(file) Return to CIMClientRep.h CVS log (file) (dir) Up to [Pegasus] / pegasus / src / Pegasus / Client

  1 martin 1.32 //%LICENSE////////////////////////////////////////////////////////////////
  2 martin 1.33 //
  3 martin 1.32 // Licensed to The Open Group (TOG) under one or more contributor license
  4             // agreements.  Refer to the OpenPegasusNOTICE.txt file distributed with
  5             // this work for additional information regarding copyright ownership.
  6             // Each contributor licenses this file to you under the OpenPegasus Open
  7             // Source License; you may not use this file except in compliance with the
  8             // License.
  9 martin 1.33 //
 10 martin 1.32 // Permission is hereby granted, free of charge, to any person obtaining a
 11             // copy of this software and associated documentation files (the "Software"),
 12             // to deal in the Software without restriction, including without limitation
 13             // the rights to use, copy, modify, merge, publish, distribute, sublicense,
 14             // and/or sell copies of the Software, and to permit persons to whom the
 15             // Software is furnished to do so, subject to the following conditions:
 16 martin 1.33 //
 17 martin 1.32 // The above copyright notice and this permission notice shall be included
 18             // in all copies or substantial portions of the Software.
 19 martin 1.33 //
 20 martin 1.32 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
 21 martin 1.33 // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
 22 martin 1.32 // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
 23             // IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
 24             // CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
 25             // TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
 26             // SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 27 martin 1.33 //
 28 martin 1.32 //////////////////////////////////////////////////////////////////////////
 29 kumpf  1.1  //
 30             //%/////////////////////////////////////////////////////////////////////////////
 31             
 32             #ifndef Pegasus_ClientRep_h
 33             #define Pegasus_ClientRep_h
 34             
 35             #include <Pegasus/Common/Config.h>
 36             #include <Pegasus/Common/String.h>
 37             #include <Pegasus/Common/CIMName.h>
 38             #include <Pegasus/Common/SSLContext.h>
 39             #include <Pegasus/Common/CIMObject.h>
 40             #include <Pegasus/Common/CIMClass.h>
 41             #include <Pegasus/Common/CIMInstance.h>
 42             #include <Pegasus/Common/CIMObjectPath.h>
 43             #include <Pegasus/Common/CIMValue.h>
 44             #include <Pegasus/Common/CIMParamValue.h>
 45             #include <Pegasus/Common/CIMPropertyList.h>
 46             #include <Pegasus/Common/CIMQualifierDecl.h>
 47             #include <Pegasus/Common/Exception.h>
 48             #include <Pegasus/Common/Constants.h>
 49             #include <Pegasus/Common/FileSystem.h>
 50 kumpf  1.1  #include <Pegasus/Common/Monitor.h>
 51             #include <Pegasus/Common/HTTPConnector.h>
 52             #include <Pegasus/Common/CIMMessage.h>
 53             #include <Pegasus/Common/HTTPConnection.h>
 54             #include <Pegasus/Common/XmlWriter.h>
 55             #include <Pegasus/Common/TimeValue.h>
 56 kumpf  1.10 #include <Pegasus/Common/AutoPtr.h>
 57 kumpf  1.1  #include <Pegasus/Client/CIMClientException.h>
 58             #include <Pegasus/Client/Linkage.h>
 59             #include <Pegasus/Client/CIMClientInterface.h>
 60 a.dunfey 1.22 #include <Pegasus/Client/ClientPerfDataStore.h>
 61 kumpf    1.1  
 62               #include "CIMOperationResponseDecoder.h"
 63               #include "CIMOperationRequestEncoder.h"
 64 w.white  1.16 
 65 kumpf    1.1  
 66               PEGASUS_NAMESPACE_BEGIN
 67               
 68               ///////////////////////////////////////////////////////////////////////////////
 69               //
 70               // CIMClientRep
 71               //
 72               ///////////////////////////////////////////////////////////////////////////////
 73 mike     1.24 class PEGASUS_CLIENT_LINKAGE CIMClientRep : public CIMClientInterface
 74 kumpf    1.1  {
 75               public:
 76               
 77                   // Timeout value defines the time the CIMClient will wait for a response
 78                   // to an outstanding request.  If a request times out, the connection
 79                   // gets reset (disconnected and reconnected).
 80 marek    1.28     CIMClientRep(Uint32 timeoutMilliseconds =
 81                                PEGASUS_DEFAULT_CLIENT_TIMEOUT_MILLISECONDS);
 82 kumpf    1.1  
 83                   ~CIMClientRep();
 84               
 85                   virtual void handleEnqueue();
 86               
 87                   virtual Uint32 getTimeout() const
 88                   {
 89                       return _timeoutMilliseconds;
 90                   }
 91               
 92                   virtual void setTimeout(Uint32 timeoutMilliseconds)
 93                   {
 94                       _timeoutMilliseconds = timeoutMilliseconds;
 95 kumpf    1.27         if ((_connected) && (_httpConnection != 0))
 96 marek    1.28            _httpConnection->setSocketWriteTimeout(_timeoutMilliseconds/1000+1);
 97 kumpf    1.1      }
 98               
 99 kumpf    1.21     AcceptLanguageList getRequestAcceptLanguages() const;
100                   ContentLanguageList getRequestContentLanguages() const;
101                   ContentLanguageList getResponseContentLanguages() const;
102                   void setRequestAcceptLanguages(const AcceptLanguageList& langs);
103                   void setRequestContentLanguages(const ContentLanguageList& langs);
104 kumpf    1.1      void setRequestDefaultLanguages();
105               
106                   void connect(
107                       const String& host,
108                       const Uint32 portNumber,
109                       const String& userName,
110                       const String& password
111                   );
112               
113                   void connect(
114                       const String& host,
115                       const Uint32 portNumber,
116                       const SSLContext& sslContext,
117                       const String& userName,
118                       const String& password
119                   );
120               
121                   void connectLocal();
122               
123                   void disconnect();
124               
125 david.dillard 1.19     Boolean isConnected() const throw();
126 marek         1.9  
127 r.kieninger   1.34     Boolean isLocalConnect() const throw();
128                    
129 kumpf         1.1      virtual CIMClass getClass(
130                            const CIMNamespaceName& nameSpace,
131                            const CIMName& className,
132                            Boolean localOnly = true,
133                            Boolean includeQualifiers = true,
134                            Boolean includeClassOrigin = false,
135                            const CIMPropertyList& propertyList = CIMPropertyList()
136                        );
137                    
138 thilo.boehm   1.35     virtual CIMResponseData getInstance(
139 kumpf         1.1          const CIMNamespaceName& nameSpace,
140                            const CIMObjectPath& instanceName,
141                            Boolean localOnly = true,
142                            Boolean includeQualifiers = false,
143                            Boolean includeClassOrigin = false,
144                            const CIMPropertyList& propertyList = CIMPropertyList()
145                        );
146                    
147                        virtual void deleteClass(
148                            const CIMNamespaceName& nameSpace,
149                            const CIMName& className
150                        );
151                    
152                        virtual void deleteInstance(
153                            const CIMNamespaceName& nameSpace,
154                            const CIMObjectPath& instanceName
155                        );
156                    
157                        virtual void createClass(
158                            const CIMNamespaceName& nameSpace,
159                            const CIMClass& newClass
160 kumpf         1.1      );
161                    
162                        virtual CIMObjectPath createInstance(
163                            const CIMNamespaceName& nameSpace,
164                            const CIMInstance& newInstance
165                        );
166                    
167                        virtual void modifyClass(
168                            const CIMNamespaceName& nameSpace,
169                            const CIMClass& modifiedClass
170                        );
171                    
172                        virtual void modifyInstance(
173                            const CIMNamespaceName& nameSpace,
174                            const CIMInstance& modifiedInstance,
175                            Boolean includeQualifiers = true,
176                            const CIMPropertyList& propertyList = CIMPropertyList()
177                        );
178                    
179                        virtual Array<CIMClass> enumerateClasses(
180                            const CIMNamespaceName& nameSpace,
181 kumpf         1.1          const CIMName& className = CIMName(),
182                            Boolean deepInheritance = false,
183                            Boolean localOnly = true,
184                            Boolean includeQualifiers = true,
185                            Boolean includeClassOrigin = false
186                        );
187                    
188                        virtual Array<CIMName> enumerateClassNames(
189                            const CIMNamespaceName& nameSpace,
190                            const CIMName& className = CIMName(),
191                            Boolean deepInheritance = false
192                        );
193                    
194 thilo.boehm   1.35     virtual CIMResponseData enumerateInstances(
195 r.kieninger   1.34         const CIMNamespaceName& nameSpace,
196                            const CIMName& className,
197                            Boolean deepInheritance = true,
198                            Boolean localOnly = true,
199                            Boolean includeQualifiers = false,
200                            Boolean includeClassOrigin = false,
201                            const CIMPropertyList& propertyList = CIMPropertyList()
202                        );
203                    
204 thilo.boehm   1.35     virtual CIMResponseData enumerateInstanceNames(
205 kumpf         1.1          const CIMNamespaceName& nameSpace,
206                            const CIMName& className
207                        );
208                    
209 thilo.boehm   1.35     virtual CIMResponseData execQuery(
210 kumpf         1.1          const CIMNamespaceName& nameSpace,
211                            const String& queryLanguage,
212                            const String& query
213                        );
214                    
215 thilo.boehm   1.35     virtual CIMResponseData associators(
216 r.kieninger   1.34         const CIMNamespaceName& nameSpace,
217                            const CIMObjectPath& objectName,
218                            const CIMName& assocClass = CIMName(),
219                            const CIMName& resultClass = CIMName(),
220                            const String& role = String::EMPTY,
221                            const String& resultRole = String::EMPTY,
222                            Boolean includeQualifiers = false,
223                            Boolean includeClassOrigin = false,
224                            const CIMPropertyList& propertyList = CIMPropertyList()
225                        );
226                    
227 thilo.boehm   1.35     virtual CIMResponseData associatorNames(
228 kumpf         1.1          const CIMNamespaceName& nameSpace,
229                            const CIMObjectPath& objectName,
230                            const CIMName& assocClass = CIMName(),
231                            const CIMName& resultClass = CIMName(),
232                            const String& role = String::EMPTY,
233                            const String& resultRole = String::EMPTY
234                        );
235                    
236 thilo.boehm   1.35     virtual CIMResponseData references(
237 kumpf         1.1          const CIMNamespaceName& nameSpace,
238                            const CIMObjectPath& objectName,
239                            const CIMName& resultClass = CIMName(),
240                            const String& role = String::EMPTY,
241                            Boolean includeQualifiers = false,
242                            Boolean includeClassOrigin = false,
243                            const CIMPropertyList& propertyList = CIMPropertyList()
244                        );
245                    
246 thilo.boehm   1.35     virtual CIMResponseData referenceNames(
247 kumpf         1.1          const CIMNamespaceName& nameSpace,
248                            const CIMObjectPath& objectName,
249                            const CIMName& resultClass = CIMName(),
250                            const String& role = String::EMPTY
251                        );
252                    
253                        virtual CIMValue getProperty(
254                            const CIMNamespaceName& nameSpace,
255                            const CIMObjectPath& instanceName,
256                            const CIMName& propertyName
257                        );
258                    
259                        virtual void setProperty(
260                            const CIMNamespaceName& nameSpace,
261                            const CIMObjectPath& instanceName,
262                            const CIMName& propertyName,
263                            const CIMValue& newValue = CIMValue()
264                        );
265                    
266                        virtual CIMQualifierDecl getQualifier(
267                            const CIMNamespaceName& nameSpace,
268 kumpf         1.1          const CIMName& qualifierName
269                        );
270                    
271                        virtual void setQualifier(
272                            const CIMNamespaceName& nameSpace,
273                            const CIMQualifierDecl& qualifierDeclaration
274                        );
275                    
276                        virtual void deleteQualifier(
277                            const CIMNamespaceName& nameSpace,
278                            const CIMName& qualifierName
279                        );
280                    
281                        virtual Array<CIMQualifierDecl> enumerateQualifiers(
282                            const CIMNamespaceName& nameSpace
283                        );
284                    
285                        virtual CIMValue invokeMethod(
286                            const CIMNamespaceName& nameSpace,
287                            const CIMObjectPath& instanceName,
288                            const CIMName& methodName,
289 kumpf         1.1          const Array<CIMParamValue>& inParameters,
290                            Array<CIMParamValue>& outParameters
291                        );
292                    
293 w.white       1.18     void registerClientOpPerformanceDataHandler(
294                            ClientOpPerformanceDataHandler & handler);
295 david.dillard 1.19 
296 w.white       1.18     void deregisterClientOpPerformanceDataHandler();
297                    
298 mike          1.31     void setBinaryResponse(bool x) { _binaryResponse = x; }
299                    
300                        void setBinaryRequest(bool x) { _binaryRequest = x; }
301                    
302 marek         1.36     void connectLocalBinary();
303                    
304 marek         1.37     bool _binaryResponse;
305                    
306 kumpf         1.1  private:
307                    
308 mike          1.31     void _connect(bool binaryRequest, bool binaryResponse);
309 kumpf         1.4      void _disconnect();
310 marek         1.36     void _connectLocal(bool binary);
311 kumpf         1.4  
312 kumpf         1.1      Message* _doRequest(
313 a.arora       1.12         AutoPtr<CIMRequestMessage>& request,
314 kumpf         1.30         MessageType expectedResponseMessageType);
315 kumpf         1.1  
316 a.arora       1.12     AutoPtr<Monitor> _monitor;
317                        AutoPtr<HTTPConnector> _httpConnector;
318 denise.eckstein 1.20     HTTPConnection* _httpConnection;
319 r.kieninger     1.11 
320 kumpf           1.1      Uint32 _timeoutMilliseconds;
321                          Boolean _connected;
322 kumpf           1.29     /**
323                              The CIMExportClient uses a lazy reconnect algorithm.  A reconnection
324                              is necessary when the server (listener) sends a Connection: Close
325                              header in the HTTP response or when a connection timeout occurs
326                              while waiting for a response.  In these cases, a disconnect is
327                              performed immediately and the _doReconnect flag is set.  The
328                              connection is re-established only when required to perform another
329                              operation.  Note that in the case of a connection timeout, the
330                              challenge status must be reset in the ClientAuthenticator to allow
331                              authentication to be performed properly on the new connection.
332                          */
333                          Boolean _doReconnect;
334                      
335 a.arora         1.12     AutoPtr<CIMOperationResponseDecoder> _responseDecoder;
336                          AutoPtr<CIMOperationRequestEncoder> _requestEncoder;
337 kumpf           1.1      ClientAuthenticator _authenticator;
338                          String _connectHost;
339                          Uint32 _connectPortNumber;
340 kumpf           1.10     AutoPtr<SSLContext> _connectSSLContext;
341 a.dunfey        1.22     ClientPerfDataStore perfDataStore;
342 kumpf           1.1  
343 kumpf           1.21     AcceptLanguageList requestAcceptLanguages;
344                          ContentLanguageList requestContentLanguages;
345                          ContentLanguageList responseContentLanguages;
346 mike            1.31     bool _binaryRequest;
347 r.kieninger     1.34     bool _localConnect;
348 kumpf           1.1  };
349                      
350 karl            1.38 /**************************************************************************** 
351                      **  
352                      **   Implementation of ClientTrace class.  This allows setup of variables
353                      **   to control display of Client network send and receive.
354                      **
355                      ****************************************************************************/
356                      // Tests for Display optons of the form:
357                      // Env variable PEGASUS_CLIENT_TRACE= <intrace> : <outtrace
358                      // intrace = "con" | "log" | "both"
359                      // outtrace = intrace
360                      // ex set PEGASUS_CLIENT_TRACE=BOTH:BOTH traces input and output
361                      // to console and log
362                      // Keywords are case insensitive.
363                      // PEP 90
364                      // options allowed are:
365                      //     keyword:keyword  separately define input and output
366                      //     keyword:         Input only
367                      //     :keyword         Output Only
368                      //     keyword          Input and output defined by keyword
369                      //
370                      class ClientTrace
371 karl            1.38 {
372                      public:
373                          // Bit flags, that define what is to be displayed.
374                          enum TraceType
375                          {
376                              TRACE_NONE = 0,
377                              TRACE_CON = 1,
378                              TRACE_LOG = 2,
379                              TRACE_BOTH = 3
380                          };
381                      
382                          // setup the control variables from env variable
383                          static void setup();
384                      
385                          // Called from OperationRequest and Response handlers to test for
386                          // particular masks set.  Return true if the TraceType mask defined by
387                          // tt is set in the state variable.
388                          static Boolean displayOutput(TraceType tt);
389                          static Boolean displayInput(TraceType tt);
390                      
391                      private:
392 karl            1.38     // constructors, etc. are private and not to be used.
393                          ClientTrace();
394                          ClientTrace(ClientTrace const&);
395                          ClientTrace& operator=(ClientTrace const&);
396                      
397                          // internal function to translate input strings to TraceTypes
398                          static TraceType selectType(const String& str);
399                      
400                          // Define the display states set by setup.
401                          static Uint32 inputState;
402                          static Uint32 outputState;
403                      };
404 ajay.rao        1.39 
405 kumpf           1.1  PEGASUS_NAMESPACE_END
406                      
407                      #endif /* Pegasus_ClientRep_h */

No CVS admin address has been configured
Powered by
ViewCVS 0.9.2