1 //%2003////////////////////////////////////////////////////////////////////////
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.
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:
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.
24 //==============================================================================
26 // Author: Barbara Packard (barbara_packard@hp.com)
30 //%/////////////////////////////////////////////////////////////////////////////
32 // WMIAssociatorProvider.cpp: implementation of the WMIAssociatorProvider class.
34 //////////////////////////////////////////////////////////////////////
38 #include "WMICollector.h"
39 #include "WMIBaseProvider.h"
40 #include "WMIClassProvider.h"
41 #include "WMIInstanceProvider.h"
42 #include "WMIAssociatorProvider.h"
44 #include "WMIProperty.h"
45 #include "WMIString.h"
47 #include "WMIQualifier.h"
48 #include "WMIQualifierSet.h"
50 #include "WMIException.h"
53 //////////////////////////////////////////////////////////////////////////////
54 // WMIAssociatorProvider::
56 // ///////////////////////////////////////////////////////////////////////////
57 PEGASUS_NAMESPACE_BEGIN
59 /////////////////////////////////////////////////////////////////////
60 // Construction/Destruction
61 //////////////////////////////////////////////////////////////////////
63 WMIAssociatorProvider::WMIAssociatorProvider()
66 m_bInitialized = false;
69 WMIAssociatorProvider::~WMIAssociatorProvider()
74 //////////////////////////////////////////////////////////////////////////////
75 // WMIAssociatorProvider::associators
77 // NOTE: This method sets up the query string and then calls
78 // WMIBaseProvider::execCIMQuery
79 //////////////////////////////////////////////////////////////////////////////
80 Array<CIMObject> WMIAssociatorProvider::associators(
81 const String& nameSpace,
82 const String& userName,
83 const String& password,
84 const CIMObjectPath& objectName,
85 const String& assocClass,
86 const String& resultClass,
88 const String& resultRole,
89 Boolean includeQualifiers,
90 Boolean includeClassOrigin,
91 const CIMPropertyList& propertyList)
94 String sQueryLanguage;
96 Array<CIMObject> objects;
98 PEG_METHOD_ENTER(TRC_WMIPROVIDER,"WMIAssociatorProvider::associators()");
100 sQueryLanguage = qString(Q_WQL);
101 sQuery = getAssocQueryString(objectName,
107 objects = execCIMQuery(nameSpace,
121 //////////////////////////////////////////////////////////////////////////////
122 // WMIAssociatorProvider::associatorNames
124 // ///////////////////////////////////////////////////////////////////////////
125 Array<CIMObjectPath> WMIAssociatorProvider::associatorNames(
126 const String& nameSpace,
127 const String& userName,
128 const String& password,
129 const CIMObjectPath& objectName,
130 const String& assocClass,
131 const String& resultClass,
133 const String& resultRole)
135 Array<CIMObject> objects;
136 Array<CIMObjectPath> objectNames;
138 PEG_METHOD_ENTER(TRC_WMIPROVIDER,"WMIAssociatorProvider::associatorNames()");
140 // create an empty property list to save time...
141 Array<CIMName> propNames;
142 CIMPropertyList propertyList(propNames);
144 // now get the objects
145 objects = associators( nameSpace,
157 // now get the names from the object
158 Uint32 size = objects.size();
161 for (i=0; i<size; i++)
163 CIMObjectPath objPath;
165 objPath = objects[i].getPath();
166 objectNames.append(objPath);
174 //////////////////////////////////////////////////////////////////////////////
175 // WMIAssociatorProvider
178 // ///////////////////////////////////////////////////////////////////////////
180 //////////////////////////////////////////////////////////////////////////////
181 // WMIAssociatorProvider::getAssocQueryString - calls the BaseProvider method
182 // to build the query string from the input parameters
184 // ///////////////////////////////////////////////////////////////////////////
185 String WMIAssociatorProvider::getAssocQueryString(const CIMObjectPath &objectName,
186 const String &assocClass,
187 const String &resultClass,
189 const String &resultRole)
193 sQuery = qString(Q_ASSOCIATORS);
195 return getQueryString(objectName, sQuery, assocClass, resultClass, role, resultRole);
200 PEGASUS_NAMESPACE_END