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
00036 #ifndef OW_CIMOMENVIRONMENT_HPP_INCLUDE_GUARD_
00037 #define OW_CIMOMENVIRONMENT_HPP_INCLUDE_GUARD_
00038 #define OW_DAEMON_NAME "owcimomd"
00039 #include "OW_config.h"
00040 #include "OW_Types.hpp"
00041 #include "OW_LogLevel.hpp"
00042 #include "OW_ServiceEnvironmentIFC.hpp"
00043 #include "OW_SharedLibrary.hpp"
00044 #include "OW_SortedVectorMap.hpp"
00045 #include "OW_Map.hpp"
00046 #include "OW_Array.hpp"
00047 #include "OW_SharedLibraryReference.hpp"
00048 #include "OW_DateTime.hpp"
00049 #include "OW_Mutex.hpp"
00050 #include "OW_CIMInstance.hpp"
00051 #include "OW_Reference.hpp"
00052 #include "OW_IntrusiveReference.hpp"
00053 #include "OW_ConfigFile.hpp"
00054 #include "OW_HashMap.hpp"
00055 #include "OW_SortedVectorSet.hpp"
00056 #include "OW_CimomCommonFwd.hpp"
00057 #include "OW_CimomServerFwd.hpp"
00058 #include "OW_CIMFwd.hpp"
00059
00060 namespace OW_NAMESPACE
00061 {
00062
00063 class OW_CIMOMCOMMON_API CIMOMEnvironment : public ServiceEnvironmentIFC
00064 {
00065 public:
00066 CIMOMEnvironment();
00067 ~CIMOMEnvironment();
00068 void init();
00069 virtual bool authenticate(String &userName, const String &info,
00070 String &details, OperationContext& context) const;
00071 virtual String getConfigItem(const String &name, const String& defRetVal="") const;
00072 virtual StringArray getMultiConfigItem(const String &itemName,
00073 const StringArray& defRetVal, const char* tokenizeSeparator) const;
00074
00075
00079 CIMOMHandleIFCRef getCIMOMHandle(OperationContext& context,
00080 EBypassProvidersFlag bypassProviders = E_USE_PROVIDERS,
00081 ELockingFlag locking = E_LOCKING) const;
00082
00083 enum ESendIndicationsFlag
00084 {
00085 E_DONT_SEND_INDICATIONS,
00086 E_SEND_INDICATIONS
00087 };
00088
00092 CIMOMHandleIFCRef getCIMOMHandle(OperationContext& context,
00093 ESendIndicationsFlag sendIndications,
00094 EBypassProvidersFlag bypassProviders = E_USE_PROVIDERS,
00095 ELockingFlag locking = E_LOCKING) const;
00096
00100
00101
00105 CIMOMHandleIFCRef getWQLFilterCIMOMHandle(const CIMInstance& inst,
00106 OperationContext& context) const;
00107
00108 virtual WQLIFCRef getWQLRef() const;
00109 virtual RequestHandlerIFCRef getRequestHandler(const String &id) const;
00110 virtual LoggerRef getLogger() const OW_DEPRECATED;
00111 virtual LoggerRef getLogger(const String& componentName) const;
00112 IndicationServerRef getIndicationServer() const;
00113 PollingManagerRef getPollingManager() const;
00114 void clearConfigItems();
00115 virtual void setConfigItem(const String &item, const String &value,
00116 EOverwritePreviousFlag overwritePrevious = E_OVERWRITE_PREVIOUS);
00117 virtual void addSelectable(const SelectableIFCRef& obj,
00118 const SelectableCallbackIFCRef& cb);
00119 virtual void removeSelectable(const SelectableIFCRef& obj);
00120 void unloadProviders();
00121 void startServices();
00122 void shutdown();
00123 ProviderManagerRef getProviderManager() const;
00124 void runSelectEngine() const;
00125 void exportIndication(const CIMInstance& instance,
00126 const String& instNS);
00127 void unloadReqHandlers();
00128 IndicationRepLayerMediatorRef getIndicationRepLayerMediator() const;
00129 RepositoryIFCRef getRepository() const;
00130 AuthorizerManagerRef getAuthorizerManager() const;
00131
00132
00133
00134 static CIMOMEnvironmentRef& instance();
00135
00136 private:
00137 void _createLogger();
00138 void _loadConfigItemsFromFile(const String& filename);
00139 void _loadRequestHandlers();
00140 void _loadServices();
00141 void _createAuthManager();
00142 void _createPollingManager();
00143 void _createIndicationServer();
00144 SharedLibraryRepositoryIFCRef _getIndicationRepLayer(const RepositoryIFCRef& rref) const;
00145 void _clearSelectables();
00146 void _loadAuthorizer();
00147 void _createAuthorizerManager();
00148 void _sortServicesForDependencies();
00149
00150
00151 typedef ConfigFile::ConfigMap ConfigMap;
00152 typedef Reference<ConfigMap> ConfigMapRef;
00153 struct ReqHandlerData : public IntrusiveCountableBase
00154 {
00155 DateTime dt;
00156 RequestHandlerIFCRef rqIFCRef;
00157 String filename;
00158 };
00159 typedef IntrusiveReference<ReqHandlerData> ReqHandlerDataRef;
00160 typedef SortedVectorMap<String, ReqHandlerDataRef> ReqHandlerMap;
00161 mutable Mutex m_monitor;
00162 RepositoryIFCRef m_cimRepository;
00163 RepositoryIFCRef m_cimServer;
00164 AuthorizerIFCRef m_authorizer;
00165
00166 AuthorizerManagerRef m_authorizerManager;
00167
00168
00169 AuthManagerRef m_authManager;
00170 LoggerRef m_Logger;
00171 ConfigMapRef m_configItems;
00172 ProviderManagerRef m_providerManager;
00173 mutable SharedLibraryRef m_wqlLib;
00174 mutable SharedLibraryRef m_indicationRepLayerLib;
00175 PollingManagerRef m_pollingManager;
00176 IndicationServerRef m_indicationServer;
00177 bool m_indicationsDisabled;
00178 Array<SelectableIFCRef> m_selectables;
00179 Array<SelectableCallbackIFCRef> m_selectableCallbacks;
00180 mutable Array<ServiceIFCRef> m_services;
00181 mutable ReqHandlerMap m_reqHandlers;
00182 mutable Mutex m_reqHandlersLock;
00183 mutable Mutex m_indicationLock;
00184 mutable bool m_indicationRepLayerDisabled;
00185 mutable Mutex m_selectableLock;
00186
00187 enum EEnvState
00188 {
00189 E_STATE_INVALID,
00190 E_STATE_INITIALIZING,
00191 E_STATE_INITIALIZED,
00192 E_STATE_STARTING,
00193 E_STATE_STARTED,
00194 E_STATE_SHUTTING_DOWN,
00195 E_STATE_SHUTDOWN,
00196 E_STATE_UNLOADED
00197 };
00198
00199 static bool isLoaded(EEnvState s)
00200 {
00201 return s >= E_STATE_INITIALIZING && s <= E_STATE_SHUTDOWN;
00202 }
00203 static bool isInitialized(EEnvState s)
00204 {
00205 return s >= E_STATE_INITIALIZED && s <= E_STATE_STARTED;
00206 }
00207
00208 EEnvState m_state;
00209 mutable Mutex m_stateGuard;
00210 IndicationRepLayerMediatorRef m_indicationRepLayerMediatorRef;
00211
00212 static String COMPONENT_NAME;
00213 };
00214
00215 }
00216
00217 #endif