org.apache.activemq.filter
Class DestinationMap

java.lang.Object
  extended by org.apache.activemq.filter.DestinationMap
Direct Known Subclasses:
DefaultAuthorizationMap, MultiKahaDBPersistenceAdapter, PolicyMap, RedeliveryPolicyMap

public class DestinationMap
extends Object

A Map-like data structure allowing values to be indexed by 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.


Field Summary
protected static String ANY_CHILD
           
protected static String ANY_DESCENDENT
           
 
Constructor Summary
DestinationMap()
           
 
Method Summary
 Object chooseValue(ActiveMQDestination destination)
          Returns the value which matches the given destination or null if there is no matching value.
protected  Set findWildcardMatches(ActiveMQDestination key)
           
 Set get(ActiveMQDestination key)
          Looks up the value(s) matching the given Destination key.
protected  Class<? extends DestinationMapEntry> getEntryClass()
          Returns the type of the allowed entries which can be set via the setEntries(List) method.
 int getQueueRootChildCount()
           
 DestinationMapNode getQueueRootNode()
           
protected  DestinationMapNode getRootNode(ActiveMQDestination key)
          Returns the root node for the given destination type
 DestinationMapNode getTempQueueRootNode()
           
 DestinationMapNode getTempTopicRootNode()
           
 int getTopicRootChildCount()
           
 DestinationMapNode getTopicRootNode()
           
 void put(ActiveMQDestination key, Object value)
           
 void remove(ActiveMQDestination key, Object value)
          Removes the value from the associated destination
 Set removeAll(ActiveMQDestination key)
           
 void reset()
           
protected  void setEntries(List<DestinationMapEntry> entries)
          A helper method to allow the destination map to be populated from a dependency injection framework such as Spring
static Set union(Set existing, Set candidates)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

ANY_DESCENDENT

protected static final String ANY_DESCENDENT
See Also:
Constant Field Values

ANY_CHILD

protected static final String ANY_CHILD
See Also:
Constant Field Values
Constructor Detail

DestinationMap

public DestinationMap()
Method Detail

get

public Set get(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.

Parameters:
key - the destination to lookup
Returns:
a List of matching values or an empty list if there are no matching values.

put

public void put(ActiveMQDestination key,
                Object value)

remove

public void remove(ActiveMQDestination key,
                   Object value)
Removes the value from the associated destination


getTopicRootChildCount

public int getTopicRootChildCount()

getQueueRootChildCount

public int getQueueRootChildCount()

getQueueRootNode

public DestinationMapNode getQueueRootNode()

getTopicRootNode

public DestinationMapNode getTopicRootNode()

getTempQueueRootNode

public DestinationMapNode getTempQueueRootNode()

getTempTopicRootNode

public DestinationMapNode getTempTopicRootNode()

setEntries

protected void setEntries(List<DestinationMapEntry> entries)
A helper method to allow the destination map to be populated from a dependency injection framework such as Spring


getEntryClass

protected Class<? extends DestinationMapEntry> getEntryClass()
Returns the type of the allowed entries which can be set via the setEntries(List) method. This allows derived classes to further restrict the type of allowed entries to make a type safe destination map for custom policies.


findWildcardMatches

protected Set findWildcardMatches(ActiveMQDestination key)

removeAll

public Set removeAll(ActiveMQDestination key)
Parameters:
key -
Returns:

chooseValue

public Object chooseValue(ActiveMQDestination destination)
Returns the value which matches the given destination or null if there is no matching value. If there are multiple values, the results are sorted and the last item (the biggest) is returned.

Parameters:
destination - the destination to find the value for
Returns:
the largest matching value or null if no value matches

getRootNode

protected DestinationMapNode getRootNode(ActiveMQDestination key)
Returns the root node for the given destination type


reset

public void reset()

union

public static Set union(Set existing,
                        Set candidates)


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