/**
   _validateKeys method of the NIS provider Test Client
  */
void NISTestClient::_validateKeys(
    CIMObjectPath &cimRef,
    Boolean verboseTest)
{
    // don't have a try here - want it to be caught by caller
    String keyVal;
    CIMName keyName;
    Array<CIMKeyBinding> keyBindings = cimRef.getKeyBindings();

    if (verboseTest)
        cout << "Retrieved " << keyBindings.size() << " keys" <<endl;

    for (Uint32 j = 0; j < keyBindings.size(); j++)
    {
        keyName = keyBindings[j].getName();
        keyVal = keyBindings[j].getValue();
        if (verboseTest)
            cout << "checking key " << keyName.getString() << endl;

        if (keyName.equal("CreationClassName") &&
            !goodCreationClassName(keyVal, verboseTest))
        {
            errorExit ("CreationClassName not PG_NISServerService");
        }
        else if (keyName.equal("Name") &&
                 !goodName(keyVal, verboseTest))
        {
            errorExit ("Name not correct");
        }
        else if (keyName.equal("SystemCreationClassName") &&
                 !goodSystemCreationClassName(keyVal, verboseTest))
        {
            errorExit ("SystemCreationClassName not correct");
        }
        else if (keyName.equal("SystemName") &&
                 !goodSystemName(keyVal, verboseTest))
        {
            errorExit ("SystemName not correct");
        }
    }
}
CIMInstance UNIX_BIOSStringProvider::constructInstance(
	const CIMName &className,
	const CIMNamespaceName &nameSpace,
	const UNIX_BIOSString &instanceObject) const
{
	CIMProperty p;

	CIMInstance inst(className);

	// Set path
	inst.setPath(CIMObjectPath(String(""), // hostname
			nameSpace,
			className,
			constructKeyBindings(instanceObject)));

	//CIM_ManagedElement Properties
	if (instanceObject.getInstanceID(p)) inst.addProperty(p);
	if (instanceObject.getCaption(p)) inst.addProperty(p);
	if (instanceObject.getDescription(p)) inst.addProperty(p);
	if (instanceObject.getElementName(p)) inst.addProperty(p);
	if (instanceObject.getGeneration(p)) inst.addProperty(p);
	if (className.equal("CIM_ManagedElement")) return inst;
	
	//CIM_BIOSAttribute Properties
	if (instanceObject.getAttributeName(p)) inst.addProperty(p);
	if (instanceObject.getCurrentValue(p)) inst.addProperty(p);
	if (instanceObject.getDefaultValue(p)) inst.addProperty(p);
	if (instanceObject.getPendingValue(p)) inst.addProperty(p);
	if (instanceObject.getIsOrderedList(p)) inst.addProperty(p);
	if (instanceObject.getIsReadOnly(p)) inst.addProperty(p);
	if (className.equal("CIM_BIOSAttribute")) return inst;
	
	//CIM_BIOSString Properties
	if (instanceObject.getStringType(p)) inst.addProperty(p);
	if (instanceObject.getMinLength(p)) inst.addProperty(p);
	if (instanceObject.getMaxLength(p)) inst.addProperty(p);
	if (instanceObject.getValueExpression(p)) inst.addProperty(p);
	

	return inst;
}
CIMInstance UNIX_AlarmDeviceCapabilitiesProvider::constructInstance(
	const CIMName &className,
	const CIMNamespaceName &nameSpace,
	const UNIX_AlarmDeviceCapabilities &instanceObject) const
{
	CIMProperty p;

	CIMInstance inst(className);

	// Set path
	inst.setPath(CIMObjectPath(String(""), // hostname
			nameSpace,
			className,
			constructKeyBindings(instanceObject)));

	//CIM_ManagedElement Properties
	if (instanceObject.getInstanceID(p)) inst.addProperty(p);
	if (instanceObject.getCaption(p)) inst.addProperty(p);
	if (instanceObject.getDescription(p)) inst.addProperty(p);
	if (instanceObject.getElementName(p)) inst.addProperty(p);
	if (instanceObject.getGeneration(p)) inst.addProperty(p);
	if (className.equal("CIM_ManagedElement")) return inst;
	
	//CIM_Capabilities Properties
	if (className.equal("CIM_Capabilities")) return inst;
	
	//CIM_EnabledLogicalElementCapabilities Properties
	if (instanceObject.getElementNameEditSupported(p)) inst.addProperty(p);
	if (instanceObject.getMaxElementNameLen(p)) inst.addProperty(p);
	if (instanceObject.getRequestedStatesSupported(p)) inst.addProperty(p);
	if (instanceObject.getElementNameMask(p)) inst.addProperty(p);
	if (instanceObject.getStateAwareness(p)) inst.addProperty(p);
	if (className.equal("CIM_EnabledLogicalElementCapabilities")) return inst;
	
	//CIM_AlarmDeviceCapabilities Properties
	if (instanceObject.getRequestedAlarmStatesSupported(p)) inst.addProperty(p);
	if (instanceObject.getAlarmIndicatorTypesConfigurable(p)) inst.addProperty(p);
	

	return inst;
}
Boolean UNIX_ComputerSystem::find(Array<CIMKeyBinding> &kbArray)
{
	CIMKeyBinding kb;
	String creationClassNameKey;
	String nameKey;


	for(Uint32 i = 0; i < kbArray.size(); i++)
	{
		kb = kbArray[i];
		CIMName keyName = kb.getName();
		if (keyName.equal(PROPERTY_CREATION_CLASS_NAME)) creationClassNameKey = kb.getValue();
		else if (keyName.equal(PROPERTY_NAME)) nameKey = kb.getValue();
	}



/* EXecute find with extracted keys */

	return false;
}
Boolean UNIX_CollectionInSystem::find(Array<CIMKeyBinding> &kbArray)
{
	CIMKeyBinding kb;
	String parentKey;
	String childKey;


	for(Uint32 i = 0; i < kbArray.size(); i++)
	{
		kb = kbArray[i];
		CIMName keyName = kb.getName();
		if (keyName.equal(PROPERTY_PARENT)) parentKey = kb.getValue();
		else if (keyName.equal(PROPERTY_CHILD)) childKey = kb.getValue();
	}



/* EXecute find with extracted keys */

	return false;
}
Boolean UNIX_CollectedSoftwareFeatures::find(Array<CIMKeyBinding> &kbArray)
{
	CIMKeyBinding kb;
	String collectionKey;
	String memberKey;


	for(Uint32 i = 0; i < kbArray.size(); i++)
	{
		kb = kbArray[i];
		CIMName keyName = kb.getName();
		if (keyName.equal(PROPERTY_COLLECTION)) collectionKey = kb.getValue();
		else if (keyName.equal(PROPERTY_MEMBER)) memberKey = kb.getValue();
	}



/* EXecute find with extracted keys */

	return false;
}
Boolean UNIX_ComputerSystemIRQ::find(Array<CIMKeyBinding> &kbArray)
{
	CIMKeyBinding kb;
	String groupComponentKey;
	String partComponentKey;


	for(Uint32 i = 0; i < kbArray.size(); i++)
	{
		kb = kbArray[i];
		CIMName keyName = kb.getName();
		if (keyName.equal(PROPERTY_GROUP_COMPONENT)) groupComponentKey = kb.getValue();
		else if (keyName.equal(PROPERTY_PART_COMPONENT)) partComponentKey = kb.getValue();
	}



/* EXecute find with extracted keys */

	return false;
}
Boolean UNIX_ApplicationSystemDependency::find(Array<CIMKeyBinding> &kbArray)
{
	CIMKeyBinding kb;
	String antecedentKey;
	String dependentKey;


	for(Uint32 i = 0; i < kbArray.size(); i++)
	{
		kb = kbArray[i];
		CIMName keyName = kb.getName();
		if (keyName.equal(PROPERTY_ANTECEDENT)) antecedentKey = kb.getValue();
		else if (keyName.equal(PROPERTY_DEPENDENT)) dependentKey = kb.getValue();
	}



/* EXecute find with extracted keys */

	return false;
}
Boolean UNIX_BIOSElement::validateKey(CIMKeyBinding &kb) const
{

	/* Keys  */
	//Name
	//Version
	//SoftwareElementState
	//SoftwareElementID
	//TargetOperatingSystem

	CIMName name = kb.getName();
	if (name.equal(PROPERTY_NAME) ||
			name.equal(PROPERTY_VERSION) ||
			name.equal(PROPERTY_SOFTWARE_ELEMENT_STATE) ||
			name.equal(PROPERTY_SOFTWARE_ELEMENT_ID) ||
			name.equal(PROPERTY_TARGET_OPERATING_SYSTEM)
		)
			return true;

	return false;
}
Boolean UNIX_BGPServiceStatistics::find(Array<CIMKeyBinding> &kbArray)
{
	CIMKeyBinding kb;
	String statsKey;
	String elementKey;


	for(Uint32 i = 0; i < kbArray.size(); i++)
	{
		kb = kbArray[i];
		CIMName keyName = kb.getName();
		if (keyName.equal(PROPERTY_STATS)) statsKey = kb.getValue();
		else if (keyName.equal(PROPERTY_ELEMENT)) elementKey = kb.getValue();
	}



/* EXecute find with extracted keys */

	return false;
}
Exemple #11
0
void
OperatingSystemProvider::enumerateInstances(
      				const OperationContext& context,
			        const CIMObjectPath& ref,
				const Boolean includeQualifiers,
				const Boolean includeClassOrigin,
			        const CIMPropertyList& propertyList,
			        InstanceResponseHandler& handler)
{
    CIMName className;
    CIMInstance instance;
    CIMObjectPath newref;

    className = ref.getClassName();

    // only return instances when enumerate on our subclass, CIMOM
    // will call us as natural part of recursing through subtree on
    // enumerate - if we return instances on enumerate of our superclass,
    // there would be dups
    if (className.equal (EXTENDEDOPERATINGSYSTEMCLASS))
    {
        handler.processing();
        newref = _fill_reference(ref.getNameSpace(), className);
        instance = _build_instance(ref);
        instance.setPath(newref);
        handler.deliver(instance);
        handler.complete();
    }
    else if (className.equal (STANDARDOPERATINGSYSTEMCLASS))
    {
        handler.processing();
        handler.complete();
    }
    else
    {
        throw CIMNotSupportedException("OperatingSystemProvider "
                "does not support class " + className.getString());
    }
    return;
}
CIMInstance UNIX_BlockStatisticsCapabilitiesProvider::constructInstance(
	const CIMName &className,
	const CIMNamespaceName &nameSpace,
	const UNIX_BlockStatisticsCapabilities &instanceObject) const
{
	CIMProperty p;

	CIMInstance inst(className);

	// Set path
	inst.setPath(CIMObjectPath(String(""), // hostname
			nameSpace,
			className,
			constructKeyBindings(instanceObject)));

	//CIM_ManagedElement Properties
	if (instanceObject.getInstanceID(p)) inst.addProperty(p);
	if (instanceObject.getCaption(p)) inst.addProperty(p);
	if (instanceObject.getDescription(p)) inst.addProperty(p);
	if (instanceObject.getElementName(p)) inst.addProperty(p);
	if (instanceObject.getGeneration(p)) inst.addProperty(p);
	if (className.equal("CIM_ManagedElement")) return inst;
	
	//CIM_Capabilities Properties
	if (className.equal("CIM_Capabilities")) return inst;
	
	//CIM_StatisticsCapabilities Properties
	if (instanceObject.getElementTypesSupported(p)) inst.addProperty(p);
	if (instanceObject.getSynchronousMethodsSupported(p)) inst.addProperty(p);
	if (instanceObject.getAsynchronousMethodsSupported(p)) inst.addProperty(p);
	if (className.equal("CIM_StatisticsCapabilities")) return inst;
	
	//CIM_BlockStatisticsCapabilities Properties
	if (instanceObject.getClockTickInterval(p)) inst.addProperty(p);
	if (instanceObject.getSupportedFeatures(p)) inst.addProperty(p);
	if (instanceObject.getRateElementTypesSupported(p)) inst.addProperty(p);
	

	return inst;
}
Boolean UNIX_BootConfigSetting::validateKey(CIMKeyBinding &kb) const
{

	/* Keys  */
	//InstanceID

	CIMName name = kb.getName();
	if (name.equal(PROPERTY_INSTANCE_ID)
		)
			return true;

	return false;
}
Boolean UNIX_AuthorizedPrivilege::validateKey(CIMKeyBinding &kb) const
{

	/* Keys  */
	//InstanceID

	CIMName name = kb.getName();
	if (name.equal(PROPERTY_INSTANCE_ID)
		)
			return true;

	return false;
}
Boolean UNIX_CIMOMStatisticalData::validateKey(CIMKeyBinding &kb) const
{

	/* Keys  */
	//InstanceID

	CIMName name = kb.getName();
	if (name.equal(PROPERTY_INSTANCE_ID)
		)
			return true;

	return false;
}
Boolean UNIX_CertificateManagementCapabilities::validateKey(CIMKeyBinding &kb) const
{

	/* Keys  */
	//InstanceID

	CIMName name = kb.getName();
	if (name.equal(PROPERTY_INSTANCE_ID)
		)
			return true;

	return false;
}
/*****************************************************************************
 *
 * Implementation of AssociationProvider referenceNames method
 *
 *****************************************************************************/
void InteropProvider::referenceNames(
    const OperationContext & context,
    const CIMObjectPath & objectName,
    const CIMName & resultClass,
    const String & role,
    ObjectPathResponseHandler & handler)
{
    PEG_METHOD_ENTER(TRC_CONTROLPROVIDER,
        "InteropProvider::referenceNames()");
    initProvider();
    handler.processing();

    String tmpRole = role;
    String tmpTarget;
    Uint32 numIterations = 1;
    //
    // Makes call to internal references method to get result, supplying the
    // role parameter, but obviously not setting a resultRole/target parameter.
    //
    if (resultClass.equal(PEGASUS_CLASSNAME_PG_REFERENCEDPROFILE))
    {
        if (tmpRole.size() == 0)
        {
            tmpRole = String("Antecedent");
            tmpTarget = String("Dependent");
            numIterations = 2;
        }
    }
    for (Uint32 i = 0; i < numIterations; ++i)
    {
        Array<CIMInstance> refs = localReferences(
            context,
            objectName,
            resultClass,
            tmpRole,
            tmpTarget);
        for (Uint32 j = 0, n = refs.size(); j < n; ++j)
        {
            handler.deliver(refs[j].getPath());
        }
        if (numIterations == 2)
        {
            tmpRole = String("Dependent");
            tmpTarget = String("Antecedent");
        }
    }

    handler.complete();

    PEG_METHOD_EXIT();
}
void UNIX_PROVIDER::enumerateInstances(
    const OperationContext& context,
    const CIMObjectPath& ref,
    const Boolean includeQualifiers,
    const Boolean includeClassOrigin,
    const CIMPropertyList& propertyList,
    InstanceResponseHandler& handler)
{
    CIMName className;
    CIMInstance instance;
    CIMObjectPath newref;
    CLASS_IMPLEMENTATION _p;
    className = ref.getClassName();
    CIMNamespaceName nameSpace = ref.getNameSpace();
    int pIndex;
    // only return instances when enumerate on our subclass, CIMOM
    // will call us as natural part of recursing through subtree on
    // enumerate - if we return instances on enumerate of our superclass,
    // there would be dups
    if (className.equal (_getClassCimName()) ||
    	className.equal(_getBaseClassCimName()))
    {
        handler.processing();
        _p.initialize();
        for (pIndex = 0; _p.load(pIndex); pIndex++)
        handler.deliver(_constructInstance(_getClassCimName(),
                                           nameSpace,
                                           _p));
		_p.finalize();
        handler.complete();
    }
    else
    {
        throw CIMNotSupportedException(_getClassName() + 
                "does not support class " + className.getString());
    }
    return;
}
Boolean UNIX_BIOSElement::find(const Array<CIMKeyBinding> &kbArray)
{
	CIMKeyBinding kb;
	String nameKey;
	String versionKey;
	String softwareElementStateKey;
	String softwareElementIDKey;
	String targetOperatingSystemKey;


	for(Uint32 i = 0; i < kbArray.size(); i++)
	{
		kb = kbArray[i];
		CIMName keyName = kb.getName();
		if (keyName.equal(PROPERTY_NAME)) nameKey = kb.getValue();
		else if (keyName.equal(PROPERTY_VERSION)) versionKey = kb.getValue();
		else if (keyName.equal(PROPERTY_SOFTWARE_ELEMENT_STATE)) softwareElementStateKey = kb.getValue();
		else if (keyName.equal(PROPERTY_SOFTWARE_ELEMENT_ID)) softwareElementIDKey = kb.getValue();
		else if (keyName.equal(PROPERTY_TARGET_OPERATING_SYSTEM)) targetOperatingSystemKey = kb.getValue();
	}
	
	
	
	/* Execute find with extracted keys */
	for(int i = 0; load(i); i++) {
		if ((String::equalNoCase(getName(), nameKey)) && 
			(String::equalNoCase(getVersion(), versionKey)) && 
			(String::equalNoCase(String(std::to_string(getSoftwareElementState()).c_str()), softwareElementStateKey)) && 
			(String::equalNoCase(getSoftwareElementID(), softwareElementIDKey)) && 
			(String::equalNoCase(String(std::to_string(getTargetOperatingSystem()).c_str()), targetOperatingSystemKey)))
		{
			return true;
		}
	}
	
	return false;
}
CIMInstance UNIX_BoundedPrioritySchedulingElementProvider::constructInstance(
	const CIMName &className,
	const CIMNamespaceName &nameSpace,
	const UNIX_BoundedPrioritySchedulingElement &instanceObject) const
{
	CIMProperty p;

	CIMInstance inst(className);

	// Set path
	inst.setPath(CIMObjectPath(String(""), // hostname
			nameSpace,
			className,
			constructKeyBindings(instanceObject)));

	//CIM_ManagedElement Properties
	if (instanceObject.getInstanceID(p)) inst.addProperty(p);
	if (instanceObject.getCaption(p)) inst.addProperty(p);
	if (instanceObject.getDescription(p)) inst.addProperty(p);
	if (instanceObject.getElementName(p)) inst.addProperty(p);
	if (instanceObject.getGeneration(p)) inst.addProperty(p);
	if (className.equal("CIM_ManagedElement")) return inst;
	
	//CIM_SchedulingElement Properties
	if (instanceObject.getWorkConserving(p)) inst.addProperty(p);
	if (className.equal("CIM_SchedulingElement")) return inst;
	
	//CIM_PrioritySchedulingElement Properties
	if (instanceObject.getPriority(p)) inst.addProperty(p);
	if (className.equal("UNIX_PrioritySchedulingElement")) return inst;
	
	//CIM_BoundedPrioritySchedulingElement Properties
	if (instanceObject.getBandwidthBound(p)) inst.addProperty(p);
	

	return inst;
}
Exemple #21
0
void MethodProvider::invokeMethod(
    const OperationContext & context,
    const CIMObjectPath & objectReference,
    const CIMName & methodName,
    const Array<CIMParamValue> & inParameters,
    MethodResultResponseHandler & handler)
{
    // convert a fully qualified reference into a local reference
    // (class name and keys only).
    CIMObjectPath localReference = CIMObjectPath(
        String(),
        CIMNamespaceName(),
        objectReference.getClassName(),
        objectReference.getKeyBindings());

    handler.processing();

    if (objectReference.getClassName().equal("Sample_MethodProviderClass"))
    {
        if (methodName.equal("SayHello"))
        {
            String outString = "Hello";
            if (inParameters.size() > 0)
            {
                CIMValue paramVal = inParameters[0].getValue();
                if (!paramVal.isNull())
                {
                    String replyName;
                    paramVal.get(replyName);
                    if (replyName != String::EMPTY)
                    {
                        outString.append(", " + replyName + "!");
                    }
                }

                handler.deliverParamValue(
                    CIMParamValue("Place",
                        CIMValue(String("From Neverland"))));
                handler.deliver(CIMValue(outString));
            }
            else
            {
                handler.deliver(CIMValue(outString));
            }
        }
    }
    
    handler.complete();
}
CIMInstance CIMHelper::extractInstanceParameter(const Array<CIMParamValue>& inParameters, String name)
{
    for(Uint32 i = 0; i < inParameters.size(); i++)
    {
    	CIMParamValue paramValue = inParameters[i];
    	CIMName paramName = paramValue.getParameterName();
    	if (paramName.equal(name))
    	{
    		CIMInstance value;
    		paramValue.getValue().get(value);
    		return value;
    	}
    }
    return CIMInstance();
}
CIMInstance UNIX_AuthorizedPrivilegeProvider::constructInstance(
	const CIMName &className,
	const CIMNamespaceName &nameSpace,
	const UNIX_AuthorizedPrivilege &instanceObject) const
{
	CIMProperty p;

	CIMInstance inst(className);

	// Set path
	inst.setPath(CIMObjectPath(String(""), // hostname
			nameSpace,
			className,
			constructKeyBindings(instanceObject)));

	//CIM_ManagedElement Properties
	if (instanceObject.getInstanceID(p)) inst.addProperty(p);
	if (instanceObject.getCaption(p)) inst.addProperty(p);
	if (instanceObject.getDescription(p)) inst.addProperty(p);
	if (instanceObject.getElementName(p)) inst.addProperty(p);
	if (instanceObject.getGeneration(p)) inst.addProperty(p);
	if (className.equal("CIM_ManagedElement")) return inst;
	
	//CIM_Privilege Properties
	if (instanceObject.getPrivilegeGranted(p)) inst.addProperty(p);
	if (instanceObject.getActivities(p)) inst.addProperty(p);
	if (instanceObject.getActivityQualifiers(p)) inst.addProperty(p);
	if (instanceObject.getQualifierFormats(p)) inst.addProperty(p);
	if (instanceObject.getRepresentsAuthorizationRights(p)) inst.addProperty(p);
	if (className.equal("UNIX_Privilege")) return inst;
	
	//CIM_AuthorizedPrivilege Properties
	

	return inst;
}
String CIMHelper::extractStringParameter(const Array<CIMParamValue>& inParameters, String name)
{
    for(Uint32 i = 0; i < inParameters.size(); i++)
    {
    	CIMParamValue paramValue = inParameters[i];
    	CIMName paramName = paramValue.getParameterName();
    	if (paramName.equal(name))
    	{
    		String s;
    		paramValue.getValue().get(s);
    		return s;
    	}
    }
    return CIMHelper::EmptyString;
}
Exemple #25
0
void ParserTestProvider::getInstance(
    const OperationContext & context,
    const CIMObjectPath & instanceReference,
    const Boolean includeQualifiers,
    const Boolean includeClassOrigin,
    const CIMPropertyList & propertyList,
    InstanceResponseHandler & handler)
{
    String Value;
    char csname[256];
    int cnum;
    char badstrname[256];

    cout << "ParserTestProvider::getInstance" << endl;

    CIMName className = instanceReference.getClassName();
    CIMNamespaceName nameSpace = instanceReference.getNameSpace();

    Array<CIMKeyBinding> keys = instanceReference.getKeyBindings();

    for (int i = 0; i < (int)keys.size(); i++)
    {
        CIMName cimName = keys[i].getName();
        Value = keys[i].getValue();

        if (cimName.equal("BadStringName")) {
                strncpy(badstrname, Value.getCString(), 256);
        }
    }
    CIMInstance instance(CLASS_NAME);
    instance.setPath(CIMObjectPath(String::EMPTY, // hostname
                                      nameSpace,
                                      CLASS_NAME,
                                      keys));
    instance.addProperty(CIMProperty("CName",
                         String(CLASS_NAME)));
    instance.addProperty(CIMProperty("BadStringName",
                         String(badstrname)));
    
    //begin processing the request
    handler.processing();

    handler.deliver(instance);
    // complete processing the request
    handler.complete();
}
Exemple #26
0
void RT_IndicationProvider::invokeMethod(
        const OperationContext & context,
        const CIMObjectPath & objectReference,
        const CIMName & methodName,
        const Array<CIMParamValue> & inParameters,
        MethodResultResponseHandler & handler)
{
        Boolean sendIndication = false;
        handler.processing();

        if (objectReference.getClassName().equal ("RT_TestIndication") &&
	    _enabled)
        {
            if ((methodName.equal ("SendTestIndication")) ||
                (methodName.equal ("SendTestIndicationNormal")) ||
                (methodName.equal ("SendTestIndicationMissingProperty")) ||
                (methodName.equal ("SendTestIndicationExtraProperty")) ||
                (methodName.equal ("SendTestIndicationMatchingInstance")) ||
                (methodName.equal ("SendTestIndicationUnmatchingNamespace")) ||
                (methodName.equal ("SendTestIndicationUnmatchingClassName")))
            {
                sendIndication = true;
                handler.deliver( CIMValue( 0 ) );
            }
        }

        else if ((objectReference.getClassName ().equal
            ("RT_TestIndicationSubclass")) && _enabled)
        {
            if (methodName.equal ("SendTestIndicationSubclass"))
            {
                sendIndication = true;
                handler.deliver( CIMValue( 0 ) );
            }
        }

        else
        {
             handler.deliver( CIMValue( 1 ) );
	     PEGASUS_STD(cout) << "Provider is not enabled." << PEGASUS_STD(endl);
        }

        handler.complete();

        if (sendIndication)
           _generateIndication(_handler, methodName);
}
Boolean UNIX_AllocationSchedulingElement::find(Array<CIMKeyBinding> &kbArray)
{
	CIMKeyBinding kb;
	String instanceIDKey;


	for(Uint32 i = 0; i < kbArray.size(); i++)
	{
		kb = kbArray[i];
		CIMName keyName = kb.getName();
		if (keyName.equal(PROPERTY_INSTANCE_ID)) instanceIDKey = kb.getValue();
	}



/* EXecute find with extracted keys */

	return false;
}
void ComputerSystemProvider::enumerateInstances(
    const OperationContext& context,
    const CIMObjectPath& ref,
    const Boolean includeQualifiers,
    const Boolean includeClassOrigin,
    const CIMPropertyList& propertyList,
    InstanceResponseHandler& handler)
{
    CIMName className = ref.getClassName();
    _checkClass(className);

    handler.processing();

    // Deliver instance only if request was for leaf class
    if (className.equal (CLASS_EXTENDED_COMPUTER_SYSTEM))
    {
        Array<CIMKeyBinding> keys;
        keys.append(CIMKeyBinding(
            PROPERTY_CREATION_CLASS_NAME,
            CLASS_EXTENDED_COMPUTER_SYSTEM,
            CIMKeyBinding::STRING));
        keys.append(CIMKeyBinding(
            PROPERTY_NAME,
            _cs.getHostName(),
            CIMKeyBinding::STRING));
        CIMObjectPath instanceName(
            String::EMPTY,       // Hostname not required
            CIMNamespaceName(),  // Namespace not required
            CLASS_EXTENDED_COMPUTER_SYSTEM,
            keys);
        CIMInstance instance =
            _cs.buildInstance(CLASS_EXTENDED_COMPUTER_SYSTEM);
        instance.setPath(instanceName);
        handler.deliver(instance);
    }

    handler.complete();
    return;
}
PEGASUS_NAMESPACE_BEGIN

/*
    ATTN: This method provider is used by ProviderRegistrationProvider to 
    update InteropProvider Cache. If SLP is enabled we invoke SLPProvider's
    'update' method to update registrations in this method. Note that 
    'updateCache' method is not defined as part of class 
    PG_ProviderProfileCapabilities. This method is used purely for internal
    purpose for the communication between InteropProvider and 
    ProviderRegistrationProvider.
*/

void InteropProvider::invokeMethod(
    const OperationContext & context,
    const CIMObjectPath & objectReference,
    const CIMName & methodName,
    const Array<CIMParamValue> & inParameters,
    MethodResultResponseHandler & handler)
{
    if(objectReference.getNameSpace().equal (PEGASUS_NAMESPACENAME_INTEROP)
        && objectReference.getClassName().equal(
            PEGASUS_CLASSNAME_PG_PROVIDERPROFILECAPABILITIES)
        && methodName.equal("updateCache"))
    {
        handler.processing();
#ifdef PEGASUS_ENABLE_SLP
        sendUpdateRegMessageToSLPProvider(context);
#endif
        updateProfileCache++;
        handler.complete();
    }
    else
    {
        throw PEGASUS_CIM_EXCEPTION(CIM_ERR_NOT_SUPPORTED, 
            objectReference.getNameSpace().getString());
    }
}
Exemple #30
0
/*
   testEnumerateInstanceNames of the NIS provider.
*/
void NISTestClient::testEnumerateInstanceNames(
    CIMClient &client,
    Boolean verboseTest)
{
    try
    {
        Uint32  numberInstances;

        testLog("NIS Provider Test Start EnumerateInstanceNames");

        Array<CIMObjectPath> cimReferences =
            client.enumerateInstanceNames(NAMESPACE, CLASS_NAME);

        numberInstances = cimReferences.size();
        if (verboseTest)
            cout << numberInstances << " instances of " <<
                CLASS_NAME.getString() <<endl;

        for (Uint32 i = 0; i < cimReferences.size(); i++)
        {
            CIMName className = cimReferences[i].getClassName();
            if (!className.equal(CLASS_NAME))
            {
                errorExit("EnumInstanceNames failed - wrong class");
            }

            _validateKeys(cimReferences[i], verboseTest);

        }   // end for looping through instances

        testLog("NIS Provider Test EnumInstanceNames Passed");
    }
    catch(Exception& e)
    {
        errorExit(e.getMessage());
    }
}