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 karl 1.23 // don't catch the exceptions that might be thrown. They should go up.
53 if (_ot != compilerCommonDefs::IGNORE_REPOSITORY) {
54 _cimrepository = new CIMRepository(path, mode);
55 }
56 _context = new compilerDeclContext(_cimrepository, _ot);
57 if (_cimrepository)
58 _cimrepository->setDeclContext(_context);
|
59 bob 1.10 }
|
60 mike 1.9
|
61 karl 1.23 cimmofRepository::~cimmofRepository()
62 {
63 if (_cimrepository)
64 delete(_cimrepository);
65 if (_context)
66 delete(_context);
|
67 bob 1.10 }
|
68 mike 1.9
|
69 karl 1.23 int cimmofRepository::addClass(const CIMNamespaceName &nameSpace,
70 CIMClass *classdecl)
|
71 mike 1.9 {
|
72 karl 1.23 // Don't catch errors: pass them up to the requester
73 _context->addClass( nameSpace, *classdecl);
74 return 0;
|
75 mike 1.9 }
76
77
|
78 karl 1.23 int cimmofRepository::addInstance(const CIMNamespaceName &nameSpace,
79 CIMInstance *instance)
80 {
81 // Don't catch errors: pass them up to the requester
82 _context->addInstance(nameSpace, *instance);
83 return 0;
|
84 mike 1.9 }
85
|
86 karl 1.23 int cimmofRepository::addQualifier(const CIMNamespaceName &nameSpace,
87 CIMQualifierDecl *qualifier)
88 {
89 // Don't catch errors: pass them up to the requester
90 _context->addQualifierDecl(nameSpace, *qualifier);
91 return 0;
|
92 mike 1.9 }
93
|
94 karl 1.23 CIMQualifierDecl cimmofRepository::getQualifierDecl(
95 const CIMNamespaceName &nameSpace,
96 const CIMName &name)
|
97 mike 1.9 {
|
98 karl 1.23 // Don't catch errors: pass them up to the requester
99 return _context->lookupQualifierDecl(nameSpace, name);
|
100 mike 1.9 }
101
|
102 karl 1.23 CIMClass cimmofRepository::getClass(const CIMNamespaceName &nameSpace,
103 const CIMName &classname)
|
104 bob 1.10 {
|
105 karl 1.23 // Don't catch errors: pass them up to the requester
106 return _context->lookupClass(nameSpace, classname);
|
107 gerarda 1.15 }
108
|
109 karl 1.23 int cimmofRepository::modifyClass(const CIMNamespaceName &nameSpace,
110 CIMClass *classdecl)
|
111 gerarda 1.15 {
|
112 karl 1.23 // Don't catch errors: pass them up to the requester
113 _context->modifyClass( nameSpace, *classdecl);
114 return 0;
|
115 bob 1.10 }
|
116 mike 1.9
|
117 karl 1.23 void cimmofRepository::createNameSpace(const CIMNamespaceName &nameSpaceName)
|
118 bob 1.10 {
|
119 karl 1.23 if (_cimrepository && _ot != compilerCommonDefs::IGNORE_REPOSITORY)
120 _cimrepository->createNameSpace(nameSpaceName);
|
121 bob 1.10 }
|