1 chuck 1.1.2.5 //%2003////////////////////////////////////////////////////////////////////////
|
2 chuck 1.1.2.2 //
3 // Copyright (c) 2000, 2001, 2002 BMC Software, Hewlett-Packard Development
4 // Company, L. P., IBM Corp., The Open Group, Tivoli Systems.
|
5 chuck 1.1.2.6 // Copyright (c) 2003 BMC Software; Hewlett-Packard Development Company, L. P.;
|
6 chuck 1.1.2.2 // IBM Corp.; EMC Corporation, The Open Group.
7 //
8 // Permission is hereby granted, free of charge, to any person obtaining a copy
9 // 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 // 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 // THE ABOVE COPYRIGHT NOTICE AND THIS PERMISSION NOTICE SHALL BE INCLUDED IN
16 // 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 // 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 // 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 // Authors: David Rosckes (rosckes@us.ibm.com)
27 chuck 1.1.2.2 // Bert Rivero (hurivero@us.ibm.com)
28 // Chuck Carmack (carmack@us.ibm.com)
29 // Brian Lucier (lucier@us.ibm.com)
30 //
31 // Modified By:
32 //
33 //%/////////////////////////////////////////////////////////////////////////////
34
|
35 humberto 1.1.2.1 #include "RepositoryQueryContext.h"
36
37 PEGASUS_NAMESPACE_BEGIN
|
38 chuck 1.1.2.2
39 RepositoryQueryContext::RepositoryQueryContext(CIMNamespaceName& inNS, CIMRepository* inCIMRep)
40 :QueryContext(inNS),
41 _CIMRep(inCIMRep)
42 {
|
43 humberto 1.1.2.1 }
44
|
45 chuck 1.1.2.2 RepositoryQueryContext::RepositoryQueryContext(const RepositoryQueryContext& ctx)
46 :QueryContext(ctx),
47 _CIMRep(ctx._CIMRep)
48 {
49
50 }
51
|
52 chuck 1.1.2.3 RepositoryQueryContext::~RepositoryQueryContext()
53 {
54 }
55
|
56 chuck 1.1.2.2 RepositoryQueryContext& RepositoryQueryContext::operator=(const RepositoryQueryContext& rhs)
57 {
58 if (this == &rhs)
59 return *this;
60
61 QueryContext::operator=(rhs);
62
63 _CIMRep = rhs._CIMRep;
64
65 return *this;
66 }
|
67 humberto 1.1.2.1
|
68 david 1.1.2.10 CIMClass RepositoryQueryContext::getClass(const CIMName& inClassName)const
|
69 chuck 1.1.2.2 {
70 /* Hardcoded defaults */
71 Boolean localOnly = false;
72 Boolean includeQualifiers = true;
73 Boolean includeClassOrigin = false;
74 CIMPropertyList _emptyCIMPropertyList;
75
76 CIMClass _class = _CIMRep->getClass(
77 getNamespace(),
78 inClassName,
79 localOnly,
80 includeQualifiers,
81 includeClassOrigin,
82 _emptyCIMPropertyList);
83 return _class;
|
84 humberto 1.1.2.1 }
|
85 chuck 1.1.2.2
|
86 david 1.1.2.10 Array<CIMName> RepositoryQueryContext::enumerateClassNames(const CIMName& inClassName)const
|
87 chuck 1.1.2.4 {
88 return _CIMRep->enumerateClassNames(getNamespace(),
89 inClassName,
90 true); // deepInheritance
91 }
92
|
93 chuck 1.1.2.9 Boolean RepositoryQueryContext::isSubClass(const CIMName& baseClass,
|
94 david 1.1.2.10 const CIMName& derivedClass)const
|
95 chuck 1.1.2.9 {
96 if (baseClass == derivedClass)
97 {
98 return false;
99 }
100
101 Array<CIMName> subClasses = enumerateClassNames(baseClass);
102 for (Uint32 i = 0; i < subClasses.size(); i++)
103 {
104 if (subClasses[i] == derivedClass)
105 {
106 return true;
107 }
108 }
109
110 return false;
111 }
112
113 QueryContext::ClassRelation RepositoryQueryContext::getClassRelation(const CIMName& anchorClass,
|
114 david 1.1.2.10 const CIMName& relatedClass)const
|
115 chuck 1.1.2.9 {
116 if (anchorClass == relatedClass)
117 {
118 return SAMECLASS;
119 }
120
121 if (isSubClass(anchorClass, relatedClass))
122 {
123 return SUBCLASS;
124 }
125
126 if (isSubClass(relatedClass, anchorClass))
127 {
128 return SUPERCLASS;
129 }
130
131 return NOTRELATED;
132 }
133
|
134 chuck 1.1.2.7 QueryContext* RepositoryQueryContext::clone()
135 {
136 return new RepositoryQueryContext(*this);
137 }
138
|
139 humberto 1.1.2.1 PEGASUS_NAMESPACE_END
140
|