Package org.cyclos.impl.storage
Interface StoredFileContentManager
-
- All Superinterfaces:
CustomBean
- All Known Implementing Classes:
AmazonS3StoredFileContentManagerImpl,DbStoredFileContentManagerImpl,FsStoredFileContentManagerImpl,GoogleCloudStoredFileContentManagerImpl
public interface StoredFileContentManager extends CustomBean
Custom interface for the management ofStoredFile's contents.
You can create a new implementation of this interface and configure it in the cyclos.properties if you want to use your own storage different from those offered out of the box: database, file and Amazon S3.
This interface is not intended to be used directly from the services, instead the services will interact through theStoredFileHandler. Moreover, the implementation of this manager is not automatically published in the script's context. The metadata parameter used in the methods contains information needed to locate a content and its type/format is implementation-dependent.
-
-
Field Summary
Fields Modifier and Type Field Description static StringSTORAGE_DIRECTORIES_PROPERTYProperty containing the list of directory names (comma separated) available for store an individual document or a custom field of type image/file configured in the cyclos.properties.
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description SaveStoredFileContentActioncopy(String storageDirectory, Object sourceMetadata)Copies the content from the specified source, optionally in a specific directory, and returns the metadata of the copy.StringgetKey(StoredFile storedFile)Returns a unique key associated to the specifiedStoredFile(Commonly a String representation of the metadata)ObjectgetMetadata(StoredFile storedFile)Returns the content metadata associated to the specifiedStoredFiledefault booleanisStoredOnDB()Returns whether files are stored on the database itselfSerializableInputStreamopen(Object metadata)Opens a stream from the specified metadata to read the content from.StoredFileContentActionremove(Object metadata)Removes the specified content.booleanrequiresPersistentStoredFileToSetMetadata()Returns whether thesetMetadata(StoredFile, Object)requires theStoredFileto be persisted or notvoidsetMetadata(StoredFile storedFile, Object metadata)Sets the content metadata to the specifiedStoredFile.SaveStoredFileContentActionstore(String storageDirectory, SerializableInputStream in)Stores a new content, optionally in a specific directory, and returns the content's metadata.booleansupportStorageDirectories()Returns true if the underlying implementation support store files in a specific directory other than the default
-
-
-
Field Detail
-
STORAGE_DIRECTORIES_PROPERTY
static final String STORAGE_DIRECTORIES_PROPERTY
Property containing the list of directory names (comma separated) available for store an individual document or a custom field of type image/file configured in the cyclos.properties.- See Also:
- Constant Field Values
-
-
Method Detail
-
copy
SaveStoredFileContentAction copy(String storageDirectory, Object sourceMetadata) throws StoredFileException
Copies the content from the specified source, optionally in a specific directory, and returns the metadata of the copy.- Throws:
StoredFileException
-
getKey
String getKey(StoredFile storedFile) throws StoredFileException
Returns a unique key associated to the specifiedStoredFile(Commonly a String representation of the metadata)- Throws:
StoredFileException
-
getMetadata
Object getMetadata(StoredFile storedFile) throws StoredFileException
Returns the content metadata associated to the specifiedStoredFile- Throws:
StoredFileException
-
isStoredOnDB
default boolean isStoredOnDB()
Returns whether files are stored on the database itself
-
open
SerializableInputStream open(Object metadata) throws StoredFileException
Opens a stream from the specified metadata to read the content from.- Throws:
StoredFileException
-
remove
StoredFileContentAction remove(Object metadata) throws StoredFileException
Removes the specified content.- Throws:
StoredFileException
-
requiresPersistentStoredFileToSetMetadata
boolean requiresPersistentStoredFileToSetMetadata()
Returns whether thesetMetadata(StoredFile, Object)requires theStoredFileto be persisted or not
-
setMetadata
void setMetadata(StoredFile storedFile, Object metadata) throws StoredFileException
Sets the content metadata to the specifiedStoredFile.- Throws:
StoredFileException
-
store
SaveStoredFileContentAction store(String storageDirectory, SerializableInputStream in) throws StoredFileException
Stores a new content, optionally in a specific directory, and returns the content's metadata.- Throws:
StoredFileException
-
supportStorageDirectories
boolean supportStorageDirectories()
Returns true if the underlying implementation support store files in a specific directory other than the default
-
-