本文整理汇总了C++中CIMObjectPath::setNameSpace方法的典型用法代码示例。如果您正苦于以下问题:C++ CIMObjectPath::setNameSpace方法的具体用法?C++ CIMObjectPath::setNameSpace怎么用?C++ CIMObjectPath::setNameSpace使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CIMObjectPath
的用法示例。
在下文中一共展示了CIMObjectPath::setNameSpace方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: 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);
}
示例2: CIMPropertyList
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;
}
示例3: _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);
}
示例4: _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;
}
示例5: _testElementCapabilityInstance
void _testElementCapabilityInstance(CIMClient &client)
{
cout << "Testing Association Class "
<< (const char *)PEGASUS_CLASSNAME_CIM_INDICATIONSERVICECAPABILITIES.
getString().getCString()
<< "...";
// Get CIM_IndicationServiceCapabilities instance names
Array<CIMObjectPath> capPaths = client.enumerateInstanceNames(
PEGASUS_NAMESPACENAME_INTEROP,
PEGASUS_CLASSNAME_CIM_INDICATIONSERVICECAPABILITIES);
PEGASUS_TEST_ASSERT(capPaths.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);
// Get PG_ElementCapabilities instances
Array<CIMInstance> eleInstances = client.enumerateInstances(
PEGASUS_NAMESPACENAME_INTEROP,
PEGASUS_CLASSNAME_PG_ELEMENTCAPABILITIES);
PEGASUS_TEST_ASSERT(eleInstances.size() == 1);
// Test PG_ElementCapabilities instance.
CIMValue capValue = eleInstances[0].getProperty(
eleInstances[0].findProperty("Capabilities")).getValue();
CIMValue meValue = eleInstances[0].getProperty(
eleInstances[0].findProperty("ManagedElement")).getValue();
// Now test the instance names of CIM_IndicationService instance and
// CIM_IndicationServiceCapabilities instance.
CIMObjectPath testPath;
capValue.get(testPath);
testPath.setNameSpace(CIMNamespaceName());
PEGASUS_TEST_ASSERT(testPath.identical(capPaths[0]));
meValue.get(testPath);
testPath.setNameSpace(CIMNamespaceName());
PEGASUS_TEST_ASSERT(testPath.identical(servicePaths[0]));
cout << "Test Complete" << endl;
}
示例6: mbReferenceNames
static CMPIEnumeration* mbReferenceNames(
const CMPIBroker *mb,
const CMPIContext *ctx,
const CMPIObjectPath *cop,
const char *resultClass,
const char *role,
CMPIStatus *rc)
{
PEG_METHOD_ENTER(
TRC_CMPIPROVIDERINTERFACE,
"CMPI_Broker:mbReferenceNames()");
mb = CM_BROKER;
// ATTN-CAKG-P2-20020726: The following condition does not correctly
// distinguish instanceNames from classNames in every case
// The instanceName of a singleton instance of a keyless class has no
// key bindings
if (!SCMO_ObjectPath(cop)->getKeyBindingCount())
{
CMSetStatus(rc, CMPI_RC_ERR_FAILED);
PEG_METHOD_EXIT();
return 0;
}
SCMOInstance* scmoObjPath = SCMO_ObjectPath(cop);
CIMObjectPath qop;
try
{
scmoObjPath->getCIMObjectPath(qop);
// For compatibility with previous implementations have empty ns
qop.setNameSpace(CIMNamespaceName());
CIMResponseData resData =
CM_CIMOM(mb)->referenceNames(
*CM_Context(ctx),
scmoObjPath->getNameSpace(),
qop,
resultClass ? CIMName(resultClass) : CIMName(),
role ? String(role) : String::EMPTY);
// Add the namespace from the input parameters when neccessary
resData.completeNamespace(scmoObjPath);
Array<SCMOInstance>* aRef =
new Array<SCMOInstance>(resData.getSCMO());
CMPIEnumeration* cmpiEnum = reinterpret_cast<CMPIEnumeration*>(
new CMPI_Object(new CMPI_OpEnumeration(aRef)));
CMSetStatus(rc,CMPI_RC_OK);
PEG_METHOD_EXIT();
return cmpiEnum;
}
HandlerCatchSetStatus(rc, NULL);
// Code flow should never get here.
}
示例7: _createDuplicate
void _createDuplicate(CIMClient &client,
const String &filterHost,
const CIMNamespaceName &filterNameSpace,
CIMObjectPath &filterPath,
const String &handlerHost,
const CIMNamespaceName &handlerNameSpace,
CIMObjectPath &handlerPath)
{
Boolean exceptionCaught = false;
//
// Set Host and Namespace in filter CIMObjectPath
//
filterPath.setHost(filterHost);
filterPath.setNameSpace(filterNameSpace);
//
// Set Host and Namespace in handler CIMObjectPath
//
handlerPath.setHost (handlerHost);
handlerPath.setNameSpace (handlerNameSpace);
try
{
CreateSbscriptionInstance(client, handlerPath,
filterPath, PEGASUS_NAMESPACENAME_INTEROP);
}
catch (CIMException &e)
{
if (e.getCode() != CIM_ERR_ALREADY_EXISTS)
{
PEGASUS_TEST_ASSERT(0);
}
exceptionCaught = true;
}
PEGASUS_TEST_ASSERT(exceptionCaught);
}
示例8: test1
void test1 (CIMClient &client)
{
CIMObjectPath instanceName;
CIMValue output;
instanceName.setNameSpace (providerNamespace);
instanceName.setClassName (CLASSNAME);
Array < CIMParamValue > inParams;
Array < CIMParamValue > outParams;
CIMValue retValue = client.invokeMethod (providerNamespace,
instanceName,
"testBrokerServices",
inParams,
outParams);
_checkUint32Value (retValue, 1);
}
示例9: CreateSbscriptionInstance
CIMObjectPath CreateSbscriptionInstance (CIMClient& client,
const CIMObjectPath handlerRef,
const CIMObjectPath filterRef,
const CIMNamespaceName & subscriptionNS)
{
CIMInstance subscriptionInstance
(PEGASUS_CLASSNAME_INDSUBSCRIPTION);
subscriptionInstance.addProperty(CIMProperty(CIMName ("Filter"),
filterRef, 0, PEGASUS_CLASSNAME_INDFILTER));
subscriptionInstance.addProperty(CIMProperty(CIMName ("Handler"),
handlerRef, 0, PEGASUS_CLASSNAME_INDHANDLER_CIMXML));
subscriptionInstance.addProperty (CIMProperty
(CIMName ("SubscriptionState"), CIMValue ((Uint16) 2)));
CIMObjectPath Ref = client.createInstance(subscriptionNS,
subscriptionInstance);
Ref.setNameSpace (subscriptionNS);
return (Ref);
}
示例10: _checkSubscriptionCount
void _checkSubscriptionCount(CIMClient &client)
{
CIMObjectPath path;
path.setNameSpace("test/TestProvider");
path.setClassName("Test_IndicationProviderClass");
Array<CIMParamValue> inParams;
Array<CIMParamValue> outParams;
CIMValue ret_value = client.invokeMethod(
"test/TestProvider",
path,
"GetSubscriptionCount",
inParams,
outParams);
Uint32 n;
ret_value.get(n);
PEGASUS_TEST_ASSERT( n == 1);
}
示例11: CreateHandler1Instance
CIMObjectPath CreateHandler1Instance (CIMClient& client,
const CIMNamespaceName & handlerNS)
{
CIMInstance handlerInstance(PEGASUS_CLASSNAME_INDHANDLER_CIMXML);
handlerInstance.addProperty(CIMProperty (CIMName("SystemCreationClassName"),
System::getSystemCreationClassName()));
handlerInstance.addProperty(CIMProperty(CIMName ("SystemName"),
System::getFullyQualifiedHostName()));
handlerInstance.addProperty(CIMProperty(CIMName ("CreationClassName"),
PEGASUS_CLASSNAME_INDHANDLER_CIMXML.getString()));
handlerInstance.addProperty(CIMProperty(CIMName ("Name"),
String("Handler1")));
handlerInstance.addProperty(CIMProperty(CIMName ("Destination"),
String("localhost/CIMListener/Pegasus_SimpleDisplayConsumer")));
CIMObjectPath Ref = client.createInstance(handlerNS, handlerInstance);
Ref.setNameSpace (handlerNS);
return (Ref);
}
示例12: generateIndication
void generateIndication(CIMClient& client)
{
CIMInstance indicationInstance(CIMName("Test_IndicationProviderClass"));
CIMObjectPath path ;
path.setNameSpace("test/TestProvider");
path.setClassName("Test_IndicationProviderClass");
indicationInstance.setPath(path);
Array<CIMParamValue> inParams;
Array<CIMParamValue> outParams;
CIMValue ret_value = client.invokeMethod(
"test/TestProvider",
path,
"SendTestIndication",
inParams,
outParams);
}
示例13: CIMNamespaceName
CIMObjectPath _buildFilterOrHandlerPath
(const CIMName & className,
const String & name,
const CIMNamespaceName & namespaceName = CIMNamespaceName ())
{
CIMObjectPath path;
Array <CIMKeyBinding> keyBindings;
keyBindings.append (CIMKeyBinding ("SystemCreationClassName",
System::getSystemCreationClassName (), CIMKeyBinding::STRING));
keyBindings.append (CIMKeyBinding ("SystemName",
System::getFullyQualifiedHostName (), CIMKeyBinding::STRING));
keyBindings.append (CIMKeyBinding ("CreationClassName",
className.getString(), CIMKeyBinding::STRING));
keyBindings.append (CIMKeyBinding ("Name", name, CIMKeyBinding::STRING));
path.setClassName (className);
path.setKeyBindings (keyBindings);
path.setNameSpace (namespaceName);
return path;
}
示例14: _generateIndication
void _generateIndication (
IndicationResponseHandler * handler,
const String & identifier)
{
if (_enabled)
{
CIMInstance indicationInstance (CIMName ("FailureTestIndication"));
CIMObjectPath path;
path.setNameSpace ("test/testProvider");
path.setClassName ("FailureTestIndication");
indicationInstance.setPath (path);
indicationInstance.addProperty
(CIMProperty ("IndicationIdentifier", identifier));
CIMDateTime currentDateTime = CIMDateTime::getCurrentDateTime ();
indicationInstance.addProperty
(CIMProperty ("IndicationTime", currentDateTime));
Array <String> correlatedIndications;
indicationInstance.addProperty
(CIMProperty ("CorrelatedIndications", correlatedIndications));
indicationInstance.addProperty
(CIMProperty ("Description", String ("Failure Test Indication")));
indicationInstance.addProperty
(CIMProperty ("AlertingManagedElement",
System::getFullyQualifiedHostName ()));
indicationInstance.addProperty
(CIMProperty ("AlertingElementFormat", Uint16 (0)));
indicationInstance.addProperty
(CIMProperty ("AlertType", Uint16 (1)));
indicationInstance.addProperty
(CIMProperty ("OtherAlertType", String ("Test")));
indicationInstance.addProperty
(CIMProperty ("PerceivedSeverity", Uint16 (2)));
indicationInstance.addProperty
(CIMProperty ("ProbableCause", Uint16 (1)));
indicationInstance.addProperty
(CIMProperty ("ProbableCauseDescription", String ("Test")));
indicationInstance.addProperty
(CIMProperty ("Trending", Uint16 (4)));
Array <String> recommendedActions;
recommendedActions.append ("Test");
indicationInstance.addProperty
(CIMProperty ("RecommendedActions", recommendedActions));
indicationInstance.addProperty
(CIMProperty ("EventID", String ("Test")));
CIMDateTime eventTime = CIMDateTime::getCurrentDateTime ();
indicationInstance.addProperty
(CIMProperty ("EventTime", eventTime));
indicationInstance.addProperty
(CIMProperty ("SystemCreationClassName",
System::getSystemCreationClassName ()));
indicationInstance.addProperty
(CIMProperty ("SystemName",
System::getFullyQualifiedHostName ()));
indicationInstance.addProperty
(CIMProperty ("ProviderName", _providerName));
CIMIndication cimIndication (indicationInstance);
handler->deliver (cimIndication);
}
}
示例15: TestCreateInstances
void TestCreateInstances(CIMClient& client)
{
//
// Test create Provider module instances
//
CIMObjectPath returnRef;
CIMClass cimClass(CLASSNAME);
CIMInstance cimInstance(CLASSNAME);
cimInstance.addProperty(CIMProperty(CIMName ("Name"),
String("providersModule1")));
cimInstance.addProperty(CIMProperty(CIMName ("Vendor"), String("HP")));
cimInstance.addProperty(CIMProperty(CIMName ("Version"), String("2.0")));
cimInstance.addProperty(CIMProperty(CIMName ("InterfaceType"),
String("C++Default")));
cimInstance.addProperty(CIMProperty(CIMName ("InterfaceVersion"),
String("2.1.0")));
cimInstance.addProperty(CIMProperty(CIMName ("Location"),
String("/tmp/module1")));
CIMObjectPath instanceName = cimInstance.buildPath(cimClass);
instanceName.setNameSpace(PEGASUS_NAMESPACENAME_INTEROP);
instanceName.setClassName(CLASSNAME);
try
{
returnRef = client.createInstance(PEGASUS_NAMESPACENAME_INTEROP, cimInstance);
}
catch(const CIMException&)
{
throw;
}
// Test create PG_Provider instances
CIMObjectPath returnRef2;
CIMClass cimClass2(CLASSNAME2);
CIMInstance cimInstance2(CLASSNAME2);
cimInstance2.addProperty(CIMProperty(CIMName ("ProviderModuleName"),
String("providersModule1")));
cimInstance2.addProperty(CIMProperty(CIMName ("Name"),
String("PG_ProviderInstance1")));
CIMObjectPath instanceName2 = cimInstance2.buildPath(cimClass2);
instanceName2.setNameSpace(PEGASUS_NAMESPACENAME_INTEROP);
instanceName2.setClassName(CLASSNAME2);
try
{
returnRef2 = client.createInstance(PEGASUS_NAMESPACENAME_INTEROP, cimInstance2);
}
catch(const CIMException&)
{
throw;
}
//
// test create provider capability instances
//
Array <String> namespaces;
Array <Uint16> providerType;
Array <String> supportedMethods;
Array <String> supportedProperties;
namespaces.append("root/cimv2");
namespaces.append("root/cimv3");
providerType.append(4);
providerType.append(5);
supportedMethods.append("test_method1");
supportedMethods.append("test_method2");
supportedProperties.append("PkgStatus");
supportedProperties.append("PkgIndex");
CIMObjectPath returnRef3;
CIMClass cimClass3(CLASSNAME3);
CIMInstance cimInstance3(CLASSNAME3);
cimInstance3.addProperty(CIMProperty(CIMName ("ProviderModuleName"),
String("providersModule1")));
cimInstance3.addProperty(CIMProperty(CIMName ("ProviderName"),
String("PG_ProviderInstance1")));
cimInstance3.addProperty(CIMProperty(CIMName ("CapabilityID"),
String("capability1")));
cimInstance3.addProperty(CIMProperty(CIMName ("ClassName"),
String("TestSoftwarePkg")));
cimInstance3.addProperty(CIMProperty(CIMName ("Namespaces"), namespaces));
cimInstance3.addProperty(CIMProperty(CIMName ("ProviderType"),
//.........这里部分代码省略.........