Package org.apache.activemq.filter
Class DestinationMap
java.lang.Object
org.apache.activemq.filter.DestinationMap
- Direct Known Subclasses:
RedeliveryPolicyMap
A Map-like data structure allowing values to be indexed by
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.
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
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionchooseValue
(ActiveMQDestination destination) Returns the value which matches the given destination or null if there is no matching value.protected Set
protected Set
findWildcardMatches
(ActiveMQDestination key, boolean deep) get
(ActiveMQDestination key) Looks up the value(s) matching the given Destination key.protected Class<? extends DestinationMapEntry>
Returns the type of the allowed entries which can be set via thesetEntries(List)
method.int
protected DestinationMapNode
Returns the root node for the given destination typeint
boolean
isEmpty()
void
put
(ActiveMQDestination key, Object value) void
remove
(ActiveMQDestination key, Object value) Removes the value from the associated destinationvoid
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 Springstatic Set
void
unsynchronizedPut
(ActiveMQDestination key, Object value) void
unsynchronizedRemove
(ActiveMQDestination key, Object value)
-
Field Details
-
ANY_DESCENDENT
- See Also:
-
ANY_CHILD
- See Also:
-
-
Constructor Details
-
DestinationMap
public DestinationMap()
-
-
Method Details
-
get
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.
-
unsynchronizedGet
-
put
-
unsynchronizedPut
-
remove
Removes the value from the associated destination -
unsynchronizedRemove
-
getTopicRootChildCount
public int getTopicRootChildCount() -
getQueueRootChildCount
public int getQueueRootChildCount() -
getQueueRootNode
-
getTopicRootNode
-
getTempQueueRootNode
-
getTempTopicRootNode
-
setEntries
A helper method to allow the destination map to be populated from a dependency injection framework such as Spring -
getEntryClass
Returns the type of the allowed entries which can be set via thesetEntries(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
-
findWildcardMatches
-
removeAll
- Parameters:
key
-- Returns:
-
chooseValue
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
Returns the root node for the given destination type -
reset
public void reset() -
isEmpty
public boolean isEmpty() -
union
-