OW_EmbeddedCIMOMEnvironment.hpp

Go to the documentation of this file.
00001 /*******************************************************************************
00002 * Copyright (C) 2001-2004 Vintela, Inc. All rights reserved.
00003 * Copyright (C) 2005 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., Novell, 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., Novell, 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 
00038 #ifndef OW_EMBEDDEDCIMOMENVIRONMENT_HPP_INCLUDE_GUARD_
00039 #define OW_EMBEDDEDCIMOMENVIRONMENT_HPP_INCLUDE_GUARD_
00040 #define OW_DAEMON_NAME "owcimomd"
00041 #include "OW_config.h"
00042 #include "OW_Types.hpp"
00043 #include "OW_LogLevel.hpp"
00044 #include "OW_ServiceEnvironmentIFC.hpp"
00045 #include "OW_SharedLibrary.hpp"
00046 #include "OW_SortedVectorMap.hpp"
00047 #include "OW_Map.hpp"
00048 #include "OW_Array.hpp"
00049 #include "OW_SharedLibraryReference.hpp"
00050 #include "OW_DateTime.hpp"
00051 #include "OW_Mutex.hpp"
00052 #include "OW_CIMInstance.hpp"
00053 #include "OW_Reference.hpp"
00054 #include "OW_IntrusiveReference.hpp"
00055 #include "OW_ConfigFile.hpp"
00056 #include "OW_HashMap.hpp"
00057 #include "OW_SortedVectorSet.hpp"
00058 #include "OW_CimomCommonFwd.hpp"
00059 #include "OW_CimomServerFwd.hpp"
00060 #include "OW_CIMFwd.hpp"
00061 
00062 namespace OW_NAMESPACE
00063 {
00064 
00065 class OW_CIMOMCOMMON_API EmbeddedCIMOMEnvironment : public ServiceEnvironmentIFC
00066 {
00067 public:
00068    EmbeddedCIMOMEnvironment();
00069    ~EmbeddedCIMOMEnvironment();
00070    void init();
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    // from ServiceEnvironmentIFC
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    //virtual CIMOMHandleIFCRef getRepositoryCIMOMHandle(OperationContext& context) const;
00101 
00105    CIMOMHandleIFCRef getWQLFilterCIMOMHandle(const CIMInstance& inst,
00106       OperationContext& context) const;
00107 
00108    virtual WQLIFCRef getWQLRef() const;
00109    virtual LoggerRef getLogger() const OW_DEPRECATED;
00110    virtual LoggerRef getLogger(const String& componentName) const;
00111    IndicationServerRef getIndicationServer() const;
00112    PollingManagerRef getPollingManager() const;
00113    void clearConfigItems();
00114    virtual void setConfigItem(const String &item, const String &value,
00115       EOverwritePreviousFlag overwritePrevious = E_OVERWRITE_PREVIOUS);
00116    void unloadProviders();
00117    void startServices();
00118    void shutdown();
00119    ProviderManagerRef getProviderManager() const;
00120    void unloadReqHandlers();
00121    IndicationRepLayerMediatorRef getIndicationRepLayerMediator() const;
00122    RepositoryIFCRef getRepository() const;
00123    AuthorizerManagerRef getAuthorizerManager() const;
00124 
00125 
00126    // do not use this unless absolutely necessary!
00127    static EmbeddedCIMOMEnvironmentRef& instance();
00128 
00129 private:
00130    void _createLogger();
00131    void _loadConfigItemsFromFile(const String& filename);
00132    void _loadRequestHandlers();
00133    void _loadServices();
00134    void _createPollingManager();
00135    void _createIndicationServer();
00136    void _loadAuthorizer();
00137    void _createAuthorizerManager();
00138    void _sortServicesForDependencies();
00139 
00140    // Types
00141    typedef ConfigFile::ConfigMap ConfigMap;
00142    typedef Reference<ConfigMap> ConfigMapRef;
00143    struct ReqHandlerData : public IntrusiveCountableBase
00144    {
00145       DateTime dt;
00146       RequestHandlerIFCRef rqIFCRef;
00147       String filename;
00148    };
00149    typedef IntrusiveReference<ReqHandlerData> ReqHandlerDataRef;
00150    typedef SortedVectorMap<String, ReqHandlerDataRef> ReqHandlerMap;
00151    mutable Mutex m_monitor;
00152    RepositoryIFCRef m_cimRepository;
00153    RepositoryIFCRef m_cimServer;
00154    AuthorizerIFCRef m_authorizer;
00155 
00156    AuthorizerManagerRef m_authorizerManager;
00157    //AuthorizerIFCRef m_authorizer;
00158 
00159    LoggerRef m_Logger;
00160    ConfigMapRef m_configItems;
00161    ProviderManagerRef m_providerManager;
00162    mutable SharedLibraryRef m_wqlLib;
00163    mutable SharedLibraryRef m_indicationRepLayerLib;
00164    PollingManagerRef m_pollingManager;
00165    IndicationServerRef m_indicationServer;
00166    bool m_indicationsDisabled;
00167    Array<SelectableIFCRef> m_selectables;
00168    Array<SelectableCallbackIFCRef> m_selectableCallbacks;
00169    mutable Array<ServiceIFCRef> m_services;
00170    mutable ReqHandlerMap m_reqHandlers;
00171    mutable Mutex m_reqHandlersLock;
00172    mutable Mutex m_indicationLock;
00173    mutable bool m_indicationRepLayerDisabled;
00174    mutable Mutex m_selectableLock;
00175    
00176    enum EEnvState
00177    {
00178       E_STATE_INVALID,
00179       E_STATE_INITIALIZING,
00180       E_STATE_INITIALIZED,
00181       E_STATE_STARTING,
00182       E_STATE_STARTED,
00183       E_STATE_SHUTTING_DOWN,
00184       E_STATE_SHUTDOWN,
00185       E_STATE_UNLOADED
00186    };
00187 
00188    static bool isLoaded(EEnvState s)
00189    {
00190       return s >= E_STATE_INITIALIZING && s <= E_STATE_SHUTDOWN;
00191    }
00192    static bool isInitialized(EEnvState s)
00193    {
00194       return s >= E_STATE_INITIALIZED && s <= E_STATE_STARTED;
00195    }
00196 
00197    EEnvState m_state;
00198    mutable Mutex m_stateGuard;
00199    IndicationRepLayerMediatorRef m_indicationRepLayerMediatorRef;
00200 
00201    static String COMPONENT_NAME;
00202 };
00203 
00204 } // end namespace OW_NAMESPACE
00205 
00206 #endif

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