Class ObjectPath

java.lang.Object
net.aifusion.metamodel.ObjectPath

public class ObjectPath extends Object
Class to represent a CIM ObjectPath. An object path represents the globally unique name of a named element, and can be used to access that element.
Author:
Sharad Singhal
  • Constructor Details

    • ObjectPath

      public ObjectPath(ElementType type, String objectName, NameSpacePath path, Map<String,DataValue> keys, String alias)
      Create an object path based on its type, name, name space path, and key-value pairs
      Parameters:
      type - - type of named object (must be non-null)
      objectName - - name of the object (must be non-null)
      path - - Name space path for this object (must be non-null)
      keys - - keys associated with this object (must be non-null for instances; must be null or empty for all other element types)
      alias - - alias, if any defined on this object.
    • ObjectPath

      public ObjectPath(ElementType elementType, String className, String alias)
      Create an object path based on a class name and an instance alias, where alias is of the form "$" [a-zA-Z0-9_]+
      Parameters:
      elementType - Type of this element (instance or structurevalue)
      className - - name of class or structure
      alias - - alias for the instance of the class, or value of the structure
    • ObjectPath

      public ObjectPath(String objectName)
      Create an object path from a path specification as defined in DSP0004 and extended for CimV3. The following forms are recognized
      className: schemaName "_" identifier
      instanceName : className "." key "=" dataValue [, key "=" dataValue]*
      localClassPath : ["/elementType"] "/" pathName ["/" pathName]* ":" className
      localInstancePath : ["/instanceType"] "/" pathName ["/" pathName]* ":" instanceName
      classPath : scheme "://" authority localClassPath
      instancePath : scheme "://" authority localInstancePath
      where
      schemaName : [A-Za-z0-9]+
      identifier : [A-Za-z0-9_]+
      scheme : [A-Za-z0-9+-.]+
      authority : ascii char set not including "/"
      The term "/elementType" above can take the forms "/" ["class" | "structure" | "enumeration" | "qualifiertype" | "interface"]
      The term "/instanceType" above can take the forms "/" ["instance" | "structurevalue"]
      Parameters:
      objectName - - string dataValue containing object name
    • ObjectPath

      public ObjectPath(URI uri)
      Construct an object path from a URI
      Parameters:
      uri - - Properly constructed URI. In the URI, the localPath is expected to be of the form:
      uri = '/' elementType '/' localPathElement [ ('/' localPathElement)* ] '/' ElementName [InstanceLocator] instanceLocator = '?' keyName ',' dataType '=' value (['&' keyName ',' dataType '=' value)*
  • Method Details

    • getElementType

      public ElementType getElementType()
      Get the element type represented in this object path
      Returns:
      - element type represented by this path
    • getName

      public String getName()
      Get the name of the element in this path
      Returns:
      - name of the element in the path
    • getLowerCaseName

      public String getLowerCaseName()
      Get the normalized case name of the element in this path
      Returns:
      - lower case name of the element in the path
    • getNameSpacePath

      public NameSpacePath getNameSpacePath()
      Get the name space path associated with this object path
      Returns:
      - name space path associated with this object path. Null is returned if no namespace path is associated with the object path (e.g., for alias values)
    • getLocalPath

      public String getLocalPath()
      Get the localPath corresponding to this objectPath
      Returns:
      - local path for this objectPath. Default is returned if none specified
    • getAlias

      public String getAlias()
      Get the alias value associated with this object path
      Returns:
      - alias value. Null if no alias is set in this object path
    • getKeyValue

      public DataValue getKeyValue(String keyName)
      Get the value associated with a given key in this object path
      Parameters:
      keyName - - case insensitive name of the key property
      Returns:
      - value of the key. Null if this path is not a structure/instancevalue, or if no such key exists
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • equals

      public boolean equals(Object obj)
      Overrides:
      equals in class Object
    • getUUID

      public UUID getUUID()
      get a UUID value based on this objectPath. Note that the UUID depends on the element type, local path, and object name and keys, but does NOT depend on the hostname and authority in the namespace
      Returns:
      - Type 3 (Name-based) UUID based on this objectPath
    • toURL

      public URL toURL()
      Create a URL based on this object path. The scheme/authority are extracted from this path, or replaced by defaults if null
      Returns:
      - URL based on this object path
    • getURL

      public URL getURL(String scheme, String authority)
      Create a URL for this objectPath targeted at a given host
      Parameters:
      scheme - - scheme used for this URL. Replaced by a default if null
      authority - - authority used for this URL. Replaced by a default if null
      Returns:
      - URL constructed based on this ObjectPath
      See Also: