Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

org.activemq.filter
Class DestinationMap  view DestinationMap download DestinationMap.java

java.lang.Object
  extended byorg.activemq.filter.DestinationMap

public class DestinationMap
extends java.lang.Object

A Map-like data structure allowing values to be indexed by org.activemq.message.ActiveMQDestination and retrieved by destination - supporting both * and > style of wildcard as well as composite destinations.
This class assumes that the index changes rarely but that fast lookup into the index is required. So this class maintains a pre-calculated index for destination steps. So looking up the values for "TEST.*" or "*.TEST" will be pretty fast.
Looking up of a value could return a single value or a List of matching values if a wildcard or composite destination is used.

Version:
$Revision: 1.1.1.1 $

Field Summary
protected static java.lang.String ANY_CHILD
           
protected static java.lang.String ANY_DESCENDENT
           
private  boolean containsWildCards
           
private  java.util.Set nullAnswer
           
private  DestinationMapNode rootNode
           
private  java.util.Map vanillaDestinations
           
 
Constructor Summary
DestinationMap()
           
 
Method Summary
private  void addToVanillaDestinations(org.activemq.message.ActiveMQDestination key, java.lang.Object value)
           
protected  java.util.Set findWildcardMatches(org.activemq.message.ActiveMQDestination key)
           
 java.util.Set get(org.activemq.message.ActiveMQDestination key)
          Looks up the value(s) matching the given Destination key.
private  java.util.Set getFromVanillaDestinations(org.activemq.message.ActiveMQDestination key)
           
 void put(org.activemq.message.ActiveMQDestination key, java.lang.Object value)
          add destination to the map
 void remove(org.activemq.message.ActiveMQDestination key, java.lang.Object value)
          Removes the value from the associated destination
 void removeAll(org.activemq.message.ActiveMQDestination key)
          remove all destinations associated with a key
private  void removeAllFromVanillaDestinations(org.activemq.message.ActiveMQDestination key)
           
private  void removeFromVanillaDestinations(org.activemq.message.ActiveMQDestination key, java.lang.Object value)
           
private  void validateContainsWildCards(org.activemq.message.ActiveMQDestination key)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

rootNode

private DestinationMapNode rootNode

vanillaDestinations

private java.util.Map vanillaDestinations

containsWildCards

private boolean containsWildCards

ANY_DESCENDENT

protected static final java.lang.String ANY_DESCENDENT
See Also:
Constant Field Values

ANY_CHILD

protected static final java.lang.String ANY_CHILD
See Also:
Constant Field Values

nullAnswer

private java.util.Set nullAnswer
Constructor Detail

DestinationMap

public DestinationMap()
Method Detail

get

public java.util.Set get(org.activemq.message.ActiveMQDestination key)
Looks up the value(s) matching the given Destination key. For simple destinations this is typically a List of one single value, for wildcards or composite destinations this will typically be a List of matching values.


put

public void put(org.activemq.message.ActiveMQDestination key,
                java.lang.Object value)
add destination to the map


remove

public void remove(org.activemq.message.ActiveMQDestination key,
                   java.lang.Object value)
Removes the value from the associated destination


findWildcardMatches

protected java.util.Set findWildcardMatches(org.activemq.message.ActiveMQDestination key)

removeAll

public void removeAll(org.activemq.message.ActiveMQDestination key)
remove all destinations associated with a key


addToVanillaDestinations

private void addToVanillaDestinations(org.activemq.message.ActiveMQDestination key,
                                      java.lang.Object value)

removeFromVanillaDestinations

private void removeFromVanillaDestinations(org.activemq.message.ActiveMQDestination key,
                                           java.lang.Object value)

removeAllFromVanillaDestinations

private void removeAllFromVanillaDestinations(org.activemq.message.ActiveMQDestination key)

getFromVanillaDestinations

private java.util.Set getFromVanillaDestinations(org.activemq.message.ActiveMQDestination key)

validateContainsWildCards

private void validateContainsWildCards(org.activemq.message.ActiveMQDestination key)