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