Service Registry 3.1 Developer's Guide

Identifying Objects

As stated in Finding Objects by Unique Identifier, every object in the Registry has two identifiers, a unique identifier and a logical identifier. If you do not set these identifiers when you create the object, the Registry generates a unique value and assigns that value to both the unique and the logical identifiers.

Whenever a new version of an object is created, the logical identifier remains the same as the original one, but the Registry generates a new unique identifier by adding a colon and the version number to the unique identifier. See Retrieving the Version of an Object and Creating Relationships Between Objects: Associations for more information.

If you are creating long-lived objects, you should establish a hierarchical identification scheme with human-friendly names. Then you can use API methods to set object identifiers. You can find examples of human-friendly identifier names in many of the objects that populate the default Registry database. For example, the organization in this database has the identifier urn:freebxml:registry:Organization:freebXMLRegistry.

In the JAXR API, the unique identifier is called a Key object. You can use the LifeCycleManager.createKey method to create a unique identifier from a String object. You can then use the RegistryObject.setKey method to set the key.

The logical identifier is called a lid. The JAXR provider for the Registry has an implementation-specific method, RegistryObjectImpl.setLid, which also takes a String argument, for setting this identifier. The method has the following signature:

public void setLid(java.lang.String lid)
    throws JAXRException

Any identifier that you specify must be a valid, globally unique URN (Uniform Resource Name). When the JAXR API generates a key for an object, the key is in the form of a DCE 128 UUID (Universal Unique IDentifier).

If you set the unique identifier but do not set the lid, the Registry assigns the object a lid that has the same value as the unique identifier. If you set the lid explicitly when you create an object, the value should be the same as that of the unique identifier.

Most of the sample programs do not set identifiers, because the objects they create are not expected to be long-lived or unique objects.