00001 
00002 
00003 
00004 
00005 
00006 
00007 
00008 
00009 
00010 
00011 
00012 
00013 
00014 
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 
00042 
00043 
00044 
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     
00054 
00055     protected:
00056 
00057 
00058 
00059 
00060 
00061 
00062         WrapperNamedCache(NamedCache::Handle hCache);
00063 
00064     
00065 
00066     public:
00067 
00068 
00069 
00070         virtual size32_t size() const;
00071 
00072 
00073 
00074 
00075         virtual bool isEmpty() const;
00076 
00077 
00078 
00079 
00080         virtual bool containsKey(Object::View vKey) const;
00081 
00082 
00083 
00084 
00085         virtual bool containsValue(Object::View vValue) const;
00086 
00087 
00088 
00089 
00090         virtual Object::Holder get(Object::View vKey) const;
00091 
00092 
00093 
00094 
00095         virtual Object::Holder get(Object::View vKey);
00096 
00097 
00098 
00099 
00100         virtual Object::Holder put(Object::View vKey, Object::Holder ohValue);
00101 
00102 
00103 
00104 
00105         virtual Object::Holder remove(Object::View vKey);
00106 
00107 
00108 
00109 
00110         virtual void putAll(Map::View vMap);
00111 
00112 
00113 
00114 
00115         virtual void clear();
00116 
00117 
00118 
00119 
00120         virtual Set::View keySet() const;
00121 
00122 
00123 
00124 
00125         virtual Set::Handle keySet();
00126 
00127 
00128 
00129 
00130         virtual Collection::View values() const;
00131 
00132 
00133 
00134 
00135         virtual Collection::Handle values();
00136 
00137 
00138 
00139 
00140         virtual Set::View entrySet() const;
00141 
00142 
00143 
00144 
00145         virtual Set::Handle entrySet();
00146 
00147     
00148 
00149     public:
00150 
00151 
00152 
00153         virtual Map::View getAll(Collection::View vKeys) const;
00154 
00155 
00156 
00157 
00158         virtual Object::Holder put(Object::View vKey, Object::Holder ohValue,
00159                 int64_t cMillis);
00160 
00161     
00162 
00163     public:
00164 
00165 
00166 
00167         virtual void release();
00168 
00169 
00170 
00171 
00172         virtual void destroy();
00173 
00174 
00175 
00176 
00177         virtual String::View getCacheName() const;
00178 
00179 
00180 
00181 
00182         virtual bool isActive() const;
00183 
00184 
00185 
00186 
00187         virtual NamedCache::CacheServiceHandle getCacheService();
00188 
00189 
00190 
00191 
00192         virtual NamedCache::CacheServiceView getCacheService() const;
00193 
00194     
00195 
00196     public:
00197 
00198 
00199 
00200         virtual bool lock(Object::View vKey, int64_t cWait) const;
00201 
00202 
00203 
00204 
00205         virtual bool lock(Object::View vKey) const;
00206 
00207 
00208 
00209 
00210         virtual bool unlock(Object::View vKey) const;
00211 
00212     
00213 
00214     public:
00215 
00216 
00217 
00218         virtual Object::Holder invoke(Object::View vKey,
00219                 EntryProcessor::Handle hAgent);
00220 
00221 
00222 
00223 
00224         virtual Map::View invokeAll(Collection::View vCollKeys,
00225                 EntryProcessor::Handle hAgent);
00226 
00227 
00228 
00229 
00230         virtual Map::View invokeAll(Filter::View vFilter,
00231                 EntryProcessor::Handle hAgent);
00232 
00233 
00234 
00235 
00236         virtual Object::Holder aggregate(Collection::View vCollKeys,
00237                 EntryAggregator::Handle hAgent) const;
00238 
00239 
00240 
00241 
00242         virtual Object::Holder aggregate(Filter::View vFilter,
00243                 EntryAggregator::Handle hAgent) const;
00244 
00245     
00246 
00247     public:
00248 
00249 
00250 
00251         virtual Set::View keySet(Filter::View vFilter) const;
00252 
00253 
00254 
00255 
00256         virtual Set::View entrySet(Filter::View vFilter) const;
00257 
00258 
00259 
00260 
00261         virtual Set::View entrySet(Filter::View vFilter,
00262                 Comparator::View vComparator) const;
00263 
00264 
00265 
00266 
00267         virtual void addIndex(ValueExtractor::View vExtractor, bool fOrdered,
00268                 Comparator::View vComparator);
00269 
00270 
00271 
00272 
00273         virtual void removeIndex(ValueExtractor::View vExtractor);
00274 
00275     
00276 
00277     public:
00278 
00279 
00280 
00281         virtual void addKeyListener(MapListener::Handle hListener,
00282                 Object::View vKey, bool fLite);
00283 
00284 
00285 
00286 
00287         virtual void removeKeyListener(MapListener::Handle hListener,
00288                 Object::View vKey);
00289 
00290 
00291 
00292 
00293         virtual void addFilterListener(MapListener::Handle hListener,
00294                 Filter::View vFilter = NULL, bool fLite = false);
00295 
00296 
00297 
00298 
00299         virtual void removeFilterListener(MapListener::Handle hListener,
00300                 Filter::View vFilter = NULL);
00301 
00302     
00303 
00304     public:
00305 
00306 
00307 
00308         virtual void toStream(std::ostream& out) const;
00309 
00310     
00311 
00312     public:
00313 
00314 
00315 
00316 
00317 
00318         virtual NamedCache::Handle getNamedCache();
00319 
00320 
00321 
00322 
00323 
00324 
00325         virtual NamedCache::View getNamedCache() const;
00326 
00327     
00328 
00329     protected:
00330 
00331 
00332 
00333         FinalHandle<NamedCache> f_hNamedCache;
00334 };
00335 
00336 COH_CLOSE_NAMESPACE3
00337 
00338 #endif // COH_WRAPPER_NAMED_CACHE_HPP