version 1.12, 2005/01/24 15:31:50
|
version 1.23, 2005/03/12 20:16:39
|
|
|
//%2004//////////////////////////////////////////////////////////////////////// |
//%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. |
|
|
// 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.; | // Copyright (c) 2004 BMC Software; Hewlett-Packard Development Company, L.P.; |
// IBM Corp.; EMC Corporation; VERITAS Software Corporation; The Open Group. | // 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 |
|
|
#define Pegasus_OperationResponseHandler_h | #define Pegasus_OperationResponseHandler_h |
| |
#include <Pegasus/Common/Config.h> | #include <Pegasus/Common/Config.h> |
#include <Pegasus/Server/Linkage.h> |
|
#include <Pegasus/Common/CIMMessage.h> | #include <Pegasus/Common/CIMMessage.h> |
#include <Pegasus/Common/MessageQueueService.h> | #include <Pegasus/Common/MessageQueueService.h> |
#include <Pegasus/Common/Constants.h> | #include <Pegasus/Common/Constants.h> |
|
|
// Attempt to get the cached class definition used to validate results of this | // 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. If it does not exist, then this feature is disabled for this |
// operation. | // operation. |
|
CIMClass cimClass; |
|
|
try | try |
{ | { |
CachedClassDefinitionContainer container = | CachedClassDefinitionContainer container = |
request->operationContext.get(CachedClassDefinitionContainer::NAME); | request->operationContext.get(CachedClassDefinitionContainer::NAME); |
| |
CIMClass cimClass = container.getClass(); |
cimClass = container.getClass(); |
| |
_normalizer = |
|
ObjectNormalizer( |
|
cimClass, |
|
request->localOnly, |
|
request->includeQualifiers, |
|
request->includeClassOrigin); |
|
} | } |
catch(Exception &) | catch(Exception &) |
{ | { |
// Do nothing. Container is missing, which implies normalization is disabled | // Do nothing. Container is missing, which implies normalization is disabled |
// for this operation. | // for this operation. |
} | } |
|
|
|
_normalizer = |
|
ObjectNormalizer( |
|
cimClass, |
|
request->includeQualifiers, |
|
request->includeClassOrigin); |
#endif | #endif |
} | } |
| |
virtual void deliver(const CIMInstance & cimInstance) | virtual void deliver(const CIMInstance & cimInstance) |
{ | { |
// If the normalizer was seeded with a class definition, the results are |
if(cimInstance.isUninitialized()) |
// normalized. Otherwise, the normalizer does nothing. |
{ |
deliver(_normalizer.processInstance(cimInstance)); |
MessageLoaderParms message( |
|
"Common.Exception.UNINITIALIZED_OBJECT_EXCEPTION", |
|
"The object is not initialized."); |
|
|
|
throw CIMException(CIM_ERR_FAILED, message); |
|
} |
|
|
|
#ifdef PEGASUS_ENABLE_OBJECT_NORMALIZATION |
|
// The normalizer expects an object path embedded in instances even |
|
// though it is not required by this operation. Use the requested |
|
// object path is missing from the instance. |
|
if(cimInstance.getPath().getKeyBindings().size() == 0) |
|
{ |
|
cimInstance.setPath(request->instanceName); |
|
} |
|
|
|
SimpleInstanceResponseHandler::deliver(_normalizer.processInstance(cimInstance)); |
|
#else |
|
SimpleInstanceResponseHandler::deliver(cimInstance); |
|
#endif |
} | } |
| |
|
protected: |
virtual String getClass(void) const | virtual String getClass(void) const |
{ | { |
return(String("GetInstanceResponseHandler")); | return(String("GetInstanceResponseHandler")); |
|
|
// Attempt to get the cached class definition used to validate results of this | // 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. If it does not exist, then this feature is disabled for this |
// operation. | // operation. |
|
CIMClass cimClass; |
|
|
try | try |
{ | { |
CachedClassDefinitionContainer container = | CachedClassDefinitionContainer container = |
request->operationContext.get(CachedClassDefinitionContainer::NAME); | request->operationContext.get(CachedClassDefinitionContainer::NAME); |
| |
CIMClass cimClass = container.getClass(); |
cimClass = container.getClass(); |
|
|
_normalizer = |
|
ObjectNormalizer( |
|
cimClass, |
|
request->localOnly, |
|
request->includeQualifiers, |
|
request->includeClassOrigin); |
|
} | } |
catch(Exception &) | catch(Exception &) |
{ | { |
// Do nothing. Container is missing, which implies normalization is disabled | // Do nothing. Container is missing, which implies normalization is disabled |
// for this operation. | // for this operation. |
} | } |
|
|
|
_normalizer = |
|
ObjectNormalizer( |
|
cimClass, |
|
request->includeQualifiers, |
|
request->includeClassOrigin); |
#endif | #endif |
} | } |
| |
virtual void deliver(const CIMInstance & cimInstance) | virtual void deliver(const CIMInstance & cimInstance) |
{ | { |
// If the normalizer was seeded with a class definition, the results are |
if(cimInstance.isUninitialized()) |
// normalized. Otherwise, the normalizer does nothing. |
{ |
deliver(_normalizer.processInstance(cimInstance)); |
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 | virtual String getClass(void) const |
{ | { |
return(String("EnumerateInstancesResponseHandler")); | return(String("EnumerateInstancesResponseHandler")); |
|
|
// Attempt to get the cached class definition used to validate results of this | // 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. If it does not exist, then this feature is disabled for this |
// operation. | // operation. |
|
CIMClass cimClass; |
|
|
try | try |
{ | { |
CachedClassDefinitionContainer container = | CachedClassDefinitionContainer container = |
request->operationContext.get(CachedClassDefinitionContainer::NAME); | request->operationContext.get(CachedClassDefinitionContainer::NAME); |
| |
CIMClass cimClass = container.getClass(); |
cimClass = container.getClass(); |
|
|
_normalizer = |
|
ObjectNormalizer( |
|
cimClass, |
|
false, |
|
false, |
|
false); |
|
} | } |
catch(Exception &) | catch(Exception &) |
{ | { |
// Do nothing. Container is missing, which implies normalization is disabled | // Do nothing. Container is missing, which implies normalization is disabled |
// for this operation. | // for this operation. |
} | } |
|
|
|
_normalizer = |
|
ObjectNormalizer( |
|
cimClass, |
|
false, |
|
false); |
#endif | #endif |
} | } |
| |
virtual void deliver(const CIMObjectPath & cimObjectPath) | virtual void deliver(const CIMObjectPath & cimObjectPath) |
{ | { |
// If the normalizer was seeded with a class definition, the results are |
if(cimObjectPath.getClassName().isNull()) |
// normalized. Otherwise, the normalizer does nothing. |
{ |
deliver(_normalizer.processInstanceObjectPath(cimObjectPath)); |
MessageLoaderParms message( |
|
"Common.Exception.UNINITIALIZED_OBJECT_EXCEPTION", |
|
"The object is not initialized."); |
|
|
|
throw CIMException(CIM_ERR_FAILED, message); |
} | } |
| |
|
#ifdef PEGASUS_ENABLE_OBJECT_NORMALIZATION |
|
SimpleObjectPathResponseHandler::deliver(_normalizer.processInstanceObjectPath(cimObjectPath)); |
|
#else |
|
SimpleObjectPathResponseHandler::deliver(cimObjectPath); |
|
#endif |
|
} |
|
|
|
protected: |
virtual String getClass(void) const | virtual String getClass(void) const |
{ | { |
return(String("EnumerateInstanceNamesResponseHandler")); | return(String("EnumerateInstanceNamesResponseHandler")); |
|
|
{ | { |
} | } |
| |
|
virtual void deliver(const CIMObjectPath & cimObjectPath) |
|
{ |
|
if(cimObjectPath.getClassName().isNull()) |
|
{ |
|
MessageLoaderParms message( |
|
"Common.Exception.UNINITIALIZED_OBJECT_EXCEPTION", |
|
"The object is not initialized."); |
|
|
|
throw CIMException(CIM_ERR_FAILED, message); |
|
} |
|
|
|
SimpleObjectPathResponseHandler::deliver(cimObjectPath); |
|
} |
|
|
|
protected: |
virtual String getClass(void) const | virtual String getClass(void) const |
{ | { |
return(String("CreateInstanceResponseHandler")); | return(String("CreateInstanceResponseHandler")); |
|
|
{ | { |
} | } |
| |
|
protected: |
virtual String getClass(void) const | virtual String getClass(void) const |
{ | { |
return(String("ModifyInstanceResponseHandler")); | return(String("ModifyInstanceResponseHandler")); |
} | } |
|
|
}; | }; |
| |
class DeleteInstanceResponseHandler : public OperationResponseHandler, public SimpleResponseHandler | class DeleteInstanceResponseHandler : public OperationResponseHandler, public SimpleResponseHandler |
|
|
{ | { |
} | } |
| |
|
protected: |
virtual String getClass(void) const | virtual String getClass(void) const |
{ | { |
return(String("DeleteInstanceResponseHandler")); | return(String("DeleteInstanceResponseHandler")); |
|
|
{ | { |
} | } |
| |
|
virtual void deliver(const CIMValue & cimValue) |
|
{ |
|
if(cimValue.isNull()) |
|
{ |
|
MessageLoaderParms message( |
|
"Common.Exception.UNINITIALIZED_OBJECT_EXCEPTION", |
|
"The object is not initialized."); |
|
|
|
throw CIMException(CIM_ERR_FAILED, message); |
|
} |
|
|
|
SimpleValueResponseHandler::deliver(cimValue); |
|
} |
|
|
|
protected: |
virtual String getClass(void) const | virtual String getClass(void) const |
{ | { |
return(String("GetPropertyResponseHandler")); | return(String("GetPropertyResponseHandler")); |
|
|
{ | { |
} | } |
| |
|
protected: |
virtual String getClass(void) const | virtual String getClass(void) const |
{ | { |
return(String("SetPropertyResponseHandler")); | return(String("SetPropertyResponseHandler")); |
|
|
{ | { |
} | } |
| |
|
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); |
|
} |
|
|
|
SimpleInstance2ObjectResponseHandler::deliver(cimInstance); |
|
} |
|
|
|
protected: |
virtual String getClass(void) const | virtual String getClass(void) const |
{ | { |
return(String("ExecQueryResponseHandler")); | return(String("ExecQueryResponseHandler")); |
|
|
msg.cimObjects = getObjects(); | msg.cimObjects = getObjects(); |
} | } |
| |
// this handler will not send async |
|
virtual Boolean isAsync(void) const | virtual Boolean isAsync(void) const |
{ | { |
return(false); | return(false); |
|
|
{ | { |
} | } |
| |
|
virtual void deliver(const CIMObject & cimObject) |
|
{ |
|
if(cimObject.isUninitialized()) |
|
{ |
|
MessageLoaderParms message( |
|
"Common.Exception.UNINITIALIZED_OBJECT_EXCEPTION", |
|
"The object is not initialized."); |
|
|
|
throw CIMException(CIM_ERR_FAILED, message); |
|
} |
|
|
|
SimpleObjectResponseHandler::deliver(cimObject); |
|
} |
|
|
|
protected: |
virtual String getClass(void) const | virtual String getClass(void) const |
{ | { |
return(String("AssociatorsResponseHandler")); | return(String("AssociatorsResponseHandler")); |
|
|
{ | { |
} | } |
| |
|
virtual void deliver(const CIMObjectPath & cimObjectPath) |
|
{ |
|
if(cimObjectPath.getClassName().isNull()) |
|
{ |
|
MessageLoaderParms message( |
|
"Common.Exception.UNINITIALIZED_OBJECT_EXCEPTION", |
|
"The object is not initialized."); |
|
|
|
throw CIMException(CIM_ERR_FAILED, message); |
|
} |
|
|
|
SimpleObjectPathResponseHandler::deliver(cimObjectPath); |
|
} |
|
|
|
protected: |
virtual String getClass(void) const | virtual String getClass(void) const |
{ | { |
return(String("AssociatorNamesResponseHandler")); | return(String("AssociatorNamesResponseHandler")); |
|
|
{ | { |
} | } |
| |
|
virtual void deliver(const CIMObject & cimObject) |
|
{ |
|
if(cimObject.isUninitialized()) |
|
{ |
|
MessageLoaderParms message( |
|
"Common.Exception.UNINITIALIZED_OBJECT_EXCEPTION", |
|
"The object is not initialized."); |
|
|
|
throw CIMException(CIM_ERR_FAILED, message); |
|
} |
|
|
|
SimpleObjectResponseHandler::deliver(cimObject); |
|
} |
|
|
|
protected: |
virtual String getClass(void) const | virtual String getClass(void) const |
{ | { |
return(String("ReferencesResponseHandler")); | return(String("ReferencesResponseHandler")); |
|
|
{ | { |
} | } |
| |
|
virtual void deliver(const CIMObjectPath & cimObjectPath) |
|
{ |
|
if(cimObjectPath.getClassName().isNull()) |
|
{ |
|
MessageLoaderParms message( |
|
"Common.Exception.UNINITIALIZED_OBJECT_EXCEPTION", |
|
"The object is not initialized."); |
|
|
|
throw CIMException(CIM_ERR_FAILED, message); |
|
} |
|
|
|
SimpleObjectPathResponseHandler::deliver(cimObjectPath); |
|
} |
|
|
|
protected: |
virtual String getClass(void) const | virtual String getClass(void) const |
{ | { |
return(String("ReferenceNamesResponseHandler")); | return(String("ReferenceNamesResponseHandler")); |
|
|
{ | { |
} | } |
| |
|
virtual void deliverParamValue(const CIMParamValue & cimParamValue) |
|
{ |
|
if(cimParamValue.isUninitialized()) |
|
{ |
|
MessageLoaderParms message( |
|
"Common.Exception.UNINITIALIZED_OBJECT_EXCEPTION", |
|
"The object is not initialized."); |
|
|
|
throw CIMException(CIM_ERR_FAILED, message); |
|
} |
|
|
|
SimpleMethodResultResponseHandler::deliverParamValue(cimParamValue); |
|
} |
|
|
|
virtual void deliver(const CIMValue & cimValue) |
|
{ |
|
if(cimValue.isNull()) |
|
{ |
|
MessageLoaderParms message( |
|
"Common.Exception.UNINITIALIZED_OBJECT_EXCEPTION", |
|
"The object is not initialized."); |
|
|
|
throw CIMException(CIM_ERR_FAILED, message); |
|
} |
|
|
|
SimpleMethodResultResponseHandler::deliver(cimValue); |
|
} |
|
|
|
protected: |
virtual String getClass(void) const | virtual String getClass(void) const |
{ | { |
return(String("InvokeMethodResponseHandler")); | return(String("InvokeMethodResponseHandler")); |
|
|
{ | { |
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; |
} | } |
| |
virtual String getClass(void) const |
|
{ |
|
return(String("EnableIndicationsResponseHandler")); |
|
} |
|
|
|
// this handler will not send async |
|
virtual Boolean isAsync(void) const |
|
{ |
|
return(false); |
|
} |
|
|
|
virtual void deliver(const CIMIndication & cimIndication) | virtual void deliver(const CIMIndication & cimIndication) |
{ | { |
OperationContext context; | OperationContext context; |
|
|
| |
virtual void deliver(const OperationContext & context, const CIMIndication & cimIndication) | virtual void 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 | // ATTN: temporarily convert indication to instance |
CIMInstance cimInstance(cimIndication); | CIMInstance cimInstance(cimIndication); |
| |
|
|
} | } |
} | } |
| |
|
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; |
| |
}; | }; |