The following table describes the methods in the property provider interface.
Table 5–3 PropertyProvider Interface Methods
Method |
Description |
---|---|
CIMValue getPropertyValue(CIMObjectPath op, String originClass, String propertyName) |
Returns a CIMValue containing the value of the property specified by propertyName for the instance specified in op. The originClass contains the name of the class in the class hierarchy that originally defined this property. |
void setPropertyValue(CIMObjectPath op, String originClass, String propertyName, CIMValue cv) |
Sets the value of the property specified by propertyName for the instance specified in op to the CIMValue cv. The originClass contains the name of the class in the class hierarchy that originally defined this property. |
The code segment in Example 5–2 creates a property provider (fruit_prop_provider) class that is registered in Example 5–2. The fruit_prop_provider implements the PropertyProvider interface.
This sample property provider illustrates the getPropertyValue method, which returns a property value for the specified class, parent class, and property name. A CIM property is defined by its name and origin class. Two or more properties can have the same name, but the origin class uniquely identifies the property.
... public class SimplePropertyProvider implements PropertyProvider{ public void initialize(CIMOMHandle cimom) throws CIMException { } public void cleanup() throws CIMException { } public CIMValue getPropertyValue(CIMObjectpath op, string originclass, string PropertyName){ if (PropertyName.equals("A") return new CIMValue("ValueA") else return new CIMValue("ValueB"); } ... }