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 mike 1.9 //
29 //%/////////////////////////////////////////////////////////////////////////////
30
31
32 //
|
33 bob 1.10 // implementation of cimmofRepository
34 //
|
35 mike 1.9 //
36 //
|
37 bob 1.11 // This class acts as a buffer between the compiler and the repository
38 // interface. Thie main thing it does is registers a non-standard
39 // DeclContext so we can do local checking of context for new objects
|
40 mike 1.9 //
41
42 #include "cimmofRepository.h"
43
|
44 bob 1.11 PEGASUS_USING_PEGASUS;
45
|
46 bob 1.10 cimmofRepository::cimmofRepository(const String &path,
47 compilerCommonDefs::operationType ot) :
48 _cimrepository(0), _context(0), _ot(ot)
49 {
50 // don't catch the exceptions that might be thrown. They should go up.
51 if (_ot != compilerCommonDefs::IGNORE_REPOSITORY) {
|
52 kumpf 1.12 _cimrepository = new CIMRepository(path + "/repository");
|
53 bob 1.10 }
54 _context = new compilerDeclContext(_cimrepository, _ot);
55 if (_cimrepository)
56 _cimrepository->setDeclContext(_context);
57 }
|
58 mike 1.9
|
59 bob 1.10 cimmofRepository::~cimmofRepository() {
60 if (_cimrepository)
61 delete(_cimrepository);
62 if (_context)
63 delete(_context);
64 }
|
65 mike 1.9
66 int
|
67 kumpf 1.14 cimmofRepository::addClass(const CIMNamespaceName &nameSpace,
68 CIMClass *classdecl)
|
69 mike 1.9 {
|
70 bob 1.11 // Don't catch errors: pass them up to the requester
71 _context->addClass( nameSpace, *classdecl);
|
72 mike 1.9 return 0;
73 }
74
75
76 int
|
77 kumpf 1.14 cimmofRepository::addInstance(const CIMNamespaceName &nameSpace,
78 CIMInstance *instance)
|
79 mike 1.9 {
|
80 bob 1.11 // Don't catch errors: pass them up to the requester
81 _context->addInstance(nameSpace, *instance);
|
82 mike 1.9 return 0;
83 }
84
85 int
|
86 kumpf 1.14 cimmofRepository::addQualifier(const CIMNamespaceName &nameSpace,
|
87 bob 1.11 CIMQualifierDecl *qualifier)
|
88 mike 1.9 {
|
89 bob 1.11 // Don't catch errors: pass them up to the requester
90 _context->addQualifierDecl(nameSpace, *qualifier);
91 return 0;
|
92 mike 1.9 }
93
94 CIMQualifierDecl
|
95 kumpf 1.14 cimmofRepository::getQualifierDecl(const CIMNamespaceName &nameSpace,
96 const CIMName &name)
|
97 mike 1.9 {
|
98 bob 1.11 // Don't catch errors: pass them up to the requester
99 return _context->lookupQualifierDecl(nameSpace, name);
|
100 mike 1.9 }
101
|
102 bob 1.10 CIMClass
|
103 kumpf 1.14 cimmofRepository::getClass(const CIMNamespaceName &nameSpace,
104 const CIMName &classname)
|
105 bob 1.10 {
|
106 bob 1.11 // Don't catch errors: pass them up to the requester
107 return _context->lookupClass(nameSpace, classname);
|
108 bob 1.10 }
|
109 mike 1.9
|
110 bob 1.10 void
|
111 kumpf 1.14 cimmofRepository::createNameSpace(const CIMNamespaceName &nameSpaceName)
|
112 bob 1.10 {
113 if (_cimrepository && _ot != compilerCommonDefs::IGNORE_REPOSITORY)
114 _cimrepository->createNameSpace(nameSpaceName);
115 }
|