Service Registry 3 2005Q4 Developer's Guide

Changing the State of Objects in the Registry

You add an AuditableEvent object to the audit trail of an object when you publish the object to the Registry or when you modify the object in any way. See Retrieving the Audit Trail of an Object for details on these events and on how to obtain information about them. Retrieving the Audit Trail of an Object describes the events and how they are created.

Many events are created as a side effect of some other action:


Note –

Versioning of objects is enabled by default when you publish using the JAXR API. Versioning is disabled by default when you publish using the Web Console.


You can also change the state of objects explicitly. This feature may be useful in a production environment where different versions of objects exist and where you wish to use some form of version control. For example, you can approve a version of an object for general use and deprecate an obsolete version before you remove it. If you change your mind after deprecating an object, you can undeprecate it. As a registered user, you can perform these actions only on objects you own.

The LifeCycleManagerImpl.approveObjects method has the following signature:

public BulkResponse approveObjects(java.util.Collection keys)
    throws JAXRException

The code to deprecate an object typically looks like this:

String id = id_string;
Key key = lcm.createKey(id);
Collection keys = new ArrayList();
keys.add(key);

// deprecate the object
lcm.deprecateObjects(keys);

It is possible to restrict access to these actions to specific users, user roles, and user groups, such as registry administrators. See Controlling Access to Objects.

No AuditableEvent is created for actions that do not alter the state of a RegistryObject. For example, queries do not generate an AuditableEvent, and no AuditableEvent is generated for a RegistryObject when it is added to a RegistryPackage or when you create an Association with the object as the source or target.

Changing the State of Objects in the Registry: Examples

For examples of approving, deprecating, undeprecating objects, see the examples in <INSTALL>/registry/samples/auditable-events/src: JAXRApproveObject.java, JAXRDeprecateObject.java, and JAXRUndeprecateObject.java. Each example performs an action on an object whose unique identifier you specify, then displays the object’s audit trail so that you can see the effect of the example.

For all examples, the object that you specify must be one that you created.

ProcedureTo Run the JAXRApproveObject, JAXRDeprecateObject, and JAXRUndeprecateObject Examples

Steps
  1. Go to the directory <INSTALL>/registry/samples/auditable-events.

  2. Type the following command:


    asant approve-obj -Did=id_string
    
  3. Type the following command:


    asant deprecate-obj -Did=id_string
    
  4. Type the following command:


    asant undeprecate-obj -Did=id_string