org.mycore.backend.filesystem
Class MCRCStoreVFS

java.lang.Object
  extended by org.mycore.datamodel.ifs.MCRContentStore
      extended by org.mycore.backend.filesystem.MCRCStoreVFS

public class MCRCStoreVFS
extends MCRContentStore

This class implements the MCRContentStore interface to store the content of MCRFile objects on any filesystem supported by the Apache Jakarta Commons VFS. The connection URI is configured in mycore.properties: MCR.IFS.ContentStore..URI the base directory in Apache Commons VFS syntax Local filesystem: [file://]/absolute-path FTP Server: ftp://[username[:password]@]hostname[:port][/absolute-path] SFTP / SCP / SSH Server: sftp://[username[:password]@]hostname[:port][/absolute-path] CIFS / Samba / Windows share: smb://[username[:password]@]hostname[:port][/absolute-path] MCR.IFS.ContentStore..StrictHostKeyChecking=yes|no for SFTP: controls the use of known_hosts file, default is "no"

Version:
$Revision: 14585 $ $Date: 2009-01-09 16:03:37 +0100 (Fri, 09 Jan 2009) $
Author:
Werner Greßhoff, Frank Lützenkirchen

Field Summary
 
Fields inherited from class org.mycore.datamodel.ifs.MCRContentStore
formatter, lastTimestamp, prefix, slotDirDepth, storeID
 
Constructor Summary
MCRCStoreVFS()
           
 
Method Summary
protected  void doDeleteContent(String storageId)
          Deletes the content of an MCRFile object that is stored under the given Storage ID in this store instance.
protected  InputStream doRetrieveContent(MCRFileReader file)
          Retrieves the content of an MCRFile.
protected  void doRetrieveContent(MCRFileReader file, OutputStream target)
          Retrieves the content of an MCRFile to an OutputStream.
protected  String doStoreContent(MCRFileReader file, MCRContentInputStream source)
          Stores the content of an MCRFile by reading from an MCRContentInputStream.
protected  org.apache.commons.vfs.FileObject getBase()
           
 void init(String storeId)
          Initializes the store and sets its unique store ID.
 
Methods inherited from class org.mycore.datamodel.ifs.MCRContentStore
buildNextID, buildNextTimestamp, buildSlotPath, deleteContent, getID, retrieveContent, retrieveContent, storeContent
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

MCRCStoreVFS

public MCRCStoreVFS()
Method Detail

doStoreContent

protected String doStoreContent(MCRFileReader file,
                                MCRContentInputStream source)
                         throws Exception
Description copied from class: MCRContentStore
Stores the content of an MCRFile by reading from an MCRContentInputStream. Returns a StorageID to indentify the place where the content was stored.

Specified by:
doStoreContent in class MCRContentStore
Parameters:
file - the MCRFile thats content is to be stored
source - the ContentInputStream where the file content is read from
Returns:
an ID that indentifies the place where the content was stored
Throws:
Exception

doDeleteContent

protected void doDeleteContent(String storageId)
                        throws Exception
Description copied from class: MCRContentStore
Deletes the content of an MCRFile object that is stored under the given Storage ID in this store instance.

Specified by:
doDeleteContent in class MCRContentStore
Parameters:
storageId - the storage ID of the MCRFile object
Throws:
Exception

doRetrieveContent

protected void doRetrieveContent(MCRFileReader file,
                                 OutputStream target)
                          throws Exception
Description copied from class: MCRContentStore
Retrieves the content of an MCRFile to an OutputStream. Uses the StorageID to indentify the place where the file content was stored in this store instance.

Specified by:
doRetrieveContent in class MCRContentStore
Parameters:
file - the MCRFile thats content should be retrieved
target - the OutputStream to write the file content to
Throws:
Exception

doRetrieveContent

protected InputStream doRetrieveContent(MCRFileReader file)
                                 throws Exception
Description copied from class: MCRContentStore
Retrieves the content of an MCRFile. Uses the StorageID to indentify the place where the file content was stored in this store instance.

Specified by:
doRetrieveContent in class MCRContentStore
Parameters:
file - the MCRFile thats content should be retrieved
Throws:
Exception

getBase

protected org.apache.commons.vfs.FileObject getBase()
                                             throws org.apache.commons.vfs.FileSystemException
Throws:
org.apache.commons.vfs.FileSystemException

init

public void init(String storeId)
Description copied from class: MCRContentStore
Initializes the store and sets its unique store ID. MCRFiles must remember this ID to indentify the store that holds their file content. The store ID is set by MCRContentStoreFactory when a new store instance is built. Subclasses should override this method.

Overrides:
init in class MCRContentStore
Parameters:
storeId - the non-null unique store ID for this store instance