本文整理汇总了C++中CIMException函数的典型用法代码示例。如果您正苦于以下问题:C++ CIMException函数的具体用法?C++ CIMException怎么用?C++ CIMException使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了CIMException函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: CIMException
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();
}
开发者ID:rdobson,项目名称:openpegasus,代码行数:29,代码来源:PG_TestPropertyTypes.cpp
示例2: _enumerateInstanceNames
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();
}
开发者ID:rdobson,项目名称:openpegasus,代码行数:35,代码来源:PG_TestPropertyTypes.cpp
示例3: PEG_METHOD_ENTER
//async request handler method invoked on a seperate thread per provider
//through the async request executor.
CIMException DefaultProviderManager::_asyncRequestCallback(
void *callbackPtr,
AsyncRequestExecutor::AsyncRequestMsg* request)
{
PEG_METHOD_ENTER(TRC_PROVIDERMANAGER,
"DefaultProviderManager::_asyncRequestCallback");
CIMException responseException;
//extract the parameters
UnloadProviderRequest* my_request =
dynamic_cast<UnloadProviderRequest*>(request);
if(my_request != NULL)
{
PEGASUS_ASSERT(0 != callbackPtr);
DefaultProviderManager *dpmPtr =
static_cast<DefaultProviderManager*>(callbackPtr);
ProviderMessageHandler* provider =
dynamic_cast<ProviderMessageHandler*>(my_request->_provider);
try
{
AutoMutex lock(provider->status.getStatusMutex());
//unload the provider
if (provider->status.isInitialized())
{
dpmPtr->_unloadProvider(provider);
}
else
{
PEGASUS_ASSERT(0);
}
}
catch (CIMException& e)
{
PEG_TRACE((TRC_PROVIDERMANAGER, Tracer::LEVEL1,"CIMException: %s",
(const char*)e.getMessage().getCString()));
responseException = e;
}
catch (Exception& e)
{
PEG_TRACE((TRC_PROVIDERMANAGER, Tracer::LEVEL1,"Exception: %s",
(const char*)e.getMessage().getCString()));
responseException = CIMException(CIM_ERR_FAILED, e.getMessage());
}
catch (PEGASUS_STD(exception)& e)
{
responseException = CIMException(CIM_ERR_FAILED, e.what());
}
catch (...)
{
PEG_TRACE_CSTRING(TRC_PROVIDERMANAGER, Tracer::LEVEL1,
"Exception: Unknown");
responseException = PEGASUS_CIM_EXCEPTION(
CIM_ERR_FAILED, "Unknown error.");
}
}
开发者ID:brunolauze,项目名称:pegasus,代码行数:60,代码来源:DefaultProviderManager.cpp
示例4: _Check
void CIMError::setInstance(const CIMInstance& instance)
{
for (Uint32 i = 0; i < instance.getPropertyCount(); i++)
{
CIMConstProperty p = instance.getProperty(i);
_Check("ErrorType", p, (Uint16*)0);
_Check("OtherErrorType", p, (String*)0);
_Check("OwningEntity", p, (String*)0);
_Check("MessageID", p, (String*)0);
_Check("Message", p, (String*)0);
_Check("MessageArguments", p, (Array<String>*)0);
_Check("PerceivedSeverity", p, (Uint16*)0);
_Check("ProbableCause", p, (Uint16*)0);
_Check("ProbableCauseDescription", p, (String*)0);
_Check("RecommendedActions", p, (Array<String>*)0);
_Check("ErrorSource", p, (String*)0);
_Check("ErrorSourceFormat", p, (Uint16*)0);
_Check("OtherErrorSourceFormat", p, (String*)0);
_Check("CIMStatusCode", p, (Uint32*)0);
_Check("CIMStatusCodeDescription", p, (String*)0);
}
// Verify that the instance contains all of the required properties.
for (Uint32 i = 0; i < _numRequiredProperties; i++)
{
// Does inst have this property?
Uint32 pos = instance.findProperty(_requiredProperties[i]);
if (pos == PEG_NOT_FOUND)
{
char buffer[80];
sprintf(buffer, "required property does not exist: %s",
_requiredProperties[i]);
throw CIMException(CIM_ERR_NO_SUCH_PROPERTY, buffer);
}
// is required property non-null?
CIMConstProperty p = instance.getProperty(pos);
CIMValue v = p.getValue();
if (v.isNull())
{
char buffer[80];
sprintf(buffer, "required property MUST NOT be Null: %s",
_requiredProperties[i]);
throw CIMException(CIM_ERR_FAILED, buffer);
}
}
_inst = instance;
}
开发者ID:xenserver,项目名称:openpegasus,代码行数:51,代码来源:CIMError.cpp
示例5: PEG_METHOD_ENTER
/////////////////////////////////////////////////////////////////////////////
// WMIInstanceProvider::getProperty
//
// ///////////////////////////////////////////////////////////////////////////
CIMValue WMIInstanceProvider::getProperty(
const String& nameSpace,
const String& userName,
const String& password,
const CIMObjectPath& instanceName,
const String& propertyName)
{
CIMInstance cimInstance;
Array<CIMName> propertyNames;
PEG_METHOD_ENTER(TRC_WMIPROVIDER,"WMIInstanceProvider::getProperty()");
setup(nameSpace,userName,password);
if (!m_bInitialized)
{
throw CIMException(CIM_ERR_FAILED, "[getProperty] m_bInitialized");
}
CIMName propName = propertyName;
propertyNames.append(propName);
CIMPropertyList propertyList = CIMPropertyList(propertyNames);
// get the relevant CIMInstance object
cimInstance = getCIMInstance(nameSpace,
userName,
password,
instanceName,
propertyList);
// now fetch the property
Uint32 pos = cimInstance.findProperty(propName);
if (PEG_NOT_FOUND == pos)
{
throw CIMException(CIM_ERR_NO_SUCH_PROPERTY,
"[getProperty] findproperty");
}
CIMProperty property = cimInstance.getProperty(pos);
// and return the value
CIMValue value = property.getValue();
PEG_METHOD_EXIT();
return value;
}
开发者ID:rdobson,项目名称:openpegasus,代码行数:55,代码来源:WMIInstanceProvider.cpp
示例6: CIMException
void TestFaultyInstanceProvider::deleteInstance(
const OperationContext& context,
const CIMObjectPath& instanceReference,
ResponseHandler& handler)
{
throw CIMException(CIM_ERR_NOT_SUPPORTED);
}
开发者ID:brunolauze,项目名称:pegasus,代码行数:7,代码来源:TestFaultyInstanceProvider.cpp
示例7: _parseFile
static void _parseFile(const char* fileName, Boolean hideEmptyTags)
{
// cout << "Parsing: " << fileName << endl;
Buffer text;
FileSystem::loadFileToMemory(text, fileName);
XmlParser parser((char*)text.getData(), 0, hideEmptyTags);
XmlEntry entry;
// Get initial comment and ignore
parser.next(entry, true);
// get next comment, check for file Description
parser.next(entry, true);
if (!String::equal(entry.text, "Test XML file") )
{
throw CIMException(CIM_ERR_FAILED, "Comment Error");
}
PEGASUS_ASSERT (parser.getLine () == 2);
PEGASUS_ASSERT (parser.getStackSize () == 0);
// Put the Comment back...
parser.putBack (entry);
PEGASUS_ASSERT (parser.getLine () == 2);
PEGASUS_ASSERT (parser.getStackSize () == 0);
while (parser.next(entry))
{
if (verbose)
{
entry.print();
}
}
PEGASUS_ASSERT (parser.next (entry, true) == false);
}
开发者ID:rdobson,项目名称:openpegasus,代码行数:34,代码来源:XmlParser.cpp
示例8: ClientCIMOMHandleAccessController
ClientCIMOMHandleAccessController(Mutex& lock)
: _lock(lock)
{
try
{
// assume default client timeout
if (!_lock.timed_lock(PEGASUS_DEFAULT_CLIENT_TIMEOUT_MILLISECONDS))
{
throw CIMException(CIM_ERR_ACCESS_DENIED, MessageLoaderParms(
"Provider.CIMOMHandle.CIMOMHANDLE_TIMEOUT",
"Timeout waiting for CIMOMHandle"));
}
}
catch (Exception& e)
{
PEG_TRACE((TRC_CIMOM_HANDLE, Tracer::LEVEL2,
"Unexpected Exception: %s",
(const char*)e.getMessage().getCString()));
throw;
}
catch (...)
{
PEG_TRACE_CSTRING(TRC_CIMOM_HANDLE, Tracer::LEVEL2,
"Unexpected exception");
throw;
}
}
开发者ID:rdobson,项目名称:openpegasus,代码行数:27,代码来源:ClientCIMOMHandleRep.cpp
示例9: CIMException
void benchmarkProvider::createInstance(
const OperationContext & context,
const CIMObjectPath & instanceReference,
const CIMInstance & instanceObject,
ObjectPathResponseHandler & handler)
{
throw CIMException(CIM_ERR_NOT_SUPPORTED);
}
开发者ID:host1812,项目名称:scx_plugin_public,代码行数:8,代码来源:benchmarkProvider.cpp
示例10: CIMException
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;
}
开发者ID:brunolauze,项目名称:pegasus,代码行数:56,代码来源:ObjectNormalizer.cpp
示例11: _throw
static void _throw(CIMStatusCode code, const char* format, ...)
{
char buffer[4096];
va_list ap;
va_start(ap, format);
vsprintf(buffer, format, ap);
va_end(ap);
throw CIMException(code, format);
}
开发者ID:host1812,项目名称:scx_plugin_public,代码行数:10,代码来源:cimmofMRR.cpp
示例12: _processQualifier
CIMQualifier _processQualifier(
CIMConstQualifier& referenceQualifier,
CIMConstQualifier& cimQualifier)
{
// check name
if (!referenceQualifier.getName().equal(cimQualifier.getName()))
{
MessageLoaderParms message(
"Common.ObjectNormalizer.INVALID_QUALIFIER_NAME",
"Invalid qualifier name: $0",
cimQualifier.getName().getString());
throw CIMException(CIM_ERR_FAILED, message);
}
// check type
if (referenceQualifier.getType() != cimQualifier.getType())
{
MessageLoaderParms message(
"Common.ObjectNormalizer.INVALID_QUALIFIER_TYPE",
"Invalid qualifier type: $0",
cimQualifier.getName().getString());
throw CIMException(CIM_ERR_FAILED, message);
}
CIMQualifier normalizedQualifier(
referenceQualifier.getName(),
referenceQualifier.getValue(), // default value
referenceQualifier.getFlavor(),
referenceQualifier.getPropagated() == 0 ? false : true);
// TODO: check override
// update value
if (!cimQualifier.getValue().isNull())
{
normalizedQualifier.setValue(cimQualifier.getValue());
}
return normalizedQualifier;
}
开发者ID:brunolauze,项目名称:pegasus,代码行数:42,代码来源:ObjectNormalizer.cpp
示例13: String
/////////////////////////////////////////////////////////////////////////////
// WMIInstanceProvider::getHostName
//
// ///////////////////////////////////////////////////////////////////////////
String WMIInstanceProvider::getHostName()
{
DWORD nSize = 255;
char hostName[256];
// Get the computer name
if(GetComputerName(hostName, &nSize))
return String(hostName);
throw CIMException(CIM_ERR_FAILED);
}
开发者ID:rdobson,项目名称:openpegasus,代码行数:15,代码来源:WMIInstanceProvider.cpp
示例14: message
void AssociatorsResponseHandler::deliver(const SCMOInstance& scmoObject)
{
if (scmoObject.isUninitialized())
{
MessageLoaderParms message(
"Common.Exception.UNINITIALIZED_OBJECT_EXCEPTION",
"The object is not initialized.");
throw CIMException(CIM_ERR_FAILED, message);
}
SimpleObjectResponseHandler::deliver(scmoObject);
}
开发者ID:deleisha,项目名称:neopegasus,代码行数:12,代码来源:OperationResponseHandler.cpp
示例15: CIMException
/**
TBD?
*/
void EmbeddedInstanceProvider::modifyInstance(
const OperationContext& context,
const CIMObjectPath& ref,
const CIMInstance& obj,
const Boolean includeQualifiers,
const CIMPropertyList& propertyList,
ResponseHandler& handler)
{
throw CIMException(CIM_ERR_NOT_SUPPORTED);
// handler.processing();
// handler.complete();
}
开发者ID:brunolauze,项目名称:pegasus,代码行数:15,代码来源:EmbeddedInstanceProvider.cpp
注:本文中的CIMException函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论