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.List;
   20   import java.util.NoSuchElementException;
   21   
   22   /**
   23    * Represents a container of persistent objects in the store Acts as a map, but
   24    * values can be retrieved in insertion order
   25    * 
   26    * @version $Revision: 1.2 $
   27    */
   28   public interface ListContainer<V> extends List<V> {
   29   
   30       /**
   31        * The container is created or retrieved in an unloaded state. load
   32        * populates the container will all the indexes used etc and should be
   33        * called before any operations on the container
   34        */
   35       void load();
   36   
   37       /**
   38        * unload indexes from the container
   39        * 
   40        */
   41       void unload();
   42   
   43       /**
   44        * @return true if the indexes are loaded
   45        */
   46       boolean isLoaded();
   47   
   48       /**
   49        * For homogenous containers can set a custom marshaller for loading values
   50        * The default uses Object serialization
   51        * 
   52        * @param marshaller
   53        */
   54       void setMarshaller(Marshaller marshaller);
   55   
   56       /**
   57        * @return the id the MapContainer was create with
   58        */
   59       Object getId();
   60   
   61       /**
   62        * @return the number of values in the container
   63        */
   64       int size();
   65   
   66       /**
   67        * Inserts the given element at the beginning of this list.
   68        * 
   69        * @param o the element to be inserted at the beginning of this list.
   70        */
   71       void addFirst(V o);
   72   
   73       /**
   74        * Appends the given element to the end of this list. (Identical in function
   75        * to the <tt>add</tt> method; included only for consistency.)
   76        * 
   77        * @param o the element to be inserted at the end of this list.
   78        */
   79       void addLast(V o);
   80   
   81       /**
   82        * Removes and returns the first element from this list.
   83        * 
   84        * @return the first element from this list.
   85        * @throws NoSuchElementException if this list is empty.
   86        */
   87       V removeFirst();
   88   
   89       /**
   90        * Removes and returns the last element from this list.
   91        * 
   92        * @return the last element from this list.
   93        * @throws NoSuchElementException if this list is empty.
   94        */
   95       V removeLast();
   96   
   97       /**
   98        * remove an objecr from the list without retrieving the old value from the
   99        * store
  100        * 
  101        * @param position
  102        * @return true if successful
  103        */
  104       boolean doRemove(int position);
  105   
  106       /**
  107        * add an Object to the list but get a StoreEntry of its position
  108        * 
  109        * @param object
  110        * @return the entry in the Store
  111        */
  112       StoreEntry placeLast(V object);
  113   
  114       /**
  115        * insert an Object in first position int the list but get a StoreEntry of
  116        * its position
  117        * 
  118        * @param object
  119        * @return the location in the Store
  120        */
  121       StoreEntry placeFirst(V object);
  122   
  123       /**
  124        * Advanced feature = must ensure the object written doesn't overwrite other
  125        * objects in the container
  126        * 
  127        * @param entry
  128        * @param object
  129        */
  130       void update(StoreEntry entry, V object);
  131   
  132       /**
  133        * Retrieve an Object from the Store by its location
  134        * 
  135        * @param entry
  136        * @return the Object at that entry
  137        */
  138       V get(StoreEntry entry);
  139   
  140       /**
  141        * Get the StoreEntry for the first item of the list
  142        * 
  143        * @return the first StoreEntry or null if the list is empty
  144        */
  145       StoreEntry getFirst();
  146   
  147       /**
  148        * Get the StoreEntry for the last item of the list
  149        * 
  150        * @return the last StoreEntry or null if the list is empty
  151        */
  152       StoreEntry getLast();
  153   
  154       /**
  155        * Get the next StoreEntry from the list
  156        * 
  157        * @param entry
  158        * @return the next StoreEntry or null
  159        */
  160       StoreEntry getNext(StoreEntry entry);
  161   
  162       /**
  163        * Get the previous StoreEntry from the list
  164        * 
  165        * @param entry
  166        * @return the previous store entry or null
  167        */
  168       StoreEntry getPrevious(StoreEntry entry);
  169   
  170       /**
  171        * remove the Object at the StoreEntry
  172        * 
  173        * @param entry
  174        * @return true if successful
  175        */
  176       boolean remove(StoreEntry entry);
  177   
  178       /**
  179        * It's possible that a StoreEntry could be come stale this will return an
  180        * upto date entry for the StoreEntry position
  181        * 
  182        * @param entry old entry
  183        * @return a refreshed StoreEntry
  184        */
  185       StoreEntry refresh(StoreEntry entry);
  186   }

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