1 karl 1.3 //%2006////////////////////////////////////////////////////////////////////////
|
2 chuck 1.1 //
|
3 karl 1.2 // 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 chuck 1.1 // IBM Corp.; EMC Corporation, The Open Group.
|
7 karl 1.2 // Copyright (c) 2004 BMC Software; Hewlett-Packard Development Company, L.P.;
8 // IBM Corp.; EMC Corporation; VERITAS Software Corporation; The Open Group.
9 // Copyright (c) 2005 Hewlett-Packard Development Company, L.P.; IBM Corp.;
10 // EMC Corporation; VERITAS Software Corporation; The Open Group.
|
11 karl 1.3 // Copyright (c) 2006 Hewlett-Packard Development Company, L.P.; IBM Corp.;
12 // EMC Corporation; Symantec Corporation; The Open Group.
|
13 chuck 1.1 //
14 // Permission is hereby granted, free of charge, to any person obtaining a copy
15 // 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 // 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.5 //
|
21 chuck 1.1 // THE ABOVE COPYRIGHT NOTICE AND THIS PERMISSION NOTICE SHALL BE INCLUDED IN
22 // 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 // 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 // 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 #include "RepositoryQueryContext.h"
35
36 PEGASUS_NAMESPACE_BEGIN
|
37 kumpf 1.4
38 RepositoryQueryContext::RepositoryQueryContext(
39 const CIMNamespaceName& inNS,
40 CIMRepository* inCIMRep)
41 : QueryContext(inNS),
42 _CIMRep(inCIMRep)
|
43 chuck 1.1 {
44 }
45
|
46 kumpf 1.4 RepositoryQueryContext::RepositoryQueryContext(
47 const RepositoryQueryContext& ctx)
48 : QueryContext(ctx),
49 _CIMRep(ctx._CIMRep)
|
50 chuck 1.1 {
|
51 kumpf 1.4 }
|
52 chuck 1.1
53 RepositoryQueryContext::~RepositoryQueryContext()
54 {
55 }
56
|
57 kumpf 1.4 RepositoryQueryContext& RepositoryQueryContext::operator=(
58 const RepositoryQueryContext& rhs)
|
59 chuck 1.1 {
|
60 kumpf 1.4 if (this == &rhs)
61 return *this;
62
63 QueryContext::operator=(rhs);
64
65 _CIMRep = rhs._CIMRep;
66
|
67 chuck 1.1 return *this;
|
68 kumpf 1.4 }
|
69 chuck 1.1
|
70 kumpf 1.4 CIMClass RepositoryQueryContext::getClass(const CIMName& inClassName) const
71 {
72 /* Hardcoded defaults */
73 Boolean localOnly = false;
74 Boolean includeQualifiers = true;
75 Boolean includeClassOrigin = false;
76 CIMPropertyList _emptyCIMPropertyList;
77
78 CIMClass _class = _CIMRep->getClass(
79 getNamespace(),
80 inClassName,
81 localOnly,
82 includeQualifiers,
83 includeClassOrigin,
84 _emptyCIMPropertyList);
85 return _class;
86 }
87
88 Array<CIMName> RepositoryQueryContext::enumerateClassNames(
89 const CIMName& inClassName) const
90 {
91 kumpf 1.4 return _CIMRep->enumerateClassNames(
92 getNamespace(),
93 inClassName,
94 true); // deepInheritance
95 }
96
97 Boolean RepositoryQueryContext::isSubClass(
98 const CIMName& baseClass,
99 const CIMName& derivedClass) const
100 {
101 if (baseClass == derivedClass)
102 {
103 return false;
104 }
105
106 Array<CIMName> subClasses = enumerateClassNames(baseClass);
107 for (Uint32 i = 0; i < subClasses.size(); i++)
108 {
109 if (subClasses[i] == derivedClass)
110 {
111 return true;
112 kumpf 1.4 }
113 }
114
115 return false;
|
116 chuck 1.1 }
117
|
118 kumpf 1.4 QueryContext::ClassRelation RepositoryQueryContext::getClassRelation(
119 const CIMName& anchorClass,
120 const CIMName& relatedClass) const
|
121 chuck 1.1 {
|
122 kumpf 1.4 if (anchorClass == relatedClass)
123 {
124 return SAMECLASS;
125 }
126
127 if (isSubClass(anchorClass, relatedClass))
128 {
129 return SUBCLASS;
130 }
|
131 chuck 1.1
|
132 kumpf 1.4 if (isSubClass(relatedClass, anchorClass))
|
133 chuck 1.1 {
|
134 kumpf 1.4 return SUPERCLASS;
135 }
|
136 chuck 1.1
|
137 kumpf 1.4 return NOTRELATED;
|
138 chuck 1.1 }
139
|
140 kumpf 1.6 QueryContext* RepositoryQueryContext::clone() const
|
141 chuck 1.1 {
|
142 kumpf 1.4 return new RepositoryQueryContext(*this);
|
143 chuck 1.1 }
144
145 PEGASUS_NAMESPACE_END
146
|