javax.cim
Class CIMInstance

java.lang.Object
  extended byjavax.cim.CIMInstance
All Implemented Interfaces:
javax.cim.CIMNamedElementInterface, java.io.Serializable

public class CIMInstance
extends java.lang.Object
implements javax.cim.CIMNamedElementInterface, java.io.Serializable

This class represents a CIM instance as defined by the Distributed Management Task Force (DMTF) CIM Infrastructure Specification (DSP004).

Since:
JSR48 1.0.0
See Also:
Serialized Form

Constructor Summary
CIMInstance(CIMObjectPath name, CIMProperty[] props)
          Constructs a CIMInstance object using the name and properties specified.
 
Method Summary
 CIMInstance deriveInstance(CIMObjectPath pPath)
          Returns a CIMInstance with the updated CIMObjectPath.
 CIMInstance deriveInstance(CIMProperty[] pArray)
          Returns a CIMInstance with the updated values for the properties in pArray.
 boolean equals(java.lang.Object o)
          Indicates whether some other instance is "equal to" this one.
 CIMInstance filterProperties(boolean localOnly, boolean includeClassOrigin, java.lang.String[] propertyList)
          This method returns a new CIMInstance with properties filtered according to the input parameters.
 java.lang.String getClassName()
          Get the name of the class that instantiates this CIM instance
 CIMProperty[] getKeys()
          Get the key properties for this instance.
 CIMObjectPath getObjectPath()
          Returns the CIMObjectPath that represents this instance.
 CIMProperty[] getProperties()
          Retrieve an array of the properties for this instance.
 CIMProperty getProperty(int pIndex)
          Get a class property by index.
 CIMProperty getProperty(java.lang.String name)
          Returns the specified property
 CIMProperty getProperty(java.lang.String name, java.lang.String originClass)
          Returns the specified CIMProperty.
 int getPropertyCount()
          Get the number of properties defined in this CIMClass.
 java.lang.Object getPropertyValue(java.lang.String name)
          Returns the value of a property of this CIM Instance.
 int hashCode()
          Computes the hash code for this instance.
 java.lang.String toString()
          Returns a String representation of the CIMInstance.
 
Methods inherited from class java.lang.Object
getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

CIMInstance

public CIMInstance(CIMObjectPath name,
                   CIMProperty[] props)
Constructs a CIMInstance object using the name and properties specified.

Parameters:
name - The objectpath for this CIMInstance
props - The properties for this CIMInstance
Throws:
java.lang.IllegalArgumentException - name is null or name.getObjectName() is null
[OPTIONAL] - IllegalArgumentException If the key property values do not match the values in the porperty array. This is optional due to the cost of the verification. Some implementations may leave it up to the developer to ensure that the values match.
Method Detail

deriveInstance

public CIMInstance deriveInstance(CIMObjectPath pPath)
Returns a CIMInstance with the updated CIMObjectPath.

Parameters:
pPath - The complete CIMObjectPath for this instance
Returns:
CIMInstance a new CIMInstance with the updated CIMObjectPath

deriveInstance

public CIMInstance deriveInstance(CIMProperty[] pArray)
Returns a CIMInstance with the updated values for the properties in pArray. Any new properties are ignored.

Parameters:
pArray - - The array of properties to update.
Returns:
CIMInstance - a new instance with the updated properties.

equals

public boolean equals(java.lang.Object o)
Indicates whether some other instance is "equal to" this one. Two CIMInstances are considered equal if the names are the same. This method does NOT compare each property value.

Parameters:
o - the object to compare
Returns:
true if the specified path references the same instance, otherwise false.

filterProperties

public CIMInstance filterProperties(boolean localOnly,
                                    boolean includeClassOrigin,
                                    java.lang.String[] propertyList)
This method returns a new CIMInstance with properties filtered according to the input parameters. Inclusion of class origin and qualifiers can also be controlled.

Parameters:
localOnly - Include only the properties values that were instantiated in this instance.
includeClassOrigin - classOrigins are only included if true.
propertyList - If the PropertyList input parameter is not NULL, the members of the array define one or more Property names. The returned Instance does not include elements for any Properties missing from this list. If the PropertyList input parameter is an empty array this signifies that no Properties are included in each returned class. If the PropertyList input parameter is NULL this specifies that all Properties are included in each returned class. If the PropertyList contains duplicate elements or invalid property names, they are ignored.
Returns:
CIMInstance matching the input filter.

getClassName

public java.lang.String getClassName()
Get the name of the class that instantiates this CIM instance

Returns:
name of class that instantiates this CIM instance

getKeys

public CIMProperty[] getKeys()
Get the key properties for this instance.

Returns:
an array of key properties.

getObjectPath

public CIMObjectPath getObjectPath()
Returns the CIMObjectPath that represents this instance.

Specified by:
getObjectPath in interface javax.cim.CIMNamedElementInterface
Returns:
the CIMObjectPath that represents this instance

getProperties

public CIMProperty[] getProperties()
Retrieve an array of the properties for this instance.

Returns:
CIMProperty[] An array of the CIM properties for this instance

getProperty

public CIMProperty getProperty(int pIndex)
Get a class property by index.

Parameters:
pIndex - The index of the class property to retrieve
Returns:
The CIMProperty at the specified index.

getProperty

public CIMProperty getProperty(java.lang.String name)
Returns the specified property

Parameters:
name - The text string for the name of the property
Returns:
CIMProperty The property requested or null if the property does not exist

getProperty

public CIMProperty getProperty(java.lang.String name,
                               java.lang.String originClass)
Returns the specified CIMProperty.

Parameters:
name - The string name of the property to get.
originClass - (Optional) The string name of the class in which the property was defined.
Returns:
CIMProperty Null if the property does not exist, otherwise returns the CIM property.

getPropertyCount

public int getPropertyCount()
Get the number of properties defined in this CIMClass.

Returns:
int The number of properties defined in the CIMClass.

getPropertyValue

public java.lang.Object getPropertyValue(java.lang.String name)
Returns the value of a property of this CIM Instance.

Parameters:
name - The name of the property
Returns:
Object The value for the specified property name or null if the property does not exist.

hashCode

public int hashCode()
Computes the hash code for this instance. The hash code will be the object path of the instance not including the host or namespace information.

Returns:
the integer representing the hash code for this object path.

toString

public java.lang.String toString()
Returns a String representation of the CIMInstance. This method is intended to be used only for debugging purposes, and the format of the returned string may vary between implementations. The returned string may be empty but may not be null.

Returns:
string representation of this instance


Java™ WBEM (JSR48) 1.0.0 API