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


C++ CIMName函数代码示例

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


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

示例1: PEG_METHOD_ENTER

//
// Class that determines whether or not the origin class in an association
// operation is valid for the given association class, and also determines
// the origin and target "roles". These values generally correspond to the
// role and resultRole parameter of an associators/associatorNames operation.
//
bool InteropProvider::validAssocClassForObject(
    const OperationContext & context,
    const CIMName & assocClass,
    const CIMObjectPath & objectName,
    const CIMNamespaceName & opNamespace,
    String & originProperty,
    String & targetProperty)
{
    PEG_METHOD_ENTER(TRC_CONTROLPROVIDER,
                     "InteropProvider::validAssocClassForObject()");
    TARGET_CLASS assocClassEnum = translateClassInput(assocClass);
    TARGET_CLASS originClassEnum = NOCLASS;
    CIMName originClass = objectName.getClassName();
    // If the association class is PG_ElementConformsToProfile, we'll have to
    // do some special processing in case the origin instance for the operation
    // is managed by another provider.
    if(assocClassEnum == PG_ELEMENTCONFORMSTOPROFILE)
    {
        // Test if the origin is an element managed by another provider
        // that has implemented a registered profile.
        if(opNamespace != PEGASUS_NAMESPACENAME_INTEROP ||
                (originClass != PEGASUS_CLASSNAME_PG_REGISTEREDPROFILE &&
#ifdef PEGASUS_ENABLE_DMTF_INDICATION_PROFILE_SUPPORT
                 originClass != PEGASUS_CLASSNAME_CIM_INDICATIONSERVICE &&
#endif
                 originClass != PEGASUS_CLASSNAME_PG_OBJECTMANAGER ))
        {
            //
            // Search the cached conformingElements list for the originClass,
            // returning false if it is not found
            //
            bool found = false;

            PEGASUS_ASSERT(conformingElements.size() ==
                           elementNamespaces.size());
            for(Uint32 i = 0, n = conformingElements.size(); i < n; ++i)
            {
                CIMNameArray & elementList = conformingElements[i];
                CIMNamespaceArray & namespaceList = elementNamespaces[i];
                PEGASUS_ASSERT(elementList.size() == namespaceList.size());
                for(Uint32 j = 0, m = elementList.size(); j < m; ++j)
                {
                    CIMName & curElement = elementList[j];
                    if((curElement == originClass ||
                            curElement.getString().find(PEGASUS_DYNAMIC) == 0) &&
                            opNamespace == namespaceList[j])
                    {
                        found = true;
                        break;
                    }
                }
                if(found)
                    break;
            }

            if(!found)
            {
                PEG_METHOD_EXIT();
                return false;
            }
        }
    }
    else
    {
        // Otherwise, just get the enum value representing the origin class
        // for this operation
        originClassEnum = translateClassInput(originClass);
    }

    CIMName expectedTargetRole;
    CIMName expectedOriginRole;

    Array<CIMName> propNames;
    String profileName;
    CIMPropertyList propertyList;
    CIMInstance tmpInstance;
    Uint32 index;
    propNames.clear();

    //
    // Set the target and origin role values. Note that if these values are
    // not set following the switch block, that implies that the origin class
    // is not valid for the supplied association class.
    //
    switch(assocClassEnum)
    {
    case PG_NAMESPACEINMANAGER:
        if(originClassEnum == PG_OBJECTMANAGER)
        {
            expectedTargetRole = PROPERTY_DEPENDENT;
            expectedOriginRole = PROPERTY_ANTECEDENT;
        }
        else if(originClassEnum == PG_NAMESPACE)
        {
//.........这里部分代码省略.........
开发者ID:deleisha,项目名称:neopegasus,代码行数:101,代码来源:InteropProvider.cpp

示例2: _test2

static void
_test2 (CIMClient & client)
{
  Uint32 exceptions = 0;
  CIMObjectPath instanceName;
  Array < CIMKeyBinding > keyBindings;

  keyBindings.append (CIMKeyBinding ("ElementNameName",
                                     "TestCMPI_ExecQuery",
                                     CIMKeyBinding::STRING));

  instanceName.setNameSpace (providerNamespace);
  instanceName.setClassName ("TestCMPI_ExecQuery");
  instanceName.setKeyBindings (keyBindings);

  /* Call the unsupported functions of the provider. */
  try
  {
    CIMInstance instance (client.getInstance (providerNamespace,
                                              instanceName));
  } catch (const CIMException &)
  {
     exceptions ++;
  }


  try
  {
    client.deleteInstance (providerNamespace, instanceName);

  } catch (const CIMException & )
  {
     exceptions ++;
  }
  CIMClass thisClass = client.getClass(
                           providerNamespace,
                           "TestCMPI_ExecQuery",
                           false,
                           true,
                           true,
                           CIMPropertyList());
  Array<CIMName> propertyNameList;
  propertyNameList.append(CIMName("ElementName"));
  CIMPropertyList myPropertyList(propertyNameList);
  // create the instance with the defined properties
  CIMInstance newInstance = thisClass.buildInstance(true, true, myPropertyList);
  newInstance.getProperty(0).setValue(CIMValue(String("TestCMPI_execQuery") ));
  try
  {

    CIMObjectPath objectPath (client.createInstance (providerNamespace,
                                                     newInstance));


  } catch (const CIMException &)
  {
     exceptions ++;
  }

  try
  {
    client.modifyInstance (providerNamespace, newInstance);

  } catch (const CIMException &)
  {
     exceptions ++;
  }
  try
  {

    Array < CIMInstance > instances =
      client.enumerateInstances (providerNamespace,
                                 CIMName ("TestCMPI_ExecQuery"));
  } catch (const CIMException &)
  {
     exceptions ++;
  }

  try
  {
    Array < CIMObjectPath > objectPaths =
      client.enumerateInstanceNames (providerNamespace,
                                     CIMName ("TestCMPI_ExecQuery"));
  } catch (const CIMException &)
  {
     exceptions ++;
  }

  PEGASUS_TEST_ASSERT(exceptions ==  6);

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

示例3: _test4

void _test4(CIMClient & client)
{
    static const String NAMESPACE("test/TestProvider");
    static const String CLASSNAME("cmpiPerf_TestClassA");
    Array<CIMObjectPath> cimInstanceNames =
    client.enumerateInstanceNames(
        NAMESPACE,
        CLASSNAME);
    cout<<"+++++++++empty property list filtered output++++++"<<endl;
    {
        Array<CIMName> propNames;
        for (Uint32 i = 0, n = cimInstanceNames.size(); i < n; i++)
        {
            CIMInstance cimInstance=client.getInstance(
                NAMESPACE,
                cimInstanceNames[i],
                true,
                false,
                false,
                CIMPropertyList(propNames));
            if (verbose)
            {
                XmlWriter::printInstanceElement(cimInstance);
            }
            Uint32 propertyCount = cimInstance.getPropertyCount();
            if(propertyCount == 0)
            {
                cout<<"Filter getInstance test on "
                    <<"cmpiPerf_TestClassA SUCCEEDED :Filtering "
                    <<"the ciminstance with a empty property list "
                    <<"returned zero properties as expected"<<endl;
            }
            else
            {
                cout<<"Filter getInstance test on cmpiPerf_TestClassA"
                    <<" FAILED:Filtering the ciminstance with a empty "
                    <<"property list returned some properties "
                    <<"which is not expected"<<endl;
                PEGASUS_TEST_ASSERT(false);
            } 
        }
    }
    cout<<"+++++++++wrong property list filtered output++++++"<<endl;
    {
        Array<CIMName> propNames;
        propNames.append(CIMName(String("theK")));
        for (Uint32 i = 0, n = cimInstanceNames.size(); i < n; i++)
        {
            CIMInstance cimInstance=client.getInstance(
                NAMESPACE,
                cimInstanceNames[i],
                true,
                false,
                false,
                CIMPropertyList(propNames));
            if (verbose)
            {
                XmlWriter::printInstanceElement(cimInstance);
            }
            Uint32 propertyCount = cimInstance.getPropertyCount();
            if(propertyCount == 0)
            {
                cout<<"Filter getInstance test on "
                    <<"cmpiPerf_TestClassA SUCCEEDED :Filtering "
                    <<"the ciminstance with a wrong property list "
                    <<"returned zero properties as expected"<<endl;
            }
            else
            {
                cout<<"Filter getInstance test on cmpiPerf_TestClassA"
                    <<" FAILED:Filtering the ciminstance with a wrong "
                    <<"property list returned some properties "
                    <<"which is not expected"<<endl;
                PEGASUS_TEST_ASSERT(false);
            }
        }
    }
    cout<<"+++++++++NULL property list filtered output++++++"<<endl;
    {
        for (Uint32 i = 0, n = cimInstanceNames.size(); i < n; i++)
        {
            CIMInstance cimInstance=client.getInstance(
                NAMESPACE,
                cimInstanceNames[i],
                true,
                false,
                false,
                CIMPropertyList());
            if (verbose)
            {
                XmlWriter::printInstanceElement(cimInstance);
            }
            Uint32 propertyCount = cimInstance.getPropertyCount();
            if(propertyCount == 24)
            {
                cout<<"Filter getInstance test on "
                    <<"cmpiPerf_TestClassA SUCCEEDED :Filtering "
                    <<"the ciminstance with a NULL property list "
                    <<"returned all properties as expected"<<endl;
            }
//.........这里部分代码省略.........
开发者ID:brunolauze,项目名称:pegasus,代码行数:101,代码来源:TestCMPIInstanceExecQuery.cpp

示例4: CIMNamespaceName

// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
//==============================================================================
//
// Author: Lyle Wilkinson, Hewlett-Packard Company <[email protected]>
//
// Modified By:
//
//%/////////////////////////////////////////////////////////////////////////////

#include "IPInfo.h"

PEGASUS_USING_PEGASUS;
PEGASUS_USING_STD;

static const CIMName          CLASS_NAME = CIMName          ("PG_IPRoute");
static const CIMNamespaceName NAMESPACE  = CIMNamespaceName ("root/cimv2");
#define HeaderFormat "%-16s %-10s %-16s %-16s %-16s"


////////////////////////////////////////////////////////////////////////////////
//  Constructor for IP Route Info
////////////////////////////////////////////////////////////////////////////////
IPRouteInfo::IPRouteInfo(CIMClient &client, Boolean enableDebug,
                  ostream& outPrintWriter, ostream& errPrintWriter)
{
    _enableDebug = enableDebug;

    try
    {
        Boolean deepInheritance = true;
开发者ID:ncultra,项目名称:Pegasus-2.5,代码行数:31,代码来源:IPRoute.cpp

示例5: test01

void test01()
{
    NameSpaceManager nsm;

    _nameSpaceNames.append(CIMNamespaceName("aa"));
    _nameSpaceNames.append(CIMNamespaceName("aa/bb"));
    _nameSpaceNames.append(CIMNamespaceName("aa/bb/cc"));
    _nameSpaceNames.append(CIMNamespaceName("/lmnop/qrstuv"));
    _nameSpaceNames.append(CIMNamespaceName("root"));
    _nameSpaceNames.append(CIMNamespaceName("xx"));
    _nameSpaceNames.append(CIMNamespaceName("xx/yy"));

    for (Uint32 j = 0; j < _nameSpaceNames.size(); j++)
    {
        // NOTE: The "root" namespace is created by CIMRepository, which is not
        // used by this test program.  So the "root" namespace is not expected
        // to be created automatically in this case.
        //if (!_nameSpaceNames[j].equal(CIMNamespaceName("root")))
        {
            // Create a namespace
            nsm.createNameSpace(_nameSpaceNames[j], true, true, String::EMPTY);
        }
    }

    Array<CIMNamespaceName> nameSpaceNames;
    nsm.getNameSpaceNames(nameSpaceNames);
    if (verbose)
        nsm.print(cout);
    PEGASUS_TEST_ASSERT(nameSpaceNames.size() == NUM_NAMESPACE_NAMES);
    BubbleSort(nameSpaceNames);

    for (Uint32 i = 0; i < NUM_NAMESPACE_NAMES; i++)
    {
        PEGASUS_TEST_ASSERT(_nameSpaceNames[i] == nameSpaceNames[i]);
        PEGASUS_TEST_ASSERT(nsm.nameSpaceExists(nameSpaceNames[i]));
    }

    nsm.deleteNameSpace(CIMNamespaceName("lmnop/qrstuv"));
    nsm.getNameSpaceNames(nameSpaceNames);
    PEGASUS_TEST_ASSERT(nameSpaceNames.size() == NUM_NAMESPACE_NAMES - 1);

    // Create and delete a class to test these functions
    nsm.createClass(CIMNamespaceName("aa/bb"), "MySuperClass", CIMName());
    nsm.createClass(CIMNamespaceName("aa/bb"), "MyClass", "MySuperClass");
    PEGASUS_TEST_ASSERT(
        nsm.getSuperClassName(CIMNamespaceName("aa/bb"), "MySuperClass") ==
        CIMName());
    PEGASUS_TEST_ASSERT(
        nsm.getSuperClassName(CIMNamespaceName("aa/bb"), "MyClass") ==
        "MySuperClass");
    nsm.deleteClass(CIMNamespaceName("aa/bb"), "MyClass");
    nsm.deleteClass(CIMNamespaceName("aa/bb"), "MySuperClass");

    for (Uint32 j = 0; j < _nameSpaceNames.size(); j++)
    {
        if (!_nameSpaceNames[j].equal(CIMNamespaceName("root")) &&
            !_nameSpaceNames[j].equal(CIMNamespaceName("lmnop/qrstuv")))
        {
            nsm.deleteNameSpace(CIMNamespaceName(_nameSpaceNames[j]));
        }
    }
    nsm.getNameSpaceNames(nameSpaceNames);
    // Only the root namespace should be left.
    PEGASUS_TEST_ASSERT(nameSpaceNames.size() == 1);
    PEGASUS_TEST_ASSERT(nameSpaceNames[0].equal(CIMNamespaceName("root")));
    // confirm we can delete root
    nsm.deleteNameSpace(nameSpaceNames[0]);
    nsm.getNameSpaceNames(nameSpaceNames);
    PEGASUS_TEST_ASSERT(nameSpaceNames.size() == 0);
}
开发者ID:brunolauze,项目名称:pegasus,代码行数:70,代码来源:NameSpaceManager.cpp

示例6: CIMNamespaceName

//

#include "RUEpProvider.h"

PEGASUS_USING_STD;
PEGASUS_USING_PEGASUS;

//********************************************************
//  Constants
//********************************************************

// Namespace name
static const CIMNamespaceName NAMESPACE = CIMNamespaceName("root/cimv2");

// Class names
static const CIMName CLASS_CIM_PROTOCOL_ENDPOINT = CIMName(
    "CIM_ProtocolEndpoint");
static const CIMName CLASS_CIM_NEXT_HOP_ROUTE = CIMName("CIM_NextHopRoute");
static const CIMName CLASS_PG_ROUTE_USES_ENDPOINT = CIMName(
    "PG_RouteUsesEndpoint");

// Property names.
static const CIMName PROPERTY_INSTANCE_ID = CIMName("InstanceID");
static const CIMName PROPERTY_DESTINATION_ADDRESS = CIMName(
    "DestinationAddress");
static const CIMName PROPERTY_DESTINATION_MASK = CIMName("DestinationMask");
static const CIMName PROPERTY_PREFIX_LENGTH = CIMName("PrefixLength");
static const CIMName PROPERTY_SUBNET_MASK = CIMName("SubnetMask");
static const CIMName PROPERTY_ADDRESS_TYPE = CIMName("AddressType");
static const CIMName PROPERTY_PROTOCOL_IF_TYPE = CIMName("ProtocolIFType");
static const CIMName PROPERTY_IPV4ADDRESS = CIMName("IPv4Address");
static const CIMName PROPERTY_IPV6ADDRESS = CIMName("IPv6Address");
开发者ID:deleisha,项目名称:neopegasus,代码行数:32,代码来源:RUEpProvider.cpp

示例7: CIMInstance

CIMInstance UNIX_BGPServiceAttributes::getPartComponent() const
{
	return CIMInstance(CIMName("CIM_Component"));
}
开发者ID:brunolauze,项目名称:openpegasus-providers-old,代码行数:4,代码来源:UNIX_BGPServiceAttributes_ZOS.hpp

示例8: main

int main()
{
    cout << "Starting Server Profile Tests" << endl << endl;
    // Create a locally-connected client
    CIMClient client;

    try
    {
        client.connectLocal();
        client.setTimeout(60000); // Set the timeout to one minute
    }
    catch(Exception &)
    {
        exitFailure(String("Could not connect to server"));
    }

    CIMName currentClass;
    try
    {
        currentClass = CIMName("CIM_ComputerSystem");
        testInstanceClass(client, currentClass);
        currentClass = CIMName("CIM_ObjectManager");
        testInstanceClass(client, currentClass);
        currentClass = CIMName("CIM_RegisteredSubProfile");
        testInstanceClass(client, currentClass);
        currentClass = CIMName("CIM_RegisteredProfile");
        testInstanceClass(client, currentClass);
        currentClass = CIMName("CIM_CIMXMLCommunicationMechanism");
        testInstanceClass(client, currentClass);
        currentClass = CIMName("CIM_Namespace");
        testInstanceClass(client, currentClass);
        currentClass = CIMName("CIM_SoftwareIdentity");
        testInstanceClass(client, currentClass);

        currentClass = CIMName("CIM_HostedService");
        testAssociationClass(client, currentClass);
        currentClass = CIMName("CIM_ElementConformsToProfile");
        testAssociationClass(client, currentClass);
        currentClass = CIMName("CIM_SubprofileRequiresProfile");
        testAssociationClass(client, currentClass);
        currentClass = CIMName("CIM_ReferencedProfile");
        testAssociationClass(client, currentClass);
        currentClass = CIMName("CIM_ElementSoftwareIdentity");
        testAssociationClass(client, currentClass);
        currentClass = CIMName("CIM_CommMechanismForManager");
        testAssociationClass(client, currentClass);
    }
    catch(Exception & e)
    {
        exitFailure(String("Caught exception while testing class ") +
            currentClass.getString() + String(": ") + e.getMessage());
    }
    catch(...)
    {
        exitFailure(String("Caught unknown exception while testing class ") +
            currentClass.getString());
    }

    testDMTFProfileInstances(client);
#ifdef PEGASUS_ENABLE_DMTF_INDICATION_PROFILE_SUPPORT
    testIndicationProfileInstances(client);
#endif
    //testAssociationTraversal(client);

    cout << endl << "Server Profile Tests complete" << endl;
    return 0;
}
开发者ID:brunolauze,项目名称:pegasus,代码行数:67,代码来源:ServerProfile.cpp

示例9: CIMNamespaceName

#include <Pegasus/Common/Config.h>
#include <Pegasus/Common/Constants.h>
#include <Pegasus/Common/System.h>
#include <Pegasus/Common/FileSystem.h>
#include <Pegasus/Common/InternalException.h>
#include <Pegasus/Client/CIMClient.h>
#include <Pegasus/Common/XmlWriter.h>

#include <iostream>

PEGASUS_USING_PEGASUS;
PEGASUS_USING_STD;

const CIMNamespaceName SOURCE_NAMESPACE = CIMNamespaceName(
                                              "root/SampleProvider");
const CIMName SAMPLE_CLASSNAME  = CIMName("CWS_PlainFile");

Array<CIMObjectPath> objectNames;
CIMInstance instance;
CIMValue value;

static Boolean verbose;

void _enumerateInstanceNames(CIMClient & client)
{
    try
    {
        objectNames = client.enumerateInstanceNames(
                                 SOURCE_NAMESPACE,
                                 SAMPLE_CLASSNAME);
        if (verbose)
开发者ID:rdobson,项目名称:openpegasus,代码行数:31,代码来源:TestCMPIProperty.cpp

示例10: CIMNotSupportedException

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

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

    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("uniqueId", 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();

    // If there is at least one subscription active for the lifecycle indication
    // InstCreation_for_Sample_LifecycleIndicationProviderClass, then generate
    // that indication here, embedding the newly-created instance as
    // the SourceInstance property. See LifecycleIndicationProviderR.mof.
    if (_lifecycle_indications_enabled)
    {
        CIMInstance indicationInstance(
            CIMName(
                "InstCreation_for_Sample_LifecycleIndicationProviderClass"));
        CIMObjectPath path;
        path.setNameSpace("root/SampleProvider");
        path.setClassName(
            "InstCreation_for_Sample_LifecycleIndicationProviderClass");
        indicationInstance.setPath(path);

        char buffer[32];
        sprintf(buffer, "%d", _nextUID++);
        indicationInstance.addProperty
            (CIMProperty ("IndicationIdentifier",String(buffer)));

        CIMDateTime currentDateTime = CIMDateTime::getCurrentDateTime ();
        indicationInstance.addProperty
            (CIMProperty ("IndicationTime", currentDateTime));

        indicationInstance.addProperty
            (CIMProperty ("SourceInstance",CIMObject(cimInstance)));

        _indication_handler->deliver (indicationInstance);

//      cout << "LifecycleIndicationProvider::createInstance() sent "
//                  "InstCreation_for_Sample_LifecycleIndicationProviderClass"
//           << endl;
    }
}
开发者ID:brunolauze,项目名称:pegasus,代码行数:94,代码来源:LifecycleIndicationProvider.cpp

示例11: CIMObjectPath

void LifecycleIndicationProvider::deleteInstance(
    const OperationContext & context,
    const CIMObjectPath & instanceReference,
    ResponseHandler & handler)
{
//  cout << "LifecycleIndicationProvider::deleteInstance()" << endl;
    CIMInstance localInstance;
    // 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())
        {
            localInstance = _instances[i];
            // remove instance from the array
            _instances.remove(i);

            break;
        }
    }

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

    // If there is at least one subscription active for the lifecycle indication
    // InstDeletion_for_Sample_LifecycleIndicationProviderClass, then generate
    // that indication here, embedding the just-deleted instance as the
    // SourceInstance property. See LifecycleIndicationProviderR.mof.
    if (_lifecycle_indications_enabled)
    {
        CIMInstance indicationInstance(
            CIMName(
                "InstDeletion_for_Sample_LifecycleIndicationProviderClass"));
        CIMObjectPath path;
        path.setNameSpace("root/SampleProvider");
        path.setClassName(
            "InstDeletion_for_Sample_LifecycleIndicationProviderClass");
        indicationInstance.setPath(path);

        char buffer[32];
        sprintf(buffer, "%d", _nextUID++);
        indicationInstance.addProperty
            (CIMProperty ("IndicationIdentifier",String(buffer)));

        CIMDateTime currentDateTime = CIMDateTime::getCurrentDateTime ();
        indicationInstance.addProperty
            (CIMProperty ("IndicationTime", currentDateTime));

        // Before we send the Lifecycle Indication for the delete of this
        // instance, change the "lastOp" property value to "deleteInstance".
        Uint32 ix = localInstance.findProperty(CIMName("lastOp"));
        if (ix != PEG_NOT_FOUND)
        {
            localInstance.removeProperty(ix);
            localInstance.addProperty(
                CIMProperty(
                    CIMName("lastOp"),
                    String("deleteInstance")));
        }

        indicationInstance.addProperty
            (CIMProperty ("SourceInstance",CIMObject(localInstance)));

        _indication_handler->deliver (indicationInstance);

//      cout << "LifecycleIndicationProvider::deleteInstance() sent "
//                  "InstDeletion_for_Sample_LifecycleIndicationProviderClass"
//           << endl;
    }
}
开发者ID:brunolauze,项目名称:pegasus,代码行数:81,代码来源:LifecycleIndicationProvider.cpp

示例12: Test01

void Test01(Uint32 mode)
{
    String repositoryRoot;
    const char* tmpDir = getenv ("PEGASUS_TMP");
    if (tmpDir == NULL)
    {
        repositoryRoot = ".";
    }
    else
    {
        repositoryRoot = tmpDir;
    }

    repositoryRoot.append("/repository");

    FileSystem::removeDirectoryHier(repositoryRoot);

    CIMRepository r (repositoryRoot, mode);

    // Create a namespace:

    const CIMNamespaceName NAMESPACE = CIMNamespaceName ("zzz");
    r.createNameSpace(NAMESPACE);

    // Create a qualifier (and read it back):

    CIMQualifierDecl q1(CIMName ("abstract"), false, CIMScope::CLASS);
    r.setQualifier(NAMESPACE, q1);

    CIMConstQualifierDecl q2 = r.getQualifier(NAMESPACE, CIMName ("abstract"));
    PEGASUS_TEST_ASSERT(q1.identical(q2));

    // Create two simple classes:

    CIMClass class1(CIMName ("Class1"));
    class1.addQualifier(
        CIMQualifier(CIMName ("abstract"), true, CIMFlavor::DEFAULTS));
    CIMClass class2(CIMName ("Class2"), CIMName ("Class1"));

    r.createClass(NAMESPACE, class1);
    r.createClass(NAMESPACE, class2);

    // Enumerate the class names:
    Array<CIMName> classNames =
        r.enumerateClassNames(NAMESPACE, CIMName(), true);

    BubbleSort(classNames);

    PEGASUS_TEST_ASSERT(classNames.size() == 2);
    PEGASUS_TEST_ASSERT(classNames[0] == "Class1");
    PEGASUS_TEST_ASSERT(classNames[1] == "Class2");

    // Get the classes and determine if they are identical with input

    CIMClass c1 = r.getClass(NAMESPACE, CIMName ("Class1"), true, true, false);
    CIMClass c2 = r.getClass(NAMESPACE, CIMName ("Class2"), true, true, false);

    PEGASUS_TEST_ASSERT(c1.identical(class1));
    PEGASUS_TEST_ASSERT(c1.identical(class1));

    Array<CIMClass> classes =
        r.enumerateClasses(NAMESPACE, CIMName (), true, true, true);

    // Attempt to delete Class1. It should fail since the class has
    // children.

    try
    {
        r.deleteClass(NAMESPACE, CIMName ("Class1"));
    }
    catch (CIMException& e)
    {
        PEGASUS_TEST_ASSERT(e.getCode() == CIM_ERR_CLASS_HAS_CHILDREN);
    }

    // Delete all classes created here:

    r.deleteClass(NAMESPACE, CIMName ("Class2"));
    r.deleteClass(NAMESPACE, CIMName ("Class1"));

    // Be sure the classes are really gone:

    try
    {
        CIMClass c1 = r.getClass(
            NAMESPACE, CIMName ("Class1"), true, true, true);
        PEGASUS_TEST_ASSERT(false);
    }
    catch (CIMException& e)
    {
        PEGASUS_TEST_ASSERT(e.getCode() == CIM_ERR_NOT_FOUND);
    }

    try
    {
        CIMClass c2 = r.getClass(
            NAMESPACE, CIMName ("Class2"), true, true, true);
        PEGASUS_TEST_ASSERT(false);
    }
    catch (CIMException& e)
//.........这里部分代码省略.........
开发者ID:brunolauze,项目名称:pegasus,代码行数:101,代码来源:ClassDeclRep.cpp

示例13: _testCMPIFilterOfAssociation

void _testCMPIFilterOfAssociation(CIMClient& client)
{
    try
    {
        Array<CIMObjectPath> personRefs;
        Uint32 numPersonInstances ;
        personRefs = 
            client.enumerateInstanceNames(providerNamespace,CMPI_TEST_PERSON);
        numPersonInstances = personRefs.size();
        CIMName resultClass;
        String role;
        String resultRole;
        cout<<"++++++++Filtering the NULL propery list+++"<<endl;
        for (Uint32 i = 0; i < numPersonInstances; ++i)
        {
            Array<CIMObject> resultObjects =
                client.associators(
                    providerNamespace,
                    personRefs[i],
                    CMPI_TEST_RACING,
                    resultClass,
                    role,
                    resultRole,
                    false,
                    false,
                    CIMPropertyList());
            Uint32 size = resultObjects.size();
            for(Uint32 j = 0;j<size;j++)
            {
                Uint32 propCount = resultObjects[j].getPropertyCount();
                Uint32 propNameCount = 0;
                if(propCount != 0)
                {
                    String propName=
                        resultObjects[j].getProperty(0).getName().getString();
                    if(verbose)
                    {
                        cout<<"Property Name of :"<<i<<":"<<propName<<endl;
                    }
                    if(propName == "vehiclename") 
                    {
                        propNameCount++;
                    }
                }
                if((size != 0)&&(propCount == 1) &&(propNameCount == 1))
                {
                    cout<<"Filter associator test on CMPI_TEST_RACING SUCCEEDED"
                        <<":Filtering the ciminstance with a NULL property list"
                        <<" returned all properties as expected"<<endl;
                }
                else
                {
                    cout<<"Filter associator test on CMPI_TEST_RACING FAILED"
                        <<":Filtering the ciminstance with a NULL property list"
                        <<" did not return all properties as expected"<<endl;
                    PEGASUS_TEST_ASSERT(false);
                }
            }

        }
        cout<<"++++++Filtering the empty propery list+++"<<endl;
        Array<CIMName> propList;
        for (Uint32 i = 0; i < numPersonInstances; ++i)
        {
            Array<CIMObject> resultObjects =
                client.associators(
                    providerNamespace,
                    personRefs[i],
                    CMPI_TEST_RACING,
                    resultClass,
                    role,
                    resultRole,
                    false,
                    false,
                    CIMPropertyList(propList));
            Uint32 size = resultObjects.size();
            for(Uint32 j = 0;j<size;j++)
            {
                Uint32 propCount = resultObjects[j].getPropertyCount();
                if((size != 0)&&(propCount == 0))
                {
                    cout<<"Filter associator test on CMPI_TEST_RACING SUCCEEDED"
                        <<":Filtering the ciminstance with a empty property "
                        <<"list returned zero properties as expected"<<endl;
                }
                else
                { 
                    cout<<"Filter associators test on CMPI_TEST_RACING FAILED"
                        <<":Filtering the ciminstance with a empty property "
                        <<"list returned some properties which is not expected"
                        <<endl; 
                    PEGASUS_TEST_ASSERT(false);
                }
            }
        }
        cout<<"+++filtering the wrong properties ++++++"<<endl;
        Array<CIMName> propList1;
        propList1.append(CIMName(String("nam")));
        for (Uint32 i = 0; i < numPersonInstances; ++i)
        {
//.........这里部分代码省略.........
开发者ID:brunolauze,项目名称:pegasus,代码行数:101,代码来源:cmpiAssociationTestClient.cpp

示例14: CIMName

// is considered a failure.  If there is a failure, an error message is
// displayed and the program terminates.

#include <Pegasus/Client/CIMClient.h>
#include <string.h>

#include <Pegasus/Provider/CMPI/cmpidt.h>
#include <Pegasus/Provider/CMPI/cmpift.h>
#include <Pegasus/Provider/CMPI/cmpimacs.h>
#include <Pegasus/Common/PegasusAssert.h>

PEGASUS_USING_STD;
PEGASUS_USING_PEGASUS;

CIMNamespaceName providerNamespace;
const CIMName CMPI_TEST_PERSON = CIMName ("CMPI_TEST_Person");
const CIMName CMPI_TEST_VEHICLE = CIMName ("CMPI_TEST_Vehicle");
const CIMName CMPI_TEST_RACING = CIMName ("CMPI_TEST_Racing");


Boolean verbose = false;

// exepected results - number of returned objects expected for each test

static const Uint32 resultArray_asso_P1[] = { 3, 3 };
static const Uint32 resultArray_asso_V1[] = { 3, 3 };
static const Uint32 resultArray_ref_P[] =   { 3, 3, 3, 3 };
static const Uint32 resultArray_ref_V[] =   { 3, 3, 3, 3 };

////////////////////////////////////////////////////////////////////////////
//  _errorExit
开发者ID:brunolauze,项目名称:pegasus,代码行数:31,代码来源:cmpiAssociationTestClient.cpp

示例15: main

int main(int argc, char** argv)
{
    verbose = getenv("PEGASUS_TEST_VERBOSE");
    String assocTablePath;
    const char* tmpDir = getenv ("PEGASUS_TMP");
    if (tmpDir == NULL)
    {
        assocTablePath = ".";
    }
    else
    {
        assocTablePath = tmpDir;
    }
    assocTablePath.append("/associations.tbl");

    //
    // create class association
    //
    AssocClassTable::append(
        assocTablePath,
	CIMName ("Lineage"),
	CIMName ("Person"),
	CIMName ("parent"),
	CIMName ("Person"),
	CIMName ("child"));

    //
    // delete class association 
    //
    AssocClassTable::deleteAssociation(
        assocTablePath,
        CIMName ("Lineage"));

    //
    // create instance association 
    //
    AssocInstTable::append(
        assocTablePath,
        "A.left=\"x.key=\\\"one\\\"\",right=\"y.key=\\\"two\\\"\"",
        CIMName ("A"),
        "X.key=\"one\"",
        CIMName ("X"),
        CIMName ("left"),
        "Y.key=\"two\"",
        CIMName ("Y"),
        CIMName ("right"));

    //
    // delete instance association 
    //
    AssocInstTable::deleteAssociation(
        assocTablePath,
        CIMObjectPath 
            ("A.left=\"x.key=\\\"one\\\"\",right=\"y.key=\\\"two\\\"\""));

    cout << argv[0] << " +++++ passed all tests" << endl;

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


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