当前位置: 首页>>代码示例>>C++>>正文


C++ CIMObjectPath类代码示例

本文整理汇总了C++中CIMObjectPath的典型用法代码示例。如果您正苦于以下问题:C++ CIMObjectPath类的具体用法?C++ CIMObjectPath怎么用?C++ CIMObjectPath使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了CIMObjectPath类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: deleteInstance

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();
}
开发者ID:rdobson,项目名称:openpegasus,代码行数:35,代码来源:PG_TestPropertyTypes.cpp

示例2: CIMObjectPath

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();
}
开发者ID:brunolauze,项目名称:pegasus,代码行数:31,代码来源:InstanceProvider.cpp

示例3: getInstance

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;
}
开发者ID:deleisha,项目名称:neopegasus,代码行数:60,代码来源:ComputerSystemProvider.cpp

示例4: CIMObjectPath

void LargeDataProvider::getInstance(
    const OperationContext & context,
    const CIMObjectPath & instanceReference,
    const Boolean includeQualifiers,
    const Boolean includeClassOrigin,
    const CIMPropertyList & propertyList,
    InstanceResponseHandler & handler)
{
    cout << "------------------------------" << endl;
    cout << "LargeDataProvider::getInstance" << endl;
    cout << "------------------------------" << endl;
    // 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();

    // 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();
}
开发者ID:brunolauze,项目名称:pegasus,代码行数:35,代码来源:LargeDataProvider.cpp

示例5: CIMObjectPath

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();
}
开发者ID:brunolauze,项目名称:pegasus,代码行数:33,代码来源:TimingProvider.cpp

示例6: CIMObjectPath

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 );
    }
}
开发者ID:brunolauze,项目名称:pegasus,代码行数:25,代码来源:AuditLoggerToSMF.cpp

示例7: _BubbleSort

static void _BubbleSort(Array<CIMKeyBinding>& x)
{
    Uint32 n = x.size();

    //
    //  If the key is a reference, the keys in the reference must also be
    //  sorted
    //
    for (Uint32 k = 0; k < n ; k++)
        if (x[k].getType () == CIMKeyBinding::REFERENCE)
        {
            CIMObjectPath tmp (x[k].getValue ());
            Array <CIMKeyBinding> keyBindings = tmp.getKeyBindings ();
            _BubbleSort (keyBindings);
            tmp.setKeyBindings (keyBindings);
            x[k].setValue (tmp.toString ());
        }

    if (n < 2)
        return;

    for (Uint32 i = 0; i < n - 1; i++)
    {
        for (Uint32 j = 0; j < n - 1; j++)
        {
            if (String::compareNoCase(x[j].getName().getString(),
                                      x[j+1].getName().getString()) > 0)
            {
                CIMKeyBinding t = x[j];
                x[j] = x[j+1];
                x[j+1] = t;
            }
        }
    }
}
开发者ID:ncultra,项目名称:Pegasus-2.5,代码行数:35,代码来源:CIMObjectPath.cpp

示例8: testCreateInstance

void testCreateInstance(CIMClient& client, const char* ns)
{
  CIMObjectPath path;
  Array<CIMInstance> instances;
  CIMName keyName;
  String keyValue;

  instances = client.enumerateInstances(ns, CIM_QUERYCAPCLASS_NAME);

  Array<CIMKeyBinding> keys = instances[0].getPath().getKeyBindings();

  keys[0].setValue("100");

  path = instances[0].getPath();
  path.setKeyBindings(keys);

  try
  {
    path = client.createInstance(ns, instances[0]);
  }
  catch(Exception)
  {
    // Do nothing. This is expected since createInstance is NOT
    // supported.
    return;
  }

  throw Exception("createInstance is supported");
}
开发者ID:rdobson,项目名称:openpegasus,代码行数:29,代码来源:TestCIMQueryCap.cpp

示例9: CIMInstanceNametoXML

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>";
}
开发者ID:kkaempf,项目名称:openwbem,代码行数:27,代码来源:OW_CIMtoXML.cpp

示例10: _testMethodError

// This method calls CMPIProviderManager::handleInvokeMethodRequest and
// 'if(rc.rc != CMPI_RC_OK)' condition  in CMPIProviderManager.cpp succeeds.
void _testMethodError(CIMClient & client)
{
    CIMObjectPath instanceName;
    instanceName.setNameSpace (providerNamespace);
    instanceName.setClassName (CMPI_TEST_FAIL);

    Array < CIMParamValue > inParams;
    Array < CIMParamValue > outParams;
    Boolean caughtException;

    caughtException = false;
    try
    {
        CIMValue retValue = client.invokeMethod(
             providerNamespace,
             instanceName,
             "test",
             inParams,
             outParams);
    }
    catch (const CIMException &e)
    {
        if (e.getCode() == CIM_ERR_NOT_SUPPORTED)
        {
            caughtException = true;
        }
    }
    PEGASUS_TEST_ASSERT (caughtException);
}
开发者ID:rdobson,项目名称:openpegasus,代码行数:31,代码来源:TestCMPI_Fail_5.cpp

示例11: CreateFilterInstance

CIMObjectPath CreateFilterInstance (CIMClient& client,
                                    const String query,
                                    const String qlang,
                                    const String name,
                                    const CIMNamespaceName & filterNS)
{
    CIMInstance filterInstance(PEGASUS_CLASSNAME_INDFILTER);
    filterInstance.addProperty(CIMProperty (CIMName ("SystemCreationClassName"),
        System::getSystemCreationClassName()));
    filterInstance.addProperty(CIMProperty(CIMName ("SystemName"),
        System::getFullyQualifiedHostName()));
    filterInstance.addProperty(CIMProperty(CIMName ("CreationClassName"),
        PEGASUS_CLASSNAME_INDFILTER.getString()));
    filterInstance.addProperty(CIMProperty(CIMName ("Name"),
        String(name)));
    filterInstance.addProperty (CIMProperty(CIMName ("Query"),
        String(query)));
    filterInstance.addProperty (CIMProperty(CIMName ("QueryLanguage"),
        String(qlang)));
    filterInstance.addProperty (CIMProperty(CIMName ("SourceNamespace"),
        String("test/TestProvider")));

    CIMObjectPath Ref = client.createInstance(filterNS, filterInstance);
    Ref.setNameSpace (filterNS);
    return (Ref);
}
开发者ID:brunolauze,项目名称:pegasus,代码行数:26,代码来源:IndicationProcess.cpp

示例12: if

/**
    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();
}
开发者ID:brunolauze,项目名称:pegasus,代码行数:30,代码来源:EmbeddedInstanceProvider.cpp

示例13: _checkClass

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;
}
开发者ID:deleisha,项目名称:neopegasus,代码行数:34,代码来源:ComputerSystemProvider.cpp

示例14: _testHostedIndicationServiceInstance

void _testHostedIndicationServiceInstance(CIMClient &client)
{
    cout << "Testing Association Class "
        << (const char *)PEGASUS_CLASSNAME_PG_HOSTEDINDICATIONSERVICE.
             getString().getCString()
        << "...";
    // Get PG_HostedIndicationService Instances
    Array<CIMInstance> hostedInstances = client.enumerateInstances(
        PEGASUS_NAMESPACENAME_INTEROP,
        PEGASUS_CLASSNAME_PG_HOSTEDINDICATIONSERVICE);
    PEGASUS_TEST_ASSERT(hostedInstances.size() == 1);

    // Get PG_HostedIndicationService Instance names
    Array<CIMObjectPath> hostedPaths = client.enumerateInstanceNames(
        PEGASUS_NAMESPACENAME_INTEROP,
        PEGASUS_CLASSNAME_PG_HOSTEDINDICATIONSERVICE);
    PEGASUS_TEST_ASSERT(hostedPaths.size() == 1);

    // Get CIM_IndicationService instance names
    Array<CIMObjectPath> servicePaths = client.enumerateInstanceNames(
        PEGASUS_NAMESPACENAME_INTEROP,
        PEGASUS_CLASSNAME_CIM_INDICATIONSERVICE);
    PEGASUS_TEST_ASSERT(servicePaths.size() == 1);

    // Test the CIM_IndicationService value.
    CIMValue capValue = hostedInstances[0].getProperty(
        hostedInstances[0].findProperty("Dependent")).getValue();
    CIMObjectPath testPath;
    capValue.get(testPath);
    testPath.setNameSpace(CIMNamespaceName());
    PEGASUS_TEST_ASSERT(testPath.identical(servicePaths[0]));

    cout << "Test Complete" << endl;
}
开发者ID:brunolauze,项目名称:pegasus,代码行数:34,代码来源:ServerProfile.cpp

示例15: CIMNotSupportedException

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();
}
开发者ID:brunolauze,项目名称:pegasus,代码行数:25,代码来源:TestGroupingProvider.cpp


注:本文中的CIMObjectPath类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。