|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectorg.ceryle.xnode.XNodeRevisionManagerImpl
public class XNodeRevisionManagerImpl
Provides an implementation of the XNodeStore API as a database manager for XNode (XML Node) content.
The XNode Implementation (the package org.ceryle.xnode.*, both its source code and documentation), are released under the Apache 2.0 License. For more details, check the LICENSE file contained with the distribution, or see The Ceryle Project for more information. It is distributed with no warranty.
An XNode's repository as a list of XNodeRevision objects is not generated
automatically upon creation of the XNode, only upon demand. The only method
that accesses information about the repository that does not generate the
repository is the getRevisionCount(XNode) method, which uses the number
of <Revision> DOM Elements as an alternative. The repository
is also explicitly generated upon a call to the XNodeRevisionManager's
getRepository(XNode) method.
The XNodeRevisionManager is expected to maintain settings regarding repository limits, both of revision count and space used (in KB). These settings are to be set elsewhere (such as in a UI preferences dialog) and set as System properties whose names begin with xnode-revision-*, and which are processed into boolean, int, and enumerated values and available via get() methods from this class.
And in case there's any confusion, XNodeRevisions are objects (as <xnode:Revision> elements when serialized as XML) specified by a version number, the latter incremented as each revision is created.
| Field Summary | |
|---|---|
static String |
REV_COUNT_LIMIT
The System property name for the Ceryle database revision count limit value. |
static String |
REV_COUNT_LIMIT_ACTION
The System property name for the Ceryle database revision count limit action value. |
static String |
REV_SPACE_LIMIT
The System property name for the Ceryle database revision space limit value. |
static String |
REV_SPACE_LIMIT_ACTION
The System property name for the Ceryle database revision space limit action value. |
static String |
REV_USE_COUNT_LIMIT
The System property name for the Ceryle database use revision count limit flag. |
static String |
REV_USE_SPACE_LIMIT
The System property name for the Ceryle database use revision space limit flag. |
static String |
TS_FORMAT
Timestamp format "yyyy-MM-dd'T'HH:mm:ss", eg., "2002-09-14T14:23:55". |
| Fields inherited from interface org.purl.xnode.XNodeRevisionManager |
|---|
REV_LIMIT_ACTION_DELETE, REV_LIMIT_ACTION_WARN |
| Constructor Summary | |
|---|---|
XNodeRevisionManagerImpl(XNodeStore xnodestore)
Constructor with a parent XNodeStore. |
|
| Method Summary | |
|---|---|
Date |
convertTimeStamp(String timestamp)
Converts a String in timestamp format (such as the creation and modification date Strings, of the form "yyyy-MM-dd'T'HH:mm:ss") in UTC to a Date. |
XNodeRevision |
createRevision(String cid,
String nid,
boolean write)
Generate a new XNodeRevision for the specified XNode, adding it to the XNode's repository. |
XNodeRevision |
createRevision(XNode xnode)
Create a new revision by copying the current document and metadata content of the specified XNode to its repository. |
XNodeRevision |
createRevision(XNodeID xid,
boolean write)
Generate a new revision by creating a new XNodeRevision using the current document and metadata content of the specified XNode. |
boolean |
deleteRevision(XNodeRevision revision)
Delete the provided revision from its parent XNode. |
int |
deleteRevisions(List revisions)
Delete a List of revisions from their parent XNode(s). |
boolean |
exceedsRevisionCountLimit(XNode xnode)
Returns true if the provided XNode exceeds the set revision count limit. |
boolean |
exceedsRevisionSpaceLimit(XNode xnode)
Returns true if the provided XNode exceeds the set revision space limit. |
List |
getAllRevisions(XNode xnode)
Returns a List containing all XNodeRevisions of the provided XNode. |
static int |
getCurrentVersion(XNode xnode)
A static utility method that returns the version number of the provided XNode. |
String |
getDisplayableRevisionDateOf(XNodeRevision revision)
Returns a display version of the revision date of the XNodeRevision. |
Object |
getProperty(XNode xnode,
String name,
int version)
Return the named property name of version version of XNode xnode as an Object, null if it has not been set. |
List |
getRepository(XNode xnode)
Returns the List backing the XNode's repository (i.e., the List of individual XNodeRevision objects). |
XNodeRevision |
getRevision(String cid,
String nid,
int version)
Return a specific revision version of the specified XNode, document nid of Collection cid. |
XNodeRevision |
getRevision(XNode xnode,
int version)
Return a specific revision version of the specified XNode, document nid of Collection cid. |
int |
getRevisionCount(XNode xnode)
Return the count of available revisions for the provided XNode. |
int |
getRevisionCountLimit()
Returns the revision count limit (units: revision). |
static int |
getRevisionCountLimitAction()
Returns the revision count limit action, the action that occurs when an XNode's revision count limit is exceeded. |
int[] |
getRevisionIndex(XNode xnode)
Return an ordered array of all revision numbers. |
List |
getRevisions(XNode xnode,
int[] versions)
Returns a List containing the XNodeRevisions (specified by version number) of the provided XNode. |
List |
getRevisionsBefore(XNode xnode,
Date date)
Returns a List containing the revisions prior to the provided Date. |
int |
getRevisionSize(XNode xnode,
int version)
Return the stored size in characters of the specified revision of the provided XNode. |
int |
getRevisionSpaceLimit()
Returns the revision space limit (units: KB). |
static int |
getRevisionSpaceLimitAction()
Returns the revision space limit action, the action that occurs when an XNode's revision space limit is exceeded. |
XNode |
getXNodeFromRevision(XNode xnode,
int version)
Recreates an XNode provided one of its version numbers. |
XNodeRevision |
importRevision(XNode xnode,
XNode source)
Imports XNode source (ignoring any of that XNode's revisions) as a new revision of XNode xnode by copying the current document and metadata content of the source XNode to xnode's repository. |
XNodeRevision |
recreateRevision(XNode xnode,
Element revision)
Recreate an XNodeRevision provided the parent XNode and the source <xnode:Revision> Element. |
XNodeRevision |
recreateRevision(XNode xnode,
int version)
Recreate an existing revision from the specified XNode's repository. |
int |
restoreRevision(XNodeRevision revision)
Restore the provided XNodeRevision as a replacement for its parent XNode. |
static void |
setProperties()
Called upon instantiation of the class, this method establishes the XNodeRevisionManager properties, based on System properties. |
void |
setRevisionCountLimit(int limit)
Sets the revision count limit (units: revision) to limit. |
Date |
setRevisionDateOf(XNodeRevision revision)
Sets the revision date of the XNodeRevision based on the XNodeRevision's <xnode:Header> Element. |
void |
setRevisionSpaceLimit(int limit)
Sets the revision space limit (units: KB) to limit. |
static boolean |
useRevisionCountLimits()
Returns true if revision count limits are active. |
static boolean |
useRevisionSpaceLimits()
Returns true if revision space limits are active. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public static final String TS_FORMAT
ClockImpl.TS_FORMAT.
public static final String REV_USE_COUNT_LIMIT
public static final String REV_COUNT_LIMIT
public static final String REV_COUNT_LIMIT_ACTION
public static final String REV_USE_SPACE_LIMIT
public static final String REV_SPACE_LIMIT
public static final String REV_SPACE_LIMIT_ACTION
| Constructor Detail |
|---|
public XNodeRevisionManagerImpl(XNodeStore xnodestore)
throws XNodeException
xnodestore - the parent XNodeStore.
XNodeException - if unable to instantiate the manager for any reason.| Method Detail |
|---|
public XNode getXNodeFromRevision(XNode xnode,
int version)
Currently unimplemented.
This is an XNodeRevisionManager API method.
getXNodeFromRevision in interface XNodeRevisionManagerxnode - the XNode to be queried.version - the revision number.
public XNodeRevision createRevision(String cid,
String nid,
boolean write)
throws XNodeException
createRevision(XNode) for more details.
This is an XNodeRevisionManager API method.
createRevision in interface XNodeRevisionManagercid - the Collection ID String.nid - the Node ID String.write - if true, writes the updated XNode to the database.
XNodeException - if the XNode does not exist, or the process fails for any reason
public XNodeRevision createRevision(XNodeID xid,
boolean write)
throws XNodeException
This is an XNodeRevisionManager API method.
createRevision in interface XNodeRevisionManagerxid - the XNodeID specifying an XNode.write - if true, writes the updated XNode to the database.
XNodeException - if the XNode does not exist, or the process fails for any reason
public XNodeRevision createRevision(XNode xnode)
throws XNodeException
This is an XNodeRevisionManager API method.
createRevision in interface XNodeRevisionManagerxnode - the XNode to process.
XNodeException - if the process fails for any reason.
public XNodeRevision recreateRevision(XNode xnode,
int version)
throws XNodeException
This is an XNodeRevisionManager API method.
recreateRevision in interface XNodeRevisionManagerxnode - the parent XNode to process.version - the XNodeRevision to recreate.
XNodeException - if the process fails for any reason.
public int restoreRevision(XNodeRevision revision)
throws XNodeException
This is an XNodeRevisionManager API method.
restoreRevision in interface XNodeRevisionManagerrevision - the XNodeRevision to restore.
XNodeException - if the restoration fails.
public boolean deleteRevision(XNodeRevision revision)
throws XNodeException
This is an XNodeRevisionManager API method.
deleteRevision in interface XNodeRevisionManagerrevision - the XNodeRevision to be deleted.
XNodeException - if the deletion fails for any reason.
public int deleteRevisions(List revisions)
throws XNodeException
This is an XNodeRevisionManager API method.
deleteRevisions in interface XNodeRevisionManagerrevisions - the List of XNodeRevisions to be deleted.
XNodeException - if any of the deletions fail for any reason.
public int getRevisionCount(XNode xnode)
throws XNodeException
This is an XNodeRevisionManager API method.
getRevisionCount in interface XNodeRevisionManagerxnode - the parent XNode to process.
XNodeException - if the process fails for any reasonpublic int getRevisionCountLimit()
getRevisionCountLimit in interface XNodeRevisionManagerpublic void setRevisionCountLimit(int limit)
setRevisionCountLimit in interface XNodeRevisionManagerlimit - the limit set, in count of revisions.public boolean exceedsRevisionCountLimit(XNode xnode)
exceedsRevisionCountLimit in interface XNodeRevisionManagerxnode - the XNode to process.
public static boolean useRevisionCountLimits()
public static int getRevisionCountLimitAction()
XNodeRevisionManager.REV_LIMIT_ACTION_WARN
or XNodeRevisionManager.REV_LIMIT_ACTION_DELETE
public int getRevisionSize(XNode xnode,
int version)
throws XNodeException
This is an XNodeRevisionManager API method.
getRevisionSize in interface XNodeRevisionManagerxnode - the XNode to process.version - the revision to process, or -1 to return a count of all revisions.
XNodeException - if there is an error in processing.public int getRevisionSpaceLimit()
getRevisionSpaceLimit in interface XNodeRevisionManagerpublic void setRevisionSpaceLimit(int limit)
setRevisionSpaceLimit in interface XNodeRevisionManagerlimit - the limit set, in KB.public boolean exceedsRevisionSpaceLimit(XNode xnode)
exceedsRevisionSpaceLimit in interface XNodeRevisionManagerxnode - the XNode to process.
public static boolean useRevisionSpaceLimits()
public static int getRevisionSpaceLimitAction()
XNodeRevisionManager.REV_LIMIT_ACTION_WARN
or XNodeRevisionManager.REV_LIMIT_ACTION_DELETE
public static void setProperties()
throws XNodeException
XNodeException
public List getRevisions(XNode xnode,
int[] versions)
throws XNodeException
getRevisions in interface XNodeRevisionManagerxnode - the XNode to process.versions - the array of requested version numbers.
XNodeException - if there is a processing error.
public XNodeRevision getRevision(String cid,
String nid,
int version)
throws XNodeException
This is an XNodeRevisionManager API method.
getRevision in interface XNodeRevisionManagercid - the Collection ID String.nid - the XNode ID String.
XNodeException - if the XNode does not exist, or the process fails for any reason
public XNodeRevision getRevision(XNode xnode,
int version)
throws XNodeException
getRevision in interface XNodeRevisionManagerxnode - the XNode to be processed.version - the version number of the requested revision.
XNodeException - if the process fails for any reason.
public List getAllRevisions(XNode xnode)
throws XNodeException
getAllRevisions in interface XNodeRevisionManagerxnode - the XNode to process.
XNodeException - if there is a processing error.public String getDisplayableRevisionDateOf(XNodeRevision revision)
getDisplayableRevisionDateOf in interface XNodeRevisionManagerrevision - the XNodeRevision to be processed.
public List getRevisionsBefore(XNode xnode,
Date date)
throws XNodeException
getRevisionsBefore in interface XNodeRevisionManagerxnode - the XNode to be processed.date - the Date threshold.
XNodeException
public Object getProperty(XNode xnode,
String name,
int version)
throws XNodeException
getProperty in interface XNodeRevisionManagerxnode - the XNode to processname - the name of the propertyversion - the revision number to process (use -1 for current)
XNodeException - if there is a processing error.public static int getCurrentVersion(XNode xnode)
This is not an XNodeRevisionManager API method.
public List getRepository(XNode xnode)
throws XNodeException
XNodeRevision objects).
This will return an empty List rather than null if there are no
revisions. If the class being used for the list is a
SetModel, this will also sort the list
upon first instantiation.
This is not an XNodeRevisionManager API method.
XNodeException
public int[] getRevisionIndex(XNode xnode)
throws XNodeException
This is not an XNodeRevisionManager API method.
getRevisionIndex in interface XNodeRevisionManagerxnode - the XNode to process.
XNodeException
public XNodeRevision importRevision(XNode xnode,
XNode source)
throws XNodeException
This is not an XNodeRevisionManager API method.
xnode - the XNode to receive the new revision.source - the XNode to import.
XNodeException - if the process fails for any reason.
public XNodeRevision recreateRevision(XNode xnode,
Element revision)
throws XNodeException
This is not an XNodeRevisionManager API method.
xnode - the parent XNode to process.revision - the source <xnode:Revision> Element.
XNodeException - if the process fails for any reason.public Date setRevisionDateOf(XNodeRevision revision)
This is not an XNodeRevisionManager API method.
public Date convertTimeStamp(String timestamp)
throws XNodeException
This is not an XNodeRevisionManager API method.
timestamp - the timestamp String to convert.
XNodeException - if the timestamp is invalid.
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||