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

  1 mike  1.9 //%/////////////////////////////////////////////////////////////////////////////
  2           //
  3           // Copyright (c) 2000, 2001 The Open group, BMC Software, Tivoli Systems, IBM
  4           //
  5           // Permission is hereby granted, free of charge, to any person obtaining a copy
  6           // of this software and associated documentation files (the "Software"), to 
  7           // deal in the Software without restriction, including without limitation the 
  8           // rights to use, copy, modify, merge, publish, distribute, sublicense, and/or 
  9           // sell copies of the Software, and to permit persons to whom the Software is
 10           // furnished to do so, subject to the following conditions:
 11           // 
 12           // THE ABOVE COPYRIGHT NOTICE AND THIS PERMISSION NOTICE SHALL BE INCLUDED IN 
 13           // ALL COPIES OR SUBSTANTIAL PORTIONS OF THE SOFTWARE. THE SOFTWARE IS PROVIDED
 14           // "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT
 15           // LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR 
 16           // PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 
 17           // HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN 
 18           // ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
 19           // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 20           //
 21           //==============================================================================
 22 mike  1.9 //
 23           // Author: Bob Blair (bblair@bmc.com)
 24           //
 25           // Modified By:
 26           //
 27           //%/////////////////////////////////////////////////////////////////////////////
 28           
 29           
 30           //
 31 bob   1.10 // implementation of  cimmofRepository
 32            //
 33 mike  1.9  //
 34            //
 35 bob   1.11 // This class acts as a buffer between the compiler and the repository
 36            // interface.  Thie main thing it does is registers a non-standard
 37            // DeclContext so we can do local checking of context for new objects
 38 mike  1.9  //
 39            
 40            #include "cimmofRepository.h"
 41            
 42 bob   1.11 PEGASUS_USING_PEGASUS;
 43            
 44 bob   1.10 cimmofRepository::cimmofRepository(const String &path, 
 45            				   compilerCommonDefs::operationType ot) :
 46              _cimrepository(0), _context(0), _ot(ot)
 47            {
 48              // don't catch the exceptions that might be thrown.  They should go up.
 49              if (_ot != compilerCommonDefs::IGNORE_REPOSITORY) {
 50                _cimrepository = new CIMRepository(Cat(path, "/repository"));
 51              }
 52              _context = new compilerDeclContext(_cimrepository, _ot);
 53              if (_cimrepository)
 54                _cimrepository->setDeclContext(_context);
 55            }
 56 mike  1.9  
 57 bob   1.10 cimmofRepository::~cimmofRepository() {
 58              if (_cimrepository)
 59                delete(_cimrepository);
 60              if (_context)
 61                delete(_context);
 62            }
 63 mike  1.9  
 64            int 
 65 bob   1.11 cimmofRepository::addClass(const String &nameSpace, CIMClass *classdecl)
 66 mike  1.9  {
 67 bob   1.11   // Don't catch errors: pass them up to the requester
 68              _context->addClass( nameSpace,  *classdecl);
 69 mike  1.9    return 0;
 70            }
 71            
 72            
 73            int 
 74 bob   1.11 cimmofRepository::addInstance(const String &nameSpace, CIMInstance *instance)
 75 mike  1.9  { 
 76 bob   1.11   // Don't catch errors: pass them up to the requester
 77              _context->addInstance(nameSpace, *instance);
 78 mike  1.9    return 0;
 79            }
 80            
 81            int 
 82 bob   1.11 cimmofRepository::addQualifier(const String &nameSpace,
 83            			       CIMQualifierDecl *qualifier)
 84 mike  1.9  { 
 85 bob   1.11   // Don't catch errors: pass them up to the requester
 86              _context->addQualifierDecl(nameSpace, *qualifier);
 87              return 0;
 88 mike  1.9  }
 89            
 90            CIMQualifierDecl
 91 bob   1.11 cimmofRepository::getQualifierDecl(const String &nameSpace, const String &name)
 92 mike  1.9  {
 93 bob   1.11   // Don't catch errors: pass them up to the requester
 94              return _context->lookupQualifierDecl(nameSpace, name);
 95 mike  1.9  }
 96            
 97 bob   1.10 CIMClass
 98 bob   1.11 cimmofRepository::getClass(const String &nameSpace, const String &classname)
 99 bob   1.10 {
100 bob   1.11   // Don't catch errors: pass them up to the requester
101              return _context->lookupClass(nameSpace, classname);
102 bob   1.10 }
103 mike  1.9  
104 bob   1.10 void 
105            cimmofRepository::createNameSpace(const String &nameSpaceName)
106            {
107              if (_cimrepository && _ot != compilerCommonDefs::IGNORE_REPOSITORY)
108                _cimrepository->createNameSpace(nameSpaceName);
109            }

No CVS admin address has been configured
Powered by
ViewCVS 0.9.2