com.centrasite.registry.revision.admin
Class RevisionAdministrator

java.lang.Object
  extended by com.centrasite.registry.revision.admin.RevisionAdministrator

public class RevisionAdministrator
extends java.lang.Object

This class has the task to enable (resp. disable) the CentraSite revision environment. After enablement, all new/updated JAXR objects get versioned.


Nested Class Summary
static class RevisionAdministrator.SchemaType
           
 
Constructor Summary
RevisionAdministrator(javax.xml.registry.Connection connection)
          Constructor.
RevisionAdministrator(com.centrasite.jaxr.JAXRAccessor jaxr)
          Constructor.
 
Method Summary
static java.lang.String createObjectType(java.lang.String namespace, java.lang.String type)
          Delivers an objectType string in the shape: "{namespace}type"
 void defineUserSchema(java.lang.String schemaName)
          Define a doctype-schema from user defined type.
 void disable()
          Disable the revision and checkpoint environment.
 void enable()
          Enable the revision and checkpoint environment.
 void enableNewTypes()
          Enable new types during repair: a repair step has added a new type or some new types, now create the corresponding versioned schemas.
 boolean isEnabled()
          Checks it the revision infrastructure is enabled.
static void main(java.lang.String[] args)
          Main entry that provides the possiblity to activate the revision feature via direct call (from the command line)
 void printStatus(boolean extended)
          Print status about enabling of revision.
 void setLogging(boolean logging)
          Enable logging during revision enablement.
 void undefineUserSchema(java.lang.String schemaName)
          Undefine a doctype-schema from user defined type.
 void update(RevisionAdministrator.SchemaType schemaType)
          update the base schemas during repair: a repair step has updated one of the base schemas, now update the versioned schema by recreating it.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

RevisionAdministrator

public RevisionAdministrator(com.centrasite.jaxr.JAXRAccessor jaxr)
                      throws javax.xml.registry.JAXRException
Constructor.

Parameters:
jaxr - a jaxr accessor
Throws:
javax.xml.registry.JAXRException

RevisionAdministrator

public RevisionAdministrator(javax.xml.registry.Connection connection)
                      throws javax.xml.registry.JAXRException
Constructor.

Parameters:
connection - a jaxr connection
Throws:
javax.xml.registry.JAXRException
Method Detail

setLogging

public void setLogging(boolean logging)
Enable logging during revision enablement. If set to true then messages will be printed to the console. This method must be called prior to the enable() method.

Parameters:
logging - true: do logging during enable()

enable

public void enable()
            throws RevisionException
Enable the revision and checkpoint environment. It creates the version collection with all doctypes from CentraSite collection and creates the first version of each user object.

After enablement all JAXR objects will create revisions on insert and update. It has no effect if the feature is already enabled. Finally it commits all the updates.

Throws:
RevisionException - could not be enabled

disable

public void disable()
             throws RevisionException
Disable the revision and checkpoint environment. Deletes the entire version collection with all the version records. Finally it commits all the updates. It has no effect if the feature is not enabled.

Throws:
RevisionException - internal error

enableNewTypes

public void enableNewTypes()
                    throws java.lang.Exception
Enable new types during repair: a repair step has added a new type or some new types, now create the corresponding versioned schemas. The new types are always user-defined.

Throws:
java.lang.Exception

update

public void update(RevisionAdministrator.SchemaType schemaType)
            throws java.lang.Exception
update the base schemas during repair: a repair step has updated one of the base schemas, now update the versioned schema by recreating it.

Throws:
java.lang.Exception

isEnabled

public boolean isEnabled()
Checks it the revision infrastructure is enabled.

Returns:
true: revision is enabled; false: disabled

defineUserSchema

public void defineUserSchema(java.lang.String schemaName)
Define a doctype-schema from user defined type. The schema is expected to be in the CentraSite collection. It prepares the doctype schema for the revision collection (v.CentraSite) and issues a "define". Typically called from the SchemaHandler which handles new schemas. Note: errors are ignored and only logged.

Parameters:
schemaName - the name of the schema (typically: "uddi_...")

undefineUserSchema

public void undefineUserSchema(java.lang.String schemaName)
Undefine a doctype-schema from user defined type. Typically called from the SchemaHandler which handles schemas for undefine.

Parameters:
schemaName - the name of the schema (typically: "uddi_...")

printStatus

public void printStatus(boolean extended)
                 throws java.lang.Exception
Print status about enabling of revision.

Parameters:
extended - true: extended view; false: just print "true" or "false"
Throws:
java.lang.Exception

createObjectType

public static java.lang.String createObjectType(java.lang.String namespace,
                                                java.lang.String type)
Delivers an objectType string in the shape: "{namespace}type"

Parameters:
namespace - the namespace of the object
type - the type of the object
Returns:
e.g.: {http://namespaces.CentraSite.com/Schema/jaxr}service

main

public static void main(java.lang.String[] args)
                 throws java.lang.Exception
Main entry that provides the possiblity to activate the revision feature via direct call (from the command line)

Parameters:
args - function [-h host] [-user user] [-password password]

function: -enable, -disable, -check

Throws:
java.lang.Exception