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

E90870-01

coherence/util/ConverterCollections.hpp

00001 /*
00002 * ConverterCollections.hpp
00003 *
00004 * Copyright (c) 2000, 2019, 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_CONVERTER_COLLECTIONS_HPP
00017 #define COH_CONVERTER_COLLECTIONS_HPP
00018 
00019 #include "coherence/lang.ns"
00020 
00021 
00022 #include "coherence/net/cache/CacheEvent.hpp"
00023 #include "coherence/net/cache/CacheMap.hpp"
00024 #include "coherence/net/CacheService.hpp"
00025 #include "coherence/net/NamedCache.hpp"
00026 #include "coherence/util/Collection.hpp"
00027 #include "coherence/util/ConcurrentMap.hpp"
00028 #include "coherence/util/Converter.hpp"
00029 #include "coherence/util/Filter.hpp"
00030 #include "coherence/util/InvocableMap.hpp"
00031 #include "coherence/util/Iterator.hpp"
00032 #include "coherence/util/MapEvent.hpp"
00033 #include "coherence/util/ObservableMap.hpp"
00034 #include "coherence/util/Set.hpp"
00035 #include "coherence/util/WrapperCollections.hpp"
00036 
00037 COH_OPEN_NAMESPACE2(coherence,util)
00038 
00039 using coherence::net::cache::CacheEvent;
00040 using coherence::net::cache::CacheMap;
00041 using coherence::net::CacheService;
00042 using coherence::net::NamedCache;
00043 
00044 /**
00045 * A collection of Collection implementation classes that use the Converter
00046 * interface to convert the items stored in underlying Collection objects.
00047 *
00048 * @author mf  2007.07.05
00049 */
00050 class COH_EXPORT ConverterCollections
00051     {
00052     // ----- ConverterCollections interface ---------------------------------
00053     public:
00054         /**
00055         * Return a new lang#ObjectArray whose contents are the converted
00056         * contents of the supplied array.
00057         *
00058         * @param hArray  the supplied array
00059         * @param vConvUp the converter to use
00060         *
00061         * @return a handle to the converted array
00062         */
00063         static ObjectArray::Handle convertArray(ObjectArray::Handle hArray,
00064                                                 Converter::View vConvUp);
00065 
00066         /**
00067         * Return a new lang#ObjectArray whose contents are the converted
00068         * contents of the supplied array.
00069         *
00070         * @param vArray  the supplied array
00071         * @param vConvUp the converter to use
00072         *
00073         * @return a view of the converted array
00074         */
00075         static ObjectArray::View convertArray(ObjectArray::View vArray,
00076                                               Converter::View vConvUp);
00077 
00078 
00079     // ----- inner classes --------------------------------------------------
00080 
00081     public:
00082         /**
00083         * A ConverterIterator views an underlying Iterator through a
00084         * Converter.
00085         */
00086         class COH_EXPORT ConverterIterator
00087             : public cloneable_spec<ConverterIterator,
00088                 extends<WrapperCollections::AbstractWrapperIterator> >
00089             {
00090             friend class factory<ConverterIterator>;
00091 
00092             // ----- constructor ----------------------------------------
00093 
00094             protected:
00095                 /**
00096                 * Create a WrapperCollections#AbstractWrapperIterator which
00097                 * delegates to the specified Iterator.
00098                 *
00099                 * @param hiterDelegate the specified Iterator
00100                 * @param vConvUp       the Converter to view through
00101                 */
00102                 ConverterIterator(Iterator::Handle hiterDelegate,
00103                                   Converter::View vConvUp);
00104 
00105                 /**
00106                 * Copy constructor.
00107                 */
00108                 ConverterIterator(const ConverterIterator& that);
00109 
00110             // ----- Iterator interface ---------------------------------
00111 
00112             public:
00113                 /**
00114                 * {@inheritDoc}
00115                 */
00116                 virtual Object::Holder next();
00117 
00118 
00119             // ----- data members ---------------------------------------
00120 
00121             protected:
00122                 /**
00123                 * The Converter from the underlying container
00124                 */
00125                 FinalView<Converter> f_vConvUp;
00126             };
00127 
00128 
00129         /**
00130         * A ConverterCollection views an underlying Collection through a
00131         * Converter.
00132         */
00133         class COH_EXPORT ConverterCollection
00134             : public cloneable_spec<ConverterCollection,
00135                 extends<WrapperCollections::AbstractWrapperCollection> >
00136             {
00137             friend class factory<ConverterCollection>;
00138 
00139             // ----- constructors ---------------------------------------
00140 
00141             protected:
00142                 /**
00143                 * Create a WrapperCollections#AbstractWrapperCollection which
00144                 * delegates to the specified Collection.
00145                 *
00146                 * @param hcollDelegate the specified collection
00147                 * @param vConvUp       the converter from the underlying
00148                 *                      Collection
00149                 * @param vConvDown     the converter to the underlying
00150                 *                      Collection
00151                 */
00152                 ConverterCollection(Collection::Handle hcollDelegate,
00153                                     Converter::View vConvUp,
00154                                     Converter::View vConvDown);
00155 
00156                 /**
00157                 * Create a WrapperCollections#AbstractWrapperCollection which
00158                 * delegates to the specified Collection.
00159                 *
00160                 * @param vcollDelegate the specified collection
00161                 * @param vConvUp       the converter from the underlying
00162                 *                      Collection
00163                 * @param vConvDown     the converter to the underlying
00164                 *                      Collection
00165                 */
00166                 ConverterCollection(Collection::View vcollDelegate,
00167                                     Converter::View vConvUp,
00168                                     Converter::View vConvDown);
00169 
00170                 /**
00171                 * Copy constructor.
00172                 */
00173                 ConverterCollection(const ConverterCollection& that);
00174 
00175 
00176             // ----- Collection interface -------------------------------
00177 
00178             public:
00179                 /**
00180                 * {@inheritDoc}
00181                 */
00182                 virtual bool contains(Object::View v) const;
00183 
00184                 /**
00185                 * {@inheritDoc}
00186                 */
00187                 virtual Iterator::Handle iterator() const;
00188 
00189                 /**
00190                 * {@inheritDoc}
00191                 */
00192                 virtual Muterator::Handle iterator();
00193 
00194                 /**
00195                 * {@inheritDoc}
00196                 */
00197                 virtual ObjectArray::Handle toArray(
00198                         ObjectArray::Handle hao = NULL) const;
00199 
00200                 /**
00201                 * {@inheritDoc}
00202                 */
00203                 virtual bool add(Object::Holder oh);
00204 
00205                 /**
00206                 * {@inheritDoc}
00207                 */
00208                 virtual bool remove(Object::View v);
00209 
00210                 /**
00211                 * {@inheritDoc}
00212                 */
00213                 virtual bool containsAll(Collection::View vc) const;
00214 
00215                 /**
00216                 * {@inheritDoc}
00217                 */
00218                 virtual bool addAll(Collection::View vc);
00219 
00220                 /**
00221                 * {@inheritDoc}
00222                 */
00223                 virtual bool removeAll(Collection::View vc);
00224 
00225                 /**
00226                 * {@inheritDoc}
00227                 */
00228                 virtual bool retainAll(Collection::View vc);
00229 
00230             // ----- Object interface -----------------------------------
00231 
00232             public:
00233                 /**
00234                 * {@inheritDoc}
00235                 */
00236                 virtual bool equals(Object::View that) const;
00237 
00238                 /**
00239                 * {@inheritDoc}
00240                 */
00241                 virtual size32_t hashCode() const;
00242 
00243                 /**
00244                 * {@inheritDoc}
00245                 */
00246                 virtual TypedHandle<const String> toString() const;
00247 
00248             // ----- data members ---------------------------------------
00249 
00250             protected:
00251                 /**
00252                 * The Converter from the underlying container
00253                 */
00254                 FinalView<Converter> f_vConvUp;
00255 
00256                 /**
00257                 * The Converter to the underlying container
00258                 */
00259                 FinalView<Converter> f_vConvDown;
00260             };
00261 
00262 
00263         /**
00264         * A ConverterSet views an underlying Set through a Converter.
00265         */
00266         class COH_EXPORT ConverterSet
00267             : public cloneable_spec<ConverterSet,
00268                 extends<WrapperCollections::AbstractWrapperSet> >
00269             {
00270             friend class factory<ConverterSet>;
00271 
00272             // ----- constructors ---------------------------------------
00273 
00274             protected:
00275                 /**
00276                 * Create a WrapperCollections#AbstractWrapperSet which
00277                 * delegates to the specified Set.
00278                 *
00279                 * @param hSet      the specified Set
00280                 * @param vConvUp   the Converter from the underlying Set
00281                 * @param vConvDown the Converter to the underlying Set
00282                 */
00283                 ConverterSet(Set::Handle hsetDelegate,
00284                              Converter::View vConvUp,
00285                              Converter::View vConvDown);
00286 
00287                 /**
00288                 * Create a WrapperCollections#AbstractWrapperSet which
00289                 * delegates to the specified Set.
00290                 *
00291                 * @param vSet      the specified Set
00292                 * @param vConvUp   the Converter from the underlying Set
00293                 * @param vConvDown the Converter to the underlying Set
00294                 */
00295                 ConverterSet(Set::View vsetDelegate,
00296                              Converter::View vConvUp,
00297                              Converter::View vConvDown);
00298 
00299                 /**
00300                 * Copy constructor.
00301                 */
00302                 ConverterSet(const ConverterSet& that);
00303 
00304             // ----- Set interface --------------------------------------
00305 
00306             public:
00307 
00308                 /**
00309                 * {@inheritDoc}
00310                 */
00311                 virtual bool contains(Object::View v) const;
00312 
00313                 /**
00314                 * {@inheritDoc}
00315                 */
00316                 virtual Iterator::Handle iterator() const;
00317 
00318                 /**
00319                 * {@inheritDoc}
00320                 */
00321                 virtual Muterator::Handle iterator();
00322 
00323                 /**
00324                 * {@inheritDoc}
00325                 */
00326                 virtual ObjectArray::Handle toArray(
00327                         ObjectArray::Handle hoa = NULL) const;
00328 
00329                 /**
00330                 * {@inheritDoc}
00331                 */
00332                 virtual bool add(Object::Holder oh);
00333 
00334                 /**
00335                 * {@inheritDoc}
00336                 */
00337                 virtual bool remove(Object::View v);
00338 
00339                 /**
00340                 * {@inheritDoc}
00341                 */
00342                 virtual bool containsAll(Collection::View vc) const;
00343 
00344                 /**
00345                 * {@inheritDoc}
00346                 */
00347                 virtual bool addAll(Collection::View vc);
00348 
00349                 /**
00350                 * {@inheritDoc}
00351                 */
00352                 virtual bool removeAll(Collection::View vc);
00353 
00354                 /**
00355                 * {@inheritDoc}
00356                 */
00357                 virtual bool retainAll(Collection::View vc);
00358 
00359             // ----- Object interface -----------------------------------
00360 
00361             public:
00362                 /**
00363                 * {@inheritDoc}
00364                 */
00365                 virtual bool equals(Object::View that) const;
00366 
00367                 /**
00368                 * {@inheritDoc}
00369                 */
00370                 virtual size32_t hashCode() const;
00371 
00372                 /**
00373                 * {@inheritDoc}
00374                 */
00375                 virtual TypedHandle<const String> toString() const;
00376 
00377             // ----- data members ---------------------------------------
00378 
00379             protected:
00380                 /**
00381                 * The Converter from the underlying Set
00382                 */
00383                 FinalView<Converter> f_vConvUp;
00384 
00385                 /**
00386                 * The Converter to the underlying Set
00387                 */
00388                 FinalView<Converter> f_vConvDown;
00389             };
00390 
00391 
00392         /**
00393         * Map::Entry Converter, supporting key and value conversion.
00394         */
00395         class COH_EXPORT EntryConverter
00396             : public class_spec<EntryConverter,
00397                 extends<Object>,
00398                 implements<Converter> >
00399             {
00400             friend class factory<EntryConverter>;
00401 
00402             // ----- constructor ----------------------------------------
00403 
00404             public:
00405                 /**
00406                 * Create a Map entry Converter.
00407                 *
00408                 * @param vConvKey   the key Converter
00409                 * @param vConvVal   the value Converter
00410                 */
00411                 EntryConverter(Converter::View vConvKey,
00412                         Converter::View vConvVal);
00413 
00414                 /**
00415                 * Copy constructor.
00416                 */
00417                 EntryConverter(const EntryConverter& that);
00418 
00419             // ----- Converter interface --------------------------------
00420 
00421             public:
00422                 /**
00423                 * {@inheritDoc}
00424                 */
00425                 virtual Object::Holder convert(Object::Holder oh) const;
00426 
00427             // ----- EntryConverter interface ---------------------------
00428 
00429             public:
00430                 /**
00431                 * @return a view of the key Converter
00432                 */
00433                 virtual Converter::View getKeyConverter() const;
00434 
00435                 /**
00436                 * @return a view of the value Converter
00437                 */
00438                 virtual Converter::View getValueConverter() const;
00439 
00440             // ----- static helper methods ------------------------------
00441 
00442             public:
00443                 /**
00444                 * @param vConvert the EntryConverter
00445                 *
00446                 * @return a view of the vConvert's key Converter
00447                 */
00448                 static Converter::View getKeyConverter
00449                     (EntryConverter::View vConvert);
00450 
00451                 /**
00452                 * @param vConvert the EntryConverter
00453                 *
00454                 * @return a view of the vConvert's value Converter
00455                 */
00456                 static Converter::View getValueConverter
00457                     (EntryConverter::View vConvert);
00458 
00459                 /**
00460                 * Convert the key of the map entry referenced by the
00461                 * supplied handle using the supplied EntryConverter.
00462                 *
00463                 * @param vConvert a view of the EntryConverter to use
00464                 * @param vKey     a view to the key to convert
00465                 *
00466                 * @return a handle to the key, or the unconverted key
00467                 *         if the vConvert is NULL
00468                 */
00469                 static Object::View convertKey
00470                     (EntryConverter::View vConvert, Object::View vKey);
00471 
00472                 /**
00473                 * Convert the value of the map entry referenced by
00474                 * the supplied view using the supplied
00475                 * EntryConverter.
00476                 *
00477                 * @param vConvert  a view of the EntryConverter to
00478                 *                  use
00479                 * @param ohValue   a holder to the value to convert
00480                 *
00481                 * @return a view of the value, or the unconverted
00482                 *         value if the vConvert is NULL
00483                 */
00484                 static Object::Holder convertValue
00485                     (EntryConverter::View vConvert, Object::Holder ohValue);
00486 
00487             // ----- data members ---------------------------------------
00488 
00489             protected:
00490                 /**
00491                 * The key Converter.
00492                 */
00493                 FinalView<Converter> f_vConvKey;
00494 
00495                 /**
00496                 * The value Converter.
00497                 */
00498                 FinalView<Converter> f_vConvVal;
00499             };
00500 
00501 
00502         /**
00503         * A ConverterMap views an underlying Map through a Converter.
00504         */
00505         class COH_EXPORT ConverterMap
00506             : public cloneable_spec<ConverterMap,
00507                 extends<WrapperCollections::AbstractWrapperMap> >
00508             {
00509             friend class factory<ConverterMap>;
00510 
00511             // ----- constructors ---------------------------------------
00512 
00513             protected:
00514                 /**
00515                 * Create a WrapperCollections#AbstractWrapperMap which
00516                 * delegates to the specified Map.
00517                 *
00518                 * @param hMap      the specified Map
00519                 * @param vConvUp   the EntryConverter from the underlying Map
00520                 * @param vConvDown the EntryConverter to the underlying Map
00521                 */
00522                 ConverterMap(Map::Handle hMapDelegate,
00523                              EntryConverter::View vConvUp,
00524                              EntryConverter::View vConvDown);
00525 
00526                 /**
00527                 * Create a WrapperCollections#AbstractWrapperMap which
00528                 * delegates to the specified Map.
00529                 *
00530                 * @param vMap      the specified Map
00531                 * @param vConvUp   the EntryConverter from the underlying Map
00532                 * @param vConvDown the EntryConverter to the underlying Map
00533                 */
00534                 ConverterMap(Map::View vMapDelegate,
00535                              EntryConverter::View vConvUp,
00536                              EntryConverter::View vConvDown);
00537 
00538                 /**
00539                 * Copy constructor.
00540                 */
00541                 ConverterMap(const ConverterMap& that);
00542 
00543             // ----- Map interface --------------------------------------
00544 
00545             public:
00546                 /**
00547                 * {@inheritDoc}
00548                 */
00549                 virtual bool containsKey(Object::View vKey) const;
00550 
00551                 /**
00552                 * {@inheritDoc}
00553                 */
00554                 virtual bool containsValue(Object::View vValue) const;
00555 
00556                 /**
00557                 * {@inheritDoc}
00558                 */
00559                 virtual Object::Holder get(Object::View vKey) const;
00560 
00561                 /**
00562                 * {@inheritDoc}
00563                 */
00564                 using Map::get;
00565 
00566                 /**
00567                 * {@inheritDoc}
00568                 */
00569                 virtual Object::Holder put(Object::View vKey,
00570                                          Object::Holder ohValue);
00571 
00572                 /**
00573                 * {@inheritDoc}
00574                 */
00575                 virtual Object::Holder remove(Object::View vKey);
00576                 using Map::remove;
00577 
00578                 /**
00579                 * {@inheritDoc}
00580                 */
00581                 virtual void putAll(Map::View vMap);
00582 
00583                 /**
00584                 * {@inheritDoc}
00585                 */
00586                 virtual Set::View keySet() const;
00587 
00588                 /**
00589                 * {@inheritDoc}
00590                 */
00591                 virtual Set::Handle keySet();
00592 
00593                 /**
00594                 * {@inheritDoc}
00595                 */
00596                 virtual Collection::View values() const;
00597 
00598                 /**
00599                 * {@inheritDoc}
00600                 */
00601                 virtual Collection::Handle values();
00602 
00603                 /**
00604                 * {@inheritDoc}
00605                 */
00606                 virtual Set::View entrySet() const;
00607 
00608                 /**
00609                 * {@inheritDoc}
00610                 */
00611                 virtual Set::Handle entrySet();
00612 
00613             // ----- Object interface -----------------------------------
00614 
00615             public:
00616                 /**
00617                 * {@inheritDoc}
00618                 */
00619                 virtual bool equals(Object::View that) const;
00620 
00621                 /**
00622                 * {@inheritDoc}
00623                 */
00624                 virtual size32_t hashCode() const;
00625 
00626                 /**
00627                 * {@inheritDoc}
00628                 */
00629                 virtual TypedHandle<const String> toString() const;
00630 
00631             // ----- accessors ------------------------------------------
00632 
00633             public:
00634                 /**
00635                 * Get the up converter, which is used to convert from the
00636                 * underlying entries in the Map.
00637                 *
00638                 * @return the up converter
00639                 */
00640                 virtual EntryConverter::View getUpConverter() const;
00641 
00642                 /**
00643                 * Get the down converter, which is used to convert to the
00644                 * underlying entries in the Map.
00645                 *
00646                 * @return the down converter
00647                 */
00648                 virtual EntryConverter::View getDownConverter() const;
00649 
00650             // ----- data members ---------------------------------------
00651 
00652             protected:
00653                 /**
00654                 * The Converter from the underlying entries in the Map
00655                 */
00656                 FinalView<EntryConverter> f_vConvUp;
00657 
00658                 /**
00659                 * The Converter to the underlying entries in the Map
00660                 */
00661                 FinalView<EntryConverter> f_vConvDown;
00662             };
00663 
00664 
00665         /**
00666         * A ConverterEntry views an underlying Map#Entry through a Converter.
00667         */
00668         class COH_EXPORT ConverterEntry
00669             : public cloneable_spec<ConverterEntry,
00670                 extends<WrapperCollections::AbstractWrapperEntry> >
00671             {
00672             friend class factory<ConverterEntry>;
00673 
00674             // ----- constructors ---------------------------------------
00675 
00676             protected:
00677                 /**
00678                 * Create a WrapperCollections::AbstractWrapperEntry which
00679                 * delegates to the specified Map#Entry.
00680                 *
00681                 * @param hMapEntry  a handle to the specified Map#Entry
00682                 * @param vConvUp    the EntryConverter from the underlying
00683                 *                   Map
00684                 * @param vConvDown  the EntryConverter to the underlying Map
00685                 */
00686                 ConverterEntry(Map::Entry::Handle hMapDelegate,
00687                              EntryConverter::View vConvUp,
00688                              EntryConverter::View vConvDown);
00689 
00690                 /**
00691                 * Create a WrapperCollections::AbstractWrapperEntry which
00692                 * delegates to the specified Map#Entry.
00693                 *
00694                 * @param vMapEntry  a view of the specified Map#Entry
00695                 * @param vConvUp    the EntryConverter from the underlying
00696                 *                   Map
00697                 * @param vConvDown  the EntryConverter to the underlying Map
00698                 */
00699                 ConverterEntry(Map::Entry::View vMapDelegate,
00700                              EntryConverter::View vConvUp,
00701                              EntryConverter::View vConvDown);
00702 
00703                 /**
00704                 * Copy constructor.
00705                 */
00706                 ConverterEntry(const ConverterEntry& that);
00707 
00708 
00709             // ----- Map::Entry interface -------------------------------
00710 
00711             public:
00712                 /**
00713                 * {@inheritDoc}
00714                 */
00715                 virtual Object::View getKey() const;
00716 
00717                 /**
00718                 * {@inheritDoc}
00719                 */
00720                 virtual Object::Holder getValue() const;
00721 
00722                 /**
00723                 * {@inheritDoc}
00724                 */
00725                 using Map::Entry::getValue;
00726 
00727                 /**
00728                 * {@inheritDoc}
00729                 */
00730                 virtual Object::Holder setValue(Object::Holder ohValue);
00731 
00732             // ----- Object interface -----------------------------------
00733 
00734             public:
00735                 /**
00736                 * {@inheritDoc}
00737                 */
00738                 virtual bool equals(Object::View that) const;
00739 
00740                 /**
00741                 * {@inheritDoc}
00742                 */
00743                 virtual size32_t hashCode() const;
00744 
00745 
00746                 /**
00747                 * {@inheritDoc}
00748                 */
00749                 virtual TypedHandle<const String> toString() const;
00750 
00751             // ----- data members ---------------------------------------
00752 
00753             protected:
00754                 /**
00755                 * The Converter from the underlying Entry.
00756                 */
00757                 FinalView<EntryConverter> f_vConvUp;
00758 
00759                 /**
00760                 * The Converter from the underlying Entry.
00761                 */
00762                 FinalView<EntryConverter> f_vConvDown;
00763             };
00764 
00765 
00766         // ----- inner class: ConverterCacheEvent ---------------------------
00767 
00768         /**
00769         * A Converter CacheEvent views an underlying CacheEvent through a set
00770         * of key and value Converters.
00771         */
00772         class COH_EXPORT ConverterCacheEvent
00773             : public class_spec<ConverterCacheEvent,
00774                 extends<CacheEvent> >
00775             {
00776             friend class factory<ConverterCacheEvent>;
00777 
00778             // ----- constructors ---------------------------------------
00779 
00780             protected:
00781                 /**
00782                 * Create a ConverterCacheEvent.
00783                 *
00784                 * @param hMap      the new event's source
00785                 * @param vEvent    the underlying CacheEvent
00786                 * @param vConvKey  the Converter to view the underlying
00787                 *                  CacheEvent's key
00788                 * @param vConvVal  the Converter to view the underlying
00789                 *                  CacheEvent's values
00790                 */
00791                 ConverterCacheEvent(ObservableMap::Handle hMap,
00792                         CacheEvent::View vEvent, Converter::View vConvKey,
00793                         Converter::View vConvVal);
00794 
00795             // ----- MapEvent interface ---------------------------------
00796 
00797             public:
00798                 /**
00799                 * {@inheritDoc}
00800                 */
00801                 virtual Object::View getKey() const;
00802 
00803                 /**
00804                 * {@inheritDoc}
00805                 */
00806                 virtual Object::View getOldValue() const;
00807 
00808                 /**
00809                 * {@inheritDoc}
00810                 */
00811                 virtual Object::View getNewValue() const;
00812 
00813             // ----- accessors ------------------------------------------
00814 
00815             public:
00816                 /**
00817                 * Return the underlying CacheEvent.
00818                 *
00819                 * @return the underlying CacheEvent
00820                 */
00821                 virtual CacheEvent::View getCacheEvent() const;
00822 
00823                 /**
00824                 * Return the Converter used to view the underlying
00825                 * CacheEvent's key through.
00826                 *
00827                 * @return the Converter from the underlying CacheEvent's key
00828                 */
00829                 virtual Converter::View getConverterKeyUp() const;
00830 
00831                 /**
00832                 * Return the Converter used to view the underlying
00833                 * CacheEvent's value through.
00834                 *
00835                 * @return the Converter from the underlying CacheEvent's
00836                 *         value
00837                 */
00838                 virtual Converter::View getConverterValueUp() const;
00839 
00840                 /**
00841                 * Set the cached converted old value associated with this
00842                 * event.
00843                 *
00844                 * @param voValue the new converted "old" value
00845                 */
00846                 virtual void setOldValue(Object::View voValue);
00847 
00848                 /**
00849                 * Set the cached converted new value associated with this
00850                 * event.
00851                 *
00852                 * @param voValue the new converted "new" value
00853                 */
00854                 virtual void setNewValue(Object::View voValue);
00855 
00856             // ----- data members ---------------------------------------
00857 
00858             protected:
00859                 /**
00860                 * The underlying CacheEvent.
00861                 */
00862                 FinalView<CacheEvent> f_vEvent;
00863 
00864                 /**
00865                 * The Converter to view the underlying CacheEvent's key.
00866                 */
00867                 FinalView<Converter> f_vConvKey;
00868 
00869                 /**
00870                 * The Converter to view the underlying CacheEvent's value.
00871                 */
00872                 FinalView<Converter> f_vConvVal;
00873             };
00874 
00875 
00876         // ----- inner class: ConverterMapEvent -----------------------------
00877 
00878         /**
00879         * A Converter MapEvent views an underlying MapEvent through a set of
00880         * key and value Converters.
00881         */
00882         class COH_EXPORT ConverterMapEvent
00883             : public class_spec<ConverterMapEvent,
00884                 extends<MapEvent> >
00885             {
00886             friend class factory<ConverterMapEvent>;
00887 
00888             // ----- constructors ---------------------------------------
00889 
00890             protected:
00891                 /**
00892                 * Create a ConverterMapEvent.
00893                 *
00894                 * @param hMap      the new event's source
00895                 * @param vEvent    the underlying MapEvent
00896                 * @param vConvKey  the Converter to view the underlying
00897                 *                  MapEvent's key
00898                 * @param vConvVal  the Converter to view the underlying
00899                 *                  MapEvent's values
00900                 */
00901                 ConverterMapEvent(ObservableMap::Handle hMap,
00902                         MapEvent::View vEvent, Converter::View vConvKey,
00903                         Converter::View vConvVal);
00904 
00905             // ----- MapEvent interface ---------------------------------
00906 
00907             public:
00908                 /**
00909                 * {@inheritDoc}
00910                 */
00911                 virtual Object::View getKey() const;
00912 
00913                 /**
00914                 * {@inheritDoc}
00915                 */
00916                 virtual Object::View getOldValue() const;
00917 
00918                 /**
00919                 * {@inheritDoc}
00920                 */
00921                 virtual Object::View getNewValue() const;
00922 
00923             // ----- accessors ------------------------------------------
00924 
00925             public:
00926                 /**
00927                 * Return the underlying MapEvent.
00928                 *
00929                 * @return the underlying MapEvent
00930                 */
00931                 virtual MapEvent::View getMapEvent() const;
00932 
00933                 /**
00934                 * Return the Converter used to view the underlying MapEvent's
00935                 * key through.
00936                 *
00937                 * @return the Converter from the underlying MapEvent's key
00938                 */
00939                 virtual Converter::View getConverterKeyUp() const;
00940 
00941                 /**
00942                 * Return the Converter used to view the underlying MapEvent's
00943                 * value through.
00944                 *
00945                 * @return the Converter from the underlying MapEvent's value
00946                 */
00947                 virtual Converter::View getConverterValueUp() const;
00948 
00949                 /**
00950                 * Set the cached converted key associated with this event.
00951                 *
00952                 * @param voKey the converted key value
00953                 */
00954                 virtual void setKey(Object::View voKey);
00955 
00956                 /**
00957                 * Set the cached converted old value associated with this
00958                 * event.
00959                 *
00960                 * @param voValue the new converted "old" value
00961                 */
00962                 virtual void setOldValue(Object::View voValue);
00963 
00964                 /**
00965                 * Set the cached converted new value associated with this
00966                 * event.
00967                 *
00968                 * @param voValue the new converted "new" value
00969                 */
00970                 virtual void setNewValue(Object::View voValue);
00971 
00972                 /**
00973                 * Check if the event's key has been converted.
00974                 *
00975                 * @return true iff the key has been converted
00976                 */
00977                 virtual bool isKeyConverted() const;
00978 
00979                 /**
00980                 * Check if the event's old value has been converted.
00981                 *
00982                 * @return true iff the old value has been converted
00983                 */
00984                 virtual bool isOldValueConverted() const;
00985 
00986                 /**
00987                 * Check if the event's new value has been converted.
00988                 *
00989                 * @return true iff the new value has been converted
00990                 */
00991                 virtual bool isNewValueConverted() const;
00992 
00993             // ----- data members ---------------------------------------
00994 
00995             protected:
00996                 /**
00997                 * The underlying MapEvent.
00998                 */
00999                 FinalView<MapEvent> f_vEvent;
01000 
01001                 /**
01002                 * The Converter to view the underlying MapEvent's key.
01003                 */
01004                 FinalView<Converter> f_vConvKey;
01005 
01006                 /**
01007                 * The Converter to view the underlying MapEvent's value.
01008                 */
01009                 FinalView<Converter> f_vConvVal;
01010             };
01011 
01012 
01013         // ----- inner class: ConverterMapListener --------------------------
01014 
01015         /**
01016         * A converter MapListener that converts events of the underlying
01017         * MapListener for the underlying map.
01018         */
01019         class COH_EXPORT ConverterMapListener
01020             : public class_spec<ConverterMapListener,
01021                 extends<Object>,
01022                 implements<MapListener> >
01023             {
01024             friend class factory<ConverterMapListener>;
01025 
01026             // ----- constructors ---------------------------------------
01027 
01028             protected:
01029                 /**
01030                 * Create a ConverterMapListener that converts events of the
01031                 * underlying MapListener for the underlying map.
01032                 */
01033                 ConverterMapListener(ObservableMap::Handle hMap,
01034                         MapListener::Handle hListener, Converter::View vConvKey,
01035                         Converter::View vConvVal);
01036 
01037             // ----- MapListener interface ------------------------------
01038 
01039             public:
01040                 /**
01041                 * {@inheritDoc}
01042                 */
01043                 virtual void entryInserted(MapEvent::View vEvent);
01044 
01045                 /**
01046                 * {@inheritDoc}
01047                 */
01048                 virtual void entryUpdated(MapEvent::View vEvent);
01049 
01050                 /**
01051                 * {@inheritDoc}
01052                 */
01053                 virtual void entryDeleted(MapEvent::View vEvent);
01054 
01055             // ----- Object interface -----------------------------------
01056 
01057             public:
01058                 /**
01059                 * {@inheritDoc}
01060                 */
01061                 virtual bool equals(Object::View v) const;
01062 
01063                 /**
01064                 * {@inheritDoc}
01065                 */
01066                 virtual size32_t hashCode() const;
01067 
01068             // ----- accessors ------------------------------------------
01069 
01070             public:
01071                 /**
01072                 * Get the underlying ObservableMap.
01073                 *
01074                 * @return the underlying map
01075                 */
01076                 virtual ObservableMap::Handle getObservableMap();
01077 
01078                 /**
01079                 * Get the underlying ObservableMap.
01080                 *
01081                 * @return the underlying map
01082                 */
01083                 virtual ObservableMap::View getObservableMap() const;
01084 
01085                 /**
01086                 * Get the underling MapListener.
01087                 *
01088                 * @return the underlying listener
01089                 */
01090                 virtual MapListener::Handle getMapListener();
01091 
01092                 /**
01093                 * Get the underling MapListener.
01094                 *
01095                 * @return the underlying listener
01096                 */
01097                 virtual MapListener::View getMapListener() const;
01098 
01099                 /**
01100                 * Get the Converter used to view an underlying CacheEvent's
01101                 * key through.
01102                 *
01103                 * @return the Converter used to view an underlying
01104                 *         CacheEvent's key
01105                 */
01106                 virtual Converter::View getConverterKeyUp() const;
01107 
01108                 /**
01109                 * Get the Converter used to view an underlying CacheEvent's
01110                 * value through.
01111                 *
01112                 * @return the Converter used to view an underlying
01113                 *         CacheEvent's value
01114                 */
01115                 virtual Converter::View getConverterValueUp() const;
01116 
01117             // ----- data members -------------------------------------------
01118 
01119             protected:
01120                 /**
01121                 * The converting Map the will be the source of converted
01122                 * events.
01123                 */
01124                 FinalHandle<ObservableMap> f_hMap;
01125 
01126                 /**
01127                 * The underlying MapListener.
01128                 */
01129                 FinalHandle<MapListener> f_hListener;
01130 
01131                 /**
01132                 * The Converter to view an underlying CacheEvent's key.
01133                 */
01134                 FinalView<Converter> f_vConvKey;
01135 
01136                 /**
01137                 * The Converter to view an underlying CacheEvent's value.
01138                 */
01139                 FinalView<Converter> f_vConvVal;
01140             };
01141 
01142 
01143         // ----- inner class: ConverterObservableMap ------------------------
01144 
01145         /**
01146         * A Converter ObservableMap views an underlying ObservableMap through
01147         * a set of key and value Converters.
01148         */
01149         class COH_EXPORT ConverterObservableMap
01150             : public class_spec<ConverterObservableMap,
01151                 extends<ConverterMap>,
01152                 implements<ObservableMap> >
01153             {
01154             friend class factory<ConverterObservableMap>;
01155 
01156             // ----- constructors ---------------------------------------
01157 
01158             protected:
01159                 /**
01160                 * Create a ConverterObservableMap which delegates to the
01161                 * specified ObservableMap.
01162                 *
01163                 * @param hMap      underlying ObservableMap
01164                 * @param vConvUp   EntryConverter from the underlying Map
01165                 * @param vConvDown EntryConverter to the underlying Map
01166                 */
01167                 ConverterObservableMap(ObservableMap::Handle hMap,
01168                         EntryConverter::View vConvUp,
01169                         EntryConverter::View vConvDown);
01170 
01171                 /**
01172                 * Create a ConverterObservableMap which delegates to the
01173                 * specified ObservableMap.
01174                 *
01175                 * @param vMap      underlying ObservableMap
01176                 * @param vConvUp   EntryConverter from the underlying Map
01177                 * @param vConvDown EntryConverter to the underlying Map
01178                 */
01179                 ConverterObservableMap(ObservableMap::View vMap,
01180                         EntryConverter::View vConvUp,
01181                         EntryConverter::View vConvDown);
01182 
01183             // ----- ObservableMap interface ----------------------------
01184 
01185             public:
01186                 /**
01187                 * {@inheritDoc}
01188                 */
01189                 virtual void addKeyListener(MapListener::Handle hListener,
01190                         Object::View vKey, bool fLite);
01191 
01192                 /**
01193                 * {@inheritDoc}
01194                 */
01195                 virtual void removeKeyListener(MapListener::Handle hListener,
01196                         Object::View vKey);
01197 
01198                 /**
01199                 * {@inheritDoc}
01200                 */
01201                 virtual void addMapListener(MapListener::Handle hListener);
01202 
01203                 /**
01204                 * {@inheritDoc}
01205                 */
01206                 virtual void removeMapListener(MapListener::Handle hListener);
01207         
01208                 /**
01209                 * {@inheritDoc}
01210                 */
01211                 virtual void addFilterListener(MapListener::Handle hListener,
01212                         Filter::View vFilter, bool fLite);
01213 
01214                 /**
01215                 * {@inheritDoc}
01216                 */
01217                 virtual void removeFilterListener(
01218                         MapListener::Handle hListener, Filter::View vFilter);
01219 
01220             // ----- helper methods -------------------------------------
01221 
01222             protected:
01223                 /**
01224                 * Create a converter listener for the specified listener.
01225                 *
01226                 * @param hListener  the underlying listener
01227                 *
01228                 * @return the converting listener
01229                 */
01230                 virtual MapListener::Handle getConverterListener(
01231                         MapListener::Handle hListener);
01232 
01233             // ----- accessors ------------------------------------------
01234 
01235             public:
01236                 /**
01237                 * Return the underlying ObservableMap.
01238                 *
01239                 * @return the underlying ObservableMap
01240                 */
01241                 virtual ObservableMap::Handle getObservableMap();
01242 
01243                 /**
01244                 * Return the underlying ObservableMap.
01245                 *
01246                 * @return the underlying ObservableMap
01247                 */
01248                 virtual ObservableMap::View getObservableMap() const;
01249             };
01250 
01251 
01252         // ----- inner class: ConverterCacheMap -----------------------------
01253 
01254         /**
01255         * A ConverterCacheMap views an underlying CacheMap through a set
01256         * of key and value Converters.
01257         */
01258         class COH_EXPORT ConverterCacheMap
01259             : public class_spec<ConverterCacheMap,
01260                 extends<ConverterObservableMap>,
01261                 implements<CacheMap> >
01262             {
01263             friend class factory<ConverterCacheMap>;
01264 
01265             // ----- constructors ---------------------------------------
01266 
01267             protected:
01268                 /**
01269                 * Create a ConverterCacheMap which delegates to the specified
01270                 * CacheMap.
01271                 *
01272                 * @param hMap      the specified CacheMap
01273                 * @param vConvUp   the EntryConverter from the underlying
01274                 *                  Map
01275                 * @param vConvDown the EntryConverter to the underlying
01276                 *                  Map
01277                 */
01278                 ConverterCacheMap(CacheMap::Handle hMapDelegate,
01279                              EntryConverter::View vConvUp,
01280                              EntryConverter::View vConvDown);
01281 
01282                 /**
01283                 * Create a ConverterCacheMap which delegates to the specified
01284                 * CacheMap.
01285                 *
01286                 * @param vMap      the specified CacheMap
01287                 * @param vConvUp   the EntryConverter from the underlying
01288                 *                  Map
01289                 * @param vConvDown the EntryConverter to the underlying
01290                 *                  Map
01291                 */
01292                 ConverterCacheMap(CacheMap::View vMapDelegate,
01293                              EntryConverter::View vConvUp,
01294                              EntryConverter::View vConvDown);
01295 
01296             // ----- CacheMap interface -----------------------------
01297 
01298             public:
01299                 /**
01300                 * {@inheritDoc}
01301                 */
01302                 virtual Map::View getAll(Collection::View vKeys) const;
01303 
01304                 /**
01305                 * {@inheritDoc}
01306                 */
01307                 using ConverterMap::put;
01308 
01309                 /**
01310                 * {@inheritDoc}
01311                 */
01312                 virtual Object::Holder put(Object::View vKey,
01313                         Object::Holder ohValue, int64_t cMillis);
01314 
01315             // ----- Map interface ----------------------------------
01316 
01317             public:
01318                 /**
01319                 * {@inheritDoc}
01320                 */
01321                virtual void putAll(Map::View vMap);
01322 
01323 
01324             // ----- accessors --------------------------------------
01325 
01326             public:
01327                 /**
01328                 * Return the underlying CacheMap.
01329                 *
01330                 * @return the underlying CacheMap
01331                 */
01332                 virtual CacheMap::View getCacheMap() const;
01333 
01334                 /**
01335                 * Return the underlying CacheMap.
01336                 *
01337                 * @return the underlying CacheMap
01338                 */
01339                 virtual CacheMap::Handle getCacheMap();
01340             };
01341 
01342         /**
01343         * A Converter ConverterConcurrentMap views an underlying
01344         * ConcurrentMap through a set of key and value Converters.
01345         */
01346         class COH_EXPORT ConverterConcurrentMap
01347             : public class_spec<ConverterConcurrentMap,
01348                 extends<ConverterMap>,
01349                 implements<ConcurrentMap> >
01350             {
01351             friend class factory<ConverterConcurrentMap>;
01352 
01353             // ----- constructors ---------------------------------------
01354 
01355             protected:
01356                 /**
01357                 * Create a ConverterConcurrentMap which delegates to the
01358                 * specified ConcurrentMap.
01359                 *
01360                 * @param hMap      the specified ConcurrentMap
01361                 * @param vConvUp   the EntryConverter from the underlying
01362                 *                  Map
01363                 * @param vConvDown the EntryConverter to the underlying
01364                 *                  Map
01365                 */
01366                 ConverterConcurrentMap(ConcurrentMap::Handle hMapDelegate,
01367                              EntryConverter::View vConvUp,
01368                              EntryConverter::View vConvDown);
01369 
01370                 /**
01371                 * Create a ConverterConcurrentMap which delegates to the
01372                 * specified ConcurrentMap.
01373                 *
01374                 * @param vMap      the specified ConcurrentMap
01375                 * @param vConvUp   the EntryConverter from the underlying
01376                 *                  Map
01377                 * @param vConvDown the EntryConverter to the underlying
01378                 *                  Map
01379                 */
01380                 ConverterConcurrentMap(ConcurrentMap::View vMapDelegate,
01381                              EntryConverter::View vConvUp,
01382                              EntryConverter::View vConvDown);
01383 
01384             // ----- ConcurrentMap interface ----------------------------
01385 
01386             public:
01387                 /**
01388                 * {@inheritDoc}
01389                 */
01390                 virtual bool lock(Object::View vKey, int64_t cWait) const;
01391 
01392                 /**
01393                 * {@inheritDoc}
01394                 */
01395                 virtual bool lock(Object::View vKey) const;
01396 
01397                 /**
01398                 * {@inheritDoc}
01399                 */
01400                 virtual bool unlock(Object::View vKey) const;
01401 
01402             // ----- accessors ------------------------------------------
01403 
01404             public:
01405                 /**
01406                 * Return the underlying ConcurrentMap.
01407                 *
01408                 * @return the underlying ConcurrentMap
01409                 */
01410                 virtual ConcurrentMap::View getConcurrentMap() const;
01411 
01412                 /**
01413                 * Return the underlying ConcurrentMap.
01414                 *
01415                 * @return the underlying ConcurrentMap
01416                 */
01417                 virtual ConcurrentMap::Handle getConcurrentMap();
01418 
01419             };
01420 
01421         /**
01422         * A ConverterInvocable views an underlying InvocableMap through a set
01423         * of key and value Converters.
01424         */
01425         class COH_EXPORT ConverterInvocableMap
01426             : public class_spec<ConverterInvocableMap,
01427                 extends<ConverterMap>,
01428                 implements<InvocableMap> >
01429             {
01430             friend class factory<ConverterInvocableMap>;
01431 
01432             // ----- constructors ---------------------------------------
01433 
01434             protected:
01435                 /**
01436                 * Create a ConverterInvocableMap which delegates to the s
01437                 * pecified InvocableMap.
01438                 *
01439                 * @param hMap      the specified InvocableMap
01440                 * @param vConvUp   the EntryConverter from the underlying
01441                 *                  Map
01442                 * @param vConvDown the EntryConverter to the underlying
01443                 *                  Map
01444                 */
01445                 ConverterInvocableMap(InvocableMap::Handle hMapDelegate,
01446                              EntryConverter::View vConvUp,
01447                              EntryConverter::View vConvDown);
01448 
01449                 /**
01450                 * Create a ConverterInvocableMap which delegates to the s
01451                 * pecified InvocableMap.
01452                 *
01453                 * @param vMap      the specified InvocableMap
01454                 * @param vConvUp   the EntryConverter from the underlying
01455                 *                  Map
01456                 * @param vConvDown the EntryConverter to the underlying
01457                 *                  Map
01458                 */
01459                 ConverterInvocableMap(InvocableMap::View vMapDelegate,
01460                              EntryConverter::View vConvUp,
01461                              EntryConverter::View vConvDown);
01462 
01463             // ----- InvocableMap interface -----------------------------
01464 
01465             public:
01466                 /**
01467                 * {@inheritDoc}
01468                 */
01469                 virtual Object::Holder invoke(Object::View vKey,
01470                         InvocableMap::EntryProcessor::Handle hAgent);
01471 
01472                 /**
01473                 * {@inheritDoc}
01474                 */
01475                 virtual Map::View invokeAll(Collection::View vCollKeys,
01476                         InvocableMap::EntryProcessor::Handle hAgent);
01477 
01478                 /**
01479                 * {@inheritDoc}
01480                 */
01481                 virtual Map::View invokeAll(Filter::View vFilter,
01482                         InvocableMap::EntryProcessor::Handle hAgent);
01483 
01484                 /**
01485                 * {@inheritDoc}
01486                 */
01487                 virtual Object::Holder aggregate(Collection::View vCollKeys,
01488                         InvocableMap::EntryAggregator::Handle hAgent) const;
01489 
01490                 /**
01491                 * {@inheritDoc}
01492                 */
01493                 virtual Object::Holder aggregate(Filter::View vFilter,
01494                         InvocableMap::EntryAggregator::Handle hAgent) const;
01495 
01496             // ----- accessors ------------------------------------------
01497 
01498             public:
01499                 /**
01500                 * Return the underlying InvocableMap.
01501                 *
01502                 * @return the underlying InvocableMap
01503                 */
01504                 virtual InvocableMap::View getInvocableMap() const;
01505 
01506                 /**
01507                 * Return the underlying CacheMap.
01508                 *
01509                 * @return the underlying CacheMap
01510                 */
01511                 virtual InvocableMap::Handle getInvocableMap();
01512             };
01513 
01514 
01515         // ----- inner class: ConverterQueryMap -----------------------------
01516 
01517         /**
01518         * A Converter QueryMap views an underlying QueryMap through a set of
01519         * key and value Converters.
01520         */
01521         class COH_EXPORT ConverterQueryMap
01522             : public class_spec<ConverterQueryMap,
01523                 extends<ConverterMap>,
01524                 implements<QueryMap> >
01525             {
01526             friend class factory<ConverterQueryMap>;
01527 
01528             // ----- constructors -----------------------------------
01529 
01530             protected:
01531                 /**
01532                 * Create a ConverterQueryMap which delegates to the specified
01533                 * QueryMap.
01534                 *
01535                 * @param hMap      the specified InvocableMap
01536                 * @param vConvUp   the EntryConverter from the underlying
01537                 *                  Map
01538                 * @param vConvDown the EntryConverter to the underlying
01539                 *                  Map
01540                 */
01541                 ConverterQueryMap(QueryMap::Handle hMapDelegate,
01542                              EntryConverter::View vConvUp,
01543                              EntryConverter::View vConvDown);
01544 
01545                 /**
01546                 * Create a ConverterQueryMap which delegates to the s
01547                 * pecified QueryMap.
01548                 *
01549                 * @param vMap      the specified InvocableMap
01550                 * @param vConvUp   the EntryConverter from the underlying
01551                 *                  Map
01552                 * @param vConvDown the EntryConverter to the underlying
01553                 *                  Map
01554                 */
01555                 ConverterQueryMap(QueryMap::View vMapDelegate,
01556                              EntryConverter::View vConvUp,
01557                              EntryConverter::View vConvDown);
01558 
01559             // ----- QueryMap interface ---------------------------------
01560 
01561             public:
01562                 /**
01563                 * {@inheritDoc}
01564                 */
01565                 virtual Set::View keySet(Filter::View vFilter) const;
01566 
01567                 /**
01568                 * {@inheritDoc}
01569                 */
01570                 virtual Set::View entrySet(Filter::View vFilter) const;
01571 
01572                 /**
01573                 * {@inheritDoc}
01574                 */
01575                 virtual Set::View entrySet(Filter::View vFilter,
01576                         Comparator::View vComparator) const;
01577 
01578                 /**
01579                 * {@inheritDoc}
01580                 */
01581                 virtual void addIndex(ValueExtractor::View vExtractor,
01582                         bool fOrdered, Comparator::View vComparator);
01583 
01584                 /**
01585                 * {@inheritDoc}
01586                 */
01587                 virtual void removeIndex(ValueExtractor::View vExtractor);
01588 
01589             // ----- Map interface --------------------------------------
01590 
01591             public:
01592                 /**
01593                 * {@inheritDoc}
01594                 */
01595                 using Map::keySet;
01596 
01597                 /**
01598                 * {@inheritDoc}
01599                 */
01600                 using Map::entrySet;
01601 
01602             // ----- accessors ----------------------------------------------
01603 
01604             public:
01605                 /**
01606                 * Return the underlying InvocableMap.
01607                 *
01608                 * @return the underlying InvocableMap
01609                 */
01610                 virtual QueryMap::View getQueryMap() const;
01611 
01612                 /**
01613                 * Return the underlying CacheMap.
01614                 *
01615                 * @return the underlying CacheMap
01616                 */
01617                 virtual QueryMap::Handle getQueryMap();
01618             };
01619 
01620 
01621         /**
01622         * A ConverterNamedCache views an underlying NamedCache through a set
01623         * of key and value Converters.
01624         */
01625         class COH_EXPORT ConverterNamedCache
01626             : public class_spec<ConverterNamedCache,
01627                 extends<ConverterCacheMap>,
01628                 implements<NamedCache> >
01629             {
01630             friend class factory<ConverterNamedCache>;
01631 
01632             // ----- constructors -----------------------------------
01633 
01634             protected:
01635                 /**
01636                 * Create a ConverterQueryMap which delegates to the s
01637                 * pecified QueryMap.
01638                 *
01639                 * @param hMap      the specified InvocableMap
01640                 * @param vConvUp   the EntryConverter from the underlying
01641                 *                  Map
01642                 * @param vConvDown the EntryConverter to the underlying
01643                 *                  Map
01644                 */
01645                 ConverterNamedCache(NamedCache::Handle hMapDelegate,
01646                              EntryConverter::View vConvUp,
01647                              EntryConverter::View vConvDown);
01648 
01649                 /**
01650                 * Create a ConverterQueryMap which delegates to the s
01651                 * pecified QueryMap.
01652                 *
01653                 * @param vMap      the specified InvocableMap
01654                 * @param vConvUp   the EntryConverter from the underlying
01655                 *                  Map
01656                 * @param vConvDown the EntryConverter to the underlying
01657                 *                  Map
01658                 */
01659                 ConverterNamedCache(NamedCache::View vMapDelegate,
01660                              EntryConverter::View vConvUp,
01661                              EntryConverter::View vConvDown);
01662 
01663             // ----- NamedCache interface -------------------------------
01664 
01665             public:
01666                 /**
01667                 * Return the cache name.
01668                 *
01669                 * @return the cache name
01670                 */
01671                 virtual String::View getCacheName() const;
01672 
01673                 /**
01674                 * Return the CacheService that this NamedCache is a part of.
01675                 *
01676                 * @return the CacheService
01677                 */
01678                 virtual CacheService::Handle getCacheService();
01679 
01680                 /**
01681                 * Return the CacheService that this NamedCache is a part of.
01682                 *
01683                 * @return the CacheService
01684                 */
01685                 virtual CacheService::View getCacheService() const;
01686 
01687                 /**
01688                 * Specifies whether or not the NamedCache is active.
01689                 *
01690                 * @return true if the NamedCache is active; false otherwise
01691                 */
01692                 virtual bool isActive() const;
01693 
01694                 /**
01695                 * Release local resources associated with this instance of
01696                 * NamedCache.
01697                 *
01698                 * Releasing a cache makes it no longer usable, but does not
01699                 * affect the cache itself. In other words, all other
01700                 * references to the cache will still be valid, and the cache
01701                 * data is not affected by releasing the reference. Any
01702                 * attempt to use this reference afterword will result in an
01703                 * exception.
01704                 *
01705                 * @see CacheService#releaseCache
01706                 */
01707                 virtual void release();
01708 
01709                 /**
01710                 * Release and destroy this instance of NamedCache.
01711                 *
01712                 * <b>Warning:</b> This method is used to completely destroy
01713                 * the specified cache across the cluster. All references in
01714                 * the entire cluster to this cache will be invalidated, the
01715                 * cached data will be cleared, and all resources will be
01716                 * released.
01717                 *
01718                 * @see CacheService#destroyCache
01719                 */
01720                 virtual void destroy();
01721 
01722             // ----- ConcurrentMap interface ----------------------------
01723 
01724             public:
01725                 /**
01726                 * {@inheritDoc}
01727                 */
01728                 virtual bool lock(Object::View vKey, int64_t cWait) const;
01729 
01730                 /**
01731                 * {@inheritDoc}
01732                 */
01733                 virtual bool lock(Object::View vKey) const;
01734 
01735                 /**
01736                 * {@inheritDoc}
01737                 */
01738                 virtual bool unlock(Object::View vKey) const;
01739 
01740             // ----- InvocableMap interface -----------------------------
01741 
01742             public:
01743                 /**
01744                 * {@inheritDoc}
01745                 */
01746                 virtual Object::Holder invoke(Object::View vKey,
01747                         InvocableMap::EntryProcessor::Handle hAgent);
01748 
01749                 /**
01750                 * {@inheritDoc}
01751                 */
01752                 virtual Map::View invokeAll(Collection::View vCollKeys,
01753                         InvocableMap::EntryProcessor::Handle hAgent);
01754 
01755                 /**
01756                 * {@inheritDoc}
01757                 */
01758                 virtual Map::View invokeAll(Filter::View vFilter,
01759                         InvocableMap::EntryProcessor::Handle hAgent);
01760 
01761                 /**
01762                 * {@inheritDoc}
01763                 */
01764                 virtual Object::Holder aggregate(Collection::View vCollKeys,
01765                         InvocableMap::EntryAggregator::Handle hAgent) const;
01766 
01767                 /**
01768                 * {@inheritDoc}
01769                 */
01770                 virtual Object::Holder aggregate(Filter::View vFilter,
01771                         InvocableMap::EntryAggregator::Handle hAgent) const;
01772 
01773             // ----- QueryMap interface ---------------------------------
01774 
01775             public:
01776                 /**
01777                 * {@inheritDoc}
01778                 */
01779                 virtual Set::View keySet(Filter::View vFilter) const;
01780 
01781                 /**
01782                 * {@inheritDoc}
01783                 */
01784                 virtual Set::View entrySet(Filter::View vFilter) const;
01785 
01786                 /**
01787                 * {@inheritDoc}
01788                 */
01789                 virtual Set::View entrySet(Filter::View vFilter,
01790                         Comparator::View vComparator) const;
01791 
01792                 /**
01793                 * {@inheritDoc}
01794                 */
01795                 virtual void addIndex(ValueExtractor::View vExtractor,
01796                         bool fOrdered, Comparator::View vComparator);
01797 
01798                 /**
01799                 * {@inheritDoc}
01800                 */
01801                 virtual void removeIndex(ValueExtractor::View vExtractor);
01802 
01803             // ----- Map interface --------------------------------------
01804 
01805             public:
01806                 /**
01807                 * {@inheritDoc}
01808                 */
01809                 using Map::keySet;
01810 
01811                 /**
01812                 * {@inheritDoc}
01813                 */
01814                 using Map::entrySet;
01815 
01816             // ----- accessors ------------------------------------------
01817 
01818             public:
01819                 /**
01820                 * Return the underlying InvocableMap.
01821                 *
01822                 * @return the underlying InvocableMap
01823                 */
01824                 virtual NamedCache::View getNamedCache() const;
01825 
01826                 /**
01827                 * Return the underlying CacheMap.
01828                 *
01829                 * @return the underlying CacheMap
01830                 */
01831                 virtual NamedCache::Handle getNamedCache();
01832 
01833                 /**
01834                 * Return the underlying ConcurrentMap.
01835                 *
01836                 * @return the underlying ConcurrentMap
01837                 */
01838                 virtual ConcurrentMap::View getConcurrentMap() const;
01839 
01840                 /**
01841                 * Return the underlying ConcurrentMap.
01842                 *
01843                 * @return the underlying ConcurrentMap
01844                 */
01845                 virtual ConcurrentMap::Handle getConcurrentMap();
01846 
01847                 /**
01848                 * Return the underlying InvocableMap.
01849                 *
01850                 * @return the underlying InvocableMap
01851                 */
01852                 virtual InvocableMap::View getInvocableMap() const;
01853 
01854                 /**
01855                 * Return the underlying InvocableMap.
01856                 *
01857                 * @return the underlying InvocableMap
01858                 */
01859                 virtual InvocableMap::Handle getInvocableMap();
01860 
01861                 /**
01862                 * Return the underlying QueryMap.
01863                 *
01864                 * @return the underlying QueryMap
01865                 */
01866                 virtual QueryMap::View getQueryMap() const;
01867 
01868                 /**
01869                 * Return the underlying QueryMap.
01870                 *
01871                 * @return the underlying QueryMap
01872                 */
01873                 virtual QueryMap::Handle getQueryMap();
01874 
01875             // ---- data members ----------------------------------------
01876 
01877             protected:
01878                 /**
01879                 * A Converter ConcurrentMap around the underlying NamedCache.
01880                 */
01881                 FinalHolder<ConverterConcurrentMap> f_ohMapConcurrent;
01882 
01883                 /**
01884                 * A Converter InvocableMap around the underlying NamedCache.
01885                 */
01886                 FinalHolder<ConverterInvocableMap> f_ohMapInvocable;
01887 
01888                 /**
01889                 * A Converter QueryMap around the underlying NamedCache.
01890                 */
01891                 FinalHolder<ConverterQueryMap> f_ohMapQuery;
01892             };
01893 
01894 
01895         // ----- inner class: UnsupportedConverter --------------------------
01896 
01897         /**
01898         * Converter which always throws an UnsupportedOperationException.
01899         */
01900         class COH_EXPORT UnsupportedConverter
01901             : public class_spec<UnsupportedConverter,
01902                 extends<Object>,
01903                 implements<Converter> >
01904             {
01905             friend class factory<UnsupportedConverter>;
01906 
01907             // ----- constructor ----------------------------------------
01908 
01909             public:
01910                 /**
01911                 * Create an UnsupportedConverter
01912                 *
01913                 * return a handle to the new UnsupportedConverter
01914                 */
01915                 UnsupportedConverter();
01916 
01917             // ----- Converter interface --------------------------------
01918 
01919             public:
01920                 /**
01921                 * {@inheritDoc}
01922                 *
01923                 * @throws UnsupportedOperationException always
01924                 */
01925                 virtual Object::Holder convert(Object::Holder oh) const;
01926 
01927                 /**
01928                 * Return a singleton instance of the UnsupportedConverter.
01929                 */
01930                 static UnsupportedConverter::View getInstance();
01931             };
01932     };
01933 
01934 COH_CLOSE_NAMESPACE2
01935 
01936 #endif // COH_CONVERTER_COLLECTIONS_HPP
Copyright © 2000, 2019, Oracle and/or its affiliates. All rights reserved.