coherence/net/ConfigurableCacheFactory.hpp

00001 /*
00002 * ConfigurableCacheFactory.hpp
00003 *
00004 * Copyright (c) 2000, 2009, Oracle and/or its affiliates. All rights reserved.
00005 *
00006 * Oracle is a registered trademarks of Oracle Corporation and/or its
00007 * affiliates.
00008 *
00009 * This software is the confidential and proprietary information of Oracle
00010 * Corporation. You shall not disclose such confidential and proprietary
00011 * information and shall use it only in accordance with the terms of the
00012 * license agreement you entered into with Oracle.
00013 *
00014 * This notice may not be removed or altered.
00015 */
00016 #ifndef COH_CONFIGURABLE_CACHE_FACTORY_HPP
00017 #define COH_CONFIGURABLE_CACHE_FACTORY_HPP
00018 
00019 #include "coherence/lang.ns"
00020 
00021 #include "coherence/net/NamedCache.hpp"
00022 #include "coherence/net/Service.hpp"
00023 #include "coherence/run/xml/XmlConfigurable.hpp"
00024 #include "coherence/util/Map.hpp"
00025 
00026 COH_OPEN_NAMESPACE2(coherence,net)
00027 
00028 using coherence::run::xml::XmlConfigurable;
00029 using coherence::util::Map;
00030 
00031 /**
00032 * An interface for XML driven %cache factory.
00033 *
00034 * @see DefaultConfigurableCacheFactory
00035 */
00036 class COH_EXPORT ConfigurableCacheFactory
00037     : public interface_spec<ConfigurableCacheFactory,
00038         implements<XmlConfigurable> >
00039     {
00040     // ----- ConfigurableCacheFactory interface -----------------------------
00041 
00042     public:
00043         /**
00044         * Ensure a %cache for the given name using the corresponding XML
00045         * configuration.
00046         *
00047         * @param vsCacheName the %cache name
00048         *
00049         * @return a handle to a NamedCache created according to the
00050         *         configuration XML
00051         */
00052         virtual NamedCache::Handle ensureCache(String::View vsCacheName) = 0;
00053 
00054         /**
00055         * Releases and destroys the specified NamedCache.
00056         *
00057         * <b>Warning:</b> This method is used to completely destroy the
00058         * specified %cache across the cluster. All references in the entire
00059         * cluster to this %cache will be invalidated, the cached data will be
00060         * cleared, and all resources will be released.
00061         *
00062         * @param hCache the NamedCache object to be destroyed
00063         *
00064         * @see releaseCache
00065         */
00066         virtual void destroyCache(NamedCache::Handle hCache) = 0;
00067 
00068         /**
00069         * Release local resources associated with the specified instance of
00070         * the %cache.
00071         *
00072         * Releasing a NamedCache reference makes it no longer usable, but
00073         * does not affect the content of the %cache. In other words, all other
00074         * references to the %cache will still be valid, and the %cache data is
00075         * not affected by releasing the reference.
00076         *
00077         * The reference that is released using this method can no longer be
00078         * used; any attempt to use the reference will result in an exception.
00079         *
00080         * @param hCache the NamedCache object to be released
00081         *
00082         * @see destroyCache
00083         */
00084         virtual void releaseCache(NamedCache::Handle hCache) = 0;
00085 
00086         /**
00087         * Ensure a service for the given name using the corresponding XML
00088         * configuration.
00089         *
00090         * @param vsServiceName the service name
00091         *
00092         * @return a handle to a service created according to the
00093         *         configuration XML
00094         */
00095         virtual Service::Handle ensureService(String::View vsServiceName) = 0;
00096 
00097         /**
00098         * Get the product edition.
00099         *
00100         * @return the product edition
00101         */
00102         virtual int32_t getEdition() const = 0;
00103 
00104         /**
00105         * Set the product edition.
00106         *
00107         * @param nEdition  the product edition
00108         */
00109         virtual void setEdition(int32_t nEdition) = 0;
00110 
00111         /**
00112         * Get the local member
00113         *
00114         * @return  the local member
00115         */
00116         virtual Member::View getLocalMember() const = 0;
00117 
00118         /**
00119         * Set the local member
00120         *
00121         * @param vMemberLocal  the local member
00122         */
00123         virtual void setLocalMember(Member::View vMemberLocal) = 0;
00124 
00125         /**
00126         * Get the filter config map.
00127         *
00128         * @return  the filter config map
00129         */
00130         virtual Map::View getFilterConfigMap() const = 0;
00131 
00132         /**
00133         * Set the filter config map.
00134         *
00135         * @param vMapFilterConfig  the filter config map
00136         */
00137         virtual void setFilterConfigMap(Map::View vMapFilterConfig) = 0;
00138 
00139         /**
00140         * Shutdown all services related to this ConfigurableCacheFactory.
00141         */
00142         virtual void shutdown() = 0;
00143     };
00144 
00145 COH_CLOSE_NAMESPACE2
00146 
00147 #endif // COH_CONFIGURABLE_CACHE_FACTORY_HPP
Copyright (c) 2000, 2009, Oracle and/or its affiliates. All rights reserved.