Package javax.cim
Class CIMObjectPath
- java.lang.Object
-
- javax.cim.CIMObjectPath
-
- All Implemented Interfaces:
java.io.Serializable
public class CIMObjectPath extends java.lang.Object implements java.io.Serializable
This class represents the CIM Object Path as defined by the Distributed Management Task Force (DMTF) CIM Infrastructure Specification (DSP004). In order to uniquely identify a given object, a CIM object path includes the host, namespace, object name and keys (if the object is an instance).
For example, the object path:
http://myserver/root/cimv2:My_ComputerSystem.Name=mycomputer, CreationClassName=My_ComputerSystem
has two parts:
- Namespace Path
- Model Path
Name=mycomputer
-
CreationClassName=My_ComputerSystem
http://myserver/root/cimv2
JSR48 defines the namespace path to include the scheme, host, port (optional) and namespace
The example specifies the"root/cimv2"
namespace on the hostmyserver
.My_ComputerSystem.Name=mycomputer,CreationClassName=My_ComputerSystem
DSP0004 defines the model path for a class or qualifier type as the name of the class/qualifier type
DSP0004 defines the model path for an instance as the class name.(key=value),*
The example specifies an instance for the classMy_ComputerSystem
which is uniquely identified by two key properties and values:- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor Description CIMObjectPath(java.lang.String pObjectPath)
Constructs a CIM Object Path referencing a CIM element.CIMObjectPath(java.lang.String pScheme, java.lang.String pHost, java.lang.String pPort, java.lang.String pNamespace, java.lang.String pObjectName, CIMProperty<?>[] pKeys)
Constructs a CIM Object Path referencing an instance of the specified CIM element as defined in the specified namespace on the specified host and identified by the given key properties and their corresponding values.CIMObjectPath(java.lang.String pScheme, java.lang.String pHost, java.lang.String pPort, java.lang.String pNamespace, java.lang.String pObjectName, CIMProperty<?>[] pKeys, java.lang.String pXmlSchemaName)
Constructs a CIM Object Path referencing an instance of the specified CIM element as defined in the specified namespace on the specified host and identified by the given key properties and their corresponding values.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
equals(java.lang.Object pObj)
Compares this CIM object path with the specified CIM object path for equality.boolean
equalsModelPath(CIMObjectPath pModelPath)
Compares this model path with the specified model path for equality.java.lang.String
getHost()
Gets the host.CIMProperty<?>
getKey(java.lang.String pName)
Gets a key property by name.CIMProperty<?>[]
getKeys()
Gets all key properties.java.lang.Object
getKeyValue(java.lang.String pName)
java.lang.String
getNamespace()
Gets the namespace.java.lang.String
getObjectName()
Gets the object name.java.lang.String
getPort()
Gets the the port on the host to which the connection was established.java.lang.String
getScheme()
Get the connection scheme.java.lang.String
getXmlSchemaName()
Get the XML Schema for this object (optional).int
hashCode()
Computes the hash code for this object path.java.lang.String
toString()
Returns aString
representation of the CIM object path.
-
-
-
Constructor Detail
-
CIMObjectPath
public CIMObjectPath(java.lang.String pObjectPath)
Constructs a CIM Object Path referencing a CIM element. The name can refer to a class name or a qualifier type name, depending on the particular CIM element identified. In order to refer to an instance, the key properties and their corresponding values must be set.
Should be able to handle strings, like:
http://myserver.org:5066/root/cimv2:My_ComputerSystem.Name="mycmp",CreationClassName="My_ComputerSystem"
http://myserver.org/root/cimv2:My_ComputerSystem.Name="mycmp",CreationClassName="My_ComputerSystem"
//myserver.org/root/cimv2:My_ComputerSystem
/root/cimv2:My_ComputerSystem- Parameters:
pObjectPath
- The string representation of an object path for a CIM element that will be parsed and used to initialize the object.- Throws:
java.lang.IllegalArgumentException
- If thepObjectPath
isnull
or an empty string.
-
CIMObjectPath
public CIMObjectPath(java.lang.String pScheme, java.lang.String pHost, java.lang.String pPort, java.lang.String pNamespace, java.lang.String pObjectName, CIMProperty<?>[] pKeys)
Constructs a CIM Object Path referencing an instance of the specified CIM element as defined in the specified namespace on the specified host and identified by the given key properties and their corresponding values. Note that the connection mechanism and the port number to which a client connection is established are also specified.
NOTE: When using this API against OpenPegasus CIMOM, do not provide the preceding '/' in the namespace parameter. For example, OpenPegasus will accept"root/cimv2"
as a namespace but will not accept"/root/cimv2"
.- Parameters:
pScheme
- The connection scheme to the host (e.g. http, https, ...)pHost
- The host name or IP Address.pPort
- The port on the host to which the connection was established.pNamespace
- The namepace in which the CIM element is defined.pObjectName
- The name of the CIM element referenced.pKeys
- The keys and their corresponding values that identify an instance of the CIM element.
-
CIMObjectPath
public CIMObjectPath(java.lang.String pScheme, java.lang.String pHost, java.lang.String pPort, java.lang.String pNamespace, java.lang.String pObjectName, CIMProperty<?>[] pKeys, java.lang.String pXmlSchemaName)
Constructs a CIM Object Path referencing an instance of the specified CIM element as defined in the specified namespace on the specified host and identified by the given key properties and their corresponding values. Note that the connection mechanism and the port number to which a client connection is established are also specified.
NOTE: When using this API against OpenPegasus CIMOM, do not provide the preceding '/' in the namespace parameter. For example, OpenPegasus will accept"root/cimv2"
as a namespace but will not accept"/root/cimv2"
.- Parameters:
pScheme
- The connection scheme to the host (e.g. http, https, ...)pHost
- The host name or IP Address.pPort
- The port on the host to which the connection was established.pNamespace
- The namepace in which the CIM element is defined.pObjectName
- The name of the CIM element referenced.pKeys
- The keys and their corresponding values that identify an instance of the CIM element.pXmlSchemaName
- The name of the XML Schema for this object. This is only needed for protocols that require this information.
-
-
Method Detail
-
equals
public boolean equals(java.lang.Object pObj)
Compares this CIM object path with the specified CIM object path for equality.- Overrides:
equals
in classjava.lang.Object
- Parameters:
pObj
- The object to compare to this CIM object path. Only the model paths are compared.- Returns:
true
if the specified path references the same object, otherwisefalse
is returned.
-
equalsModelPath
public boolean equalsModelPath(CIMObjectPath pModelPath)
Compares this model path with the specified model path for equality. If the model path includes references, then the references will also be compared for the model path (i.e. the namespace part of the object path will be ignored).- Parameters:
pModelPath
- The object to compare.- Returns:
true
if the specified path references the same object, otherwisefalse
.
-
getHost
public java.lang.String getHost()
Gets the host.- Returns:
- The name of the host.
-
getKey
public CIMProperty<?> getKey(java.lang.String pName)
Gets a key property by name.- Parameters:
pName
- The name of the key property to retrieve.- Returns:
- The
CIMProperty
with the given name, ornull
if it is not found.
-
getKeys
public CIMProperty<?>[] getKeys()
Gets all key properties.- Returns:
- The container of key properties.
-
getKeyValue
public java.lang.Object getKeyValue(java.lang.String pName)
- Parameters:
pName
- The name of the key property to retrieve.- Returns:
- The value of the key property.
-
getNamespace
public java.lang.String getNamespace()
Gets the namespace.- Returns:
- The name of the namespace.
-
getObjectName
public java.lang.String getObjectName()
Gets the object name. Depending on the type of CIM element referenced, this may be either a class name or a qualifier type name.- Returns:
- The name of this CIM element.
-
getPort
public java.lang.String getPort()
Gets the the port on the host to which the connection was established.- Returns:
- The port on the host.
-
getScheme
public java.lang.String getScheme()
Get the connection scheme.- Returns:
- The connection scheme (e.g. http, https,...)
-
getXmlSchemaName
public java.lang.String getXmlSchemaName()
Get the XML Schema for this object (optional).- Returns:
- The XML Schema name.
-
hashCode
public int hashCode()
Computes the hash code for this object path.- Overrides:
hashCode
in classjava.lang.Object
- Returns:
- The integer representing the hash code for this object path.
-
toString
public java.lang.String toString()
Returns aString
representation of the CIM object path. This method is intended to be used only for debugging purposes. The format of the value returned may vary between implementations. The string returned may be empty but may not benull
.- Overrides:
toString
in classjava.lang.Object
- Returns:
- A string representation of this CIM object path.
-
-