Oracle® Fusion Middleware C++ API Reference for Oracle Coherence
12c (12.2.1.0.0)

E55667-01

coherence/net/cache/WrapperNamedCache.hpp

00001 /*
00002 * WrapperNamedCache.hpp
00003 *
00004 * Copyright (c) 2000, 2015, 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_WRAPPER_NAMED_CACHE_HPP
00017 #define COH_WRAPPER_NAMED_CACHE_HPP
00018 
00019 #include "coherence/lang.ns"
00020 
00021 #include "coherence/net/CacheService.hpp"
00022 #include "coherence/net/NamedCache.hpp"
00023 #include "coherence/util/Comparator.hpp"
00024 #include "coherence/util/Filter.hpp"
00025 #include "coherence/util/MapListener.hpp"
00026 #include "coherence/util/Set.hpp"
00027 #include "coherence/util/ValueExtractor.hpp"
00028 
00029 COH_OPEN_NAMESPACE3(coherence,net,cache)
00030 
00031 using coherence::net::CacheService;
00032 using coherence::net::NamedCache;
00033 using coherence::util::Collection;
00034 using coherence::util::Comparator;
00035 using coherence::util::Filter;
00036 using coherence::util::MapListener;
00037 using coherence::util::Set;
00038 using coherence::util::ValueExtractor;
00039 
00040 /**
00041  * A wrapper for the given NamedCache.
00042  *
00043  * @author lh  2012.06.18
00044  * @since Coherence 12.1.2
00045  */
00046 class COH_EXPORT WrapperNamedCache
00047     : public class_spec<WrapperNamedCache,
00048         extends<Object>,
00049         implements<NamedCache> >
00050     {
00051     friend class factory<WrapperNamedCache>;
00052 
00053     // ----- constructors ---------------------------------------------------
00054 
00055     protected:
00056         /**
00057          * Create a new WrapperNamedCache.
00058          *
00059          * @param hCache  the NamedCache that will be wrapped by this 
00060          *                WrapperNamedCache
00061          */
00062         WrapperNamedCache(NamedCache::Handle hCache);
00063 
00064     // ----- Map interface --------------------------------------------------
00065 
00066     public:
00067         /**
00068          * {@inheritDoc}
00069          */
00070         virtual size32_t size() const;
00071 
00072         /**
00073          * {@inheritDoc}
00074          */
00075         virtual bool isEmpty() const;
00076 
00077         /**
00078          * {@inheritDoc}
00079          */
00080         virtual bool containsKey(Object::View vKey) const;
00081 
00082         /**
00083          * {@inheritDoc}
00084          */
00085         virtual bool containsValue(Object::View vValue) const;
00086 
00087         /**
00088          * {@inheritDoc}
00089          */
00090         virtual Object::Holder get(Object::View vKey) const;
00091 
00092         /**
00093          * {@inheritDoc}
00094          */
00095         virtual Object::Holder get(Object::View vKey);
00096 
00097         /**
00098          * {@inheritDoc}
00099          */
00100         virtual Object::Holder put(Object::View vKey, Object::Holder ohValue);
00101 
00102         /**
00103          * {@inheritDoc}
00104          */
00105         virtual Object::Holder remove(Object::View vKey);
00106         using Map::remove;
00107 
00108         /**
00109          * {@inheritDoc}
00110          */
00111         virtual void putAll(Map::View vMap);
00112 
00113         /**
00114          * {@inheritDoc}
00115          */
00116         virtual void clear();
00117 
00118         /**
00119          * {@inheritDoc}
00120          */
00121         virtual Set::View keySet() const;
00122 
00123         /**
00124          * {@inheritDoc}
00125          */
00126         virtual Set::Handle keySet();
00127 
00128         /**
00129          * {@inheritDoc}
00130          */
00131         virtual Collection::View values() const;
00132 
00133         /**
00134          * {@inheritDoc}
00135          */
00136         virtual Collection::Handle values();
00137 
00138         /**
00139          * {@inheritDoc}
00140          */
00141         virtual Set::View entrySet() const;
00142 
00143         /**
00144          * {@inheritDoc}
00145          */
00146         virtual Set::Handle entrySet();
00147 
00148     // ----- CacheMap interface ---------------------------------------------
00149 
00150     public:
00151         /**
00152          * {@inheritDoc}
00153          */
00154         virtual Map::View getAll(Collection::View vKeys) const;
00155 
00156         /**
00157          * {@inheritDoc}
00158          */
00159         virtual Object::Holder put(Object::View vKey, Object::Holder ohValue,
00160                 int64_t cMillis);
00161 
00162     // ----- NamedCache interface -------------------------------------------
00163 
00164     public:
00165         /**
00166          * {@inheritDoc}
00167          */
00168         virtual void release();
00169 
00170         /**
00171          * {@inheritDoc}
00172          */
00173         virtual void destroy();
00174 
00175         /**
00176          * {@inheritDoc}
00177          */
00178         virtual String::View getCacheName() const;
00179 
00180         /**
00181          * {@inheritDoc}
00182          */
00183         virtual bool isActive() const;
00184 
00185         /**
00186          * {@inheritDoc}
00187          */
00188         virtual NamedCache::CacheServiceHandle getCacheService();
00189 
00190         /**
00191          * {@inheritDoc}
00192          */
00193         virtual NamedCache::CacheServiceView getCacheService() const;
00194 
00195     // ----- ConcurrentMap interface ----------------------------------------
00196 
00197     public:
00198         /**
00199          * {@inheritDoc}
00200          */
00201         virtual bool lock(Object::View vKey, int64_t cWait) const;
00202 
00203         /**
00204          * {@inheritDoc}
00205          */
00206         virtual bool lock(Object::View vKey) const;
00207 
00208         /**
00209          * {@inheritDoc}
00210          */
00211         virtual bool unlock(Object::View vKey) const;
00212 
00213     // ----- InvocableMap interface -----------------------------------------
00214 
00215     public:
00216         /**
00217          * {@inheritDoc}
00218          */
00219         virtual Object::Holder invoke(Object::View vKey,
00220                 EntryProcessor::Handle hAgent);
00221 
00222         /**
00223          * {@inheritDoc}
00224          */
00225         virtual Map::View invokeAll(Collection::View vCollKeys,
00226                 EntryProcessor::Handle hAgent);
00227 
00228         /**
00229          * {@inheritDoc}
00230          */
00231         virtual Map::View invokeAll(Filter::View vFilter,
00232                 EntryProcessor::Handle hAgent);
00233 
00234         /**
00235          * {@inheritDoc}
00236          */
00237         virtual Object::Holder aggregate(Collection::View vCollKeys,
00238                 EntryAggregator::Handle hAgent) const;
00239 
00240         /**
00241          * {@inheritDoc}
00242          */
00243         virtual Object::Holder aggregate(Filter::View vFilter,
00244                 EntryAggregator::Handle hAgent) const;
00245 
00246     // ----- QueryMap interface ---------------------------------------------
00247 
00248     public:
00249         /**
00250          * {@inheritDoc}
00251          */
00252         virtual Set::View keySet(Filter::View vFilter) const;
00253 
00254         /**
00255          * {@inheritDoc}
00256          */
00257         virtual Set::View entrySet(Filter::View vFilter) const;
00258 
00259         /**
00260          * {@inheritDoc}
00261          */
00262         virtual Set::View entrySet(Filter::View vFilter,
00263                 Comparator::View vComparator) const;
00264 
00265         /**
00266          * {@inheritDoc}
00267          */
00268         virtual void addIndex(ValueExtractor::View vExtractor, bool fOrdered,
00269                 Comparator::View vComparator);
00270 
00271         /**
00272          * {@inheritDoc}
00273          */
00274         virtual void removeIndex(ValueExtractor::View vExtractor);
00275 
00276     // ----- ObservableMap interface ----------------------------------------
00277 
00278     public:
00279         /**
00280          * {@inheritDoc}
00281          */
00282         virtual void addKeyListener(MapListener::Handle hListener,
00283                 Object::View vKey, bool fLite);
00284 
00285         /**
00286          * {@inheritDoc}
00287          */
00288         virtual void removeKeyListener(MapListener::Handle hListener,
00289                 Object::View vKey);
00290 
00291         /**
00292          * {@inheritDoc}
00293          */
00294         virtual void addMapListener(MapListener::Handle hListener);
00295 
00296         /**
00297         * {@inheritDoc}
00298         */
00299         virtual void removeMapListener(MapListener::Handle hListener);
00300         
00301         /**
00302          * {@inheritDoc}
00303          */
00304         virtual void addFilterListener(MapListener::Handle hListener,
00305                 Filter::View vFilter = NULL, bool fLite = false);
00306 
00307         /**
00308          * {@inheritDoc}
00309          */
00310         virtual void removeFilterListener(MapListener::Handle hListener,
00311                 Filter::View vFilter = NULL);
00312 
00313     // ----- Object interface -----------------------------------------------
00314 
00315     public:
00316         /**
00317          * {@inheritDoc}
00318          */
00319         virtual TypedHandle<const String> toString() const;
00320 
00321     // ----- property getters/setters ---------------------------------------
00322 
00323     public:
00324         /**
00325          * Get the actual (wrapped) named cache.
00326          *
00327          * @return the wrapped cache
00328          */
00329         virtual NamedCache::Handle getNamedCache();
00330 
00331         /**
00332          * Get the actual (wrapped) named cache.
00333          *
00334          * @return the wrapped cache
00335          */
00336         virtual NamedCache::View getNamedCache() const;
00337 
00338     // ----- data members ---------------------------------------------------
00339 
00340     protected:
00341         /**
00342          * Actual (wrapped) NamedCache.
00343          */
00344         FinalHandle<NamedCache> f_hNamedCache;
00345 };
00346 
00347 COH_CLOSE_NAMESPACE3
00348 
00349 #endif // COH_WRAPPER_NAMED_CACHE_HPP
Copyright © 2000, 2015, Oracle and/or its affiliates. All rights reserved.