|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.gcube.contentmanagement.storagelayer.StorageManager
public class StorageManager
The library implementation of the storage managment functionality
Field Summary | |
---|---|
static boolean |
initialized
|
static CredentialsProvider |
provider
|
Constructor Summary | |
---|---|
StorageManager()
|
Method Summary | |
---|---|
static void |
addReference(java.lang.String sourceObjectID,
java.lang.String targetObjectID,
java.lang.String role,
java.lang.String secondaryRole,
int position,
java.lang.String propagationRule)
Adds a new reference between two information objects. |
static void |
associateRawContent(java.lang.String objectID,
byte[] rawContent,
BasicStorageHints hints)
Gets the file from the defined location and stores it as the raw content of a information object. |
static void |
associateRawContent(java.lang.String objectID,
java.lang.String fileLocation,
BasicStorageHints hints)
Gets the file from the defined location and stores it as the raw content of a information object. |
static long |
countReferences(java.lang.String oid,
boolean isSource,
java.lang.String role,
java.lang.String secondaryRole)
Counts the references of an object |
static java.lang.String |
createInfoObject(java.lang.String name,
java.lang.String type,
BasicStorageHints hints)
Creates a new information object. |
static void |
deleteContentLengthInformation(java.lang.String objectID)
|
static void |
ensureInit()
Internal method to ensure that the Storage Manager has been initialized. |
static boolean |
existsInfoObject(java.lang.String oid)
Checks, whether an information object with the given ID exists. |
static boolean |
existsReference(java.lang.String sourceoid,
java.lang.String targetoid,
java.lang.String role,
java.lang.String secondaryRole)
|
static BasicInfoObjectDescription |
getInfoObject(java.lang.String objectID,
java.lang.String targetFileLocation,
BasicStorageHints hints)
Retrieves an existing information object and associated data |
static RawFileContentManager |
getManagerForDataProvider(java.lang.String dataProvider)
|
static boolean |
hasRawContent(java.lang.String objectID)
Returns whether there exists raw content associated with an information object |
static boolean |
hasStorageProperty(java.lang.String oid,
java.lang.String name)
Returnes whether an information object has a particular property set |
static void |
init(java.io.File configDir,
GCUBEServiceContext ctx)
Initializes the Storage Manager. |
static boolean |
removeInfoObject(java.lang.String objectID)
Deletes an information object. |
static boolean |
removeRawContent(java.lang.String objectID,
BasicStorageHints hints)
Removes any raw content associated with the information object |
static boolean |
removeReference(java.lang.String sourceObjectID,
java.lang.String targetObjectID,
java.lang.String role,
java.lang.String secondaryRole)
Deletes any reference with having the given parameters. CAUTION: This may delete also referenced information objects and cascade those deletions, depending on the propagation rules. |
static java.util.List<java.lang.String> |
retrieveObjectIDsByStorageProperty(java.lang.String name,
java.lang.String value)
Retrieves all object IDs of information object for which a particular property value has been set |
static java.util.Map<java.lang.String,BasicPropertyDescription> |
retrieveObjectStorageProperties(java.lang.String objectID)
Retrieves all properties of an information object |
static java.util.List<BasicReferenceDescription> |
retrieveReferences(java.lang.String sourceObjectID,
java.lang.String role,
java.lang.String secondaryRole)
Retrieves all references which point from this source object to some other object. |
static java.util.List<BasicReferenceDescription> |
retrieveReferencesOrderedByPosition(java.lang.String sourceObjectID,
java.lang.String role,
java.lang.String secondaryRole)
Retrieves all references which point from this source object to some other object. |
static java.util.List<BasicReferenceDescription> |
retrieveReferred(java.lang.String targetObjectID,
java.lang.String role,
java.lang.String secondaryRole)
Retrieves all references which point to this target object. |
static java.util.List<java.lang.String> |
retrieveReferredSourceOIDs(java.lang.String targetObjectID,
java.lang.String role,
java.lang.String secondaryRole)
Retrieves all object OIDs of information object, which have a reference to this target object. |
static java.util.List<java.lang.String> |
retrieveReferredTargetOIDs(java.lang.String sourceObjectID,
java.lang.String role,
java.lang.String secondaryRole)
Retrieves all object OIDs of information object, which have a reference from this source object. |
static BasicPropertyDescription |
retrieveStorageProperty(java.lang.String objectID,
java.lang.String name)
Retrieves a particular property of an information object |
static void |
setStorageProperty(java.lang.String objectID,
java.lang.String name,
java.lang.String type,
java.lang.String value)
Sets the property of a given name for a particular information object. |
static void |
unassociateAndDeleteRawContent(java.lang.String objectID,
BasicStorageHints hints)
Deletes all raw content of an information object. |
static boolean |
unsetStorageProperty(java.lang.String objectID,
java.lang.String name)
Removes a property of an information object |
static void |
updateContentLengthInformation(java.lang.String objectID,
long newLengthInformation,
boolean appended)
Updates the information about the length of the raw content, which is stored as a storage property. |
static void |
updateRawContent(java.lang.String objectID,
byte[] rawContent,
BasicStorageHints hints)
Stores new raw content of a information object. |
static void |
updateRawContent(java.lang.String objectID,
java.lang.String fileLocation,
BasicStorageHints hints)
Gets the file from the defined location and stores it as the raw content of a information object. |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static CredentialsProvider provider
public static boolean initialized
Constructor Detail |
---|
public StorageManager()
Method Detail |
---|
public static void init(java.io.File configDir, GCUBEServiceContext ctx)
public static java.lang.String createInfoObject(java.lang.String name, java.lang.String type, BasicStorageHints hints) throws StorageLayerException
name
- a human readable name (does not need to be unique, can also be null)type
- the type of the information objecthints
- hints that should be taken into account
StorageLayerException
- if something goes wrongpublic static boolean removeInfoObject(java.lang.String objectID) throws StorageLayerException
objectID
- the object ID of the object that should be deleted
true
, if object has been deleted successfully;false
if the object did not exist and therefore the operation had no effect.
StorageLayerException
- if something goes wrongpublic static boolean hasRawContent(java.lang.String objectID) throws StorageLayerException
objectID
- the object ID of the information object
true
, if there is raw content; false
otherwise
StorageLayerException
- if something goes wrongpublic static BasicInfoObjectDescription getInfoObject(java.lang.String objectID, java.lang.String targetFileLocation, BasicStorageHints hints) throws StorageLayerException
objectID
- the object ID of the object that should be deletedtargetFileLocation
- a URI where raw content should be transferred (if present), use DO_NOT_TRANFER_RAW_CONTENT
if raw content is not wantedhints
- recommendation, how a source should be selected (if several are availble)
StorageLayerException
- if something goes wrongpublic static boolean existsInfoObject(java.lang.String oid) throws StorageLayerException
oid
- the object ID of the object
StorageLayerException
- if something goes wrongpublic static boolean existsReference(java.lang.String sourceoid, java.lang.String targetoid, java.lang.String role, java.lang.String secondaryRole) throws StorageLayerException
StorageLayerException
public static void associateRawContent(java.lang.String objectID, byte[] rawContent, BasicStorageHints hints) throws StorageLayerException
objectID
- the id of the information object, to which the file should be associatedrawContent
- the content of the filehints
- recommendation, how the this file should be stored
StorageLayerException
- if something goes wrongpublic static void associateRawContent(java.lang.String objectID, java.lang.String fileLocation, BasicStorageHints hints) throws StorageLayerException
objectID
- the id of the information object, to which the file should be
associatedfileLocation
- the location from which the file can be retrievedhints
- recommendation, how the this file should be stored
StorageLayerException
- if something goes wrongpublic static void updateRawContent(java.lang.String objectID, byte[] rawContent, BasicStorageHints hints) throws StorageLayerException
objectID
- the id of the information object, to which the file should be
associatedrawContent
- the content of the filehints
- recommendation, how the this file should be stored
StorageLayerException
- if something goes wrongpublic static void updateRawContent(java.lang.String objectID, java.lang.String fileLocation, BasicStorageHints hints) throws StorageLayerException
objectID
- the id of the information object, to which the file should be
associatedfileLocation
- the location from which the file can be retrieved, if this is
set to BasicInfoObjectDescription.RAW_CONTENT_DO_NOT_TRANFER,
any previously associated content will be removed.hints
- recommendation, how the this file should be stored
StorageLayerException
- if something goes wrongpublic static void unassociateAndDeleteRawContent(java.lang.String objectID, BasicStorageHints hints) throws StorageLayerException
objectID
- the object id of the information object, of which the content
should be deletedhints
- storage hints (if any)
StorageLayerException
- in case of a failurepublic static boolean removeRawContent(java.lang.String objectID, BasicStorageHints hints) throws StorageLayerException
objectID
- the id of the information object
StorageLayerException
- if something goes wrongpublic static void addReference(java.lang.String sourceObjectID, java.lang.String targetObjectID, java.lang.String role, java.lang.String secondaryRole, int position, java.lang.String propagationRule) throws StorageLayerException
sourceObjectID
- the object ID of the starting information object of the relationtargetObjectID
- the object Id of the referenced information objectrole
- the role of the information object (sourceObject) with respect to this referencesecondaryRole
- similar to role, but for the secondary role used by Metadata Catalogposition
- an attribute to allow for position preserving representation, set to ReferenceDescription.UNDEFINED_POSITION
if not in use.propagationRule
- rule for propagation of deletion.
StorageLayerException
- if something goes wrongorg.gcube.contentmanagement.layerindependent.descriptions.BasicReferenceDescription
public static boolean removeReference(java.lang.String sourceObjectID, java.lang.String targetObjectID, java.lang.String role, java.lang.String secondaryRole) throws StorageLayerException
sourceObjectID
- the object ID of the starting information object of the
relationtargetObjectID
- the object Id of the referenced information objectrole
- the role of the information object (sourceoid) with respect
this reference. Can be set to
ReferenceDescription.ANY_ROLE
to match all
possible values of role.secondaryRole
- similar to role, but for the secondary role used by Metadata
Catalog
StorageLayerException
- if something goes wrongpublic static java.util.List<BasicReferenceDescription> retrieveReferences(java.lang.String sourceObjectID, java.lang.String role, java.lang.String secondaryRole) throws StorageLayerException
sourceObjectID
- the object ID of the starting information object of the relationrole
- the role of the information object (sourceoid) with respect this reference.
Can be set to ReferenceDescription.ANY_ROLE
to match all possible values of role.secondaryRole
- similar to role, but for the secondary role used by Metadata Catalog
ReferenceDescription
representing all references
StorageLayerException
- if something goes wrongpublic static java.util.List<BasicReferenceDescription> retrieveReferencesOrderedByPosition(java.lang.String sourceObjectID, java.lang.String role, java.lang.String secondaryRole) throws StorageLayerException
sourceObjectID
- the object ID of the starting information object of the relationrole
- the role of the information object (sourceoid) with respect this reference.
Can be set to ReferenceDescription.ANY_ROLE
to match all possible values of role.secondaryRole
- similar to role, but for the secondary role used by Metadata Catalog
StorageLayerException
- if something goes wrongpublic static java.util.List<BasicReferenceDescription> retrieveReferred(java.lang.String targetObjectID, java.lang.String role, java.lang.String secondaryRole) throws StorageLayerException
targetObjectID
- the object Id of the referenced information objectrole
- the role of the information object (sourceoid) with respect this reference.
Can be set to ReferenceDescription.ANY_ROLE
to match all possible values of role.secondaryRole
- similar to role, but for the secondary role used by Metadata Catalogreferences
- a collection to which ReferenceDescription
representing all references shall be added
StorageLayerException
- if something goes wrongpublic static java.util.List<java.lang.String> retrieveReferredSourceOIDs(java.lang.String targetObjectID, java.lang.String role, java.lang.String secondaryRole) throws StorageLayerException
targetObjectID
- the object Id of the referenced information objectrole
- the role of the information object (sourceoid) with respect
this reference. Can be set to
ReferenceDescription.ANY_ROLE
to match all
possible values of role.secondaryRole
- similar to role, but for the secondary role used by Metadata
Catalogoids
- a collection to which the OIDs shall be added
StorageLayerException
- if something goes wrongpublic static java.util.List<java.lang.String> retrieveReferredTargetOIDs(java.lang.String sourceObjectID, java.lang.String role, java.lang.String secondaryRole) throws StorageLayerException
sourceObjectID
- the object Id of the reference source information objectrole
- the role of the information object (sourceoid) with respect
this reference. Can be set to
ReferenceDescription.ANY_ROLE
to match all
possible values of role.secondaryRole
- similar to role, but for the secondary role used by Metadata
Catalogoids
- a collection to which the OIDs shall be added
StorageLayerException
- if something goes wrongpublic static long countReferences(java.lang.String oid, boolean isSource, java.lang.String role, java.lang.String secondaryRole) throws StorageLayerException
oid
- the oid of the known objectisSource
- true, if oid is the object ID of the source object, false if
oid is the target oidrole
- the role, or ReferenceDescription.ANY_ROLE
secondaryRole
- similar to role, but for the secondary role used by Metadata
Catalog
StorageLayerException
- if something goes wrongpublic static void setStorageProperty(java.lang.String objectID, java.lang.String name, java.lang.String type, java.lang.String value) throws StorageLayerException
If this property already exists, it will be updated. If not, it will be added with the given values.
objectID
- the object ID of the information objectname
- the name of the property (use prefixes, e.g. namespace prefixes to disambiguate)value
- the value of the property
StorageLayerException
- if something goes wrongpublic static boolean unsetStorageProperty(java.lang.String objectID, java.lang.String name) throws StorageLayerException
objectID
- the object ID of the information objectname
- the name of the property
StorageLayerException
- if something goes wrongpublic static java.util.Map<java.lang.String,BasicPropertyDescription> retrieveObjectStorageProperties(java.lang.String objectID) throws StorageLayerException
objectID
- the object ID of the information object
PropertyDescription
shall be added, key is the property name
StorageLayerException
- if something goes wrongpublic static BasicPropertyDescription retrieveStorageProperty(java.lang.String objectID, java.lang.String name) throws StorageLayerException
objectID
- the object ID of the information objectname
- the name of the property
StorageLayerException
- if something goes wrongpublic static boolean hasStorageProperty(java.lang.String oid, java.lang.String name) throws StorageLayerException
oid
- the object ID of the information objectname
- the name of the property
ObjectNotFoundException
- if the OID is invalid
StorageLayerException
- if something goes wrongpublic static java.util.List<java.lang.String> retrieveObjectIDsByStorageProperty(java.lang.String name, java.lang.String value) throws StorageLayerException
name
- the name of the propertyvalue
- the value of the propertyoids
- a collection to which the OIDs shall be added
StorageLayerException
- if something goes wrongpublic static void updateContentLengthInformation(java.lang.String objectID, long newLengthInformation, boolean appended) throws StorageLayerException
objectID
- OID of the information object, to which raw content is
associatednewLengthInformation
- the number of bytes, negativ values imply that length
information should be deleted instead of updatedappended
- if true, content has been appended and therefore new length
information should be added to the old value; if false, old
information willl simply be overwritten
StorageLayerException
- if something goes wrongpublic static void deleteContentLengthInformation(java.lang.String objectID) throws StorageLayerException
StorageLayerException
public static void ensureInit()
public static RawFileContentManager getManagerForDataProvider(java.lang.String dataProvider)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |