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 //
21 // 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 chuck 1.1 #include "CIMOMHandleQueryContext.h"
35
36 PEGASUS_NAMESPACE_BEGIN
37
|
38 kumpf 1.4 CIMOMHandleQueryContext::CIMOMHandleQueryContext(
39 const CIMNamespaceName& inNS,
40 CIMOMHandle& handle)
41 : QueryContext(inNS),
42 _CH(handle)
|
43 chuck 1.1 {
44 }
45
|
46 kumpf 1.4 CIMOMHandleQueryContext::CIMOMHandleQueryContext(
47 const CIMOMHandleQueryContext& handle)
48 : QueryContext(handle),
49 _CH(handle._CH)
|
50 chuck 1.1 {
51 }
52
53 CIMOMHandleQueryContext::~CIMOMHandleQueryContext()
54 {
55 }
56
|
57 kumpf 1.4 CIMOMHandleQueryContext& CIMOMHandleQueryContext::operator=(
58 const CIMOMHandleQueryContext& rhs)
|
59 chuck 1.1 {
|
60 kumpf 1.4 if (this == &rhs)
61 return *this;
|
62 chuck 1.1
|
63 kumpf 1.4 QueryContext::operator=(rhs);
|
64 chuck 1.1
|
65 kumpf 1.4 _CH = rhs._CH;
|
66 chuck 1.1
|
67 kumpf 1.4 return *this;
|
68 chuck 1.1 }
69
|
70 kumpf 1.4 CIMClass CIMOMHandleQueryContext::getClass(const CIMName& inClassName) const
|
71 chuck 1.1 {
|
72 kumpf 1.4 /* Hardcoded defaults */
73 Boolean localOnly = false;
74 Boolean includeQualifiers = true;
75 Boolean includeClassOrigin = false;
76 CIMOMHandle tmp = _CH;
77
78 // ATTN - constructing OperationContext from scratch may be a problem
79 // once security is added to that object
80 CIMClass _class = tmp.getClass(
81 OperationContext(),
82 getNamespace(),
83 inClassName,
84 localOnly,
85 includeQualifiers,
86 includeClassOrigin,
87 CIMPropertyList());
88 return _class;
89 }
90
91 Array<CIMName> CIMOMHandleQueryContext::enumerateClassNames(
92 const CIMName& inClassName) const
93 kumpf 1.4 {
94 CIMOMHandle tmp = _CH;
95 // ATTN - constructing OperationContext from scratch may be a problem
96 // once security is added to that object
97 return tmp.enumerateClassNames(
98 OperationContext(),
99 getNamespace(),
100 inClassName,
101 true); // deepInheritance
102 }
103
104 Boolean CIMOMHandleQueryContext::isSubClass(
105 const CIMName& baseClass,
106 const CIMName& derivedClass) const
107 {
108 if (baseClass == derivedClass)
109 {
110 return false;
111 }
|
112 chuck 1.1
|
113 kumpf 1.4 Array<CIMName> subClasses = enumerateClassNames(baseClass);
114 for (Uint32 i = 0; i < subClasses.size(); i++)
115 {
116 if (subClasses[i] == derivedClass)
117 {
118 return true;
119 }
120 }
121
122 return false;
|
123 chuck 1.1 }
124
|
125 kumpf 1.4 QueryContext::ClassRelation CIMOMHandleQueryContext::getClassRelation(
126 const CIMName& anchorClass,
127 const CIMName& relatedClass) const
|
128 chuck 1.1 {
|
129 kumpf 1.4 if (anchorClass == relatedClass)
130 {
131 return SAMECLASS;
132 }
|
133 chuck 1.1
|
134 kumpf 1.4 if (isSubClass(anchorClass, relatedClass))
135 {
136 return SUBCLASS;
137 }
|
138 chuck 1.1
|
139 kumpf 1.4 if (isSubClass(relatedClass, anchorClass))
|
140 chuck 1.1 {
|
141 kumpf 1.4 return SUPERCLASS;
142 }
|
143 chuck 1.1
|
144 kumpf 1.4 return NOTRELATED;
|
145 chuck 1.1 }
146
147 QueryContext* CIMOMHandleQueryContext::clone()
148 {
|
149 kumpf 1.4 return new CIMOMHandleQueryContext(*this);
|
150 chuck 1.1 }
151
152 PEGASUS_NAMESPACE_END
|