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


C++ CIMInstance::findProperty方法代码示例

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


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

示例1: inst

static void
_test1 (CIMClient & client, const String & ql)
{
  try
  {
    for (Uint32 i = 0; i < QUERIES; i++)
      {

        if (verbose)
          cerr << "Querying " << queries[i] << endl;

        Array < CIMObject > objects = client.execQuery (providerNamespace,
                                                        ql, queries[i]);

        if (objects.size () == 0)
          {
            // Only the third (second when starting from zero)
            // and eight(7) won't return instances.
            //PEGASUS_TEST_ASSERT(i == 2 || i == 5 || i == 7
            //                    || i == 8 || i == 12);
            if (verbose)
              cerr <<i<< " No instance returned.. That is good" << endl;
          }

        for (Uint32 i = 0; i < objects.size (); i++)
          {

            if (objects[i].isInstance ())
              {

                CIMInstance inst (objects[i]);

                if (inst.findProperty ("ElementName") != PEG_NOT_FOUND)
                  _checkStringProperty (inst, "ElementName",
                                        "TestCMPI_ExecQuery");

                if (inst.findProperty ("s") != PEG_NOT_FOUND)
                  _checkStringProperty (inst, "s", "s");

                if (inst.findProperty ("n32") != PEG_NOT_FOUND)
                  _checkUint32Property (inst, "n32", 32);

                if (inst.findProperty ("n64") != PEG_NOT_FOUND)
                  _checkUint64Property (inst, "n64", 64);

                if (inst.findProperty ("n16") != PEG_NOT_FOUND)
                  _checkUint16Property (inst, "n16", 16);

              }
          }
      }
  }
  catch (const Exception & e)
  {
    cerr << "test failed: " << e.getMessage () << endl;
    exit (-1);
  }

}
开发者ID:brunolauze,项目名称:pegasus,代码行数:59,代码来源:TestCMPIInstanceExecQuery.cpp

示例2: _propertyIdentical

Boolean _propertyIdentical(
    const char* propertyName,
    CIMInstance& instance1,
    CIMInstance& instance2)
{
    Uint32 pos = instance1.findProperty(propertyName);
    CIMConstProperty p1 = instance1.getProperty(pos);
    pos = instance2.findProperty(propertyName);
    CIMConstProperty p2 = instance2.getProperty(pos);
    return (p1.identical(p2));
}
开发者ID:ncultra,项目名称:Pegasus-2.5,代码行数:11,代码来源:InstanceDecl.cpp

示例3: checkBlocked

static void checkBlocked(CIMInstance &pm)
{
    PEG_METHOD_ENTER(TRC_PROVIDERMANAGER, "checkBlocked");
    
    Array<Uint16> operationalStatus;

    Uint32 pos = pm.findProperty(CIMName ("OperationalStatus"));
    if(pos == PEG_NOT_FOUND) {
        PEG_TRACE_STRING(TRC_PROVIDERMANAGER, Tracer::LEVEL4,
            "OperationalStatus not found.");
        PEG_METHOD_EXIT();
	//l10n
        //throw PEGASUS_CIM_EXCEPTION(CIM_ERR_FAILED, "provider lookup failed.");
        throw PEGASUS_CIM_EXCEPTION_L(CIM_ERR_FAILED, MessageLoaderParms(
        					"ProviderManager.ProviderManagerService.PROVIDER_LOOKUP_FAILED",
        					"provider lookup failed."));
    }

    pm.getProperty(pos).getValue().get(operationalStatus);
    for(Uint32 i = 0; i < operationalStatus.size(); i++) {
        if(operationalStatus[i] == _MODULE_STOPPED ||
	   operationalStatus[i] == _MODULE_STOPPING) {
            PEG_TRACE_STRING(TRC_PROVIDERMANAGER, Tracer::LEVEL4,
                "Provider blocked.");
            PEG_METHOD_EXIT();
			//l10n
            //throw PEGASUS_CIM_EXCEPTION(CIM_ERR_ACCESS_DENIED, "provider blocked.");
            throw PEGASUS_CIM_EXCEPTION_L(CIM_ERR_ACCESS_DENIED, MessageLoaderParms(
            			"ProviderManager.ProviderManagerService.PROVIDER_BLOCKED",
            			"provider blocked."));
        }
    }
}
开发者ID:ncultra,项目名称:Pegasus-2.5,代码行数:33,代码来源:ProviderRegistrar.cpp

示例4: setPropertyValue

void setPropertyValue(CIMInstance& instance, const CIMName& propertyName,
    const Uint32 value)
{
    Uint32 pos;
    PEGASUS_ASSERT(pos = instance.findProperty(propertyName) != PEG_NOT_FOUND);
    instance.getProperty(pos).setValue(CIMValue(value));
}
开发者ID:deleisha,项目名称:neopegasus,代码行数:7,代码来源:ResponseData.cpp

示例5: _getPropertyValue

/*
    Return the value in a property.
    If the property cannot be found, return false
*/
Boolean _getPropertyValue(const CIMInstance& inst,
                          const CIMName name,
                          CIMValue& val)
{
#ifdef ENABLE_LOCAL_DIAGNOSTICS
    DCOUT << "Instance from which to retrieve "
          << inst.getClassName().getString() << " propertyName "
          << name.getString() << endl;
#endif
    unsigned int pos = inst.findProperty(name);
    if (pos==PEG_NOT_FOUND)
    {

#ifdef ENABLE_LOCAL_DIAGNOSTICS
        DCOUT << "property " << name.getString() <<  " pos " << pos
              << " NOT found" << endl;
#endif
        return false;
    }

#ifdef ENABLE_LOCAL_DIAGNOSTICS
    DCOUT << "property " << name.getString() << " FOUND" << endl;
#endif
    val=inst.getProperty(pos).getValue();
    return true;
}
开发者ID:deleisha,项目名称:neopegasus,代码行数:30,代码来源:FQLInstancePropertySource.cpp

示例6: getPropertyValue

CIMValue CIMHelper::getPropertyValue(const CIMInstance &instanceObject, String name)
{
    CIMName cname(name);
    Uint32 index = instanceObject.findProperty(cname);
    if (index == PEG_NOT_FOUND) return CIMValue();
    CIMConstProperty property = instanceObject.getProperty(index);
    return property.getValue();
}
开发者ID:brunolauze,项目名称:pegasus-providers,代码行数:8,代码来源:CIMHelper.cpp

示例7: getPropertiesFromCIMServer

void getPropertiesFromCIMServer(
    CIMClient& client,
    const CIMName& propName,
    Array <String>& propValues)
{
    CIMProperty prop;

    Array<CIMKeyBinding> kbArray;
    CIMKeyBinding        kb;
    String               _hostName;

    kb.setName(PROPERTY_NAME);
    kb.setValue(propName.getString());
    kb.setType(CIMKeyBinding::STRING);

    _hostName.assign(System::getHostName());

    kbArray.append(kb);

    CIMObjectPath reference(_hostName, PEGASUS_NAMESPACENAME_CONFIG,
                            PEGASUS_CLASSNAME_CONFIGSETTING, kbArray);

    CIMInstance cimInstance = client.getInstance(PEGASUS_NAMESPACENAME_CONFIG,
                                                 reference);

    Uint32 pos = cimInstance.findProperty(PROPERTY_NAME);
    prop = (CIMProperty)cimInstance.getProperty(pos);
    propValues.append(prop.getValue().toString());

    pos = cimInstance.findProperty(DEFAULT_VALUE);
    prop = (CIMProperty)cimInstance.getProperty(pos);
    propValues.append(prop.getValue().toString());

    pos = cimInstance.findProperty(CURRENT_VALUE);
    prop = (CIMProperty)cimInstance.getProperty(pos);
    propValues.append(prop.getValue().toString());

    pos = cimInstance.findProperty(PLANNED_VALUE);
    prop = (CIMProperty)cimInstance.getProperty(pos);
    propValues.append(prop.getValue().toString());

    pos = cimInstance.findProperty(DYNAMIC_PROPERTY);
    prop = (CIMProperty)cimInstance.getProperty(pos);
    propValues.append(prop.getValue().toString());

}
开发者ID:rdobson,项目名称:openpegasus,代码行数:46,代码来源:TestAggregationOutputClient.cpp

示例8: _testPropertyValue

void _testPropertyValue(
    CIMInstance& instance,
    const CIMName& propertyName,
    const CIMValue & testValue)
{
    CIMValue value =
        instance.getProperty(instance.findProperty(propertyName)).getValue();
    PEGASUS_TEST_ASSERT(testValue == value);
}
开发者ID:brunolauze,项目名称:pegasus,代码行数:9,代码来源:Configuration.cpp

示例9: findConsumerProvider

ProviderName ProviderRegistrar::findConsumerProvider(const String & destinationPath)
{
   CIMInstance provider;
   CIMInstance providerModule;
   ProviderName temp;

   if (_prm->lookupIndicationConsumer(destinationPath,provider,providerModule))
      return ProviderName(
               provider.getProperty(provider.findProperty
                   ("Name")).getValue ().toString (),
               providerModule.getProperty(providerModule.findProperty
                    ("Location")).getValue().toString(),
               providerModule.getProperty(providerModule.findProperty
                    ("InterfaceType")).getValue().toString(),
               0);

   return temp;
}
开发者ID:ncultra,项目名称:Pegasus-2.5,代码行数:18,代码来源:ProviderRegistrar.cpp

示例10: _checkValue

static Boolean _checkValue(
    CIMInstance &instance,
    const String &prop,
    T value)
{
    T lvalue;
    instance.getProperty(instance.findProperty(prop)).getValue().get(lvalue);
    return lvalue == value;
}
开发者ID:brunolauze,项目名称:pegasus,代码行数:9,代码来源:DeliveryRetry.cpp

示例11: createInstance

void InstanceProvider::createInstance(
    const OperationContext & context,
    const CIMObjectPath & instanceReference,
    const CIMInstance & instanceObject,
    ObjectPathResponseHandler & handler)
{
    // Validate the class name
    if (!instanceObject.getClassName().equal("Sample_InstanceProviderClass"))
    {
        throw CIMNotSupportedException(
            instanceObject.getClassName().getString());
    }

    // Find the key property
    Uint32 idIndex = instanceObject.findProperty("Identifier");

    if (idIndex == PEG_NOT_FOUND)
    {
        throw CIMInvalidParameterException("Missing key value");
    }

    CIMInstance cimInstance = instanceObject.clone();

    // Create the new instance name
    CIMValue idValue = instanceObject.getProperty(idIndex).getValue();
    Array<CIMKeyBinding> keys;
    keys.append(CIMKeyBinding("Identifier", idValue));
    CIMObjectPath instanceName = CIMObjectPath(
        String(),
        CIMNamespaceName(),
        instanceObject.getClassName(),
        keys);

    cimInstance.setPath(instanceName);
    
    // Determine whether this instance already exists
    for(Uint32 i = 0, n = _instances.size(); i < n; i++)
    {
        if(instanceName == _instances[i].getPath())
        {
            throw CIMObjectAlreadyExistsException(instanceName.toString());
        }
    }

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

    // add the new instance to the array
    _instances.append(cimInstance);

    // deliver the new instance name
    handler.deliver(instanceName);

    // complete processing the request
    handler.complete();
}
开发者ID:brunolauze,项目名称:pegasus,代码行数:56,代码来源:InstanceProvider.cpp

示例12: setObjectManagerStatistics

Boolean setObjectManagerStatistics(CIMClient & client, Boolean newState)
{

    CIMName gathStatName ("GatherStatisticalData");
    Array<CIMInstance> instancesObjectManager;
    CIMInstance instObjectManager;
    Uint32 prop_num;
    Array<CIMName> plA;
    plA.append(gathStatName);
    CIMPropertyList statPropertyList(plA);
    // Create property list that represents correct request
    // get instance.  Get only the gatherstatitistics property
    instancesObjectManager  = 
        client.enumerateInstances(PEGASUS_NAMESPACENAME_INTEROP,
            "CIM_ObjectManager",
            true, false, false, false, statPropertyList);
    PEGASUS_TEST_ASSERT(instancesObjectManager.size() == 1);
    instObjectManager = instancesObjectManager[0];
    // set correct path into instance
    instObjectManager.setPath(instancesObjectManager[0].getPath());
    
    prop_num = instObjectManager.findProperty(gathStatName);
    PEGASUS_TEST_ASSERT(prop_num != PEG_NOT_FOUND);
    
    instObjectManager.getProperty(prop_num).setValue(CIMValue(newState));
    
    client.modifyInstance(PEGASUS_NAMESPACENAME_INTEROP, instObjectManager,
         false, statPropertyList);
    CIMInstance updatedInstance = 
        client.getInstance(PEGASUS_NAMESPACENAME_INTEROP,
        instObjectManager.getPath(),
        false, false, false, statPropertyList);
    prop_num = updatedInstance.findProperty(gathStatName);
    PEGASUS_TEST_ASSERT(prop_num != PEG_NOT_FOUND);
    CIMProperty p = updatedInstance.getProperty(prop_num);
    CIMValue v = p.getValue();
    Boolean rtn;
    v.get(rtn);
    //// Need to get it again
    cout << "Updated Status= " << ((rtn)? "true" : "false") << endl;
    return(rtn);
}
开发者ID:host1812,项目名称:scx_plugin_public,代码行数:42,代码来源:CIMCLICommand.cpp

示例13: setPropertyValue

bool setPropertyValue(CIMInstance& instance, const CIMName& propertyName,
    const CIMValue & value)
{
    unsigned int pos = instance.findProperty(propertyName);
    if(pos != PEG_NOT_FOUND)
    {
        instance.getProperty(pos).setValue(value);
        return true;
    }
    return false;
}
开发者ID:deleisha,项目名称:neopegasus,代码行数:11,代码来源:main.cpp

示例14: getProperty

/////////////////////////////////////////////////////////////////////////////
// WMIInstanceProvider::getProperty
//
// ///////////////////////////////////////////////////////////////////////////
CIMValue WMIInstanceProvider::getProperty(
        const String& nameSpace,
        const String& userName,
        const String& password,
        const CIMObjectPath& instanceName,
        const String& propertyName)
{

    CIMInstance cimInstance;
    Array<CIMName> propertyNames;

    PEG_METHOD_ENTER(TRC_WMIPROVIDER,"WMIInstanceProvider::getProperty()");

    setup(nameSpace,userName,password);

    if (!m_bInitialized)
    {
        throw CIMException(CIM_ERR_FAILED, "[getProperty] m_bInitialized");
    }

    CIMName propName = propertyName;

    propertyNames.append(propName);

    CIMPropertyList propertyList = CIMPropertyList(propertyNames);

    // get the relevant CIMInstance object
    cimInstance = getCIMInstance(nameSpace,
                                 userName,
                                 password,
                                 instanceName,
                                 propertyList);

    // now fetch the property
    Uint32 pos = cimInstance.findProperty(propName);

    if (PEG_NOT_FOUND == pos)
    {
        throw CIMException(CIM_ERR_NO_SUCH_PROPERTY,
            "[getProperty] findproperty");
    }

    CIMProperty property = cimInstance.getProperty(pos);

    // and return the value
    CIMValue value = property.getValue();

    PEG_METHOD_EXIT();

    return value;
}
开发者ID:rdobson,项目名称:openpegasus,代码行数:55,代码来源:WMIInstanceProvider.cpp

示例15: setInstance

void CIMError::setInstance(const CIMInstance& instance)
{
    for (Uint32 i = 0; i < instance.getPropertyCount(); i++)
    {
        CIMConstProperty p = instance.getProperty(i);

        _Check("ErrorType", p, (Uint16*)0);
        _Check("OtherErrorType", p, (String*)0);
        _Check("OwningEntity", p, (String*)0);
        _Check("MessageID", p, (String*)0);
        _Check("Message", p, (String*)0);
        _Check("MessageArguments", p, (Array<String>*)0);
        _Check("PerceivedSeverity", p, (Uint16*)0);
        _Check("ProbableCause", p, (Uint16*)0);
        _Check("ProbableCauseDescription", p, (String*)0);
        _Check("RecommendedActions", p, (Array<String>*)0);
        _Check("ErrorSource", p, (String*)0);
        _Check("ErrorSourceFormat", p, (Uint16*)0);
        _Check("OtherErrorSourceFormat", p, (String*)0);
        _Check("CIMStatusCode", p, (Uint32*)0);
        _Check("CIMStatusCodeDescription", p, (String*)0);
    }

    // Verify that the instance contains all of the required properties.

    for (Uint32 i = 0; i < _numRequiredProperties; i++)
    {
        // Does inst have this property?

        Uint32 pos = instance.findProperty(_requiredProperties[i]);

        if (pos == PEG_NOT_FOUND)
        {
            char buffer[80];
            sprintf(buffer, "required property does not exist: %s",
                    _requiredProperties[i]);
            throw CIMException(CIM_ERR_NO_SUCH_PROPERTY, buffer);
        }
        // is required property non-null?
        CIMConstProperty p = instance.getProperty(pos);
        CIMValue v = p.getValue();
        if (v.isNull())
        {
            char buffer[80];
            sprintf(buffer, "required property MUST NOT be Null: %s",
                    _requiredProperties[i]);
            throw CIMException(CIM_ERR_FAILED, buffer);
        }
    }
    _inst = instance;
}
开发者ID:xenserver,项目名称:openpegasus,代码行数:51,代码来源:CIMError.cpp


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