1 a.dunfey 1.1 //%2006////////////////////////////////////////////////////////////////////////
2 //
3 // 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 // IBM Corp.; EMC Corporation, The Open Group.
7 // 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 // Copyright (c) 2006 Hewlett-Packard Development Company, L.P.; IBM Corp.;
12 // EMC Corporation; Symantec Corporation; The Open Group.
13 //
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 a.dunfey 1.1 // 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 // Interop Provider - This provider services those classes from the
35 // DMTF Interop schema in an implementation compliant with the SMI-S v1.1
36 // Server Profile
37 //
38 // Please see PG_ServerProfile20.mof in the directory
39 // $(PEGASUS_ROOT)/Schemas/Pegasus/InterOp/VER20 for retails regarding the
40 // classes supported by this control provider.
41 //
42 // Interop forces all creates to the PEGASUS_NAMESPACENAME_INTEROP
43 a.dunfey 1.1 // namespace. There is a test on each operation that returns
44 // the Invalid Class CIMDError
45 // This is a control provider and as such uses the Tracer functions
46 // for data and function traces. Since we do not expect high volume
47 // use we added a number of traces to help diagnostics.
48 ///////////////////////////////////////////////////////////////////////////////
49
50 #include "InteropProvider.h"
51 #include "InteropProviderUtils.h"
52 #include "InteropConstants.h"
53
54 PEGASUS_USING_STD;
|
55 a.dunfey 1.2 PEGASUS_NAMESPACE_BEGIN
|
56 a.dunfey 1.1
57 /*****************************************************************************
58 *
59 * Implementation of AssociationProvider associators method
60 *
61 *****************************************************************************/
62 void InteropProvider::associators(
63 const OperationContext & context,
64 const CIMObjectPath & objectName,
65 const CIMName & associationClass,
66 const CIMName & resultClass,
67 const String & role,
68 const String & resultRole,
69 const Boolean includeQualifiers,
70 const Boolean includeClassOrigin,
71 const CIMPropertyList & propertyList,
72 ObjectResponseHandler & handler)
73 {
74 PEG_METHOD_ENTER(TRC_CONTROLPROVIDER,
75 "InteropProvider::associators()");
|
76 a.dunfey 1.2 initProvider();
|
77 a.dunfey 1.1 Tracer::trace(TRC_CONTROLPROVIDER, Tracer::LEVEL4,
78 "%s associators. objectName= %s , assocClass= %s resultClass= %s role= %s resultRole %includeQualifiers= %s, includeClassOrigin= %s, PropertyList= %s",
79 thisProvider,
80 (const char *)objectName.toString().getCString(),
81 (const char *)associationClass.getString().getCString(),
82 (const char *)resultClass.getString().getCString(),
83 (const char *)role.getCString(),
84 (const char *)resultRole.getCString(),
85 boolToString(includeQualifiers),
86 boolToString(includeClassOrigin),
87 (const char *)propertyListToString(propertyList).getCString());
88
89 handler.processing();
90 String originRole = role;
91 String targetRole = resultRole;
92 //
93 // The localReferences call retrieves instances of the desired association
94 // class and sets the originRole and targetRole properties if currently
95 // empty.
96 //
97 Array<CIMInstance> refs = localReferences(context, objectName,
98 a.dunfey 1.1 associationClass, originRole, targetRole, CIMPropertyList(),
99 resultClass);
100 for(Uint32 i = 0, n = refs.size(); i < n; ++i)
101 {
102 CIMInstance & currentRef = refs[i];
103 // Retrieve the "other side" of the association
104 CIMObjectPath currentTarget = getRequiredValue<CIMObjectPath>(
105 currentRef, targetRole);
106 CIMInstance tmpInstance = localGetInstance(context, currentTarget,
107 propertyList);
108 tmpInstance.setPath(currentTarget);
109 handler.deliver(tmpInstance);
110 }
111 handler.complete();
112
113 PEG_METHOD_EXIT();
114 }
115
116 /*****************************************************************************
117 *
118 * Implementation of AssociationProvider associatorNames method
119 a.dunfey 1.1 *
120 *****************************************************************************/
121 void InteropProvider::associatorNames(
122 const OperationContext & context,
123 const CIMObjectPath & objectName,
124 const CIMName & associationClass,
125 const CIMName & resultClass,
126 const String & role,
127 const String & resultRole,
128 ObjectPathResponseHandler & handler)
129 {
130 PEG_METHOD_ENTER(TRC_CONTROLPROVIDER,
131 "InteropProvider::associatorNames()");
|
132 a.dunfey 1.2 initProvider();
|
133 a.dunfey 1.1 Tracer::trace(TRC_CONTROLPROVIDER, Tracer::LEVEL4,
134 "%s associatorNames. objectName= %s , assocClass= %s resultClass= %s role= %s resultRole",
135 thisProvider,
136 (const char *)objectName.toString().getCString(),
137 (const char *)associationClass.getString().getCString(),
138 (const char *)resultClass.getString().getCString(),
139 (const char *)role.getCString(),
140 (const char *)resultRole.getCString());
141
142 handler.processing();
143 String originRole = role;
144 String targetRole = resultRole;
145 //
146 // The localReferences call retrieves instances of the desired association
147 // class and sets the originRole and targetRole properties if currently
148 // empty.
149 //
150 Array<CIMInstance> refs = localReferences(context, objectName,
151 associationClass, originRole, targetRole, CIMPropertyList(),
152 resultClass);
153 for(Uint32 i = 0, n = refs.size(); i < n; ++i)
154 a.dunfey 1.1 {
155 CIMInstance & currentRef = refs[i];
156 CIMObjectPath currentTarget = getRequiredValue<CIMObjectPath>(
157 currentRef, targetRole);
158 handler.deliver(currentTarget);
159 }
160 handler.complete();
161 PEG_METHOD_EXIT();
162 }
163
164
165 /*****************************************************************************
166 *
167 * Implementation of AssociationProvider references method
168 *
169 *****************************************************************************/
170 void InteropProvider::references(
171 const OperationContext & context,
172 const CIMObjectPath & objectName,
173 const CIMName & resultClass,
174 const String & role,
175 a.dunfey 1.1 const Boolean includeQualifiers,
176 const Boolean includeClassOrigin,
177 const CIMPropertyList & propertyList,
178 ObjectResponseHandler & handler)
179 {
180 PEG_METHOD_ENTER(TRC_CONTROLPROVIDER,
181 "InteropProvider::references()");
|
182 a.dunfey 1.2 initProvider();
|
183 a.dunfey 1.1 Tracer::trace(TRC_CONTROLPROVIDER, Tracer::LEVEL4,
184 "%s references. objectName= %s , resultClass= %s role= %s includeQualifiers= %s, includeClassOrigin= %s, PropertyList= %s",
185 thisProvider,
186 (const char *)objectName.toString().getCString(),
187 (const char *)resultClass.getString().getCString(),
188 (const char *)role.getCString(),
189 boolToString(includeQualifiers),
190 boolToString(includeClassOrigin),
191 (const char *)propertyListToString(propertyList).getCString());
192
193 handler.processing();
194 String tmpRole = role;
195 String tmpTarget;
196 //
197 // Makes call to internal references method to get result, supplying the
198 // role parameter, but obviously not setting a resultRole/target parameter.
199 //
200 Array<CIMInstance> refs =
201 localReferences(context, objectName, resultClass, tmpRole, tmpTarget);
202 for(Uint32 i = 0, n = refs.size(); i < n; ++i)
203 handler.deliver((CIMObject)refs[i]);
204 a.dunfey 1.1 handler.complete();
205 PEG_METHOD_EXIT();
206 }
207
208 /*****************************************************************************
209 *
210 * Implementation of AssociationProvider referenceNames method
211 *
212 *****************************************************************************/
213 void InteropProvider::referenceNames(
214 const OperationContext & context,
215 const CIMObjectPath & objectName,
216 const CIMName & resultClass,
217 const String & role,
218 ObjectPathResponseHandler & handler)
219 {
220 PEG_METHOD_ENTER(TRC_CONTROLPROVIDER,
221 "InteropProvider::referenceNames()");
|
222 a.dunfey 1.2 initProvider();
|
223 a.dunfey 1.1 handler.processing();
224
225 String tmpRole = role;
226 String tmpTarget;
227 //
228 // Makes call to internal references method to get result, supplying the
229 // role parameter, but obviously not setting a resultRole/target parameter.
230 //
231 Array<CIMInstance> refs =
232 localReferences(context, objectName, resultClass, tmpRole, tmpTarget);
233 for(Uint32 i = 0, n = refs.size(); i < n; ++i)
234 {
235 handler.deliver(refs[i].getPath());
236 }
237
238 handler.complete();
239
240 PEG_METHOD_EXIT();
241 }
242
243
|
244 a.dunfey 1.2 PEGASUS_NAMESPACE_END
|
245 a.dunfey 1.1 // END_OF_FILE
|