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

  1 mike  1.9 //%/////////////////////////////////////////////////////////////////////////////
  2           //
  3 kumpf 1.13 // Copyright (c) 2000, 2001, 2002 BMC Software, Hewlett-Packard Company, IBM,
  4            // The Open Group, Tivoli Systems
  5 mike  1.9  //
  6            // Permission is hereby granted, free of charge, to any person obtaining a copy
  7 kumpf 1.13 // 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 mike  1.9  // 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 kumpf 1.13 // THE ABOVE COPYRIGHT NOTICE AND THIS PERMISSION NOTICE SHALL BE INCLUDED IN
 14 mike  1.9  // 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 kumpf 1.13 // 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 mike  1.9  // 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: Bob Blair (bblair@bmc.com)
 25            //
 26 kumpf 1.14 // Modified By: Carol Ann Krug Graves, Hewlett-Packard Company
 27            //                (carolann_graves@hp.com)
 28 gerarda 1.15 //              Gerarda Marquez (gmarquez@us.ibm.com)
 29              //              -- PEP 43 changes
 30 mike    1.9  //
 31              //%/////////////////////////////////////////////////////////////////////////////
 32              
 33              
 34              //
 35 bob     1.10 // implementation of  cimmofRepository
 36              //
 37 mike    1.9  //
 38              //
 39 bob     1.11 // This class acts as a buffer between the compiler and the repository
 40 david.eger 1.16 // interface.  The main thing it does is registers a non-standard
 41 bob        1.11 // DeclContext so we can do local checking of context for new objects
 42 mike       1.9  //
 43                 
 44                 #include "cimmofRepository.h"
 45                 
 46 bob        1.11 PEGASUS_USING_PEGASUS;
 47                 
 48 bob        1.10 cimmofRepository::cimmofRepository(const String &path, 
 49                 				   compilerCommonDefs::operationType ot) :
 50                   _cimrepository(0), _context(0), _ot(ot)
 51                 {
 52                   // don't catch the exceptions that might be thrown.  They should go up.
 53                   if (_ot != compilerCommonDefs::IGNORE_REPOSITORY) {
 54 kumpf      1.12     _cimrepository = new CIMRepository(path + "/repository");
 55 bob        1.10   }
 56                   _context = new compilerDeclContext(_cimrepository, _ot);
 57                   if (_cimrepository)
 58                     _cimrepository->setDeclContext(_context);
 59                 }
 60 mike       1.9  
 61 bob        1.10 cimmofRepository::~cimmofRepository() {
 62                   if (_cimrepository)
 63                     delete(_cimrepository);
 64                   if (_context)
 65                     delete(_context);
 66                 }
 67 mike       1.9  
 68                 int 
 69 kumpf      1.14 cimmofRepository::addClass(const CIMNamespaceName &nameSpace, 
 70                                            CIMClass *classdecl)
 71 mike       1.9  {
 72 bob        1.11   // Don't catch errors: pass them up to the requester
 73                   _context->addClass( nameSpace,  *classdecl);
 74 mike       1.9    return 0;
 75                 }
 76                 
 77                 
 78                 int 
 79 kumpf      1.14 cimmofRepository::addInstance(const CIMNamespaceName &nameSpace, 
 80                                               CIMInstance *instance)
 81 mike       1.9  { 
 82 bob        1.11   // Don't catch errors: pass them up to the requester
 83                   _context->addInstance(nameSpace, *instance);
 84 mike       1.9    return 0;
 85                 }
 86                 
 87                 int 
 88 kumpf      1.14 cimmofRepository::addQualifier(const CIMNamespaceName &nameSpace,
 89 bob        1.11 			       CIMQualifierDecl *qualifier)
 90 mike       1.9  { 
 91 bob        1.11   // Don't catch errors: pass them up to the requester
 92                   _context->addQualifierDecl(nameSpace, *qualifier);
 93                   return 0;
 94 mike       1.9  }
 95                 
 96                 CIMQualifierDecl
 97 kumpf      1.14 cimmofRepository::getQualifierDecl(const CIMNamespaceName &nameSpace, 
 98                                                    const CIMName &name)
 99 mike       1.9  {
100 bob        1.11   // Don't catch errors: pass them up to the requester
101                   return _context->lookupQualifierDecl(nameSpace, name);
102 mike       1.9  }
103                 
104 bob        1.10 CIMClass
105 kumpf      1.14 cimmofRepository::getClass(const CIMNamespaceName &nameSpace, 
106                                            const CIMName &classname)
107 bob        1.10 {
108 bob        1.11   // Don't catch errors: pass them up to the requester
109                   return _context->lookupClass(nameSpace, classname);
110 gerarda    1.15 }
111                 
112                 int 
113                 cimmofRepository::modifyClass(const CIMNamespaceName &nameSpace, 
114                                            CIMClass *classdecl)
115                 {
116                   // Don't catch errors: pass them up to the requester
117                   _context->modifyClass( nameSpace,  *classdecl);
118                   return 0;
119 bob        1.10 }
120 mike       1.9  
121 bob        1.10 void 
122 kumpf      1.14 cimmofRepository::createNameSpace(const CIMNamespaceName &nameSpaceName)
123 bob        1.10 {
124                   if (_cimrepository && _ot != compilerCommonDefs::IGNORE_REPOSITORY)
125                     _cimrepository->createNameSpace(nameSpaceName);
126                 }

No CVS admin address has been configured
Powered by
ViewCVS 0.9.2