PEP # ?: Pegasus CIMOMHandle |
Type | Status | Approveers |
---|---|---|
Architecture | Draft | Pegasus architecture team |
Version | Date | Author | Comments |
---|---|---|---|
1.0 | Thu Feb 13 11:58:12 2003 | Mike Day | initial submission |
2.0 | Fri Mar 7 12:17:45 2003 | Mike Day |
Changed handling of timeout to use an OperationContext container. Upgraded interfaces to be consistent with CIMClient. Changed exception specification to throw CIMException. Exception error code and string are captured from CIMResponseMessage and rethrown to provider whenever the CIM_ERR code is not zero. |
The CIMOMHandle in Pegasus is the object that providers must use to gain access to Pegasus services including the repository and other providers. A functioning CIMOMHandle is necessary for association support.
The CIMOMhandle also serves a useful role for asynchronous providers in that it facilitates communication of status between Pegasus and its providers. For example, some providers must always remain loaded, or must ensure they are not unloaded during a critical or time consuming operation. They need the CIMOMHandle to indicate this status back to Pegasus.
The CIMOMHandle in Pegasus does not work right now. This document proposes a redesign of the CIMOMHandle to ensure it works and fulfills present and future requirements.
Pegasus requires the CIMOMHandle to provide the following facilities:
This document proposes adding a new Server component to Pegasus that acts as a binary request encoder/decoder. The CIMOMHandle presents providers with what is logically a CIMClient interface. However, instead of generating CIM/XML operations, the CIMOMHandle enqueues binary CIMRequest/Response messages to the new Server component.
The new Server component fulfills the role of both request decoder and response encoder. Except that it does not encode/decode; it only passes the preformed messages through the normal execution path and forwards the response back to the CIMOMHandle.
CIMOMHandle client requests originate as CIMMessage objects. They don't need to be decoded. They follow the exact same processing path as decoded client operations.
Responses to CIMOMHandle operations follow the exact same processing paths as Client responses, up to the encoding step. Instead of being encoded and transmitted, they are enqueued back to the CIMOMhandle. The CIMOMHandle marshals the response data and returns from the method call back to the provider.
The advantages to this proposal include the following:
The alternative I considered was to use the CIMClient class to invoke the client interface from the CIMOMHandle. However, this approach has the following disadvantages:
This proposal is already implemented. Source code is included at the end of this document. It can be committed to the head of the repository immediately upon acceptance by the Architecture Team.
To Mimimize risk, I have already implemented and tested this proposal in the mday-2-0-patches branch of the CVS repository.
1 //%///-*-c++-*-///////////////////////////////////////////////////////////////// 2 // 3 // Copyright (c) 2000, 2001, 2002 BMC Software, Hewlett-Packard Company, IBM, 4 // The Open Group, Tivoli Systems 5 // 6 // Permission is hereby granted, free of charge, to any person obtaining a copy 7 // of this software and associated documentation files (the "Software"), to 8 // deal in the Software without restriction, including without limitation the 9 // rights to use, copy, modify, merge, publish, distribute, sublicense, and/or 10 // sell copies of the Software, and to permit persons to whom the Software is 11 // furnished to do so, subject to the following conditions: 12 // 13 // THE ABOVE COPYRIGHT NOTICE AND THIS PERMISSION NOTICE SHALL BE INCLUDED IN 14 // ALL COPIES OR SUBSTANTIAL PORTIONS OF THE SOFTWARE. THE SOFTWARE IS PROVIDED 15 // "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT 16 // LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR 17 // PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 18 // HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN 19 // ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 20 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 21 // 22 //============================================================================== 23 // 24 // Author: Chip Vincent (cvincent@us.ibm.com) 25 // 26 // Modified By: Mike Brasher (mbrasher@bmc.com) 27 // Yi Zhou, Hewlett-Packard Company (yi_zhou@hp.com) 28 // Roger Kumpf, Hewlett-Packard Company (roger_kumpf@hp.com) 29 // Mike Day, IBM (mdday@us.ibm.com) 30 // 31 //%///////////////////////////////////////////////////////////////////////////// 32 33 34 #ifndef Pegasus_CIMOMHandle_h 35 #define Pegasus_CIMOMHandle_h 36 37 #include <Pegasus/Common/Config.h> 38 #include <Pegasus/Common/ModuleController.h> 39 #include <Pegasus/Common/OperationContext.h> 40 #include <Pegasus/Common/CIMObject.h> 41 #include <Pegasus/Common/CIMObjectPath.h> 42 #include <Pegasus/Common/CIMClass.h> 43 #include <Pegasus/Common/CIMInstance.h> 44 #include <Pegasus/Common/CIMPropertyList.h> 45 #include <Pegasus/Common/ResponseHandler.h> 46 #include "Linkage.h" 47 48 PEGASUS_NAMESPACE_BEGIN 49 50 class ProviderManager; 51 class Provider; 52 53 class cimom_handle_op_semaphore; 54 55 class PEGASUS_PROVIDER_LINKAGE TimeoutContainer : public OperationContext::Container 56 { 57 public: 58 static const String NAME; 59 60 TimeoutContainer(const OperationContext::Container & container); 61 TimeoutContainer(Uint32 timeout); 62 virtual String getName(void) const; 63 virtual OperationContext::Container * clone(void) const; 64 virtual void destroy(void); 65 66 Uint32 getTimeOut(void) const; 67 protected: 68 Uint32 _value; 69 private: 70 TimeoutContainer(void); 71 }; 72 73 74 class PEGASUS_PROVIDER_LINKAGE CIMOMHandle 75 { 76 77 public: 78 79 /** */ 80 CIMOMHandle(void); 81 CIMOMHandle(const CIMOMHandle &); 82 83 /** */ 84 virtual ~CIMOMHandle(void); 85 86 CIMOMHandle & operator=(const CIMOMHandle & handle); 87 88 CIMClass getClass( 89 const OperationContext & context, 90 const CIMNamespaceName& nameSpace, 91 const CIMName& className, 92 Boolean localOnly, 93 Boolean includeQualifiers, 94 Boolean includeClassOrigin, 95 const CIMPropertyList& propertyList); 96 97 Array<CIMClass> enumerateClasses( 98 const OperationContext & context, 99 const CIMNamespaceName& nameSpace, 100 const CIMName& className, 101 Boolean deepInheritance, 102 Boolean localOnly, 103 Boolean includeQualifiers, 104 Boolean includeClassOrigin); 105 106 Array<CIMName> enumerateClassNames( 107 const OperationContext & context, 108 const CIMNamespaceName& nameSpace, 109 const CIMName& className, 110 Boolean deepInheritance); 111 112 void createClass( 113 const OperationContext & context, 114 const CIMNamespaceName& nameSpace, 115 const CIMClass& newClass); 116 117 void modifyClass( 118 const OperationContext & context, 119 const CIMNamespaceName& nameSpace, 120 const CIMClass& modifiedClass); 121 122 void deleteClass( 123 const OperationContext & context, 124 const CIMNamespaceName& nameSpace, 125 const CIMName& className); 126 127 CIMInstance getInstance( 128 const OperationContext & context, 129 const CIMNamespaceName& nameSpace, 130 const CIMObjectPath& instanceName, 131 Boolean localOnly, 132 Boolean includeQualifiers, 133 Boolean includeClassOrigin, 134 const CIMPropertyList& propertyList); 135 136 Array<CIMInstance> enumerateInstances( 137 const OperationContext & context, 138 const CIMNamespaceName& nameSpace, 139 const CIMName& className, 140 Boolean deepInheritance, 141 Boolean localOnly, 142 Boolean includeQualifiers, 143 Boolean includeClassOrigin, 144 const CIMPropertyList& propertyList); 145 146 Array<CIMObjectPath> enumerateInstanceNames( 147 const OperationContext & context, 148 const CIMNamespaceName& nameSpace, 149 const CIMName& className); 150 151 CIMObjectPath createInstance( 152 const OperationContext & context, 153 const CIMNamespaceName& nameSpace, 154 const CIMInstance& newInstance); 155 156 void modifyInstance( 157 const OperationContext & context, 158 const CIMNamespaceName& nameSpace, 159 const CIMInstance& modifiedInstance, 160 Boolean includeQualifiers, 161 const CIMPropertyList& propertyList); 162 163 void deleteInstance( 164 const OperationContext & context, 165 const CIMNamespaceName& nameSpace, 166 const CIMObjectPath& instanceName); 167 168 Array<CIMObject> execQuery( 169 const OperationContext & context, 170 const CIMNamespaceName& nameSpace, 171 const String& queryLanguage, 172 const String& query); 173 174 Array<CIMObject> associators( 175 const OperationContext & context, 176 const CIMNamespaceName& nameSpace, 177 const CIMObjectPath& objectName, 178 const CIMName& assocClass, 179 const CIMName& resultClass, 180 const String& role, 181 const String& resultRole, 182 Boolean includeQualifiers, 183 Boolean includeClassOrigin, 184 const CIMPropertyList& propertyList); 185 186 Array<CIMObjectPath> associatorNames( 187 const OperationContext & context, 188 const CIMNamespaceName& nameSpace, 189 const CIMObjectPath& objectName, 190 const CIMName& assocClass, 191 const CIMName& resultClass, 192 const String& role, 193 const String& resultRole); 194 195 Array<CIMObject> references( 196 const OperationContext & context, 197 const CIMNamespaceName& nameSpace, 198 const CIMObjectPath& objectName, 199 const CIMName& resultClass, 200 const String& role, 201 Boolean includeQualifiers, 202 Boolean includeClassOrigin, 203 const CIMPropertyList& propertyList); 204 205 Array<CIMObjectPath> referenceNames( 206 const OperationContext & context, 207 const CIMNamespaceName& nameSpace, 208 const CIMObjectPath& objectName, 209 const CIMName& resultClass, 210 const String& role); 211 212 // property operations 213 CIMValue getProperty( 214 const OperationContext & context, 215 const CIMNamespaceName& nameSpace, 216 const CIMObjectPath& instanceName, 217 const CIMName& propertyName); 218 219 void setProperty( 220 const OperationContext & context, 221 const CIMNamespaceName& nameSpace, 222 const CIMObjectPath& instanceName, 223 const CIMName& propertyName, 224 const CIMValue& newValue); 225 226 CIMValue invokeMethod( 227 const OperationContext & context, 228 const CIMNamespaceName& nameSpace, 229 const CIMObjectPath& instanceName, 230 const CIMName& methodName, 231 const Array<CIMParamValue>& inParameters, 232 Array<CIMParamValue>& outParameters); 233 234 235 236 // force provider manager to keep in memory 237 virtual void protect(void); 238 // allow provider manager to unload when idle 239 virtual void unprotect(void); 240 241 class _cimom_handle_rep; 242 _cimom_handle_rep *_rep; 243 private: 244 friend class Provider; 245 friend class cimom_handle_op_semaphore; 246 virtual void get_idle_timer(struct timeval *); 247 virtual void update_idle_timer(void); 248 virtual Boolean pending_operation(void); 249 virtual Boolean unload_ok(void); 250 }; 251 252 253 254 255 256 PEGASUS_NAMESPACE_END 257 258 #endif
1 //%/////////////-*-c++-*-/////////////////////////////////////////////////////// 2 // 3 // Copyright (c) 2000 - 2003 BMC Software, Hewlett-Packard Company, IBM, 4 // The Open Group, Tivoli Systems 5 // 6 // Permission is hereby granted, free of charge, to any person obtaining a copy 7 // of this software and associated documentation files (the "Software"), to 8 // deal in the Software without restriction, including without limitation the 9 // rights to use, copy, modify, merge, publish, distribute, sublicense, and/or 10 // sell copies of the Software, and to permit persons to whom the Software is 11 // furnished to do so, subject to the following conditions: 12 // 13 // THE ABOVE COPYRIGHT NOTICE AND THIS PERMISSION NOTICE SHALL BE INCLUDED IN 14 // ALL COPIES OR SUBSTANTIAL PORTIONS OF THE SOFTWARE. THE SOFTWARE IS PROVIDED 15 // "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT 16 // LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR 17 // PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 18 // HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN 19 // ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 20 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 21 // 22 //============================================================================== 23 // 24 // Author: Mike Day (mdday@us.ibm.com) 25 // 26 //%///////////////////////////////////////////////////////////////////////////// 27 #ifndef Pegasus_BinaryMessageHandler_h 28 #define Pegasus_BinaryMessageHandler_h 29 #include <Pegasus/Common/Config.h> 30 #include <Pegasus/Common/AsyncOpNode.h> 31 #include <Pegasus/Common/DQueue.h> 32 #include <Pegasus/Common/MessageQueueService.h> 33 #include <Pegasus/Common/Message.h> 34 #include <Pegasus/Common/CIMMessage.h> 35 #include <Pegasus/Common/Tracer.h> 36 #include <Pegasus/Common/TraceComponents.h> 37 #include <Pegasus/Common/IPC.h> 38 #include <Pegasus/Common/Thread.h> 39 #include <Pegasus/Common/Constants.h> 40 #include <Pegasus/Server/Linkage.h> 41 42 PEGASUS_NAMESPACE_BEGIN 43 44 /** This class provides an in-process binary client interface, 45 both for requests and responses. 46 */ 47 48 class PEGASUS_SERVER_LINKAGE BinaryMessageHandler : public MessageQueueService 49 { 50 public: 51 typedef MessageQueueService Base; 52 53 BinaryMessageHandler(MessageQueueService *outputQueue); 54 ~BinaryMessageHandler(); 55 56 virtual Boolean messageOK(const Message * message); 57 virtual void handleEnqueue(void); 58 virtual void handleEnqueue(Message * message); 59 virtual void _handle_async_request(AsyncRequest * request); 60 protected: 61 static PEGASUS_THREAD_RETURN PEGASUS_THREAD_CDECL handle_binary_message(void *); 62 63 // **** Request Messages **** // 64 65 void handleCreateClassRequest( 66 AsyncOpNode *, 67 CIMCreateClassRequestMessage *) throw(); 68 69 void handleGetClassRequest( 70 AsyncOpNode *, 71 CIMGetClassRequestMessage *) throw(); 72 73 void handleModifyClassRequest( 74 AsyncOpNode *, 75 CIMModifyClassRequestMessage *) throw(); 76 77 void handleEnumerateClassNamesRequest( 78 AsyncOpNode *, 79 CIMEnumerateClassNamesRequestMessage *) throw(); 80 81 void handleEnumerateClassesRequest( 82 AsyncOpNode *, 83 CIMEnumerateClassesRequestMessage *) throw(); 84 85 void handleDeleteClassRequest( 86 AsyncOpNode *, 87 CIMDeleteClassRequestMessage *) throw(); 88 89 void handleCreateInstanceRequest( 90 AsyncOpNode *, 91 CIMCreateInstanceRequestMessage *) throw(); 92 93 void handleGetInstanceRequest( 94 AsyncOpNode *, 95 CIMGetInstanceRequestMessage *) throw(); 96 97 void handleModifyInstanceRequest( 98 AsyncOpNode *, 99 CIMModifyInstanceRequestMessage *) throw(); 100 101 void handleEnumerateInstanceNamesRequest( 102 AsyncOpNode *, 103 CIMEnumerateInstanceNamesRequestMessage *) throw(); 104 105 void handleEnumerateInstancesRequest( 106 AsyncOpNode *, 107 CIMEnumerateInstancesRequestMessage *) throw(); 108 109 void handleDeleteInstanceRequest( 110 AsyncOpNode *, 111 CIMDeleteInstanceRequestMessage *) throw(); 112 113 void handleSetQualifierRequest( 114 AsyncOpNode *, 115 CIMSetQualifierRequestMessage *) throw(); 116 117 void handleGetQualifierRequest( 118 AsyncOpNode *, 119 CIMGetQualifierRequestMessage *) throw(); 120 121 void handleEnumerateQualifiersRequest( 122 AsyncOpNode *, 123 CIMEnumerateQualifiersRequestMessage *) throw(); 124 125 void handleDeleteQualifiersRequest( 126 AsyncOpNode *, 127 CIMDeleteQualifierRequestMessage *) throw(); 128 129 void handleReferenceNamesRequest( 130 AsyncOpNode *, 131 CIMReferenceNamesRequestMessage *) throw(); 132 133 void handleReferencesRequest( 134 AsyncOpNode *, 135 CIMReferencesRequestMessage *) throw(); 136 137 void handleAssociatorNamesRequest( 138 AsyncOpNode *, 139 CIMAssociatorNamesRequestMessage *) throw(); 140 141 void handleAssociatorsRequest( 142 AsyncOpNode *, 143 CIMAssociatorsRequestMessage *) throw(); 144 145 void handleGetPropertyRequest( 146 AsyncOpNode *, 147 CIMGetPropertyRequestMessage *) throw(); 148 149 void handleSetPropertyRequest( 150 AsyncOpNode *, 151 CIMSetPropertyRequestMessage *) throw(); 152 153 void handleExecQueryRequest( 154 AsyncOpNode *, 155 CIMExecQueryRequestMessage *) throw(); 156 157 void handleInvokeMethodRequest( 158 AsyncOpNode *, 159 CIMInvokeMethodRequestMessage *) throw(); 160 161 // **** Response Messages **** // 162 163 void handleCreateClassResponse( 164 AsyncOpNode *, 165 CIMCreateClassResponseMessage *) throw(); 166 167 void handleGetClassResponse( 168 AsyncOpNode *, 169 CIMGetClassResponseMessage *) throw(); 170 171 void handleModifyClassResponse( 172 AsyncOpNode *, 173 CIMModifyClassResponseMessage *) throw(); 174 175 void handleEnumerateClassNamesResponse( 176 AsyncOpNode *, 177 CIMEnumerateClassNamesResponseMessage *) throw(); 178 179 void handleEnumerateClassesResponse( 180 AsyncOpNode *, 181 CIMEnumerateClassesResponseMessage *) throw(); 182 183 void handleDeleteClassResponse( 184 AsyncOpNode *, 185 CIMDeleteClassResponseMessage *) throw(); 186 187 void handleCreateInstanceResponse( 188 AsyncOpNode *, 189 CIMCreateInstanceResponseMessage *) throw(); 190 191 void handleGetInstanceResponse( 192 AsyncOpNode *, 193 CIMGetInstanceResponseMessage *) throw(); 194 195 void handleModifyInstanceResponse( 196 AsyncOpNode *, 197 CIMModifyInstanceResponseMessage *) throw(); 198 199 void handleEnumerateInstanceNamesResponse( 200 AsyncOpNode *, 201 CIMEnumerateInstanceNamesResponseMessage *) throw(); 202 203 void handleEnumerateInstancesResponse( 204 AsyncOpNode *, 205 CIMEnumerateInstancesResponseMessage *) throw(); 206 207 void handleDeleteInstanceResponse( 208 AsyncOpNode *, 209 CIMDeleteInstanceResponseMessage *) throw(); 210 211 void handleGetPropertyResponse( 212 AsyncOpNode *, 213 CIMGetPropertyResponseMessage *) throw(); 214 215 void handleSetPropertyResponse( 216 AsyncOpNode *, 217 CIMSetPropertyResponseMessage *) throw(); 218 219 void handleSetQualifierResponse( 220 AsyncOpNode *, 221 CIMSetQualifierResponseMessage *) throw(); 222 223 void handleGetQualifierResponse( 224 AsyncOpNode *, 225 CIMGetQualifierResponseMessage *) throw(); 226 227 void handleEnumerateQualifiersResponse( 228 AsyncOpNode *, 229 CIMEnumerateQualifiersResponseMessage *) throw(); 230 231 void handleDeleteQualifierResponse( 232 AsyncOpNode *, 233 CIMDeleteQualifierResponseMessage *) throw(); 234 235 void handleReferenceNamesResponse( 236 AsyncOpNode *, 237 CIMReferenceNamesResponseMessage *) throw(); 238 239 void handleReferencesResponse( 240 AsyncOpNode *, 241 CIMReferencesResponseMessage *) throw(); 242 243 void handleAssociatorNamesResponse( 244 AsyncOpNode *, 245 CIMAssociatorNamesResponseMessage *) throw(); 246 247 void handleAssociatorsResponse( 248 AsyncOpNode *, 249 CIMAssociatorsResponseMessage *) throw(); 250 251 void handleExecQueryResponse( 252 AsyncOpNode *, 253 CIMExecQueryResponseMessage *) throw(); 254 255 void handleInvokeMethodResponse( 256 AsyncOpNode *, 257 CIMInvokeMethodResponseMessage *) throw(); 258 259 private: 260 BinaryMessageHandler(void); 261 BinaryMessageHandler & operator = (const BinaryMessageHandler & ) const; 262 void _handleRequest(AsyncOpNode *, Message *) throw(); 263 void _handleResponse(AsyncOpNode *, Message *) throw(); 264 265 266 MessageQueueService* _outputQueue; 267 268 // Flag to indicate whether or not the CIMServer is shutting down. 269 Boolean _serverTerminating; 270 AsyncDQueue<AsyncOpNode> _msg_q; 271 272 }; 273 274 275 PEGASUS_NAMESPACE_END 276 277 #endif // Pegasus_BinaryMessageHandler_h
Existing client operations arrive at Pegasus as CIM/XML documents and are decoded into CIMMessage objects. Then they are dispatched to Pegasus. Responses are encoded from CIMMessage objects back into CIM/XML documents.