summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authormday <mday>2002-03-04 11:57:39 +0000
committermday <mday>2002-03-04 11:57:39 +0000
commit9ba9c8b4ef405b3be8facfc324f79fa20a1ee5b8 (patch)
treecf075b9b231aa44de2d3182b75e72a29d22b835b
parent93dc475bcc72669bdbf613076f748dc23980ff4b (diff)
downloadtog-pegasus-async_dispatcher.zip
tog-pegasus-async_dispatcher.tar.gz
tog-pegasus-async_dispatcher.tar.xz
*** empty log message ***async_dispatcher
-rw-r--r--src/Pegasus/Common/AsyncOpNode.h2
-rw-r--r--src/Pegasus/Common/Cimom.cpp8
-rw-r--r--src/Pegasus/Common/MessageQueue.cpp1
-rw-r--r--src/Pegasus/Common/MessageQueueService.cpp102
-rw-r--r--src/Pegasus/Common/MessageQueueService.h7
-rw-r--r--src/Pegasus/ProviderManager/ProviderManagerService.cpp2851
-rw-r--r--src/Pegasus/ProviderManager/ProviderManagerService.h17
-rw-r--r--src/Pegasus/Server/CIMOperationRequestDispatcher.cpp132
-rw-r--r--src/Pegasus/Server/CIMOperationRequestDispatcher.h3
9 files changed, 1744 insertions, 1379 deletions
diff --git a/src/Pegasus/Common/AsyncOpNode.h b/src/Pegasus/Common/AsyncOpNode.h
index 343cb4e..c6a0297 100644
--- a/src/Pegasus/Common/AsyncOpNode.h
+++ b/src/Pegasus/Common/AsyncOpNode.h
@@ -119,7 +119,7 @@ class PEGASUS_COMMON_LINKAGE AsyncOpNode
void wait(void);
- private:
+
Semaphore _client_sem;
Mutex _mut;
unlocked_dq<Message> _request;
diff --git a/src/Pegasus/Common/Cimom.cpp b/src/Pegasus/Common/Cimom.cpp
index 674974e..22bfc9c 100644
--- a/src/Pegasus/Common/Cimom.cpp
+++ b/src/Pegasus/Common/Cimom.cpp
@@ -356,21 +356,17 @@ void cimom::_completeAsyncResponse(AsyncRequest *request,
AsyncOpNode *op = request->op;
op->lock();
+ op->_state |= (state | ASYNC_OPSTATE_COMPLETE);
+ op->_flags |= flag;
if( op->_flags & ASYNC_OPFLAGS_FIRE_AND_FORGET )
{
-
// destructor empties request list
op->unlock();
-
delete op;
return;
}
-
-
- op->_state |= (state | ASYNC_OPSTATE_COMPLETE);
- op->_flags |= flag;
gettimeofday(&(op->_updated), NULL);
if ( op->_flags & ASYNC_OPFLAGS_SIMPLE_STATUS )
{
diff --git a/src/Pegasus/Common/MessageQueue.cpp b/src/Pegasus/Common/MessageQueue.cpp
index 785d284..38665f4 100644
--- a/src/Pegasus/Common/MessageQueue.cpp
+++ b/src/Pegasus/Common/MessageQueue.cpp
@@ -329,7 +329,6 @@ const char* MessageQueue::getQueueName() const
MessageQueue* MessageQueue::lookup(Uint32 queueId) throw(IPCException)
{
-
MessageQueue* queue = 0;
q_table_mut.lock(pegasus_thread_self());
diff --git a/src/Pegasus/Common/MessageQueueService.cpp b/src/Pegasus/Common/MessageQueueService.cpp
index 388459b..5d4f092 100644
--- a/src/Pegasus/Common/MessageQueueService.cpp
+++ b/src/Pegasus/Common/MessageQueueService.cpp
@@ -234,16 +234,16 @@ void MessageQueueService::_handle_incoming_operation(AsyncOpNode *operation,
Message *rq = operation->_request.next(0);
PEGASUS_ASSERT(rq != 0 );
-
- // divert legacy messages to handleEnqueue
- if ( ! (rq->getMask() & message_mask::ha_async) )
+
+ // divert "plain" legacy messages to handleEnqueue
+ if ( ! (rq->getMask() & message_mask::ha_async) )
{
-
rq = operation->_request.remove_first() ;
operation->unlock();
// delete the op node
delete operation;
+
// Attn: change to handleEnqueue(msg) when we have that method in all messagequeueservices
// make handleEnqueue pure virtual !!!
// << Fri Feb 22 13:39:09 2002 mdd >>
@@ -262,9 +262,6 @@ void MessageQueueService::_handle_incoming_operation(AsyncOpNode *operation,
}
-
-
-
void MessageQueueService::_handle_async_request(AsyncRequest *req)
{
if ( req != 0 )
@@ -571,26 +568,107 @@ void MessageQueueService::return_op(AsyncOpNode *op)
}
+void MessageQueueService::ReplyAsync(AsyncOpNode *op,
+ Uint32 destination)
+{
+ PEGASUS_ASSERT( op->_flags & ASYNC_OPFLAGS_CALLBACK );
+
+
+ // get the queue handle for the destination
+ if ( 0 == (op->_op_dest = MessageQueue::lookup(destination)))
+ {
+ delete op;
+ }
+
+ op->_response.next(0)->dest = destination;
+
+
+ op->_flags &= ~(ASYNC_OPFLAGS_FIRE_AND_FORGET);
+ op->_state |= ASYNC_OPSTATE_COMPLETE;
+
+ if ( false == _meta_dispatcher->route_async(op) )
+ delete op;
+ return;
+}
+
+
Boolean MessageQueueService::SendAsync(AsyncOpNode *op,
Uint32 destination,
void (*callback)(AsyncOpNode *,
MessageQueue *,
- void *))
+ void *),
+ void * parm)
{
- PEGASUS_ASSERT(op != 0 && callback != 0 );
+ PEGASUS_ASSERT( callback != 0 && op != 0 );
+
+ op->_callback_ptr = parm;
// get the queue handle for the destination
if ( 0 == (op->_op_dest = MessageQueue::lookup(destination)))
return false;
-
+ op->_request.next(0)->dest = destination;
+
op->_flags |= ASYNC_OPFLAGS_CALLBACK;
op->_flags &= ~(ASYNC_OPFLAGS_FIRE_AND_FORGET);
op->_state &= ~ASYNC_OPSTATE_COMPLETE;
-
return _meta_dispatcher->route_async(op);
}
+void MessageQueueService::ForwardRequest(AsyncOpNode *op, MessageQueue *dest)
+{
+
+ Message *msg = op->_request.next(0);
+ if ( msg == 0 )
+ {
+ delete op;
+ return;
+ }
+ msg->_async = 0;
+ msg->dest = dest->getQueueId();
+ if(msg->getMask() & message_mask::ha_async)
+ (static_cast<AsyncMessage *>(msg))->op = 0;
+
+ op->_flags |= ASYNC_OPFLAGS_FIRE_AND_FORGET;
+ op->_flags &= ~(ASYNC_OPFLAGS_CALLBACK | ASYNC_OPFLAGS_SIMPLE_STATUS);
+ op->_state &= ~ASYNC_OPSTATE_COMPLETE;
+
+ op->_op_dest = dest;
+
+ // now see if the meta dispatcher will take it
+ if( false == _meta_dispatcher->route_async(op))
+ delete op;
+
+ return;
+}
+
+
+void MessageQueueService::ForwardResponse(AsyncOpNode *op, MessageQueue *dest)
+{
+
+ Message *msg = op->_response.next(0);
+ if ( msg == 0 || dest == 0 )
+ {
+ delete op;
+ return;
+ }
+ msg->_async = 0;
+ msg->dest = dest->getQueueId();
+ if(msg->getMask() & message_mask::ha_async)
+ (static_cast<AsyncMessage *>(msg))->op = 0;
+
+ op->_flags |= ASYNC_OPFLAGS_FIRE_AND_FORGET;
+ op->_flags &= ~(ASYNC_OPFLAGS_CALLBACK | ASYNC_OPFLAGS_SIMPLE_STATUS);
+ op->_state &= ~ASYNC_OPSTATE_COMPLETE;
+
+ op->_op_dest = dest;
+
+ // now see if the meta dispatcher will take it
+ if( false == _meta_dispatcher->route_async(op))
+ delete op;
+
+ return;
+}
Boolean MessageQueueService::SendForget(Message *msg)
{
@@ -610,6 +688,8 @@ Boolean MessageQueueService::SendForget(Message *msg)
op->_request.insert_first(msg);
if (mask & message_mask::ha_async)
(static_cast<AsyncMessage *>(msg))->op = op;
+ else
+ msg->_async = 0;
}
op->_flags |= ASYNC_OPFLAGS_FIRE_AND_FORGET;
op->_flags &= ~(ASYNC_OPFLAGS_CALLBACK | ASYNC_OPFLAGS_SIMPLE_STATUS);
diff --git a/src/Pegasus/Common/MessageQueueService.h b/src/Pegasus/Common/MessageQueueService.h
index 20b8053..15bc51e 100644
--- a/src/Pegasus/Common/MessageQueueService.h
+++ b/src/Pegasus/Common/MessageQueueService.h
@@ -84,9 +84,12 @@ class PEGASUS_COMMON_LINKAGE MessageQueueService : public MessageQueue
AsyncReply *SendWait(AsyncRequest *request);
Boolean SendAsync(AsyncOpNode *op,
Uint32 destination,
- void (*callback)(AsyncOpNode *, MessageQueue *, void *));
+ void (*callback)(AsyncOpNode *, MessageQueue *, void *), void *);
+ void ReplyAsync(AsyncOpNode *op, Uint32 destination);
Boolean SendForget(Message *msg);
-
+ void ForwardRequest(AsyncOpNode *, MessageQueue *);
+ void ForwardResponse(AsyncOpNode *, MessageQueue *);
+
void _completeAsyncResponse(AsyncRequest *request,
AsyncReply *reply,
Uint32 state,
diff --git a/src/Pegasus/ProviderManager/ProviderManagerService.cpp b/src/Pegasus/ProviderManager/ProviderManagerService.cpp
index ff19501..9512331 100644
--- a/src/Pegasus/ProviderManager/ProviderManagerService.cpp
+++ b/src/Pegasus/ProviderManager/ProviderManagerService.cpp
@@ -42,7 +42,7 @@
PEGASUS_NAMESPACE_BEGIN
- static ProviderManager providerManager;
+static ProviderManager providerManager;
SafeMessageQueue::SafeMessageQueue(void)
{
@@ -54,104 +54,104 @@ SafeMessageQueue::~SafeMessageQueue(void)
void SafeMessageQueue::lock(void)
{
- _mutex.lock(pegasus_thread_self());
+ _mutex.lock(pegasus_thread_self());
}
void SafeMessageQueue::unlock(void)
{
- _mutex.unlock();
+ _mutex.unlock();
}
const Message * SafeMessageQueue::front(void)
{
- const Message * front = 0;
+ const Message * front = 0;
- try
- {
- lock();
+ try
+ {
+ lock();
- front = _stack.top();
+ front = _stack.top();
- unlock();
- }
- catch(...)
- {
- unlock();
- }
+ unlock();
+ }
+ catch(...)
+ {
+ unlock();
+ }
- return(front);
+ return(front);
}
void SafeMessageQueue::enqueue(Message * message)
{
- // do nothing for empty messages
- if(message == 0)
- {
- return;
- }
-
- try
- {
- lock();
-
- _stack.push(message);
-
- unlock();
- }
- catch(...)
- {
- unlock();
- }
+ // do nothing for empty messages
+ if(message == 0)
+ {
+ return;
+ }
+
+ try
+ {
+ lock();
+
+ _stack.push(message);
+
+ unlock();
+ }
+ catch(...)
+ {
+ unlock();
+ }
}
Message * SafeMessageQueue::dequeue(void)
{
- Message * front = 0;
+ Message * front = 0;
- try
- {
- lock();
+ try
+ {
+ lock();
- front = _stack.top();
+ front = _stack.top();
- _stack.pop();
+ _stack.pop();
- unlock();
- }
- catch(...)
- {
- unlock();
- }
+ unlock();
+ }
+ catch(...)
+ {
+ unlock();
+ }
- return(front);
+ return(front);
}
class Status
{
-public:
- Status(void)
- : _code(0), _message("")
- {
- }
-
- Status(const Uint32 code, const String & message)
- : _code(code), _message(message)
- {
- }
-
- Uint32 getCode(void) const
- {
- return(_code);
- }
-
- String getMessage(void) const
- {
- return(_message);
- }
-
-private:
- Uint32 _code;
- String _message;
+ public:
+ Status(void)
+ : _code(0), _message("")
+ {
+ }
+
+ Status(const Uint32 code, const String & message)
+ : _code(code), _message(message)
+ {
+ }
+
+ Uint32 getCode(void) const
+ {
+ return(_code);
+ }
+
+ String getMessage(void) const
+ {
+ return(_message);
+ }
+
+ private:
+ Uint32 _code;
+ String _message;
};
@@ -160,9 +160,9 @@ static struct timeval dwait = { 10, 0};
static struct timeval deadwait = { 1, 0};
ProviderManagerService::ProviderManagerService(void)
- : MessageQueueService("Server::ProviderManagerService", MessageQueue::getNextQueueId()),
- _threadPool(10, "ProviderManagerService", 5, 15, await, dwait, deadwait),
- _threadSemaphore(0)
+ : MessageQueueService("Server::ProviderManagerService", MessageQueue::getNextQueueId()),
+ _threadPool(10, "ProviderManagerService", 5, 15, await, dwait, deadwait),
+ _threadSemaphore(0)
{
}
@@ -172,1416 +172,1563 @@ ProviderManagerService::~ProviderManagerService(void)
ProviderManager * ProviderManagerService::getProviderManager(void)
{
- return(&providerManager);
+ return(&providerManager);
}
Pair<String, String> ProviderManagerService::_lookupProviderForClass(const CIMObjectPath & objectPath)
{
- // get target queue id
- Uint32 targetQueueId = 0;
-
- {
- MessageQueue * queue = MessageQueue::lookup("Server::ConfigurationManagerQueue");
-
- PEGASUS_ASSERT(queue != 0);
-
- targetQueueId = queue->getQueueId();
- }
-
- // get source queue id
- Uint32 sourceQueueId = 0;
-
- {
- MessageQueue * queue = MessageQueue::lookup("Server::ProviderManagerService");
-
- PEGASUS_ASSERT(queue != 0);
-
- sourceQueueId = queue->getQueueId();
- }
-
- // get all CIM_ProviderElementCapabilities instances
- Array<CIMInstance> providerElementCapabilitiesInstances;
-
- {
- // create request
- CIMRequestMessage * request = new CIMEnumerateInstancesRequestMessage(
- "golden snitch",
- objectPath.getNameSpace(),
- "CIM_ProviderElementCapabilities",
- false,
- false,
- false,
- false,
- Array<String>(),
- QueueIdStack(targetQueueId, sourceQueueId));
-
- // << Tue Feb 12 08:29:38 2002 mdd >> example of conversion to meta dispatcher
- // automatically initializes backpointer
- AsyncLegacyOperationStart * async_req = new AsyncLegacyOperationStart(
- get_next_xid(),
- 0,
- targetQueueId,
- request,
- sourceQueueId);
-
- // send request and wait for response
- AsyncReply * async_reply = SendWait(async_req);
-
- CIMEnumerateInstancesResponseMessage * response =
- reinterpret_cast<CIMEnumerateInstancesResponseMessage *>
- ((static_cast<AsyncLegacyOperationResult *>(async_reply))->get_result());
-
- delete async_req;
- delete async_reply;
-
- // ATTN: temporary fix until CIMNamedInstance is removed
- for(Uint32 i = 0, n = response->cimNamedInstances.size(); i < n; i++)
- {
- providerElementCapabilitiesInstances.append(response->cimNamedInstances[i].getInstance());
- }
- }
-
- for(Uint32 i = 0, n = providerElementCapabilitiesInstances.size(); i < n; i++)
- {
- // get the associated CIM_ProviderCapabilities instance
- CIMInstance providerCapabilitiesInstance;
-
- {
- // the object path of the associated instance is in the 'Capabilities' property
- Uint32 pos = providerElementCapabilitiesInstances[i].findProperty("Capabilities");
-
- PEGASUS_ASSERT(pos != PEG_NOT_FOUND);
-
- CIMReference cimReference = providerElementCapabilitiesInstances[i].getProperty(pos).getValue().toString();
-
- // create request
- CIMRequestMessage * request = new CIMGetInstanceRequestMessage(
- "golden snitch",
- objectPath.getNameSpace(),
- cimReference,
- false,
- false,
- false,
- Array<String>(),
- QueueIdStack(targetQueueId, sourceQueueId));
-
- // << Tue Feb 12 08:29:38 2002 mdd >> example of conversion to meta dispatcher
- // automatically initializes backpointer
- AsyncLegacyOperationStart * async_req = new AsyncLegacyOperationStart(
- get_next_xid(),
- 0,
- targetQueueId,
- request,
- sourceQueueId);
-
- // send request and wait for response
- AsyncReply * async_reply = SendWait(async_req);
-
- CIMGetInstanceResponseMessage * response =
- reinterpret_cast<CIMGetInstanceResponseMessage *>
- ((static_cast<AsyncLegacyOperationResult *>(async_reply))->get_result());
-
- delete async_req;
- delete async_reply;
-
- providerCapabilitiesInstance = response->cimInstance;
- }
-
- try
- {
- // get the ClassName property value from the instance
- Uint32 pos = providerCapabilitiesInstance.findProperty("ClassName");
-
- PEGASUS_ASSERT(pos != PEG_NOT_FOUND);
-
- // compare the property value with the requested class name
- if(!String::equalNoCase(objectPath.getClassName(), providerCapabilitiesInstance.getProperty(pos).getValue().toString()))
- {
- // go to the next CIM_ProviderCapabilities instance
- continue;
- }
- }
- catch(...)
- {
- // instance or property error, use different technique
- break;
- }
-
- // get the associated CIM_Provider instance
- CIMInstance providerInstance;
-
- {
- // the object path of the associated instance is in the 'ManagedElement' property
- Uint32 pos = providerElementCapabilitiesInstances[i].findProperty("ManagedElement");
-
- PEGASUS_ASSERT(pos != PEG_NOT_FOUND);
-
- CIMReference cimReference = providerElementCapabilitiesInstances[i].getProperty(pos).getValue().toString();
-
- // create request
- CIMRequestMessage * request = new CIMGetInstanceRequestMessage(
- "golden snitch",
- objectPath.getNameSpace(),
- cimReference,
- false,
- false,
- false,
- Array<String>(),
- QueueIdStack(targetQueueId, sourceQueueId));
-
- // << Tue Feb 12 08:29:38 2002 mdd >> example of conversion to meta dispatcher
- // automatically initializes backpointer
- AsyncLegacyOperationStart * async_req = new AsyncLegacyOperationStart(
- get_next_xid(),
- 0,
- targetQueueId,
- request,
- sourceQueueId);
-
- // send request and wait for response
- AsyncReply * async_reply = SendWait(async_req);
-
- CIMGetInstanceResponseMessage * response =
- reinterpret_cast<CIMGetInstanceResponseMessage *>
- ((static_cast<AsyncLegacyOperationResult *>(async_reply))->get_result());
-
- delete async_req;
- delete async_reply;
-
- providerInstance = response->cimInstance;
- }
-
- // extract provider information
- String providerName = providerInstance.getProperty(providerInstance.findProperty("Name")).getValue().toString();
- String providerLocation = providerInstance.getProperty(providerInstance.findProperty("Location")).getValue().toString();
-
- if((providerName.size() != 0) && (providerLocation.size() != 0))
- {
- String fileName;
-
- //
- // translate the provider identifier into a file name
- //
- #ifdef PEGASUS_OS_TYPE_WINDOWS
- fileName = providerLocation + String(".dll");
- #elif defined(PEGASUS_OS_HPUX)
- fileName = ConfigManager::getHomedPath(
- ConfigManager::getInstance()->getCurrentValue("providerDir")) +
- String("/lib") + providerName + String(".sl");
- #else
- fileName = ConfigManager::getHomedPath(
- ConfigManager::getInstance()->getCurrentValue("providerDir")) +
- String("/lib") + providerName + String(".so");
- #endif
-
- return(Pair<String, String>(fileName, providerName));
- }
-
- break;
- }
-
- return(Pair<String, String>(String::EMPTY, String::EMPTY));
+ // get target queue id
+ Uint32 targetQueueId = 0;
+
+ {
+ MessageQueue * queue = MessageQueue::lookup("Server::ConfigurationManagerQueue");
+
+ PEGASUS_ASSERT(queue != 0);
+
+ targetQueueId = queue->getQueueId();
+ }
+
+ // get source queue id
+ Uint32 sourceQueueId = 0;
+
+ {
+ MessageQueue * queue = MessageQueue::lookup("Server::ProviderManagerService");
+
+ PEGASUS_ASSERT(queue != 0);
+
+ sourceQueueId = queue->getQueueId();
+ }
+
+ // get all CIM_ProviderElementCapabilities instances
+ Array<CIMInstance> providerElementCapabilitiesInstances;
+
+ {
+ // create request
+ CIMRequestMessage * request = new CIMEnumerateInstancesRequestMessage(
+ "golden snitch",
+ objectPath.getNameSpace(),
+ "CIM_ProviderElementCapabilities",
+ false,
+ false,
+ false,
+ false,
+ Array<String>(),
+ QueueIdStack(targetQueueId, sourceQueueId));
+
+ // << Tue Feb 12 08:29:38 2002 mdd >> example of conversion to meta dispatcher
+ // automatically initializes backpointer
+ AsyncLegacyOperationStart * async_req = new AsyncLegacyOperationStart(
+ get_next_xid(),
+ 0,
+ targetQueueId,
+ request,
+ sourceQueueId);
+
+ // send request and wait for response
+ AsyncReply * async_reply = SendWait(async_req);
+
+ CIMEnumerateInstancesResponseMessage * response =
+ reinterpret_cast<CIMEnumerateInstancesResponseMessage *>
+ ((static_cast<AsyncLegacyOperationResult *>(async_reply))->get_result());
+
+ delete async_req;
+ delete async_reply;
+
+ // ATTN: temporary fix until CIMNamedInstance is removed
+ for(Uint32 i = 0, n = response->cimNamedInstances.size(); i < n; i++)
+ {
+ providerElementCapabilitiesInstances.append(response->cimNamedInstances[i].getInstance());
+ }
+ }
+
+ for(Uint32 i = 0, n = providerElementCapabilitiesInstances.size(); i < n; i++)
+ {
+ // get the associated CIM_ProviderCapabilities instance
+ CIMInstance providerCapabilitiesInstance;
+
+ {
+ // the object path of the associated instance is in the 'Capabilities' property
+ Uint32 pos = providerElementCapabilitiesInstances[i].findProperty("Capabilities");
+
+ PEGASUS_ASSERT(pos != PEG_NOT_FOUND);
+
+ CIMReference cimReference = providerElementCapabilitiesInstances[i].getProperty(pos).getValue().toString();
+
+ // create request
+ CIMRequestMessage * request = new CIMGetInstanceRequestMessage(
+ "golden snitch",
+ objectPath.getNameSpace(),
+ cimReference,
+ false,
+ false,
+ false,
+ Array<String>(),
+ QueueIdStack(targetQueueId, sourceQueueId));
+
+ // << Tue Feb 12 08:29:38 2002 mdd >> example of conversion to meta dispatcher
+ // automatically initializes backpointer
+ AsyncLegacyOperationStart * async_req = new AsyncLegacyOperationStart(
+ get_next_xid(),
+ 0,
+ targetQueueId,
+ request,
+ sourceQueueId);
+
+ // send request and wait for response
+ AsyncReply * async_reply = SendWait(async_req);
+
+ CIMGetInstanceResponseMessage * response =
+ reinterpret_cast<CIMGetInstanceResponseMessage *>
+ ((static_cast<AsyncLegacyOperationResult *>(async_reply))->get_result());
+
+ delete async_req;
+ delete async_reply;
+
+ providerCapabilitiesInstance = response->cimInstance;
+ }
+
+ try
+ {
+ // get the ClassName property value from the instance
+ Uint32 pos = providerCapabilitiesInstance.findProperty("ClassName");
+
+ PEGASUS_ASSERT(pos != PEG_NOT_FOUND);
+
+ // compare the property value with the requested class name
+ if(!String::equalNoCase(objectPath.getClassName(), providerCapabilitiesInstance.getProperty(pos).getValue().toString()))
+ {
+ // go to the next CIM_ProviderCapabilities instance
+ continue;
+ }
+ }
+ catch(...)
+ {
+ // instance or property error, use different technique
+ break;
+ }
+
+ // get the associated CIM_Provider instance
+ CIMInstance providerInstance;
+
+ {
+ // the object path of the associated instance is in the 'ManagedElement' property
+ Uint32 pos = providerElementCapabilitiesInstances[i].findProperty("ManagedElement");
+
+ PEGASUS_ASSERT(pos != PEG_NOT_FOUND);
+
+ CIMReference cimReference = providerElementCapabilitiesInstances[i].getProperty(pos).getValue().toString();
+
+ // create request
+ CIMRequestMessage * request = new CIMGetInstanceRequestMessage(
+ "golden snitch",
+ objectPath.getNameSpace(),
+ cimReference,
+ false,
+ false,
+ false,
+ Array<String>(),
+ QueueIdStack(targetQueueId, sourceQueueId));
+
+ // << Tue Feb 12 08:29:38 2002 mdd >> example of conversion to meta dispatcher
+ // automatically initializes backpointer
+ AsyncLegacyOperationStart * async_req = new AsyncLegacyOperationStart(
+ get_next_xid(),
+ 0,
+ targetQueueId,
+ request,
+ sourceQueueId);
+
+ // send request and wait for response
+ AsyncReply * async_reply = SendWait(async_req);
+
+ CIMGetInstanceResponseMessage * response =
+ reinterpret_cast<CIMGetInstanceResponseMessage *>
+ ((static_cast<AsyncLegacyOperationResult *>(async_reply))->get_result());
+
+ delete async_req;
+ delete async_reply;
+
+ providerInstance = response->cimInstance;
+ }
+
+ // extract provider information
+ String providerName = providerInstance.getProperty(providerInstance.findProperty("Name")).getValue().toString();
+ String providerLocation = providerInstance.getProperty(providerInstance.findProperty("Location")).getValue().toString();
+
+ if((providerName.size() != 0) && (providerLocation.size() != 0))
+ {
+ String fileName;
+
+ //
+ // translate the provider identifier into a file name
+ //
+#ifdef PEGASUS_OS_TYPE_WINDOWS
+ fileName = providerLocation + String(".dll");
+#elif defined(PEGASUS_OS_HPUX)
+ fileName = ConfigManager::getHomedPath(
+ ConfigManager::getInstance()->getCurrentValue("providerDir")) +
+ String("/lib") + providerName + String(".sl");
+#else
+ fileName = ConfigManager::getHomedPath(
+ ConfigManager::getInstance()->getCurrentValue("providerDir")) +
+ String("/lib") + providerName + String(".so");
+#endif
+
+ return(Pair<String, String>(fileName, providerName));
+ }
+
+ break;
+ }
+
+ return(Pair<String, String>(String::EMPTY, String::EMPTY));
}
Boolean ProviderManagerService::messageOK(const Message * message)
{
- PEGASUS_ASSERT(message != 0);
+ PEGASUS_ASSERT(message != 0);
- return(MessageQueueService::messageOK(message));
+ return(MessageQueueService::messageOK(message));
/*
- Boolean rc = false;
+ Boolean rc = false;
- switch(message->getType())
- {
- case CIM_GET_INSTANCE_REQUEST_MESSAGE:
- case CIM_ENUMERATE_INSTANCES_REQUEST_MESSAGE:
- case CIM_ENUMERATE_INSTANCE_NAMES_REQUEST_MESSAGE:
- case CIM_CREATE_INSTANCE_REQUEST_MESSAGE:
- case CIM_MODIFY_INSTANCE_REQUEST_MESSAGE:
- case CIM_DELETE_INSTANCE_REQUEST_MESSAGE:
- case CIM_GET_PROPERTY_REQUEST_MESSAGE:
- case CIM_SET_PROPERTY_REQUEST_MESSAGE:
- case CIM_INVOKE_METHOD_REQUEST_MESSAGE:
- case CIM_ENABLE_INDICATION_SUBSCRIPTION_REQUEST_MESSAGE:
- case CIM_MODIFY_INDICATION_SUBSCRIPTION_REQUEST_MESSAGE:
- case CIM_DISABLE_INDICATION_SUBSCRIPTION_REQUEST_MESSAGE:
- rc = true;
+ switch(message->getType())
+ {
+ case CIM_GET_INSTANCE_REQUEST_MESSAGE:
+ case CIM_ENUMERATE_INSTANCES_REQUEST_MESSAGE:
+ case CIM_ENUMERATE_INSTANCE_NAMES_REQUEST_MESSAGE:
+ case CIM_CREATE_INSTANCE_REQUEST_MESSAGE:
+ case CIM_MODIFY_INSTANCE_REQUEST_MESSAGE:
+ case CIM_DELETE_INSTANCE_REQUEST_MESSAGE:
+ case CIM_GET_PROPERTY_REQUEST_MESSAGE:
+ case CIM_SET_PROPERTY_REQUEST_MESSAGE:
+ case CIM_INVOKE_METHOD_REQUEST_MESSAGE:
+ case CIM_ENABLE_INDICATION_SUBSCRIPTION_REQUEST_MESSAGE:
+ case CIM_MODIFY_INDICATION_SUBSCRIPTION_REQUEST_MESSAGE:
+ case CIM_DISABLE_INDICATION_SUBSCRIPTION_REQUEST_MESSAGE:
+ rc = true;
- break;
- default:
- rc = false;
+ break;
+ default:
+ rc = false;
- break;
- }
+ break;
+ }
- return(rc);
+ return(rc);
*/
}
void ProviderManagerService::handleEnqueue(void)
{
- return;
+ return;
}
void ProviderManagerService::handleEnqueue(Message * message)
{
- return;
+ return;
}
+
+
+void ProviderManagerService::handleEnqueue(AsyncOpNode *op)
+{
+
+ const Message * message = op->_request.next(0);
+
+ PEGASUS_ASSERT(message != 0);
+
+ // pass the request message to a handler method based on message type
+ switch(message->getType())
+ {
+ case CIM_GET_CLASS_REQUEST_MESSAGE:
+ case CIM_ENUMERATE_CLASSES_REQUEST_MESSAGE:
+ case CIM_ENUMERATE_CLASS_NAMES_REQUEST_MESSAGE:
+ case CIM_CREATE_CLASS_REQUEST_MESSAGE:
+ case CIM_MODIFY_CLASS_REQUEST_MESSAGE:
+ case CIM_DELETE_CLASS_REQUEST_MESSAGE:
+ break;
+ case CIM_GET_INSTANCE_REQUEST_MESSAGE:
+ // forward request to specialized method
+ _threadPool.allocate_and_awaken(op , handleGetInstanceRequest);
+
+ // wait for specialized method to initialize
+ _threadSemaphore.wait();
+
+ break;
+ case CIM_ENUMERATE_INSTANCES_REQUEST_MESSAGE:
+ _threadPool.allocate_and_awaken((void *)this, handleEnumerateInstancesRequest);
+
+ // wait for specialized method to initialize
+ _threadSemaphore.wait();
+
+ break;
+ case CIM_ENUMERATE_INSTANCE_NAMES_REQUEST_MESSAGE:
+ _threadPool.allocate_and_awaken((void *)this, handleEnumerateInstanceNamesRequest);
+
+ // wait for specialized method to initialize
+ _threadSemaphore.wait();
+
+ break;
+ case CIM_CREATE_INSTANCE_REQUEST_MESSAGE:
+ _threadPool.allocate_and_awaken((void *)this, handleCreateInstanceRequest);
+
+ // wait for specialized method to initialize
+ _threadSemaphore.wait();
+
+ break;
+ case CIM_MODIFY_INSTANCE_REQUEST_MESSAGE:
+ _threadPool.allocate_and_awaken((void *)this, handleModifyInstanceRequest);
+
+ break;
+ case CIM_DELETE_INSTANCE_REQUEST_MESSAGE:
+ _threadPool.allocate_and_awaken((void *)this, handleDeleteInstanceRequest);
+
+ break;
+ case CIM_EXEC_QUERY_REQUEST_MESSAGE:
+ case CIM_ASSOCIATORS_REQUEST_MESSAGE:
+ case CIM_ASSOCIATOR_NAMES_REQUEST_MESSAGE:
+ case CIM_REFERENCES_REQUEST_MESSAGE:
+ case CIM_REFERENCE_NAMES_REQUEST_MESSAGE:
+ break;
+ case CIM_GET_PROPERTY_REQUEST_MESSAGE:
+ _threadPool.allocate_and_awaken((void *)this, handleGetPropertyRequest);
+
+ // wait for specialized method to initialize
+ _threadSemaphore.wait();
+
+ break;
+ case CIM_SET_PROPERTY_REQUEST_MESSAGE:
+ _threadPool.allocate_and_awaken((void *)this, handleSetPropertyRequest);
+
+ // wait for specialized method to initialize
+ _threadSemaphore.wait();
+
+ break;
+ case CIM_GET_QUALIFIER_REQUEST_MESSAGE:
+ case CIM_SET_QUALIFIER_REQUEST_MESSAGE:
+ case CIM_DELETE_QUALIFIER_REQUEST_MESSAGE:
+ case CIM_ENUMERATE_QUALIFIERS_REQUEST_MESSAGE:
+ break;
+ case CIM_INVOKE_METHOD_REQUEST_MESSAGE:
+ _threadPool.allocate_and_awaken((void *)this, handleInvokeMethodRequest);
+
+ // wait for specialized method to initialize
+ _threadSemaphore.wait();
+
+ break;
+ case CIM_ENABLE_INDICATION_SUBSCRIPTION_REQUEST_MESSAGE:
+ _threadPool.allocate_and_awaken((void *)this, handleEnableIndicationRequest);
+
+ // wait for specialized method to initialize
+ _threadSemaphore.wait();
+
+ break;
+ case CIM_MODIFY_INDICATION_SUBSCRIPTION_REQUEST_MESSAGE:
+ _threadPool.allocate_and_awaken((void *)this, handleModifyIndicationRequest);
+
+ // wait for specialized method to initialize
+ _threadSemaphore.wait();
+
+ break;
+ case CIM_DISABLE_INDICATION_SUBSCRIPTION_REQUEST_MESSAGE:
+ _threadPool.allocate_and_awaken((void *)this, handleDisableIndicationRequest);
+
+ // wait for specialized method to initialize
+ _threadSemaphore.wait();
+
+ break;
+ default:
+ break;
+ }
+
+ return;
+
+}
+
+void ProviderManagerService::_handle_incoming_operation(AsyncOpNode *operation,
+ Thread *thread,
+ MessageQueue *queue)
+{
+ if ( operation->_flags & ASYNC_OPFLAGS_CALLBACK )
+ {
+ if ( operation->_flags & ASYNC_OPSTATE_COMPLETE )
+ {
+ operation->_async_callback( operation->_callback_node,
+ operation->_callback_queue,
+ operation->_callback_ptr);
+ return;
+ }
+
+ handleEnqueue(operation);
+ }
+ return;
+}
+
+
void ProviderManagerService::_handle_async_request(AsyncRequest * request)
{
- PEGASUS_ASSERT(request != 0);
+ PEGASUS_ASSERT(request != 0);
- if(request->getType() == async_messages::ASYNC_LEGACY_OP_START)
- {
- request->op->processing();
+ if(request->getType() == async_messages::ASYNC_LEGACY_OP_START)
+ {
+ request->op->processing();
- Message * message = (static_cast<AsyncLegacyOperationStart *>(request)->get_action());
+ Message * message = (static_cast<AsyncLegacyOperationStart *>(request)->get_action());
- PEGASUS_ASSERT(message != 0);
+ PEGASUS_ASSERT(message != 0);
- messageQueue.enqueue(message);
+ messageQueue.enqueue(message);
- handleOperation();
+ handleOperation();
- return;
- }
+ return;
+ }
- // pass all other operations to the default handler
- MessageQueueService::_handle_async_request(request);
+ // pass all other operations to the default handler
+ MessageQueueService::_handle_async_request(request);
}
void ProviderManagerService::handleOperation(void)
{
- const Message * message = messageQueue.front();
-
- PEGASUS_ASSERT(message != 0);
-
- // pass the request message to a handler method based on message type
- switch(message->getType())
- {
- case CIM_GET_CLASS_REQUEST_MESSAGE:
- case CIM_ENUMERATE_CLASSES_REQUEST_MESSAGE:
- case CIM_ENUMERATE_CLASS_NAMES_REQUEST_MESSAGE:
- case CIM_CREATE_CLASS_REQUEST_MESSAGE:
- case CIM_MODIFY_CLASS_REQUEST_MESSAGE:
- case CIM_DELETE_CLASS_REQUEST_MESSAGE:
- break;
- case CIM_GET_INSTANCE_REQUEST_MESSAGE:
- // forward request to specialized method
- _threadPool.allocate_and_awaken((void *)this, handleGetInstanceRequest);
-
- // wait for specialized method to initialize
- _threadSemaphore.wait();
-
- break;
- case CIM_ENUMERATE_INSTANCES_REQUEST_MESSAGE:
- _threadPool.allocate_and_awaken((void *)this, handleEnumerateInstancesRequest);
-
- // wait for specialized method to initialize
- _threadSemaphore.wait();
-
- break;
- case CIM_ENUMERATE_INSTANCE_NAMES_REQUEST_MESSAGE:
- _threadPool.allocate_and_awaken((void *)this, handleEnumerateInstanceNamesRequest);
-
- // wait for specialized method to initialize
- _threadSemaphore.wait();
-
- break;
- case CIM_CREATE_INSTANCE_REQUEST_MESSAGE:
- _threadPool.allocate_and_awaken((void *)this, handleCreateInstanceRequest);
-
- // wait for specialized method to initialize
- _threadSemaphore.wait();
-
- break;
- case CIM_MODIFY_INSTANCE_REQUEST_MESSAGE:
- _threadPool.allocate_and_awaken((void *)this, handleModifyInstanceRequest);
-
- break;
- case CIM_DELETE_INSTANCE_REQUEST_MESSAGE:
- _threadPool.allocate_and_awaken((void *)this, handleDeleteInstanceRequest);
-
- break;
- case CIM_EXEC_QUERY_REQUEST_MESSAGE:
- case CIM_ASSOCIATORS_REQUEST_MESSAGE:
- case CIM_ASSOCIATOR_NAMES_REQUEST_MESSAGE:
- case CIM_REFERENCES_REQUEST_MESSAGE:
- case CIM_REFERENCE_NAMES_REQUEST_MESSAGE:
- break;
- case CIM_GET_PROPERTY_REQUEST_MESSAGE:
- _threadPool.allocate_and_awaken((void *)this, handleGetPropertyRequest);
-
- // wait for specialized method to initialize
- _threadSemaphore.wait();
-
- break;
- case CIM_SET_PROPERTY_REQUEST_MESSAGE:
- _threadPool.allocate_and_awaken((void *)this, handleSetPropertyRequest);
-
- // wait for specialized method to initialize
- _threadSemaphore.wait();
-
- break;
- case CIM_GET_QUALIFIER_REQUEST_MESSAGE:
- case CIM_SET_QUALIFIER_REQUEST_MESSAGE:
- case CIM_DELETE_QUALIFIER_REQUEST_MESSAGE:
- case CIM_ENUMERATE_QUALIFIERS_REQUEST_MESSAGE:
- break;
- case CIM_INVOKE_METHOD_REQUEST_MESSAGE:
- _threadPool.allocate_and_awaken((void *)this, handleInvokeMethodRequest);
-
- // wait for specialized method to initialize
- _threadSemaphore.wait();
-
- break;
- case CIM_ENABLE_INDICATION_SUBSCRIPTION_REQUEST_MESSAGE:
- _threadPool.allocate_and_awaken((void *)this, handleEnableIndicationRequest);
-
- // wait for specialized method to initialize
- _threadSemaphore.wait();
-
- break;
- case CIM_MODIFY_INDICATION_SUBSCRIPTION_REQUEST_MESSAGE:
- _threadPool.allocate_and_awaken((void *)this, handleModifyIndicationRequest);
-
- // wait for specialized method to initialize
- _threadSemaphore.wait();
-
- break;
- case CIM_DISABLE_INDICATION_SUBSCRIPTION_REQUEST_MESSAGE:
- _threadPool.allocate_and_awaken((void *)this, handleDisableIndicationRequest);
-
- // wait for specialized method to initialize
- _threadSemaphore.wait();
-
- break;
- default:
- break;
- }
+ const Message * message = messageQueue.front();
+
+ PEGASUS_ASSERT(message != 0);
+
+ // pass the request message to a handler method based on message type
+ switch(message->getType())
+ {
+ case CIM_GET_CLASS_REQUEST_MESSAGE:
+ case CIM_ENUMERATE_CLASSES_REQUEST_MESSAGE:
+ case CIM_ENUMERATE_CLASS_NAMES_REQUEST_MESSAGE:
+ case CIM_CREATE_CLASS_REQUEST_MESSAGE:
+ case CIM_MODIFY_CLASS_REQUEST_MESSAGE:
+ case CIM_DELETE_CLASS_REQUEST_MESSAGE:
+ break;
+ case CIM_GET_INSTANCE_REQUEST_MESSAGE:
+ // forward request to specialized method
+ _threadPool.allocate_and_awaken((void *)this, handleGetInstanceRequest);
+
+ // wait for specialized method to initialize
+ _threadSemaphore.wait();
+
+ break;
+ case CIM_ENUMERATE_INSTANCES_REQUEST_MESSAGE:
+ _threadPool.allocate_and_awaken((void *)this, handleEnumerateInstancesRequest);
+
+ // wait for specialized method to initialize
+ _threadSemaphore.wait();
+
+ break;
+ case CIM_ENUMERATE_INSTANCE_NAMES_REQUEST_MESSAGE:
+ _threadPool.allocate_and_awaken((void *)this, handleEnumerateInstanceNamesRequest);
+
+ // wait for specialized method to initialize
+ _threadSemaphore.wait();
+
+ break;
+ case CIM_CREATE_INSTANCE_REQUEST_MESSAGE:
+ _threadPool.allocate_and_awaken((void *)this, handleCreateInstanceRequest);
+
+ // wait for specialized method to initialize
+ _threadSemaphore.wait();
+
+ break;
+ case CIM_MODIFY_INSTANCE_REQUEST_MESSAGE:
+ _threadPool.allocate_and_awaken((void *)this, handleModifyInstanceRequest);
+
+ break;
+ case CIM_DELETE_INSTANCE_REQUEST_MESSAGE:
+ _threadPool.allocate_and_awaken((void *)this, handleDeleteInstanceRequest);
+
+ break;
+ case CIM_EXEC_QUERY_REQUEST_MESSAGE:
+ case CIM_ASSOCIATORS_REQUEST_MESSAGE:
+ case CIM_ASSOCIATOR_NAMES_REQUEST_MESSAGE:
+ case CIM_REFERENCES_REQUEST_MESSAGE:
+ case CIM_REFERENCE_NAMES_REQUEST_MESSAGE:
+ break;
+ case CIM_GET_PROPERTY_REQUEST_MESSAGE:
+ _threadPool.allocate_and_awaken((void *)this, handleGetPropertyRequest);
+
+ // wait for specialized method to initialize
+ _threadSemaphore.wait();
+
+ break;
+ case CIM_SET_PROPERTY_REQUEST_MESSAGE:
+ _threadPool.allocate_and_awaken((void *)this, handleSetPropertyRequest);
+
+ // wait for specialized method to initialize
+ _threadSemaphore.wait();
+
+ break;
+ case CIM_GET_QUALIFIER_REQUEST_MESSAGE:
+ case CIM_SET_QUALIFIER_REQUEST_MESSAGE:
+ case CIM_DELETE_QUALIFIER_REQUEST_MESSAGE:
+ case CIM_ENUMERATE_QUALIFIERS_REQUEST_MESSAGE:
+ break;
+ case CIM_INVOKE_METHOD_REQUEST_MESSAGE:
+ _threadPool.allocate_and_awaken((void *)this, handleInvokeMethodRequest);
+
+ // wait for specialized method to initialize
+ _threadSemaphore.wait();
+
+ break;
+ case CIM_ENABLE_INDICATION_SUBSCRIPTION_REQUEST_MESSAGE:
+ _threadPool.allocate_and_awaken((void *)this, handleEnableIndicationRequest);
+
+ // wait for specialized method to initialize
+ _threadSemaphore.wait();
+
+ break;
+ case CIM_MODIFY_INDICATION_SUBSCRIPTION_REQUEST_MESSAGE:
+ _threadPool.allocate_and_awaken((void *)this, handleModifyIndicationRequest);
+
+ // wait for specialized method to initialize
+ _threadSemaphore.wait();
+
+ break;
+ case CIM_DISABLE_INDICATION_SUBSCRIPTION_REQUEST_MESSAGE:
+ _threadPool.allocate_and_awaken((void *)this, handleDisableIndicationRequest);
+
+ // wait for specialized method to initialize
+ _threadSemaphore.wait();
+
+ break;
+ default:
+ break;
+ }
}
PEGASUS_THREAD_RETURN PEGASUS_THREAD_CDECL ProviderManagerService::handleGetInstanceRequest(void * arg)
{
- // get the service from argument
- ProviderManagerService * service = reinterpret_cast<ProviderManagerService *>(arg);
-
- PEGASUS_ASSERT(service != 0);
-
- // get message from service queue
- const CIMGetInstanceRequestMessage * request =
- (const CIMGetInstanceRequestMessage *)service->messageQueue.dequeue();
-
- PEGASUS_ASSERT(request != 0);
-
- // notify the service that the request has been accepted
- service->_threadSemaphore.signal();
-
- Status status;
-
- CIMInstance cimInstance;
-
- try
- {
- // make class reference
- CIMReference classReference(
- request->instanceName.getHost(),
- request->nameSpace,
- request->instanceName.getClassName());
-
- // get the provider file name and logical name
- Pair<String, String> pair = service->_lookupProviderForClass(classReference);
-
- // get cached or load new provider module
- ProviderModule module = providerManager.getProviderModule(pair.first, pair.second);
-
- // encapsulate the physical provider in a facade
- ProviderFacade facade(module.getProvider());
-
- // convert arguments
- OperationContext context;
- CIMReference instanceReference(request->instanceName);
-
- // ATTN: propagate namespace
- instanceReference.setNameSpace(request->nameSpace);
-
- // ATTN: convert flags to bitmask
- Uint32 flags = OperationFlag::convert(false);
- CIMPropertyList propertyList(request->propertyList);
-
- SimpleResponseHandler<CIMInstance> handler;
-
- // forward request
- facade.getInstance(
- context,
- instanceReference,
- flags,
- propertyList.getPropertyNameArray(),
- handler);
-
- // error? provider claims success, but did not deliver an instance.
- if(handler._objects.size() == 0)
- {
- throw CIMException(CIM_ERR_NOT_FOUND);
- }
-
- // save returned instance
- cimInstance = handler._objects[0];
- }
- catch(CIMException & e)
- {
- status = Status(e.getCode(), e.getMessage());
- }
- catch(Exception & e)
- {
- status = Status(CIM_ERR_FAILED, e.getMessage());
- }
- catch(...)
- {
- status = Status(CIM_ERR_FAILED, "Unknown Error");
- }
-
- // create response message
- CIMGetInstanceResponseMessage * response =
- new CIMGetInstanceResponseMessage(
- request->messageId,
- CIMStatusCode(status.getCode()),
- status.getMessage(),
- request->queueIds.copyAndPop(),
- cimInstance);
-
- // preserve message key
- response->setKey(request->getKey());
-
- // call the message queue service method to see if this is an async envelope
- if(service->_enqueueResponse((Message *)request, (Message *)response))
- {
- return(0);
- }
-
- /*
- // lookup the message queue
- MessageQueue * queue = MessageQueue::lookup(request->queueIds.top());
-
- PEGASUS_ASSERT(queue != 0);
-
- // enqueue the response
- queue->enqueue(response);
- */
-
- return(0);
+ // get the service from argument
+// ProviderManagerService * service = reinterpret_cast<ProviderManagerService *>(arg);
+ AsyncOpNode *op = reinterpret_cast<AsyncOpNode *>(arg);
+
+ ProviderManagerService * service = static_cast<ProviderManagerService *>(op->_op_dest);
+
+ PEGASUS_ASSERT(service != 0);
+
+ // get message from service queue
+// const CIMGetInstanceRequestMessage * request =
+// (const CIMGetInstanceRequestMessage *)service->messageQueue.dequeue();
+
+ const CIMGetInstanceRequestMessage *request =
+ static_cast<CIMGetInstanceRequestMessage *>(op->_request.next(0));
+
+ PEGASUS_ASSERT(request != 0);
+
+ // notify the service that the request has been accepted
+ service->_threadSemaphore.signal();
+
+ Status status;
+
+ CIMInstance cimInstance;
+
+ try
+ {
+ // make class reference
+ CIMReference classReference(
+ request->instanceName.getHost(),
+ request->nameSpace,
+ request->instanceName.getClassName());
+
+ // get the provider file name and logical name
+ Pair<String, String> pair = service->_lookupProviderForClass(classReference);
+
+ // get cached or load new provider module
+ ProviderModule module = providerManager.getProviderModule(pair.first, pair.second);
+
+ // encapsulate the physical provider in a facade
+ ProviderFacade facade(module.getProvider());
+
+ // convert arguments
+ OperationContext context;
+ CIMReference instanceReference(request->instanceName);
+
+ // ATTN: propagate namespace
+ instanceReference.setNameSpace(request->nameSpace);
+
+ // ATTN: convert flags to bitmask
+ Uint32 flags = OperationFlag::convert(false);
+ CIMPropertyList propertyList(request->propertyList);
+
+ SimpleResponseHandler<CIMInstance> handler;
+
+ // forward request
+ facade.getInstance(
+ context,
+ instanceReference,
+ flags,
+ propertyList.getPropertyNameArray(),
+ handler);
+
+ // error? provider claims success, but did not deliver an instance.
+ if(handler._objects.size() == 0)
+ {
+ throw CIMException(CIM_ERR_NOT_FOUND);
+ }
+
+ // save returned instance
+ cimInstance = handler._objects[0];
+ }
+ catch(CIMException & e)
+ {
+ status = Status(e.getCode(), e.getMessage());
+ }
+ catch(Exception & e)
+ {
+ status = Status(CIM_ERR_FAILED, e.getMessage());
+ }
+ catch(...)
+ {
+ status = Status(CIM_ERR_FAILED, "Unknown Error");
+ }
+
+ // create response message
+ CIMGetInstanceResponseMessage * response =
+ new CIMGetInstanceResponseMessage(
+ request->messageId,
+ CIMStatusCode(status.getCode()),
+ status.getMessage(),
+ request->queueIds.copyAndPop(),
+ cimInstance);
+
+ // preserve message key
+ response->setKey(request->getKey());
+
+ op->_response.insert_last(response);
+ service->ReplyAsync(op, request->queueIds.top());
+ return(0);
+
+ // call the message queue service method to see if this is an async envelope
+ if(service->_enqueueResponse((Message *)request, (Message *)response))
+ {
+ return(0);
+ }
+
+ /*
+ // lookup the message queue
+ MessageQueue * queue = MessageQueue::lookup(request->queueIds.top());
+
+ PEGASUS_ASSERT(queue != 0);
+
+ // enqueue the response
+ queue->enqueue(response);
+ */
+
+ return(0);
}
PEGASUS_THREAD_RETURN PEGASUS_THREAD_CDECL ProviderManagerService::handleEnumerateInstancesRequest(void * arg)
{
- // get the service from argument
- ProviderManagerService * service = reinterpret_cast<ProviderManagerService *>(arg);
-
- PEGASUS_ASSERT(service != 0);
-
- // get message from service queue
- const CIMEnumerateInstancesRequestMessage * request =
- (const CIMEnumerateInstancesRequestMessage *)service->messageQueue.dequeue();
-
- PEGASUS_ASSERT(request != 0);
-
- // notify the service that the request has been accepted
- service->_threadSemaphore.signal();
-
- Status status;
-
- Array<CIMNamedInstance> cimInstances;
-
- try
- {
- // make class reference
- CIMReference classReference(
- "",
- request->nameSpace,
- request->className);
-
- // get the provider file name and logical name
- Pair<String, String> pair = service->_lookupProviderForClass(classReference);
-
- // get cached or load new provider module
- ProviderModule module = providerManager.getProviderModule(pair.first, pair.second);
-
- // encapsulate the physical provider in a facade
- ProviderFacade facade(module.getProvider());
-
- // convert arguments
- OperationContext context;
-
- // ATTN: propagate namespace
- classReference.setNameSpace(request->nameSpace);
-
- // ATTN: convert flags to bitmask
- Uint32 flags = OperationFlag::convert(false);
- CIMPropertyList propertyList(request->propertyList);
-
- SimpleResponseHandler<CIMInstance> handler;
-
- facade.enumerateInstances(
- context,
- classReference,
- flags,
- propertyList.getPropertyNameArray(),
- handler);
-
- // save returned instance
-
- // ATTN: can be removed once CIMNamedInstance is removed
- for(Uint32 i = 0, n = handler._objects.size(); i < n; i++)
- {
- cimInstances.append(CIMNamedInstance(handler._objects[i].getPath(), handler._objects[i]));
- }
- }
- catch(CIMException & e)
- {
- status = Status(e.getCode(), e.getMessage());
- }
- catch(Exception & e)
- {
- status = Status(CIM_ERR_FAILED, e.getMessage());
- }
- catch(...)
- {
- status = Status(CIM_ERR_FAILED, "Unknown Error");
- }
-
- // create response message
- CIMEnumerateInstancesResponseMessage * response =
- new CIMEnumerateInstancesResponseMessage(
- request->messageId,
- CIMStatusCode(status.getCode()),
- status.getMessage(),
- request->queueIds.copyAndPop(),
- cimInstances);
-
- // preserve message key
- response->setKey(request->getKey());
-
- // call the message queue service method to see if this is an async envelope
- if(service->_enqueueResponse((Message *)request, (Message *)response))
- {
- return(0);
- }
-
- /*
- // lookup the message queue
- MessageQueue * queue = MessageQueue::lookup(request->queueIds.top());
-
- PEGASUS_ASSERT(queue != 0);
-
- // enqueue the response
- queue->enqueue(response);
- */
-
- return(0);
+ // get the service from argument
+ ProviderManagerService * service = reinterpret_cast<ProviderManagerService *>(arg);
+
+ PEGASUS_ASSERT(service != 0);
+
+ // get message from service queue
+ const CIMEnumerateInstancesRequestMessage * request =
+ (const CIMEnumerateInstancesRequestMessage *)service->messageQueue.dequeue();
+
+ PEGASUS_ASSERT(request != 0);
+
+ // notify the service that the request has been accepted
+ service->_threadSemaphore.signal();
+
+ Status status;
+
+ Array<CIMNamedInstance> cimInstances;
+
+ try
+ {
+ // make class reference
+ CIMReference classReference(
+ "",
+ request->nameSpace,
+ request->className);
+
+ // get the provider file name and logical name
+ Pair<String, String> pair = service->_lookupProviderForClass(classReference);
+
+ // get cached or load new provider module
+ ProviderModule module = providerManager.getProviderModule(pair.first, pair.second);
+
+ // encapsulate the physical provider in a facade
+ ProviderFacade facade(module.getProvider());
+
+ // convert arguments
+ OperationContext context;
+
+ // ATTN: propagate namespace
+ classReference.setNameSpace(request->nameSpace);
+
+ // ATTN: convert flags to bitmask
+ Uint32 flags = OperationFlag::convert(false);
+ CIMPropertyList propertyList(request->propertyList);
+
+ SimpleResponseHandler<CIMInstance> handler;
+
+ facade.enumerateInstances(
+ context,
+ classReference,
+ flags,
+ propertyList.getPropertyNameArray(),
+ handler);
+
+ // save returned instance
+
+ // ATTN: can be removed once CIMNamedInstance is removed
+ for(Uint32 i = 0, n = handler._objects.size(); i < n; i++)
+ {
+ cimInstances.append(CIMNamedInstance(handler._objects[i].getPath(), handler._objects[i]));
+ }
+ }
+ catch(CIMException & e)
+ {
+ status = Status(e.getCode(), e.getMessage());
+ }
+ catch(Exception & e)
+ {
+ status = Status(CIM_ERR_FAILED, e.getMessage());
+ }
+ catch(...)
+ {
+ status = Status(CIM_ERR_FAILED, "Unknown Error");
+ }
+
+ // create response message
+ CIMEnumerateInstancesResponseMessage * response =
+ new CIMEnumerateInstancesResponseMessage(
+ request->messageId,
+ CIMStatusCode(status.getCode()),
+ status.getMessage(),
+ request->queueIds.copyAndPop(),
+ cimInstances);
+
+ // preserve message key
+ response->setKey(request->getKey());
+
+ // call the message queue service method to see if this is an async envelope
+ if(service->_enqueueResponse((Message *)request, (Message *)response))
+ {
+ return(0);
+ }
+
+ /*
+ // lookup the message queue
+ MessageQueue * queue = MessageQueue::lookup(request->queueIds.top());
+
+ PEGASUS_ASSERT(queue != 0);
+
+ // enqueue the response
+ queue->enqueue(response);
+ */
+
+ return(0);
}
PEGASUS_THREAD_RETURN PEGASUS_THREAD_CDECL ProviderManagerService::handleEnumerateInstanceNamesRequest(void * arg)
{
- // get the service from argument
- ProviderManagerService * service = reinterpret_cast<ProviderManagerService *>(arg);
-
- PEGASUS_ASSERT(service != 0);
-
- // get message from service queue
- const CIMEnumerateInstanceNamesRequestMessage * request =
- (const CIMEnumerateInstanceNamesRequestMessage *)service->messageQueue.dequeue();
-
- PEGASUS_ASSERT(request != 0);
-
- // notify the service that the request has been accepted
- service->_threadSemaphore.signal();
-
- Status status;
-
- Array<CIMReference> cimReferences;
-
- try
- {
- // make class reference
- CIMReference classReference(
- "",
- request->nameSpace,
- request->className);
-
- // get the provider file name and logical name
- Pair<String, String> pair = service->_lookupProviderForClass(classReference);
-
- // get cached or load new provider module
- ProviderModule module = providerManager.getProviderModule(pair.first, pair.second);
-
- // encapsulate the physical provider in a facade
- ProviderFacade facade(module.getProvider());
-
- // convert arguments
- OperationContext context;
-
- // ATTN: propagate namespace
- classReference.setNameSpace(request->nameSpace);
-
- SimpleResponseHandler<CIMReference> handler;
-
- facade.enumerateInstanceNames(
- context,
- classReference,
- handler);
-
- // save returned instance
- cimReferences = handler._objects;
- }
- catch(CIMException & e)
- {
- status = Status(e.getCode(), e.getMessage());
- }
- catch(Exception & e)
- {
- status = Status(CIM_ERR_FAILED, e.getMessage());
- }
- catch(...)
- {
- status = Status(CIM_ERR_FAILED, "Unknown Error");
- }
-
- // create response message
- CIMEnumerateInstanceNamesResponseMessage * response =
- new CIMEnumerateInstanceNamesResponseMessage(
- request->messageId,
- CIMStatusCode(status.getCode()),
- status.getMessage(),
- request->queueIds.copyAndPop(),
- cimReferences);
-
- // preserve message key
- response->setKey(request->getKey());
-
- // call the message queue service method to see if this is an async envelope
- if(service->_enqueueResponse((Message *)request, (Message *)response))
- {
- return(0);
- }
-
- /*
- // lookup the message queue
- MessageQueue * queue = MessageQueue::lookup(request->queueIds.top());
-
- PEGASUS_ASSERT(queue != 0);
-
- // enqueue the response
- queue->enqueue(response);
- */
-
- return(0);
+ // get the service from argument
+ ProviderManagerService * service = reinterpret_cast<ProviderManagerService *>(arg);
+
+ PEGASUS_ASSERT(service != 0);
+
+ // get message from service queue
+ const CIMEnumerateInstanceNamesRequestMessage * request =
+ (const CIMEnumerateInstanceNamesRequestMessage *)service->messageQueue.dequeue();
+
+ PEGASUS_ASSERT(request != 0);
+
+ // notify the service that the request has been accepted
+ service->_threadSemaphore.signal();
+
+ Status status;
+
+ Array<CIMReference> cimReferences;
+
+ try
+ {
+ // make class reference
+ CIMReference classReference(
+ "",
+ request->nameSpace,
+ request->className);
+
+ // get the provider file name and logical name
+ Pair<String, String> pair = service->_lookupProviderForClass(classReference);
+
+ // get cached or load new provider module
+ ProviderModule module = providerManager.getProviderModule(pair.first, pair.second);
+
+ // encapsulate the physical provider in a facade
+ ProviderFacade facade(module.getProvider());
+
+ // convert arguments
+ OperationContext context;
+
+ // ATTN: propagate namespace
+ classReference.setNameSpace(request->nameSpace);
+
+ SimpleResponseHandler<CIMReference> handler;
+
+ facade.enumerateInstanceNames(
+ context,
+ classReference,
+ handler);
+
+ // save returned instance
+ cimReferences = handler._objects;
+ }
+ catch(CIMException & e)
+ {
+ status = Status(e.getCode(), e.getMessage());
+ }
+ catch(Exception & e)
+ {
+ status = Status(CIM_ERR_FAILED, e.getMessage());
+ }
+ catch(...)
+ {
+ status = Status(CIM_ERR_FAILED, "Unknown Error");
+ }
+
+ // create response message
+ CIMEnumerateInstanceNamesResponseMessage * response =
+ new CIMEnumerateInstanceNamesResponseMessage(
+ request->messageId,
+ CIMStatusCode(status.getCode()),
+ status.getMessage(),
+ request->queueIds.copyAndPop(),
+ cimReferences);
+
+ // preserve message key
+ response->setKey(request->getKey());
+
+ // call the message queue service method to see if this is an async envelope
+ if(service->_enqueueResponse((Message *)request, (Message *)response))
+ {
+ return(0);
+ }
+
+ /*
+ // lookup the message queue
+ MessageQueue * queue = MessageQueue::lookup(request->queueIds.top());
+
+ PEGASUS_ASSERT(queue != 0);
+
+ // enqueue the response
+ queue->enqueue(response);
+ */
+
+ return(0);
}
PEGASUS_THREAD_RETURN PEGASUS_THREAD_CDECL ProviderManagerService::handleCreateInstanceRequest(void * arg)
{
- // get the service from argument
- ProviderManagerService * service = reinterpret_cast<ProviderManagerService *>(arg);
-
- PEGASUS_ASSERT(service != 0);
-
- // get message from service queue
- const CIMCreateInstanceRequestMessage * request =
- (const CIMCreateInstanceRequestMessage *)service->messageQueue.dequeue();
-
- PEGASUS_ASSERT(request != 0);
-
- // notify the service that the request has been accepted
- service->_threadSemaphore.signal();
-
- CIMInstance cimInstance;
- CIMReference instanceName;
- Status status;
-
- try
- {
- String className = request->newInstance.getClassName();
-
- // make class reference
- CIMReference classReference(
- "",
- request->nameSpace,
- className);
-
- // get the provider file name and logical name
- Pair<String, String> pair = service->_lookupProviderForClass(classReference);
-
- // get cached or load new provider module
- ProviderModule module = providerManager.getProviderModule(pair.first, pair.second);
-
- // encapsulate the physical provider in a facade
- ProviderFacade facade(module.getProvider());
-
- // convert arguments
- OperationContext context;
-
- CIMReference instanceReference;
-
- // ATTN: propagate namespace
- instanceReference.setNameSpace(request->nameSpace);
-
- // ATTN: need to handle key binding
- instanceReference.setClassName(className);
-
- SimpleResponseHandler<CIMReference> handler;
-
- // forward request
- facade.createInstance(
- context,
- instanceReference,
- request->newInstance,
- handler);
-
- // error? provider claims success, but did not deliver an
- // instance name.
- if(handler._objects.size() == 0)
- {
- throw CIMException(CIM_ERR_NOT_FOUND);
- }
-
- // save returned instance name
- instanceName = handler._objects[0];
- }
- catch(CIMException & e)
- {
- status = Status(e.getCode(), e.getMessage());
- }
- catch(Exception & e)
- {
- status = Status(CIM_ERR_FAILED, e.getMessage());
- }
- catch(...)
- {
- status = Status(CIM_ERR_FAILED, "Unknown Error");
- }
-
- // create response message
- CIMCreateInstanceResponseMessage * response =
- new CIMCreateInstanceResponseMessage(
- request->messageId,
- CIMStatusCode(status.getCode()),
- status.getMessage(),
- request->queueIds.copyAndPop(),
- instanceName);
-
- // preserve message key
- response->setKey(request->getKey());
-
- // call the message queue service method to see if this is an async envelope
- if(service->_enqueueResponse((Message *)request, (Message *)response))
- {
- return(0);
- }
-
- /*
- // lookup the message queue
- MessageQueue * queue = MessageQueue::lookup(request->queueIds.top());
-
- PEGASUS_ASSERT(queue != 0);
-
- // enqueue the response
- queue->enqueue(response);
- */
-
- return(0);
+ // get the service from argument
+ ProviderManagerService * service = reinterpret_cast<ProviderManagerService *>(arg);
+
+ PEGASUS_ASSERT(service != 0);
+
+ // get message from service queue
+ const CIMCreateInstanceRequestMessage * request =
+ (const CIMCreateInstanceRequestMessage *)service->messageQueue.dequeue();
+
+ PEGASUS_ASSERT(request != 0);
+
+ // notify the service that the request has been accepted
+ service->_threadSemaphore.signal();
+
+ CIMInstance cimInstance;
+ CIMReference instanceName;
+ Status status;
+
+ try
+ {
+ String className = request->newInstance.getClassName();
+
+ // make class reference
+ CIMReference classReference(
+ "",
+ request->nameSpace,
+ className);
+
+ // get the provider file name and logical name
+ Pair<String, String> pair = service->_lookupProviderForClass(classReference);
+
+ // get cached or load new provider module
+ ProviderModule module = providerManager.getProviderModule(pair.first, pair.second);
+
+ // encapsulate the physical provider in a facade
+ ProviderFacade facade(module.getProvider());
+
+ // convert arguments
+ OperationContext context;
+
+ CIMReference instanceReference;
+
+ // ATTN: propagate namespace
+ instanceReference.setNameSpace(request->nameSpace);
+
+ // ATTN: need to handle key binding
+ instanceReference.setClassName(className);
+
+ SimpleResponseHandler<CIMReference> handler;
+
+ // forward request
+ facade.createInstance(
+ context,
+ instanceReference,
+ request->newInstance,
+ handler);
+
+ // error? provider claims success, but did not deliver an
+ // instance name.
+ if(handler._objects.size() == 0)
+ {
+ throw CIMException(CIM_ERR_NOT_FOUND);
+ }
+
+ // save returned instance name
+ instanceName = handler._objects[0];
+ }
+ catch(CIMException & e)
+ {
+ status = Status(e.getCode(), e.getMessage());
+ }
+ catch(Exception & e)
+ {
+ status = Status(CIM_ERR_FAILED, e.getMessage());
+ }
+ catch(...)
+ {
+ status = Status(CIM_ERR_FAILED, "Unknown Error");
+ }
+
+ // create response message
+ CIMCreateInstanceResponseMessage * response =
+ new CIMCreateInstanceResponseMessage(
+ request->messageId,
+ CIMStatusCode(status.getCode()),
+ status.getMessage(),
+ request->queueIds.copyAndPop(),
+ instanceName);
+
+ // preserve message key
+ response->setKey(request->getKey());
+
+ // call the message queue service method to see if this is an async envelope
+ if(service->_enqueueResponse((Message *)request, (Message *)response))
+ {
+ return(0);
+ }
+
+ /*
+ // lookup the message queue
+ MessageQueue * queue = MessageQueue::lookup(request->queueIds.top());
+
+ PEGASUS_ASSERT(queue != 0);
+
+ // enqueue the response
+ queue->enqueue(response);
+ */
+
+ return(0);
}
PEGASUS_THREAD_RETURN PEGASUS_THREAD_CDECL ProviderManagerService::handleModifyInstanceRequest(void * arg)
{
- // get the service from argument
- ProviderManagerService * service = reinterpret_cast<ProviderManagerService *>(arg);
-
- PEGASUS_ASSERT(service != 0);
-
- // get message from service queue
- const CIMModifyInstanceRequestMessage * request =
- (const CIMModifyInstanceRequestMessage *)service->messageQueue.dequeue();
-
- PEGASUS_ASSERT(request != 0);
-
- // notify the service that the request has been accepted
- service->_threadSemaphore.signal();
-
- CIMReference instanceName;
- Status status;
-
- try
- {
- instanceName = request->modifiedInstance.getInstanceName();
- String className = instanceName.getClassName();
-
- // make class reference
- CIMReference classReference(
- instanceName.getHost(),
- request->nameSpace,
- className);
-
- // get the provider file name and logical name
- Pair<String, String> pair = service->_lookupProviderForClass(classReference);
-
- // get cached or load new provider module
- ProviderModule module = providerManager.getProviderModule(pair.first, pair.second);
-
- // encapsulate the physical provider in a facade
- ProviderFacade facade(module.getProvider());
-
- // convert arguments
- OperationContext context;
-
- // ATTN: convert flags to bitmask
- Uint32 flags = OperationFlag::convert(false);
- CIMPropertyList propertyList(request->propertyList);
-
- SimpleResponseHandler<CIMInstance> handler;
-
- // forward request
- facade.modifyInstance(
- context,
- instanceName,
- request->modifiedInstance.getInstance(),
- flags,
- propertyList.getPropertyNameArray(),
- handler);
- }
- catch(CIMException & e)
- {
- status = Status(e.getCode(), e.getMessage());
- }
- catch(Exception & e)
- {
- status = Status(CIM_ERR_FAILED, e.getMessage());
- }
- catch(...)
- {
- status = Status(CIM_ERR_FAILED, "Unknown Error");
- }
-
- // create response message
- CIMModifyInstanceResponseMessage * response =
- new CIMModifyInstanceResponseMessage(
- request->messageId,
- CIMStatusCode(status.getCode()),
- status.getMessage(),
- request->queueIds.copyAndPop());
-
- // preserve message key
- response->setKey(request->getKey());
-
- // call the message queue service method to see if this is an async envelope
- if(service->_enqueueResponse((Message *)request, (Message *)response))
- {
- return(0);
- }
-
- /*
- // lookup the message queue
- MessageQueue * queue = MessageQueue::lookup(request->queueIds.top());
-
- PEGASUS_ASSERT(queue != 0);
-
- // enqueue the response
- queue->enqueue(response);
- */
-
- return(0);
+ // get the service from argument
+ ProviderManagerService * service = reinterpret_cast<ProviderManagerService *>(arg);
+
+ PEGASUS_ASSERT(service != 0);
+
+ // get message from service queue
+ const CIMModifyInstanceRequestMessage * request =
+ (const CIMModifyInstanceRequestMessage *)service->messageQueue.dequeue();
+
+ PEGASUS_ASSERT(request != 0);
+
+ // notify the service that the request has been accepted
+ service->_threadSemaphore.signal();
+
+ CIMReference instanceName;
+ Status status;
+
+ try
+ {
+ instanceName = request->modifiedInstance.getInstanceName();
+ String className = instanceName.getClassName();
+
+ // make class reference
+ CIMReference classReference(
+ instanceName.getHost(),
+ request->nameSpace,
+ className);
+
+ // get the provider file name and logical name
+ Pair<String, String> pair = service->_lookupProviderForClass(classReference);
+
+ // get cached or load new provider module
+ ProviderModule module = providerManager.getProviderModule(pair.first, pair.second);
+
+ // encapsulate the physical provider in a facade
+ ProviderFacade facade(module.getProvider());
+
+ // convert arguments
+ OperationContext context;
+
+ // ATTN: convert flags to bitmask
+ Uint32 flags = OperationFlag::convert(false);
+ CIMPropertyList propertyList(request->propertyList);
+
+ SimpleResponseHandler<CIMInstance> handler;
+
+ // forward request
+ facade.modifyInstance(
+ context,
+ instanceName,
+ request->modifiedInstance.getInstance(),
+ flags,
+ propertyList.getPropertyNameArray(),
+ handler);
+ }
+ catch(CIMException & e)
+ {
+ status = Status(e.getCode(), e.getMessage());
+ }
+ catch(Exception & e)
+ {
+ status = Status(CIM_ERR_FAILED, e.getMessage());
+ }
+ catch(...)
+ {
+ status = Status(CIM_ERR_FAILED, "Unknown Error");
+ }
+
+ // create response message
+ CIMModifyInstanceResponseMessage * response =
+ new CIMModifyInstanceResponseMessage(
+ request->messageId,
+ CIMStatusCode(status.getCode()),
+ status.getMessage(),
+ request->queueIds.copyAndPop());
+
+ // preserve message key
+ response->setKey(request->getKey());
+
+ // call the message queue service method to see if this is an async envelope
+ if(service->_enqueueResponse((Message *)request, (Message *)response))
+ {
+ return(0);
+ }
+
+ /*
+ // lookup the message queue
+ MessageQueue * queue = MessageQueue::lookup(request->queueIds.top());
+
+ PEGASUS_ASSERT(queue != 0);
+
+ // enqueue the response
+ queue->enqueue(response);
+ */
+
+ return(0);
}
PEGASUS_THREAD_RETURN PEGASUS_THREAD_CDECL ProviderManagerService::handleDeleteInstanceRequest(void * arg)
{
- // get the service from argument
- ProviderManagerService * service = reinterpret_cast<ProviderManagerService *>(arg);
-
- PEGASUS_ASSERT(service != 0);
-
- // get message from service queue
- const CIMDeleteInstanceRequestMessage * request =
- (const CIMDeleteInstanceRequestMessage *)service->messageQueue.dequeue();
-
- PEGASUS_ASSERT(request != 0);
-
- // notify the service that the request has been accepted
- service->_threadSemaphore.signal();
-
- Status status;
-
- try
- {
- String className = request->instanceName.getClassName();
-
- // make class reference
- CIMReference classReference(
- request->instanceName.getHost(),
- request->nameSpace,
- className);
-
- // get the provider file name and logical name
- Pair<String, String> pair = service->_lookupProviderForClass(classReference);
-
- // get cached or load new provider module
- ProviderModule module = providerManager.getProviderModule(pair.first, pair.second);
-
- // encapsulate the physical provider in a facade
- ProviderFacade facade(module.getProvider());
-
- // convert arguments
- OperationContext context;
-
- SimpleResponseHandler<CIMInstance> handler;
-
- // forward request
- facade.deleteInstance(
- context,
- request->instanceName,
- handler);
- }
- catch(CIMException & e)
- {
- status = Status(e.getCode(), e.getMessage());
- }
- catch(Exception & e)
- {
- status = Status(CIM_ERR_FAILED, e.getMessage());
- }
- catch(...)
- {
- status = Status(CIM_ERR_FAILED, "Unknown Error");
- }
-
- // create response message
- CIMDeleteInstanceResponseMessage * response =
- new CIMDeleteInstanceResponseMessage(
- request->messageId,
- CIMStatusCode(status.getCode()),
- status.getMessage(),
- request->queueIds.copyAndPop());
-
- // preserve message key
- response->setKey(request->getKey());
-
- // call the message queue service method to see if this is an async envelope
- if(service->_enqueueResponse((Message *)request, (Message *)response))
- {
- return(0);
- }
-
- /*
- // lookup the message queue
- MessageQueue * queue = MessageQueue::lookup(request->queueIds.top());
-
- PEGASUS_ASSERT(queue != 0);
-
- // enqueue the response
- queue->enqueue(response);
- */
-
- return(0);
+ // get the service from argument
+ ProviderManagerService * service = reinterpret_cast<ProviderManagerService *>(arg);
+
+ PEGASUS_ASSERT(service != 0);
+
+ // get message from service queue
+ const CIMDeleteInstanceRequestMessage * request =
+ (const CIMDeleteInstanceRequestMessage *)service->messageQueue.dequeue();
+
+ PEGASUS_ASSERT(request != 0);
+
+ // notify the service that the request has been accepted
+ service->_threadSemaphore.signal();
+
+ Status status;
+
+ try
+ {
+ String className = request->instanceName.getClassName();
+
+ // make class reference
+ CIMReference classReference(
+ request->instanceName.getHost(),
+ request->nameSpace,
+ className);
+
+ // get the provider file name and logical name
+ Pair<String, String> pair = service->_lookupProviderForClass(classReference);
+
+ // get cached or load new provider module
+ ProviderModule module = providerManager.getProviderModule(pair.first, pair.second);
+
+ // encapsulate the physical provider in a facade
+ ProviderFacade facade(module.getProvider());
+
+ // convert arguments
+ OperationContext context;
+
+ SimpleResponseHandler<CIMInstance> handler;
+
+ // forward request
+ facade.deleteInstance(
+ context,
+ request->instanceName,
+ handler);
+ }
+ catch(CIMException & e)
+ {
+ status = Status(e.getCode(), e.getMessage());
+ }
+ catch(Exception & e)
+ {
+ status = Status(CIM_ERR_FAILED, e.getMessage());
+ }
+ catch(...)
+ {
+ status = Status(CIM_ERR_FAILED, "Unknown Error");
+ }
+
+ // create response message
+ CIMDeleteInstanceResponseMessage * response =
+ new CIMDeleteInstanceResponseMessage(
+ request->messageId,
+ CIMStatusCode(status.getCode()),
+ status.getMessage(),
+ request->queueIds.copyAndPop());
+
+ // preserve message key
+ response->setKey(request->getKey());
+
+ // call the message queue service method to see if this is an async envelope
+ if(service->_enqueueResponse((Message *)request, (Message *)response))
+ {
+ return(0);
+ }
+
+ /*
+ // lookup the message queue
+ MessageQueue * queue = MessageQueue::lookup(request->queueIds.top());
+
+ PEGASUS_ASSERT(queue != 0);
+
+ // enqueue the response
+ queue->enqueue(response);
+ */
+
+ return(0);
}
PEGASUS_THREAD_RETURN PEGASUS_THREAD_CDECL ProviderManagerService::handleGetPropertyRequest(void * arg)
{
- // get the service from argument
- ProviderManagerService * service = reinterpret_cast<ProviderManagerService *>(arg);
+ // get the service from argument
+ ProviderManagerService * service = reinterpret_cast<ProviderManagerService *>(arg);
- PEGASUS_ASSERT(service != 0);
+ PEGASUS_ASSERT(service != 0);
- // get message from service queue
- const CIMGetPropertyRequestMessage * request =
- (const CIMGetPropertyRequestMessage *)service->messageQueue.dequeue();
+ // get message from service queue
+ const CIMGetPropertyRequestMessage * request =
+ (const CIMGetPropertyRequestMessage *)service->messageQueue.dequeue();
- PEGASUS_ASSERT(request != 0);
+ PEGASUS_ASSERT(request != 0);
- // notify the service that the request has been accepted
- service->_threadSemaphore.signal();
+ // notify the service that the request has been accepted
+ service->_threadSemaphore.signal();
- CIMValue cimValue;
+ CIMValue cimValue;
- // create response message
- CIMGetPropertyResponseMessage * response =
- new CIMGetPropertyResponseMessage(
- request->messageId,
- CIM_ERR_FAILED,
- "not implemented",
- request->queueIds.copyAndPop(),
- cimValue);
+ // create response message
+ CIMGetPropertyResponseMessage * response =
+ new CIMGetPropertyResponseMessage(
+ request->messageId,
+ CIM_ERR_FAILED,
+ "not implemented",
+ request->queueIds.copyAndPop(),
+ cimValue);
- // preserve message key
- response->setKey(request->getKey());
+ // preserve message key
+ response->setKey(request->getKey());
- // call the message queue service method to see if this is an async envelope
- if(service->_enqueueResponse((Message *)request, (Message *)response))
- {
- return(0);
- }
+ // call the message queue service method to see if this is an async envelope
+ if(service->_enqueueResponse((Message *)request, (Message *)response))
+ {
+ return(0);
+ }
- /*
- // lookup the message queue
- MessageQueue * queue = MessageQueue::lookup(request->queueIds.top());
+ /*
+ // lookup the message queue
+ MessageQueue * queue = MessageQueue::lookup(request->queueIds.top());
- PEGASUS_ASSERT(queue != 0);
+ PEGASUS_ASSERT(queue != 0);
- // enqueue the response
- queue->enqueue(response);
- */
+ // enqueue the response
+ queue->enqueue(response);
+ */
- return(0);
+ return(0);
}
PEGASUS_THREAD_RETURN PEGASUS_THREAD_CDECL ProviderManagerService::handleSetPropertyRequest(void * arg)
{
- // get the service from argument
- ProviderManagerService * service = reinterpret_cast<ProviderManagerService *>(arg);
+ // get the service from argument
+ ProviderManagerService * service = reinterpret_cast<ProviderManagerService *>(arg);
- PEGASUS_ASSERT(service != 0);
+ PEGASUS_ASSERT(service != 0);
- // get message from service queue
- const CIMSetPropertyRequestMessage * request =
- (const CIMSetPropertyRequestMessage *)service->messageQueue.dequeue();
+ // get message from service queue
+ const CIMSetPropertyRequestMessage * request =
+ (const CIMSetPropertyRequestMessage *)service->messageQueue.dequeue();
- PEGASUS_ASSERT(request != 0);
+ PEGASUS_ASSERT(request != 0);
- // notify the service that the request has been accepted
- service->_threadSemaphore.signal();
+ // notify the service that the request has been accepted
+ service->_threadSemaphore.signal();
- // create response message
- CIMSetPropertyResponseMessage * response =
- new CIMSetPropertyResponseMessage(
- request->messageId,
- CIM_ERR_FAILED,
- "not implemented",
- request->queueIds.copyAndPop());
+ // create response message
+ CIMSetPropertyResponseMessage * response =
+ new CIMSetPropertyResponseMessage(
+ request->messageId,
+ CIM_ERR_FAILED,
+ "not implemented",
+ request->queueIds.copyAndPop());
- // preserve message key
- response->setKey(request->getKey());
+ // preserve message key
+ response->setKey(request->getKey());
- // call the message queue service method to see if this is an async envelope
- if(service->_enqueueResponse((Message *)request, (Message *)response))
- {
- return(0);
- }
+ // call the message queue service method to see if this is an async envelope
+ if(service->_enqueueResponse((Message *)request, (Message *)response))
+ {
+ return(0);
+ }
- /*
- // lookup the message queue
- MessageQueue * queue = MessageQueue::lookup(request->queueIds.top());
+ /*
+ // lookup the message queue
+ MessageQueue * queue = MessageQueue::lookup(request->queueIds.top());
- PEGASUS_ASSERT(queue != 0);
+ PEGASUS_ASSERT(queue != 0);
- // enqueue the response
- queue->enqueue(response);
- */
+ // enqueue the response
+ queue->enqueue(response);
+ */
- return(0);
+ return(0);
}
PEGASUS_THREAD_RETURN PEGASUS_THREAD_CDECL ProviderManagerService::handleInvokeMethodRequest(void * arg)
{
- // get the service from argument
- ProviderManagerService * service = reinterpret_cast<ProviderManagerService *>(arg);
-
- PEGASUS_ASSERT(service != 0);
-
- // get message from service queue
- const CIMInvokeMethodRequestMessage * request =
- (const CIMInvokeMethodRequestMessage *)service->messageQueue.dequeue();
-
- PEGASUS_ASSERT(request != 0);
-
- // notify the service that the request has been accepted
- service->_threadSemaphore.signal();
-
- // process request
- CIMValue returnValue;
- Array<CIMParamValue> outParameters;
- Status status;
- CIMInstance cimInstance;
-
- try
- {
- // make class reference
- CIMReference classReference(
- request->instanceName.getHost(),
- request->nameSpace,
- request->instanceName.getClassName());
-
- // get the provider file name and logical name
- Pair<String, String> pair = service->_lookupProviderForClass(classReference);
-
- // get cached or load new provider module
- ProviderModule module = providerManager.getProviderModule(pair.first, pair.second);
-
- // encapsulate the physical provider in a facade
- ProviderFacade facade(module.getProvider());
-
- // convert arguments
- OperationContext context;
- CIMReference instanceReference(request->instanceName);
-
- // ATTN: propagate namespace
- instanceReference.setNameSpace(request->nameSpace);
-
- SimpleResponseHandler<CIMValue> handler;
-
- // forward request
- facade.invokeMethod(
- context,
- instanceReference,
- request->methodName,
- request->inParameters,
- outParameters,
- handler);
-
- // error? provider claims success, but did not deliver a CIMValue.
- if(handler._objects.size() == 0)
- {
- throw CIMException(CIM_ERR_NOT_FOUND);
- }
-
- returnValue = handler._objects[0];
- }
- catch(CIMException & e)
- {
- status = Status(e.getCode(), e.getMessage());
- }
- catch(Exception & e)
- {
- status = Status(CIM_ERR_FAILED, e.getMessage());
- }
- catch(...)
- {
- status = Status(CIM_ERR_FAILED, "Unknown Error");
- }
-
- // create response message
- CIMInvokeMethodResponseMessage * response =
- new CIMInvokeMethodResponseMessage(
- request->messageId,
- CIMStatusCode(status.getCode()),
- status.getMessage(),
- request->queueIds.copyAndPop(),
- returnValue,
- outParameters,
- request->methodName);
-
- // preserve message key
- response->setKey(request->getKey());
-
- // call the message queue service method to see if this is an async envelope
- if(service->_enqueueResponse((Message *)request, (Message *)response))
- {
- return(0);
- }
-
- /*
- // lookup the message queue
- MessageQueue * queue = MessageQueue::lookup(request->queueIds.top());
-
- PEGASUS_ASSERT(queue != 0);
-
- // enqueue the response
- queue->enqueue(response);
- */
-
- return(0);
+ // get the service from argument
+ ProviderManagerService * service = reinterpret_cast<ProviderManagerService *>(arg);
+
+ PEGASUS_ASSERT(service != 0);
+
+ // get message from service queue
+ const CIMInvokeMethodRequestMessage * request =
+ (const CIMInvokeMethodRequestMessage *)service->messageQueue.dequeue();
+
+ PEGASUS_ASSERT(request != 0);
+
+ // notify the service that the request has been accepted
+ service->_threadSemaphore.signal();
+
+ // process request
+ CIMValue returnValue;
+ Array<CIMParamValue> outParameters;
+ Status status;
+ CIMInstance cimInstance;
+
+ try
+ {
+ // make class reference
+ CIMReference classReference(
+ request->instanceName.getHost(),
+ request->nameSpace,
+ request->instanceName.getClassName());
+
+ // get the provider file name and logical name
+ Pair<String, String> pair = service->_lookupProviderForClass(classReference);
+
+ // get cached or load new provider module
+ ProviderModule module = providerManager.getProviderModule(pair.first, pair.second);
+
+ // encapsulate the physical provider in a facade
+ ProviderFacade facade(module.getProvider());
+
+ // convert arguments
+ OperationContext context;
+ CIMReference instanceReference(request->instanceName);
+
+ // ATTN: propagate namespace
+ instanceReference.setNameSpace(request->nameSpace);
+
+ SimpleResponseHandler<CIMValue> handler;
+
+ // forward request
+ facade.invokeMethod(
+ context,
+ instanceReference,
+ request->methodName,
+ request->inParameters,
+ outParameters,
+ handler);
+
+ // error? provider claims success, but did not deliver a CIMValue.
+ if(handler._objects.size() == 0)
+ {
+ throw CIMException(CIM_ERR_NOT_FOUND);
+ }
+
+ returnValue = handler._objects[0];
+ }
+ catch(CIMException & e)
+ {
+ status = Status(e.getCode(), e.getMessage());
+ }
+ catch(Exception & e)
+ {
+ status = Status(CIM_ERR_FAILED, e.getMessage());
+ }
+ catch(...)
+ {
+ status = Status(CIM_ERR_FAILED, "Unknown Error");
+ }
+
+ // create response message
+ CIMInvokeMethodResponseMessage * response =
+ new CIMInvokeMethodResponseMessage(
+ request->messageId,
+ CIMStatusCode(status.getCode()),
+ status.getMessage(),
+ request->queueIds.copyAndPop(),
+ returnValue,
+ outParameters,
+ request->methodName);
+
+ // preserve message key
+ response->setKey(request->getKey());
+
+ // call the message queue service method to see if this is an async envelope
+ if(service->_enqueueResponse((Message *)request, (Message *)response))
+ {
+ return(0);
+ }
+
+ /*
+ // lookup the message queue
+ MessageQueue * queue = MessageQueue::lookup(request->queueIds.top());
+
+ PEGASUS_ASSERT(queue != 0);
+
+ // enqueue the response
+ queue->enqueue(response);
+ */
+
+ return(0);
}
PEGASUS_THREAD_RETURN PEGASUS_THREAD_CDECL ProviderManagerService::handleEnableIndicationRequest(void * arg)
{
- // get the service from argument
- ProviderManagerService * service = reinterpret_cast<ProviderManagerService *>(arg);
-
- PEGASUS_ASSERT(service != 0);
-
- // get message from service queue
- const CIMEnableIndicationSubscriptionRequestMessage * request =
- (const CIMEnableIndicationSubscriptionRequestMessage *)service->messageQueue.dequeue();
-
- PEGASUS_ASSERT(request != 0);
-
- // notify the service that the request has been accepted
- service->_threadSemaphore.signal();
-
- CIMStatusCode errorCode = CIM_ERR_SUCCESS;
- String errorDescription = String::EMPTY;
-
- try
- {
- // make class reference
- CIMReference classReference(
- "",
- request->nameSpace,
- request->classNames[0]);
-
- // ATTN: this needs to be message based
- Pair<String, String> pair = service->_lookupProviderForClass(classReference);
- ProviderModule module = providerManager.getProviderModule(pair.first, pair.second);
- ProviderFacade facade(module.getProvider());
-
- SimpleResponseHandler<CIMInstance> handler;
-
- try
- {
- //
- // ATTN: pass thresholding parameter values in
- // operation context
- //
- facade.enableIndication(
- OperationContext (),
- request->nameSpace,
- request->classNames,
- request->providerName,
- request->propertyList,
- request->repeatNotificationPolicy,
- request->otherRepeatNotificationPolicy,
- request->repeatNotificationInterval,
- request->repeatNotificationGap,
- request->repeatNotificationCount,
- request->condition,
- request->queryLanguage,
- request->subscription,
- handler);
- }
- catch(...)
- {
- errorCode = CIM_ERR_FAILED;
- errorDescription = "Provider not available";
- }
- }
- catch(CIMException& exception)
- {
- errorCode = exception.getCode ();
- errorDescription = exception.getMessage ();
- }
- catch(Exception& exception)
- {
- errorCode = CIM_ERR_FAILED;
- errorDescription = exception.getMessage ();
- }
- catch(...)
- {
- errorCode = CIM_ERR_FAILED;
- }
-
- CIMEnableIndicationSubscriptionResponseMessage * response =
- new CIMEnableIndicationSubscriptionResponseMessage(
- request->messageId,
- errorCode,
- errorDescription,
- request->queueIds.copyAndPop());
-
- // preserve message key
- response->setKey(request->getKey());
-
- // call the message queue service method to see if this is an async envelope
- if(service->_enqueueResponse((Message *)request, (Message *)response))
- {
- return(0);
- }
-
- /*
- // lookup the message queue
- MessageQueue * queue = MessageQueue::lookup(request->queueIds.top());
-
- PEGASUS_ASSERT(queue != 0);
-
- // enqueue the response
- queue->enqueue(response);
- */
-
- return(0);
+ // get the service from argument
+ ProviderManagerService * service = reinterpret_cast<ProviderManagerService *>(arg);
+
+ PEGASUS_ASSERT(service != 0);
+
+ // get message from service queue
+ const CIMEnableIndicationSubscriptionRequestMessage * request =
+ (const CIMEnableIndicationSubscriptionRequestMessage *)service->messageQueue.dequeue();
+
+ PEGASUS_ASSERT(request != 0);
+
+ // notify the service that the request has been accepted
+ service->_threadSemaphore.signal();
+
+ CIMStatusCode errorCode = CIM_ERR_SUCCESS;
+ String errorDescription = String::EMPTY;
+
+ try
+ {
+ // make class reference
+ CIMReference classReference(
+ "",
+ request->nameSpace,
+ request->classNames[0]);
+
+ // ATTN: this needs to be message based
+ Pair<String, String> pair = service->_lookupProviderForClass(classReference);
+ ProviderModule module = providerManager.getProviderModule(pair.first, pair.second);
+ ProviderFacade facade(module.getProvider());
+
+ SimpleResponseHandler<CIMInstance> handler;
+
+ try
+ {
+ //
+ // ATTN: pass thresholding parameter values in
+ // operation context
+ //
+ facade.enableIndication(
+ OperationContext (),
+ request->nameSpace,
+ request->classNames,
+ request->providerName,
+ request->propertyList,
+ request->repeatNotificationPolicy,
+ request->otherRepeatNotificationPolicy,
+ request->repeatNotificationInterval,
+ request->repeatNotificationGap,
+ request->repeatNotificationCount,
+ request->condition,
+ request->queryLanguage,
+ request->subscription,
+ handler);
+ }
+ catch(...)
+ {
+ errorCode = CIM_ERR_FAILED;
+ errorDescription = "Provider not available";
+ }
+ }
+ catch(CIMException& exception)
+ {
+ errorCode = exception.getCode ();
+ errorDescription = exception.getMessage ();
+ }
+ catch(Exception& exception)
+ {
+ errorCode = CIM_ERR_FAILED;
+ errorDescription = exception.getMessage ();
+ }
+ catch(...)
+ {
+ errorCode = CIM_ERR_FAILED;
+ }
+
+ CIMEnableIndicationSubscriptionResponseMessage * response =
+ new CIMEnableIndicationSubscriptionResponseMessage(
+ request->messageId,
+ errorCode,
+ errorDescription,
+ request->queueIds.copyAndPop());
+
+ // preserve message key
+ response->setKey(request->getKey());
+
+ // call the message queue service method to see if this is an async envelope
+ if(service->_enqueueResponse((Message *)request, (Message *)response))
+ {
+ return(0);
+ }
+
+ /*
+ // lookup the message queue
+ MessageQueue * queue = MessageQueue::lookup(request->queueIds.top());
+
+ PEGASUS_ASSERT(queue != 0);
+
+ // enqueue the response
+ queue->enqueue(response);
+ */
+
+ return(0);
}
PEGASUS_THREAD_RETURN PEGASUS_THREAD_CDECL ProviderManagerService::handleModifyIndicationRequest(void * arg)
{
- // get the service from argument
- ProviderManagerService * service = reinterpret_cast<ProviderManagerService *>(arg);
+ // get the service from argument
+ ProviderManagerService * service = reinterpret_cast<ProviderManagerService *>(arg);
- PEGASUS_ASSERT(service != 0);
+ PEGASUS_ASSERT(service != 0);
- // get message from service queue
- const CIMModifyIndicationSubscriptionRequestMessage * request =
- (const CIMModifyIndicationSubscriptionRequestMessage *)service->messageQueue.dequeue();
+ // get message from service queue
+ const CIMModifyIndicationSubscriptionRequestMessage * request =
+ (const CIMModifyIndicationSubscriptionRequestMessage *)service->messageQueue.dequeue();
- PEGASUS_ASSERT(request != 0);
+ PEGASUS_ASSERT(request != 0);
- // notify the service that the request has been accepted
- service->_threadSemaphore.signal();
+ // notify the service that the request has been accepted
+ service->_threadSemaphore.signal();
- CIMModifyIndicationSubscriptionResponseMessage * response =
- new CIMModifyIndicationSubscriptionResponseMessage(
- request->messageId,
- CIM_ERR_FAILED,
- "not implemented",
- request->queueIds.copyAndPop());
+ CIMModifyIndicationSubscriptionResponseMessage * response =
+ new CIMModifyIndicationSubscriptionResponseMessage(
+ request->messageId,
+ CIM_ERR_FAILED,
+ "not implemented",
+ request->queueIds.copyAndPop());
- // preserve message key
- response->setKey(request->getKey());
+ // preserve message key
+ response->setKey(request->getKey());
- // call the message queue service method to see if this is an async envelope
- if(service->_enqueueResponse((Message *)request, (Message *)response))
- {
- return(0);
- }
+ // call the message queue service method to see if this is an async envelope
+ if(service->_enqueueResponse((Message *)request, (Message *)response))
+ {
+ return(0);
+ }
- /*
- // lookup the message queue
- MessageQueue * queue = MessageQueue::lookup(request->queueIds.top());
+ /*
+ // lookup the message queue
+ MessageQueue * queue = MessageQueue::lookup(request->queueIds.top());
- PEGASUS_ASSERT(queue != 0);
+ PEGASUS_ASSERT(queue != 0);
- // enqueue the response
- queue->enqueue(response);
- */
+ // enqueue the response
+ queue->enqueue(response);
+ */
- return(0);
+ return(0);
}
PEGASUS_THREAD_RETURN PEGASUS_THREAD_CDECL ProviderManagerService::handleDisableIndicationRequest(void * arg)
{
- // get the service from argument
- ProviderManagerService * service = reinterpret_cast<ProviderManagerService *>(arg);
+ // get the service from argument
+ ProviderManagerService * service = reinterpret_cast<ProviderManagerService *>(arg);
- PEGASUS_ASSERT(service != 0);
+ PEGASUS_ASSERT(service != 0);
- // get message from service queue
- const CIMDisableIndicationSubscriptionRequestMessage * request =
- (const CIMDisableIndicationSubscriptionRequestMessage *)service->messageQueue.dequeue();
+ // get message from service queue
+ const CIMDisableIndicationSubscriptionRequestMessage * request =
+ (const CIMDisableIndicationSubscriptionRequestMessage *)service->messageQueue.dequeue();
- PEGASUS_ASSERT(request != 0);
+ PEGASUS_ASSERT(request != 0);
- // notify the service that the request has been accepted
- service->_threadSemaphore.signal();
+ // notify the service that the request has been accepted
+ service->_threadSemaphore.signal();
- CIMDisableIndicationSubscriptionResponseMessage * response =
- new CIMDisableIndicationSubscriptionResponseMessage(
- request->messageId,
- CIM_ERR_FAILED,
- "not implemented",
- request->queueIds.copyAndPop());
+ CIMDisableIndicationSubscriptionResponseMessage * response =
+ new CIMDisableIndicationSubscriptionResponseMessage(
+ request->messageId,
+ CIM_ERR_FAILED,
+ "not implemented",
+ request->queueIds.copyAndPop());
- // preserve message key
- response->setKey(request->getKey());
+ // preserve message key
+ response->setKey(request->getKey());
- // call the message queue service method to see if this is an async envelope
- if(service->_enqueueResponse((Message *)request, (Message *)response))
- {
- return(0);
- }
+ // call the message queue service method to see if this is an async envelope
+ if(service->_enqueueResponse((Message *)request, (Message *)response))
+ {
+ return(0);
+ }
- /*
- // lookup the message queue
- MessageQueue * queue = MessageQueue::lookup(request->queueIds.top());
+ /*
+ // lookup the message queue
+ MessageQueue * queue = MessageQueue::lookup(request->queueIds.top());
- PEGASUS_ASSERT(queue != 0);
+ PEGASUS_ASSERT(queue != 0);
- // enqueue the response
- queue->enqueue(response);
- */
+ // enqueue the response
+ queue->enqueue(response);
+ */
- return(0);
+ return(0);
}
PEGASUS_NAMESPACE_END
diff --git a/src/Pegasus/ProviderManager/ProviderManagerService.h b/src/Pegasus/ProviderManager/ProviderManagerService.h
index 288d1b0..e6fa6f8 100644
--- a/src/Pegasus/ProviderManager/ProviderManagerService.h
+++ b/src/Pegasus/ProviderManager/ProviderManagerService.h
@@ -73,12 +73,17 @@ public:
// short term hack
ProviderManager * getProviderManager(void);
-protected:
- virtual Boolean messageOK(const Message * message);
- virtual void handleEnqueue(void);
- virtual void handleEnqueue(Message * message);
-
- virtual void _handle_async_request(AsyncRequest * request);
+ protected:
+ virtual Boolean messageOK(const Message * message);
+ virtual void handleEnqueue(void);
+ virtual void handleEnqueue(Message * message);
+ virtual void handleEnqueue(AsyncOpNode *);
+
+ virtual void _handle_incoming_operation(AsyncOpNode *operation,
+ Thread *thread,
+ MessageQueue *queue);
+
+ virtual void _handle_async_request(AsyncRequest * request);
protected:
Pair<String, String> _lookupProviderForClass(const CIMObjectPath & objectPath);
diff --git a/src/Pegasus/Server/CIMOperationRequestDispatcher.cpp b/src/Pegasus/Server/CIMOperationRequestDispatcher.cpp
index d39e5d3..244e27d 100644
--- a/src/Pegasus/Server/CIMOperationRequestDispatcher.cpp
+++ b/src/Pegasus/Server/CIMOperationRequestDispatcher.cpp
@@ -286,6 +286,8 @@ void CIMOperationRequestDispatcher::_enqueueResponse(
response->setKey(request->getKey());
+ response->dest = request->queueIds.top();
+
if( true == Base::_enqueueResponse(request, response))
return;
@@ -519,6 +521,136 @@ void CIMOperationRequestDispatcher::handleGetClassRequest(
}
void CIMOperationRequestDispatcher::handleGetInstanceRequest(
+ AsyncOpNode *op, MessageQueue *q, void *parm)
+{
+
+ CIMOperationRequestDispatcher *myself =
+ reinterpret_cast<CIMOperationRequestDispatcher *>(parm);
+
+
+ if ( ! (op->_state & ASYNC_OPSTATE_COMPLETE ))
+ {
+ // start of async op
+ CIMGetInstanceRequestMessage *request =
+ static_cast<CIMGetInstanceRequestMessage *>(op->_request.next(0));
+
+ // get the class name
+ String className = request->instanceName.getClassName();
+
+ // check the class name for an "internal provider"
+ if(String::equalNoCase(className, "CIM_Provider") ||
+ String::equalNoCase(className, "CIM_ProviderCapabilities") ||
+ String::equalNoCase(className, "CIM_ProviderElementCapabilities"))
+ {
+ // send to the configuration manager. it will generate the
+ // appropriate response message.
+
+ myself->ForwardRequest(op, &(myself->_configurationManager));
+ return;
+ }
+
+ //
+ // check the class name for subscription, filter and handler
+ //
+ if(String::equalNoCase(className, "CIM_IndicationSubscription") ||
+ String::equalNoCase(className, "CIM_IndicationHandlerCIMXML") ||
+ String::equalNoCase(className, "CIM_IndicationHandlerSNMP") ||
+ String::equalNoCase(className, "CIM_IndicationFilter"))
+ {
+ //
+ // Send to the indication service. It will generate the
+ // appropriate response message.
+ //
+
+ // lookup IndicationService
+ MessageQueue * queue = MessageQueue::lookup("Server::IndicationService");
+
+ PEGASUS_ASSERT(queue != 0);
+ myself->ForwardRequest(op, queue);
+
+ return;
+ }
+
+ // get provider for class
+ String providerName =
+ myself->_lookupProviderForClass(request->nameSpace, className);
+
+ if(providerName.size() != 0)
+ {
+ Array<Uint32> serviceQueueIds;
+
+ myself->find_services(String("Server::ProviderManagerService"), 0, 0, &serviceQueueIds);
+ PEGASUS_ASSERT(serviceQueueIds.size() != 0);
+
+ myself->SendAsync( op , serviceQueueIds[0], handleGetInstanceRequest, myself );
+ return;
+
+ }
+
+ CIMStatusCode errorCode = CIM_ERR_SUCCESS;
+ String errorDescription;
+ CIMInstance cimInstance;
+
+ myself->_repository->read_lock();
+
+ try
+ {
+ cimInstance = myself->_repository->getInstance(
+ request->nameSpace,
+ request->instanceName,
+ request->localOnly,
+ request->includeQualifiers,
+ request->includeClassOrigin,
+ request->propertyList.getPropertyNameArray());
+ }
+ catch(CIMException& exception)
+ {
+ errorCode = exception.getCode();
+ errorDescription = exception.getMessage();
+ }
+ catch(Exception& exception)
+ {
+ errorCode = CIM_ERR_FAILED;
+ errorDescription = exception.getMessage();
+ }
+ catch(...)
+ {
+ errorCode = CIM_ERR_FAILED;
+ }
+
+ myself->_repository->read_unlock();
+
+ CIMGetInstanceResponseMessage* response = new CIMGetInstanceResponseMessage(
+ request->messageId,
+ errorCode,
+ errorDescription,
+ request->queueIds.copyAndPop(),
+ cimInstance);
+
+ response->setKey(request->getKey());
+
+ response->dest = request->queueIds.top();
+ myself->SendForget(response);
+
+ delete op;
+ return;
+
+ }
+
+ else
+ {
+ // aysnc op is complete
+ MessageQueue *dest = MessageQueue::lookup(
+ (static_cast<CIMGetInstanceRequestMessage *>
+ (op->_request.next(0)))->queueIds.top()) ;
+ myself->ForwardResponse(op, dest);
+ }
+
+}
+
+
+
+void CIMOperationRequestDispatcher::handleGetInstanceRequest(
CIMGetInstanceRequestMessage* request)
{
// ATTN: Need code here to expand partial instance!
diff --git a/src/Pegasus/Server/CIMOperationRequestDispatcher.h b/src/Pegasus/Server/CIMOperationRequestDispatcher.h
index 341d606..c880e4d 100644
--- a/src/Pegasus/Server/CIMOperationRequestDispatcher.h
+++ b/src/Pegasus/Server/CIMOperationRequestDispatcher.h
@@ -76,6 +76,9 @@ public:
void handleGetInstanceRequest(
CIMGetInstanceRequestMessage* request);
+ static void handleGetInstanceRequest(
+ AsyncOpNode *, MessageQueue *, void * );
+
void handleDeleteClassRequest(
CIMDeleteClassRequestMessage* request);