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

  1 karl  1.21 //%2006////////////////////////////////////////////////////////////////////////
  2 mike  1.9  //
  3 karl  1.18 // 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.17 // IBM Corp.; EMC Corporation, The Open Group.
  7 karl  1.18 // 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.19 // Copyright (c) 2005 Hewlett-Packard Development Company, L.P.; IBM Corp.;
 10            // EMC Corporation; VERITAS Software Corporation; The Open Group.
 11 karl  1.21 // Copyright (c) 2006 Hewlett-Packard Development Company, L.P.; IBM Corp.;
 12            // EMC Corporation; Symantec Corporation; The Open Group.
 13 mike  1.9  //
 14            // Permission is hereby granted, free of charge, to any person obtaining a copy
 15 kumpf 1.13 // 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 mike  1.9  // 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 karl  1.23 //
 21 kumpf 1.13 // THE ABOVE COPYRIGHT NOTICE AND THIS PERMISSION NOTICE SHALL BE INCLUDED IN
 22 mike  1.9  // 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.13 // 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 mike  1.9  // 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            //%/////////////////////////////////////////////////////////////////////////////
 33            //
 34 bob   1.10 // implementation of  cimmofRepository
 35            //
 36 mike  1.9  //
 37            //
 38 bob   1.11 // This class acts as a buffer between the compiler and the repository
 39 david.eger 1.16 // interface.  The main thing it does is registers a non-standard
 40 bob        1.11 // DeclContext so we can do local checking of context for new objects
 41 mike       1.9  //
 42                 
 43                 #include "cimmofRepository.h"
 44                 
 45 bob        1.11 PEGASUS_USING_PEGASUS;
 46                 
 47 karl       1.23 cimmofRepository::cimmofRepository(const String& path,
 48 kumpf      1.22     Uint32 mode,
 49                     compilerCommonDefs::operationType ot)
 50                     : _cimrepository(0), _context(0), _ot(ot)
 51 bob        1.10 {
 52 dmitry.mikulin 1.26     // Decl context is allocated here but will be owned and deleted by
 53                         // the CIMRepository class
 54                         _context = new compilerDeclContext(_ot);
 55                     
 56 karl           1.23     // don't catch the exceptions that might be thrown.  They should go up.
 57                         if (_ot != compilerCommonDefs::IGNORE_REPOSITORY) {
 58 dmitry.mikulin 1.26         _cimrepository = new CIMRepository(path, mode, _context);
 59 karl           1.23     }
 60 dmitry.mikulin 1.26 
 61 karl           1.23     if (_cimrepository)
 62 dmitry.mikulin 1.26     {
 63                             _context->setRepository(_cimrepository);
 64                         }
 65                         else if (ot != compilerCommonDefs::IGNORE_REPOSITORY)
 66                         {
 67                             throw PEGASUS_CIM_EXCEPTION(CIM_ERR_FAILED,
 68                                 "attempt to initialize repository with invalid data");
 69                         }
 70 bob            1.10 }
 71 mike           1.9  
 72 karl           1.23 cimmofRepository::~cimmofRepository()
 73                     {
 74 dmitry.mikulin 1.26     delete _cimrepository;
 75 bob            1.10 }
 76 mike           1.9  
 77 karl           1.23 int cimmofRepository::addClass(const CIMNamespaceName &nameSpace,
 78                         CIMClass *classdecl)
 79 mike           1.9  {
 80 karl           1.23     // Don't catch errors: pass them up to the requester
 81                         _context->addClass( nameSpace,  *classdecl);
 82                         return 0;
 83 mike           1.9  }
 84                     
 85                     
 86 karl           1.23 int cimmofRepository::addInstance(const CIMNamespaceName &nameSpace,
 87                         CIMInstance *instance)
 88                     {
 89                         // Don't catch errors: pass them up to the requester
 90                         _context->addInstance(nameSpace, *instance);
 91                         return 0;
 92 mike           1.9  }
 93                     
 94 karl           1.23 int cimmofRepository::addQualifier(const CIMNamespaceName &nameSpace,
 95                         CIMQualifierDecl *qualifier)
 96                     {
 97                         // Don't catch errors: pass them up to the requester
 98                         _context->addQualifierDecl(nameSpace, *qualifier);
 99                         return 0;
100 mike           1.9  }
101                     
102 karl           1.23 CIMQualifierDecl cimmofRepository::getQualifierDecl(
103                         const CIMNamespaceName &nameSpace,
104                         const CIMName &name)
105 mike           1.9  {
106 karl           1.23     // Don't catch errors: pass them up to the requester
107                         return _context->lookupQualifierDecl(nameSpace, name);
108 mike           1.9  }
109                     
110 karl           1.23 CIMClass cimmofRepository::getClass(const CIMNamespaceName &nameSpace,
111                         const CIMName &classname)
112 bob            1.10 {
113 karl           1.23     // Don't catch errors: pass them up to the requester
114                         return _context->lookupClass(nameSpace, classname);
115 gerarda        1.15 }
116                     
117 karl           1.23 int cimmofRepository::modifyClass(const CIMNamespaceName &nameSpace,
118                         CIMClass *classdecl)
119 gerarda        1.15 {
120 karl           1.23     // Don't catch errors: pass them up to the requester
121                         _context->modifyClass( nameSpace,  *classdecl);
122                         return 0;
123 bob            1.10 }
124 mike           1.9  
125 karl           1.23 void cimmofRepository::createNameSpace(const CIMNamespaceName &nameSpaceName)
126 bob            1.10 {
127 karl           1.23     if (_cimrepository && _ot != compilerCommonDefs::IGNORE_REPOSITORY)
128                             _cimrepository->createNameSpace(nameSpaceName);
129 bob            1.10 }

No CVS admin address has been configured
Powered by
ViewCVS 0.9.2