OW_ProviderAgentCIMOMHandle.cpp

Go to the documentation of this file.
00001 /*******************************************************************************
00002 * Copyright (C) 2001-2004 Vintela, Inc. All rights reserved.
00003 * Copyright (C) 2004 Novell, Inc. All rights reserved.
00004 *
00005 * Redistribution and use in source and binary forms, with or without
00006 * modification, are permitted provided that the following conditions are met:
00007 *
00008 *  - Redistributions of source code must retain the above copyright notice,
00009 *    this list of conditions and the following disclaimer.
00010 *
00011 *  - Redistributions in binary form must reproduce the above copyright notice,
00012 *    this list of conditions and the following disclaimer in the documentation
00013 *    and/or other materials provided with the distribution.
00014 *
00015 *  - Neither the name of Vintela, Inc. nor the names of its
00016 *    contributors may be used to endorse or promote products derived from this
00017 *    software without specific prior written permission.
00018 *
00019 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS IS''
00020 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
00021 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
00022 * ARE DISCLAIMED. IN NO EVENT SHALL Vintela, Inc. OR THE CONTRIBUTORS
00023 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
00024 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
00025 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
00026 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
00027 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
00028 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
00029 * POSSIBILITY OF SUCH DAMAGE.
00030 *******************************************************************************/
00031 
00037 #include "OW_config.h"
00038 #include "OW_ProviderAgentCIMOMHandle.hpp"
00039 #include "OW_CIMInstance.hpp"
00040 #include "OW_CIMException.hpp"
00041 #include "OW_CIMValue.hpp"
00042 #include "OW_CIMClass.hpp"
00043 #include "OW_CIMQualifierType.hpp"
00044 #include "OW_CIMProperty.hpp"
00045 #include "OW_CIMObjectPath.hpp"
00046 #include "OW_CppProviderBaseIFC.hpp"
00047 #include "OW_CppInstanceProviderIFC.hpp"
00048 #include "OW_CppSecondaryInstanceProviderIFC.hpp"
00049 #include "OW_CppMethodProviderIFC.hpp"
00050 #include "OW_CppAssociatorProviderIFC.hpp"
00051 #include "OW_ProviderAgent.hpp"
00052 #include "OW_Assertion.hpp"
00053 #include "OW_ConfigException.hpp"
00054 #include "OW_Enumeration.hpp"
00055 #include "OW_HTTPServer.hpp"
00056 #include "OW_Thread.hpp"
00057 
00058 namespace OW_NAMESPACE
00059 {
00060 
00061 //using namespace WBEMFlags;
00062 
00063 ProviderAgentCIMOMHandle::ProviderAgentCIMOMHandle(
00064    const Map<String, CppProviderBaseIFCRef>& assocProvs,
00065    const Map<String, CppProviderBaseIFCRef>& instProvs,
00066    const Map<String, CppProviderBaseIFCRef>& secondaryInstProvs,
00067    const Map<String, CppProviderBaseIFCRef>& methodProvs,
00068    Cache<CIMClass>& cimClasses,
00069    const ProviderEnvironmentIFCRef& env,
00070    ProviderAgentEnvironment::EClassRetrievalFlag classRetrieval,
00071    const ProviderAgentLockerIFCRef& locker)
00072    : m_assocProvs(assocProvs)
00073    , m_instProvs(instProvs)
00074    , m_secondaryInstProvs(secondaryInstProvs)
00075    , m_methodProvs(methodProvs)
00076    , m_cimClasses(cimClasses)
00077    , m_PAEnv(env)
00078    , m_locker(locker)
00079    , m_classRetrieval(classRetrieval)
00080 {
00081 }
00082 
00084 CIMInstance
00085 ProviderAgentCIMOMHandle::getInstance(const String &ns,
00086          const CIMObjectPath &instanceName,
00087          WBEMFlags:: ELocalOnlyFlag localOnly,
00088          WBEMFlags:: EIncludeQualifiersFlag includeQualifiers,
00089          WBEMFlags:: EIncludeClassOriginFlag includeClassOrigin,
00090          const StringArray *propertyList)
00091 {
00092    CppInstanceProviderIFC* pInstProv = getInstanceProvider(ns, instanceName.getClassName());
00093    CppSecondaryInstanceProviderIFC* pSInstProv = getSecondaryInstanceProvider(ns, instanceName.getClassName());
00094    if (!pInstProv && !pSInstProv)
00095    {
00096       OW_THROWCIM(CIMException::NOT_SUPPORTED);
00097    }
00098    CIMInstance rval(CIMNULL);
00099    {
00100       PAReadLock rl(m_locker);
00101       if (pInstProv)
00102       {
00103          rval = pInstProv->getInstance(m_PAEnv,ns ,instanceName ,localOnly ,
00104                includeQualifiers ,includeClassOrigin ,
00105                propertyList , helperGetClass(ns, instanceName.getClassName()));
00106       }
00107       if (pSInstProv)
00108       {
00109          CIMInstanceArray ia;
00110          if (pInstProv)
00111          {
00112             ia.push_back(rval);
00113          }
00114          else
00115          {
00116             CIMInstance newInst(instanceName.getClassName());
00117             newInst.setProperties(instanceName.getKeys());
00118             newInst.setKeys(instanceName.getKeys());
00119             ia.push_back(newInst);
00120          }
00121          CIMClass cc = helperGetClass(ns, instanceName.getClassName());
00122          pSInstProv->filterInstances(m_PAEnv,ns , instanceName.getClassName(),
00123                                         ia,localOnly , WBEMFlags::E_SHALLOW,
00124                               includeQualifiers, includeClassOrigin,
00125                               propertyList, cc, cc); // TODO should the classes be different?
00126          OW_ASSERT(ia.size() == 1); // did the secondary instance provider do something horribly wrong?
00127          rval = ia[0];
00128       }
00129    }
00130    return rval;
00131 }
00132 
00134 void
00135 ProviderAgentCIMOMHandle::enumQualifierTypes(const String &ns,
00136          CIMQualifierTypeResultHandlerIFC &result)
00137 {
00138    OW_THROWCIM(CIMException::NOT_SUPPORTED);
00139 }
00140 
00142 CIMValue
00143 ProviderAgentCIMOMHandle::invokeMethod(const String &ns,
00144          const CIMObjectPath &path,
00145          const String &methodName,
00146          const CIMParamValueArray &inParams,
00147          CIMParamValueArray &outParams)
00148 {
00149    CppMethodProviderIFC* pMethodProv = getMethodProvider(ns, path.getClassName(), methodName);
00150    if (!pMethodProv)
00151    {
00152       OW_THROWCIM(CIMException::NOT_SUPPORTED);
00153    }
00154    {
00155       PAWriteLock wl(m_locker);
00156       return pMethodProv->invokeMethod(m_PAEnv,ns ,path ,methodName ,
00157             inParams, outParams);
00158    }
00159 }
00160 
00162 CIMQualifierType
00163 ProviderAgentCIMOMHandle::getQualifierType(const String &ns, const String &qualifierName)
00164 {
00165    OW_THROWCIM(CIMException::NOT_SUPPORTED);
00166 }
00167 
00169 void
00170 ProviderAgentCIMOMHandle::setQualifierType(const String &ns, const CIMQualifierType &qualifierType)
00171 {
00172    OW_THROWCIM(CIMException::NOT_SUPPORTED);
00173 }
00174 
00176 void
00177 ProviderAgentCIMOMHandle::deleteQualifierType(const String &ns, const String &qualName)
00178 {
00179    OW_THROWCIM(CIMException::NOT_SUPPORTED);
00180 }
00181 
00183 void
00184 ProviderAgentCIMOMHandle::createClass(const String &ns, const CIMClass &cimClass)
00185 {
00186    OW_THROWCIM(CIMException::NOT_SUPPORTED);
00187 }
00188 
00190 void
00191 ProviderAgentCIMOMHandle::deleteClass(const String &ns, const String &className)
00192 {
00193    OW_THROWCIM(CIMException::NOT_SUPPORTED);
00194 }
00195 
00197 void
00198 ProviderAgentCIMOMHandle::modifyClass(const String &ns, const CIMClass &cimClass)
00199 {
00200    OW_THROWCIM(CIMException::NOT_SUPPORTED);
00201 }
00202 #ifndef OW_DISABLE_INSTANCE_MANIPULATION
00203 
00205 void
00206 ProviderAgentCIMOMHandle::deleteInstance(const String &ns, const CIMObjectPath &path)
00207 {
00208    CppInstanceProviderIFC* pInstProv = getInstanceProvider(ns, path.getClassName());
00209    CppSecondaryInstanceProviderIFC* pSInstProv = getSecondaryInstanceProvider(ns, path.getClassName());
00210    if (!pInstProv && !pSInstProv)
00211    {
00212       OW_THROWCIM(CIMException::NOT_SUPPORTED);
00213    }
00214    {
00215       PAWriteLock wl(m_locker);
00216       if (pInstProv)
00217       {
00218          pInstProv->deleteInstance(m_PAEnv,ns , path);
00219       }
00220       if (pSInstProv)
00221       {
00222          pSInstProv->deleteInstance(m_PAEnv,ns , path);
00223       }
00224    }
00225 }
00226 
00228 void
00229 ProviderAgentCIMOMHandle::setProperty(const String &ns,
00230                              const CIMObjectPath &instanceName,
00231                              const String &propertyName,
00232                              const CIMValue &newValue)
00233 {
00234    OW_THROWCIM(CIMException::NOT_SUPPORTED);
00235    // CIMOM will never demand this of us.  It always translates
00236    // to modifyInstance.
00237 }
00238 
00240 void
00241 ProviderAgentCIMOMHandle::modifyInstance(const String &ns,
00242          const CIMInstance &modifiedInstance,
00243          WBEMFlags:: EIncludeQualifiersFlag includeQualifiers,
00244          const StringArray *propertyList)
00245 {
00246    CppInstanceProviderIFC* pInstProv = getInstanceProvider(ns, modifiedInstance.getClassName());
00247    CppSecondaryInstanceProviderIFC* pSInstProv = getSecondaryInstanceProvider(ns, modifiedInstance.getClassName());
00248    if (!pInstProv && !pSInstProv)
00249    {
00250       OW_THROWCIM(CIMException::NOT_SUPPORTED);
00251    }
00252    {
00253       PAWriteLock wl(m_locker);
00254       CIMClass cc = helperGetClass(ns, modifiedInstance.getClassName());
00255       if (pInstProv)
00256       {
00257          pInstProv->modifyInstance(m_PAEnv,ns ,modifiedInstance ,
00258                CIMInstance(CIMNULL),   // previousInstance unavailable
00259                includeQualifiers ,
00260                propertyList , cc);
00261       }
00262       if (pSInstProv)
00263       {
00264          pSInstProv->modifyInstance(m_PAEnv,ns ,modifiedInstance ,
00265                               CIMInstance(CIMNULL),
00266                               includeQualifiers ,propertyList ,
00267                               cc);
00268       }
00269    }
00270 }
00271 
00273 CIMObjectPath
00274 ProviderAgentCIMOMHandle::createInstance(const String &ns, const CIMInstance &instance)
00275 {
00276    CppInstanceProviderIFC* pInstProv = getInstanceProvider(ns, instance.getClassName());
00277    CppSecondaryInstanceProviderIFC* pSInstProv = getSecondaryInstanceProvider(ns, instance.getClassName());
00278    if (!pInstProv && !pSInstProv)
00279    {
00280       OW_THROWCIM(CIMException::NOT_SUPPORTED);
00281    }
00282    CIMObjectPath rval(ns, instance); // Not CIMNULL since we have to return something for the seconday instance provider.
00283    {
00284       PAWriteLock wl(m_locker);
00285       if (pInstProv)
00286       {
00287          rval = pInstProv->createInstance(m_PAEnv,ns , instance);
00288       }
00289       if (pSInstProv)
00290       {
00291          pSInstProv->createInstance(m_PAEnv,ns , instance);
00292       }
00293    }
00294    return rval;
00295 }
00296 #endif // #ifndef OW_DISABLE_INSTANCE_MANIPULATION
00297 
00298 CIMValue
00299 ProviderAgentCIMOMHandle::getProperty(const String &ns,
00300          const CIMObjectPath &instanceName,
00301          const String &propertyName)
00302 {
00303    OW_THROWCIM(CIMException::NOT_SUPPORTED);
00304    // CIMOM will never demand this of us.
00305 }
00306 
00307 #ifndef OW_DISABLE_ASSOCIATION_TRAVERSAL
00308 
00309 void
00310 ProviderAgentCIMOMHandle::associatorNames(const String &ns,
00311          const CIMObjectPath &objectName,
00312          CIMObjectPathResultHandlerIFC &result,
00313          const String &assocClass,
00314          const String &resultClass,
00315          const String &role,
00316          const String &resultRole)
00317 {
00318    CppAssociatorProviderIFC* pAssocProv = getAssociatorProvider(ns, assocClass);
00319    if (!pAssocProv)
00320    {
00321       OW_THROWCIM(CIMException::NOT_SUPPORTED);
00322    }
00323    {
00324       PAReadLock rl(m_locker);
00325       pAssocProv->associatorNames(m_PAEnv,result ,ns ,objectName ,
00326             assocClass ,resultClass ,role ,resultRole);
00327    }
00328 }
00329 
00331 void
00332 ProviderAgentCIMOMHandle::associatorsClasses(const String &ns,
00333             const CIMObjectPath &path,
00334             CIMClassResultHandlerIFC &result,
00335             const String &assocClass,
00336             const String &resultClass,
00337             const String &role,
00338             const String &resultRole,
00339             WBEMFlags:: EIncludeQualifiersFlag includeQualifiers,
00340             WBEMFlags:: EIncludeClassOriginFlag includeClassOrigin,
00341             const StringArray *propertyList)
00342 {
00343    OW_THROWCIM(CIMException::NOT_SUPPORTED);
00344 }
00345 
00347 void
00348 ProviderAgentCIMOMHandle::associators(const String &ns, const CIMObjectPath &path,
00349       CIMInstanceResultHandlerIFC &result,
00350       const String &assocClass,
00351       const String &resultClass,
00352       const String &role,
00353       const String &resultRole,
00354       WBEMFlags:: EIncludeQualifiersFlag
00355       includeQualifiers,
00356       WBEMFlags:: EIncludeClassOriginFlag includeClassOrigin,
00357       const StringArray *propertyList)
00358 {
00359    CppAssociatorProviderIFC* pAssocProv = getAssociatorProvider(ns, assocClass);
00360    if (!pAssocProv)
00361    {
00362       OW_THROWCIM(CIMException::NOT_SUPPORTED);
00363    }
00364    {
00365       PAReadLock rl(m_locker);
00366       pAssocProv->associators(m_PAEnv,result ,ns , path,assocClass ,
00367             resultClass ,role ,resultRole ,
00368             includeQualifiers ,includeClassOrigin ,
00369             propertyList);
00370    }
00371 }
00372 
00374 void
00375 ProviderAgentCIMOMHandle::referenceNames(const String &ns,
00376       const CIMObjectPath &path,
00377       CIMObjectPathResultHandlerIFC &result,
00378       const String &resultClass,
00379       const String &role)
00380 {
00381    CppAssociatorProviderIFC* pAssocProv = getAssociatorProvider(ns, resultClass);
00382    if (!pAssocProv)
00383    {
00384       OW_THROWCIM(CIMException::NOT_SUPPORTED);
00385    }
00386    {
00387       PAReadLock rl(m_locker);
00388       pAssocProv->referenceNames(m_PAEnv,result ,ns , path,resultClass ,role);
00389    }
00390 }
00391 
00393 void
00394 ProviderAgentCIMOMHandle::references(const String &ns,
00395       const CIMObjectPath &path,
00396       CIMInstanceResultHandlerIFC &result,
00397       const String &resultClass,
00398       const String &role,
00399       WBEMFlags:: EIncludeQualifiersFlag includeQualifiers,
00400       WBEMFlags:: EIncludeClassOriginFlag includeClassOrigin,
00401       const StringArray *propertyList)
00402 {
00403    CppAssociatorProviderIFC* pAssocProv = getAssociatorProvider(ns, resultClass);
00404    if (!pAssocProv)
00405    {
00406       OW_THROWCIM(CIMException::NOT_SUPPORTED);
00407    }
00408    {
00409       PAReadLock rl(m_locker);
00410       pAssocProv->references(m_PAEnv,result ,ns , path,resultClass ,role ,
00411             includeQualifiers ,
00412             includeClassOrigin ,
00413             propertyList);
00414    }
00415 }
00416 
00418 void
00419 ProviderAgentCIMOMHandle::referencesClasses(const String &ns,
00420       const CIMObjectPath &path,
00421       CIMClassResultHandlerIFC &result,
00422       const String &resultClass,
00423       const String &role,
00424       WBEMFlags:: EIncludeQualifiersFlag includeQualifiers,
00425       WBEMFlags:: EIncludeClassOriginFlag includeClassOrigin,
00426       const StringArray *propertyList)
00427 {
00428    OW_THROWCIM(CIMException::NOT_SUPPORTED);
00429 }
00430 #endif // #ifndef OW_DISABLE_ASSOCIATION_TRAVERSAL
00431 
00432 void
00433 ProviderAgentCIMOMHandle::close()
00434 {
00435 }
00436 
00438 void
00439 ProviderAgentCIMOMHandle::enumClassNames(const String &ns,
00440       const String &className,
00441       StringResultHandlerIFC &result,
00442       WBEMFlags:: EDeepFlag deep)
00443 {
00444    OW_THROWCIM(CIMException::NOT_SUPPORTED);
00445 }
00446 
00448 void
00449 ProviderAgentCIMOMHandle::enumClass(const String &ns,
00450       const String &className,
00451       CIMClassResultHandlerIFC &result,
00452       WBEMFlags:: EDeepFlag deep,
00453       WBEMFlags:: ELocalOnlyFlag localOnly,
00454       WBEMFlags:: EIncludeQualifiersFlag includeQualifiers,
00455       WBEMFlags:: EIncludeClassOriginFlag includeClassOrigin)
00456 {
00457    OW_THROWCIM(CIMException::NOT_SUPPORTED);
00458 }
00459 
00461 void
00462 ProviderAgentCIMOMHandle::enumInstances(const String &ns,
00463       const String &className,
00464       CIMInstanceResultHandlerIFC &result,
00465       WBEMFlags:: EDeepFlag deep,
00466       WBEMFlags:: ELocalOnlyFlag localOnly,
00467       WBEMFlags:: EIncludeQualifiersFlag includeQualifiers,
00468       WBEMFlags:: EIncludeClassOriginFlag includeClassOrigin,
00469       const StringArray *propertyList)
00470 {
00471    CppInstanceProviderIFC* pInstProv = getInstanceProvider(ns, className);
00472    if (!pInstProv)
00473    {
00474       OW_THROWCIM(CIMException::NOT_SUPPORTED);
00475    }
00476    {
00477       PAReadLock rl(m_locker);
00478       CIMClass cc = helperGetClass(ns, className);
00479       pInstProv->enumInstances(m_PAEnv,ns ,className ,result ,localOnly ,
00480             deep ,includeQualifiers ,includeClassOrigin,
00481             propertyList, cc,cc);
00482    }
00483 }
00484 
00486 void
00487 ProviderAgentCIMOMHandle::enumInstanceNames(const String &ns,
00488       const String &className,
00489       CIMObjectPathResultHandlerIFC &result)
00490 {
00491    CppInstanceProviderIFC* pInstProv = getInstanceProvider(ns, className);
00492    if (!pInstProv)
00493    {
00494       OW_THROWCIM(CIMException::NOT_SUPPORTED);
00495    }
00496    {
00497       PAReadLock rl(m_locker);
00498       pInstProv->enumInstanceNames(m_PAEnv,ns ,className ,result ,
00499                             helperGetClass(ns, className));
00500    }
00501 }
00502 
00504 CIMClass
00505 ProviderAgentCIMOMHandle::getClass(const String &ns,
00506       const String &className,
00507       WBEMFlags:: ELocalOnlyFlag localOnly,
00508       WBEMFlags:: EIncludeQualifiersFlag includeQualifiers,
00509       WBEMFlags:: EIncludeClassOriginFlag includeClassOrigin,
00510       const StringArray *propertyList)
00511 {
00512    OW_THROWCIM(CIMException::NOT_SUPPORTED);
00513 }
00514 
00516 void
00517 ProviderAgentCIMOMHandle::execQuery(const String &ns,
00518       CIMInstanceResultHandlerIFC &result,
00519       const String &query,
00520       const String &queryLanguage)
00521 {
00522    OW_THROWCIM(CIMException::NOT_SUPPORTED);
00523 }
00524 
00526 ProviderAgentCIMOMHandle::PAReadLock::PAReadLock(const ProviderAgentLockerIFCRef& locker)
00527    : m_locker(locker)
00528 {
00529    m_locker->getReadLock();
00530 }
00532 ProviderAgentCIMOMHandle::PAReadLock::~PAReadLock()
00533 {
00534    m_locker->releaseReadLock();
00535 }
00537 ProviderAgentCIMOMHandle::PAWriteLock::PAWriteLock(const ProviderAgentLockerIFCRef& locker)
00538    : m_locker(locker)
00539 {
00540    m_locker->getWriteLock();
00541 }
00543 ProviderAgentCIMOMHandle::PAWriteLock::~PAWriteLock()
00544 {
00545    m_locker->releaseWriteLock();
00546 }
00549 CppInstanceProviderIFC*
00550 ProviderAgentCIMOMHandle::getInstanceProvider(const String& ns,
00551                                     const String& className) const
00552 {
00553    CppInstanceProviderIFC* rval = 0;
00554    String key = ns + ":" + className;
00555    key.toLowerCase();
00556    Map<String, CppProviderBaseIFCRef>::const_iterator iter =
00557          m_instProvs.find(key);
00558    if (iter != m_instProvs.end())
00559    {
00560       rval = iter->second->getInstanceProvider();
00561       OW_ASSERT(rval != 0);
00562       return rval;
00563    }
00564    key = String("") + ":" + className;
00565    key.toLowerCase();
00566    iter = m_instProvs.find(key);
00567    if (iter != m_instProvs.end())
00568    {
00569       rval = iter->second->getInstanceProvider();
00570       OW_ASSERT(rval != 0);
00571       return rval;
00572    }
00573    iter = m_instProvs.find("*");
00574    if (iter != m_instProvs.end())
00575    {
00576       rval = iter->second->getInstanceProvider();
00577       OW_ASSERT(rval != 0);
00578       return rval;
00579    }
00580    return rval;
00581 }
00583 CppSecondaryInstanceProviderIFC*
00584 ProviderAgentCIMOMHandle::getSecondaryInstanceProvider(const String& ns,
00585                                     const String& className) const
00586 {
00587    CppSecondaryInstanceProviderIFC* rval = 0;
00588    String key = ns + ":" + className;
00589    key.toLowerCase();
00590    Map<String, CppProviderBaseIFCRef>::const_iterator iter =
00591          m_secondaryInstProvs.find(key);
00592    if (iter != m_secondaryInstProvs.end())
00593    {
00594       rval = iter->second->getSecondaryInstanceProvider();
00595       OW_ASSERT(rval != 0);
00596       return rval;
00597    }
00598    key = String("") + ":" + className;
00599    key.toLowerCase();
00600    iter = m_secondaryInstProvs.find(key);
00601    if (iter != m_secondaryInstProvs.end())
00602    {
00603       rval = iter->second->getSecondaryInstanceProvider();
00604       OW_ASSERT(rval != 0);
00605       return rval;
00606    }
00607    iter = m_secondaryInstProvs.find("*");
00608    if (iter != m_secondaryInstProvs.end())
00609    {
00610       rval = iter->second->getSecondaryInstanceProvider();
00611       OW_ASSERT(rval != 0);
00612       return rval;
00613    }
00614    return rval;
00615 }
00616 #ifndef OW_DISABLE_ASSOCIATION_TRAVERSAL
00617 
00618 CppAssociatorProviderIFC*
00619 ProviderAgentCIMOMHandle::getAssociatorProvider(const String& ns,
00620                                     const String& className) const
00621 {
00622    CppAssociatorProviderIFC* rval = 0;
00623    String key = ns + ":" + className;
00624    key.toLowerCase();
00625    Map<String, CppProviderBaseIFCRef>::const_iterator iter =
00626          m_assocProvs.find(key);
00627    if (iter != m_assocProvs.end())
00628    {
00629       rval = iter->second->getAssociatorProvider();
00630       OW_ASSERT(rval != 0);
00631       return rval;
00632    }
00633    key = String("") + ":" + className;
00634    key.toLowerCase();
00635    iter = m_assocProvs.find(key);
00636    if (iter != m_assocProvs.end())
00637    {
00638       rval = iter->second->getAssociatorProvider();
00639       OW_ASSERT(rval != 0);
00640       return rval;
00641    }
00642    iter = m_assocProvs.find("*");
00643    if (iter != m_assocProvs.end())
00644    {
00645       rval = iter->second->getAssociatorProvider();
00646       OW_ASSERT(rval != 0);
00647       return rval;
00648    }
00649    return rval;
00650 }
00651 #endif
00652 
00653 CppMethodProviderIFC*
00654 ProviderAgentCIMOMHandle::getMethodProvider(const String& ns,
00655                                  const String& className,
00656                                  const String& methodName) const
00657 {
00658    CppMethodProviderIFC* rval = 0;
00659    String key = ns + ":" + className + ":" + methodName;
00660    key.toLowerCase();
00661    Map<String, CppProviderBaseIFCRef>::const_iterator iter =
00662          m_methodProvs.find(key);
00663    if (iter != m_methodProvs.end())
00664    {
00665       rval = iter->second->getMethodProvider();
00666       OW_ASSERT(rval != 0);
00667       return rval;
00668    }
00669    key = String("") + ":" + className + ":" + methodName;
00670    key.toLowerCase();
00671    iter = m_methodProvs.find(key);
00672    if (iter != m_methodProvs.end())
00673    {
00674       rval = iter->second->getMethodProvider();
00675       OW_ASSERT(rval != 0);
00676       return rval;
00677    }
00678    iter = m_methodProvs.find("*");
00679    if (iter != m_methodProvs.end())
00680    {
00681       rval = iter->second->getMethodProvider();
00682       OW_ASSERT(rval != 0);
00683       return rval;
00684    }
00685    return rval;
00686 }
00687 
00689 CIMClass
00690 ProviderAgentCIMOMHandle::helperGetClass(const String& ns,
00691                                const String& className)
00692 {
00693    CIMClass rval(CIMNULL);
00694    String lcn = className;
00695    lcn.toLowerCase();
00696    String lns = ns;
00697    lns.toLowerCase();
00698    String key = lns + ":" + lcn;
00699    rval = m_cimClasses.getFromCache(key);
00700    if (rval)
00701    {
00702       return rval;
00703    }
00704    rval = m_cimClasses.getFromCache(lcn);
00705    if (rval)
00706    {
00707       return rval;
00708    }
00709    if (m_classRetrieval == ProviderAgentEnvironment::E_RETRIEVE_CLASSES)
00710    {
00711       CIMOMHandleIFCRef ch = m_PAEnv->getCIMOMHandle();
00712       if (ch)
00713       {
00714          rval = ch->getClass(ns, className);
00715          if (rval)
00716          {
00717             m_cimClasses.addToCache(rval,key);
00718          }
00719       }
00720    }
00721    return rval;
00722 }
00723 
00726 } // end namespace OW_NAMESPACE
00727 

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