public class DatabaseRepresentation extends Object
Constructor and Description |
---|
DatabaseRepresentation(IStorage pDatabase,
IBackend.IBackendFactory pStorageFac,
IRevisioning pRevision) |
Modifier and Type | Method and Description |
---|---|
void |
add(InputStream input,
String resource)
This method is responsible to add a new XML document to a collection.
|
void |
createResource(InputStream inputStream,
String resourceName)
This method is responsible to create a new database.
|
void |
deleteResource(String resourceName)
This method is responsible to delete an existing database.
|
long |
getLastRevision(String resourceName)
This method reads the existing database, and offers the last revision id
of the database
|
OutputStream |
getModificHistory(String resourceName,
String revisionRange,
boolean nodeid,
OutputStream output,
boolean wrap)
This method reads the existing database, and offers all modifications of
the two given revisions
|
javax.ws.rs.core.StreamingOutput |
getResource(String resourceName,
Map<QueryParameter,String> queryParams)
This method is responsible to deliver the whole database.
|
javax.ws.rs.core.StreamingOutput |
getResourcesNames()
This method is responsible to deliver a list of available resources and
collections supported by TreeTank's REST implementation.
|
javax.ws.rs.core.StreamingOutput |
performQueryOnResource(String resource,
String query,
Map<QueryParameter,String> otherParams)
This method is responsible to perform queries on a special database.
|
void |
revertToRevision(String resourceName,
long backToRevision)
This method reverts the latest revision data to the requested.
|
boolean |
shred(InputStream xmlInput,
String resource)
This method is responsible to save the XML file, which is in an
InputStream , as a TreeTank
object. |
public DatabaseRepresentation(IStorage pDatabase, IBackend.IBackendFactory pStorageFac, IRevisioning pRevision) throws TTException
TTException
public void createResource(InputStream inputStream, String resourceName) throws JaxRxException
inputStream
- The stream containing the XML document that has to be stored.resourceName
- The name of the new database.JaxRxException
- The exception occurred.public javax.ws.rs.core.StreamingOutput getResource(String resourceName, Map<QueryParameter,String> queryParams) throws JaxRxException
resourceName
- The name of the requested database.queryParams
- The optional query parameters.JaxRxException
- The exception occurred.public javax.ws.rs.core.StreamingOutput performQueryOnResource(String resource, String query, Map<QueryParameter,String> otherParams)
resource
- The name of the database instance.query
- The XPath expression.otherParams
- Further query parameters (output, wrap, revision) which change
the response.public javax.ws.rs.core.StreamingOutput getResourcesNames() throws JaxRxException
JaxRxException
- The exception occurred.public void add(InputStream input, String resource) throws JaxRxException
input
- The new XML document packed in an InputStream
.resource
- The name of the collection.JaxRxException
- The exception occurred.public void deleteResource(String resourceName) throws javax.ws.rs.WebApplicationException
resourceName
- The name of the database.javax.ws.rs.WebApplicationException
- The exception occurred.public final boolean shred(InputStream xmlInput, String resource) throws TTException
InputStream
, as a TreeTank
object.xmlInput
- The XML file in an InputStream
.resource
- The name of the resource.true
when the shredding process has been successful. false
otherwise.TTException
public long getLastRevision(String resourceName) throws JaxRxException, TTException
resourceName
- The name of the existing database.OutputStream
containing the resultjavax.ws.rs.WebApplicationException
- The Exception occurred.TTException
JaxRxException
public OutputStream getModificHistory(String resourceName, String revisionRange, boolean nodeid, OutputStream output, boolean wrap) throws JaxRxException, TTException
resourceName
- The name of the existing database.revisionRange
- Contains the range of revisionsnodeid
- To response the resource with a restid for each node ( true
) or without (
false
).output
- The OutputStream reference which have to be modified and
returnedwrap
- true
if the results have to be wrapped. false
otherwise.OutputStream
containing the resultTTException
javax.ws.rs.WebApplicationException
- The Exception occurred.JaxRxException
public void revertToRevision(String resourceName, long backToRevision) throws JaxRxException, TTException
resourceName
- The name of the XML resource.backToRevision
- The revision value, which has to be set as the latest.javax.ws.rs.WebApplicationException
TTException
JaxRxException
Copyright © 2013. All Rights Reserved.