Save This Page
Home » activemq-parent-5.3.1-source-release » org.apache » activemq » kaha » [javadoc | source]
    1   /**
    2    * Licensed to the Apache Software Foundation (ASF) under one or more
    3    * contributor license agreements.  See the NOTICE file distributed with
    4    * this work for additional information regarding copyright ownership.
    5    * The ASF licenses this file to You under the Apache License, Version 2.0
    6    * (the "License"); you may not use this file except in compliance with
    7    * the License.  You may obtain a copy of the License at
    8    *
    9    *      http://www.apache.org/licenses/LICENSE-2.0
   10    *
   11    * Unless required by applicable law or agreed to in writing, software
   12    * distributed under the License is distributed on an "AS IS" BASIS,
   13    * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
   14    * See the License for the specific language governing permissions and
   15    * limitations under the License.
   16    */
   17   package org.apache.activemq.kaha;
   18   
   19   import java.util.Collection;
   20   import java.util.Map;
   21   import java.util.Set;
   22   
   23   /**
   24    * Represents a container of persistent objects in the store Acts as a map, but
   25    * values can be retrieved in insertion order
   26    * 
   27    * @version $Revision: 1.2 $
   28    */
   29   public interface MapContainer<K, V> extends Map<K, V> {
   30   
   31       /**
   32        * The container is created or retrieved in an unloaded state. load
   33        * populates the container will all the indexes used etc and should be
   34        * called before any operations on the container
   35        */
   36       void load();
   37   
   38       /**
   39        * unload indexes from the container
   40        * 
   41        */
   42       void unload();
   43   
   44       /**
   45        * @return true if the indexes are loaded
   46        */
   47       boolean isLoaded();
   48   
   49       /**
   50        * For homogenous containers can set a custom marshaller for loading keys
   51        * The default uses Object serialization
   52        * 
   53        * @param keyMarshaller
   54        */
   55       void setKeyMarshaller(Marshaller<K> keyMarshaller);
   56   
   57       /**
   58        * For homogenous containers can set a custom marshaller for loading values
   59        * The default uses Object serialization
   60        * 
   61        * @param valueMarshaller
   62        * 
   63        */
   64       void setValueMarshaller(Marshaller<V> valueMarshaller);
   65   
   66       /**
   67        * @return the id the MapContainer was create with
   68        */
   69       Object getId();
   70   
   71       /**
   72        * @return the number of values in the container
   73        */
   74       int size();
   75   
   76       /**
   77        * @return true if there are no values stored in the container
   78        */
   79       boolean isEmpty();
   80   
   81       /**
   82        * @param key
   83        * @return true if the container contains the key
   84        */
   85       boolean containsKey(K key);
   86   
   87       /**
   88        * Get the value associated with the key
   89        * 
   90        * @param key
   91        * @return the value associated with the key from the store
   92        */
   93       V get(K key);
   94   
   95       /**
   96        * @param o
   97        * @return true if the MapContainer contains the value o
   98        */
   99       boolean containsValue(K o);
  100   
  101       /**
  102        * Add add entries in the supplied Map
  103        * 
  104        * @param map
  105        */
  106       void putAll(Map<K, V> map);
  107   
  108       /**
  109        * @return a Set of all the keys
  110        */
  111       Set<K> keySet();
  112   
  113       /**
  114        * @return a collection of all the values - the values will be lazily pulled
  115        *         out of the store if iterated etc.
  116        */
  117       Collection<V> values();
  118   
  119       /**
  120        * @return a Set of all the Map.Entry instances - the values will be lazily
  121        *         pulled out of the store if iterated etc.
  122        */
  123       Set<Map.Entry<K, V>> entrySet();
  124   
  125       /**
  126        * Add an entry
  127        * 
  128        * @param key
  129        * @param value
  130        * @return the old value for the key
  131        */
  132       V put(K key, V value);
  133   
  134       /**
  135        * remove an entry associated with the key
  136        * 
  137        * @param key
  138        * @return the old value assocaited with the key or null
  139        */
  140       V remove(K key);
  141   
  142       /**
  143        * empty the container
  144        */
  145       void clear();
  146   
  147       /**
  148        * Add an entry to the Store Map
  149        * 
  150        * @param key
  151        * @param Value
  152        * @return the StoreEntry associated with the entry
  153        */
  154       StoreEntry place(K key, V value);
  155   
  156       /**
  157        * Remove an Entry from ther Map
  158        * 
  159        * @param entry
  160        */
  161       void remove(StoreEntry entry);
  162   
  163       /**
  164        * Get the Key object from it's location
  165        * 
  166        * @param keyLocation
  167        * @return the key for the entry
  168        */
  169       K getKey(StoreEntry keyLocation);
  170   
  171       /**
  172        * Get the value from it's location
  173        * 
  174        * @param Valuelocation
  175        * @return the Object
  176        */
  177       V getValue(StoreEntry valueLocation);
  178   
  179       /**
  180        * Get the StoreEntry for the first value in the Map
  181        * 
  182        * @return the first StoreEntry or null if the map is empty
  183        */
  184       StoreEntry getFirst();
  185   
  186       /**
  187        * Get the StoreEntry for the last value item of the Map
  188        * 
  189        * @return the last StoreEntry or null if the list is empty
  190        */
  191       StoreEntry getLast();
  192   
  193       /**
  194        * Get the next StoreEntry value from the map
  195        * 
  196        * @param entry
  197        * @return the next StoreEntry or null
  198        */
  199       StoreEntry getNext(StoreEntry entry);
  200   
  201       /**
  202        * Get the previous StoreEntry from the map
  203        * 
  204        * @param entry
  205        * @return the previous store entry or null
  206        */
  207       StoreEntry getPrevious(StoreEntry entry);
  208   
  209       /**
  210        * It's possible that a StoreEntry could be come stale this will return an
  211        * upto date entry for the StoreEntry position
  212        * 
  213        * @param entry old entry
  214        * @return a refreshed StoreEntry
  215        */
  216       StoreEntry refresh(StoreEntry entry);
  217   
  218       /**
  219        * Get the StoreEntry associated with the key
  220        * 
  221        * @param key
  222        * @return the StoreEntry
  223        */
  224       StoreEntry getEntry(K key);
  225       
  226       /**
  227        * Set the index bin size
  228        * @param size
  229        */
  230       void setIndexBinSize(int size);
  231       
  232       /**
  233        * @return index bin size
  234        */
  235       int getIndexBinSize();
  236       
  237       
  238       /**
  239        * Add the index key size
  240        * @param size
  241        */
  242       void setIndexKeySize(int size);
  243       
  244       
  245       /**
  246        * @return the index key size
  247        */
  248       int getIndexKeySize();
  249       
  250      
  251       /**
  252        * Set the index page size
  253        * @param size
  254        */
  255       void setIndexPageSize(int size);
  256       
  257       /**
  258        * @return the index page size
  259        */
  260       int getIndexPageSize();
  261       
  262       /**
  263        * set the meximum bin size
  264        */
  265       void setIndexMaxBinSize(int size);
  266       
  267       /**
  268        * @return the maximum bin size
  269        * @return
  270        */
  271       int getIndexMaxBinSize();
  272       
  273       /**
  274        * @return the loadFactor
  275        */
  276       public int getIndexLoadFactor();
  277       /**
  278        * @param loadFactor the loadFactor to set
  279        */
  280       public void setIndexLoadFactor(int loadFactor);
  281       
  282       /**
  283        * @return the Index MBean
  284        */
  285       IndexMBean getIndexMBean();
  286   
  287       /**
  288        * Clean up all state associated with this container.
  289        */
  290       void delete();
  291   }

Save This Page
Home » activemq-parent-5.3.1-source-release » org.apache » activemq » kaha » [javadoc | source]