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

E26041-01

coherence/net/cache/WrapperNamedCache.hpp

00001 /*
00002 * WrapperNamedCache.hpp
00003 *
00004 * Copyright (c) 2000, 2013, 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 
00107         /**
00108          * {@inheritDoc}
00109          */
00110         virtual void putAll(Map::View vMap);
00111 
00112         /**
00113          * {@inheritDoc}
00114          */
00115         virtual void clear();
00116 
00117         /**
00118          * {@inheritDoc}
00119          */
00120         virtual Set::View keySet() const;
00121 
00122         /**
00123          * {@inheritDoc}
00124          */
00125         virtual Set::Handle keySet();
00126 
00127         /**
00128          * {@inheritDoc}
00129          */
00130         virtual Collection::View values() const;
00131 
00132         /**
00133          * {@inheritDoc}
00134          */
00135         virtual Collection::Handle values();
00136 
00137         /**
00138          * {@inheritDoc}
00139          */
00140         virtual Set::View entrySet() const;
00141 
00142         /**
00143          * {@inheritDoc}
00144          */
00145         virtual Set::Handle entrySet();
00146 
00147     // ----- CacheMap interface ---------------------------------------------
00148 
00149     public:
00150         /**
00151          * {@inheritDoc}
00152          */
00153         virtual Map::View getAll(Collection::View vKeys) const;
00154 
00155         /**
00156          * {@inheritDoc}
00157          */
00158         virtual Object::Holder put(Object::View vKey, Object::Holder ohValue,
00159                 int64_t cMillis);
00160 
00161     // ----- NamedCache interface -------------------------------------------
00162 
00163     public:
00164         /**
00165          * {@inheritDoc}
00166          */
00167         virtual void release();
00168 
00169         /**
00170          * {@inheritDoc}
00171          */
00172         virtual void destroy();
00173 
00174         /**
00175          * {@inheritDoc}
00176          */
00177         virtual String::View getCacheName() const;
00178 
00179         /**
00180          * {@inheritDoc}
00181          */
00182         virtual bool isActive() const;
00183 
00184         /**
00185          * {@inheritDoc}
00186          */
00187         virtual NamedCache::CacheServiceHandle getCacheService();
00188 
00189         /**
00190          * {@inheritDoc}
00191          */
00192         virtual NamedCache::CacheServiceView getCacheService() const;
00193 
00194     // ----- ConcurrentMap interface ----------------------------------------
00195 
00196     public:
00197         /**
00198          * {@inheritDoc}
00199          */
00200         virtual bool lock(Object::View vKey, int64_t cWait) const;
00201 
00202         /**
00203          * {@inheritDoc}
00204          */
00205         virtual bool lock(Object::View vKey) const;
00206 
00207         /**
00208          * {@inheritDoc}
00209          */
00210         virtual bool unlock(Object::View vKey) const;
00211 
00212     // ----- InvocableMap interface -----------------------------------------
00213 
00214     public:
00215         /**
00216          * {@inheritDoc}
00217          */
00218         virtual Object::Holder invoke(Object::View vKey,
00219                 EntryProcessor::Handle hAgent);
00220 
00221         /**
00222          * {@inheritDoc}
00223          */
00224         virtual Map::View invokeAll(Collection::View vCollKeys,
00225                 EntryProcessor::Handle hAgent);
00226 
00227         /**
00228          * {@inheritDoc}
00229          */
00230         virtual Map::View invokeAll(Filter::View vFilter,
00231                 EntryProcessor::Handle hAgent);
00232 
00233         /**
00234          * {@inheritDoc}
00235          */
00236         virtual Object::Holder aggregate(Collection::View vCollKeys,
00237                 EntryAggregator::Handle hAgent) const;
00238 
00239         /**
00240          * {@inheritDoc}
00241          */
00242         virtual Object::Holder aggregate(Filter::View vFilter,
00243                 EntryAggregator::Handle hAgent) const;
00244 
00245     // ----- QueryMap interface ---------------------------------------------
00246 
00247     public:
00248         /**
00249          * {@inheritDoc}
00250          */
00251         virtual Set::View keySet(Filter::View vFilter) const;
00252 
00253         /**
00254          * {@inheritDoc}
00255          */
00256         virtual Set::View entrySet(Filter::View vFilter) const;
00257 
00258         /**
00259          * {@inheritDoc}
00260          */
00261         virtual Set::View entrySet(Filter::View vFilter,
00262                 Comparator::View vComparator) const;
00263 
00264         /**
00265          * {@inheritDoc}
00266          */
00267         virtual void addIndex(ValueExtractor::View vExtractor, bool fOrdered,
00268                 Comparator::View vComparator);
00269 
00270         /**
00271          * {@inheritDoc}
00272          */
00273         virtual void removeIndex(ValueExtractor::View vExtractor);
00274 
00275     // ----- ObservableMap interface ----------------------------------------
00276 
00277     public:
00278         /**
00279          * {@inheritDoc}
00280          */
00281         virtual void addKeyListener(MapListener::Handle hListener,
00282                 Object::View vKey, bool fLite);
00283 
00284         /**
00285          * {@inheritDoc}
00286          */
00287         virtual void removeKeyListener(MapListener::Handle hListener,
00288                 Object::View vKey);
00289 
00290         /**
00291          * {@inheritDoc}
00292          */
00293         virtual void addFilterListener(MapListener::Handle hListener,
00294                 Filter::View vFilter = NULL, bool fLite = false);
00295 
00296         /**
00297          * {@inheritDoc}
00298          */
00299         virtual void removeFilterListener(MapListener::Handle hListener,
00300                 Filter::View vFilter = NULL);
00301 
00302     // ----- Object interface -----------------------------------------------
00303 
00304     public:
00305         /**
00306          * {@inheritDoc}
00307          */
00308         virtual void toStream(std::ostream& out) const;
00309 
00310     // ----- property getters/setters ---------------------------------------
00311 
00312     public:
00313         /**
00314          * Get the actual (wrapped) named cache.
00315          *
00316          * @return the wrapped cache
00317          */
00318         virtual NamedCache::Handle getNamedCache();
00319 
00320         /**
00321          * Get the actual (wrapped) named cache.
00322          *
00323          * @return the wrapped cache
00324          */
00325         virtual NamedCache::View getNamedCache() const;
00326 
00327     // ----- data members ---------------------------------------------------
00328 
00329     protected:
00330         /**
00331          * Actual (wrapped) NamedCache.
00332          */
00333         FinalHandle<NamedCache> f_hNamedCache;
00334 };
00335 
00336 COH_CLOSE_NAMESPACE3
00337 
00338 #endif // COH_WRAPPER_NAMED_CACHE_HPP
Copyright © 2000, 2013, Oracle and/or its affiliates. All rights reserved.