00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
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
00053
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
00126
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 }
00136
00137 #endif // #ifndef OW_PROVIDERAGENTENVIRONMENT_HPP_INCLUDE_GUARD_