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

  1 martin 1.30 //%LICENSE////////////////////////////////////////////////////////////////
  2 martin 1.31 //
  3 martin 1.30 // 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.31 //
 10 martin 1.30 // 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.31 //
 17 martin 1.30 // The above copyright notice and this permission notice shall be included
 18             // in all copies or substantial portions of the Software.
 19 martin 1.31 //
 20 martin 1.30 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
 21 martin 1.31 // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
 22 martin 1.30 // 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.31 //
 28 martin 1.30 //////////////////////////////////////////////////////////////////////////
 29 bob    1.1  //
 30             //%/////////////////////////////////////////////////////////////////////////////
 31             
 32             #include "cimmofClient.h"
 33 marek  1.29 #include <Pegasus/Common/Constants.h>
 34 bob    1.1  #include <Pegasus/Common/CIMClass.h>
 35             #include <Pegasus/Common/CIMQualifierDecl.h>
 36             #include <Pegasus/Common/CIMInstance.h>
 37             
 38             PEGASUS_USING_PEGASUS;
 39             
 40 kumpf  1.3  static const char NAMESPACE_CLASS [] = "__NameSpace";
 41             
 42 bob    1.1  cimmofClient::cimmofClient() :
 43 karl   1.26     _ot(compilerCommonDefs::USE_REPOSITORY),
 44                 _client(0)
 45 bob    1.1  {
 46             }
 47             
 48 karl   1.26 cimmofClient::~cimmofClient()
 49             {
 50 dmitry.mikulin 1.27     delete _client;
 51 bob            1.1  }
 52                     
 53 karl           1.26 void cimmofClient::init(String &location, compilerCommonDefs::operationType ot)
 54 bob            1.1  {
 55 karl           1.26     _ot = ot;
 56                         // ATTN:  We will want to make failure to connect a more satisfying
 57                         // experience by catching the error here and analyzing it.  For now,
 58                         // though, it should be OK to just jump all the way out and let
 59                         // our caller handle it.
 60 bob            1.1  
 61 karl           1.26     _client = new CIMClient();
 62                         _client->setTimeout(CIMMOFCLIENT_TIMEOUT_DEFAULT);
 63                         _client->setRequestDefaultLanguages();  //l10n
 64                         _client->connectLocal();
 65 bob            1.1  }
 66                     
 67 karl           1.26 void cimmofClient::addClass(const CIMNamespaceName &nameSpace,
 68                                                 CIMClass &Class) const
 69 kumpf          1.8  {
 70 bob            1.1      _client->createClass(nameSpace, Class);
 71                     }
 72                     
 73 karl           1.26 void cimmofClient::addQualifier(const CIMNamespaceName &nameSpace,
 74                                                     CIMQualifierDecl &qualifier) const
 75 bob            1.1  {
 76                         _client->setQualifier(nameSpace, qualifier);
 77                     }
 78                     
 79 karl           1.26 void cimmofClient::addInstance(const CIMNamespaceName &nameSpace,
 80                                                    CIMInstance &instance) const
 81 bob            1.1  {
 82                         _client->createInstance(nameSpace, instance);
 83                     }
 84                     
 85 karl           1.26 CIMQualifierDecl cimmofClient::getQualifierDecl(
 86                             const CIMNamespaceName &nameSpace,
 87                             const CIMName &qualifierName) const
 88 bob            1.1  {
 89                         return (_client->getQualifier(nameSpace, qualifierName));
 90                     }
 91                     
 92 karl           1.26 CIMClass cimmofClient::getClass(const CIMNamespaceName &nameSpace,
 93                                                     const CIMName &className) const
 94 bob            1.1  {
 95 karl           1.18     return (_client->getClass(nameSpace, className, false, true, true));
 96 gerarda        1.15 }
 97                     
 98 karl           1.26 void cimmofClient::modifyClass(const CIMNamespaceName &nameSpace,
 99                                                    CIMClass &Class) const
100 gerarda        1.15 {
101                         _client->modifyClass(nameSpace, Class);
102 bob            1.1  }
103                     
104 karl           1.26 void cimmofClient::createNameSpace(const CIMNamespaceName &nameSpace) const
105 bob            1.1  {
106 kumpf          1.6      // The new namespace name will be computed by
107                         // concatenating the target Namespace name with the
108                         // value of the Name property. By setting the
109                         // value of the Name property to String::EMPTY,
110 karl           1.26     // the name of the created namespace will be the
111 kumpf          1.6      // target namespace.
112 kumpf          1.10     CIMInstance newInstance = CIMName (NAMESPACE_CLASS);
113 marek          1.29     newInstance.addProperty(CIMProperty(PEGASUS_PROPERTYNAME_NAME,
114 karl           1.26                                         String::EMPTY));
115 kumpf          1.6      _client->createInstance(nameSpace, newInstance);
116 bob            1.1  }

No CVS admin address has been configured
Powered by
ViewCVS 0.9.2