(file) Return to cimmofClient.cpp CVS log (file) (dir) Up to [Pegasus] / pegasus / src / Pegasus / Compiler

  1 karl  1.23 //%2006////////////////////////////////////////////////////////////////////////
  2 bob   1.1  //
  3 karl  1.20 // Copyright (c) 2000, 2001, 2002 BMC Software; Hewlett-Packard Development
  4            // Company, L.P.; IBM Corp.; The Open Group; Tivoli Systems.
  5            // Copyright (c) 2003 BMC Software; Hewlett-Packard Development Company, L.P.;
  6 karl  1.19 // IBM Corp.; EMC Corporation, The Open Group.
  7 karl  1.20 // Copyright (c) 2004 BMC Software; Hewlett-Packard Development Company, L.P.;
  8            // IBM Corp.; EMC Corporation; VERITAS Software Corporation; The Open Group.
  9 karl  1.21 // Copyright (c) 2005 Hewlett-Packard Development Company, L.P.; IBM Corp.;
 10            // EMC Corporation; VERITAS Software Corporation; The Open Group.
 11 karl  1.23 // Copyright (c) 2006 Hewlett-Packard Development Company, L.P.; IBM Corp.;
 12            // EMC Corporation; Symantec Corporation; The Open Group.
 13 bob   1.1  //
 14            // Permission is hereby granted, free of charge, to any person obtaining a copy
 15 kumpf 1.7  // of this software and associated documentation files (the "Software"), to
 16            // deal in the Software without restriction, including without limitation the
 17            // rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
 18 bob   1.1  // sell copies of the Software, and to permit persons to whom the Software is
 19            // furnished to do so, subject to the following conditions:
 20            // 
 21 kumpf 1.7  // THE ABOVE COPYRIGHT NOTICE AND THIS PERMISSION NOTICE SHALL BE INCLUDED IN
 22 bob   1.1  // ALL COPIES OR SUBSTANTIAL PORTIONS OF THE SOFTWARE. THE SOFTWARE IS PROVIDED
 23            // "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT
 24 kumpf 1.7  // LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
 25            // PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
 26            // HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
 27 bob   1.1  // ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
 28            // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 29            //
 30            //==============================================================================
 31            //
 32            // Author: Bob Blair (bblair@bmc.com)
 33            //
 34 kumpf 1.10 // Modified By: Carol Ann Krug Graves, Hewlett-Packard Company
 35            //                (carolann_graves@hp.com)
 36 gerarda 1.15 //              Gerarda Marquez (gmarquez@us.ibm.com)
 37              //              -- PEP 43 changes
 38 bob     1.1  //
 39              //%/////////////////////////////////////////////////////////////////////////////
 40              
 41              #include "cimmofClient.h"
 42              #include <Pegasus/Common/CIMClass.h>
 43              #include <Pegasus/Common/CIMQualifierDecl.h>
 44              #include <Pegasus/Common/CIMInstance.h>
 45              
 46              PEGASUS_USING_PEGASUS;
 47              
 48 kumpf   1.5  static const char __NAMESPACE_NAMESPACE [] = "root";
 49 kumpf   1.3  static const char NAMESPACE_CLASS [] = "__NameSpace";
 50              static const char NAMESPACE_PROPERTY_NAME [] = "Name";
 51              
 52 bob     1.1  cimmofClient::cimmofClient() :
 53 kumpf   1.2    _ot(compilerCommonDefs::USE_REPOSITORY),
 54                _client(0)
 55 bob     1.1  {
 56              }
 57              
 58              cimmofClient::~cimmofClient() {
 59              }
 60              
 61              void
 62              cimmofClient::init(String &location, compilerCommonDefs::operationType ot)
 63              {
 64                _ot = ot;
 65                // ATTN:  We will want to make failure to connect a more satisfying
 66                // experience by catching the error here and analyzing it.  For now,
 67                // though, it should be OK to just jump all the way out and let
 68                // our caller handle it.
 69              
 70                _client = new CIMClient();
 71 humberto 1.17   _client->setRequestDefaultLanguages();  //l10n
 72 bob      1.1  
 73 gs.keenan 1.22 #if defined(PEGASUS_OS_HPUX) || defined(PEGASUS_PLATFORM_LINUX_GENERIC_GNU) || defined(PEGASUS_OS_VMS)
 74 kumpf     1.12   _client->connectLocal();
 75                #else
 76 bob       1.1    String hostname = "localhost";  //defaults
 77 kumpf     1.11   Uint32 portno = 5988;
 78 bob       1.1    // ATTN:
 79                  //   get host name and port from command line data via parser object
 80 kumpf     1.11   _client->connect(hostname, portno, String::EMPTY, String::EMPTY);
 81 kumpf     1.12 #endif
 82 bob       1.1  }
 83                
 84                void
 85 kumpf     1.10 cimmofClient::addClass(const CIMNamespaceName &nameSpace, CIMClass &Class) const
 86 kumpf     1.8  {
 87 bob       1.1      _client->createClass(nameSpace, Class);
 88                }
 89                
 90                void
 91 kumpf     1.10 cimmofClient::addQualifier(const CIMNamespaceName &nameSpace,
 92 bob       1.1  					CIMQualifierDecl &qualifier) const
 93                {
 94                    _client->setQualifier(nameSpace, qualifier);
 95                }
 96                
 97                void
 98 kumpf     1.10 cimmofClient::addInstance(const CIMNamespaceName &nameSpace,
 99 bob       1.1  				       CIMInstance &instance) const
100                {
101                    _client->createInstance(nameSpace, instance);
102                }
103                
104                CIMQualifierDecl
105 kumpf     1.10 cimmofClient::getQualifierDecl(const CIMNamespaceName &nameSpace,
106                					    const CIMName &qualifierName) const
107 bob       1.1  {
108                    return (_client->getQualifier(nameSpace, qualifierName));
109                }
110                
111                CIMClass
112 kumpf     1.10 cimmofClient::getClass(const CIMNamespaceName &nameSpace,
113                				    const CIMName &className) const
114 bob       1.1  {
115 karl      1.18     return (_client->getClass(nameSpace, className, false, true, true));
116 gerarda   1.15 }
117                
118                void
119                cimmofClient::modifyClass(const CIMNamespaceName &nameSpace, CIMClass &Class) const
120                {
121                    _client->modifyClass(nameSpace, Class);
122 bob       1.1  }
123                
124                void
125 kumpf     1.10 cimmofClient::createNameSpace(const CIMNamespaceName &nameSpace) const
126 bob       1.1  {
127 kumpf     1.6      // The new namespace name will be computed by
128                    // concatenating the target Namespace name with the
129                    // value of the Name property. By setting the
130                    // value of the Name property to String::EMPTY,
131                    // the name of the created namespace will be the 
132                    // target namespace.
133 kumpf     1.10     CIMInstance newInstance = CIMName (NAMESPACE_CLASS);
134 kumpf     1.3      newInstance.addProperty(
135 kumpf     1.10               CIMProperty(CIMName (NAMESPACE_PROPERTY_NAME), String::EMPTY));
136 kumpf     1.6      _client->createInstance(nameSpace, newInstance);
137 bob       1.1  }

No CVS admin address has been configured
Powered by
ViewCVS 0.9.2