com.centrasite.registry.revision
Class RevisionManagerImpl

java.lang.Object
  extended by com.centrasite.registry.revision.RevisionManagerImpl
All Implemented Interfaces:
RevisionManager

public class RevisionManagerImpl
extends java.lang.Object
implements RevisionManager

The implementation of the revision manager.
Note that the revision feature must be switched on before using this interface. Refer to the 'RevisionAdministrator' for the way how to activate. The following environment is established to perform the revisions and checkpoints:

       Collection CentraSite                  Collection v.CentraSite
     
         doctype1             ----------->      v.doctype1
         doctype2                 ----------->      v.doctype2
         ...
 
Updates and inserts to any of the doctypes in the CentraSite collection creates a version into the corresponding doctype of the v.CentraSite collection. Deletes of objects from the usual CentraSite collection has no effect on the versioning collection.
If a new doctype is created in the CentraSite collection, its counterpart in the v.CentraSite collection will be created in parallel. If a doctype will be deleted then the corresponding doctype together will all the data gets deleted from the v.CentaSite collection.

All of the get() and find() methods return objects from the v.CentraSite collection. The restore() plays back objects from v.CentraSite to CentraSite. The purge() methods delete old versions from the versioning part v.CentraSite.


Field Summary
static java.lang.String CS_TYPE_NAMESPACE
           
 
Method Summary
 int deleteCheckpointLabels(java.lang.String checkpointLabel)
          Delete all label names from all flagged revision objects.
 java.util.Collection<javax.xml.registry.infomodel.RegistryObject> findObjects(java.util.Collection findQualifiers, javax.xml.registry.infomodel.RegistryObject regObj)
          Find all revision objects based on the given registry object and with find qualifiers.
 java.util.Collection<javax.xml.registry.infomodel.RegistryObject> findObjects(java.util.Collection findQualifiers, java.lang.String objectType, java.util.Collection checkpointLabels, java.util.Collection classifications)
          Find all revision objects based on the given object type and with find qualifiers.
 java.lang.String getCheckpointLabel(javax.xml.registry.infomodel.RegistryObject regObj)
          Get the checkpoint label name of a registry object from the revision part.
 java.util.Collection<java.lang.String> getCheckpointLabels()
          Get a list of all checkpoint label names active in the system.
 java.util.Collection<javax.xml.registry.infomodel.RegistryObject> getCheckpointObjects(java.util.Collection<javax.xml.registry.infomodel.RegistryObject> objects, java.lang.String checkpointLabel)
          Get the revision objects, based on the objects specified and having a checkpoint label in one of their revisions.
 java.util.Collection<javax.xml.registry.infomodel.RegistryObject> getCheckpointObjects(java.lang.String checkpointLabel)
          Get all revision objects which were created with the given checkpoint label name.
 int getMinorVersion(javax.xml.registry.infomodel.RegistryObject regObj)
          Get the minor version number of a registry object.
 java.util.Collection<javax.xml.registry.infomodel.RegistryObject> getObjects(javax.xml.registry.infomodel.RegistryObject regObj)
          Get all present revision objects based on a specific jaxr object.
 java.util.Collection<javax.xml.registry.infomodel.RegistryObject> getObjects(java.lang.String objectType, java.lang.String objectId)
          Get all present revision objects based on a specific jaxr object.
 void printRevisions(javax.xml.registry.infomodel.RegistryObject regObj)
          Prints all the revisions of an object to the console.
 int purge(java.util.Collection<java.lang.String> objectTypes, int keepCount)
          Purge old versions of objects in the registry.
 int purge(javax.xml.registry.infomodel.RegistryObject regObj, int keepCount)
          Purge old versions based on the given registry object.
 void restoreObjects(java.util.Collection objects)
          Restore the specified revision objects that they will become the actual object.
 void setCheckpointLabel(java.util.Collection<javax.xml.registry.infomodel.RegistryObject> objects, java.lang.String checkpointLabel)
          Set a checkpoint label name to the objects specified.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

CS_TYPE_NAMESPACE

public static final java.lang.String CS_TYPE_NAMESPACE
See Also:
Constant Field Values
Method Detail

getObjects

public java.util.Collection<javax.xml.registry.infomodel.RegistryObject> getObjects(java.lang.String objectType,
                                                                                    java.lang.String objectId)
                                                                             throws RevisionException
Get all present revision objects based on a specific jaxr object. Only versions for physical jaxr objects are returned. If the specified object type is an embedded one (e.g. Classification or ServiceBinding) then an empty list will be returned.

Specified by:
getObjects in interface RevisionManager
Parameters:
objectType - the object type of the object (in the shape: "{namespace}typename")
objectId - the uddi-id of the object
Returns:
collection of RegistryObject from the revision part
Throws:
RevisionException
See Also:
RevisionManager.getObjects(java.lang.String, java.lang.String)

getObjects

public java.util.Collection<javax.xml.registry.infomodel.RegistryObject> getObjects(javax.xml.registry.infomodel.RegistryObject regObj)
                                                                             throws RevisionException
Get all present revision objects based on a specific jaxr object. Only versions for physical jaxr objects are returned. If the specified object is derived from an embedded one (e.g. Classification or ServiceBinding) then an empty list will be returned.

Specified by:
getObjects in interface RevisionManager
Parameters:
regObj - a registry object
Returns:
collection of RegistryObject from the revision part
Throws:
RevisionException
See Also:
RevisionManager.getObjects(javax.xml.registry.infomodel.RegistryObject)

findObjects

public java.util.Collection<javax.xml.registry.infomodel.RegistryObject> findObjects(java.util.Collection findQualifiers,
                                                                                     javax.xml.registry.infomodel.RegistryObject regObj)
                                                                              throws RevisionException
Find all revision objects based on the given registry object and with find qualifiers. The following qualifiers are supported:

Specified by:
findObjects in interface RevisionManager
Parameters:
findQualifiers - qualifiers from RevisionFindQualifiers (null: no qualifiers supplied)
regObj - a registry object
Returns:
collection of RegistryObject from the revision part with criteria
Throws:
RevisionException

findObjects

public java.util.Collection<javax.xml.registry.infomodel.RegistryObject> findObjects(java.util.Collection findQualifiers,
                                                                                     java.lang.String objectType,
                                                                                     java.util.Collection checkpointLabels,
                                                                                     java.util.Collection classifications)
                                                                              throws RevisionException
Find all revision objects based on the given object type and with find qualifiers. The following qualifiers are supported:

Specified by:
findObjects in interface RevisionManager
Parameters:
findQualifiers - qualifiers from RevisionFindQualifiers (null: not required)
objectType - the object type (in the shape: "{namespace}typename")
checkpointLabels - collection of matching label names (null: not required)
classifications - collection of classifications which should match (null: not required)
Returns:
collection of RegistryObject from the revision part with criteria
Throws:
RevisionException

restoreObjects

public void restoreObjects(java.util.Collection objects)
                    throws RevisionException
Restore the specified revision objects that they will become the actual object.

Specified by:
restoreObjects in interface RevisionManager
Parameters:
objects - collection of RegistryObject from the revision part
Throws:
RevisionException - revision feature not enabled object list contains non-revisioned objects
See Also:
RevisionManager.restoreObjects(java.util.Collection)

setCheckpointLabel

public void setCheckpointLabel(java.util.Collection<javax.xml.registry.infomodel.RegistryObject> objects,
                               java.lang.String checkpointLabel)
                        throws RevisionException
Set a checkpoint label name to the objects specified. Note that the checkpoint label must not be previously used.
The label setting has no effect of the registry object is an embedded one (e.g. Classification)

Specified by:
setCheckpointLabel in interface RevisionManager
Parameters:
objects - collection of RegistryObject
checkpointLabel - name of the checkpoint label
Throws:
RevisionException - revision feature not enabled
See Also:
RevisionManager.setCheckpointLabel(java.util.Collection, java.lang.String)

getCheckpointObjects

public java.util.Collection<javax.xml.registry.infomodel.RegistryObject> getCheckpointObjects(java.util.Collection<javax.xml.registry.infomodel.RegistryObject> objects,
                                                                                              java.lang.String checkpointLabel)
                                                                                       throws RevisionException
Get the revision objects, based on the objects specified and having a checkpoint label in one of their revisions. If a object in the input collection does not have label in one of their revisions or if the object is an embedded one (e.g. Classification) then nothing is returned for that object.

Specified by:
getCheckpointObjects in interface RevisionManager
Parameters:
objects - collection of RegistryObject
checkpointLabel - name of the checkpoint label
Returns:
collection of RegistryObject from the revision part having the checkpoint label set
Throws:
RevisionException
See Also:
RevisionManager.getCheckpointObjects(java.util.Collection, java.lang.String)

getCheckpointObjects

public java.util.Collection<javax.xml.registry.infomodel.RegistryObject> getCheckpointObjects(java.lang.String checkpointLabel)
                                                                                       throws RevisionException
Get all revision objects which were created with the given checkpoint label name.

Specified by:
getCheckpointObjects in interface RevisionManager
Parameters:
checkpointLabel - name of the checkpoint label
Returns:
collection of RegistryObject from the revision part
Throws:
RevisionException
See Also:
RevisionManager.getCheckpointObjects(java.lang.String)

getCheckpointLabels

public java.util.Collection<java.lang.String> getCheckpointLabels()
                                                           throws RevisionException
Get a list of all checkpoint label names active in the system.

Specified by:
getCheckpointLabels in interface RevisionManager
Returns:
collection of checkpoint label names
Throws:
RevisionException
See Also:
RevisionManager.getCheckpointLabels()

deleteCheckpointLabels

public int deleteCheckpointLabels(java.lang.String checkpointLabel)
                           throws RevisionException
Delete all label names from all flagged revision objects.

Specified by:
deleteCheckpointLabels in interface RevisionManager
Parameters:
checkpointLabel - name of the checkpoint label
Returns:
number of deleted labels
Throws:
RevisionException - revision feature not enabled
See Also:
RevisionManager.deleteCheckpointLabels(java.lang.String)

getMinorVersion

public int getMinorVersion(javax.xml.registry.infomodel.RegistryObject regObj)
                    throws RevisionException
Get the minor version number of a registry object.

Specified by:
getMinorVersion in interface RevisionManager
Parameters:
regObj - any registry object
Returns:
minor version
Throws:
RevisionException

getCheckpointLabel

public java.lang.String getCheckpointLabel(javax.xml.registry.infomodel.RegistryObject regObj)
                                    throws RevisionException
Get the checkpoint label name of a registry object from the revision part. If the object specified is a original one then the label name from the highest revision is returned.

Specified by:
getCheckpointLabel in interface RevisionManager
Parameters:
regObj - a registry object (original or from revision part)
Returns:
the checkpoint label name (empty string if no label set)
Throws:
RevisionException

purge

public int purge(javax.xml.registry.infomodel.RegistryObject regObj,
                 int keepCount)
          throws RevisionException
Purge old versions based on the given registry object.

Specified by:
purge in interface RevisionManager
Parameters:
regObj - a registry object
keepCount - number of objects to keep (the value must be > 0)
Returns:
number of objects deleted
Throws:
RevisionException - revision feature not enabled
java.lang.IllegalArgumentException - invalid parameter detected

purge

public int purge(java.util.Collection<java.lang.String> objectTypes,
                 int keepCount)
          throws RevisionException
Purge old versions of objects in the registry. If objectTypes are specified then the purge is performed only to those, otherwise the entire registry will be purged.

Specified by:
purge in interface RevisionManager
Parameters:
objectTypes - collection of object types to purge (shape: {namespace}type) null or empty list: purge all objects in the registry
keepCount - number of objects to keep (the value must be > 0)
Returns:
number of objects deleted
Throws:
RevisionException - revision feature not enabled
java.lang.IllegalArgumentException - invalid parameter detected

printRevisions

public void printRevisions(javax.xml.registry.infomodel.RegistryObject regObj)
                    throws RevisionException
Prints all the revisions of an object to the console. Useful for debugging reasons.

Parameters:
regObj - a registry object
Throws:
RevisionException