com.sun.wbem.cim
Class CIMClass

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

public class CIMClass
extends CIMElement

Creates and instantiates a Java object that represents a CIM class. A CIM class is a template for creating a CIM instance. A CIM class represents a collection of CIM instances, all of which support a common type (for example, a set of properties, methods, and associations).

Since:
WBEM 1.0
See Also:
Serialized Form

Constructor Summary
CIMClass()
          Creates and instantiates a Java object representing a CIM class.
CIMClass(java.lang.String name)
          Creates and instantiates a Java object representing a CIM Class with the specified name.
 
Method Summary
 void addMethod(CIMMethod m)
          Adds the specified CIM method to this CIM class.
 void addProperty(CIMProperty p)
          Adds the specified property to the CIM properties in this CIM class.
 void addQualifier(CIMQualifier q)
          Adds the specified CIM qualifier to the qualifiers in this CIM class.
 CIMClass filterProperties(java.lang.String[] propertyList, boolean includeQualifier, boolean includeClassOrigin)
          This method returns a new CIMClass with properties filtered according to the input parameters.
 java.util.Vector getAllMethods()
          Gets the CIM methods in this CIM class, including overridden ones.
 java.util.Vector getAllProperties()
          Gets the CIM properties in this CIM class, including overriden properties.
 java.util.Vector getKeys()
          Returns a list of key properties in this CIMClass.
 CIMMethod getMethod(java.lang.String name)
          Returns the specified CIM method in this CIM class.
 CIMMethod getMethod(java.lang.String name, java.lang.String originClass)
          Returns the CIM method specified by its name and optionally, its origin class.
 java.util.Vector getMethods()
          Gets the CIM methods in this CIM class.
 java.util.Vector getProperties()
          Gets the CIM properties in this CIM class.
 CIMProperty getProperty(java.lang.String name)
          Returns the specified CIM Property.
 CIMProperty getProperty(java.lang.String name, java.lang.String originClass)
          Returns the specified CIMProperty.
 CIMQualifier getQualifier(java.lang.String name)
          Returns the specified qualifier, if it exists in this CIM class.
 java.util.Vector getQualifiers()
          Gets the CIM Qualifiers in this CIM class.
 java.lang.String getSuperClass()
          Gets the parent of this CIM class.
 boolean hasQualifier(CIMQualifier q)
          Checks whether the specified qualifier is one of the qualifiers in this CIM class.
 boolean isAssociation()
          Identifies whether or not this CIM class is an association.
 boolean isKeyed()
          Convenience method to identify if this class is keyed.
 CIMClass localElements()
          Returns only the local elements for this class and filters out the rest.
 CIMInstance newInstance()
          Returns a new CIM instance initialized with the default CIM properties, qualifiers, and name of this CIM class.
 int numberOfProperties()
          Returns the number of properties in this class.
 int numberOfQualifiers()
          Returns the number of qualifiers declared in this CIM Class.
 boolean removeQualifier(CIMQualifier q)
          Removes the specified qualifier from this CIM class.
 void setIsAssociation(boolean isAssociation)
          Sets the isAssociation field to true to indicate that this CIM class is an association.
 void setIsKeyed(boolean isKeyedValue)
          Takes a boolean that indicates whether or not this CIM class has a key property.
 void setMethods(java.util.Vector Table)
          Replaces the existing methods in this class with the specified methods.
 void setProperties(java.util.Vector Table)
          Replaces the existing CIM properties in this class with the specified CIM properties.
 void setQualifiers(java.util.Vector Table)
          Replaces the CIM qualifiers in this CIM class with the specified CIM qualifiers.
 void setSuperClass(java.lang.String sClass)
          Sets the parent of this CIM class to the name of the super class contained in the specified string.
 java.lang.String toMOF()
          Returns a MOF representation of the CIM class.
 java.lang.String toString()
          Returns a String representation of the CIMClass.
 java.lang.String toXml()
          Returns an XML representation of this CIM class.
 java.lang.String toXml(CIMObjectPath cop)
          Returns an XML representation of the specified CIM object (class or instance).
 java.lang.String toXml(CIMObjectPath cop, java.lang.String host)
          Returns an XML representation of the specified class or instance on the specified host.
 
Methods inherited from class com.sun.wbem.cim.CIMElement
assign, equals, getName, lessThan, setName
 
Methods inherited from class java.lang.Object
getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

CIMClass

public CIMClass()
Creates and instantiates a Java object representing a CIM class. To declare the most basic CIM class, you need only specify the class name. If you use this constructor to create the CIM Class, use the setName method to assign a name to the CIM class.

Example:

 {
 // Connect to the root\cimv2 namespace on the local host and 
 // create a new class called myclass.
 CIMClient cc = new CIMClient();
 // Construct a new CIMClass object.
 CIMClass cimclass = new CIMClass();
 // Set the name of the CIM class to myclass.
 cimclass.setName("myclass");
 ...
 }
 

CIMClass

public CIMClass(java.lang.String name)
Creates and instantiates a Java object representing a CIM Class with the specified name.

Parameters:
name - Name of the CIM class.

Example:

 {
 // Construct a new CIMClass object with the name myclass.
 CIMClass cimclass = new CIMClass(myclass);
 ...
 }
 
Method Detail

toString

public java.lang.String toString()
Returns a String representation of the CIMClass. 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 class

toMOF

public java.lang.String toMOF()
Returns a MOF representation of the CIM class.
Returns:
String Managed Object Format (MOF) representation of this class.

getSuperClass

public java.lang.String getSuperClass()
Gets the parent of this CIM class.
Returns:
String The parent class.

setSuperClass

public void setSuperClass(java.lang.String sClass)
Sets the parent of this CIM class to the name of the super class contained in the specified string.
Parameters:
superClass - The parent class.

isKeyed

public boolean isKeyed()
Convenience method to identify if this class is keyed. Only keyed classes can have instances. Returns true if this CIM class has a key property. Otherwise, returns false.
Returns:
boolean True if this CIM class has a key property. Otherwise returns false.

setIsKeyed

public void setIsKeyed(boolean isKeyedValue)
Takes a boolean that indicates whether or not this CIM class has a key property.
Parameters:
isKeyedValue - True indicates this CIM class has a key property. False indicates this CIM class has no key properties.

getKeys

public java.util.Vector getKeys()
Returns a list of key properties in this CIMClass.
Returns:
Vector The list of key properties in this CIM class.

getQualifier

public CIMQualifier getQualifier(java.lang.String name)
Returns the specified qualifier, if it exists in this CIM class.
Parameters:
name - The string name of the CIM qualifier.
Returns:
CIMQualifier Null if the qualifier does not exist, otherwise returns the CIM qualifier.

getProperty

public CIMProperty getProperty(java.lang.String name)
Returns the specified CIM Property.
Parameters:
name - The string name of the property to get. It can also be of the form "originClass.propertyName"
Returns:
CIMProperty Null if the property does not exist, otherwise returns the CIM property.

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.

getMethod

public CIMMethod getMethod(java.lang.String name)
Returns the specified CIM method in this CIM class.
Parameters:
name - The string name of the method to get. The name can also be in the form "originClass.methodName"
Returns:
CIMMethod Null if the method does not exist, otherwise returns the CIM method.

getMethod

public CIMMethod getMethod(java.lang.String name,
                           java.lang.String originClass)
Returns the CIM method specified by its name and optionally, its origin class. The origin class is the class in which the method is defined.
Parameters:
name - The string name of the method to get.
originClass - (Optional) The class in which the method was defined.
Returns:
CIMMethod Null if the method does not exist, otherwise returns the CIM method.

isAssociation

public boolean isAssociation()
Identifies whether or not this CIM class is an association. An association is a relationship between two (or more) classes or instances of two classes. The properties of an association class include pointers, or references, to the two (or more) instances. All CIM classes can be included in one or more associations.

This method returns true if this CIM class is an association. Otherwise, false.

Returns:
boolean True if this CIM class belongs to an association; otherwise, false.

setIsAssociation

public void setIsAssociation(boolean isAssociation)
Sets the isAssociation field to true to indicate that this CIM class is an association.

An association is a relationship between two classes or between instances of two classes. The properties of an association class include pointers, or references, to the two classes or instances.

Class association is one of the most powerful CIM features. It provides a way to organize a collection of management objects into meaningful relationships. For example, a Solaris_ComputerSystem object might contain a Solaris_Disk, Processor A, and Processor B. The Solaris_ComputerSystem has an association with each of the objects it contains. Because this particular association is a containment association, it is represented by a class called CIM_contains. The CIM_contains class contains references to each of the objects that belong to the association. In this case, CIM_contains has a reference to Solaris_Disk and a reference to Solaris_ComputerSystem.

All CIM classes can be included in one or more associations.

Parameters:
isAssociation - True indicates this CIM class belongs to an association. False indicates that this CIM class does not belong to an association.

getQualifiers

public java.util.Vector getQualifiers()
Gets the CIM Qualifiers in this CIM class.
Returns:
Vector CIMQualifier objects in this class.

getAllProperties

public java.util.Vector getAllProperties()
Gets the CIM properties in this CIM class, including overriden properties.
Returns:
Vector CIMProperty objects in this CIM class.

getProperties

public java.util.Vector getProperties()
Gets the CIM properties in this CIM class.
Returns:
Vector CIMProperty objects in this CIM class.

getAllMethods

public java.util.Vector getAllMethods()
Gets the CIM methods in this CIM class, including overridden ones.
Returns:
Vector CIMMethod objects in this CIM class.

getMethods

public java.util.Vector getMethods()
Gets the CIM methods in this CIM class.
Returns:
Vector CIMMethod objects in this CIM class.

addProperty

public void addProperty(CIMProperty p)
Adds the specified property to the CIM properties in this CIM class.
Parameters:
p - The property to add to this CIM class.

numberOfProperties

public int numberOfProperties()
Returns the number of properties in this class.
Returns:
int Number of properties.

setProperties

public void setProperties(java.util.Vector Table)
Replaces the existing CIM properties in this class with the specified CIM properties.
Parameters:
Table - Vector of CIMProperty objects.

addQualifier

public void addQualifier(CIMQualifier q)
Adds the specified CIM qualifier to the qualifiers in this CIM class.
Parameters:
q - CIMQualifier object to add to this CIM class.

hasQualifier

public boolean hasQualifier(CIMQualifier q)
Checks whether the specified qualifier is one of the qualifiers in this CIM class.
Returns:
boolean true if the qualifier exists in this CIM class. Otherwise, false.

numberOfQualifiers

public int numberOfQualifiers()
Returns the number of qualifiers declared in this CIM Class.
Returns:
int Number of qualifiers in this CIM Class.

removeQualifier

public boolean removeQualifier(CIMQualifier q)
Removes the specified qualifier from this CIM class.
Returns:
boolean true if the qualifier is successfully removed. Otherwise, false.

setQualifiers

public void setQualifiers(java.util.Vector Table)
Replaces the CIM qualifiers in this CIM class with the specified CIM qualifiers.
Parameters:
Table - Vector of CIMQualifier objects.

addMethod

public void addMethod(CIMMethod m)
Adds the specified CIM method to this CIM class.
Parameters:
m - The CIMMethod object to add to this CIM class.

setMethods

public void setMethods(java.util.Vector Table)
Replaces the existing methods in this class with the specified methods.
Parameters:
Table - Vector of CIMMethod elements.

newInstance

public CIMInstance newInstance()
Returns a new CIM instance initialized with the default CIM properties, qualifiers, and name of this CIM class.
Returns:
CIMInstance CIM instance of this CIM class.

toXml

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

toXml

public java.lang.String toXml(CIMObjectPath cop)
Returns an XML representation of the specified CIM object (class or instance).
Returns:
An XML representation of the specified class or 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 class or instance on the specified host.
Returns:
An XML representation of the specified class or instance, using XML elements from the default XML namespace.

localElements

public CIMClass localElements()
Returns only the local elements for this class 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:
CIMClass populated with the local elements.
See Also:
filterProperties(java.lang.String[], boolean, boolean)

filterProperties

public CIMClass filterProperties(java.lang.String[] propertyList,
                                 boolean includeQualifier,
                                 boolean includeClassOrigin)
This method returns a new CIMClass 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 CIMClass 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:
CIMClass matching the input filter.
See Also:
localElements()