|
SMILA (incubation) API documentation | ||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectorg.eclipse.smila.objectstore.filesystem.SimpleObjectStoreService
public class SimpleObjectStoreService
A file system based implementation of ObjectStoreService.
The following rules apply to this store implementation:
getStoreObjectInfos(String, String).SimpleStoreOutputStream is closed or an
invocation of writeObject(String, String) method succeeded.
appendToObject(String, String, byte[]) method will append directly to
the visible object.
| Field Summary | |
|---|---|
static java.lang.String |
BUNDLE_ID
The Constant BUNDLE_ID. |
static java.lang.String |
PROPERTY_FILE_LOCKING
property for file locking requested. |
static java.lang.String |
PROPERTY_ROOT_PATH
property for root of object store. |
static java.lang.String |
VALID_STORENAME_EXPRESSION
the regular expression to determine whether store names are valid. |
| Fields inherited from interface org.eclipse.smila.objectstore.ObjectStoreService |
|---|
KEY_OBJECT_COUNT, KEY_OBJECTS, KEY_SIZE, KEY_STORE_NAME, KEY_STORE_PROPERTIES |
| Constructor Summary | |
|---|---|
SimpleObjectStoreService()
|
|
| Method Summary | |
|---|---|
protected void |
activate(ComponentContext context)
Cleans the temporary stores that were open when the system went down. |
void |
appendToObject(java.lang.String storeName,
java.lang.String objectId,
byte[] data)
append the data to the given store and object. |
void |
clearStore(java.lang.String storeName)
Remove all objects from the named store. |
void |
createStore(java.lang.String storeName,
AnyMap storeProperties)
Creates a store with the given configuration properties. |
void |
ensureStore(java.lang.String storeName)
Ensures that a store with the given name existing, regardless of the exact configuration properties. |
boolean |
existsObject(java.lang.String storeName,
java.lang.String objectId)
|
boolean |
existsStore(java.lang.String storeName)
|
void |
finishObject(java.lang.String storeName,
java.lang.String objectId)
Prevent further append calls to this object. |
byte[] |
getObject(java.lang.String storeName,
java.lang.String objectId)
get the complete content of an object. |
StoreObject |
getObjectInfo(java.lang.String storeName,
java.lang.String objectId)
get information about a single object. |
AnyMap |
getStoreInfo(java.lang.String storeName,
boolean includeObjectInfos)
get a description of the current store state to be displayed in administration tools (e.g. |
java.util.Collection<java.lang.String> |
getStoreNames()
|
java.util.Collection<StoreObject> |
getStoreObjectInfos(java.lang.String storeName)
Get information about all current objects in the named store. |
java.util.Collection<StoreObject> |
getStoreObjectInfos(java.lang.String storeName,
java.lang.String objectIdPrefix)
Get information about all current objects in the named store that have an ID that starts with the given prefix. |
AnyMap |
getStoreProperties(java.lang.String storeName)
get configuration properties of the named store. |
boolean |
isFileLockingRequested()
|
boolean |
isValidStoreName(java.lang.String storeName)
Check if the argument is a valid store name for this service implementation. |
void |
putObject(java.lang.String storeName,
java.lang.String objectId,
byte[] data)
write the data to the given store and object. |
java.io.InputStream |
readObject(java.lang.String storeName,
java.lang.String objectId)
get a stream for reading the object content. |
void |
removeAllStores()
remove all stores from the service. |
void |
removeObject(java.lang.String storeName,
java.lang.String objectId)
remove the object from the store.No exception is thrown if the object does not exist in the store currently (however, there is one if the store itself does not exist). |
void |
removeStore(java.lang.String storeName)
remove a store completely, if it exists. |
protected void |
setFileLockingRequested(boolean fileLocking)
Sets whether file locking is requested. |
protected void |
validateStore(java.lang.String storeName)
Validates that the store name is valid and a store with the given name exists, throws an exception if it does not exist. |
protected void |
validateStoreName(java.lang.String storeName)
Validates that the storeName is a valid one, throws an exception if it does not exist. |
StoreOutputStream |
writeObject(java.lang.String storeName,
java.lang.String objectId)
open a stream for creating a data object and writing it. |
protected void |
writeToObject(java.lang.String storeName,
java.lang.String objectId,
byte[] data)
Puts data to an object in the store. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public static final java.lang.String VALID_STORENAME_EXPRESSION
public static final java.lang.String BUNDLE_ID
public static final java.lang.String PROPERTY_ROOT_PATH
public static final java.lang.String PROPERTY_FILE_LOCKING
| Constructor Detail |
|---|
public SimpleObjectStoreService()
| Method Detail |
|---|
protected void activate(ComponentContext context)
throws java.io.IOException
java.io.IOException - errors creating working dir.
public java.util.Collection<java.lang.String> getStoreNames()
throws ObjectStoreException
getStoreNames in interface ObjectStoreServiceObjectStoreException - on error.
public void ensureStore(java.lang.String storeName)
throws ObjectStoreException
ensureStore in interface ObjectStoreServiceInvalidStoreNameException - if the store name is not valid.
ObjectStoreException - other errorspublic boolean isValidStoreName(java.lang.String storeName)
isValidStoreName in interface ObjectStoreService
public void createStore(java.lang.String storeName,
AnyMap storeProperties)
throws ObjectStoreException
null, the service chooses
default properties on its own.
createStore in interface ObjectStoreServicestoreName - name of store to createstoreProperties - store configuration, may be null.
InvalidStoreNameException - if the store name is not valid.
StoreExistsException - if a store with this name exists already.
ObjectStoreException - other errors.
public AnyMap getStoreProperties(java.lang.String storeName)
throws ObjectStoreException
getStoreProperties in interface ObjectStoreServiceInvalidStoreNameException - if the store name is not valid.
ObjectStoreException - error reading store properties.
public AnyMap getStoreInfo(java.lang.String storeName,
boolean includeObjectInfos)
throws ObjectStoreException
includeObjectInfos == true. It
can contain additional information.
getStoreInfo in interface ObjectStoreServiceincludeObjectInfos - set to true to include the list of current object infos in the result.
InvalidStoreNameException - if the store name is not valid.
NoSuchStoreException - if the store does not exist
ObjectStoreException - error reading store properties.
public boolean existsStore(java.lang.String storeName)
throws ObjectStoreException
existsStore in interface ObjectStoreServiceInvalidStoreNameException - if the store name is not valid.
ObjectStoreException - some error.
public void removeStore(java.lang.String storeName)
throws ObjectStoreException
removeStore in interface ObjectStoreServiceInvalidStoreNameException - if the store name is not valid.
ObjectStoreException - error deleting the store.
public void removeAllStores()
throws ObjectStoreException
removeAllStores in interface ObjectStoreServiceObjectStoreException - error removing the data.
public void clearStore(java.lang.String storeName)
throws ObjectStoreException
clearStore in interface ObjectStoreServiceInvalidStoreNameException - if the store name is not valid.
NoSuchStoreException - if the store does not exist.
ObjectStoreException - error clearing the store.
public java.util.Collection<StoreObject> getStoreObjectInfos(java.lang.String storeName)
throws ObjectStoreException
getStoreObjectInfos in interface ObjectStoreServiceStoreObjects
InvalidStoreNameException - if the store name is not valid.
NoSuchStoreException - if the store does not exist
ObjectStoreException - error determining the object info list.
public java.util.Collection<StoreObject> getStoreObjectInfos(java.lang.String storeName,
java.lang.String objectIdPrefix)
throws ObjectStoreException
getStoreObjectInfos in interface ObjectStoreServiceStoreObjects with IDs matching the prefix.
InvalidStoreNameException - if the store name is not valid.
NoSuchStoreException - if the store does not exist
ObjectStoreException - error determining the object info list.
public byte[] getObject(java.lang.String storeName,
java.lang.String objectId)
throws ObjectStoreException
getObject in interface ObjectStoreServiceInvalidStoreNameException - if the store name is not valid.
NoSuchStoreException - if the store does not exist
NoSuchObjectException - if the object does not exist
ObjectStoreException - other error reading the object
public java.io.InputStream readObject(java.lang.String storeName,
java.lang.String objectId)
throws ObjectStoreException
readObject in interface ObjectStoreServiceInvalidStoreNameException - if the store name is not valid.
NoSuchStoreException - if the store does not exist
NoSuchObjectException - if the object does not exist
ObjectStoreException - other error reading the object
public void putObject(java.lang.String storeName,
java.lang.String objectId,
byte[] data)
throws ObjectStoreException
putObject in interface ObjectStoreServiceInvalidStoreNameException - if the store name is not valid.
NoSuchStoreException - if the store does not exist
ObjectStoreException - other error reading the object
public void appendToObject(java.lang.String storeName,
java.lang.String objectId,
byte[] data)
throws ObjectStoreException
appendToObject in interface ObjectStoreServiceInvalidStoreNameException - if the store name is not valid.
NoSuchStoreException - if the store does not exist
ObjectStoreException - other error reading the object
public boolean existsObject(java.lang.String storeName,
java.lang.String objectId)
throws ObjectStoreException
existsObject in interface ObjectStoreServiceInvalidStoreNameException - if the store name is not valid.
NoSuchStoreException - if the store does not exist
ObjectStoreException - error checking object existence.
public void removeObject(java.lang.String storeName,
java.lang.String objectId)
throws ObjectStoreException
removeObject in interface ObjectStoreServiceInvalidStoreNameException - if the store name is not valid.
NoSuchStoreException - if the store does not exist
ObjectStoreException - error removing the object.
public StoreObject getObjectInfo(java.lang.String storeName,
java.lang.String objectId)
throws ObjectStoreException
getObjectInfo in interface ObjectStoreServiceInvalidStoreNameException - if the store name is not valid.
NoSuchStoreException - if the store does not exist.
NoSuchObjectException - if the object does not exist in the store.
ObjectStoreException - error reading the object info.
public void finishObject(java.lang.String storeName,
java.lang.String objectId)
throws ObjectStoreException
ObjectStoreService.appendToObject(String, String, byte[]). The operation is optional:
An implementation may choose not to support it, in this case it should just ignore the call and not throw an
exception. However, in some pathological situations this may lead to data loss, because data could be appended for
processing when the object is already considered as finished and the next processing steps have been started and
miss the latest appends.
This method is not supported in SimpleObjectStoreService.
finishObject in interface ObjectStoreServiceInvalidStoreNameException - if the store name is not valid.
NoSuchStoreException - if the store does not exist
ObjectStoreExceptionprotected void setFileLockingRequested(boolean fileLocking)
fileLocking - 'true' if file locking is requested, 'false' if not.public boolean isFileLockingRequested()
protected void validateStore(java.lang.String storeName)
throws ObjectStoreException
storeName - the name of the store to check.
ObjectStoreException - validation failed.
protected void validateStoreName(java.lang.String storeName)
throws InvalidStoreNameException
storeName - the name to check.
InvalidStoreNameException - validation failed.
protected void writeToObject(java.lang.String storeName,
java.lang.String objectId,
byte[] data)
throws ObjectStoreException
storeName - the name of the storeobjectId - the object iddata - the data to put (or append to) the object
ObjectStoreException
public StoreOutputStream writeObject(java.lang.String storeName,
java.lang.String objectId)
throws ObjectStoreException
StoreOutputStream.abort() before
closing the stream.
writeObject in interface ObjectStoreServiceInvalidStoreNameException - if the store name is not valid.
NoSuchStoreException - if the store does not exist
ObjectStoreException - error creating the object.
|
SMILA (incubation) API documentation | ||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||