本文整理汇总了C++中CIMObjectPath::getClassName方法的典型用法代码示例。如果您正苦于以下问题:C++ CIMObjectPath::getClassName方法的具体用法?C++ CIMObjectPath::getClassName怎么用?C++ CIMObjectPath::getClassName使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CIMObjectPath
的用法示例。
在下文中一共展示了CIMObjectPath::getClassName方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: 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();
}
示例2: getInstance
void TimingProvider::getInstance(
const OperationContext & context,
const CIMObjectPath & instanceReference,
const Boolean includeQualifiers,
const Boolean includeClassOrigin,
const CIMPropertyList & propertyList,
InstanceResponseHandler & 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());
CIMName className = instanceReference.getClassName();
// 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();
}
示例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: enumerateInstanceNames
/**
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();
}
示例5: 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);
}
}
示例6: processClassObjectPath
CIMObjectPath ObjectNormalizer::processClassObjectPath(
const CIMObjectPath& cimObjectPath) const
{
// pre-check
if (!_enableNormalization || _cimClass.isUninitialized())
{
// do nothing
return cimObjectPath;
}
/*
// ATTN: moving similar logic to the response handlers because this
// type of error should be checked regardless with or without
// normalization enabled.
if (cimObjectPath.getClassName().isNull())
{
throw CIMException(CIM_ERR_FAILED, "uninitialized object path");
}
*/
/*
// ATTN: The following code is currently redundant because the CIMName
// object validates legal names when it is constructed. It is included
// here for completeness.
// check class name
if (!CIMName(cimObjectPath.getClassName()).legal())
{
MessageLoaderParms message(
"Common.ObjectNormalizer.INVALID_CLASS_NAME",
"Invalid class name: $0",
cimObjectPath.getClassName().getString());
throw CIMException(CIM_ERR_FAILED, message);
}
*/
// check class type
if (!_cimClass.getClassName().equal(cimObjectPath.getClassName()))
{
MessageLoaderParms message(
"Common.ObjectNormalizer.INVALID_CLASS_TYPE",
"Invalid class type: $0",
cimObjectPath.getClassName().getString());
throw CIMException(CIM_ERR_FAILED, message);
}
CIMObjectPath normalizedObjectPath(
_cimClass.getPath().getHost(),
_cimClass.getPath().getNameSpace(),
_cimClass.getClassName());
// ignore any keys, they are not part of a class object path
return normalizedObjectPath;
}
示例7: testEnumerateInstances
/*
testEnumerateInstances of the NIS provider.
*/
void NISTestClient::testEnumerateInstances(
CIMClient &client,
Boolean verboseTest)
{
try
{
Boolean deepInheritance = true;
Boolean localOnly = true;
Boolean includeQualifiers = false;
Boolean includeClassOrigin = false;
Uint32 numberInstances;
testLog("NIS Provider Test EnumerateInstances");
Array<CIMInstance> cimNInstances = client.enumerateInstances(
NAMESPACE,
CLASS_NAME,
deepInheritance,
localOnly,
includeQualifiers,
includeClassOrigin);
numberInstances = cimNInstances.size();
if (verboseTest)
cout << numberInstances << " instances of PG_NISServerService" <<
endl;
for (Uint32 i = 0; i < cimNInstances.size(); i++)
{
CIMObjectPath instanceRef = cimNInstances[i].getPath ();
if (verboseTest)
cout << "Instance ClassName is " <<
instanceRef.getClassName().getString() << endl;
if(!instanceRef.getClassName().equal(CLASS_NAME))
{
errorExit("EnumInstances failed");
}
// now validate the properties
_validateProperties(cimNInstances[i], verboseTest);
} // end for looping through instances
testLog("NIS Provider Test EnumInstances Passed");
}
catch(Exception& e)
{
errorExit(e.getMessage());
}
}
示例8: enumerateInstanceNames
void TimingProvider::enumerateInstanceNames(
const OperationContext & context,
const CIMObjectPath & classReference,
ObjectPathResponseHandler & handler)
{
// begin processing the request
handler.processing();
cout <<"TimingProvider::enumerateInstanceNames" << endl;
CIMName clName = classReference.getClassName();
sleep(10);
if (clName == "TimeOne")
{
for(Uint32 i = 0, n = _instances.size(); i < n; i++)
// deliver reference
handler.deliver(_instanceNames[i]);
}
else if (clName == "TimeTwo")
{
for(Uint32 i = 0, n = _instances_2.size(); i < n; i++)
// deliver reference
handler.deliver(_instanceNames_2[i]);
}
// complete processing the request
cout <<"TimingProvider::enumerateInstanceNames" << endl;
handler.complete();
}
示例9: enumerateInstanceNames
void benchmarkProvider::enumerateInstanceNames(
const OperationContext & context,
const CIMObjectPath & classReference,
ObjectPathResponseHandler & handler)
{
CIMObjectPath _instanceName;
Uint32 numberOfProperties;
Uint32 sizeOfPropertyValue;
Uint32 numberOfInstances;
CIMName className = classReference.getClassName();
test.getConfiguration(className, numberOfProperties,
sizeOfPropertyValue, numberOfInstances);
// begin processing the request
handler.processing();
for (Uint32 i = 1; i <= numberOfInstances; i++)
{
_instanceName = _buildObjectPath(className,
CIMKeyBinding(CIMName("Identifier"), CIMValue(i)));
handler.deliver(_instanceName);
}
// complete processing the request
handler.complete();
}
示例10: 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>";
}
示例11: getSelectPropertyList
const CIMPropertyList WQLSelectStatementRep::getSelectPropertyList(
const CIMObjectPath& inClassName) const
{
//
// Check for "*"
//
if (_allProperties)
{
//
// Return null CIMPropertyList for all properties
//
return CIMPropertyList ();
}
CIMName className = inClassName.getClassName();
if (className.isNull())
{
//
// If the caller passed in an empty className, then the FROM class is
// to be used
//
className = _className;
}
//
// Check if inClassName is the FROM class
//
if (!(className == _className))
{
//
// Check for NULL Query Context
//
if (_ctx == NULL)
{
MessageLoaderParms parms
("WQL.WQLSelectStatementRep.QUERY_CONTEXT_IS_NULL",
"Trying to process a query with a NULL Query Context.");
throw QueryRuntimeException(parms);
}
//
// Check if inClassName is a subclass of the FROM class
//
if (!_ctx->isSubClass(_className,className))
{
MessageLoaderParms parms
("WQL.WQLSelectStatementRep.CLASS_NOT_FROM_LIST_CLASS",
"Class $0 does not match the FROM class or any of its "
"subclasses.",
className.getString());
throw QueryRuntimeException(parms);
}
}
//
// Return CIMPropertyList for properties referenced in the projection
// list (SELECT clause)
//
return CIMPropertyList (_selectPropertyNames);
}
示例12: 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;
}
示例13: 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();
}
示例14: 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();
}
示例15: 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();
}