org.apache.activemq.kaha
Interface MapContainer<K,V>

All Superinterfaces:
java.util.Map<K,V>
All Known Implementing Classes:
MapContainerImpl

public interface MapContainer<K,V>
extends java.util.Map<K,V>

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


Nested Class Summary
 
Nested classes/interfaces inherited from interface java.util.Map
java.util.Map.Entry<K,V>
 
Method Summary
 void clear()
          empty the container
 boolean containsKey(K key)
           
 boolean containsValue(K o)
           
 void delete()
          Clean up all state associated with this container.
 java.util.Set<java.util.Map.Entry<K,V>> entrySet()
           
 V get(K key)
          Get the value associated with the key
 StoreEntry getEntry(K key)
          Get the StoreEntry associated with the key
 StoreEntry getFirst()
          Get the StoreEntry for the first value in the Map
 java.lang.Object getId()
           
 int getIndexBinSize()
           
 int getIndexKeySize()
           
 int getIndexLoadFactor()
           
 int getIndexMaxBinSize()
           
 IndexMBean getIndexMBean()
           
 int getIndexPageSize()
           
 K getKey(StoreEntry keyLocation)
          Get the Key object from it's location
 StoreEntry getLast()
          Get the StoreEntry for the last value item of the Map
 StoreEntry getNext(StoreEntry entry)
          Get the next StoreEntry value from the map
 StoreEntry getPrevious(StoreEntry entry)
          Get the previous StoreEntry from the map
 V getValue(StoreEntry valueLocation)
          Get the value from it's location
 boolean isEmpty()
           
 boolean isLoaded()
           
 java.util.Set<K> keySet()
           
 void load()
          The container is created or retrieved in an unloaded state.
 StoreEntry place(K key, V value)
          Add an entry to the Store Map
 V put(K key, V value)
          Add an entry
 void putAll(java.util.Map<K,V> map)
          Add add entries in the supplied Map
 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
 V remove(K key)
          remove an entry associated with the key
 void remove(StoreEntry entry)
          Remove an Entry from ther Map
 void setIndexBinSize(int size)
          Set the index bin size
 void setIndexKeySize(int size)
          Add the index key size
 void setIndexLoadFactor(int loadFactor)
           
 void setIndexMaxBinSize(int size)
          set the meximum bin size
 void setIndexPageSize(int size)
          Set the index page size
 void setKeyMarshaller(Marshaller<K> keyMarshaller)
          For homogenous containers can set a custom marshaller for loading keys The default uses Object serialization
 void setValueMarshaller(Marshaller<V> valueMarshaller)
          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
 java.util.Collection<V> values()
           
 
Methods inherited from interface java.util.Map
containsKey, containsValue, equals, get, hashCode, putAll, remove
 

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

setKeyMarshaller

void setKeyMarshaller(Marshaller<K> keyMarshaller)
For homogenous containers can set a custom marshaller for loading keys The default uses Object serialization

Parameters:
keyMarshaller -

setValueMarshaller

void setValueMarshaller(Marshaller<V> valueMarshaller)
For homogenous containers can set a custom marshaller for loading values The default uses Object serialization

Parameters:
valueMarshaller -

getId

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

size

int size()
Specified by:
size in interface java.util.Map<K,V>
Returns:
the number of values in the container

isEmpty

boolean isEmpty()
Specified by:
isEmpty in interface java.util.Map<K,V>
Returns:
true if there are no values stored in the container

containsKey

boolean containsKey(K key)
Parameters:
key -
Returns:
true if the container contains the key

get

V get(K key)
Get the value associated with the key

Parameters:
key -
Returns:
the value associated with the key from the store

containsValue

boolean containsValue(K o)
Parameters:
o -
Returns:
true if the MapContainer contains the value o

putAll

void putAll(java.util.Map<K,V> map)
Add add entries in the supplied Map

Parameters:
map -

keySet

java.util.Set<K> keySet()
Specified by:
keySet in interface java.util.Map<K,V>
Returns:
a Set of all the keys

values

java.util.Collection<V> values()
Specified by:
values in interface java.util.Map<K,V>
Returns:
a collection of all the values - the values will be lazily pulled out of the store if iterated etc.

entrySet

java.util.Set<java.util.Map.Entry<K,V>> entrySet()
Specified by:
entrySet in interface java.util.Map<K,V>
Returns:
a Set of all the Map.Entry instances - the values will be lazily pulled out of the store if iterated etc.

put

V put(K key,
      V value)
Add an entry

Specified by:
put in interface java.util.Map<K,V>
Parameters:
key -
value -
Returns:
the old value for the key

remove

V remove(K key)
remove an entry associated with the key

Parameters:
key -
Returns:
the old value assocaited with the key or null

clear

void clear()
empty the container

Specified by:
clear in interface java.util.Map<K,V>

place

StoreEntry place(K key,
                 V value)
Add an entry to the Store Map

Parameters:
key -
Value -
Returns:
the StoreEntry associated with the entry

remove

void remove(StoreEntry entry)
Remove an Entry from ther Map

Parameters:
entry -

getKey

K getKey(StoreEntry keyLocation)
Get the Key object from it's location

Parameters:
keyLocation -
Returns:
the key for the entry

getValue

V getValue(StoreEntry valueLocation)
Get the value from it's location

Parameters:
Valuelocation -
Returns:
the Object

getFirst

StoreEntry getFirst()
Get the StoreEntry for the first value in the Map

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

getLast

StoreEntry getLast()
Get the StoreEntry for the last value item of the Map

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

getNext

StoreEntry getNext(StoreEntry entry)
Get the next StoreEntry value from the map

Parameters:
entry -
Returns:
the next StoreEntry or null

getPrevious

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

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

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

getEntry

StoreEntry getEntry(K key)
Get the StoreEntry associated with the key

Parameters:
key -
Returns:
the StoreEntry

setIndexBinSize

void setIndexBinSize(int size)
Set the index bin size

Parameters:
size -

getIndexBinSize

int getIndexBinSize()
Returns:
index bin size

setIndexKeySize

void setIndexKeySize(int size)
Add the index key size

Parameters:
size -

getIndexKeySize

int getIndexKeySize()
Returns:
the index key size

setIndexPageSize

void setIndexPageSize(int size)
Set the index page size

Parameters:
size -

getIndexPageSize

int getIndexPageSize()
Returns:
the index page size

setIndexMaxBinSize

void setIndexMaxBinSize(int size)
set the meximum bin size


getIndexMaxBinSize

int getIndexMaxBinSize()
Returns:
the maximum bin size

getIndexLoadFactor

int getIndexLoadFactor()
Returns:
the loadFactor

setIndexLoadFactor

void setIndexLoadFactor(int loadFactor)
Parameters:
loadFactor - the loadFactor to set

getIndexMBean

IndexMBean getIndexMBean()
Returns:
the Index MBean

delete

void delete()
Clean up all state associated with this container.



Copyright © 2005-2011 FuseSource, Corp.. All Rights Reserved.