org.apache.activemq.kaha.impl.container
Class MapContainerImpl

java.lang.Object
  extended by org.apache.activemq.kaha.impl.container.BaseContainerImpl
      extended by org.apache.activemq.kaha.impl.container.MapContainerImpl
All Implemented Interfaces:
java.util.Map, MapContainer

public final class MapContainerImpl
extends BaseContainerImpl
implements MapContainer

Implementation of a MapContainer

Version:
$Revision: 1.2 $

Nested Class Summary
 
Nested classes/interfaces inherited from interface java.util.Map
java.util.Map.Entry<K,V>
 
Field Summary
protected  java.util.Map indexMap
           
protected  Marshaller keyMarshaller
           
protected  Marshaller valueMarshaller
           
 
Fields inherited from class org.apache.activemq.kaha.impl.container.BaseContainerImpl
closed, containerId, dataManager, indexList, indexManager, indexType, initialized, loaded, root
 
Constructor Summary
MapContainerImpl(ContainerId id, IndexItem root, IndexManager indexManager, DataManager dataManager, java.lang.String indexType)
           
 
Method Summary
 void clear()
          empty the container
 boolean containsKey(java.lang.Object key)
           
 boolean containsValue(java.lang.Object o)
           
 java.util.Set entrySet()
           
 java.lang.Object get(java.lang.Object key)
          Get the value associated with the key
 java.util.Map getIndexMap()
           
protected  java.util.Set getInternalKeySet()
           
protected  IndexLinkedList getItemList()
           
 java.lang.Object getKey(StoreEntry item)
          Get the Key object from it's location
 java.lang.Object getValue(StoreEntry item)
          Get the value from it's location
 void init()
           
 boolean isEmpty()
           
 java.util.Set keySet()
           
 void load()
          The container is created or retrieved in an unloaded state.
 StoreEntry place(java.lang.Object key, java.lang.Object value)
          Add an entry to the Store Map
 java.lang.Object put(java.lang.Object key, java.lang.Object value)
          Add an entry
 void putAll(java.util.Map t)
          Add add entries in the supplied Map
protected  void remove(IndexItem item)
           
 java.lang.Object remove(java.lang.Object key)
          remove an entry associated with the key
 void remove(StoreEntry entry)
          Remove an Entry from ther Map
 boolean removeValue(java.lang.Object o)
           
 void setIndexMap(java.util.Map map)
          Set the internal index map
 void setKeyMarshaller(Marshaller keyMarshaller)
          For homogenous containers can set a custom marshaller for loading keys The default uses Object serialization
 void setValueMarshaller(Marshaller 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 values()
           
protected  IndexItem write(java.lang.Object key, java.lang.Object value)
           
 
Methods inherited from class org.apache.activemq.kaha.impl.container.BaseContainerImpl
checkClosed, close, delete, doClear, expressDataInterest, getContainerId, getDataManager, getId, getIndexManager, getInternalList, getList, isLoaded, isRoot, setList, storeIndex, updateIndexes
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.apache.activemq.kaha.MapContainer
getId, isLoaded
 
Methods inherited from interface java.util.Map
equals, hashCode
 

Field Detail

indexMap

protected java.util.Map indexMap

keyMarshaller

protected Marshaller keyMarshaller

valueMarshaller

protected Marshaller valueMarshaller
Constructor Detail

MapContainerImpl

public MapContainerImpl(ContainerId id,
                        IndexItem root,
                        IndexManager indexManager,
                        DataManager dataManager,
                        java.lang.String indexType)
Method Detail

init

public void init()
Overrides:
init in class BaseContainerImpl

load

public void load()
Description copied from interface: MapContainer
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

Specified by:
load in interface MapContainer
Specified by:
load in class BaseContainerImpl

unload

public void unload()
Description copied from interface: MapContainer
unload indexes from the container

Specified by:
unload in interface MapContainer
Specified by:
unload in class BaseContainerImpl

setKeyMarshaller

public void setKeyMarshaller(Marshaller keyMarshaller)
Description copied from interface: MapContainer
For homogenous containers can set a custom marshaller for loading keys The default uses Object serialization

Specified by:
setKeyMarshaller in interface MapContainer

setValueMarshaller

public void setValueMarshaller(Marshaller valueMarshaller)
Description copied from interface: MapContainer
For homogenous containers can set a custom marshaller for loading values The default uses Object serialization

Specified by:
setValueMarshaller in interface MapContainer

size

public int size()
Specified by:
size in interface java.util.Map
Specified by:
size in interface MapContainer
Specified by:
size in class BaseContainerImpl
Returns:
the number of values in the container

isEmpty

public boolean isEmpty()
Specified by:
isEmpty in interface java.util.Map
Specified by:
isEmpty in interface MapContainer
Returns:
true if there are no values stored in the container

containsKey

public boolean containsKey(java.lang.Object key)
Specified by:
containsKey in interface java.util.Map
Specified by:
containsKey in interface MapContainer
Returns:
true if the container contains the key

get

public java.lang.Object get(java.lang.Object key)
Description copied from interface: MapContainer
Get the value associated with the key

Specified by:
get in interface java.util.Map
Specified by:
get in interface MapContainer
Returns:
the value associated with the key from the store

containsValue

public boolean containsValue(java.lang.Object o)
Specified by:
containsValue in interface java.util.Map
Specified by:
containsValue in interface MapContainer
Returns:
true if the MapContainer contains the value o

putAll

public void putAll(java.util.Map t)
Description copied from interface: MapContainer
Add add entries in the supplied Map

Specified by:
putAll in interface java.util.Map
Specified by:
putAll in interface MapContainer

keySet

public java.util.Set keySet()
Specified by:
keySet in interface java.util.Map
Specified by:
keySet in interface MapContainer
Returns:
a Set of all the keys

values

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

entrySet

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

put

public java.lang.Object put(java.lang.Object key,
                            java.lang.Object value)
Description copied from interface: MapContainer
Add an entry

Specified by:
put in interface java.util.Map
Specified by:
put in interface MapContainer
Returns:
the old value for the key

remove

public java.lang.Object remove(java.lang.Object key)
Description copied from interface: MapContainer
remove an entry associated with the key

Specified by:
remove in interface java.util.Map
Specified by:
remove in interface MapContainer
Returns:
the old value assocaited with the key or null

removeValue

public boolean removeValue(java.lang.Object o)

remove

protected void remove(IndexItem item)
Specified by:
remove in class BaseContainerImpl

clear

public void clear()
Description copied from interface: MapContainer
empty the container

Specified by:
clear in interface java.util.Map
Specified by:
clear in interface MapContainer
Overrides:
clear in class BaseContainerImpl

place

public StoreEntry place(java.lang.Object key,
                        java.lang.Object value)
Add an entry to the Store Map

Specified by:
place in interface MapContainer
Parameters:
key -
value -
Returns:
the StoreEntry associated with the entry

remove

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

Specified by:
remove in interface MapContainer
Parameters:
entry -

getValue

public java.lang.Object getValue(StoreEntry item)
Get the value from it's location

Specified by:
getValue in interface MapContainer
Specified by:
getValue in class BaseContainerImpl
Parameters:
item -
Returns:
the value associated with the store entry

getKey

public java.lang.Object getKey(StoreEntry item)
Get the Key object from it's location

Specified by:
getKey in interface MapContainer
Parameters:
item -
Returns:
the Key Object associated with the StoreEntry

getInternalKeySet

protected java.util.Set getInternalKeySet()

getItemList

protected IndexLinkedList getItemList()

write

protected IndexItem write(java.lang.Object key,
                          java.lang.Object value)

getIndexMap

public java.util.Map getIndexMap()
Specified by:
getIndexMap in interface MapContainer
Returns:
See Also:
MapContainer.getIndexMap()

setIndexMap

public void setIndexMap(java.util.Map map)
Description copied from interface: MapContainer
Set the internal index map

Specified by:
setIndexMap in interface MapContainer
Parameters:
map -
See Also:
MapContainer.setIndexMap(java.util.Map)


Copyright © 2009 Apache Software Foundation. All Rights Reserved.