org.apache.activemq.kaha
Interface ListContainer<V>

All Superinterfaces:
Collection<V>, Iterable<V>, List<V>
All Known Implementing Classes:
ListContainerImpl

public interface ListContainer<V>
extends List<V>

Represents a container of persistent objects in the store Acts as a map, but values can be retrieved in insertion order


Method Summary
 void addFirst(V o)
          Inserts the given element at the beginning of this list.
 void addLast(V o)
          Appends the given element to the end of this list.
 boolean doRemove(int position)
          remove an objecr from the list without retrieving the old value from the store
 V get(StoreEntry entry)
          Retrieve an Object from the Store by its location
 StoreEntry getFirst()
          Get the StoreEntry for the first item of the list
 Object getId()
           
 StoreEntry getLast()
          Get the StoreEntry for the last item of the list
 StoreEntry getNext(StoreEntry entry)
          Get the next StoreEntry from the list
 StoreEntry getPrevious(StoreEntry entry)
          Get the previous StoreEntry from the list
 boolean isLoaded()
           
 void load()
          The container is created or retrieved in an unloaded state.
 StoreEntry placeFirst(V object)
          insert an Object in first position int the list but get a StoreEntry of its position
 StoreEntry placeLast(V object)
          add an Object to the list but get a StoreEntry of its position
 StoreEntry refresh(StoreEntry entry)
          It's possible that a StoreEntry could be come stale this will return an upto date entry for the StoreEntry position
 boolean remove(StoreEntry entry)
          remove the Object at the StoreEntry
 V removeFirst()
          Removes and returns the first element from this list.
 V removeLast()
          Removes and returns the last element from this list.
 void setMarshaller(Marshaller marshaller)
          For homogenous containers can set a custom marshaller for loading values The default uses Object serialization
 int size()
           
 void unload()
          unload indexes from the container
 void update(StoreEntry entry, V object)
          Advanced feature = must ensure the object written doesn't overwrite other objects in the container
 
Methods inherited from interface java.util.List
add, add, addAll, addAll, clear, contains, containsAll, equals, get, hashCode, indexOf, isEmpty, iterator, lastIndexOf, listIterator, listIterator, remove, remove, removeAll, retainAll, set, subList, toArray, toArray
 

Method Detail

load

void load()
The container is created or retrieved in an unloaded state. load populates the container will all the indexes used etc and should be called before any operations on the container


unload

void unload()
unload indexes from the container


isLoaded

boolean isLoaded()
Returns:
true if the indexes are loaded

setMarshaller

void setMarshaller(Marshaller marshaller)
For homogenous containers can set a custom marshaller for loading values The default uses Object serialization

Parameters:
marshaller -

getId

Object getId()
Returns:
the id the MapContainer was create with

size

int size()
Specified by:
size in interface Collection<V>
Specified by:
size in interface List<V>
Returns:
the number of values in the container

addFirst

void addFirst(V o)
Inserts the given element at the beginning of this list.

Parameters:
o - the element to be inserted at the beginning of this list.

addLast

void addLast(V o)
Appends the given element to the end of this list. (Identical in function to the add method; included only for consistency.)

Parameters:
o - the element to be inserted at the end of this list.

removeFirst

V removeFirst()
Removes and returns the first element from this list.

Returns:
the first element from this list.
Throws:
NoSuchElementException - if this list is empty.

removeLast

V removeLast()
Removes and returns the last element from this list.

Returns:
the last element from this list.
Throws:
NoSuchElementException - if this list is empty.

doRemove

boolean doRemove(int position)
remove an objecr from the list without retrieving the old value from the store

Parameters:
position -
Returns:
true if successful

placeLast

StoreEntry placeLast(V object)
add an Object to the list but get a StoreEntry of its position

Parameters:
object -
Returns:
the entry in the Store

placeFirst

StoreEntry placeFirst(V object)
insert an Object in first position int the list but get a StoreEntry of its position

Parameters:
object -
Returns:
the location in the Store

update

void update(StoreEntry entry,
            V object)
Advanced feature = must ensure the object written doesn't overwrite other objects in the container

Parameters:
entry -
object -

get

V get(StoreEntry entry)
Retrieve an Object from the Store by its location

Parameters:
entry -
Returns:
the Object at that entry

getFirst

StoreEntry getFirst()
Get the StoreEntry for the first item of the list

Returns:
the first StoreEntry or null if the list is empty

getLast

StoreEntry getLast()
Get the StoreEntry for the last item of the list

Returns:
the last StoreEntry or null if the list is empty

getNext

StoreEntry getNext(StoreEntry entry)
Get the next StoreEntry from the list

Parameters:
entry -
Returns:
the next StoreEntry or null

getPrevious

StoreEntry getPrevious(StoreEntry entry)
Get the previous StoreEntry from the list

Parameters:
entry -
Returns:
the previous store entry or null

remove

boolean remove(StoreEntry entry)
remove the Object at the StoreEntry

Parameters:
entry -
Returns:
true if successful

refresh

StoreEntry refresh(StoreEntry entry)
It's possible that a StoreEntry could be come stale this will return an upto date entry for the StoreEntry position

Parameters:
entry - old entry
Returns:
a refreshed StoreEntry


Copyright © 2005-2013 The Apache Software Foundation. All Rights Reserved.