OW_ProviderAgentEnvironment.hpp

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 #ifndef OW_PROVIDERAGENTENVIRONMENT_HPP_INCLUDE_GUARD_
00038 #define OW_PROVIDERAGENTENVIRONMENT_HPP_INCLUDE_GUARD_
00039 
00040 #include "OW_config.h"
00041 #include "OW_ServiceEnvironmentIFC.hpp"
00042 #include "OW_ConfigFile.hpp"
00043 #include "OW_AuthenticatorIFC.hpp"
00044 #include "OW_Map.hpp"
00045 #include "OW_ClientCIMOMHandleConnectionPool.hpp"
00046 #include "OW_Cache.hpp"
00047 #include "OW_CppProviderBaseIFC.hpp"
00048 #include "OW_Reference.hpp"
00049 #include "OW_ProviderAgentLockerIFC.hpp"
00050 #include "OW_Array.hpp"
00051 
00052 // The classes and functions defined in this file are not meant for general
00053 // use, they are internal implementation details.  They may change at any time.
00054 
00055 namespace OW_NAMESPACE
00056 {
00057 
00058 typedef std::pair<SelectableIFCRef, SelectableCallbackIFCRef> SelectablePair_t;
00059 
00060 class ProviderAgentEnvironment : public ServiceEnvironmentIFC
00061 {
00062 public:
00063    enum EClassRetrievalFlag
00064    {
00065       E_DONT_RETRIEVE_CLASSES,
00066       E_RETRIEVE_CLASSES
00067    };
00068 
00069    enum EConnectionCredentialsUsageFlag
00070    {
00071       E_DONT_USE_CONNECTION_CREDENTIALS,
00072       E_USE_CONNECTION_CREDENTIALS
00073    };
00074 
00075    ProviderAgentEnvironment(const ConfigFile::ConfigMap& configMap,
00076       const Array<CppProviderBaseIFCRef>& providers,
00077       const Array<CIMClass>& cimClasses,
00078       const AuthenticatorIFCRef& authenticator,
00079       const Array<RequestHandlerIFCRef>& requestHandlers,
00080       const LoggerRef& logger,
00081         const String& callbackURL,
00082       const Reference<Array<SelectablePair_t> >& selectables,
00083       const ProviderAgentLockerIFCRef& locker);
00084    virtual ~ProviderAgentEnvironment();
00085    virtual bool authenticate(String &userName,
00086       const String &info, String &details, OperationContext& context) const;
00087    virtual void addSelectable(const SelectableIFCRef& obj,
00088       const SelectableCallbackIFCRef& cb);
00089 
00090    struct selectableFinder
00091    {
00092       selectableFinder(const SelectableIFCRef& obj) : m_obj(obj) {}
00093       template <typename T>
00094       bool operator()(const T& x)
00095       {
00096          return x.first == m_obj;
00097       }
00098       const SelectableIFCRef& m_obj;
00099    };
00100 
00101    virtual void removeSelectable(const SelectableIFCRef& obj);
00102    virtual String getConfigItem(const String &name, const String& defRetVal) const;
00103    virtual StringArray getMultiConfigItem(const String &itemName, 
00104       const StringArray& defRetVal, const char* tokenizeSeparator) const;
00105    virtual void setConfigItem(const String& item, const String& value, EOverwritePreviousFlag overwritePrevious);
00106 
00107    virtual RequestHandlerIFCRef getRequestHandler(const String& ct) const;
00108    virtual CIMOMHandleIFCRef getCIMOMHandle(OperationContext&,
00109       EBypassProvidersFlag bypassProviders,
00110       ELockingFlag locking) const;
00111    virtual LoggerRef getLogger() const;
00112    virtual LoggerRef getLogger(const String& componentName) const;
00113 
00114 private:
00115    ConfigFile::ConfigMap m_configItems;
00116    AuthenticatorIFCRef m_authenticator;
00117    LoggerRef m_logger;
00118    String m_callbackURL;
00119    Array<RequestHandlerIFCRef> m_requestHandlers;
00120    Reference<Array<SelectablePair_t> > m_selectables;
00121    Map<String, CppProviderBaseIFCRef> m_assocProvs;
00122    Map<String, CppProviderBaseIFCRef> m_instProvs;
00123    Map<String, CppProviderBaseIFCRef> m_secondaryInstProvs;
00124    Map<String, CppProviderBaseIFCRef> m_methodProvs;
00125    // TODO Refactor me.  ProviderAgentCIMOMHandles get a reference
00126    // (&, not Reference) to m_cimClasses, and modify it.
00127    mutable Cache<CIMClass> m_cimClasses;
00128    ProviderAgentLockerIFCRef m_locker;
00129    EClassRetrievalFlag m_classRetrieval;
00130    mutable ClientCIMOMHandleConnectionPool m_connectionPool;
00131    ProviderAgentEnvironment::EConnectionCredentialsUsageFlag m_useConnectionCredentials;
00132 
00133 };
00134 
00135 } // end namespace OW_NAMESPACE
00136 
00137 #endif // #ifndef OW_PROVIDERAGENTENVIRONMENT_HPP_INCLUDE_GUARD_

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