org.gcube.contentmanagement.baselayer
Class RawContentLocationSelectionStrategy

java.lang.Object
  extended by org.gcube.contentmanagement.baselayer.RawContentLocationSelectionStrategy

public abstract class RawContentLocationSelectionStrategy
extends java.lang.Object

The content selection strategy defines in case that more than one location exists, which one should be used to operate on content.

Author:
michaelspringmann

Constructor Summary
RawContentLocationSelectionStrategy()
           
 
Method Summary
abstract  BaseLayerStream retrieveFromPreferredLocation(java.util.List<RawContentLocation> locations, BasicStorageHints storageHints)
          Retrieves content from a location based on the strategies preferences and the given hints.
 RawContentLocation saveAtPreferredLocation(java.lang.String objectID, BaseLayerStream bls, BasicStorageHints storageHints)
          Saves content at a location, which is selected based on the strategies preferences and the given hints.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

RawContentLocationSelectionStrategy

public RawContentLocationSelectionStrategy()
Method Detail

retrieveFromPreferredLocation

public abstract BaseLayerStream retrieveFromPreferredLocation(java.util.List<RawContentLocation> locations,
                                                              BasicStorageHints storageHints)
                                                       throws BaseLayerException
Retrieves content from a location based on the strategies preferences and the given hints.

It is up to te strategy, which hints it evaluates and which not.

Parameters:
locations - the location available for the content
storageHints - the hints for selecting the location. All hints that have been evaluated will be marked as consumed.
Returns:
A stream to the content
Throws:
BaseLayerException - if something goes wrong

saveAtPreferredLocation

public RawContentLocation saveAtPreferredLocation(java.lang.String objectID,
                                                  BaseLayerStream bls,
                                                  BasicStorageHints storageHints)
                                           throws BaseLayerException
Saves content at a location, which is selected based on the strategies preferences and the given hints.

It is up to te strategy, which hints it evaluates and which not.

Parameters:
objectID - a recommended ID suggested for storing. The strategy is free to use this or come up with one of it's own.
storageHints - the hints for selecting the location. All hints that have been evaluated will be marked as consumed.
bls - the stream containing the content that should be written.
Returns:
the raw content location where the actual content has been stored and can now be retrieved.
Throws:
BaseLayerException - if something goes wrong