本文整理汇总了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();
}
示例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();
}
示例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;
}
示例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();
}
示例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();
}
示例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 );
}
}
示例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;
}
}
}
}
示例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");
}
示例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>";
}
示例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);
}
示例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);
}
示例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();
}
示例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;
}
示例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;
}
示例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();
}