OpenId
generic naming rule attribute
For each object, you must specify attributes, and define
a naming rule that indicates which of these attributes provide a unique
value. The naming rules vary depending on the hierarchy type. The
new generic types that are stored in the simple
package,
are stored with the use of the same naming rules as in the old CDM.
Objects that inherit from the SStandaloneObject
type
are stored with the openId
attribute. Objects that
inherit from the SContextualObject
type are stored
with the context
and scopedId
attributes.
Both openId
and scopedId
attributes are of the string type in a database, but on the API
level they are of a new Java type OpenId
. As a result,
those attributes have a specific format, aligned with the OpenId schema.
The OpenId
type contains methods to easily construct
any meaningful string that represents a value of a naming rule. The
values that are specified in the openId
attribute
are the source for GUID calculation.
Examples
- Example 1
- For servers, naming rule is usually based on two attributes. They
are the primary service access point that is created from the server's
primary IP address, and a port, on which this service listens on.
The
openId
attribute is specified in the following way:id = OpenId().addId('IP' , seed.getPrimaryIpAddress().getStringNotation()).addId('port' , str(seed.getPort()))
- Example 2
- In Common Data Model, the old
ComputerSystem
type has a naming rule based on themanufacturer
,model
, andserialNumber
attributes. These three attributes are defined in the class explicitly and when values are set for them, aComputerSystem
object can be stored.
Then an object with the following attribute map is stored in the persistence layer :LinuxUnitaryComputerSystem cs = ModelFactory.newInstance(LinuxUnitaryComputerSystem.class); cs.setManufacturer("RedHat"); cs.setModel("Linux"); cs.setSerialNumber("as00123012");
manufacturer -> RedHat serialNumber -> as00123012 isPlaceholder -> false model -> Linux
- Example 3
- The
OpenId
type can also be set in the following way:
The following attribute map is stored:scs.setOpenId(new OpenId().addId("clusterInternalId", "66"));
manufacturer -> RedHat serialNumber -> as00123012 model -> LinuxhierarchyType -> RedHat isPlaceholder -> false hierarchyDomain -> sys.unix.linux openId -> <openId><id><name>clusterinternalid</name><value>66</value></id></openId>
- Example 4
- Adding a function to this simplified computer system is very similar.
The following example shows how to create the
OpenId
attribute from values that are already set for the simplified class attributes:
The following attribute map is stored:SFunction sf = ModelFactory.newInstance(SFunction.class); sf.setName("Cisco Firewall"); sf.setHierarchyDomain("function.net.firewall"); sf.setHierarchyType("Cisco"); OpenId fid = new OpenId(sf); fid.addId("name", null); fid.addId("type", "firewall"); sf.setScopedId(fid); sf.setProvider(scs);
hierarchyType -> Cisco isPlaceholder -> false provider -> {hierarchyType=RedHat;hierarchyDomain=sys.unix.linux;isPlaceholder=false;openId=<openId><id><name>clusterinternalid</name><value>66</value></id></openId>;} hierarchyDomain -> function.net.firewall name -> Cisco Firewall scopedId -> <openId><id><name>name</name><value>Cisco Firewall</value></id><id><name>type</name><value>firewall</value></id></openId>
- Example 5
- To easily create one simple id without any distinction for particular
attributes inside, set the attribute in the following way:
The following attribute map is stored:OpenId fid = new OpenId(sf); sf.setProvider(scs); sf.setScopedId(new OpenId().addId("id19921"));
hierarchyType -> Cisco isPlaceholder -> false provider -> {hierarchyType=RedHat;hierarchyDomain=sys.unix.linux;isPlaceholder=false;openId=<openId><id><name>clusterinternalid</name><value>66</value></id></openId>;} hierarchyDomain -> function.net.firewall name -> Cisco Firewall scopedId -> <openId><id><name>id</name><value>id19921</value></id></openId>