Service Registry 3.1 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 certain ways. See Retrieving the Audit Trail of an Object for details on these events and on how to obtain information about them.

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


Note –

At this release, versioning of objects is disabled by default. To enable versioning of objects, an administrator must perform the task described in Enabling Versioning of Registry Objects in Service Registry 3.1 Administration Guide. The administrator commonly enables versioning for some object types but not for all.


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 = blcm.createKey(id);
Collection keys = new ArrayList();
keys.add(key);

// deprecate the object
blcm.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

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

  2. Type the following command:


    Ant-base/ant approve-obj -Did=id-string
    
  3. Type the following command:


    Ant-base/ant deprecate-obj -Did=id-string
    
  4. Type the following command:


    Ant-base/ant undeprecate-obj -Did=id-string