WBEMfor Solaris on Sun Developer's Guide

The Property Provider Interface (PropertyProvider)

The following table describes the methods in the property provider interface.

Table 7-3 PropertyProvider Interface Methods

Method 

Description 

getPropertyValue

Returns the value of the property for the specified instance.  

setPropertyValue

Sets the value of the property for the specified instance 

Example -- Implementing a Property Provider

The code segment in Example 7-3 creates a property provider (fruit_prop_provider) class that is registered in Example 7-5. 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.


Example 7-3 Implementing a Property Provider

fruit_prop_provider implements PropertyProvider 
{
public CIMValue getPropertyValue(CIMObjectpath op, string originclass, 
	string PropertyName){
 
		if (PropertyName.euqals("a")
			return new CIMValue("fooa")
 
		else
			return new CIMValue("foob");
}
...
}