com.sun.wbem.cim
Class CIMInstance

java.lang.Object
  |
  +--com.sun.wbem.cim.CIMElement
        |
        +--com.sun.wbem.cim.CIMInstance

public class CIMInstance
extends CIMElement
implements java.io.Serializable

The CIMInstance class represents an instance of any CIM class. Clients use CIMInstance in conjunction with the CIMClient instance methods like createInstance, setInstance to manipulate instances within a namespace.

Since:
WBEM 1.0
See Also:
CIMClient, Serialized Form

Constructor Summary
CIMInstance()
          Basic CIMInstance constructor.
CIMInstance(java.lang.String name)
          Deprecated. The input name of the instance will no longer be used since the name is generated from the key properties.
 
Method Summary
 CIMInstance filterProperties(java.lang.String[] propertyList, boolean includeQualifier, boolean includeClassOrigin)
          This method returns a new CIMInstance with properties filtered according to the input parameters.
 java.lang.String getAlias()
          Gets the alias name of this CIM instance
 java.lang.String getClassName()
          Gets the name of the class that instantiates this CIM instance
 java.util.Vector getKeyValuePairs()
          Returns a dynamic list of key-value pairs for this CIM instance, not the actual name.
 java.lang.String getName()
          Gets the name of this CIM instance in string form.
 java.util.Vector getProperties()
          Gets the list of properties for this CIM instance
 CIMProperty getProperty(java.lang.String propertyName)
          Gets the values of the specified property
 CIMProperty getProperty(java.lang.String name, java.lang.String originClass)
          Returns a CIM property, a name/value pair that describes a unit of data for a class.
 java.util.Vector getQualifiers()
          Gets the list of qualifiers for this CIM instance
 CIMInstance localElements()
          Returns only the local elements for this instance and filters out the rest.
 CIMInstance localElements(java.util.List classNames)
          Returns only the elements for this instance that have classOrigin set to one of the names in the className list.
 void setAlias(java.lang.String aliasName)
          Sets the alias for this instance
 void setClassName(java.lang.String className)
          Sets the name of the class that instantiates this CIM instance
 void setProperties(java.util.Vector Table)
          Sets the properties for this CIM instance to the specified property list
 void setProperty(java.lang.String name, CIMValue cv)
          Sets the value of the specified property.
 void setQualifiers(java.util.Vector table)
          Sets the qualifiers for this CIM instance to the specified qualifier list
 java.lang.String toMOF()
          Returns a MOF representation of the CIMInstance.
 java.lang.String toString()
          Returns a String representation of the CIMInstance.
 java.lang.String toXml()
          Returns an XML representation of this CIM instance.
 java.lang.String toXml(CIMObjectPath cop)
          Returns an XML representation of the specified CIM instance.
 java.lang.String toXml(CIMObjectPath cop, java.lang.String host)
          Returns an XML representation of the specified CIM instance on the specified host.
 void updatePropertyValue(CIMProperty pe)
          Updates the value of the specified CIM property.
 void updatePropertyValues(java.util.Vector v)
          Updates the property values for this CIM instance with the specified list of property values
 
Methods inherited from class com.sun.wbem.cim.CIMElement
assign, equals, lessThan, setName
 
Methods inherited from class java.lang.Object
getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

CIMInstance

public CIMInstance()
Basic CIMInstance constructor. Initializes empty properties, qualifiers and class name.

CIMInstance

public CIMInstance(java.lang.String name)
Deprecated. The input name of the instance will no longer be used since the name is generated from the key properties.

Constructs a CIMInstance.
Parameters:
name - The string name of the CIM instance
Method Detail

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.
Overrides:
toString in class CIMElement
Returns:
string representation of this instance

toMOF

public java.lang.String toMOF()
Returns a MOF representation of the CIMInstance.
Returns:
a string representation of this instance in Managed Object Format (MOF)

getClassName

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

setClassName

public void setClassName(java.lang.String className)
Sets the name of the class that instantiates this CIM instance
Parameters:
className - the string for the name of the class that instantiates this CIM instance

getQualifiers

public java.util.Vector getQualifiers()
Gets the list of qualifiers for this CIM instance
Returns:
Vector list of qualifiers for this CIM instance

setQualifiers

public void setQualifiers(java.util.Vector table)
Sets the qualifiers for this CIM instance to the specified qualifier list
Parameters:
table - The list of qualifiers to be set for the this CIM instance

getProperties

public java.util.Vector getProperties()
Gets the list of properties for this CIM instance
Returns:
Vector The list of properties for this CIM instance

setProperties

public void setProperties(java.util.Vector Table)
Sets the properties for this CIM instance to the specified property list
Parameters:
Table - The list of properties to set for this CIM instance

getProperty

public CIMProperty getProperty(java.lang.String name,
                               java.lang.String originClass)
Returns a CIM property, a name/value pair that describes a unit of data for a class. Property values must have a valid Managed Object Format (MOF) data type.
Parameters:
name - The name of the property to get.
originClass - The class in which the property was defined.
Returns:
CIMProperty Null if the property does not exist, otherwise returns the reference to the property.

getProperty

public CIMProperty getProperty(java.lang.String propertyName)
Gets the values of the specified property
Parameters:
propertyName - The text string for the name of the property
Returns:
CIMProperty Values for the specified property. Returns Null if the property table is empty.

getAlias

public java.lang.String getAlias()
Gets the alias name of this CIM instance
Returns:
String the alias of the instance, null if no alias exists.

setAlias

public void setAlias(java.lang.String aliasName)
Sets the alias for this instance
Parameters:
aliasName - the alias name of this CIM instance

getName

public java.lang.String getName()
Gets the name of this CIM instance in string form. This method forms the name by concatenating its named key property values, including all key values of its scoping objects. Class names and property names are presented in lower case to make the the instance name insensitive to the case of these class and property names.
Overrides:
getName in class CIMElement
Returns:
String the name of this CIM instance

getKeyValuePairs

public java.util.Vector getKeyValuePairs()
Returns a dynamic list of key-value pairs for this CIM instance, not the actual name. This method is useful in cases where, programatically, you want to have a new name. For example, when updating the name of a key, a program can display all the keys available to be updated. You can then look through the list to see which names are already being used and then assign a name to the key, knowing that you have not selected a name that was already used.
Returns:
Vector the list of CIM properties and values for this CIM instance

updatePropertyValues

public void updatePropertyValues(java.util.Vector v)
Updates the property values for this CIM instance with the specified list of property values
Parameters:
v - the list of CIM properties and values for this CIM instance

updatePropertyValue

public void updatePropertyValue(CIMProperty pe)
Updates the value of the specified CIM property.
Parameters:
pe - CIM property to update. pe contains the value to be used.

setProperty

public void setProperty(java.lang.String name,
                        CIMValue cv)
Sets the value of the specified property. This is another form of the updatePropertyValue method.
Parameters:
name - The name of the property to set. Can also be in the form "originClass.propertyName".
cv - The value to set to.
Throws:
java.lang.IllegalArgumentException -  

localElements

public CIMInstance localElements()
Returns only the local elements for this instance and filters out the rest. This works like a clone method. Note that this depends on the classOrigin property of its elements, so it will not work if you invoke filterProperties and set includeClassOrigin to false.
Returns:
CIMInstance populated with the local elements.
See Also:
filterProperties(java.lang.String[], boolean, boolean)

localElements

public CIMInstance localElements(java.util.List classNames)
Returns only the elements for this instance that have classOrigin set to one of the names in the className list. Thus, only the elements local to the classes specified in the className list are retained. The rest are filtered out. This works like a clone method. Note that this depends on the classOrigin property of its elements, so it will not work if you invoke filterProperties and set includeClassOrigin to false.
Parameters:
className - A list of strings containing the classes with which the classOrigin must be matched.
Returns:
CIMInstance populated with the specified elements.
See Also:
filterProperties(java.lang.String[], boolean, boolean)

filterProperties

public CIMInstance filterProperties(java.lang.String[] propertyList,
                                    boolean includeQualifier,
                                    boolean includeClassOrigin)
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:
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.
includeQualifier - qualifiers are only included if true.
includeClassOrigin - classOrigins are only included if true.
Returns:
CIMInstance matching the input filter.
See Also:
localElements()

toXml

public java.lang.String toXml()
Returns an XML representation of this CIM instance.
Returns:
An XML representation of this CIM instance, using XML elements from the default XML namespace.

toXml

public java.lang.String toXml(CIMObjectPath cop)
Returns an XML representation of the specified CIM instance.
Parameters:
cop - The CIMObjectPath to use when creating the the XML representation.
Returns:
An XML representation of the CIM instance, using XML elements from the default XML namespace.

toXml

public java.lang.String toXml(CIMObjectPath cop,
                              java.lang.String host)
Returns an XML representation of the specified CIM instance on the specified host.
Parameters:
cop - The CIMObjectPath to use when creating the XML representation.
host - The host to use when creating the XML representation.
Returns:
An XML representation of the CIM instance, using the object path and host specified.