|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.apache.jackrabbit.mk.core.MicroKernelImpl
public class MicroKernelImpl
| Field Summary | |
|---|---|
protected Repository |
rep
|
| Constructor Summary | |
|---|---|
MicroKernelImpl()
Argument-less constructor, used for in-memory kernel. |
|
MicroKernelImpl(Repository rep)
Alternate constructor, used for testing. |
|
MicroKernelImpl(String homeDir)
|
|
| Method Summary | |
|---|---|
String |
commit(String path,
String jsonDiff,
String revision,
String message)
Applies the specified changes on the specified target node. |
String |
diff(String fromRevision,
String toRevision,
String filter)
Returns the JSON diff representation of the changes between the specified revisions. |
void |
dispose()
Dispose this instance. |
long |
getChildNodeCount(String path,
String revision)
Returns the number of child nodes of the specified node. |
String |
getHeadRevision()
Return the id of the current head revision. |
String |
getJournal(String fromRevision,
String toRevision,
String filter)
Returns a revision journal, starting with fromRevisionId
and ending with toRevisionId. |
long |
getLength(String blobId)
Returns the length of the specified blob. |
String |
getNodes(String path,
String revision)
Returns the node tree rooted at the specified parent node with depth 1. |
String |
getNodes(String path,
String revision,
int depth,
long offset,
int count,
String filter)
Returns the node tree rooted at the specified parent node with the specified depth, maximum child node count and offset. |
String |
getRevisions(long since,
int maxEntries)
Returns a chronological list of all revisions since a specific point in time. |
protected void |
init(String homeDir)
|
boolean |
nodeExists(String path,
String revision)
Determines whether the specified node exists. |
int |
read(String blobId,
long pos,
byte[] buff,
int off,
int length)
Reads up to length bytes of data from the specified blob into
the given array of bytes. |
String |
waitForCommit(String oldHeadRevision,
long maxWaitMillis)
Wait for a commit to occur that is newer than the given revision number. |
String |
write(InputStream in)
Stores the content of the given stream and returns an associated identifier for later retrieval. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
protected Repository rep
| Constructor Detail |
|---|
public MicroKernelImpl(String homeDir)
throws MicroKernelException
MicroKernelExceptionpublic MicroKernelImpl()
public MicroKernelImpl(Repository rep)
rep - repository, already initialized| Method Detail |
|---|
protected void init(String homeDir)
throws MicroKernelException
MicroKernelExceptionpublic void dispose()
MicroKernel
dispose in interface MicroKernel
public String getHeadRevision()
throws MicroKernelException
MicroKernel
getHeadRevision in interface MicroKernelMicroKernelException - if an error occurs
public String getRevisions(long since,
int maxEntries)
throws MicroKernelException
MicroKernel
[ { "id" : "", "ts" : }, ... ]
getRevisions in interface MicroKernelsince - timestamp (ms) of earliest revision to be returnedmaxEntries - maximum #entries to be returned;
if < 0, no limit will be applied.
MicroKernelException - if an error occurs
public String waitForCommit(String oldHeadRevision,
long maxWaitMillis)
throws MicroKernelException,
InterruptedException
MicroKernel
waitForCommit in interface MicroKernelmaxWaitMillis - the maximum number of milliseconds to wait (0 if the
method should not wait).
MicroKernelException - if an error occurs
InterruptedException - if the thread was interrupted
public String getJournal(String fromRevision,
String toRevision,
String filter)
throws MicroKernelException
MicroKernelfromRevisionId
and ending with toRevisionId.
Format:
[ { "id" : "<revisionId>", "ts" : "<revisionTimestamp>", "msg" : "<commitMessage>", "changes" : "<JSON diff>" }, ... ]
getJournal in interface MicroKernelfromRevision - first revision to be returned in journaltoRevision - last revision to be returned in journal, if null the current head revision is assumedfilter - (optional) filter criteria
(e.g. path, property names, etc);
TODO specify format and semantics
MicroKernelException - if an error occurs
public String diff(String fromRevision,
String toRevision,
String filter)
throws MicroKernelException
MicroKernel
[ { "id" : "<revisionId>", "ts" : "<revisionTimestamp>", "msg" : "<commitMessage>", "changes" : "<JSON diff>" }, ... ]
diff in interface MicroKernelfromRevision - a revisiontoRevision - another revision, if null the current head revision is assumedfilter - (optional) filter criteria
(e.g. path, property names, etc);
TODO specify format and semantics
MicroKernelException - if an error occurs
public boolean nodeExists(String path,
String revision)
throws MicroKernelException
MicroKernel
nodeExists in interface MicroKernelpath - path denoting noderevision - revision, if null the current head revision is assumed
true if the specified node exists, otherwise false
MicroKernelException - if an error occurs
public long getChildNodeCount(String path,
String revision)
throws MicroKernelException
MicroKernelgetNodes(path, revisionId, 0, 0, 0) and evaluating
the :childNodeCount property.
getChildNodeCount in interface MicroKernelpath - path denoting noderevision - revision, if null the current head revision is assumed
MicroKernelException - if an error occurs
public String getNodes(String path,
String revision)
throws MicroKernelException
MicroKernel:childNodeCount). Example:
{
"someprop": "someval",
":childNodeCount": 2,
"child1" : {
"prop1": "foo",
":childNodeCount": 2
},
"child2": {
"prop1": "bar"
":childNodeCount": 0
}
}
Remarks:
:childNodeCount equals 0, then the
node does not have any child nodes.
:childNodeCount is larger than the number
of returned child nodes, then the node has more child nodes than those
included in the tree. Large number of child nodes can be retrieved in
chunks using MicroKernel.getNodes(String, String, int, long, int, String)getNodes(path, revisionId, 1, 0, -1, null)
getNodes in interface MicroKernelpath - path denoting root of node tree to be retrievedrevision - revision, if null the current head revision is assumed
MicroKernelException - if an error occurs
public String getNodes(String path,
String revision,
int depth,
long offset,
int count,
String filter)
throws MicroKernelException
MicroKerneldepth parameter:
| depth = 0 | properties, including :childNodeCount and
child node names (i.e. empty child node objects) |
| depth = 1 | properties, child nodes and their properties (including
:childNodeCount) |
| depth = 2 | [and so on...] |
offset and count parameters are only applied to the
direct child nodes of the root of the returned node tree.
getNodes in interface MicroKernelpath - path denoting root of node tree to be retrievedrevision - revision, if null the current head revision is assumeddepth - maximum depth of returned treeoffset - start position in the iteration order of child nodes (0 to start at the
beginning)count - maximum number of child nodes to retrieve (-1 for all)filter - (optional) filter criteria
(e.g. names of properties to be included, etc);
TODO specify format and semantics
MicroKernelException - if an error occurs
public String commit(String path,
String jsonDiff,
String revision,
String message)
throws MicroKernelException
MicroKernel
If path.length() == 0 the paths specified in the
jsonDiff are expected to be absolute.
The implementation tries to merge changes if the revision id of the commit is set accordingly. As an example, deleting a node is allowed if the node existed in the given revision, even if it was deleted in the meantime.
commit in interface MicroKernelpath - path denoting target nodejsonDiff - changes to be applied in JSON diff format.revision - revision the changes are based on, if null the current head revision is assumedmessage - commit message
MicroKernelException - if an error occurs
public long getLength(String blobId)
throws MicroKernelException
MicroKernel
getLength in interface MicroKernelblobId - blob identifier
MicroKernelException - if an error occurs
public int read(String blobId,
long pos,
byte[] buff,
int off,
int length)
throws MicroKernelException
MicroKernellength bytes of data from the specified blob into
the given array of bytes. An attempt is made to read as many as
length bytes, but a smaller number may be read.
The number of bytes actually read is returned as an integer.
read in interface MicroKernelblobId - blob identifierpos - the offset within the blobbuff - the buffer into which the data is read.off - the start offset in array buff
at which the data is written.length - the maximum number of bytes to read
-1 if there is no more data because the end of
the blob content has been reached.
MicroKernelException - if an error occurs
public String write(InputStream in)
throws MicroKernelException
MicroKernelIf identical stream content has been stored previously, then the existing identifier will be returned instead of storing a redundant copy.
The stream is closed by this method.
write in interface MicroKernelin - InputStream providing the blob content
MicroKernelException - if an error occurs
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||