OWBI1_ProxyProvider.cpp

Go to the documentation of this file.
00001 /*******************************************************************************
00002 * Copyright (C) 2001-2004 Vintela, Inc. All rights reserved.
00003 *
00004 * Redistribution and use in source and binary forms, with or without
00005 * modification, are permitted provided that the following conditions are met:
00006 *
00007 *  - Redistributions of source code must retain the above copyright notice,
00008 *    this list of conditions and the following disclaimer.
00009 *
00010 *  - Redistributions in binary form must reproduce the above copyright notice,
00011 *    this list of conditions and the following disclaimer in the documentation
00012 *    and/or other materials provided with the distribution.
00013 *
00014 *  - Neither the name of Vintela, Inc. nor the names of its
00015 *    contributors may be used to endorse or promote products derived from this
00016 *    software without specific prior written permission.
00017 *
00018 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS IS''
00019 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
00020 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
00021 * ARE DISCLAIMED. IN NO EVENT SHALL Vintela, Inc. OR THE CONTRIBUTORS
00022 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
00023 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
00024 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
00025 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
00026 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
00027 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
00028 * POSSIBILITY OF SUCH DAMAGE.
00029 *******************************************************************************/
00030 
00035 #include "OW_config.h"
00036 #include "OWBI1_ProxyProvider.hpp"
00037 #include "OW_WBEMFlags.hpp"
00038 #include "OW_CIMValue.hpp"
00039 #include "OWBI1_CIMValue.hpp"
00040 #include "OW_CIMClass.hpp"
00041 #include "OWBI1_CIMClass.hpp"
00042 #include "OW_CIMInstance.hpp"
00043 #include "OWBI1_CIMInstance.hpp"
00044 #include "OW_CIMObjectPath.hpp"
00045 #include "OWBI1_CIMObjectPath.hpp"
00046 #include "OW_CIMParamValue.hpp"
00047 #include "OWBI1_CIMParamValue.hpp"
00048 #include "OW_ProviderEnvironmentIFC.hpp"
00049 #include "OWBI1_ProviderEnvironmentIFC.hpp"
00050 
00051 namespace OWBI1
00052 {
00053 
00054 // TODO:
00055 // remove includeQualifiers
00056 // remove includeClassOrigin
00057 // create class PropertyList and use that.
00058 //   remove localOnly & deep and have them modify the PropertyList
00059 // convert all OWBI1::CIMException to OW::CIMException
00060 // convert all OWBI1::Exception to OW::OWBI1Exception
00061 
00062 using namespace WBEMFlags;
00063 #ifndef OW_DISABLE_ASSOCIATION_TRAVERSAL
00064 
00065 BI1AssociatorProviderProxy::BI1AssociatorProviderProxy(
00066    const BI1AssociatorProviderIFCRef& pProv) :
00067    AssociatorProviderIFC(), m_pProv(pProv)
00068 {
00069 }
00070 
00072 void
00073 BI1AssociatorProviderProxy::associators(
00074       const OpenWBEM::ProviderEnvironmentIFCRef& env,
00075       OpenWBEM::CIMInstanceResultHandlerIFC& result,
00076       const OpenWBEM::String& ns,
00077       const OpenWBEM::CIMObjectPath& objectName,
00078       const OpenWBEM::String& assocClass,
00079       const OpenWBEM::String& resultClass,
00080       const OpenWBEM::String& role,
00081       const OpenWBEM::String& resultRole,
00082       OpenWBEM::WBEMFlags::EIncludeQualifiersFlag includeQualifiers,
00083       OpenWBEM::WBEMFlags::EIncludeClassOriginFlag includeClassOrigin,
00084       const OpenWBEM::StringArray* propertyList)
00085 {
00086    m_pProv->updateAccessTime();
00087    CIMInstanceResultHandlerWrapper cirh(result);
00088    // TODO: handle includeQualifiers & includeClassOrigin
00089    m_pProv->associators(createProvEnvWrapper(env), cirh, ns.c_str(), convertCIMObjectPath(objectName), assocClass.c_str(), resultClass.c_str(), role.c_str(),
00090       resultRole.c_str(), convertPropertyList(propertyList));
00091 }
00093 void
00094 BI1AssociatorProviderProxy::associatorNames(
00095       const OpenWBEM::ProviderEnvironmentIFCRef& env,
00096       OpenWBEM::CIMObjectPathResultHandlerIFC& result,
00097       const OpenWBEM::String& ns,
00098       const OpenWBEM::CIMObjectPath& objectName,
00099       const OpenWBEM::String& assocClass,
00100       const OpenWBEM::String& resultClass,
00101       const OpenWBEM::String& role,
00102       const OpenWBEM::String& resultRole)
00103 {
00104    m_pProv->updateAccessTime();
00105    CIMObjectPathResultHandlerWrapper coprh(result);
00106    m_pProv->associatorNames(createProvEnvWrapper(env), coprh, ns.c_str(), convertCIMObjectPath(objectName), assocClass.c_str(), resultClass.c_str(),
00107          role.c_str(), resultRole.c_str());
00108 }
00110 void
00111 BI1AssociatorProviderProxy::references(
00112       const OpenWBEM::ProviderEnvironmentIFCRef& env,
00113       OpenWBEM::CIMInstanceResultHandlerIFC& result,
00114       const OpenWBEM::String& ns,
00115       const OpenWBEM::CIMObjectPath& objectName,
00116       const OpenWBEM::String& resultClass,
00117       const OpenWBEM::String& role,
00118       OpenWBEM::WBEMFlags::EIncludeQualifiersFlag includeQualifiers,
00119       OpenWBEM::WBEMFlags::EIncludeClassOriginFlag includeClassOrigin,
00120       const OpenWBEM::StringArray* propertyList)
00121 {
00122    m_pProv->updateAccessTime();
00123    CIMInstanceResultHandlerWrapper cirh(result);
00124    // TODO: handle includeQualifiers & includeClassOrigin
00125    m_pProv->references(createProvEnvWrapper(env), cirh, ns.c_str(), convertCIMObjectPath(objectName), resultClass.c_str(), role.c_str(),
00126          convertPropertyList(propertyList));
00127 }
00129 void
00130 BI1AssociatorProviderProxy::referenceNames(
00131       const OpenWBEM::ProviderEnvironmentIFCRef& env,
00132       OpenWBEM::CIMObjectPathResultHandlerIFC& result,
00133       const OpenWBEM::String& ns,
00134       const OpenWBEM::CIMObjectPath& objectName,
00135       const OpenWBEM::String& resultClass,
00136       const OpenWBEM::String& role)
00137 {
00138    m_pProv->updateAccessTime();
00139    CIMObjectPathResultHandlerWrapper coprh(result);
00140    m_pProv->referenceNames(createProvEnvWrapper(env), coprh, ns.c_str(), convertCIMObjectPath(objectName), resultClass.c_str(), role.c_str());
00141 }
00142 #endif // #ifndef OW_DISABLE_ASSOCIATION_TRAVERSAL
00143 
00144 BI1InstanceProviderProxy::BI1InstanceProviderProxy(
00145       const BI1InstanceProviderIFCRef& pProv) :
00146    InstanceProviderIFC(), m_pProv(pProv)
00147 {
00148 }
00150 void
00151 BI1InstanceProviderProxy::enumInstanceNames(
00152       const OpenWBEM::ProviderEnvironmentIFCRef& env,
00153       const OpenWBEM::String& ns,
00154       const OpenWBEM::String& className,
00155       OpenWBEM::CIMObjectPathResultHandlerIFC& result,
00156       const OpenWBEM::CIMClass& cimClass)
00157 {
00158    m_pProv->updateAccessTime();
00159    CIMObjectPathResultHandlerWrapper coprh(result);
00160    return m_pProv->enumInstanceNames(createProvEnvWrapper(env), ns.c_str(), className.c_str(), coprh, convertCIMClass(cimClass));
00161 }
00163 void
00164 BI1InstanceProviderProxy::enumInstances(
00165       const OpenWBEM::ProviderEnvironmentIFCRef& env,
00166       const OpenWBEM::String& ns,
00167       const OpenWBEM::String& className,
00168       OpenWBEM::CIMInstanceResultHandlerIFC& result,
00169       OpenWBEM::WBEMFlags::ELocalOnlyFlag localOnly, 
00170       OpenWBEM::WBEMFlags::EDeepFlag deep, 
00171       OpenWBEM::WBEMFlags::EIncludeQualifiersFlag includeQualifiers, 
00172       OpenWBEM::WBEMFlags::EIncludeClassOriginFlag includeClassOrigin,
00173       const OpenWBEM::StringArray* propertyList,
00174       const OpenWBEM::CIMClass& requestedClass,
00175       const OpenWBEM::CIMClass& cimClass)
00176 {
00177    m_pProv->updateAccessTime();
00178    CIMInstanceResultHandlerWrapper cirh(result);
00179    // TODO: handle includeQualifiers & includeClassOrigin & localOnly & deep
00180    m_pProv->enumInstances(createProvEnvWrapper(env), ns.c_str(), className.c_str(), cirh,
00181       convertPropertyList(propertyList), convertCIMClass(requestedClass), 
00182       convertCIMClass(cimClass));
00183 }
00185 OpenWBEM::CIMInstance
00186 BI1InstanceProviderProxy::getInstance(
00187       const OpenWBEM::ProviderEnvironmentIFCRef& env,
00188       const OpenWBEM::String& ns,
00189       const OpenWBEM::CIMObjectPath& instanceName,
00190       OpenWBEM::WBEMFlags::ELocalOnlyFlag localOnly,
00191       OpenWBEM::WBEMFlags::EIncludeQualifiersFlag includeQualifiers, 
00192       OpenWBEM::WBEMFlags::EIncludeClassOriginFlag includeClassOrigin,
00193       const OpenWBEM::StringArray* propertyList, 
00194       const OpenWBEM::CIMClass& cimClass)
00195 {
00196    m_pProv->updateAccessTime();
00197    // TODO: handle localOnly, includeQualifiers & includeClassOrigin
00198    return convertCIMInstance(m_pProv->getInstance(createProvEnvWrapper(env), ns.c_str(), convertCIMObjectPath(instanceName),
00199       convertPropertyList(propertyList), convertCIMClass(cimClass)));
00200 }
00201 #ifndef OW_DISABLE_INSTANCE_MANIPULATION
00202 
00203 OpenWBEM::CIMObjectPath
00204 BI1InstanceProviderProxy::createInstance(
00205       const OpenWBEM::ProviderEnvironmentIFCRef& env,
00206       const OpenWBEM::String& ns,
00207       const OpenWBEM::CIMInstance& cimInstance)
00208 {
00209    m_pProv->updateAccessTime();
00210    return convertCIMObjectPath(m_pProv->createInstance(createProvEnvWrapper(env), ns.c_str(), convertCIMInstance(cimInstance)));
00211 }
00213 void
00214 BI1InstanceProviderProxy::modifyInstance(
00215       const OpenWBEM::ProviderEnvironmentIFCRef& env,
00216       const OpenWBEM::String& ns,
00217       const OpenWBEM::CIMInstance& modifiedInstance,
00218       const OpenWBEM::CIMInstance& previousInstance,
00219       OpenWBEM::WBEMFlags::EIncludeQualifiersFlag includeQualifiers,
00220       const OpenWBEM::StringArray* propertyList,
00221       const OpenWBEM::CIMClass& theClass)
00222 {
00223    m_pProv->updateAccessTime();
00224    m_pProv->modifyInstance(createProvEnvWrapper(env), ns.c_str(), convertCIMInstance(modifiedInstance), convertCIMInstance(previousInstance), 
00225       convertPropertyList(propertyList), convertCIMClass(theClass));
00226 }
00228 void
00229 BI1InstanceProviderProxy::deleteInstance(
00230       const OpenWBEM::ProviderEnvironmentIFCRef& env,
00231       const OpenWBEM::String& ns,
00232       const OpenWBEM::CIMObjectPath& cop)
00233 {
00234    m_pProv->updateAccessTime();
00235    m_pProv->deleteInstance(createProvEnvWrapper(env), ns.c_str(), convertCIMObjectPath(cop));
00236 }
00237 #endif // #ifndef OW_DISABLE_INSTANCE_MANIPULATION
00238 
00240 BI1SecondaryInstanceProviderProxy::BI1SecondaryInstanceProviderProxy(const BI1SecondaryInstanceProviderIFCRef& pProv)
00241    : SecondaryInstanceProviderIFC()
00242    , m_pProv(pProv)
00243 {
00244 }
00246 void
00247 BI1SecondaryInstanceProviderProxy::filterInstances(
00248    const OpenWBEM::ProviderEnvironmentIFCRef &env, 
00249    const OpenWBEM::String &ns, 
00250    const OpenWBEM::String &className, 
00251    OpenWBEM::CIMInstanceArray &instances, 
00252    OpenWBEM::WBEMFlags::ELocalOnlyFlag localOnly, 
00253    OpenWBEM::WBEMFlags::EDeepFlag deep, 
00254    OpenWBEM::WBEMFlags::EIncludeQualifiersFlag includeQualifiers, 
00255    OpenWBEM::WBEMFlags::EIncludeClassOriginFlag includeClassOrigin, 
00256    const OpenWBEM::StringArray *propertyList, 
00257    const OpenWBEM::CIMClass &requestedClass, 
00258    const OpenWBEM::CIMClass &cimClass)
00259 {
00260    m_pProv->updateAccessTime();
00261    OWBI1::CIMInstanceArray owbi1Instances(convertCIMInstances(instances));
00262    // TODO: handle localOnly & deep by modifying the propertyList. Handle includeQualifiers & includeClassOrigin
00263    m_pProv->filterInstances(createProvEnvWrapper(env), ns.c_str(), className.c_str(), owbi1Instances, 
00264       convertPropertyList(propertyList), convertCIMClass(requestedClass), convertCIMClass(cimClass));
00265    instances = convertCIMInstances(owbi1Instances);
00266 }
00267 #ifndef OW_DISABLE_INSTANCE_MANIPULATION
00268 
00269 void
00270 BI1SecondaryInstanceProviderProxy::createInstance(const OpenWBEM::ProviderEnvironmentIFCRef &env, const OpenWBEM::String &ns, const OpenWBEM::CIMInstance &cimInstance)
00271 {
00272    m_pProv->updateAccessTime();
00273    m_pProv->createInstance(createProvEnvWrapper(env), ns.c_str(), convertCIMInstance(cimInstance));
00274 }
00276 void
00277 BI1SecondaryInstanceProviderProxy::modifyInstance(
00278    const OpenWBEM::ProviderEnvironmentIFCRef &env, 
00279    const OpenWBEM::String &ns, 
00280    const OpenWBEM::CIMInstance &modifiedInstance, 
00281    const OpenWBEM::CIMInstance &previousInstance, 
00282    OpenWBEM::WBEMFlags::EIncludeQualifiersFlag includeQualifiers, 
00283    const OpenWBEM::StringArray *propertyList, 
00284    const OpenWBEM::CIMClass &theClass)
00285 {
00286    m_pProv->updateAccessTime();
00287    m_pProv->modifyInstance(createProvEnvWrapper(env), ns.c_str(), convertCIMInstance(modifiedInstance), convertCIMInstance(previousInstance), 
00288       convertPropertyList(propertyList), convertCIMClass(theClass));
00289 }
00291 void
00292 BI1SecondaryInstanceProviderProxy::deleteInstance(const OpenWBEM::ProviderEnvironmentIFCRef &env, const OpenWBEM::String &ns, const OpenWBEM::CIMObjectPath &cop)
00293 {
00294    m_pProv->updateAccessTime();
00295    m_pProv->deleteInstance(createProvEnvWrapper(env), ns.c_str(), convertCIMObjectPath(cop));
00296 }
00297 #endif // #ifndef OW_DISABLE_INSTANCE_MANIPULATION
00298 
00300 BI1MethodProviderProxy::BI1MethodProviderProxy(const BI1MethodProviderIFCRef& pProv) :
00301    MethodProviderIFC(), m_pProv(pProv)
00302 {
00303 }
00305 OpenWBEM::CIMValue
00306 BI1MethodProviderProxy::invokeMethod(
00307       const OpenWBEM::ProviderEnvironmentIFCRef& env,
00308       const OpenWBEM::String& ns,
00309       const OpenWBEM::CIMObjectPath& path,
00310       const OpenWBEM::String& methodName,
00311       const OpenWBEM::CIMParamValueArray& in,
00312       OpenWBEM::CIMParamValueArray& out)
00313 {
00314    m_pProv->updateAccessTime();
00315    OWBI1::CIMParamValueArray owbi1Out(convertCIMParamValues(out));
00316    CIMValue rval = m_pProv->invokeMethod(createProvEnvWrapper(env), ns.c_str(), convertCIMObjectPath(path), methodName.c_str(), convertCIMParamValues(in), owbi1Out);
00317    out = convertCIMParamValues(owbi1Out);
00318    return convertCIMValue(rval);
00319 }
00320 
00321 BI1IndicationExportProviderProxy::BI1IndicationExportProviderProxy(const BI1IndicationExportProviderIFCRef& pProv) :
00322    m_pProv(pProv) {}
00323 BI1IndicationExportProviderProxy::~BI1IndicationExportProviderProxy()
00324 {
00325 }
00326 OpenWBEM::StringArray BI1IndicationExportProviderProxy::getHandlerClassNames()
00327 {
00328    return convertStringArray(m_pProv->getHandlerClassNames());
00329 }
00330 
00331 void BI1IndicationExportProviderProxy::exportIndication(const OpenWBEM::ProviderEnvironmentIFCRef& env,
00332    const OpenWBEM::String& ns,
00333    const OpenWBEM::CIMInstance& indHandlerInst, const OpenWBEM::CIMInstance& indicationInst)
00334 {
00335    m_pProv->exportIndication(createProvEnvWrapper(env), ns.c_str(), convertCIMInstance(indHandlerInst), convertCIMInstance(indicationInst));
00336 }
00337 
00338 void BI1IndicationExportProviderProxy::doCooperativeCancel()
00339 {
00340    m_pProv->doCooperativeCancel();
00341 }
00342 void BI1IndicationExportProviderProxy::doDefinitiveCancel()
00343 {
00344    m_pProv->doDefinitiveCancel();
00345 }
00346 
00347 BI1PolledProviderProxy::BI1PolledProviderProxy(const BI1PolledProviderIFCRef& pProv) :
00348    m_pProv(pProv) {}
00349 BI1PolledProviderProxy::~BI1PolledProviderProxy()
00350 {
00351 }
00352 OpenWBEM::Int32 BI1PolledProviderProxy::poll(const OpenWBEM::ProviderEnvironmentIFCRef& env )
00353       { return m_pProv->poll(createProvEnvWrapper(env)); }
00354 OpenWBEM::Int32 BI1PolledProviderProxy::getInitialPollingInterval(const OpenWBEM::ProviderEnvironmentIFCRef& env )
00355       { return m_pProv->getInitialPollingInterval(createProvEnvWrapper(env)); }
00356 void BI1PolledProviderProxy::doCooperativeCancel()
00357 {
00358    m_pProv->doCooperativeCancel();
00359 }
00360 void BI1PolledProviderProxy::doDefinitiveCancel()
00361 {
00362    m_pProv->doDefinitiveCancel();
00363 }
00364 
00365 BI1IndicationProviderProxy::BI1IndicationProviderProxy(const BI1IndicationProviderIFCRef& pProv)
00366    : m_pProv(pProv)
00367    , m_activationCount(0) {}
00368 BI1IndicationProviderProxy::~BI1IndicationProviderProxy()
00369 {
00370 }
00371 void BI1IndicationProviderProxy::deActivateFilter(
00372    const OpenWBEM::ProviderEnvironmentIFCRef &env, 
00373    const OpenWBEM::WQLSelectStatement &filter, 
00374    const OpenWBEM::String& eventType, 
00375    const OpenWBEM::String& nameSpace,
00376    const OpenWBEM::StringArray& classes) 
00377 {
00378    bool lastActivation = (--m_activationCount == 0);
00379    m_pProv->deActivateFilter(createProvEnvWrapper(env),convertWQLSelectStatement(filter),eventType.c_str(),nameSpace.c_str(), convertStringArray(classes),lastActivation);
00380 }
00381 void BI1IndicationProviderProxy::activateFilter(
00382    const OpenWBEM::ProviderEnvironmentIFCRef &env, 
00383    const OpenWBEM::WQLSelectStatement &filter, 
00384    const OpenWBEM::String& eventType, 
00385    const OpenWBEM::String& nameSpace,
00386    const OpenWBEM::StringArray& classes) 
00387 {
00388    bool firstActivation = (m_activationCount++ == 0);
00389    m_pProv->activateFilter(createProvEnvWrapper(env),convertWQLSelectStatement(filter),eventType.c_str(),nameSpace.c_str(),convertStringArray(classes),firstActivation);
00390 }
00391 void BI1IndicationProviderProxy::authorizeFilter(
00392    const OpenWBEM::ProviderEnvironmentIFCRef &env, 
00393    const OpenWBEM::WQLSelectStatement &filter, 
00394    const OpenWBEM::String& eventType, 
00395    const OpenWBEM::String& nameSpace,
00396    const OpenWBEM::StringArray& classes, 
00397    const OpenWBEM::String &owner) 
00398 {
00399    m_pProv->authorizeFilter(createProvEnvWrapper(env),convertWQLSelectStatement(filter),eventType.c_str(),nameSpace.c_str(),convertStringArray(classes),owner.c_str());
00400 }
00401 int BI1IndicationProviderProxy::mustPoll(
00402    const OpenWBEM::ProviderEnvironmentIFCRef& env,
00403    const OpenWBEM::WQLSelectStatement& filter, 
00404    const OpenWBEM::String& eventType, 
00405    const OpenWBEM::String& nameSpace,
00406    const OpenWBEM::StringArray& classes
00407    )
00408 {
00409    return m_pProv->mustPoll(createProvEnvWrapper(env),convertWQLSelectStatement(filter),eventType.c_str(),nameSpace.c_str(),convertStringArray(classes));
00410 }
00411 
00412 } // end namespace OWBI1
00413 

Generated on Thu Feb 9 08:48:28 2006 for openwbem by  doxygen 1.4.6