本文整理汇总了C++中CIMObjectPath::getNameSpace方法的典型用法代码示例。如果您正苦于以下问题:C++ CIMObjectPath::getNameSpace方法的具体用法?C++ CIMObjectPath::getNameSpace怎么用?C++ CIMObjectPath::getNameSpace使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CIMObjectPath
的用法示例。
在下文中一共展示了CIMObjectPath::getNameSpace方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: 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;
}
示例2: _testServiceAffectsElementInstances
void _testServiceAffectsElementInstances(CIMClient &client)
{
cout << "Testing Association Class "
<< (const char *)PEGASUS_CLASSNAME_PG_SERVICEAFFECTSELEMENT.
getString().getCString()
<< "...";
// Get PG_ServiceAffectsElement instances.
Array<CIMInstance> sfInstances = client.enumerateInstances(
PEGASUS_NAMESPACENAME_INTEROP,
PEGASUS_CLASSNAME_PG_SERVICEAFFECTSELEMENT);
// Get PG_ServiceAffectsElement instance names
Array<CIMObjectPath> sfPaths = client.enumerateInstanceNames(
PEGASUS_NAMESPACENAME_INTEROP,
PEGASUS_CLASSNAME_PG_SERVICEAFFECTSELEMENT);
PEGASUS_TEST_ASSERT(sfInstances.size() == sfPaths.size());
// Get CIM_IndicationFilter instance names
Array<CIMObjectPath> filterPaths = client.enumerateInstanceNames(
PEGASUS_NAMESPACENAME_INTEROP,
PEGASUS_CLASSNAME_INDFILTER);
// Get CIM_ListenerDestination instance names
Array<CIMObjectPath> handlerPaths = client.enumerateInstanceNames(
PEGASUS_NAMESPACENAME_INTEROP,
PEGASUS_CLASSNAME_LSTNRDST);
// Count only handlers and filters from interop namespace
Uint32 elements = 0;
for (Uint32 i = 0; i < sfInstances.size() ; ++i)
{
CIMValue value = sfInstances[i].getProperty(
sfInstances[i].findProperty("AffectedElement")).getValue();
CIMObjectPath path;
value.get(path);
PEGASUS_TEST_ASSERT(path.getNameSpace() != CIMNamespaceName());
if (path.getNameSpace() == PEGASUS_NAMESPACENAME_INTEROP)
{
elements++;
}
}
PEGASUS_TEST_ASSERT(
elements == (filterPaths.size() + handlerPaths.size()));
cout << "Test Complete" << endl;
}
示例3: 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();
}
示例4: enumerateInstanceNames
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;
}
示例5: enumerateInstanceNames
void PG_TestPropertyTypes::enumerateInstanceNames(
const OperationContext& context,
const CIMObjectPath& classReference,
ObjectPathResponseHandler& handler)
{
// ensure the Namespace is valid
if (!classReference.getNameSpace().equal ("test/static"))
{
throw CIMException(CIM_ERR_INVALID_NAMESPACE);
}
// ensure the class existing in the specified namespace
if (!classReference.getClassName().equal ("PG_TestPropertyTypes"))
{
throw CIMException(CIM_ERR_INVALID_CLASS);
}
// begin processing the request
handler.processing();
Array<CIMObjectPath> instanceNames;
instanceNames = _enumerateInstanceNames(context, classReference);
handler.deliver(instanceNames);
// complete processing the request
handler.complete();
}
示例6: enumerateInstances
void PG_TestPropertyTypes::enumerateInstances(
const OperationContext& context,
const CIMObjectPath& ref,
const Boolean includeQualifiers,
const Boolean includeClassOrigin,
const CIMPropertyList& propertyList,
InstanceResponseHandler& handler)
{
// ensure the Namespace is valid
if (!ref.getNameSpace().equal ("test/static"))
{
throw CIMException(CIM_ERR_INVALID_NAMESPACE);
}
// ensure the class existing in the specified namespace
if (!ref.getClassName().equal ("PG_TestPropertyTypes"))
{
throw CIMException(CIM_ERR_INVALID_CLASS);
}
// begin processing the request
handler.processing();
// NOTE: It would be much more efficient to remember the instance names
// get class definition from repository
CIMClass cimclass = _cimom.getClass(
context,
ref.getNameSpace(),
ref.getClassName(),
false,
true,
true,
CIMPropertyList());
for (Uint32 i = 0; i < _instances.size(); i++)
{
handler.deliver(_instances[i]);
}
// complete processing the request
handler.complete();
}
示例7:
ProviderName::ProviderName(
const CIMObjectPath & path,
const Uint32 capabilities,
const CIMName & method)
: _capabilities(capabilities)
{
_nameSpace = path.getNameSpace();
_className = path.getClassName();
_method = method;
}
示例8: modifyInstance
void PG_TestPropertyTypes::modifyInstance(
const OperationContext& context,
const CIMObjectPath& instanceReference,
const CIMInstance& instanceObject,
const Boolean includeQualifiers,
const CIMPropertyList& propertyList,
ResponseHandler& handler)
{
// This provider only allows partial instance modification for the
// PropertyUint8 property.
if (!(propertyList.isNull() ||
((propertyList.size() == 1) &&
(propertyList[0].equal("PropertyUint8")))))
{
throw CIMException(CIM_ERR_NOT_SUPPORTED);
}
// 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 property values are valid
_testPropertyTypesValue(instanceObject);
// ensure the request 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 nothing here since we like to have static result
// complete processing the request
handler.complete();
}
示例9: invokeMethod
PEGASUS_NAMESPACE_BEGIN
/*
ATTN: This method provider is used by ProviderRegistrationProvider to
update InteropProvider Cache. If SLP is enabled we invoke SLPProvider's
'update' method to update registrations in this method. Note that
'updateCache' method is not defined as part of class
PG_ProviderProfileCapabilities. This method is used purely for internal
purpose for the communication between InteropProvider and
ProviderRegistrationProvider.
*/
void InteropProvider::invokeMethod(
const OperationContext & context,
const CIMObjectPath & objectReference,
const CIMName & methodName,
const Array<CIMParamValue> & inParameters,
MethodResultResponseHandler & handler)
{
if(objectReference.getNameSpace().equal (PEGASUS_NAMESPACENAME_INTEROP)
&& objectReference.getClassName().equal(
PEGASUS_CLASSNAME_PG_PROVIDERPROFILECAPABILITIES)
&& methodName.equal("updateCache"))
{
handler.processing();
#ifdef PEGASUS_ENABLE_SLP
sendUpdateRegMessageToSLPProvider(context);
#endif
updateProfileCache++;
handler.complete();
}
else
{
throw PEGASUS_CIM_EXCEPTION(CIM_ERR_NOT_SUPPORTED,
objectReference.getNameSpace().getString());
}
}
示例10: CIMInstancePathtoXML
//////////////////////////////////////////////////////////////////////////////
// This isn't used. If we ever need it we can uncomment it.
// void CIMLocalClassPathtoXML(CIMObjectPath const& cop, ostream& ostr)
// {
// if (!cop.isClassPath())
// {
// OW_THROWCIMMSG(CIMException::INVALID_PARAMETER, "cop is an instance path, not a class path as expected.");
// }
//
// if (!cop.getNameSpace().empty())
// {
// // do <LOCALCLASSPATH>
// ostr << "<LOCALCLASSPATH>";
// CIMtoXML(cop.getFullNameSpace(),ostr,CIMtoXMLFlags::doLocal);
// ostr << "<CLASSNAME NAME=\"" << cop.getObjectName() << "\"/></LOCALCLASSPATH>";
// }
// else
// {
// // do <CLASSNAME>
// ostr << "<CLASSNAME NAME=\"" << cop.getObjectName() << "\"/>";
// }
// }
/////////////////////////////////////////////////////////////
// void
// CIMClassPathtoXML(CIMObjectPath const& cop, std::ostream& ostr)
// {
// if (!cop.isClassPath())
// {
// OW_THROWCIMMSG(CIMException::INVALID_PARAMETER, "cop is an instance path, not a class path as expected.");
// }
//
// ostr << "<CLASSPATH>";
// CIMtoXML(cop.getFullNameSpace(), ostr, CIMtoXMLFlags::dontDoLocal);
//
// ostr << "<CLASSNAME NAME=\"";
// ostr << cop.getObjectName() << "\">";
//
// ostr << "</CLASSNAME>";
//
// ostr << "</CLASSPATH>\n";
// }
//////////////////////////////////////////////////////////////////////////////
void CIMInstancePathtoXML(CIMObjectPath const& cop, ostream& ostr)
{
//
// Instance path
//
bool outputInstancePath = !cop.getNameSpace().empty();
if (outputInstancePath)
{
ostr << "<INSTANCEPATH>";
CIMNameSpacetoXML(cop.getFullNameSpace(), ostr);
}
CIMInstanceNametoXML(cop, ostr);
if (outputInstancePath)
{
ostr << "</INSTANCEPATH>";
}
}
示例11: 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();
}
示例12: testSomething
void OW_BinarySerializationTestCases::testSomething()
{
StringArray cmd;
cmd.push_back("/bin/cat");
CIMObjectPath origCop("ClassName", "ns");
PopenStreams rval = OpenWBEM::Exec::safePopen(cmd);
IOIFCStreamBuffer stdinbuf(rval.in().getPtr(), 256, "out");
IOIFCStreamBuffer stdoutbuf(rval.out().getPtr(), 256, "in");
ostream stdinstr(&stdinbuf);
istream stdoutstr(&stdoutbuf);
OpenWBEM::BinarySerialization::writeObjectPath(stdinstr, origCop);
stdinstr.flush();
rval.in()->close();
CIMObjectPath newCop = OpenWBEM::BinarySerialization::readObjectPath(stdoutstr);
unitAssert(rval.getExitStatus() == 0);
unitAssert(newCop.getClassName() == "ClassName");
unitAssert(newCop.getNameSpace() == "ns");
}
示例13: _inject_object_path
static void _inject_object_path(
CIMInstance& instance,
const CIMObjectPath& objectPath,
const char* tag)
{
Array<CIMKeyBinding> bindings;
bindings.append(CIMKeyBinding("Tag", tag, CIMKeyBinding::STRING));
bindings.append(CIMKeyBinding(
"CreationClassName", "Benchmark2", CIMKeyBinding::STRING));
instance.setPath(CIMObjectPath(
objectPath.getHost(),
objectPath.getNameSpace(),
"Benchmark2",
bindings));
}
示例14: valueToXML
static void valueToXML(CIMObjectPath const& x, ostream& out)
{
if (x.getFullNameSpace().isLocal())
{
if (x.getNameSpace().empty())
{
CIMInstanceNametoXML(x, out);
}
else
{
CIMLocalInstancePathtoXML(x, out);
}
}
else
{
CIMInstancePathtoXML(x, out);
}
}
示例15: CIMClassPathtoXML
void CIMClassPathtoXML(CIMObjectPath const& cop, ostream& ostr)
{
if (!cop.isClassPath())
{
OW_THROWCIMMSG(CIMException::INVALID_PARAMETER, "cop is an instance path, not a class path as expected.");
}
if (!cop.getNameSpace().empty())
{
// do <CLASSPATH>
ostr << "<CLASSPATH>";
CIMNameSpacetoXML(cop.getFullNameSpace(),ostr);
ostr << "<CLASSNAME NAME=\"" << cop.getClassName() << "\"/></CLASSPATH>";
}
else
{
// do <CLASSNAME>
ostr << "<CLASSNAME NAME=\"" << cop.getClassName() << "\"/>";
}
}