本文整理汇总了C++中CIMObjectPath::getKeyBindings方法的典型用法代码示例。如果您正苦于以下问题:C++ CIMObjectPath::getKeyBindings方法的具体用法?C++ CIMObjectPath::getKeyBindings怎么用?C++ CIMObjectPath::getKeyBindings使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CIMObjectPath
的用法示例。
在下文中一共展示了CIMObjectPath::getKeyBindings方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: invokeMethod
void UNIX_BGPEndpointStatisticsProvider::invokeMethod(
const OperationContext& context,
const CIMObjectPath& objectReference,
const CIMName& methodName,
const Array<CIMParamValue>& inParameters,
MethodResultResponseHandler& handler)
{
if (!objectReference.getClassName().equal("UNIX_BGPEndpointStatistics") && !objectReference.getClassName().equal("CIM_BGPEndpointStatistics")) {
String classMessage;
classMessage.append("UNIX_BGPEndpointStatistics Provider");
classMessage.append (" does not support class ");
classMessage.append (objectReference.getClassName().getString());
throw CIMNotSupportedException(classMessage);
}
handler.processing();
// Make cimom handle invokeMethod request with input parameters.
CIMObjectPath localReference = CIMObjectPath(
String(""),
CIMNamespaceName("root/cimv2"),
objectReference.getClassName(),
objectReference.getKeyBindings());
if (methodName.equal("ResetSelectedStats")) {
if (inParameters.size() != 1)
{
throw new CIMOperationFailedException("Incorrect in parameters");
}
//Invoking ResetSelectedStats method.
Uint32 invokeResetSelectedStatsReturnValue;
Array<String> inSelectedStatistics;
for(Uint32 pi = 0; pi < inParameters.size(); pi++) {
CIMParamValue p = inParameters[pi];
if (String::equalNoCase(p.getParameterName(), "SelectedStatistics"))
{
p.getValue().get(inSelectedStatistics);
}
}
_p.initialize();
_p.find(localReference.getKeyBindings());
invokeResetSelectedStatsReturnValue = _p.invokeResetSelectedStats(
inSelectedStatistics
);
_p.finalize();
handler.deliver(invokeResetSelectedStatsReturnValue);
}
else {
String message;
message.append("UNIX_BGPEndpointStatistics");
message.append (" does not support invokeMethod");
throw CIMNotSupportedException(message);
}
}
示例2: modifyInstance
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();
}
示例3: _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;
}
}
}
}
示例4: _getKeyValue
void _getKeyValue (
const CIMObjectPath& instanceName,
CIMNamespaceName& childNamespaceName,
Boolean& isRelativeName)
{
Array<CIMKeyBinding> kbArray = instanceName.getKeyBindings();
if ((kbArray.size() == 1) &&
(kbArray[0].getName() == NAMESPACE_PROPERTYNAME))
{
String childNamespaceString = kbArray[0].getValue();
if (childNamespaceString != String::EMPTY)
{
childNamespaceName = childNamespaceString;
}
isRelativeName = !(childNamespaceName.isNull());
}
else
{
//l10n
//throw CIMInvalidParameterException("Invalid key property: ");
throw CIMInvalidParameterException(MessageLoaderParms(
"ControlProviders.NamespaceProvider.NamespaceProvider.INVALID_KEY_PROPERTY",
"Invalid key property: "));
}
}
示例5: deleteInstance
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();
}
示例6: getInstance
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();
}
示例7: 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;
}
示例8: logUpdateInstanceOperation
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 );
}
}
示例9: associatorNames
void RUEpProvider::associatorNames(
const OperationContext& context,
const CIMObjectPath& objectName,
const CIMName& associationClass,
const CIMName& resultClass,
const String& role,
const String& resultRole,
ObjectPathResponseHandler& handler)
{
// validate namespace
const CIMNamespaceName& nameSpace = objectName.getNameSpace();
if (!nameSpace.equal(NAMESPACE))
{
throw CIMNotSupportedException(
nameSpace.getString() + " not supported.");
}
// Build a host and namespace independent object path
CIMObjectPath localObjectPath = CIMObjectPath(
String(),
CIMNamespaceName(),
objectName.getClassName(),
objectName.getKeyBindings());
// begin processing the request
handler.processing();
if (associationClass == CLASS_PG_ROUTE_USES_ENDPOINT)
{
_associatorNames(
_AssociationInstances,
localObjectPath,
role,
resultClass,
resultRole,
handler);
}
else
{
throw CIMNotSupportedException(
associationClass.getString() + " is not supported");
}
// complete processing the request
handler.complete();
}
示例10: getProviderIndicationDataInstance
CIMInstance ProviderIndicationCountTable::getProviderIndicationDataInstance(
const CIMObjectPath& instanceName)
{
PEG_METHOD_ENTER(TRC_INDICATION_SERVICE,
"ProviderIndicationCountTable::getProviderIndicationDataInstance");
//
// Gets provider module name and provider name from the provider indication
// data instance object path
//
String providerModuleName;
String providerName;
Array<CIMKeyBinding> keys = instanceName.getKeyBindings();
for (Uint32 i = 0; i < keys.size(); i++)
{
if (keys[i].getName() == _PROPERTY_PROVIDERNAME)
{
providerName = keys[i].getValue();
}
else if (keys[i].getName() == _PROPERTY_PROVIDERMODULENAME)
{
providerModuleName = keys[i].getValue();
}
}
String providerKey = _generateKey(providerModuleName, providerName);
_ProviderIndicationCountTableEntry entry;
WriteLock lock(_tableLock);
if (_table.lookup(providerKey, entry))
{
CIMInstance providerIndDataInstance =
_buildProviderIndDataInstance(entry);
PEG_METHOD_EXIT();
return providerIndDataInstance;
}
PEG_METHOD_EXIT();
throw CIMObjectNotFoundException(instanceName.toString());
}
示例11: createInstance
void LargeDataProvider::createInstance(
const OperationContext & context,
const CIMObjectPath & instanceReference,
const CIMInstance & instanceObject,
ObjectPathResponseHandler & handler)
{
cout << "---------------------------------" << endl;
cout << "LargeDataProvider::createInstance" << 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());
// instance index corresponds to reference index
for(Uint32 i = 0, n = _instanceNames.size(); i < n; i++)
{
if(localReference == _instanceNames[i])
{
throw CIMObjectAlreadyExistsException(
localReference.toString());
}
}
// begin processing the request
handler.processing();
// add the new instance to the array
_instances.append(instanceObject);
_instanceNames.append(instanceReference);
// deliver the new instance
handler.deliver(_instanceNames[_instanceNames.size() - 1]);
// complete processing the request
handler.complete();
}
示例12: _validateKeys
/**
_validateKeys method of the NIS provider Test Client
*/
void NISTestClient::_validateKeys(
CIMObjectPath &cimRef,
Boolean verboseTest)
{
// don't have a try here - want it to be caught by caller
String keyVal;
CIMName keyName;
Array<CIMKeyBinding> keyBindings = cimRef.getKeyBindings();
if (verboseTest)
cout << "Retrieved " << keyBindings.size() << " keys" <<endl;
for (Uint32 j = 0; j < keyBindings.size(); j++)
{
keyName = keyBindings[j].getName();
keyVal = keyBindings[j].getValue();
if (verboseTest)
cout << "checking key " << keyName.getString() << endl;
if (keyName.equal("CreationClassName") &&
!goodCreationClassName(keyVal, verboseTest))
{
errorExit ("CreationClassName not PG_NISServerService");
}
else if (keyName.equal("Name") &&
!goodName(keyVal, verboseTest))
{
errorExit ("Name not correct");
}
else if (keyName.equal("SystemCreationClassName") &&
!goodSystemCreationClassName(keyVal, verboseTest))
{
errorExit ("SystemCreationClassName not correct");
}
else if (keyName.equal("SystemName") &&
!goodSystemName(keyVal, verboseTest))
{
errorExit ("SystemName not correct");
}
}
}
示例13: testFilterSystemName
/* SystemName key property should be set to fully qualified hostname
which is set on cimserver at startup to "hugo.bert" before this test case
is executed
*/
void testFilterSystemName(
CIMClient & client)
{
CIMInstance filter("CIM_IndicationFilter");
String query("SELECT * FROM CIM_ProcessIndication");
filter.addProperty(
CIMProperty(CIMName("Name"),String("Filter01")));
filter.addProperty(
CIMProperty(CIMName("SourceNamespace"),String("root/SampleProvider")));
filter.addProperty(
CIMProperty(CIMName("Query"), query));
filter.addProperty(
CIMProperty(CIMName("QueryLanguage"),String("WQL")));
CIMObjectPath path =
client.createInstance(PEGASUS_NAMESPACENAME_INTEROP, filter);
client.deleteInstance(PEGASUS_NAMESPACENAME_INTEROP, path);
// SystemName is fourth (=last) keybinding
Array<CIMKeyBinding> keys = path.getKeyBindings();
CIMKeyBinding sysName=keys[3];
if (verbose)
{
cout << "SystemName returned is: " << sysName.getValue() << endl;
}
Boolean result = String("hugo.bert") == sysName.getValue();
if(!result)
{
cout << "Test failed, Make sure that cimserver is started " \
"with \"hostname=hugo fullyQualifiedHostName=hugo.bert\"" \
<< endl;
}
PEGASUS_TEST_ASSERT(result);
}
示例14: getInstance
void benchmarkProvider::getInstance(
const OperationContext & context,
const CIMObjectPath & instanceReference,
const Boolean includeQualifiers,
const Boolean includeClassOrigin,
const CIMPropertyList & propertyList,
InstanceResponseHandler & handler)
{
CIMInstance _instance;
Uint32 numberOfProperties;
Uint32 sizeOfPropertyValue;
Uint32 numberOfInstances;
CIMName className = instanceReference.getClassName();
test.getConfiguration(className, numberOfProperties,
sizeOfPropertyValue, numberOfInstances);
Array<CIMKeyBinding> keyBindings = instanceReference.getKeyBindings();
if (keyBindings.size() != 1)
{
throw CIMException(CIM_ERR_NOT_SUPPORTED);
}
// begin processing the request
handler.processing();
Uint32 ID;
if (sscanf (keyBindings[0].getValue().getCString(), "%u", &ID) != 1)
{
throw CIMException (CIM_ERR_INVALID_PARAMETER);
}
_instance = _buildInstance(className, numberOfProperties,
sizeOfPropertyValue , CIMValue(ID));
handler.deliver(_instance);
// complete processing the request
handler.complete();
}
示例15: testEnumInstances
void testEnumInstances(CIMClient& client, const char* ns)
{
Array<CIMInstance> instances;
instances = client.enumerateInstances(ns,CIM_QUERYCAPCLASS_NAME);
if(instances.size() != 1) throw Exception("instances.size() incorrect");
Array<Uint16> providerReturnedVal;
//Array<Uint16> actualVal(NUM_QUERY_CAPABILITIES);
Uint32 prop = 0;
CIMObjectPath path;
path = instances[0].getPath();
Array<CIMKeyBinding> keys = path.getKeyBindings();
//-- make sure we're the right instance
CIMName keyName;
String keyValue;
if (keys.size() != NUM_KEY_PROPERTIES)
throw Exception("Wrong number of keys");
keyName = keys[0].getName();
keyValue = keys[0].getValue();
if(keyName.getString() != String(PROPERTY_NAME_INSTANCEID) )
throw Exception("Incorrect Key");
if(keyValue != String(INSTANCEID_VALUE))
throw Exception(keyValue);
prop = instances[0].findProperty(CIMName(PROPERTY_NAME_CQLFEATURES));
instances[0].getProperty(prop).getValue().get(providerReturnedVal);
_checkIfReturnedValueIsCorrect(providerReturnedVal);
}