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 //
|
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 // Author: Bob Blair (bblair@bmc.com)
33 //
|
34 kumpf 1.14 // Modified By: Carol Ann Krug Graves, Hewlett-Packard Company
35 // (carolann_graves@hp.com)
|
36 gerarda 1.15 // Gerarda Marquez (gmarquez@us.ibm.com)
37 // -- PEP 43 changes
|
38 mike 1.9 //
39 //%/////////////////////////////////////////////////////////////////////////////
40
41
42 //
|
43 bob 1.10 // implementation of cimmofRepository
44 //
|
45 mike 1.9 //
46 //
|
47 bob 1.11 // This class acts as a buffer between the compiler and the repository
|
48 david.eger 1.16 // interface. The main thing it does is registers a non-standard
|
49 bob 1.11 // DeclContext so we can do local checking of context for new objects
|
50 mike 1.9 //
51
52 #include "cimmofRepository.h"
53
|
54 bob 1.11 PEGASUS_USING_PEGASUS;
55
|
56 kumpf 1.22 cimmofRepository::cimmofRepository(
57 const String& path,
58 Uint32 mode,
59 compilerCommonDefs::operationType ot)
60 : _cimrepository(0), _context(0), _ot(ot)
|
61 bob 1.10 {
62 // don't catch the exceptions that might be thrown. They should go up.
63 if (_ot != compilerCommonDefs::IGNORE_REPOSITORY) {
|
64 kumpf 1.22 _cimrepository = new CIMRepository(path, mode);
|
65 bob 1.10 }
66 _context = new compilerDeclContext(_cimrepository, _ot);
67 if (_cimrepository)
68 _cimrepository->setDeclContext(_context);
69 }
|
70 mike 1.9
|
71 bob 1.10 cimmofRepository::~cimmofRepository() {
72 if (_cimrepository)
73 delete(_cimrepository);
74 if (_context)
75 delete(_context);
76 }
|
77 mike 1.9
78 int
|
79 kumpf 1.14 cimmofRepository::addClass(const CIMNamespaceName &nameSpace,
80 CIMClass *classdecl)
|
81 mike 1.9 {
|
82 bob 1.11 // Don't catch errors: pass them up to the requester
83 _context->addClass( nameSpace, *classdecl);
|
84 mike 1.9 return 0;
85 }
86
87
88 int
|
89 kumpf 1.14 cimmofRepository::addInstance(const CIMNamespaceName &nameSpace,
90 CIMInstance *instance)
|
91 mike 1.9 {
|
92 bob 1.11 // Don't catch errors: pass them up to the requester
93 _context->addInstance(nameSpace, *instance);
|
94 mike 1.9 return 0;
95 }
96
97 int
|
98 kumpf 1.14 cimmofRepository::addQualifier(const CIMNamespaceName &nameSpace,
|
99 bob 1.11 CIMQualifierDecl *qualifier)
|
100 mike 1.9 {
|
101 bob 1.11 // Don't catch errors: pass them up to the requester
102 _context->addQualifierDecl(nameSpace, *qualifier);
103 return 0;
|
104 mike 1.9 }
105
106 CIMQualifierDecl
|
107 kumpf 1.14 cimmofRepository::getQualifierDecl(const CIMNamespaceName &nameSpace,
108 const CIMName &name)
|
109 mike 1.9 {
|
110 bob 1.11 // Don't catch errors: pass them up to the requester
111 return _context->lookupQualifierDecl(nameSpace, name);
|
112 mike 1.9 }
113
|
114 bob 1.10 CIMClass
|
115 kumpf 1.14 cimmofRepository::getClass(const CIMNamespaceName &nameSpace,
116 const CIMName &classname)
|
117 bob 1.10 {
|
118 bob 1.11 // Don't catch errors: pass them up to the requester
119 return _context->lookupClass(nameSpace, classname);
|
120 gerarda 1.15 }
121
122 int
123 cimmofRepository::modifyClass(const CIMNamespaceName &nameSpace,
124 CIMClass *classdecl)
125 {
126 // Don't catch errors: pass them up to the requester
127 _context->modifyClass( nameSpace, *classdecl);
128 return 0;
|
129 bob 1.10 }
|
130 mike 1.9
|
131 bob 1.10 void
|
132 kumpf 1.14 cimmofRepository::createNameSpace(const CIMNamespaceName &nameSpaceName)
|
133 bob 1.10 {
134 if (_cimrepository && _ot != compilerCommonDefs::IGNORE_REPOSITORY)
135 _cimrepository->createNameSpace(nameSpaceName);
136 }
|