Service Registry 3.1 Developer's Guide

Adding Slots to Objects

Slots are arbitrary attributes, so the API provides maximum flexibility for you to create them. You can provide a name, one or more values, and a type. The name and type are String objects. The name is ordinarily a human-friendly URN. The type is the unique identifier value of a concept in the canonical DataType classification scheme; see Constants for Data Type Concepts.

The value or values are stored as a Collection of String objects, but the LifeCycleManager.createSlot method has a form that allows you to specify a single String value. For example, the following code fragment creates a slot using a String value, then adds the slot to the object.

String slotName = "urn:com:acme:organizationalUnit:Branch";
String slotValue = "Paris";
String slotType = CanonicalConstants.CANONICAL_DATA_TYPE_ID_String;
Slot slot = blcm.createSlot(slotName, slotValue, slotType);
org.addSlot(slot);

The example INSTALL/registry-samples/publish-object/src/JAXRPublishObject.java, described in Adding Classifications: Example, also adds a slot to an object.