OW_CIMClient.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 
00036 #include "OW_config.h"
00037 #include "OW_CIMClient.hpp"
00038 #include "OW_ClientCIMOMHandle.hpp"
00039 #include "OW_CIMClassEnumeration.hpp"
00040 #include "OW_CIMInstanceEnumeration.hpp"
00041 #include "OW_CIMValue.hpp"
00042 #include "OW_CIMQualifierEnumeration.hpp"
00043 #include "OW_CIMObjectPathEnumeration.hpp"
00044 #include "OW_CIMNameSpaceUtils.hpp"
00045 #include "OW_CIMException.hpp"
00046 #include "OW_CIMProtocolIFC.hpp"
00047 
00048 namespace OW_NAMESPACE
00049 {
00050 
00051 using namespace WBEMFlags;
00053 CIMClient::CIMClient(const String& url, const String& ns, const ClientAuthCBIFCRef& authCB)
00054    : m_namespace(ns)
00055    , m_ch(ClientCIMOMHandle::createFromURL(url, authCB))
00056 {
00057 }
00058 #if !defined(OW_DISABLE_INSTANCE_MANIPULATION) && !defined(OW_DISABLE_NAMESPACE_MANIPULATION)
00059 
00060 void CIMClient::createNameSpace(const String& ns)
00061 {
00062    try
00063    {
00064       CIMNameSpaceUtils::createCIM_Namespace(*m_ch,ns);
00065    }
00066    catch (const CIMException& e)
00067    {
00068       // server doesn't support CIM_Namespace, try __Namespace
00069       CIMNameSpaceUtils::create__Namespace(*m_ch,ns);
00070    }
00071 }
00073 void CIMClient::deleteNameSpace(const String& ns)
00074 {
00075    try
00076    {
00077       CIMNameSpaceUtils::deleteCIM_Namespace(*m_ch,ns);
00078    }
00079    catch (const CIMException& e)
00080    {
00081       // server doesn't support CIM_Namespace, try __Namespace
00082       CIMNameSpaceUtils::delete__Namespace(*m_ch,ns);
00083    }
00084 }
00085 #endif // #ifndef OW_DISABLE_INSTANCE_MANIPULATION
00086 
00087 StringArray
00088 CIMClient::enumNameSpaceE(EDeepFlag deep)
00089 {
00090    return CIMNameSpaceUtils::enum__Namespace(*m_ch, m_namespace, deep);
00091 }
00093 void
00094 CIMClient::enumNameSpace(StringResultHandlerIFC& result,
00095    EDeepFlag deep)
00096 {
00097    CIMNameSpaceUtils::enum__Namespace(*m_ch, m_namespace, result, deep);
00098 }
00100 StringArray
00101 CIMClient::enumCIM_NamespaceE()
00102 {
00103    try
00104    {
00105       return CIMNameSpaceUtils::enumCIM_Namespace(*m_ch);
00106    }
00107    catch (const CIMException& e)
00108    {
00109       // server doesn't support CIM_Namespace, try __Namespace
00110       return CIMNameSpaceUtils::enum__Namespace(*m_ch, m_namespace, E_DEEP);
00111    }
00112 }
00114 void
00115 CIMClient::enumCIM_Namespace(StringResultHandlerIFC& result)
00116 {
00117    try
00118    {
00119       CIMNameSpaceUtils::enumCIM_Namespace(*m_ch, result);
00120    }
00121    catch (const CIMException& e)
00122    {
00123       // server doesn't support CIM_Namespace, try __Namespace
00124       CIMNameSpaceUtils::enum__Namespace(*m_ch, m_namespace, result, E_DEEP);
00125    }
00126 }
00128 void
00129 CIMClient::enumClass(const String& className,
00130    CIMClassResultHandlerIFC& result,
00131    EDeepFlag deep,
00132    ELocalOnlyFlag localOnly,
00133    EIncludeQualifiersFlag includeQualifiers,
00134    EIncludeClassOriginFlag includeClassOrigin)
00135 {
00136    m_ch->enumClass(m_namespace, className, result, deep, localOnly,
00137       includeQualifiers, includeClassOrigin);
00138 }
00140 CIMClassEnumeration
00141 CIMClient::enumClassE(const String& className,
00142    EDeepFlag deep,
00143    ELocalOnlyFlag localOnly,
00144    EIncludeQualifiersFlag includeQualifiers,
00145    EIncludeClassOriginFlag includeClassOrigin)
00146 {
00147    return m_ch->enumClassE(m_namespace, className, deep, localOnly, includeQualifiers,
00148       includeClassOrigin);
00149 }
00151 void
00152    CIMClient::enumClassNames(
00153    const String& className,
00154    StringResultHandlerIFC& result,
00155    EDeepFlag deep)
00156 {
00157    m_ch->enumClassNames(m_namespace, className, result, deep);
00158 }
00160 StringEnumeration
00161    CIMClient::enumClassNamesE(
00162    const String& className,
00163    EDeepFlag deep)
00164 {
00165    return m_ch->enumClassNamesE(m_namespace, className, deep);
00166 }
00168 void
00169 CIMClient::enumInstances(
00170    const String& className,
00171    CIMInstanceResultHandlerIFC& result,
00172    EDeepFlag deep,
00173    ELocalOnlyFlag localOnly,
00174    EIncludeQualifiersFlag includeQualifiers,
00175    EIncludeClassOriginFlag includeClassOrigin,
00176    const StringArray* propertyList)
00177 {
00178    m_ch->enumInstances(m_namespace, className, result, deep, localOnly,
00179       includeQualifiers, includeClassOrigin, propertyList);
00180 }
00182 CIMInstanceEnumeration
00183 CIMClient::enumInstancesE(
00184    const String& className,
00185    EDeepFlag deep,
00186    ELocalOnlyFlag localOnly,
00187    EIncludeQualifiersFlag includeQualifiers,
00188    EIncludeClassOriginFlag includeClassOrigin,
00189    const StringArray* propertyList)
00190 {
00191    return m_ch->enumInstancesE(m_namespace, className, deep, localOnly,
00192       includeQualifiers, includeClassOrigin, propertyList);
00193 }
00195 void
00196 CIMClient::enumInstanceNames(
00197    const String& className,
00198    CIMObjectPathResultHandlerIFC& result)
00199 {
00200    m_ch->enumInstanceNames(m_namespace, className, result);
00201 }
00203 CIMObjectPathEnumeration
00204 CIMClient::enumInstanceNamesE(
00205    const String& className)
00206 {
00207    return m_ch->enumInstanceNamesE(m_namespace, className);
00208 }
00210 CIMClass
00211    CIMClient::getClass(
00212    const String& className,
00213    ELocalOnlyFlag localOnly,
00214    EIncludeQualifiersFlag includeQualifiers,
00215    EIncludeClassOriginFlag includeClassOrigin,
00216    const StringArray* propertyList)
00217 {
00218    return m_ch->getClass(m_namespace, className, localOnly,
00219       includeQualifiers, includeClassOrigin, propertyList);
00220 }
00222 CIMInstance
00223    CIMClient::getInstance(
00224    const CIMObjectPath& instanceName,
00225    ELocalOnlyFlag localOnly,
00226    EIncludeQualifiersFlag includeQualifiers,
00227    EIncludeClassOriginFlag includeClassOrigin,
00228    const StringArray* propertyList)
00229 {
00230    return m_ch->getInstance(m_namespace, instanceName, localOnly,
00231       includeQualifiers, includeClassOrigin, propertyList);
00232 }
00234 CIMValue
00235    CIMClient::invokeMethod(
00236    const CIMObjectPath& path,
00237    const String& methodName,
00238    const CIMParamValueArray& inParams,
00239    CIMParamValueArray& outParams)
00240 {
00241    return m_ch->invokeMethod(m_namespace, path, methodName, inParams, outParams);
00242 }
00244 CIMQualifierType
00245    CIMClient::getQualifierType(const String& qualifierName)
00246 {
00247    return m_ch->getQualifierType(m_namespace, qualifierName);
00248 }
00249 #ifndef OW_DISABLE_QUALIFIER_DECLARATION
00250 
00251 void
00252    CIMClient::setQualifierType(const CIMQualifierType& qualifierType)
00253 {
00254    m_ch->setQualifierType(m_namespace, qualifierType);
00255 }
00257 void
00258 CIMClient::deleteQualifierType(const String& qualName)
00259 {
00260    m_ch->deleteQualifierType(m_namespace, qualName);
00261 }
00263 void
00264 CIMClient::enumQualifierTypes(
00265    CIMQualifierTypeResultHandlerIFC& result)
00266 {
00267    m_ch->enumQualifierTypes(m_namespace, result);
00268 }
00270 CIMQualifierTypeEnumeration
00271 CIMClient::enumQualifierTypesE()
00272 {
00273    return m_ch->enumQualifierTypesE(m_namespace);
00274 }
00275 #endif // #ifndef OW_DISABLE_QUALIFIER_DECLARATION
00276 #ifndef OW_DISABLE_SCHEMA_MANIPULATION
00277 
00278 void
00279    CIMClient::modifyClass(const CIMClass& cimClass)
00280 {
00281    m_ch->modifyClass(m_namespace, cimClass);
00282 }
00284 void
00285    CIMClient::createClass(const CIMClass& cimClass)
00286 {
00287    m_ch->createClass(m_namespace, cimClass);
00288 }
00290 void
00291    CIMClient::deleteClass(const String& className)
00292 {
00293    m_ch->deleteClass(m_namespace, className);
00294 }
00295 #endif // #ifndef OW_DISABLE_SCHEMA_MANIPULATION
00296 #ifndef OW_DISABLE_INSTANCE_MANIPULATION
00297 
00298 void
00299    CIMClient::modifyInstance(const CIMInstance& modifiedInstance,
00300    EIncludeQualifiersFlag includeQualifiers,
00301    StringArray* propertyList)
00302 {
00303    m_ch->modifyInstance(m_namespace, modifiedInstance, includeQualifiers,
00304       propertyList);
00305 }
00307 CIMObjectPath
00308    CIMClient::createInstance(const CIMInstance& instance)
00309 {
00310    return m_ch->createInstance(m_namespace, instance);
00311 }
00313 void
00314    CIMClient::deleteInstance(const CIMObjectPath& path)
00315 {
00316    m_ch->deleteInstance(m_namespace, path);
00317 }
00318 #if !defined(OW_DISABLE_PROPERTY_OPERATIONS)
00319 
00320 void
00321    CIMClient::setProperty(
00322    const CIMObjectPath& instanceName,
00323    const String& propertyName,
00324    const CIMValue& newValue)
00325 {
00326    m_ch->setProperty(m_namespace, instanceName, propertyName, newValue);
00327 }
00328 #endif // #if !defined(OW_DISABLE_PROPERTY_OPERATIONS)
00329 #endif // #ifndef OW_DISABLE_INSTANCE_MANIPULATION
00330 #if !defined(OW_DISABLE_PROPERTY_OPERATIONS)
00331 
00332 CIMValue
00333    CIMClient::getProperty(
00334    const CIMObjectPath& instanceName,
00335    const String& propertyName)
00336 {
00337    return m_ch->getProperty(m_namespace, instanceName, propertyName);
00338 }
00339 #endif // #if !defined(OW_DISABLE_PROPERTY_OPERATIONS)
00340 #ifndef OW_DISABLE_ASSOCIATION_TRAVERSAL
00341 
00342 void
00343    CIMClient::associatorNames(
00344    const CIMObjectPath& objectName,
00345    CIMObjectPathResultHandlerIFC& result,
00346    const String& assocClass,
00347    const String& resultClass,
00348    const String& role,
00349    const String& resultRole)
00350 {
00351    m_ch->associatorNames(m_namespace, objectName, result,
00352       assocClass, resultClass, role, resultRole);
00353 }
00355 CIMObjectPathEnumeration
00356    CIMClient::associatorNamesE(
00357    const CIMObjectPath& objectName,
00358    const String& assocClass,
00359    const String& resultClass,
00360    const String& role,
00361    const String& resultRole)
00362 {
00363    return m_ch->associatorNamesE(m_namespace, objectName,
00364       assocClass, resultClass, role, resultRole);
00365 }
00367 void
00368 CIMClient::associators(
00369    const CIMObjectPath& path,
00370    CIMInstanceResultHandlerIFC& result,
00371    const String& assocClass,
00372    const String& resultClass,
00373    const String& role,
00374    const String& resultRole,
00375    EIncludeQualifiersFlag includeQualifiers,
00376    EIncludeClassOriginFlag includeClassOrigin,
00377    const StringArray* propertyList)
00378 {
00379    m_ch->associators(m_namespace, path, result,
00380       assocClass, resultClass,
00381       role, resultRole, includeQualifiers, includeClassOrigin, propertyList);
00382 }
00384 CIMInstanceEnumeration
00385 CIMClient::associatorsE(
00386    const CIMObjectPath& path,
00387    const String& assocClass,
00388    const String& resultClass,
00389    const String& role,
00390    const String& resultRole,
00391    EIncludeQualifiersFlag includeQualifiers,
00392    EIncludeClassOriginFlag includeClassOrigin,
00393    const StringArray* propertyList)
00394 {
00395    return m_ch->associatorsE(m_namespace, path, assocClass,
00396       resultClass, role, resultRole, includeQualifiers,
00397       includeClassOrigin, propertyList);
00398 }
00400 void
00401 CIMClient::associatorsClasses(
00402    const CIMObjectPath& path,
00403    CIMClassResultHandlerIFC& result,
00404    const String& assocClass,
00405    const String& resultClass,
00406    const String& role,
00407    const String& resultRole,
00408    EIncludeQualifiersFlag includeQualifiers,
00409    EIncludeClassOriginFlag includeClassOrigin,
00410    const StringArray* propertyList)
00411 {
00412    m_ch->associatorsClasses(m_namespace, path, result, assocClass,
00413       resultClass, role, resultRole, includeQualifiers, includeClassOrigin,
00414       propertyList);
00415 }
00417 CIMClassEnumeration
00418 CIMClient::associatorsClassesE(
00419    const CIMObjectPath& path,
00420    const String& assocClass,
00421    const String& resultClass,
00422    const String& role,
00423    const String& resultRole,
00424    EIncludeQualifiersFlag includeQualifiers,
00425    EIncludeClassOriginFlag includeClassOrigin,
00426    const StringArray* propertyList)
00427 {
00428    return m_ch->associatorsClassesE(m_namespace, path, assocClass,
00429       resultClass, role, resultRole, includeQualifiers, includeClassOrigin,
00430       propertyList);
00431 }
00433 void
00434    CIMClient::referenceNames(
00435    const CIMObjectPath& path,
00436    CIMObjectPathResultHandlerIFC& result,
00437    const String& resultClass,
00438    const String& role)
00439 {
00440    m_ch->referenceNames(m_namespace, path, result, resultClass, role);
00441 }
00443 CIMObjectPathEnumeration
00444    CIMClient::referenceNamesE(
00445    const CIMObjectPath& path,
00446    const String& resultClass,
00447    const String& role)
00448 {
00449    return m_ch->referenceNamesE(m_namespace, path, resultClass, role);
00450 }
00452 void
00453 CIMClient::references(
00454    const CIMObjectPath& path,
00455    CIMInstanceResultHandlerIFC& result,
00456    const String& resultClass,
00457    const String& role,
00458    EIncludeQualifiersFlag includeQualifiers,
00459    EIncludeClassOriginFlag includeClassOrigin,
00460    const StringArray* propertyList)
00461 {
00462    m_ch->references(m_namespace, path, result, resultClass,
00463       role, includeQualifiers, includeClassOrigin, propertyList);
00464 }
00466 CIMInstanceEnumeration
00467 CIMClient::referencesE(
00468    const CIMObjectPath& path,
00469    const String& resultClass,
00470    const String& role,
00471    EIncludeQualifiersFlag includeQualifiers,
00472    EIncludeClassOriginFlag includeClassOrigin,
00473    const StringArray* propertyList)
00474 {
00475    return m_ch->referencesE(m_namespace, path, resultClass, role,
00476       includeQualifiers, includeClassOrigin, propertyList);
00477 }
00479 void
00480 CIMClient::referencesClasses(
00481    const CIMObjectPath& path,
00482    CIMClassResultHandlerIFC& result,
00483    const String& resultClass,
00484    const String& role,
00485    EIncludeQualifiersFlag includeQualifiers,
00486    EIncludeClassOriginFlag includeClassOrigin,
00487    const StringArray* propertyList)
00488 {
00489    m_ch->referencesClasses(m_namespace, path, result, resultClass,
00490       role, includeQualifiers, includeClassOrigin, propertyList);
00491 }
00493 CIMClassEnumeration
00494 CIMClient::referencesClassesE(
00495    const CIMObjectPath& path,
00496    const String& resultClass,
00497    const String& role,
00498    EIncludeQualifiersFlag includeQualifiers,
00499    EIncludeClassOriginFlag includeClassOrigin,
00500    const StringArray* propertyList)
00501 {
00502    return m_ch->referencesClassesE(m_namespace, path, resultClass, role,
00503       includeQualifiers, includeClassOrigin, propertyList);
00504 }
00505 #endif // #ifndef OW_DISABLE_ASSOCIATION_TRAVERSAL
00506 
00507 void
00508 CIMClient::execQuery(
00509    CIMInstanceResultHandlerIFC& result,
00510    const String& query,
00511    const String& queryLanguage)
00512 {
00513    m_ch->execQuery(m_namespace, result, query, queryLanguage);
00514 }
00516 CIMInstanceEnumeration
00517 CIMClient::execQueryE(
00518    const String& query,
00519    const String& queryLanguage)
00520 {
00521    return m_ch->execQueryE(m_namespace, query, queryLanguage);
00522 }
00524 bool
00525 CIMClient::setHTTPRequestHeader(const String& hdrName, const String& hdrValue)
00526 {
00527    return m_ch->setHTTPRequestHeader(hdrName, hdrValue);
00528 }
00530 bool
00531 CIMClient::getHTTPResponseHeader(const String& hdrName, String& valueOut) const
00532 {
00533    return m_ch->getHTTPResponseHeader(hdrName, valueOut);
00534 }
00535 
00536 } // end namespace OW_NAMESPACE
00537 

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