00001 
00002 
00003 
00004 
00005 
00006 
00007 
00008 
00009 
00010 
00011 
00012 
00013 
00014 
00015 
00016 #ifndef COH_BUNDLING_NAMED_CACHE_HPP
00017 #define COH_BUNDLING_NAMED_CACHE_HPP
00018 
00019 #include "coherence/lang.ns"
00020 
00021 #include "coherence/net/NamedCache.hpp"
00022 #include "coherence/net/cache/AbstractBundler.hpp"
00023 #include "coherence/net/cache/AbstractEntryBundler.hpp"
00024 #include "coherence/net/cache/AbstractKeyBundler.hpp"
00025 #include "coherence/net/cache/WrapperNamedCache.hpp"
00026 #include "coherence/util/Collection.hpp"
00027 #include "coherence/util/Collections.hpp"
00028 #include "coherence/util/Map.hpp"
00029 
00030 COH_OPEN_NAMESPACE3(coherence,net,cache)
00031 
00032 using coherence::net::NamedCache;
00033 using coherence::util::Collection;
00034 using coherence::util::Collections;
00035 using coherence::util::Map;
00036 
00037 
00038 
00039 
00040 
00041 
00042 
00043 
00044 
00045 class COH_EXPORT BundlingNamedCache
00046     : public class_spec<BundlingNamedCache,
00047         extends<WrapperNamedCache> >
00048     {
00049     friend class factory<BundlingNamedCache>;
00050 
00051     
00052 
00053     public:
00054         typedef this_spec::Handle Handle;
00055         typedef this_spec::View   View;
00056         typedef this_spec::Holder Holder;
00057 
00058     
00059 
00060     protected:
00061 
00062 
00063 
00064 
00065 
00066 
00067         BundlingNamedCache(NamedCache::Handle hCache);
00068 
00069     private:
00070 
00071 
00072 
00073         BundlingNamedCache(const BundlingNamedCache&);
00074 
00075     
00076 
00077     public:
00078 
00079 
00080 
00081 
00082 
00083 
00084 
00085 
00086 
00087         virtual AbstractBundler::Handle ensureGetBundler(int32_t cBundleThreshold);
00088 
00089 
00090 
00091 
00092 
00093 
00094 
00095 
00096 
00097 
00098         virtual AbstractBundler::Handle ensurePutBundler(int32_t cBundleThreshold);
00099 
00100 
00101 
00102 
00103 
00104 
00105 
00106 
00107 
00108 
00109         virtual AbstractBundler::Handle ensureRemoveBundler(int32_t cBundleThreshold);
00110 
00111     
00112 
00113     public:
00114 
00115 
00116 
00117 
00118 
00119         virtual AbstractBundler::Handle getGetBundler();
00120 
00121 
00122 
00123 
00124 
00125 
00126         virtual AbstractBundler::Handle getPutBundler();
00127 
00128 
00129 
00130 
00131 
00132 
00133         virtual AbstractBundler::Handle getRemoveBundler();
00134         
00135     
00136 
00137     public:
00138         using WrapperNamedCache::get;
00139         using WrapperNamedCache::getAll;
00140         using WrapperNamedCache::put;
00141 
00142 
00143 
00144 
00145         virtual Object::Holder get(Object::View vKey);
00146 
00147 
00148 
00149 
00150         virtual Map::View getAll(Collection::View vColKeys);
00151 
00152 
00153 
00154 
00155 
00156 
00157         virtual Object::Holder put(Object::View vKey, Object::Holder ohValue);
00158 
00159 
00160 
00161 
00162         virtual void putAll(Map::View vMap);
00163 
00164 
00165 
00166 
00167 
00168 
00169         virtual Object::Holder remove(Object::View vKey);
00170         using Map::remove;
00171 
00172     
00173 
00174 
00175 
00176 
00177         virtual void release();
00178 
00179 
00180 
00181 
00182         virtual void destroy();
00183 
00184     
00185 
00186     public:
00187         class COH_EXPORT GetBundler
00188             : public class_spec<GetBundler,
00189                 extends<AbstractKeyBundler> >
00190             {
00191             friend class factory<GetBundler>;
00192             
00193             
00194 
00195             protected:
00196 
00197 
00198 
00199 
00200                 GetBundler(BundlingNamedCache::Handle hBundlingNamedCache);
00201 
00202             
00203 
00204             protected:
00205 
00206 
00207 
00208 
00209 
00210 
00211 
00212 
00213                 virtual Map::View bundle(Collection::View vColKeys);
00214 
00215 
00216 
00217 
00218 
00219 
00220                 virtual Object::Holder unbundle(Object::View vKey) const;
00221 
00222 
00223 
00224 
00225 
00226 
00227                 virtual Object::Holder unbundle(Object::View vKey);
00228 
00229             
00230 
00231             public:
00232 
00233 
00234 
00235 
00236 
00237                 virtual BundlingNamedCache::Handle getBundlingNamedCache();
00238 
00239 
00240 
00241 
00242 
00243 
00244                 virtual BundlingNamedCache::View getBundlingNamedCache() const;
00245 
00246             
00247 
00248             private:
00249 
00250 
00251 
00252                 FinalHandle<BundlingNamedCache> f_hBundlingNamedCache;
00253             };
00254 
00255         class COH_EXPORT PutBundler
00256             : public class_spec<PutBundler,
00257                 extends<AbstractEntryBundler> >
00258             {
00259             friend class factory<PutBundler>;
00260 
00261             
00262 
00263             protected:
00264 
00265 
00266 
00267 
00268                 PutBundler(BundlingNamedCache::Handle hBundlingNamedCache);
00269 
00270             
00271 
00272             protected:
00273 
00274 
00275 
00276 
00277 
00278                 virtual void bundle(Map::View vMap);
00279 
00280             
00281 
00282             public:
00283 
00284 
00285 
00286 
00287 
00288                 virtual BundlingNamedCache::Handle getBundlingNamedCache();
00289 
00290 
00291 
00292 
00293 
00294 
00295                 virtual BundlingNamedCache::View getBundlingNamedCache() const;
00296 
00297             
00298 
00299             private:
00300 
00301 
00302 
00303                 FinalHandle<BundlingNamedCache> f_hBundlingNamedCache;
00304             };
00305 
00306         class COH_EXPORT RemoveBundler
00307             : public class_spec<RemoveBundler,
00308                 extends<AbstractKeyBundler> >
00309             {
00310             friend class factory<RemoveBundler>;
00311 
00312             
00313 
00314             protected:
00315 
00316 
00317 
00318 
00319                 RemoveBundler(BundlingNamedCache::Handle hBundlingNamedCache);
00320 
00321             
00322 
00323             protected:
00324 
00325 
00326 
00327 
00328 
00329 
00330                 virtual Map::View bundle(Collection::View vColKeys);
00331 
00332 
00333 
00334 
00335 
00336 
00337                 virtual Object::Holder unbundle(Object::View vKey);
00338 
00339             
00340 
00341             public:
00342 
00343 
00344 
00345 
00346 
00347                 virtual BundlingNamedCache::Handle getBundlingNamedCache();
00348 
00349 
00350 
00351 
00352 
00353 
00354                 virtual BundlingNamedCache::View getBundlingNamedCache() const;
00355 
00356             
00357 
00358             private:
00359 
00360 
00361 
00362                 FinalHandle<BundlingNamedCache> f_hBundlingNamedCache;
00363             };
00364 
00365     
00366 
00367     private:
00368 
00369 
00370 
00371         MemberHandle<GetBundler> m_hGetBundler;
00372 
00373 
00374 
00375 
00376         MemberHandle<PutBundler> m_hPutBundler;
00377 
00378 
00379 
00380 
00381         MemberHandle<RemoveBundler> m_hRemoveBundler;
00382     };
00383     
00384 COH_CLOSE_NAMESPACE3
00385 
00386 #endif // COH_BUNDLING_NAMED_CACHE_HPP