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