org.gcube.contentmanagement.baselayer
Interface RawFileContentManager

All Known Implementing Classes:
CoGFTPContentManager, CommonsHTTPClientPseudeContentManager, FTPPseudoContentManager, GenericJDBCDatabase, GFALRawContentManager, GridFTPContentManager, HTTPPseudoContentManager, InMemoryContentManager, LocalFilesystemHandler, LocalFilesystemStorage

public interface RawFileContentManager

Manager for raw file content

Author:
michaelspringmann

Method Summary
 boolean deleteBinaryContent(RawContentLocation location, BasicStorageHints hints)
          Removes the binary content from storage
 boolean existsBinaryContent(RawContentLocation location, BasicStorageHints hints)
          Checks whether there is content at this location
 BaseLayerStream getBinaryContent(RawContentLocation location, BasicStorageHints hints)
          Opens the content for reading and passes the input stream to the caller
 java.lang.String getDataProvider()
           
 java.lang.String getUniqueStorageLocationIDFor(java.lang.String objectID)
           
 boolean handles(java.lang.String dataprovider)
          Checks whether the RawFileContentManager can handle this data.
 RawContentLocation makePermanentLocation(RawContentLocation currentLocation, BasicStorageHints hints)
          Returns a raw location, which can be stored and retrieved later without the need to pass again all the hints.
 RawContentLocation saveBinaryContent(java.lang.String uniqueStorageID, BaseLayerStream binaryFileContent, BasicStorageHints hints)
          Saves the passed binary content in the managed resource.
 boolean supportsAppending()
          Tells whether this content manager supports appending content in addition to overwriting the content when storing
 

Method Detail

saveBinaryContent

RawContentLocation saveBinaryContent(java.lang.String uniqueStorageID,
                                     BaseLayerStream binaryFileContent,
                                     BasicStorageHints hints)
                                     throws BaseLayerException
Saves the passed binary content in the managed resource. If the resource did previously exist, it is updated and the old content is lost. If the resource did not exist, it will be newly created.

Parameters:
binaryFileContent - the content to store
uniqueStorageID - a unique ID to as a hint where to store the content
hints - the hints that should be used
Returns:
the RawContentLocation where the content is now accessible
Throws:
BaseLayerException - in case of failure of underlying storage system

getBinaryContent

BaseLayerStream getBinaryContent(RawContentLocation location,
                                 BasicStorageHints hints)
                                 throws BaseLayerException
Opens the content for reading and passes the input stream to the caller

Parameters:
location - the RawContentLocation where the content is accessible
hints - the hints that should be used
Returns:
the content stored in the managed resource
Throws:
BaseLayerException - in case of failure of underlying storage system

deleteBinaryContent

boolean deleteBinaryContent(RawContentLocation location,
                            BasicStorageHints hints)
                            throws BaseLayerException
Removes the binary content from storage

Parameters:
location - the RawContentLocation where the content is accessible
hints - the hints that should be used
Returns:
true, if content has been deleted successfully; false if the content did not exist and therefore the operation had no effect.
Throws:
BaseLayerException - in case of failure of underlying storage system

existsBinaryContent

boolean existsBinaryContent(RawContentLocation location,
                            BasicStorageHints hints)
                            throws BaseLayerException
Checks whether there is content at this location

Parameters:
location - the RawContentLocation where the content is accessible
Returns:
true, if there is content at this location; false otherwise
Throws:
BaseLayerException - in case of failure of underlying storage system

handles

boolean handles(java.lang.String dataprovider)
Checks whether the RawFileContentManager can handle this data.

This means that it can handle the requests for content stored at this dataprovider. In the ideal case, this also checks if it has all required access rights. But this cannot be enforced as a strong requirement before the actual calls take place.

Parameters:
dataprovider -
Returns:
true, if it can do, false otherwise

getDataProvider

java.lang.String getDataProvider()
Returns:
a string identifying this data source

supportsAppending

boolean supportsAppending()
Tells whether this content manager supports appending content in addition to overwriting the content when storing

Returns:
true, if appending is supported
See Also:
BasicStorageHints#HINT_NAME_APPEND_CONTENT

makePermanentLocation

RawContentLocation makePermanentLocation(RawContentLocation currentLocation,
                                         BasicStorageHints hints)
                                         throws ValueNotValidException
Returns a raw location, which can be stored and retrieved later without the need to pass again all the hints.

This is of particular interest for username / password combinations.

Parameters:
currentLocation - the location, where content can be accessed currently (may require information from the hints)
hints - hints, that may be needed to request the content
Returns:
a location which can be accessed without providing again the hints. This may not always be possible.
Throws:
ValueNotValidException - If some hints was not defined correctly or there is no possibility to include that in the permanent location.

getUniqueStorageLocationIDFor

java.lang.String getUniqueStorageLocationIDFor(java.lang.String objectID)