本文整理汇总了C++中OperationContext::contains方法的典型用法代码示例。如果您正苦于以下问题:C++ OperationContext::contains方法的具体用法?C++ OperationContext::contains怎么用?C++ OperationContext::contains使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类OperationContext
的用法示例。
在下文中一共展示了OperationContext::contains方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: deliver
void EnableIndicationsResponseHandler::deliver(
const OperationContext& context,
const CIMIndication& cimIndication)
{
if (cimIndication.isUninitialized())
{
MessageLoaderParms message(
"Common.Exception.UNINITIALIZED_OBJECT_EXCEPTION",
"The object is not initialized.");
throw CIMException(CIM_ERR_FAILED, message);
}
// ATTN: temporarily convert indication to instance
CIMInstance cimInstance(cimIndication);
// Get list of subscription instance names from context
Array<CIMObjectPath> subscriptionInstanceNames;
if (context.contains(SubscriptionInstanceNamesContainer::NAME))
{
SubscriptionInstanceNamesContainer container =
context.get(SubscriptionInstanceNamesContainer::NAME);
subscriptionInstanceNames = container.getInstanceNames();
}
else
{
subscriptionInstanceNames.clear();
}
ContentLanguageList contentLangs;
if (context.contains(ContentLanguageListContainer::NAME))
{
// Get the Content-Language for this indication. The provider
// does not have to add specify a language for the indication.
ContentLanguageListContainer langContainer =
context.get(ContentLanguageListContainer::NAME);
contentLangs = langContainer.getLanguages();
}
else
{
// The provider did not explicitly set a Content-Language for
// the indication. Fall back to the lang set in this object.
contentLangs = getLanguages();
}
Uint32 timeoutMilliSec = 0;
if (context.contains(TimeoutContainer::NAME))
{
TimeoutContainer timeoutContainer =
context.get(TimeoutContainer::NAME);
timeoutMilliSec = timeoutContainer.getTimeOut();
}
// create message
CIMProcessIndicationRequestMessage* request =
new CIMProcessIndicationRequestMessage(
XmlWriter::getNextMessageId(),
cimInstance.getPath().getNameSpace(),
cimInstance,
subscriptionInstanceNames,
_provider,
QueueIdStack(), // Must be filled in by the callback function
timeoutMilliSec);
request->operationContext = context;
if (request->operationContext.contains(ContentLanguageListContainer::NAME))
{
request->operationContext.set(
ContentLanguageListContainer(contentLangs));
}
else
{
request->operationContext.insert(
ContentLanguageListContainer(contentLangs));
}
_indicationCallback(request);
}
示例2: handleIndication
//.........这里部分代码省略.........
{
PEG_TRACE((TRC_DISCARDED_DATA, Tracer::LEVEL1,
"SNMP Version is not set for IndicationHandlerSNMPMapper %s"
" Indication.",
(const char*)(indication.getClassName().getString().
getCString())));
PEG_METHOD_EXIT();
throw PEGASUS_CIM_EXCEPTION_L(CIM_ERR_FAILED, MessageLoaderParms(
"Handler.snmpIndicationHandler.snmpIndicationHandler."
"INVALID_SNMP_INSTANCE",
"Invalid IndicationHandlerSNMPMapper instance"));
}
else
{
// properties from the handler instance
String targetHost;
String otherTargetHostFormat = String();
String securityName = String();
String engineID = String();
Uint16 targetHostFormat = 0;
Uint16 snmpVersion = 0;
Uint32 portNumber;
Uint8 snmpSecLevel = 1; // noAuthnoPriv
Uint8 snmpSecAuthProto = 0;
Array<Uint8> snmpSecAuthKey;// no key
Uint8 snmpSecPrivProto = 0;
Array<Uint8> snmpSecPrivKey ;// no key
String trapOid;
Boolean trapOidAvailable = false;
//
// Get snmpTrapOid from context
//
if (context.contains(SnmpTrapOidContainer::NAME))
{
SnmpTrapOidContainer trapContainer =
context.get(SnmpTrapOidContainer::NAME);
trapOid = trapContainer.getSnmpTrapOid();
trapOidAvailable = true;
}
else
{
// get trapOid from indication Class
Uint32 pos =
indicationClass.findQualifier(CIMName("MappingStrings"));
if (pos != PEG_NOT_FOUND)
{
Array<String> classMapStr;
indicationClass.getQualifier(pos).getValue().
get(classMapStr);
for (Uint32 i=0; i < classMapStr.size(); i++)
{
Uint32 barPos = classMapStr[i].find("|");
if (barPos != PEG_NOT_FOUND)
{
String authorityName =
classMapStr[i].subString(0, barPos);
String oidStr = classMapStr[i].subString(
barPos+1, PEG_NOT_FOUND);
_trimWhitespace(authorityName);
_trimWhitespace(oidStr);
示例3: ClientCIMOMHandleSetup
ClientCIMOMHandleSetup(
CIMClientRep*& client,
const OperationContext& context)
{
//
// Initialize the CIMClient object if necessary
//
if (client == 0)
{
PEG_TRACE_CSTRING(TRC_CIMOM_HANDLE, Tracer::LEVEL3,
"Creating CIMClient connection");
client = new CIMClientRep();
//
// If connection fails, we need to make sure that subsequent
// calls will try to connect again.
//
try
{
client->connectLocal();
}
catch(...)
{
delete client;
client = 0;
throw;
}
}
_client = client;
//
// If the caller specified a timeout value in the OperationContext,
// set it in the CIMClient object.
//
_origTimeout = client->getTimeout();
if (context.contains(TimeoutContainer::NAME))
{
TimeoutContainer t_cntr = (TimeoutContainer)
context.get(TimeoutContainer::NAME);
client->setTimeout(t_cntr.getTimeOut());
}
//
// If the caller specified an Accept-Language in the
// OperationContext, set it in the CIMClient object.
//
_origAcceptLanguages = client->getRequestAcceptLanguages();
if (context.contains(AcceptLanguageListContainer::NAME))
{
AcceptLanguageListContainer al_cntr = (AcceptLanguageListContainer)
context.get(AcceptLanguageListContainer::NAME);
_client->setRequestAcceptLanguages(al_cntr.getLanguages());
}
else
{
// No AcceptLanguageListContainer in OperationContext; try
// getting the AcceptLanguageList from the current thread
AcceptLanguageList* al = Thread::getLanguages();
if (al != NULL)
{
_client->setRequestAcceptLanguages(*al);
}
}
//
// If the caller specified a Content-Language in the
// OperationContext, set it in the CIMClient object.
//
_origContentLanguages = client->getRequestContentLanguages();
if (context.contains(ContentLanguageListContainer::NAME))
{
ContentLanguageListContainer cl_cntr =
(ContentLanguageListContainer)context.get(
ContentLanguageListContainer::NAME);
_client->setRequestContentLanguages(cl_cntr.getLanguages());
}
}