void TestGroupingProvider2::invokeMethod(
    const OperationContext& context,
    const CIMObjectPath& objectReference,
    const CIMName& methodName,
    const Array<CIMParamValue>& inParameters,
    MethodResultResponseHandler& handler)
{
    if (!objectReference.getClassName().equal("Test_GroupingClass2"))
    {
        throw CIMNotSupportedException(
            objectReference.getClassName().getString());
    }

    handler.processing();
    if (methodName.equal("getNextIdentifier"))
    {
        handler.deliver(CIMValue(Uint32(getNextIdentifier())));
    }
    else if (methodName.equal("getSubscriptionCount"))
    {
         handler.deliver(CIMValue(_subscriptionCount));
    }

    handler.complete();
}
Example #2
0
void TimingProvider::getInstance(
    const OperationContext & context,
    const CIMObjectPath & instanceReference,
    const Boolean includeQualifiers,
    const Boolean includeClassOrigin,
    const CIMPropertyList & propertyList,
    InstanceResponseHandler & handler)
{
    // convert a potential fully qualified reference into a local reference
    // (class name and keys only).
    CIMObjectPath localReference = CIMObjectPath(
        String(),
        String(),
        instanceReference.getClassName(),
        instanceReference.getKeyBindings());

    CIMName className = instanceReference.getClassName();

    // begin processing the request
    handler.processing();

    // instance index corresponds to reference index
    for(Uint32 i = 0, n = _instances.size(); i < n; i++)
    {
        if(localReference == _instanceNames[i])
        {
            // deliver requested instance
            handler.deliver(_instances[i]);

            break;
        }
    }
    // complete processing the request
    handler.complete();
}
void ComputerSystemProvider::getInstance(
    const OperationContext& context,
    const CIMObjectPath& ref,
    const Boolean includeQualifiers,
    const Boolean includeClassOrigin,
    const CIMPropertyList& propertyList,
    InstanceResponseHandler &handler)
{
    CIMName className = ref.getClassName();
    _checkClass(className);

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

    //-- make sure we're the right instance
    unsigned int keyCount = NUMKEYS_COMPUTER_SYSTEM;
    CIMName keyName;
    String keyValue;

    if (keys.size() != keyCount)
    {
        throw CIMInvalidParameterException("Wrong number of keys");
    }

    for (unsigned int ii = 0; ii < keys.size(); ii++)
    {
        keyName = keys[ii].getName();
        keyValue = keys[ii].getValue();

        //Put CLASS_EXTENDED_COMPUTER_SYSTEM in front CLASS_CIM_COMPUTER_SYSTEM
        //to prefer CLASS_EXTENDED_COMPUTER_SYSTEM as class being served first
        //followed by CLASS_CIM_UNITARY_COMPUTER_SYSTEM
        if (keyName.equal(PROPERTY_CREATION_CLASS_NAME) &&
            (String::equalNoCase(keyValue,CLASS_EXTENDED_COMPUTER_SYSTEM) ||
             String::equalNoCase(keyValue,CLASS_CIM_UNITARY_COMPUTER_SYSTEM) ||
             String::equalNoCase(keyValue,CLASS_CIM_COMPUTER_SYSTEM) ||
             String::equalNoCase(keyValue,String::EMPTY)))
        {
            keyCount--;
        }
        else if (keyName.equal("Name") &&
                 String::equalNoCase(keyValue,_cs.getHostName()))
        {
            keyCount--;
        }
    }

    if (keyCount)
    {
        throw CIMInvalidParameterException(String::EMPTY);
    }

    // return instance of specified class
    CIMInstance instance = _cs.buildInstance(ref.getClassName());

    handler.processing();
    handler.deliver(instance);
    handler.complete();

    return;
}
/**
    Returns the instance names of the errorInstance or indicationInstance
    stored in this class.
*/
void EmbeddedInstanceProvider::enumerateInstanceNames(
    const OperationContext& context,
    const CIMObjectPath& ref,
    ObjectPathResponseHandler& handler)
{
    handler.processing();
    if (ref.getClassName().equal(CIMName("PG_EmbeddedError")))
    {
        CIMObjectPath errorInstancePath = errorInstance->getPath();
        handler.deliver(errorInstancePath);
        handler.deliver(errorInstancePath);
        handler.deliver(errorInstancePath);
        handler.deliver(errorInstancePath);
        handler.deliver(errorInstancePath);
    }
    else if (ref.getClassName().equal(CIMName("PG_InstMethodIndication")))
    {
        CIMObjectPath indicationInstancePath = indicationInstance->getPath();
        handler.deliver(indicationInstancePath);
        handler.deliver(indicationInstancePath);
        handler.deliver(indicationInstancePath);
        handler.deliver(indicationInstancePath);
        handler.deliver(indicationInstancePath);
    }
    handler.complete();
}
void UNIX_BGPEndpointStatisticsProvider::invokeMethod(
	const OperationContext& context,
	const CIMObjectPath& objectReference,
	const CIMName& methodName,
	const Array<CIMParamValue>& inParameters,
	MethodResultResponseHandler& handler)
{
	if (!objectReference.getClassName().equal("UNIX_BGPEndpointStatistics") && !objectReference.getClassName().equal("CIM_BGPEndpointStatistics")) {
		String classMessage;
		classMessage.append("UNIX_BGPEndpointStatistics Provider");
		classMessage.append (" does not support class ");
		classMessage.append (objectReference.getClassName().getString());
		throw CIMNotSupportedException(classMessage);
	}


	handler.processing();
	// Make cimom handle invokeMethod request with input parameters.
	CIMObjectPath localReference = CIMObjectPath(
		String(""),
		CIMNamespaceName("root/cimv2"),
		objectReference.getClassName(),
		objectReference.getKeyBindings());
	
	if (methodName.equal("ResetSelectedStats")) {

		if (inParameters.size() != 1)
		{
			throw new CIMOperationFailedException("Incorrect in parameters");
		}
		
		//Invoking ResetSelectedStats method.
		Uint32 invokeResetSelectedStatsReturnValue;

		Array<String> inSelectedStatistics;
		
		for(Uint32 pi = 0; pi < inParameters.size(); pi++) {
			CIMParamValue p = inParameters[pi];
			if (String::equalNoCase(p.getParameterName(), "SelectedStatistics"))
			{
				p.getValue().get(inSelectedStatistics);
			}
		}
		_p.initialize();
		_p.find(localReference.getKeyBindings());
		invokeResetSelectedStatsReturnValue = _p.invokeResetSelectedStats(

			inSelectedStatistics
		);
		_p.finalize();
		handler.deliver(invokeResetSelectedStatsReturnValue);

	}
	else {
		String message;
		message.append("UNIX_BGPEndpointStatistics");
		message.append (" does not support invokeMethod");
		throw CIMNotSupportedException(message);
	}
}
Example #6
0
CIMObjectPath ObjectNormalizer::processClassObjectPath(
    const CIMObjectPath& cimObjectPath) const
{
    // pre-check
    if (!_enableNormalization || _cimClass.isUninitialized())
    {
        // do nothing
        return cimObjectPath;
    }

    /*
    // ATTN: moving similar logic to the response handlers because this
    // type of error should be checked regardless with or without
    // normalization enabled.
    if (cimObjectPath.getClassName().isNull())
    {
        throw CIMException(CIM_ERR_FAILED, "uninitialized object path");
    }
    */

    /*
    // ATTN: The following code is currently redundant because the CIMName
    // object validates legal names when it is constructed. It is included
    // here for completeness.
    // check class name
    if (!CIMName(cimObjectPath.getClassName()).legal())
    {
        MessageLoaderParms message(
            "Common.ObjectNormalizer.INVALID_CLASS_NAME",
            "Invalid class name: $0",
            cimObjectPath.getClassName().getString());

        throw CIMException(CIM_ERR_FAILED, message);
    }
    */

    // check class type
    if (!_cimClass.getClassName().equal(cimObjectPath.getClassName()))
    {
        MessageLoaderParms message(
            "Common.ObjectNormalizer.INVALID_CLASS_TYPE",
            "Invalid class type: $0",
            cimObjectPath.getClassName().getString());

        throw CIMException(CIM_ERR_FAILED, message);
    }

    CIMObjectPath normalizedObjectPath(
        _cimClass.getPath().getHost(),
        _cimClass.getPath().getNameSpace(),
        _cimClass.getClassName());

    // ignore any keys, they are not part of a class object path

    return normalizedObjectPath;
}
Example #7
0
void DefaultInstanceProvider::deleteInstance(
	const OperationContext & context,
	const CIMObjectPath & instanceReference,
	ResponseHandler & handler)
{
        CIMNamespaceName nameSpace = instanceReference.getNameSpace();

        // get the class name
        CIMName className = instanceReference.getClassName();

        // create the namespace if necessary
        if (!_nameSpaceExists(nameSpace))
        {
            _copyNameSpace(nameSpace.getString(), className.getString());
        }

        // check to see if class already exists
        // if not, copy the class
        //
        try
        {
            CIMClass cimClass = _repository->getClass(nameSpace, className);
        }
        catch (Exception&)
        {
            // Class does not exist.  Copy the class.
            //
            _copyClass(nameSpace.getString(), className.getString()); 
        }

	// convert a potential fully qualified reference into a local reference
	// (class name and keys only).
	CIMObjectPath localReference = CIMObjectPath(
		String(),
		String(),
		instanceReference.getClassName(),
		instanceReference.getKeyBindings());
	
	// begin processing the request
	handler.processing();

        try
        {
           _repository->deleteInstance(nameSpace, localReference);
        }
        catch (Exception & ex)
        {
            const String msg = "delete Instance failed. " + ex.getMessage();
            throw CIMOperationFailedException( msg );
        }

	// complete processing the request
	handler.complete();
}
Example #8
0
/*
   testEnumerateInstances of the NIS provider.
*/
void NISTestClient::testEnumerateInstances(
    CIMClient &client,
    Boolean verboseTest)
{
    try
    {
        Boolean deepInheritance = true;
        Boolean localOnly = true;
        Boolean includeQualifiers = false;
        Boolean includeClassOrigin = false;
        Uint32 numberInstances;

        testLog("NIS Provider Test EnumerateInstances");

        Array<CIMInstance> cimNInstances = client.enumerateInstances(
            NAMESPACE,
            CLASS_NAME,
            deepInheritance,
            localOnly,
            includeQualifiers,
            includeClassOrigin);

        numberInstances = cimNInstances.size();
        if (verboseTest)
            cout << numberInstances << " instances of PG_NISServerService" <<
                endl;

        for (Uint32 i = 0; i < cimNInstances.size(); i++)
        {
            CIMObjectPath instanceRef = cimNInstances[i].getPath ();
            if (verboseTest)
                cout << "Instance ClassName is " <<
                    instanceRef.getClassName().getString() << endl;
            if(!instanceRef.getClassName().equal(CLASS_NAME))
            {
                errorExit("EnumInstances failed");
            }

            // now validate the properties
            _validateProperties(cimNInstances[i], verboseTest);
        }       // end for looping through instances

        testLog("NIS Provider Test EnumInstances Passed");
    }
    catch(Exception& e)
    {
        errorExit(e.getMessage());
    }
}
Example #9
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();
}
Example #10
0
void TimingProvider::enumerateInstanceNames(
    const OperationContext & context,
    const CIMObjectPath & classReference,
    ObjectPathResponseHandler & handler)
{
    // begin processing the request
    handler.processing();
    cout <<"TimingProvider::enumerateInstanceNames" << endl;
    CIMName clName = classReference.getClassName();

    sleep(10);
    if (clName == "TimeOne")
    {
        for(Uint32 i = 0, n = _instances.size(); i < n; i++)
            // deliver reference
            handler.deliver(_instanceNames[i]);
    }
    else if (clName == "TimeTwo")
    {
        for(Uint32 i = 0, n = _instances_2.size(); i < n; i++)
            // deliver reference
            handler.deliver(_instanceNames_2[i]);
    }
    // complete processing the request
    cout <<"TimingProvider::enumerateInstanceNames" << endl;
    handler.complete();
}
void benchmarkProvider::enumerateInstanceNames(
    const OperationContext & context,
    const CIMObjectPath & classReference,
    ObjectPathResponseHandler & handler)
{
    CIMObjectPath _instanceName;
    Uint32 numberOfProperties;
    Uint32 sizeOfPropertyValue;
    Uint32 numberOfInstances;

    CIMName className = classReference.getClassName();
    test.getConfiguration(className, numberOfProperties,
                          sizeOfPropertyValue, numberOfInstances);

    // begin processing the request
    handler.processing();

    for (Uint32 i = 1; i <= numberOfInstances; i++)
    {
       _instanceName = _buildObjectPath(className, 
               CIMKeyBinding(CIMName("Identifier"), CIMValue(i))); 
       handler.deliver(_instanceName);
    }
 
    // complete processing the request
    handler.complete();
}
Example #12
0
void CIMInstanceNametoXML(CIMObjectPath const& cop, ostream& ostr)
{
	ostr << "<INSTANCENAME CLASSNAME=\"";
	ostr << cop.getClassName() << "\">";
	//
	// If keys > 1 then must use KEYBINDING - we also use it for
	// the key == 1 case - most implementations can't cope with
	// a single KEYVALUE without a KEYBINDING element
	//
	if (cop.isInstancePath())
	{
		size_t numkeys = cop.getKeys().size();
		for (size_t i = 0; i < numkeys; i++)
		{
			CIMProperty cp = cop.getKeys()[i];
			ostr << "<KEYBINDING NAME=\"";
			ostr << cp.getName() << "\">";
			outputKEYVALUE(ostr, cp);
			ostr << "</KEYBINDING>";
		}
	}
	else
	{
		// A singleton, a class without keys
	}
	ostr << "</INSTANCENAME>";
}
const CIMPropertyList WQLSelectStatementRep::getSelectPropertyList(
    const CIMObjectPath& inClassName) const
{
    //
    //  Check for "*"
    //
    if (_allProperties)
    {
        //
        //  Return null CIMPropertyList for all properties
        //
        return CIMPropertyList ();
    }

    CIMName className = inClassName.getClassName();
    if (className.isNull())
    {
        //
        //  If the caller passed in an empty className, then the FROM class is
        //  to be used
        //
        className = _className;
    }

    //
    //  Check if inClassName is the FROM class
    //
    if (!(className == _className))
    {
        //
        //  Check for NULL Query Context
        //
        if (_ctx == NULL)
        {
            MessageLoaderParms parms
                ("WQL.WQLSelectStatementRep.QUERY_CONTEXT_IS_NULL",
                "Trying to process a query with a NULL Query Context.");
            throw QueryRuntimeException(parms);
        }

        //
        //  Check if inClassName is a subclass of the FROM class
        //
        if (!_ctx->isSubClass(_className,className))
        {
            MessageLoaderParms parms
                ("WQL.WQLSelectStatementRep.CLASS_NOT_FROM_LIST_CLASS",
                "Class $0 does not match the FROM class or any of its "
                "subclasses.",
                className.getString());
            throw QueryRuntimeException(parms);
        }
    }

    //
    //  Return CIMPropertyList for properties referenced in the projection
    //  list (SELECT clause)
    //
    return CIMPropertyList (_selectPropertyNames);
}
Array<CIMObjectPath> PG_TestPropertyTypes::_enumerateInstanceNames(
    const OperationContext& context,
    const CIMObjectPath& classReference)
{
    Array<CIMObjectPath> instanceNames;

    // get class definition from repository
    CIMClass cimclass = _cimom.getClass(
        context,
        classReference.getNameSpace(),
        classReference.getClassName(),
        false,
        true,
        true,
        CIMPropertyList());

    // convert instances to references;
    for (Uint32 i = 0; i < _instances.size(); i++)
    {
        CIMObjectPath tempRef = _instances[i].buildPath(cimclass);

        // ensure references are fully qualified
        tempRef.setHost(classReference.getHost());
        tempRef.setNameSpace(classReference.getNameSpace());

        instanceNames.append(tempRef);
    }

    return instanceNames;
}
void PG_TestPropertyTypes::deleteInstance(
    const OperationContext& context,
    const CIMObjectPath& instanceReference,
    ResponseHandler& handler)
{
    // synchronously get references
    Array<CIMObjectPath> references =
        _enumerateInstanceNames(context, instanceReference);

    // ensure the Namespace is valid
    if (!instanceReference.getNameSpace().equal("test/static"))
    {
        throw CIMException(CIM_ERR_INVALID_NAMESPACE);
    }

    // ensure the class existing in the specified namespace
    if (!instanceReference.getClassName().equal("PG_TestPropertyTypes"))
    {
        throw CIMException(CIM_ERR_INVALID_CLASS);
    }

    // ensure the requested object exists
    Uint32 index = findObjectPath(references, instanceReference);
    if (index == PEG_NOT_FOUND)
    {
        throw CIMException(CIM_ERR_NOT_FOUND);
    }

    // begin processing the request
    handler.processing();

    // we do not remove instance
    // complete processing the request
    handler.complete();
}
Example #16
0
void ParserTestProvider::enumerateInstanceNames(
    const OperationContext & context,
    const CIMObjectPath & classReference,
    ObjectPathResponseHandler & handler)
{
    //DEBUG("enumerateInstanceNames()");

    // begin processing the request
    CIMName className = classReference.getClassName();
    CIMNamespaceName nameSpace = classReference.getNameSpace();
    //DEBUG("[className: "<<className<<"], [in namespace: "<<nameSpace<<"]");

    handler.processing();

    Array<CIMKeyBinding> keys;

    keys.append(CIMKeyBinding("CName", 
                    String(CLASS_NAME),
                    CIMKeyBinding::STRING));
    keys.append(CIMKeyBinding("BadStr", 
                    String(BADSTR_1),
                    CIMKeyBinding::STRING));
    
    CIMObjectPath obj_path = CIMObjectPath(String(), 
                                nameSpace, 
                                className,
                                keys);
    handler.deliver(obj_path);
    // complete processing the request
    handler.complete();
}
Example #17
0
void InstanceProvider::deleteInstance(
	const OperationContext & context,
	const CIMObjectPath & instanceReference,
	ResponseHandler & handler)
{
	// convert a potential fully qualified reference into a local reference
	// (class name and keys only).
	CIMObjectPath localReference = CIMObjectPath(
		String(),
		CIMNamespaceName(),
		instanceReference.getClassName(),
		instanceReference.getKeyBindings());
	
	// begin processing the request
	handler.processing();

	// instance index corresponds to reference index
	for(Uint32 i = 0, n = _instances.size(); i < n; i++)
	{
		if(localReference == _instances[i].getPath())
		{
			// remove instance from the array
			_instances.remove(i);

			break;
		}
	}
	
	// complete processing the request
	handler.complete();
}
Example #18
0
void TimingProvider::modifyInstance(
    const OperationContext & context,
    const CIMObjectPath & instanceReference,
    const CIMInstance & instanceObject,
    const Boolean includeQualifiers,
    const CIMPropertyList & propertyList,
    ResponseHandler & handler)
{
    // convert a potential fully qualified reference into a local reference
    // (class name and keys only).
    CIMObjectPath localReference = CIMObjectPath(
        String(),
        String(),
        instanceReference.getClassName(),
        instanceReference.getKeyBindings());
    cout <<"TimingProvider::modifyInstance" << endl;
    // begin processing the request
    handler.processing();

    // instance index corresponds to reference index
    for(Uint32 i = 0, n = _instances.size(); i < n; i++)
    {
        if(localReference == _instanceNames[i])
        {
            // overwrite existing instance
            _instances[i] = instanceObject;

            break;
        }
    }
    // complete processing the request
    handler.complete();
}
void PG_TestPropertyTypes::enumerateInstanceNames(
    const OperationContext& context,
    const CIMObjectPath& classReference,
    ObjectPathResponseHandler& handler)
{

    // ensure the Namespace is valid
    if (!classReference.getNameSpace().equal ("test/static"))
    {
        throw CIMException(CIM_ERR_INVALID_NAMESPACE);
    }

    // ensure the class existing in the specified namespace
    if (!classReference.getClassName().equal ("PG_TestPropertyTypes"))
    {
        throw CIMException(CIM_ERR_INVALID_CLASS);
    }

    // begin processing the request
    handler.processing();

    Array<CIMObjectPath> instanceNames;
    instanceNames = _enumerateInstanceNames(context, classReference);

    handler.deliver(instanceNames);

    // complete processing the request
    handler.complete();
}
Example #20
0
void AuditLogger::logUpdateInstanceOperation(
    const char* cimMethodName,
    AuditEvent eventType,
    const String& userName,
    const String& ipAddr,
    const CIMNamespaceName& nameSpace,
    const CIMObjectPath& instanceName,
    const String& moduleName,
    const String& providerName,
    CIMStatusCode statusCode)
{
    // check if SMF is gathering this type of records.
    if (_smf.isRecording(CIM_OPERATION) ||
        (! _isInternalWriterUsed) )
    {
        String cimInstanceName =
            CIMObjectPath("", CIMNamespaceName(), instanceName.getClassName(),
            instanceName.getKeyBindings()).toString();

        _writeCIMOperationRecord(
            INSTANCE_OPERATION, userName, statusCode,
            ipAddr, cimMethodName, cimInstanceName,
            nameSpace.getString(), providerName, moduleName );
    }
}
Example #21
0
void
OperatingSystemProvider::enumerateInstanceNames(
      				const OperationContext& context,
			  	const CIMObjectPath &ref,
			  	ObjectPathResponseHandler& handler )
{
    CIMObjectPath newref;
    CIMName className;

    // 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
    className = ref.getClassName();
    if (className.equal (STANDARDOPERATINGSYSTEMCLASS))
    {
        handler.processing();
        handler.complete();
        return;
    }
    else if (!className.equal (EXTENDEDOPERATINGSYSTEMCLASS))
    {
        throw CIMNotSupportedException("OperatingSystemProvider "
                       "does not support class " + className.getString());
    }

    // so we know it is for EXTENDEDOPERATINGSYSTEMCLASS
    handler.processing();
    // in terms of the class we use, want to set to what was requested
    newref = _fill_reference(ref.getNameSpace(), className);
    handler.deliver(newref);
    handler.complete();

    return;
}
void ComputerSystemProvider::enumerateInstanceNames(
    const OperationContext& context,
    const CIMObjectPath &ref,
    ObjectPathResponseHandler& 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));

        handler.deliver(CIMObjectPath(
            _cs.getHostName(),
            ref.getNameSpace(),
            CLASS_EXTENDED_COMPUTER_SYSTEM,
            keys));
    }

    handler.complete();
    return;
}
void benchmarkProvider::enumerateInstances(
    const OperationContext & context,
    const CIMObjectPath & classReference,
    const Boolean includeQualifiers,
    const Boolean includeClassOrigin,
    const CIMPropertyList & propertyList,
    InstanceResponseHandler & handler)
{
    CIMInstance _instance;
    Uint32 numberOfProperties;
    Uint32 sizeOfPropertyValue;
    Uint32 numberOfInstances;

    CIMName className = classReference.getClassName();
    test.getConfiguration(className, numberOfProperties,
                          sizeOfPropertyValue, numberOfInstances);

    // begin processing the request
    handler.processing();

    for (Uint32 i = 1; i <= numberOfInstances; i++)
    {
       _instance = _buildInstance(className, numberOfProperties,
                        sizeOfPropertyValue , CIMValue(i));   
       handler.deliver(_instance);
    }

    // complete processing the request
    handler.complete();
}
Example #24
0
/**
 ***************************************************************************
   _filterAssociationInstances is used to filter the set of possible return
   instances against the filters (resultClass and resultRole) provided with
   the associators and associatorNames operations.  It returns the ObjectPaths
   of the set of objects that pass the filter tests.

    @param assocInstance     - The target association class instance
    @param sourceObjectPath  - The source ObjectPath
    @param resultClass       - The result class. If there is no resultClass,
                               this is String::EMPTY.
    @param resultRole        - The result role. If there is no role, this is
                               String::EMPTY

    @return   the ObjectPaths of the set of association instances that pass
              the filter tests.
 ***************************************************************************
*/
Array<CIMObjectPath> ANHProvider::_filterAssociationInstances(
    CIMInstance& assocInstance,
    const CIMObjectPath& sourceObjectPath,
    CIMName resultClass,
    String resultRole)
{
    Array<CIMObjectPath> returnPaths;

    // get all Reference properties
    for (Uint32 i = 0, n = assocInstance.getPropertyCount(); i < n; i++)
    {
        CIMProperty p = assocInstance.getProperty(i);

        if (p.getType() == CIMTYPE_REFERENCE)
        {
            CIMValue v = p.getValue();
            CIMObjectPath path;
            v.get(path);

            if (!sourceObjectPath.identical(path))
            {
                if (resultClass.isNull() || resultClass == path.getClassName())
                {
                    if (resultRole == String::EMPTY ||
                        (p.getName() == CIMName(resultRole)))
                    {
                        returnPaths.append(path);
                    }
                }
            }
        }
    }
    return returnPaths;
}
Example #25
0
void IBM_CIMOMStatDataProvider::getInstance(
	const OperationContext & context,
	const CIMObjectPath & instanceReference,
        const Boolean includeQualifiers,
        const Boolean includeClassOrigin,
        const CIMPropertyList & propertyList,
	InstanceResponseHandler & handler)
{
	CIMObjectPath localReference = CIMObjectPath(
		String::EMPTY,
		CIMNamespaceName(),
		instanceReference.getClassName(),
		instanceReference.getKeyBindings());

	// begin processing the request
	handler.processing();

	// instance index corresponds to reference index
	for(Uint32 i = 0; i < StatisticalData::NUMBER_OF_TYPES; i++)
	{ // cout << "loop" << endl;
		if(localReference == _references[i])
		{
			// deliver requested instance
			handler.deliver(getInstance(i));
			break;
		}
	}

	// complete processing the request
	handler.complete();
}
Example #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);
}
/*****************************************************************************
 *
 * Implementation of InstanceProvider modifyInstance method.
 *
 *****************************************************************************/
void InteropProvider::modifyInstance(
    const OperationContext & context,
    const CIMObjectPath & instanceReference,
    const CIMInstance& modifiedIns,
    const Boolean includeQualifiers,
    const CIMPropertyList& propertyList,
    ResponseHandler & handler)
{
    PEG_METHOD_ENTER(TRC_CONTROLPROVIDER,
        "InteropProvider::modifyInstance");

    initProvider();

    //AutoMutex autoMut(changeControlMutex);

    //PEG_TRACE((TRC_CONTROLPROVIDER, Tracer::LEVEL4,
    //    "%s modifyInstance. instanceReference= %s, includeQualifiers= %s, "
    //        "PropertyList= %s",
    //    thisProvider,
    //    (const char *) (instanceReference.toString().getCString()),
    //    boolToString(includeQualifiers),
    //    (const char *) (propertyListToString(propertyList).getCString())));

    //// test for legal namespace for this provider. Exception if not
    ////namespaceSupported(instanceReference);
    //// NOTE: Above is commented out because the routing tables will always
    //// do the right thing and that's the only way requests get here.

    //CIMName className =  instanceReference.getClassName();

    //// begin processing the request
    //handler.processing();

    //if (className.equal(PEGASUS_CLASSNAME_PG_OBJECTMANAGER))
    //{
    //    modifyObjectManagerInstance(context, instanceReference,modifiedIns,
    //        includeQualifiers, propertyList);
    //}
    //else
    //{
    //    throw CIMNotSupportedException("Delete instance of class " +
    //      className.getString());
    //}

    //handler.complete();
    //PEG_METHOD_EXIT();
    //return;

    // 不支持修改
    PEG_METHOD_EXIT();
    const CIMName instClassName = instanceReference.getClassName();
    MessageLoaderParms mparms(
        "ControlProviders.InteropProvider.MODIFY_INSTANCE_NOT_ALLOWED",
        "Modify instance operation not allowed by Interop Provider for "
        "class $0.",
        instClassName.getString());
    throw CIMNotSupportedException(mparms);

}
/**
    Retrieves either the stored errorInstance or indicationInstance from
    both the class and the static repository, performs a comparison, and
    returns the instance if they are the same.
*/
void EmbeddedInstanceProvider::getInstance(
    const OperationContext& context,
    const CIMObjectPath& ref,
    const Boolean includeQualifiers,
    const Boolean includeClassOrigin,
    const CIMPropertyList& propertyList,
    InstanceResponseHandler& handler)
{
    handler.processing();
    CIMInstance retInst;
    if (ref.getClassName().equal(CIMName("PG_EmbeddedError")))
        retInst = errorInstance->clone();
    else if (ref.getClassName().equal(CIMName("PG_InstMethodIndication")))
        retInst = indicationInstance->clone();

    handler.deliver(retInst);
    handler.complete();
}
Example #29
0
void
LinuxNetworkAdapterProvider::deleteInstance(
      				const OperationContext& context,
			  	const CIMObjectPath& ref,
			  	ResponseHandler& handler )
{
   throw CIMNotSupportedException(ref.getClassName().getString() +
		                  "::deleteInstance");
}
void PG_TestPropertyTypes::enumerateInstances(
    const OperationContext& context,
    const CIMObjectPath& ref,
    const Boolean includeQualifiers,
    const Boolean includeClassOrigin,
    const CIMPropertyList& propertyList,
    InstanceResponseHandler& handler)
{

    // ensure the Namespace is valid
    if (!ref.getNameSpace().equal ("test/static"))
    {
        throw CIMException(CIM_ERR_INVALID_NAMESPACE);
    }

    // ensure the class existing in the specified namespace
    if (!ref.getClassName().equal ("PG_TestPropertyTypes"))
    {
        throw CIMException(CIM_ERR_INVALID_CLASS);
    }

    // begin processing the request
    handler.processing();

    // NOTE: It would be much more efficient to remember the instance names

    // get class definition from repository
    CIMClass cimclass = _cimom.getClass(
        context,
        ref.getNameSpace(),
        ref.getClassName(),
        false,
        true,
        true,
        CIMPropertyList());

    for (Uint32 i = 0; i < _instances.size(); i++)
    {
        handler.deliver(_instances[i]);
    }

    // complete processing the request
    handler.complete();
}