version 1.2, 2004/05/18 23:58:41
|
version 1.21, 2005/03/10 21:31:48
|
|
|
//%2003//////////////////////////////////////////////////////////////////////// |
//%2005//////////////////////////////////////////////////////////////////////// |
// | // |
// Copyright (c) 2000, 2001, 2002 BMC Software, Hewlett-Packard Development |
// Copyright (c) 2000, 2001, 2002 BMC Software; Hewlett-Packard Development |
// Company, L. P., IBM Corp., The Open Group, Tivoli Systems. |
// Company, L.P.; IBM Corp.; The Open Group; Tivoli Systems. |
// Copyright (c) 2003 BMC Software; Hewlett-Packard Development Company, L. P.; | // Copyright (c) 2003 BMC Software; Hewlett-Packard Development Company, L. P.; |
// IBM Corp.; EMC Corporation, The Open Group. | // IBM Corp.; EMC Corporation, The Open Group. |
|
// Copyright (c) 2004 BMC Software; Hewlett-Packard Development Company, L.P.; |
|
// IBM Corp.; EMC Corporation; VERITAS Software Corporation; The Open Group. |
|
// Copyright (c) 2005 Hewlett-Packard Development Company, L.P.; IBM Corp.; |
|
// EMC Corporation; VERITAS Software Corporation; The Open Group. |
// | // |
// Permission is hereby granted, free of charge, to any person obtaining a copy | // Permission is hereby granted, free of charge, to any person obtaining a copy |
// of this software and associated documentation files (the "Software"), to | // of this software and associated documentation files (the "Software"), to |
|
|
// | // |
// Author: Chip Vincent (cvincent@us.ibm.com) | // Author: Chip Vincent (cvincent@us.ibm.com) |
// | // |
// Modified By: Carol Ann Krug Graves, Hewlett-Packard Company |
// Modified By: |
// (carolann_graves@hp.com) |
// Carol Ann Krug Graves, Hewlett-Packard Company (carolann_graves@hp.com) |
// Dave Rosckes (rosckes@us.ibm.com) | // Dave Rosckes (rosckes@us.ibm.com) |
// Yi Zhou, Hewlett-Packard Company (yi_zhou@hp.com) | // Yi Zhou, Hewlett-Packard Company (yi_zhou@hp.com) |
// Adrian Schuur (schuur@de.ibm.com) | // Adrian Schuur (schuur@de.ibm.com) |
|
// Seema Gupta (gseema@in.ibm.com) for PEP135 |
|
// Brian G. Campbell, EMC (campbell_brian@emc.com) - PEP140/phase2 |
// | // |
//%///////////////////////////////////////////////////////////////////////////// | //%///////////////////////////////////////////////////////////////////////////// |
| |
|
|
#include <Pegasus/Common/CIMIndication.h> | #include <Pegasus/Common/CIMIndication.h> |
#include <Pegasus/Common/CIMValue.h> | #include <Pegasus/Common/CIMValue.h> |
| |
|
#include <Pegasus/Common/OperationContext.h> |
|
#include <Pegasus/Common/OperationContextInternal.h> |
|
|
|
#include <Pegasus/Common/ObjectNormalizer.h> |
#include <Pegasus/Common/ResponseHandler.h> | #include <Pegasus/Common/ResponseHandler.h> |
#include <Pegasus/Common/Logger.h> | #include <Pegasus/Common/Logger.h> |
|
#include <Pegasus/Common/XmlWriter.h> |
| |
#include <Pegasus/ProviderManager2/SimpleResponseHandler.h> | #include <Pegasus/ProviderManager2/SimpleResponseHandler.h> |
|
|
#include <Pegasus/ProviderManager2/Linkage.h> | #include <Pegasus/ProviderManager2/Linkage.h> |
| |
PEGASUS_NAMESPACE_BEGIN | PEGASUS_NAMESPACE_BEGIN |
| |
class PEGASUS_PPM_LINKAGE OperationResponseHandler | class PEGASUS_PPM_LINKAGE OperationResponseHandler |
{ | { |
|
friend class SimpleResponseHandler; |
|
|
public: | public: |
OperationResponseHandler(CIMRequestMessage * request, CIMResponseMessage * response) |
OperationResponseHandler( |
: _request(request), _response(response) |
CIMRequestMessage * request, |
{ |
CIMResponseMessage * response); |
} |
|
| |
virtual ~OperationResponseHandler(void) |
virtual ~OperationResponseHandler(void); |
{ |
|
} |
|
| |
CIMRequestMessage * getRequest(void) const | CIMRequestMessage * getRequest(void) const |
{ | { |
|
|
return(_response); | return(_response); |
} | } |
| |
virtual void setStatus(const Uint32 code, const String & message = String::EMPTY) |
virtual void setStatus( |
|
const Uint32 code, |
|
const String & message = String::EMPTY) |
{ | { |
_response->cimException = PEGASUS_CIM_EXCEPTION(CIMStatusCode(code), message); | _response->cimException = PEGASUS_CIM_EXCEPTION(CIMStatusCode(code), message); |
} | } |
| |
virtual void setStatus(const Uint32 code, |
virtual void setStatus( |
|
const Uint32 code, |
const ContentLanguages & langs, | const ContentLanguages & langs, |
const String & message = String::EMPTY) | const String & message = String::EMPTY) |
{ | { |
_response->cimException = PEGASUS_CIM_EXCEPTION_LANG( |
_response->cimException = |
|
PEGASUS_CIM_EXCEPTION_LANG( |
langs, | langs, |
CIMStatusCode(code), | CIMStatusCode(code), |
message); | message); |
} | } |
| |
protected: | protected: |
|
// the default for all derived handlers. Some handlers may not apply |
|
// async behavior because their callers cannot handle partial responses. |
|
virtual Boolean isAsync(void) const |
|
{ |
|
return(true); |
|
} |
|
|
|
// send (deliver) asynchronously |
|
virtual void send(Boolean isComplete); |
|
|
|
// transfer any objects from handler to response. this does not clear() |
|
virtual void transfer(void) |
|
{ |
|
} |
|
|
|
// validate whatever is necessary before the transfer |
|
virtual void validate(void) |
|
{ |
|
} |
|
|
|
virtual String getClass(void) const |
|
{ |
|
return(String("OperationResponseHandler")); |
|
} |
|
|
|
Uint32 getResponseObjectTotal(void) const |
|
{ |
|
return(_responseObjectTotal); |
|
} |
|
|
|
// there can be many objects per message (or none at all - i.e complete()) |
|
Uint32 getResponseMessageTotal(void) const |
|
{ |
|
return(_responseMessageTotal); |
|
} |
|
|
|
Uint32 getResponseObjectThreshold(void) const |
|
{ |
|
return(_responseObjectThreshold); |
|
} |
|
|
CIMRequestMessage * _request; | CIMRequestMessage * _request; |
CIMResponseMessage * _response; | CIMResponseMessage * _response; |
| |
}; |
private: |
|
Uint32 _responseObjectTotal; |
|
Uint32 _responseMessageTotal; |
|
Uint32 _responseObjectThreshold; |
| |
/* ------------------------------------------------------------------------- */ |
}; |
/* operation specific response handlers */ |
|
/* ------------------------------------------------------------------------- */ |
|
| |
class GetInstanceResponseHandler: public OperationResponseHandler, public SimpleInstanceResponseHandler | class GetInstanceResponseHandler: public OperationResponseHandler, public SimpleInstanceResponseHandler |
{ | { |
|
|
CIMGetInstanceResponseMessage * response) | CIMGetInstanceResponseMessage * response) |
: OperationResponseHandler(request, response) | : OperationResponseHandler(request, response) |
{ | { |
|
#ifdef PEGASUS_ENABLE_OBJECT_NORMALIZATION |
|
// Attempt to get the cached class definition used to validate results of this |
|
// operation. If it does not exist, then this feature is disabled for this |
|
// operation. |
|
CIMClass cimClass; |
|
|
|
try |
|
{ |
|
CachedClassDefinitionContainer container = |
|
request->operationContext.get(CachedClassDefinitionContainer::NAME); |
|
|
|
cimClass = container.getClass(); |
|
|
|
} |
|
catch(Exception &) |
|
{ |
|
// Do nothing. Container is missing, which implies normalization is disabled |
|
// for this operation. |
|
} |
|
|
|
_normalizer = |
|
ObjectNormalizer( |
|
cimClass, |
|
request->includeQualifiers, |
|
request->includeClassOrigin); |
|
#endif |
|
} |
|
|
|
virtual void deliver(const CIMInstance & cimInstance) |
|
{ |
|
if(cimInstance.isUninitialized()) |
|
{ |
|
MessageLoaderParms message( |
|
"Common.Exception.UNINITIALIZED_OBJECT_EXCEPTION", |
|
"The object is not initialized."); |
|
|
|
throw CIMException(CIM_ERR_FAILED, message); |
|
} |
|
|
|
#ifdef PEGASUS_ENABLE_OBJECT_NORMALIZATION |
|
SimpleInstanceResponseHandler::deliver(_normalizer.processInstance(cimInstance)); |
|
#else |
|
SimpleInstanceResponseHandler::deliver(cimInstance); |
|
#endif |
|
} |
|
|
|
protected: |
|
virtual String getClass(void) const |
|
{ |
|
return(String("GetInstanceResponseHandler")); |
} | } |
| |
virtual void complete() |
virtual void transfer(void) |
|
{ |
|
if(size() > 0) |
{ | { |
Logger::put(Logger::STANDARD_LOG, System::CIMSERVER, Logger::TRACE, |
CIMGetInstanceResponseMessage & msg = |
"OperationResponseHandler: complete()"); |
*static_cast<CIMGetInstanceResponseMessage *>(getResponse()); |
| |
if(getObjects().size() == 0) |
msg.cimInstance = getObjects()[0]; |
|
} |
|
} |
|
|
|
virtual void validate(void) |
|
{ |
|
if(getResponseObjectTotal() == 0) |
{ | { |
// error? provider claims success, | // error? provider claims success, |
// but did not deliver an instance. | // but did not deliver an instance. |
setStatus(CIM_ERR_NOT_FOUND); | setStatus(CIM_ERR_NOT_FOUND); |
|
} |
return; |
|
} | } |
| |
static_cast<CIMGetInstanceResponseMessage *>( |
private: |
getResponse())->cimInstance = getObjects()[0]; |
ObjectNormalizer _normalizer; |
| |
// l10n |
|
getResponse()->contentLanguages = getLanguages(); |
|
} |
|
}; | }; |
| |
class EnumerateInstancesResponseHandler : public OperationResponseHandler, public SimpleInstanceResponseHandler | class EnumerateInstancesResponseHandler : public OperationResponseHandler, public SimpleInstanceResponseHandler |
|
|
CIMEnumerateInstancesResponseMessage * response) | CIMEnumerateInstancesResponseMessage * response) |
: OperationResponseHandler(request, response) | : OperationResponseHandler(request, response) |
{ | { |
|
#ifdef PEGASUS_ENABLE_OBJECT_NORMALIZATION |
|
// Attempt to get the cached class definition used to validate results of this |
|
// operation. If it does not exist, then this feature is disabled for this |
|
// operation. |
|
CIMClass cimClass; |
|
|
|
try |
|
{ |
|
CachedClassDefinitionContainer container = |
|
request->operationContext.get(CachedClassDefinitionContainer::NAME); |
|
|
|
cimClass = container.getClass(); |
|
} |
|
catch(Exception &) |
|
{ |
|
// Do nothing. Container is missing, which implies normalization is disabled |
|
// for this operation. |
|
} |
|
|
|
_normalizer = |
|
ObjectNormalizer( |
|
cimClass, |
|
request->includeQualifiers, |
|
request->includeClassOrigin); |
|
#endif |
|
} |
|
|
|
virtual void deliver(const CIMInstance & cimInstance) |
|
{ |
|
if(cimInstance.isUninitialized()) |
|
{ |
|
MessageLoaderParms message( |
|
"Common.Exception.UNINITIALIZED_OBJECT_EXCEPTION", |
|
"The object is not initialized."); |
|
|
|
throw CIMException(CIM_ERR_FAILED, message); |
|
} |
|
|
|
#ifdef PEGASUS_ENABLE_OBJECT_NORMALIZATION |
|
SimpleInstanceResponseHandler::deliver(_normalizer.processInstance(cimInstance)); |
|
#else |
|
SimpleInstanceResponseHandler::deliver(cimInstance); |
|
#endif |
} | } |
| |
virtual void complete() |
protected: |
|
virtual String getClass(void) const |
{ | { |
Logger::put(Logger::STANDARD_LOG, System::CIMSERVER, Logger::TRACE, |
return(String("EnumerateInstancesResponseHandler")); |
"OperationResponseHandler: complete()"); |
} |
| |
static_cast<CIMEnumerateInstancesResponseMessage *>( |
virtual void transfer(void) |
getResponse())->cimNamedInstances = getObjects(); |
{ |
|
CIMEnumerateInstancesResponseMessage & msg = |
|
*static_cast<CIMEnumerateInstancesResponseMessage *>(getResponse()); |
| |
// l10n |
msg.cimNamedInstances = getObjects(); |
getResponse()->contentLanguages = getLanguages(); |
|
} | } |
| |
|
private: |
|
ObjectNormalizer _normalizer; |
|
|
}; | }; |
| |
class EnumerateInstanceNamesResponseHandler : public OperationResponseHandler, public SimpleObjectPathResponseHandler | class EnumerateInstanceNamesResponseHandler : public OperationResponseHandler, public SimpleObjectPathResponseHandler |
|
|
CIMEnumerateInstanceNamesResponseMessage * response) | CIMEnumerateInstanceNamesResponseMessage * response) |
: OperationResponseHandler(request, response) | : OperationResponseHandler(request, response) |
{ | { |
|
#ifdef PEGASUS_ENABLE_OBJECT_NORMALIZATION |
|
// Attempt to get the cached class definition used to validate results of this |
|
// operation. If it does not exist, then this feature is disabled for this |
|
// operation. |
|
CIMClass cimClass; |
|
|
|
try |
|
{ |
|
CachedClassDefinitionContainer container = |
|
request->operationContext.get(CachedClassDefinitionContainer::NAME); |
|
|
|
cimClass = container.getClass(); |
|
} |
|
catch(Exception &) |
|
{ |
|
// Do nothing. Container is missing, which implies normalization is disabled |
|
// for this operation. |
} | } |
| |
virtual void complete() |
_normalizer = |
|
ObjectNormalizer( |
|
cimClass, |
|
false, |
|
false); |
|
#endif |
|
} |
|
|
|
virtual void deliver(const CIMObjectPath & cimObjectPath) |
{ | { |
Logger::put(Logger::STANDARD_LOG, System::CIMSERVER, Logger::TRACE, |
if(cimObjectPath.getClassName().isNull()) |
"OperationResponseHandler: complete()"); |
{ |
|
MessageLoaderParms message( |
|
"Common.Exception.UNINITIALIZED_OBJECT_EXCEPTION", |
|
"The object is not initialized."); |
| |
static_cast<CIMEnumerateInstanceNamesResponseMessage *>( |
throw CIMException(CIM_ERR_FAILED, message); |
getResponse())->instanceNames = getObjects(); |
} |
| |
// l10n |
#ifdef PEGASUS_ENABLE_OBJECT_NORMALIZATION |
getResponse()->contentLanguages = getLanguages(); |
SimpleObjectPathResponseHandler::deliver(_normalizer.processInstanceObjectPath(cimObjectPath)); |
|
#else |
|
SimpleObjectPathResponseHandler::deliver(cimObjectPath); |
|
#endif |
} | } |
| |
|
protected: |
|
virtual String getClass(void) const |
|
{ |
|
return(String("EnumerateInstanceNamesResponseHandler")); |
|
} |
|
|
|
virtual void transfer(void) |
|
{ |
|
CIMEnumerateInstanceNamesResponseMessage & msg = |
|
*static_cast<CIMEnumerateInstanceNamesResponseMessage *>(getResponse()); |
|
|
|
msg.instanceNames = getObjects(); |
|
} |
|
|
|
private: |
|
ObjectNormalizer _normalizer; |
|
|
}; | }; |
| |
class CreateInstanceResponseHandler : public OperationResponseHandler, public SimpleObjectPathResponseHandler | class CreateInstanceResponseHandler : public OperationResponseHandler, public SimpleObjectPathResponseHandler |
|
|
{ | { |
} | } |
| |
virtual void complete() |
protected: |
|
virtual String getClass(void) const |
{ | { |
Logger::put(Logger::STANDARD_LOG, System::CIMSERVER, Logger::TRACE, |
return(String("CreateInstanceResponseHandler")); |
"OperationResponseHandler: complete()"); |
} |
| |
if(getObjects().size() == 0) |
#if 0 |
{ |
|
// ATTN: is it an error to not return instance name? | // ATTN: is it an error to not return instance name? |
return; |
virtual void validate(void) |
|
{ |
|
if(getResponseObjectTotal() == 0) |
|
{ |
|
setStatus(CIM_ERR_NOT_FOUND); |
} | } |
|
} |
|
#endif |
| |
static_cast<CIMCreateInstanceResponseMessage *>( |
virtual void transfer(void) |
getResponse())->instanceName = getObjects()[0]; |
{ |
|
if(size() > 0) |
|
{ |
|
CIMCreateInstanceResponseMessage & msg = |
|
*static_cast<CIMCreateInstanceResponseMessage *>(getResponse()); |
| |
// l10n |
msg.instanceName = getObjects()[0]; |
getResponse()->contentLanguages = getLanguages(); |
} |
} | } |
|
|
}; | }; |
| |
class ModifyInstanceResponseHandler : public OperationResponseHandler, public SimpleResponseHandler | class ModifyInstanceResponseHandler : public OperationResponseHandler, public SimpleResponseHandler |
|
|
{ | { |
} | } |
| |
|
protected: |
|
virtual String getClass(void) const |
|
{ |
|
return(String("ModifyInstanceResponseHandler")); |
|
} |
}; | }; |
| |
class DeleteInstanceResponseHandler : public OperationResponseHandler, public SimpleResponseHandler | class DeleteInstanceResponseHandler : public OperationResponseHandler, public SimpleResponseHandler |
|
|
{ | { |
} | } |
| |
|
protected: |
|
virtual String getClass(void) const |
|
{ |
|
return(String("DeleteInstanceResponseHandler")); |
|
} |
|
|
}; | }; |
| |
class GetPropertyResponseHandler : public OperationResponseHandler, public SimpleValueResponseHandler | class GetPropertyResponseHandler : public OperationResponseHandler, public SimpleValueResponseHandler |
|
|
{ | { |
} | } |
| |
virtual void complete() |
protected: |
|
virtual String getClass(void) const |
{ | { |
Logger::put(Logger::STANDARD_LOG, System::CIMSERVER, Logger::TRACE, |
return(String("GetPropertyResponseHandler")); |
"OperationResponseHandler: complete()"); |
} |
|
|
|
virtual void transfer(void) |
|
{ |
|
if(size() > 0) |
|
{ |
|
CIMGetPropertyResponseMessage & msg = |
|
*static_cast<CIMGetPropertyResponseMessage *>(getResponse()); |
|
|
|
msg.value = getObjects()[0]; |
|
} |
|
} |
| |
if(getObjects().size() == 0) |
virtual void validate(void) |
{ | { |
// error? provider claims success, | // error? provider claims success, |
// but did not deliver an instance. | // but did not deliver an instance. |
|
if(getResponseObjectTotal() == 0) |
|
{ |
setStatus(CIM_ERR_NOT_FOUND); | setStatus(CIM_ERR_NOT_FOUND); |
|
|
return; |
|
} | } |
|
|
static_cast<CIMGetPropertyResponseMessage *>( |
|
getResponse())->value = getObjects()[0]; |
|
|
|
// l10n |
|
getResponse()->contentLanguages = getLanguages(); |
|
} | } |
}; | }; |
| |
|
|
{ | { |
} | } |
| |
|
protected: |
|
virtual String getClass(void) const |
|
{ |
|
return(String("SetPropertyResponseHandler")); |
|
} |
|
|
}; | }; |
| |
class ExecQueryResponseHandler : public OperationResponseHandler, public SimpleInstance2ObjectResponseHandler | class ExecQueryResponseHandler : public OperationResponseHandler, public SimpleInstance2ObjectResponseHandler |
|
|
{ | { |
} | } |
| |
virtual void complete() |
protected: |
|
virtual String getClass(void) const |
{ | { |
Logger::put(Logger::STANDARD_LOG, System::CIMSERVER, Logger::TRACE, |
return(String("ExecQueryResponseHandler")); |
"OperationResponseHandler: complete()"); |
} |
| |
static_cast<CIMExecQueryResponseMessage *>( |
virtual void transfer(void) |
getResponse())->cimObjects = getObjects(); |
{ |
|
CIMExecQueryResponseMessage & msg = |
|
*static_cast<CIMExecQueryResponseMessage *>(getResponse()); |
| |
// l10n |
msg.cimObjects = getObjects(); |
getResponse()->contentLanguages = getLanguages(); |
|
} | } |
| |
|
virtual Boolean isAsync(void) const |
|
{ |
|
return(false); |
|
} |
}; | }; |
| |
|
|
class AssociatorsResponseHandler : public OperationResponseHandler, public SimpleObjectResponseHandler | class AssociatorsResponseHandler : public OperationResponseHandler, public SimpleObjectResponseHandler |
{ | { |
public: | public: |
|
|
{ | { |
} | } |
| |
virtual void complete() |
protected: |
|
virtual String getClass(void) const |
{ | { |
Logger::put(Logger::STANDARD_LOG, System::CIMSERVER, Logger::TRACE, |
return(String("AssociatorsResponseHandler")); |
"OperationResponseHandler: complete()"); |
} |
| |
static_cast<CIMAssociatorsResponseMessage *>( |
virtual void transfer(void) |
getResponse())->cimObjects = getObjects(); |
{ |
|
CIMAssociatorsResponseMessage & msg = |
|
*static_cast<CIMAssociatorsResponseMessage *>(getResponse()); |
| |
// l10n |
msg.cimObjects = getObjects(); |
getResponse()->contentLanguages = getLanguages(); |
|
} | } |
|
|
}; | }; |
| |
class AssociatorNamesResponseHandler : public OperationResponseHandler, public SimpleObjectPathResponseHandler | class AssociatorNamesResponseHandler : public OperationResponseHandler, public SimpleObjectPathResponseHandler |
|
|
{ | { |
} | } |
| |
virtual void complete() |
protected: |
|
virtual String getClass(void) const |
{ | { |
Logger::put(Logger::STANDARD_LOG, System::CIMSERVER, Logger::TRACE, |
return(String("AssociatorNamesResponseHandler")); |
"OperationResponseHandler: complete()"); |
} |
| |
static_cast<CIMAssociatorNamesResponseMessage *>( |
virtual void transfer(void) |
getResponse())->objectNames.appendArray(getObjects()); |
{ |
|
CIMAssociatorNamesResponseMessage & msg = |
|
*static_cast<CIMAssociatorNamesResponseMessage *>(getResponse()); |
| |
// l10n |
msg.objectNames = getObjects(); |
getResponse()->contentLanguages = getLanguages(); |
|
} | } |
|
|
}; | }; |
| |
class ReferencesResponseHandler : public OperationResponseHandler, public SimpleObjectResponseHandler | class ReferencesResponseHandler : public OperationResponseHandler, public SimpleObjectResponseHandler |
|
|
{ | { |
} | } |
| |
virtual void complete() |
protected: |
|
virtual String getClass(void) const |
{ | { |
Logger::put(Logger::STANDARD_LOG, System::CIMSERVER, Logger::TRACE, |
return(String("ReferencesResponseHandler")); |
"OperationResponseHandler: complete()"); |
} |
| |
static_cast<CIMReferencesResponseMessage *>( |
virtual void transfer(void) |
getResponse())->cimObjects = getObjects(); |
{ |
|
CIMReferencesResponseMessage & msg = |
|
*static_cast<CIMReferencesResponseMessage *>(getResponse()); |
| |
// l10n |
msg.cimObjects = getObjects(); |
getResponse()->contentLanguages = getLanguages(); |
|
} | } |
|
|
}; | }; |
| |
class ReferenceNamesResponseHandler : public OperationResponseHandler, public SimpleObjectPathResponseHandler | class ReferenceNamesResponseHandler : public OperationResponseHandler, public SimpleObjectPathResponseHandler |
|
|
{ | { |
} | } |
| |
virtual void complete() |
protected: |
|
virtual String getClass(void) const |
{ | { |
Logger::put(Logger::STANDARD_LOG, System::CIMSERVER, Logger::TRACE, |
return(String("ReferenceNamesResponseHandler")); |
"OperationResponseHandler: complete()"); |
} |
| |
static_cast<CIMReferenceNamesResponseMessage *>( |
virtual void transfer(void) |
getResponse())->objectNames.appendArray(getObjects()); |
{ |
|
CIMReferenceNamesResponseMessage & msg = |
|
*static_cast<CIMReferenceNamesResponseMessage *>(getResponse()); |
| |
// l10n |
msg.objectNames = getObjects(); |
getResponse()->contentLanguages = getLanguages(); |
|
} | } |
|
|
}; | }; |
| |
class InvokeMethodResponseHandler : public OperationResponseHandler, public SimpleMethodResultResponseHandler | class InvokeMethodResponseHandler : public OperationResponseHandler, public SimpleMethodResultResponseHandler |
|
|
{ | { |
} | } |
| |
virtual void complete() |
protected: |
|
virtual String getClass(void) const |
{ | { |
Logger::put(Logger::STANDARD_LOG, System::CIMSERVER, Logger::TRACE, |
return(String("InvokeMethodResponseHandler")); |
"OperationResponseHandler: complete()"); |
} |
|
|
// ATTN-RK-20020903: Is it legal for the return value to be null? |
|
//if(getReturnValue().isNull()) |
|
//{ |
|
// ATTN: error? provider claims success, but did not deliver a CIMValue. |
|
// return; |
|
//} |
|
| |
static_cast<CIMInvokeMethodResponseMessage *>( |
virtual void transfer(void) |
getResponse())->outParameters = getParamValues(); |
{ |
|
CIMInvokeMethodResponseMessage & msg = |
|
*static_cast<CIMInvokeMethodResponseMessage *>(getResponse()); |
| |
static_cast<CIMInvokeMethodResponseMessage *>( |
msg.outParameters = getParamValues(); |
getResponse())->retValue = getReturnValue(); |
|
| |
// l10n |
// ATTN-RK-20020903: Is it legal for the return value to be null? |
getResponse()->contentLanguages = getLanguages(); |
// if not, then the check must be done here since deliver() works off the |
|
// virtual size, which refers to out parameters! |
|
msg.retValue = getReturnValue(); |
} | } |
|
|
}; | }; |
| |
|
typedef void (*PEGASUS_INDICATION_CALLBACK)(CIMProcessIndicationRequestMessage*); |
typedef void (*PEGASUS_INDICATION_CALLBACK)( |
|
CIMProcessIndicationRequestMessage*); |
|
| |
class EnableIndicationsResponseHandler : public OperationResponseHandler, public SimpleIndicationResponseHandler | class EnableIndicationsResponseHandler : public OperationResponseHandler, public SimpleIndicationResponseHandler |
{ | { |
public: | public: |
EnableIndicationsResponseHandler( | EnableIndicationsResponseHandler( |
CIMEnableIndicationsRequestMessage * request, |
CIMRequestMessage * request, |
CIMEnableIndicationsResponseMessage * response, |
CIMResponseMessage * response, |
CIMInstance & provider, | CIMInstance & provider, |
PEGASUS_INDICATION_CALLBACK indicationCallback) | PEGASUS_INDICATION_CALLBACK indicationCallback) |
: OperationResponseHandler(request, response), | : OperationResponseHandler(request, response), |
_request_copy(*request), |
|
_response_copy(*response), |
|
_indicationCallback(indicationCallback) | _indicationCallback(indicationCallback) |
{ | { |
_provider = provider; | _provider = provider; |
|
|
| |
Array<CIMObjectPath> subscriptionInstanceNames; | Array<CIMObjectPath> subscriptionInstanceNames; |
| |
context.insert(SubscriptionInstanceNamesContainer |
context.insert(SubscriptionInstanceNamesContainer(subscriptionInstanceNames)); |
(subscriptionInstanceNames)); |
|
| |
deliver(context, cimIndication); | deliver(context, cimIndication); |
} | } |
| |
virtual void deliver(const OperationContext & context, const CIMIndication & cimIndication) | virtual void deliver(const OperationContext & context, const CIMIndication & cimIndication) |
{ | { |
Logger::put(Logger::STANDARD_LOG, System::CIMSERVER, Logger::TRACE, |
|
"OperationResponseHandler: deliver()"); |
|
// ATTN: temporarily convert indication to instance | // ATTN: temporarily convert indication to instance |
CIMInstance cimInstance(cimIndication); | CIMInstance cimInstance(cimIndication); |
| |
// |
|
// Get list of subscription instance names from context | // Get list of subscription instance names from context |
// |
|
Array<CIMObjectPath> subscriptionInstanceNames; | Array<CIMObjectPath> subscriptionInstanceNames; |
|
|
try | try |
{ | { |
SubscriptionInstanceNamesContainer container = context.get |
SubscriptionInstanceNamesContainer container = |
(SubscriptionInstanceNamesContainer::NAME); |
context.get(SubscriptionInstanceNamesContainer::NAME); |
| |
subscriptionInstanceNames = |
subscriptionInstanceNames = container.getInstanceNames(); |
container.getInstanceNames(); |
|
} | } |
catch (Exception&) | catch (Exception&) |
{ | { |
|
|
| |
// l10n | // l10n |
ContentLanguages contentLangs; | ContentLanguages contentLangs; |
|
|
try | try |
{ | { |
// Get the Content-Language for this indication. The provider | // Get the Content-Language for this indication. The provider |
// does not have to add specify a language for the indication. | // does not have to add specify a language for the indication. |
ContentLanguageListContainer langContainer = context.get |
ContentLanguageListContainer langContainer = |
(ContentLanguageListContainer::NAME); |
context.get(ContentLanguageListContainer::NAME); |
| |
contentLangs = langContainer.getLanguages(); | contentLangs = langContainer.getLanguages(); |
} | } |
|
|
// l10n | // l10n |
CIMProcessIndicationRequestMessage * request = | CIMProcessIndicationRequestMessage * request = |
new CIMProcessIndicationRequestMessage( | new CIMProcessIndicationRequestMessage( |
_request_copy.messageId, |
XmlWriter::getNextMessageId(), |
cimInstance.getPath().getNameSpace(), | cimInstance.getPath().getNameSpace(), |
cimInstance, | cimInstance, |
subscriptionInstanceNames, | subscriptionInstanceNames, |
_provider, | _provider, |
QueueIdStack(), // Must be filled in by the callback function |
QueueIdStack()); // Must be filled in by the callback function |
contentLangs); |
|
request->operationContext = context; | request->operationContext = context; |
| |
|
try |
|
{ |
|
request->operationContext.set(ContentLanguageListContainer(contentLangs)); |
|
} |
|
catch(Exception &) |
|
{ |
|
request->operationContext.insert(ContentLanguageListContainer(contentLangs)); |
|
} |
|
|
_indicationCallback(request); | _indicationCallback(request); |
} | } |
| |
|
|
} | } |
} | } |
| |
|
protected: |
|
virtual String getClass(void) const |
|
{ |
|
return(String("EnableIndicationsResponseHandler")); |
|
} |
|
|
|
virtual Boolean isAsync(void) const |
|
{ |
|
return(false); |
|
} |
|
|
private: | private: |
CIMEnableIndicationsRequestMessage _request_copy; |
|
CIMEnableIndicationsResponseMessage _response_copy; |
|
PEGASUS_INDICATION_CALLBACK _indicationCallback; | PEGASUS_INDICATION_CALLBACK _indicationCallback; |
|
|
}; | }; |
| |
PEGASUS_NAMESPACE_END | PEGASUS_NAMESPACE_END |