Skip to main content
Jump to: navigation, search

Difference between revisions of "SMILA/Documentation/ObjectStore/Bundle org.eclipse.smila.objectstore"

(New page: = org.eclipse.smila.objectstore = <b>since SMILA 0.9.0</b> == ObjectStoreService == === API === <source lang="java"> public interface ObjectStoreService { /** key of store name of the...)
 
 
(13 intermediate revisions by 4 users not shown)
Line 1: Line 1:
= org.eclipse.smila.objectstore =
+
= Bundle org.eclipse.smila.objectstore =
<b>since SMILA 0.9.0</b>
+
  
== ObjectStoreService ==
+
This page gives only a rough overview of the components. Please refer to the [http://build.eclipse.org/rt/smila/javadoc/current/index.html?org/eclipse/smila/objectstore/package-summary.html JavaDoc] for specific information.
=== API ===
+
  
<source lang="java">
+
== org.eclipse.smila.objectstore.ObjectStoreService ==
public interface ObjectStoreService {
+
  
  /** key of store name of the store info. */
+
=== JavaDoc  ===
  String KEY_STORE_NAME = "storeName";
+
The JavaDoc for the <tt>ObjectStoreService</tt> API can be found at [http://build.eclipse.org/rt/smila/javadoc/current/org/eclipse/smila/objectstore/ObjectStoreService.html org.eclipse.smila.objectstore.ObjectStoreService].
  
  /** key of store properties of the store info. */
+
=== Description  ===
  String KEY_STORE_PROPERTIES = "storeProperties";
+
In SMILA, the ObjectStoreService is mainly used to store binary data during bulk processing. Data objects pertaining to this service are for example large bulks of records that are to be processed in a single step by some worker.
  
  /** key of store object count of the store info. */
+
The interface of ObjectStoreService is defined in <tt>org.eclipse.smila.objectstore.ObjectStoreService</tt>.
  String KEY_OBJECT_COUNT = "objectCount";
+
  
  /** key of store size of the store info. */
+
== org.eclipse.smila.objectstore.StoreObject  ==
  String KEY_SIZE = "size";
+
  
  /** key of store objects of the store info. */
+
=== JavaDoc  ===
  String KEY_OBJECTS = "objects";
+
The JavaDoc for the <tt>StoreObject</tt> interface can be found at [http://build.eclipse.org/rt/smila/javadoc/current/org/eclipse/smila/objectstore/StoreObject.html org.eclipse.smila.objectstore.StoreObject].
  
  // store handling methods
+
=== Description  ===
 +
A <tt>StoreObject</tt> contains information about an object in a store. Common pieces of information provided by <tt>StoreObject</tt> are:
  
  /**
+
*ID (String)
  * @return the names of all currently existing stores.
+
**Contains the ID of the object. Can be used to request the object from the store.  
  * @throws ObjectStoreException
+
*Size (long)
  *           on error.
+
**Contains the size of the object in byte.  
  */
+
*Timestamp (Date)  
  Collection<String> getStoreNames() throws ObjectStoreException;
+
**Contains the timestamp of the object. In the file system based object store implementation this is the time of the latest modification of the object.
  
  /**
+
In addition to the above, an ObjectStore implementation might add further information as required.
  * Creates a store with the given configuration properties. If properties are <code>null</code>, the service chooses
+
  * default properties on its own.
+
  *
+
  * @param storeName
+
  *          name of store to create
+
  * @param storeProperties
+
  *          store configuration, may be null.
+
  *
+
  * @throws InvalidStoreNameException
+
  *          if the store name is not valid.
+
  * @throws StoreExistsException
+
  *          if a store with this name exists already.
+
  * @throws ObjectStoreException
+
  *          other errors.
+
  */
+
  void createStore(String storeName, AnyMap storeProperties) throws ObjectStoreException;
+
  
  /**
+
== org.eclipse.smila.objectstore.StoreOutputStream  ==
  * Ensures that a store with the given name existing, regardless of the exact configuration properties. If the store
+
=== JavaDoc  ===
  * does not exist yet, it is created with some default properties.
+
The JavaDoc for the <tt>StoreOutputStream</tt> interface can be found at [http://build.eclipse.org/rt/smila/javadoc/current/org/eclipse/smila/objectstore/StoreOutputStream.html org.eclipse.smila.objectstore.StoreOutputStream].
  *
+
  * @throws InvalidStoreNameException
+
  *          if the store name is not valid.
+
  * @throws ObjectStoreException
+
  *          other errors
+
  */
+
  void ensureStore(String storeName) throws ObjectStoreException;
+
  
  /**
+
=== Description  ===
  * Check if the argument is a valid store name for this service implementation.
+
The <tt>StoreOutputStream</tt> interface defines an extension of <tt>java.io.OutputStream</tt> that allows a stream to be aborted if it has not been closed yet, meaning the content of the stream will not be visible but discarded.
  *
+
  * @return true if the string can be used as a store name, else false.
+
  */
+
  boolean isValidStoreName(String storeName);
+
  
  /**
+
As a result, the content of <tt>StoreOutputStream</tt> will only be visible after <tt>close()</tt> has been called successfully.
  * @return true if a store with this name exists, else false.
+
  * @throws InvalidStoreNameException
+
  *          if the store name is not valid.
+
  * @throws ObjectStoreException
+
  *          some error.
+
  */
+
  boolean existsStore(String storeName) throws ObjectStoreException;
+
  
  /**
+
== Exceptions defined in org.eclipse.smila.objectstore  ==
  * remove a store completely, if it exists. All objects in this store will be lost. No exception is thrown if the
+
=== JavaDoc  ===
  * store does not exists currently.
+
The JavaDoc for the exceptions defined in <tt>org.eclipse.smila.objectstore</tt> can be found at [http://build.eclipse.org/rt/smila/javadoc/current/org/eclipse/smila/objectstore/package-summary.html org.eclipse.smila.objectstore].
  *
+
  * @throws InvalidStoreNameException
+
  *          if the store name is not valid.
+
  * @throws ObjectStoreException
+
  *          error deleting the store.
+
  */
+
  void removeStore(String storeName) throws ObjectStoreException;
+
  
  /**
+
=== Description  ===
  * Get information about all current objects in the named store.
+
The individual exceptions are (in hierarchical order):
  *
+
  * @return list of {@link StoreObject}s
+
  * @throws InvalidStoreNameException
+
  *          if the store name is not valid.
+
  * @throws NoSuchStoreException
+
  *          if the store does not exist
+
  * @throws ObjectStoreException
+
  *          error determining the object info list.
+
  */
+
  Collection<StoreObject> getStoreObjectInfos(String storeName) throws ObjectStoreException;
+
  
  /**
+
*<tt>ObjectStoreException</tt>: This is the base class of all object store exceptions. There are subclasses which give more details about the exception:
  * Get information about all current objects in the named store that have an ID that starts with the given prefix.
+
**<tt>BadRequestException</tt>: Caused by invalid arguments or other conditions that render it impossible to perform the requested operation.  
  *  
+
***<tt>InvalidStoreNameException</tt>: The store name does not apply to the restrictions defined by the respective service implementation.  
  * @return list of {@link StoreObject}s with IDs matching the prefix.
+
***<tt>NoSuchObjectException</tt>: The requested object does not exist.
  * @throws InvalidStoreNameException
+
***<tt>NoSuchStoreException</tt>: The requested store does not exist.  
  *           if the store name is not valid.
+
***<tt>StoreExistsException</tt>: The store to be created already exists.
  * @throws NoSuchStoreException
+
**<tt>ServiceUnavailableException</tt>: The request could not be fulfilled by the service due to some temporary condition. The client may retry the request shortly afterwards.
  *           if the store does not exist
+
  * @throws ObjectStoreException
+
  *           error determining the object info list.
+
  */
+
  Collection<StoreObject> getStoreObjectInfos(String storeName, String objectIdPrefix) throws ObjectStoreException;
+
  
  /**
+
== Handlers in org.eclipse.smila.objectstore  ==
  * get configuration properties of the named store.
+
=== JavaDoc  ===
  *
+
The JavaDoc for the handlers of the <tt>org.eclipse.smila.objectstore</tt> bundle can be found at [http://build.eclipse.org/rt/smila/javadoc/current/org/eclipse/smila/objectstore/httphandler/package-summary.html org.eclipse.smila.objectstore.httphandler].
  * @return configuration properties.
+
  * @throws InvalidStoreNameException
+
  *          if the store name is not valid.
+
  * @throws NoSuchStoreException
+
  *          if the store does not exist
+
  * @throws ObjectStoreException
+
  *          error reading store properties.
+
  */
+
  AnyMap getStoreProperties(String storeName) throws ObjectStoreException;
+
  
  /**
+
=== Description  ===
  * get a description of the current store state to be displayed in administration tools (e.g. by an Http handler). It
+
The following handlers exist:
  * should include the store properties and the complete object list, if <code>includeObjectInfos == true</code>. It
+
  * can contain additional information.
+
  *
+
  * @param includeObjectInfos
+
  *          set to true to include the list of current object infos in the result.
+
  * @return store state information
+
  * @throws InvalidStoreNameException
+
  *          if the store name is not valid.
+
  * @throws NoSuchStoreException
+
  *          if the store does not exist
+
  * @throws ObjectStoreException
+
  *          error reading store properties.
+
  */
+
  AnyMap getStoreInfo(String storeName, boolean includeObjectInfos) throws ObjectStoreException;
+
  
  // object handling methods
+
==== ObjectStoreServiceHandler  ====
 +
This handler lists the stores handled by <tt>ObjectStoreService</tt>.
  
  /**
+
<b>Supported operations:</b>
  * get the complete content of an object. Use only if you are sure that the object is small enough to fit in memory.
+
  *
+
  * @throws InvalidStoreNameException
+
  *          if the store name is not valid.
+
  * @throws NoSuchStoreException
+
  *          if the store does not exist
+
  * @throws NoSuchObjectException
+
  *          if the object does not exist
+
  * @throws ObjectStoreException
+
  *          other error reading the object
+
  */
+
  byte[] getObject(String storeName, String objectId) throws ObjectStoreException;
+
  
  /**
+
*GET: Lists all stores handled by <tt>ObjectStoreService</tt>.
  * get a stream for reading the object content.
+
  *
+
  * @throws InvalidStoreNameException
+
  *          if the store name is not valid.
+
  * @throws NoSuchStoreException
+
  *          if the store does not exist
+
  * @throws NoSuchObjectException
+
  *          if the object does not exist
+
  * @throws ObjectStoreException
+
  *          other error reading the object
+
  */
+
  InputStream readObject(String storeName, String objectId) throws ObjectStoreException;
+
  
  /**
+
<b>Usage:</b>
  * write the data to the given store and object. If the object exists already, it is overwritten.
+
  *
+
  * @throws InvalidStoreNameException
+
  *          if the store name is not valid.
+
  * @throws NoSuchStoreException
+
  *          if the store does not exist
+
  * @throws ObjectStoreException
+
  *          other error reading the object
+
  */
+
  void putObject(String storeName, String objectId, byte[] data) throws ObjectStoreException;
+
  
  /**
+
*URL: <tt><nowiki>http://&lt;hostname&gt;:8080/smila/store/</nowiki></tt>
  * append the data to the given store and object. If the object exists already, the new data is appended at the end of
+
*Allowed methods:
  * the object. If the object does not exist already, it is created.
+
**GET (no further URL parameters and no request body allowed)
  *  
+
*Response status codes:
  * @throws InvalidStoreNameException
+
**200 OK: Upon successful execution.
  *          if the store name is not valid.
+
**500 INTERNAL SERVER ERROR: An internal error occurred.
  * @throws NoSuchStoreException
+
**503 SERVICE UNAVAILABLE: The service is currently unable to perform the requested operation, please retry later.
  *           if the store does not exist
+
  * @throws ObjectStoreException
+
  *           other error reading the object
+
  */
+
  void appendToObject(String storeName, String objectId, byte[] data) throws ObjectStoreException;
+
  
  /**
+
<b>Example:</b>
  * Prevent further append calls to this object. It does not prevent the object from being removed. It is irrelevant
+
  * for objects that were not created using {@link #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.
+
  *
+
  * @throws InvalidStoreNameException
+
  *          if the store name is not valid.
+
  * @throws NoSuchStoreException
+
  *          if the store does not exist
+
  * @throws ObjectStoreException
+
  */
+
  void finishObject(String storeName, String objectId) throws ObjectStoreException;
+
  
  /**
+
<pre>
  * open a stream for creating a data object and writing it. If the object exists already, it is overwritten. The
+
GET http://&lt;hostname&gt;:8080/smila/store/
  * object will not become visible in the store until the stream is closed. To prevent the object from becoming visible
+
200 OK
  * then (because some error has occurred and the object is invalid), call {@link StoreOutputStream#abort()} before
+
{
  * closing the stream.
+
  "stores" : [ {
  *
+
    "store" : "store1",
  * @return stream for writing data to the object.
+
    "url" : "http://localhost:8080/smila/store/store1/"
  * @throws InvalidStoreNameException
+
  }, {
  *          if the store name is not valid.
+
    "store" : "store2",
  * @throws NoSuchStoreException
+
    "url" : "http://localhost:8080/smila/store/store2/"
  *          if the store does not exist
+
  } ]
  * @throws ObjectStoreException
+
}
  *          error creating the object.
+
</pre>
  */
+
  StoreOutputStream writeObject(String storeName, String objectId) throws ObjectStoreException;
+
  
  /**
+
==== StoreAdminHandler  ====
  * @return true if object exists in store, else false.
+
This handler allows the stores handled by the <tt>ObjectStoreService</tt> to be managed or queried.  
  * @throws InvalidStoreNameException
+
  *          if the store name is not valid.
+
  * @throws NoSuchStoreException
+
  *          if the store does not exist
+
  * @throws ObjectStoreException
+
  *          error checking object existence.
+
  */
+
  boolean existsObject(String storeName, String objectId) throws ObjectStoreException;
+
  
  /**
+
<b>Supported operations:</b>
  * 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).
+
  *
+
  * @throws InvalidStoreNameException
+
  *          if the store name is not valid.
+
  * @throws NoSuchStoreException
+
  *          if the store does not exist
+
  * @throws ObjectStoreException
+
  *          error removing the object.
+
  */
+
  void removeObject(String storeName, String objectId) throws ObjectStoreException;
+
  
  /**
+
*GET: Returns the store information. Without the optional parameter <tt>returnObjects</tt> set to <tt>false</tt> also information on the contained objects will be returned.
  * get information about a single object.
+
*PUT: Creates a new store. Optional parameters can be sent as part of a JSON body.  
  *
+
*DELETE: Deletes a store. If the store does not exist, it will be ignored and 200 OK will be returned.
  * @return information about the object.
+
  * @throws InvalidStoreNameException
+
  *          if the store name is not valid.
+
  * @throws NoSuchStoreException
+
  *          if the store does not exist.
+
  * @throws NoSuchObjectException
+
  *          if the object does not exist in the store.
+
  * @throws ObjectStoreException
+
  *          error reading the object info.
+
  */
+
  StoreObject getObjectInfo(String storeName, String objectId) throws ObjectStoreException;
+
  
  /**
+
<b>Usage:</b>
  * remove all stores from the service. All data will be lost, no store will exist anymore.
+
 
  *  
+
*URL: <tt><nowiki>http://&lt;hostname&gt;:8080/smila/store/&lt;store-name&gt;/</nowiki></tt>.
  * @throws ObjectStoreException
+
*Allowed methods:
  *           error removing the data.
+
**GET (with optional URL parameter <tt>returnObjects</tt>)
  */
+
**PUT
  void removeAllStores() throws ObjectStoreException;
+
**DELETE
 +
*Response status codes:
 +
**200 OK: Upon successful execution (GET, DELETE).
 +
**201 CREATED: Upon successful creation of a store (PUT).
 +
**400 BAD REQUEST: The calling client provided some information that lead to an error, e.g. an invalid store name, or tried to create a store that already exists etc.
 +
**404 NOT FOUND: The requested store could not be found.
 +
**500 INTERNAL SERVER ERROR: An internal error occurred.
 +
**503 SERVICE UNAVAILABLE: The service is currently unable to perform the requested operation, please retry later.
 +
 
 +
<b>Examples:</b>
 +
 
 +
<pre>
 +
GET http://&lt;hostname&gt;:8080/smila/store/store1/?returnObjects=false
 +
 
 +
200 OK
 +
{
 +
  "storeName" : "store1",
 +
  "storeProperties" : {
 +
  },
 +
  "objectCount" : 1,
 +
  "size" : 25
 +
}
 +
</pre>
 +
 
 +
<pre>
 +
GET http://&lt;hostname&gt;:8080/smila/store/store1/
 +
 
 +
200 OK
 +
{
 +
"storeName" : "store1",
 +
"storeProperties" : {
 +
},
 +
"objectCount" : 1,
 +
"size" : 25,
 +
"objects" : [ {
 +
  "id" : "sample-object",
 +
  "size" : 25,
 +
  "timestamp" : "2011-06-20T17:12:35.417+0200"
 +
} ]
 +
}
 +
</pre>
 +
 
 +
==== StoreObjectHandler  ====
 +
 
 +
This handler allows to PUTting, GETting, or DELETing objects to or from a store.
 +
 
 +
<b>Supported operations:</b>
 +
 
 +
*GET: Retrieves an object from a store.
 +
*PUT: Puts a new object to or updates an existing one in a store. The content of the object is sent with the PUT command as a JSON body.  
 +
*DELETE: Deletes an object from a store. If the object does not exist, it will be ignored and 200 OK will be returned.
 +
 
 +
<b>Usage:</b>
 +
 
 +
*URL: <tt><nowiki>http://&lt;hostname&gt;:8080/smila/store/&lt;store-name&gt;/&lt;object-id&gt;/</nowiki></tt>.
 +
*Allowed methods
 +
**GET
 +
**PUT
 +
**DELETE
 +
*Response status codes:
 +
**200 OK: Upon successful execution.
 +
**400 BAD REQUEST: The client provided information that lead to an error, e.g. an invalid store or object name etc.
 +
**404 NOT FOUND: The requested object (or the store) could not be found.
 +
**500 INTERNAL SERVER ERROR: An internal error occurred.
 +
**503 SERVICE UNAVAILABLE: The service is currently unable to perform the requested operation, please retry later.
 +
 
 +
<b>Examples:</b>
 +
 
 +
<pre>
 +
PUT http://&lt;hostname&gt;:8080/smila/store/store2/object1/
 +
{
 +
  "id": "object1",
 +
  "content": "my content."
 +
}
 +
200 OK
 +
</pre>
  
  /**
+
<pre>
  * Remove all objects from the named store. The store itself will continue to exist with the same properties as
+
GET http://&lt;hostname&gt;:8080/smila/store/store2/object1/
  * before, it will just be empty as if newly created.
+
  *
+
  * @throws InvalidStoreNameException
+
  *          if the store name is not valid.
+
  * @throws NoSuchStoreException
+
  *          if the store does not exist.
+
  * @throws ObjectStoreException
+
  *          error clearing the store.
+
  */
+
  void clearStore(String storeName) throws ObjectStoreException;
+
  
 +
200 OK
 +
{
 +
"id": "object1",
 +
"content": "my content."
 
}
 
}
</source>
+
</pre>  
  
=== Implementations ===
+
=== Implementations ===
A filesystem bases implementation can be found in the package [[SMILA/Documentation/ObjectStore/filesystem/SimpleObjectStoreService|org.eclipse.smila.objectstore.filesystem]].
+
A file system based implementation can be found in package [[SMILA/Documentation/ObjectStore/filesystem/SimpleObjectStoreService|org.eclipse.smila.objectstore.filesystem]].

Latest revision as of 10:40, 23 January 2012

Bundle org.eclipse.smila.objectstore

This page gives only a rough overview of the components. Please refer to the JavaDoc for specific information.

org.eclipse.smila.objectstore.ObjectStoreService

JavaDoc

The JavaDoc for the ObjectStoreService API can be found at org.eclipse.smila.objectstore.ObjectStoreService.

Description

In SMILA, the ObjectStoreService is mainly used to store binary data during bulk processing. Data objects pertaining to this service are for example large bulks of records that are to be processed in a single step by some worker.

The interface of ObjectStoreService is defined in org.eclipse.smila.objectstore.ObjectStoreService.

org.eclipse.smila.objectstore.StoreObject

JavaDoc

The JavaDoc for the StoreObject interface can be found at org.eclipse.smila.objectstore.StoreObject.

Description

A StoreObject contains information about an object in a store. Common pieces of information provided by StoreObject are:

  • ID (String)
    • Contains the ID of the object. Can be used to request the object from the store.
  • Size (long)
    • Contains the size of the object in byte.
  • Timestamp (Date)
    • Contains the timestamp of the object. In the file system based object store implementation this is the time of the latest modification of the object.

In addition to the above, an ObjectStore implementation might add further information as required.

org.eclipse.smila.objectstore.StoreOutputStream

JavaDoc

The JavaDoc for the StoreOutputStream interface can be found at org.eclipse.smila.objectstore.StoreOutputStream.

Description

The StoreOutputStream interface defines an extension of java.io.OutputStream that allows a stream to be aborted if it has not been closed yet, meaning the content of the stream will not be visible but discarded.

As a result, the content of StoreOutputStream will only be visible after close() has been called successfully.

Exceptions defined in org.eclipse.smila.objectstore

JavaDoc

The JavaDoc for the exceptions defined in org.eclipse.smila.objectstore can be found at org.eclipse.smila.objectstore.

Description

The individual exceptions are (in hierarchical order):

  • ObjectStoreException: This is the base class of all object store exceptions. There are subclasses which give more details about the exception:
    • BadRequestException: Caused by invalid arguments or other conditions that render it impossible to perform the requested operation.
      • InvalidStoreNameException: The store name does not apply to the restrictions defined by the respective service implementation.
      • NoSuchObjectException: The requested object does not exist.
      • NoSuchStoreException: The requested store does not exist.
      • StoreExistsException: The store to be created already exists.
    • ServiceUnavailableException: The request could not be fulfilled by the service due to some temporary condition. The client may retry the request shortly afterwards.

Handlers in org.eclipse.smila.objectstore

JavaDoc

The JavaDoc for the handlers of the org.eclipse.smila.objectstore bundle can be found at org.eclipse.smila.objectstore.httphandler.

Description

The following handlers exist:

ObjectStoreServiceHandler

This handler lists the stores handled by ObjectStoreService.

Supported operations:

  • GET: Lists all stores handled by ObjectStoreService.

Usage:

  • URL: http://<hostname>:8080/smila/store/
  • Allowed methods:
    • GET (no further URL parameters and no request body allowed)
  • Response status codes:
    • 200 OK: Upon successful execution.
    • 500 INTERNAL SERVER ERROR: An internal error occurred.
    • 503 SERVICE UNAVAILABLE: The service is currently unable to perform the requested operation, please retry later.

Example:

GET http://<hostname>:8080/smila/store/
200 OK
{
  "stores" : [ {
    "store" : "store1",
    "url" : "http://localhost:8080/smila/store/store1/"
  }, {
    "store" : "store2",
    "url" : "http://localhost:8080/smila/store/store2/"
  } ]
}

StoreAdminHandler

This handler allows the stores handled by the ObjectStoreService to be managed or queried.

Supported operations:

  • GET: Returns the store information. Without the optional parameter returnObjects set to false also information on the contained objects will be returned.
  • PUT: Creates a new store. Optional parameters can be sent as part of a JSON body.
  • DELETE: Deletes a store. If the store does not exist, it will be ignored and 200 OK will be returned.

Usage:

  • URL: http://<hostname>:8080/smila/store/<store-name>/.
  • Allowed methods:
    • GET (with optional URL parameter returnObjects)
    • PUT
    • DELETE
  • Response status codes:
    • 200 OK: Upon successful execution (GET, DELETE).
    • 201 CREATED: Upon successful creation of a store (PUT).
    • 400 BAD REQUEST: The calling client provided some information that lead to an error, e.g. an invalid store name, or tried to create a store that already exists etc.
    • 404 NOT FOUND: The requested store could not be found.
    • 500 INTERNAL SERVER ERROR: An internal error occurred.
    • 503 SERVICE UNAVAILABLE: The service is currently unable to perform the requested operation, please retry later.

Examples:

GET http://<hostname>:8080/smila/store/store1/?returnObjects=false

200 OK
{
  "storeName" : "store1",
  "storeProperties" : {
  },
  "objectCount" : 1,
  "size" : 25
}
GET http://<hostname>:8080/smila/store/store1/

200 OK
{
 "storeName" : "store1",
 "storeProperties" : {
 },
 "objectCount" : 1,
 "size" : 25,
 "objects" : [ {
  "id" : "sample-object",
  "size" : 25,
  "timestamp" : "2011-06-20T17:12:35.417+0200"
 } ]
}

StoreObjectHandler

This handler allows to PUTting, GETting, or DELETing objects to or from a store.

Supported operations:

  • GET: Retrieves an object from a store.
  • PUT: Puts a new object to or updates an existing one in a store. The content of the object is sent with the PUT command as a JSON body.
  • DELETE: Deletes an object from a store. If the object does not exist, it will be ignored and 200 OK will be returned.

Usage:

  • URL: http://<hostname>:8080/smila/store/<store-name>/<object-id>/.
  • Allowed methods
    • GET
    • PUT
    • DELETE
  • Response status codes:
    • 200 OK: Upon successful execution.
    • 400 BAD REQUEST: The client provided information that lead to an error, e.g. an invalid store or object name etc.
    • 404 NOT FOUND: The requested object (or the store) could not be found.
    • 500 INTERNAL SERVER ERROR: An internal error occurred.
    • 503 SERVICE UNAVAILABLE: The service is currently unable to perform the requested operation, please retry later.

Examples:

PUT http://<hostname>:8080/smila/store/store2/object1/
{
  "id": "object1",
  "content": "my content."
}
200 OK
GET http://<hostname>:8080/smila/store/store2/object1/

200 OK
{
 "id": "object1",
 "content": "my content."
}

Implementations

A file system based implementation can be found in package org.eclipse.smila.objectstore.filesystem.

Back to the top