Service Registry 3.1 Update 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 in Service Registry in Service Registry 3.1 Update 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
    

    For example, if you specify the unique identifier of the RegistryPackage object you created in Organizing Objects Within Registry Packages: Examples, the output of the approve-obj target looks something like this:


    approve-obj:
         [java] ID string is urn:uuid:182e383b-1244-4e9f-9439-bddac093ebe7
         [java] Query URL is http://localhost:6480/soar/registry/soap
         [java] Publish URL is http://localhost:6480/soar/registry/soap
         [java] Created connection to registry
         [java] Established security credentials
         [java] Got registry service, query manager, and life cycle manager
         [java] Object type is RegistryPackage
         [java] Object name is FreePackage
         [java] Object description is Package with objects named free
         [java] Object key id is urn:uuid:182e383b-1244-4e9f-9439-bddac093ebe7
         [java] Current audit trail:
         [java] FreePackage created 2007-07-23 01:21:40.0
         [java] Approved the object
         [java] Object saved
         [java] Audit trail for approved object:
         [java] FreePackage created 2007-07-23 01:21:40.0
         [java] FreePackage approved 2007-07-23 01:28:26.0
  3. Type the following command:


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

    The output of the deprecate-obj target for the same object looks something like this:


    deprecate-obj:
         [java] ID string is urn:uuid:182e383b-1244-4e9f-9439-bddac093ebe7
         [java] Query URL is http://localhost:6480/soar/registry/soap
         [java] Publish URL is http://localhost:6480/soar/registry/soap
         [java] Created connection to registry
         [java] Established security credentials
         [java] Got registry service, query manager, and life cycle manager
         [java] Object type is RegistryPackage
         [java] Object name is FreePackage
         [java] Object description is Package with objects named free
         [java] Object key id is urn:uuid:182e383b-1244-4e9f-9439-bddac093ebe7
         [java] Current audit trail:
         [java] FreePackage created 2007-07-23 01:21:40.0
         [java] FreePackage approved 2007-07-23 01:28:26.0
         [java] Deprecated the object
         [java] Object saved
         [java] Audit trail for deprecated object:
         [java] FreePackage created 2007-07-23 01:21:40.0
         [java] FreePackage approved 2007-07-23 01:28:26.0
         [java] FreePackage deprecated 2007-07-23 01:30:47.0
  4. Type the following command:


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

    The output of the undeprecate-obj target for the same object looks something like this:


    undeprecate-obj:
         [java] ID string is urn:uuid:182e383b-1244-4e9f-9439-bddac093ebe7
         [java] Query URL is http://localhost:6480/soar/registry/soap
         [java] Publish URL is http://localhost:6480/soar/registry/soap
         [java] Created connection to registry
         [java] Established security credentials
         [java] Got registry service, query manager, and life cycle manager
         [java] Object type is RegistryPackage
         [java] Object name is FreePackage
         [java] Object description is Package with objects named free
         [java] Object key id is urn:uuid:182e383b-1244-4e9f-9439-bddac093ebe7
         [java] Current audit trail:
         [java] FreePackage created 2007-07-23 01:21:40.0
         [java] FreePackage approved 2007-07-23 01:28:26.0
         [java] FreePackage deprecated 2007-07-23 01:30:47.0
         [java] Undeprecated the object
         [java] Object saved
         [java] Audit trail for undeprecated object:
         [java] FreePackage created 2007-07-23 01:21:40.0
         [java] FreePackage approved 2007-07-23 01:28:26.0
         [java] FreePackage deprecated 2007-07-23 01:30:47.0
         [java] FreePackage undeprecated 2007-07-23 01:32:05.0