version 1.102, 2013/10/16 23:24:19
|
version 1.103, 2014/08/27 23:10:11
|
|
|
#include <Pegasus/Common/OperationContextInternal.h> | #include <Pegasus/Common/OperationContextInternal.h> |
#include <Pegasus/Common/QueryExpressionRep.h> | #include <Pegasus/Common/QueryExpressionRep.h> |
#include <Pegasus/Common/AutoPtr.h> | #include <Pegasus/Common/AutoPtr.h> |
|
#include <Pegasus/Common/UintArgs.h> |
#include <Pegasus/Common/ArrayIterator.h> | #include <Pegasus/Common/ArrayIterator.h> |
#include <Pegasus/Common/Magic.h> | #include <Pegasus/Common/Magic.h> |
| |
|
|
<Pegasus/Server/ProviderRegistrationManager/ProviderRegistrationManager.h> | <Pegasus/Server/ProviderRegistrationManager/ProviderRegistrationManager.h> |
#include <Pegasus/Server/Linkage.h> | #include <Pegasus/Server/Linkage.h> |
#include <Pegasus/Server/reg_table.h> | #include <Pegasus/Server/reg_table.h> |
|
#include <Pegasus/Server/EnumerationContext.h> |
| |
PEGASUS_NAMESPACE_BEGIN | PEGASUS_NAMESPACE_BEGIN |
PEGASUS_USING_STD; | PEGASUS_USING_STD; |
|
|
*/ | */ |
void appendClass(ProviderInfo& x); | void appendClass(ProviderInfo& x); |
| |
/** append a new Provider to the list. Note that this function |
/** Append a new Provider to the list. This function |
increments the ProviderCount. This count may be different | increments the ProviderCount. This count may be different |
than the count of items in the array | than the count of items in the array |
@param x ProviderInfo to append to the list | @param x ProviderInfo to append to the list |
|
|
*/ | */ |
Uint32 getIndex(); | Uint32 getIndex(); |
| |
|
// Execute the pegtrace that displays class/provider |
|
void pegRoutingTrace(ProviderInfo& providerInfo, const char * reqMsgName, |
|
String& messageId); |
|
|
// The following are purely debug functionality and are normally not | // The following are purely debug functionality and are normally not |
// compiled. To compile them for testing of the results of the | // compiled. To compile them for testing of the results of the |
// lookup providers functionality enable the following define. | // lookup providers functionality enable the following define. |
|
|
{ | { |
friend class CIMOperationRequestDispatcher; | friend class CIMOperationRequestDispatcher; |
public: | public: |
/** Operation Aggregate constructor. Builds an aggregate object |
/** Operation Aggregate constructor. Builds an aggregation |
object. | object. |
@param request - CIMOprationRequestMessage containing copy | @param request - CIMOprationRequestMessage containing copy |
of the original request | of the original request |
|
|
// Increment the total Operation Requests issued parameter by 1 | // Increment the total Operation Requests issued parameter by 1 |
void incTotalIssued(); | void incTotalIssued(); |
| |
Uint32 getTotalIssued(); |
Uint32 getTotalIssued() const; |
| |
// Append a new entry to the response list. Return value indicates |
// Append a new entry to the response list. |
// whether this response is the last one expected |
|
| |
Boolean appendResponse(CIMResponseMessage* response); |
void appendResponse(CIMResponseMessage* response); |
| |
Uint32 numberResponses() const; | Uint32 numberResponses() const; |
| |
CIMOperationRequestMessage* getRequest(); |
CIMOperationRequestMessage* getRequest() const; |
| |
CIMResponseMessage* getResponse(const Uint32& pos); | CIMResponseMessage* getResponse(const Uint32& pos); |
| |
|
|
| |
void resequenceResponse(CIMResponseMessage& response); | void resequenceResponse(CIMResponseMessage& response); |
| |
|
/** sets the parameters required for pull operations into a new |
|
* operation aggregate that was created as part of an Open... |
|
* Operation. |
|
* |
|
* @param enContext EnumerationContext defined for this sequence |
|
* @param contextString String representing the operation |
|
* Context defined for this sequence |
|
*/ |
|
void setPullOperation(EnumerationContext* enContext); |
|
|
|
bool isPullOperation() const; |
|
|
String _messageId; | String _messageId; |
MessageType _msgRequestType; | MessageType _msgRequestType; |
Uint32 _dest; | Uint32 _dest; |
|
|
Array<String> propertyList; | Array<String> propertyList; |
QueryExpressionRep* _query; | QueryExpressionRep* _query; |
String _queryLanguage; | String _queryLanguage; |
|
Boolean _pullOperation; |
|
Boolean _enumerationFinished; |
|
Boolean _closeReceived; |
|
EnumerationContext* _enumerationContext; |
| |
private: | private: |
/** Hidden (unimplemented) copy constructor */ |
/** Hidden (unimplemented) copy and assignment constructors */ |
OperationAggregate(const OperationAggregate& x); | OperationAggregate(const OperationAggregate& x); |
|
OperationAggregate& operator=(const OperationAggregate&); |
| |
Array<CIMResponseMessage*> _responseList; | Array<CIMResponseMessage*> _responseList; |
Mutex _appendResponseMutex; | Mutex _appendResponseMutex; |
Mutex _enqueueResponseMutex; | Mutex _enqueueResponseMutex; |
|
Mutex _enqueuePullResponseMutex; |
CIMOperationRequestMessage* _request; | CIMOperationRequestMessage* _request; |
Uint32 _totalIssued; | Uint32 _totalIssued; |
Uint32 _totalReceived; | Uint32 _totalReceived; |
|
|
Magic<0xC531B144> _magic; | Magic<0xC531B144> _magic; |
}; | }; |
| |
inline Uint32 OperationAggregate::getTotalIssued() |
inline Uint32 OperationAggregate::getTotalIssued() const |
{ | { |
return _totalIssued; | return _totalIssued; |
} | } |
|
|
_totalIssued++; | _totalIssued++; |
} | } |
| |
inline CIMOperationRequestMessage* OperationAggregate::getRequest() |
inline CIMOperationRequestMessage* OperationAggregate::getRequest() const |
{ | { |
return _request; | return _request; |
} | } |
|
|
return _msgRequestType; | return _msgRequestType; |
} | } |
| |
|
inline bool OperationAggregate::isPullOperation() const |
|
{ |
|
return _pullOperation; |
|
} |
|
|
|
/****************************************************************************** |
|
** |
|
** CIMOperationRequestDispatcher Class |
|
** |
|
******************************************************************************/ |
|
|
class PEGASUS_SERVER_LINKAGE CIMOperationRequestDispatcher : | class PEGASUS_SERVER_LINKAGE CIMOperationRequestDispatcher : |
public MessageQueueService | public MessageQueueService |
{ | { |
|
friend struct ProviderRequests; |
public: | public: |
| |
typedef MessageQueueService Base; | typedef MessageQueueService Base; |
|
|
void handleInvokeMethodRequest( | void handleInvokeMethodRequest( |
CIMInvokeMethodRequestMessage* request); | CIMInvokeMethodRequestMessage* request); |
| |
|
// EXP_PULL_BEGIN |
|
bool handleOpenEnumerateInstancesRequest( |
|
CIMOpenEnumerateInstancesRequestMessage* request); |
|
|
|
bool handleOpenEnumerateInstancePathsRequest( |
|
CIMOpenEnumerateInstancePathsRequestMessage* request); |
|
|
|
bool handleOpenReferenceInstancesRequest( |
|
CIMOpenReferenceInstancesRequestMessage* request); |
|
|
|
bool handleOpenReferenceInstancePathsRequest( |
|
CIMOpenReferenceInstancePathsRequestMessage* request); |
|
|
|
bool handleOpenAssociatorInstancesRequest( |
|
CIMOpenAssociatorInstancesRequestMessage* request); |
|
|
|
bool handleOpenAssociatorInstancePathsRequest( |
|
CIMOpenAssociatorInstancePathsRequestMessage* request); |
|
|
|
bool handleOpenQueryInstancesRequest( |
|
CIMOpenQueryInstancesRequestMessage* request); |
|
|
|
bool handlePullInstancesWithPath( |
|
CIMPullInstancesWithPathRequestMessage* request); |
|
|
|
bool handlePullInstancePaths( |
|
CIMPullInstancePathsRequestMessage* request); |
|
|
|
bool handlePullInstances( |
|
CIMPullInstancesRequestMessage* request); |
|
|
|
void handleCloseEnumeration( |
|
CIMCloseEnumerationRequestMessage* request); |
|
|
|
void handleEnumerationCount( |
|
CIMEnumerationCountRequestMessage* request); |
|
|
|
// EXP_PULL END |
|
|
|
/** Common Request handling for ExecQuery and OpenQueryRequests. |
|
This function gets the provider list, get instances from the |
|
repository and calls the required providers. |
|
|
|
@param request CIMExecQueryRequestMessage. The request being issued |
|
|
|
@param cimException CIMException - Contains an exception if |
|
the processing fails and the return from the function is false. |
|
|
|
@param enumerationContext* EnumertionContext if this is a |
|
pull operation or NULL if not. |
|
|
|
@param queryLanguage const char* defining query language (ex. |
|
"WQL") |
|
|
|
@return bool true if processing completed successfully or |
|
false if there is an error. cimException contains CIMException |
|
if return is false. |
|
*/ |
|
bool handleQueryRequestCommon( |
|
CIMExecQueryRequestMessage* request, |
|
CIMException& cimException, |
|
EnumerationContext* enumerationContext, |
|
const char* queryLanguage, |
|
const CIMName& className, |
|
QueryExpressionRep* qx); |
|
|
|
|
|
/** Callback from Providers, etc. This callback is used for |
|
Operations that aggregate response information. This is the |
|
callback pointer used by the _forwardForAggregation |
|
function. |
|
@param AsyncOpNode * |
|
@param MessageQueue* |
|
@param userParam Pointer to data that is transparently |
|
carrried through the call to callback process. It contains |
|
a pointer to the OperationAggregate. |
|
*/ |
static void _forwardForAggregationCallback( | static void _forwardForAggregationCallback( |
AsyncOpNode*, | AsyncOpNode*, |
MessageQueue*, | MessageQueue*, |
void*); | void*); |
| |
|
/** Callback from providers etc. for operations that do not |
|
aggregate response. This callback pointer used by |
|
_forwardToProvider functions. |
|
@param AsyncOpNode * |
|
@param MessageQueue* |
|
@param userParam Contains the request message |
|
*/ |
static void _forwardRequestCallback( | static void _forwardRequestCallback( |
AsyncOpNode*, | AsyncOpNode*, |
MessageQueue*, | MessageQueue*, |
|
|
| |
void handleExecQueryResponseAggregation(OperationAggregate* poA); | void handleExecQueryResponseAggregation(OperationAggregate* poA); |
| |
|
// Issue RequestToProvider Functions |
|
void issueRequestsToProviders(CIMEnumerateInstancesRequestMessage* request, |
|
Uint32 numberOfClasses, |
|
ProviderInfoList& providerInfos, |
|
OperationAggregate* poA); |
|
|
protected: | protected: |
| |
/** _getSubClassNames - Gets the names of all subclasses of the defined | /** _getSubClassNames - Gets the names of all subclasses of the defined |
|
|
/*Forward the response defined for aggregation processing | /*Forward the response defined for aggregation processing |
and queue for output. Note this function is called | and queue for output. Note this function is called |
when a response that should be processed through the | when a response that should be processed through the |
aggregator already exists. |
aggregator already exists. It just queues the response because |
|
one exists. |
*/ | */ |
void _forwardResponseForAggregation( | void _forwardResponseForAggregation( |
CIMOperationRequestMessage* request, | CIMOperationRequestMessage* request, |
|
|
| |
/* | /* |
Forward a request for aggregation. This is the path used | Forward a request for aggregation. This is the path used |
to forward aggregationoperation requests to providers, |
to forward aggregating operation requests to providers, |
control providers, and services | control providers, and services |
*/ | */ |
void _forwardRequestForAggregation( |
void _forwardAggregatingRequestToProvider( |
const ProviderInfo& providerInfo, | const ProviderInfo& providerInfo, |
CIMOperationRequestMessage* request, | CIMOperationRequestMessage* request, |
OperationAggregate* poA); | OperationAggregate* poA); |
| |
/* Commmon aggregating function used by both _forwardResponseForAggregation | /* Commmon aggregating function used by both _forwardResponseForAggregation |
and _forwardRequestForAggregation above. |
and _forwardRequestForAggregation above. This is an inline function |
|
//// FUTURE we should be able to eliminate this one completely |
|
//// in favor of the one above. Also change the name. |
*/ | */ |
void _forwardRequestForAggregation( | void _forwardRequestForAggregation( |
Uint32 serviceId, | Uint32 serviceId, |
|
|
OperationAggregate* poA, | OperationAggregate* poA, |
CIMResponseMessage* response = 0); | CIMResponseMessage* response = 0); |
| |
void _forwardRequestToProvider( |
void _forwardRequestToSingleProvider( |
const ProviderInfo& providerInfo, | const ProviderInfo& providerInfo, |
CIMOperationRequestMessage* request, | CIMOperationRequestMessage* request, |
CIMOperationRequestMessage* requestCopy); | CIMOperationRequestMessage* requestCopy); |
|
|
// pattern of returning true if the test fails so that the main | // pattern of returning true if the test fails so that the main |
// function must test the result and return. This allows putting | // function must test the result and return. This allows putting |
// the trace method return into the CIMOperationRequestDispatcher main. | // the trace method return into the CIMOperationRequestDispatcher main. |
|
// |
|
// EXP_PULL_BEGIN |
|
|
|
bool _rejectIfPullParametersFailTests( |
|
CIMOpenOperationRequestMessage* request, |
|
Uint32& operationMaxObjectCount); |
|
|
|
bool _rejectIfContinueOnError(CIMOperationRequestMessage* request, |
|
Boolean continueOnError); |
|
|
|
bool _rejectInvalidFilterParameters(CIMOperationRequestMessage* request, |
|
const String& filterQueryLanguageParam, |
|
const String& filterQueryParam); |
|
|
|
bool _rejectInvalidMaxObjectCountParam( |
|
CIMOperationRequestMessage* request, |
|
const Uint32 maxObjectCountParam, |
|
bool requiredParameter, |
|
Uint32& value, |
|
const Uint32 defaultValue); |
|
|
|
bool _rejectInvalidOperationTimeout(CIMOperationRequestMessage* request, |
|
const Uint32Arg& operationTimeout); |
|
|
|
bool _rejectInvalidEnumerationContext( |
|
CIMOperationRequestMessage* request, |
|
EnumerationContext* enumerationContext); |
|
|
|
bool _rejectIfContextTimedOut(CIMOperationRequestMessage* request, |
|
Boolean isTimedOut); |
|
|
|
bool _rejectInvalidPullRequest(CIMOperationRequestMessage* request, |
|
Boolean valid); |
|
|
|
bool _rejectIfEnumerationContextProcessing( |
|
CIMOperationRequestMessage* request, |
|
Boolean processing); |
|
// EXP_PULL_END |
| |
Boolean _rejectAssociationTraversalDisabled( | Boolean _rejectAssociationTraversalDisabled( |
CIMOperationRequestMessage* request, | CIMOperationRequestMessage* request, |
|
|
Boolean _rejectInvalidClassParameter(CIMOperationRequestMessage* request, | Boolean _rejectInvalidClassParameter(CIMOperationRequestMessage* request, |
CIMConstClass& targetClass); | CIMConstClass& targetClass); |
| |
|
void _rejectCreateContextFailed(CIMOperationRequestMessage* request); |
|
|
/**Equivalent to _rejectInvalidClassParameter above except that | /**Equivalent to _rejectInvalidClassParameter above except that |
it included objecName parameter | it included objecName parameter |
| |
|
|
const CIMNamespaceName& nameSpace, | const CIMNamespaceName& nameSpace, |
const CIMObjectPath& objectName); | const CIMObjectPath& objectName); |
| |
|
/* generate and return the required exception if this test fails |
|
|
|
*/ |
|
Boolean _CIMExceptionIfNoProvidersOrRepository( |
|
CIMOperationRequestMessage* request, |
|
const ProviderInfoList& providerInfos, |
|
CIMException& cimException); |
/** | /** |
Reject if no providers or repository for this class | Reject if no providers or repository for this class |
*/ | */ |
|
|
const ProviderInfoList&); | const ProviderInfoList&); |
| |
/** | /** |
Checks whether the number of providers required to complete an |
Reject if the number of providers required to complete an |
operation is greater than the maximum allowed. | operation is greater than the maximum allowed. |
@param nameSpace The target namespace of the operation. | @param nameSpace The target namespace of the operation. |
@param className The name of the class specified in the request. | @param className The name of the class specified in the request. |
|
|
things like this, simply return no objects. On the other hand | things like this, simply return no objects. On the other hand |
This is a real boundary condition for the server where the | This is a real boundary condition for the server where the |
repository is not to be used and there are NO providers registered. | repository is not to be used and there are NO providers registered. |
TODO - Check if this is really valid |
KS_TODO - Check if this is really valid |
*/ | */ |
Boolean _checkNoProvidersOrRepository(CIMOperationRequestMessage* request, | Boolean _checkNoProvidersOrRepository(CIMOperationRequestMessage* request, |
Uint32 providerCount, const CIMName& className); | Uint32 providerCount, const CIMName& className); |
| |
|
|
Boolean _forwardEnumerationToProvider( | Boolean _forwardEnumerationToProvider( |
ProviderInfo &providerInfo, | ProviderInfo &providerInfo, |
OperationAggregate* poA, | OperationAggregate* poA, |
|
|
// response. | // response. |
Uint32 _maximumEnumerateBreadth; | Uint32 _maximumEnumerateBreadth; |
| |
|
// Define the maximum number of objects that the system will accept |
|
// for pull operation input parameter. |
|
Uint32 _systemMaxPullOperationObjectCount; |
|
|
|
// Define whether the system will accept the value zero as a valid |
|
// pull interoperation timeout. Since the value of zero disables the |
|
// timer this would mean that the system operates with no timeout |
|
// between pull operations. This should be somewhere externally as |
|
// a configuration parameter |
|
Boolean _rejectZeroOperationTimeoutValue; |
|
|
|
// Value for maximum timeout for pull operations. If this value is |
|
// exceeded, the operation request will be rejected. |
|
Uint32 _pullOperationMaxTimeout; |
|
|
|
// Value for default operationTimeout for open operations if no |
|
// value is supplied with the open request. |
|
Uint32 _pullOperationDefaultTimeout; |
|
|
Uint32 _providerManagerServiceId; | Uint32 _providerManagerServiceId; |
|
|
#ifdef PEGASUS_ENABLE_OBJECT_NORMALIZATION | #ifdef PEGASUS_ENABLE_OBJECT_NORMALIZATION |
Array<String> _excludeModulesFromNormalization; | Array<String> _excludeModulesFromNormalization; |
#endif | #endif |
|
|
OperationAggregate* poA, | OperationAggregate* poA, |
ProviderInfoList& providerInfos); | ProviderInfoList& providerInfos); |
| |
|
void _issueImmediateOpenOrPullResponseMessage( |
|
CIMOperationRequestMessage* request, |
|
CIMOpenOrPullResponseDataMessage* response, |
|
EnumerationContext* en, |
|
Uint32 operationMaxObjectCount); |
|
|
|
bool issueOpenOrPullResponseMessage( |
|
CIMOperationRequestMessage* openRequest, |
|
CIMOpenOrPullResponseDataMessage* openResponse, |
|
EnumerationContext* en, |
|
Uint32 operationMaxObjectCount, |
|
Boolean requireCompleteResponses); |
|
|
private: | private: |
static void _handle_enqueue_callback(AsyncOpNode*, MessageQueue*, void*); | static void _handle_enqueue_callback(AsyncOpNode*, MessageQueue*, void*); |
| |
|
|
ProviderInfoList& providerInfos, | ProviderInfoList& providerInfos, |
CIMResponseMessage* response); | CIMResponseMessage* response); |
| |
|
/** |
|
Complete processing for the pull operations, pullInstancesWithPath |
|
and Pull InstancePaths. This function replaces all the code in the |
|
pull functions including the input checking code because the pull operations |
|
are exactly the same except for the response object type. |
|
@param this - Pointer to the CIMOperationRequestDispatcher object. |
|
Required to execute dispatcher methods |
|
@param request CIMPullOperationRequestMessage* Defines the pull |
|
request message pointer |
|
@param pullResponse - AutoPtr<CIMOpenOrPullResponseDataMessage>& defines the |
|
response message for this pull response |
|
@param requestName - String with the request name. Used internally for |
|
traces, etc. |
|
*/ |
|
bool processPullRequest( |
|
CIMPullOperationRequestMessage* request, |
|
CIMOpenOrPullResponseDataMessage* pullResponse, |
|
const char * requestName); |
|
// EXP_PULL_BEGIN |
|
|
|
// pointer to EnumerationContextTable which allocates |
|
// and releases enumeration context objects. |
|
EnumerationContextTable *_enumerationContextTable; |
|
// EXP_PULL END |
|
|
// Pointer to internal RoutingTable for Control Providers and Services | // Pointer to internal RoutingTable for Control Providers and Services |
DynamicRoutingTable *_routing_table; | DynamicRoutingTable *_routing_table; |
|
|
|
// internal bool that defines whether handleEnqueue will delete |
|
// the original request. Used because in some cases the handler |
|
// retains the request beyond the life of the handleEnqueue call. |
|
bool _deleteRequestRequired; |
}; | }; |
| |
// Forward response to Common Request Aggregator. This is simply | // Forward response to Common Request Aggregator. This is simply |
// a syntatic simplification. |
// a syntatic simplification that sends the response directly to the |
|
// aggregation component because a response exists. |
inline void CIMOperationRequestDispatcher::_forwardResponseForAggregation( | inline void CIMOperationRequestDispatcher::_forwardResponseForAggregation( |
CIMOperationRequestMessage* request, | CIMOperationRequestMessage* request, |
OperationAggregate* poA, | OperationAggregate* poA, |
|
|
/* | /* |
For request for aggregation with poA as parameter. | For request for aggregation with poA as parameter. |
*/ | */ |
inline void CIMOperationRequestDispatcher::_forwardRequestForAggregation( |
inline void CIMOperationRequestDispatcher::_forwardAggregatingRequestToProvider( |
const ProviderInfo& providerInfo, | const ProviderInfo& providerInfo, |
CIMOperationRequestMessage* request, | CIMOperationRequestMessage* request, |
OperationAggregate* poA) | OperationAggregate* poA) |