version 1.25, 2006/02/17 19:20:11
|
version 1.26, 2006/02/24 19:16:28
|
|
|
public: | public: |
OutstandingRequestEntry( | OutstandingRequestEntry( |
String messageId_, | String messageId_, |
|
CIMRequestMessage* requestMessage_, |
CIMResponseMessage*& responseMessage_, | CIMResponseMessage*& responseMessage_, |
Semaphore* responseReady_) | Semaphore* responseReady_) |
: messageId(messageId_), | : messageId(messageId_), |
|
requestMessage(requestMessage_), |
responseMessage(responseMessage_), | responseMessage(responseMessage_), |
responseReady(responseReady_) | responseReady(responseReady_) |
{ | { |
} | } |
| |
String messageId; | String messageId; |
|
CIMRequestMessage* requestMessage; |
CIMResponseMessage*& responseMessage; | CIMResponseMessage*& responseMessage; |
Semaphore* responseReady; | Semaphore* responseReady; |
}; | }; |
|
|
ProviderAgentContainer( | ProviderAgentContainer( |
const String & moduleName, | const String & moduleName, |
const String & userName, | const String & userName, |
PEGASUS_INDICATION_CALLBACK indicationCallback, |
PEGASUS_INDICATION_CALLBACK_T indicationCallback, |
|
PEGASUS_RESPONSE_CHUNK_CALLBACK_T responseChunkCallback, |
Boolean subscriptionInitComplete); | Boolean subscriptionInitComplete); |
| |
~ProviderAgentContainer(); | ~ProviderAgentContainer(); |
|
|
Callback function to which all generated indications are sent for | Callback function to which all generated indications are sent for |
processing. | processing. |
*/ | */ |
PEGASUS_INDICATION_CALLBACK _indicationCallback; |
PEGASUS_INDICATION_CALLBACK_T _indicationCallback; |
|
|
|
/** |
|
Callback function to which response chunks are sent for processing. |
|
*/ |
|
PEGASUS_RESPONSE_CHUNK_CALLBACK_T _responseChunkCallback; |
| |
/** | /** |
Indicates whether the Provider Agent is active. | Indicates whether the Provider Agent is active. |
|
|
ProviderAgentContainer::ProviderAgentContainer( | ProviderAgentContainer::ProviderAgentContainer( |
const String & moduleName, | const String & moduleName, |
const String & userName, | const String & userName, |
PEGASUS_INDICATION_CALLBACK indicationCallback, |
PEGASUS_INDICATION_CALLBACK_T indicationCallback, |
|
PEGASUS_RESPONSE_CHUNK_CALLBACK_T responseChunkCallback, |
Boolean subscriptionInitComplete) | Boolean subscriptionInitComplete) |
: _moduleName(moduleName), | : _moduleName(moduleName), |
_userName(userName), | _userName(userName), |
_indicationCallback(indicationCallback), | _indicationCallback(indicationCallback), |
|
_responseChunkCallback(responseChunkCallback), |
_isInitialized(false), | _isInitialized(false), |
_subscriptionInitComplete(subscriptionInitComplete) | _subscriptionInitComplete(subscriptionInitComplete) |
{ | { |
|
|
// | // |
Semaphore waitSemaphore(0); | Semaphore waitSemaphore(0); |
OutstandingRequestEntry outstandingRequestEntry( | OutstandingRequestEntry outstandingRequestEntry( |
uniqueMessageId, response, &waitSemaphore); |
uniqueMessageId, request, response, &waitSemaphore); |
| |
// | // |
// Lock the Provider Agent Container while initializing the | // Lock the Provider Agent Container while initializing the |
|
|
reinterpret_cast<CIMProcessIndicationRequestMessage*>( | reinterpret_cast<CIMProcessIndicationRequestMessage*>( |
message)); | message)); |
} | } |
|
else if (!message->isComplete()) |
|
{ |
|
CIMResponseMessage* response; |
|
response = dynamic_cast<CIMResponseMessage*>(message); |
|
PEGASUS_ASSERT(response != 0); |
|
|
|
// Get the OutstandingRequestEntry for this response chunk |
|
OutstandingRequestEntry* _outstandingRequestEntry = 0; |
|
{ |
|
AutoMutex tableLock(_outstandingRequestTableMutex); |
|
Boolean foundEntry = _outstandingRequestTable.lookup( |
|
response->messageId, _outstandingRequestEntry); |
|
PEGASUS_ASSERT(foundEntry); |
|
} |
|
|
|
// Put the original message ID into the response |
|
response->messageId = |
|
_outstandingRequestEntry->requestMessage->messageId; |
|
|
|
// Call the response chunk callback to process the chunk |
|
_responseChunkCallback( |
|
_outstandingRequestEntry->requestMessage, response); |
|
} |
else | else |
{ | { |
CIMResponseMessage* response; | CIMResponseMessage* response; |
|
|
///////////////////////////////////////////////////////////////////////////// | ///////////////////////////////////////////////////////////////////////////// |
| |
OOPProviderManagerRouter::OOPProviderManagerRouter( | OOPProviderManagerRouter::OOPProviderManagerRouter( |
PEGASUS_INDICATION_CALLBACK indicationCallback) |
PEGASUS_INDICATION_CALLBACK_T indicationCallback, |
|
PEGASUS_RESPONSE_CHUNK_CALLBACK_T responseChunkCallback) |
{ | { |
PEG_METHOD_ENTER(TRC_PROVIDERMANAGER, | PEG_METHOD_ENTER(TRC_PROVIDERMANAGER, |
"OOPProviderManagerRouter::OOPProviderManagerRouter"); | "OOPProviderManagerRouter::OOPProviderManagerRouter"); |
| |
_indicationCallback = indicationCallback; | _indicationCallback = indicationCallback; |
|
_responseChunkCallback = responseChunkCallback; |
_subscriptionInitComplete = false; | _subscriptionInitComplete = false; |
| |
PEG_METHOD_EXIT(); | PEG_METHOD_EXIT(); |
|
|
if (!_providerAgentTable.lookup(key, pa)) | if (!_providerAgentTable.lookup(key, pa)) |
{ | { |
pa = new ProviderAgentContainer( | pa = new ProviderAgentContainer( |
moduleName, userName, _indicationCallback, |
moduleName, userName, _indicationCallback, _responseChunkCallback, |
_subscriptionInitComplete); | _subscriptionInitComplete); |
_providerAgentTable.insert(key, pa); | _providerAgentTable.insert(key, pa); |
} | } |