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

Quick Search    Search Deep

org.activemq.message
Class ActiveMQDestination  view ActiveMQDestination download ActiveMQDestination.java

java.lang.Object
  extended byorg.activemq.jndi.JNDIBaseStorable
      extended byorg.activemq.message.ActiveMQDestination
All Implemented Interfaces:
java.lang.Comparable, javax.jms.Destination, org.activemq.jndi.JNDIStorableInterface, javax.naming.Referenceable, java.io.Serializable
Direct Known Subclasses:
ActiveMQQueue, ActiveMQTopic

public abstract class ActiveMQDestination
extends org.activemq.jndi.JNDIBaseStorable
implements javax.jms.Destination, java.lang.Comparable, java.io.Serializable

A Destination object encapsulates a provider-specific address. The JMS API does not define a standard address syntax. Although a standard address syntax was considered, it was decided that the differences in address semantics between existing message-oriented middleware (MOM) products were too wide to bridge with a single syntax.

Since Destination is an administered object, it may contain provider-specific configuration information in addition to its address.

The JMS API also supports a client's use of provider-specific address names.

Destination objects support concurrent use.

A Destination object is a JMS administered object.

JMS administered objects are objects containing configuration information that are created by an administrator and later used by JMS clients. They make it practical to administer the JMS API in the enterprise.

Although the interfaces for administered objects do not explicitly depend on the Java Naming and Directory Interface (JNDI) API, the JMS API establishes the convention that JMS clients find administered objects by looking them up in a JNDI namespace.

An administrator can place an administered object anywhere in a namespace. The JMS API does not define a naming policy.

It is expected that JMS providers will provide the tools an administrator needs to create and configure administered objects in a JNDI namespace. JMS provider implementations of administered objects should implement the javax.naming.Referenceable and java.io.Serializable interfaces so that they can be stored in all JNDI naming contexts. In addition, it is recommended that these implementations follow the JavaBeansTM design patterns.

This strategy provides several benefits:

An administered object should not hold on to any remote resources. Its lookup should not use remote resources other than those used by the JNDI API itself.

Clients should think of administered objects as local Java objects. Looking them up should not have any hidden side effects or use surprising amounts of local resources.


Field Summary
static int ACTIVEMQ_QUEUE
          Queue Destination object
static int ACTIVEMQ_TEMPORARY_QUEUE
          Temporary Queue Destination object
static int ACTIVEMQ_TEMPORARY_TOPIC
          Temporary Topic Destination object
static int ACTIVEMQ_TOPIC
          Topic Destination object
private  boolean advisory
           
static java.lang.String ADVISORY_PREFIX
          prefix for Advisory message destinations
private  boolean composite
           
private static java.lang.String COMPOSITE_SEPARATOR
           
static java.lang.String CONNECTION_ADVISORY_PREFIX
          prefix for connection advisory destinations
static java.lang.String CONSUMER_ADVISORY_PREFIX
          Deprecated. Use #getDestinationForConsumerAdvisory() instead.
private  int consumerCounter
           
static java.lang.String DEFAULT_ORDERED_TARGET
          The default target for ordered destinations
private  boolean deleted
           
private  boolean exclusive
           
private  org.activemq.filter.DestinationFilter filter
           
private static int NULL_DESTINATION
           
private  boolean ordered
           
private  java.lang.String orderedTarget
           
private  java.lang.String[] paths
           
private  java.lang.String physicalName
           
static java.lang.String PRODUCER_ADVISORY_PREFIX
          Deprecated. Use #getDestinationForProducerAdvisory() instead.
private static java.lang.String QUEUE_PREFIX
           
(package private) static long serialVersionUID
           
private  org.activemq.ActiveMQSession sessionCreatedBy
           
private  org.activemq.management.JMSDestinationStats stats
           
static java.lang.String TEMP_DESTINATION_ADVISORY_PREFIX
          Deprecated. Use #getDestinationForTempAdvisory() instead.
private static java.lang.String TEMP_POSTFIX
           
private static java.lang.String TEMP_PREFIX
           
private static java.lang.String TOPIC_PREFIX
           
private  boolean wildcard
           
 
Fields inherited from class org.activemq.jndi.JNDIBaseStorable
 
Constructor Summary
protected ActiveMQDestination()
          The Default Constructor
protected ActiveMQDestination(java.lang.String name)
          Construct the ActiveMQDestination with a defined physical name;
 
Method Summary
protected  void buildFromProperties(java.util.Properties props)
          Set the properties that will represent the instance in JNDI
 int compareTo(ActiveMQDestination that)
          Lets sort by name first then lets sort topics greater than queues
 int compareTo(java.lang.Object o)
          Compares this object with another, and returns a numerical result based on the comparison.
static ActiveMQDestination createDestination(int type, java.lang.String pyhsicalName)
          Create a Destination
protected abstract  javax.jms.Destination createDestination(java.lang.String name)
          Factory method to create a child destination if this destination is a composite
private  ActiveMQDestination createDestinationFromAdvisoryName(java.lang.String advisoryName)
           
protected abstract  org.activemq.management.JMSDestinationStats createDestinationStats()
          Factory method to create a statistics counter object
static java.lang.String createTemporaryName(java.lang.String clientId)
          Create a temporary name from the clientId
 void decrementConsumerCounter()
          descrement counter for number interested consumers
 void delete()
          Used to Deletes a temporary destination.
 boolean equals(java.lang.Object obj)
          if the object passed in is equivalent, return true
private  java.lang.String getAdvisoryDestinationTypePrefix()
           
 java.util.List getChildDestinations()
          Returns a list of child destinations if this destination represents a composite destination.
static java.lang.String getClientId(ActiveMQDestination destination)
          From a temporary destination find the clientId of the Connection that created it
 ActiveMQDestination getDestinationBeingAdvised()
           
 org.activemq.filter.DestinationFilter getDestinationFilter()
           
 java.lang.String[] getDestinationPaths()
           
abstract  int getDestinationType()
           
 java.lang.String getOrderedTarget()
           
 java.lang.String getPhysicalName()
           
 org.activemq.ActiveMQSession getSessionCreatedBy()
           
 org.activemq.management.JMSDestinationStats getStats()
           
 ActiveMQTopic getTopicForConsumerAdvisory()
           
 ActiveMQTopic getTopicForProducerAdvisory()
           
 ActiveMQTopic getTopicForTempAdvisory()
           
 int hashCode()
          Get a value that represents this Object, as uniquely as possible within the confines of an int.
 void incrementConsumerCounter()
          increment counter for number of interested consumers
static java.lang.String inspect(javax.jms.Destination destination)
          A helper method to return a descriptive string for the topic or queue
 boolean isAdvisory()
           
 boolean isComposite()
          Returns true if this destination represents a collection of destinations; allowing a set of destinations to be published to or subscribed from in one JMS operation.
 boolean isConnectionAdvisory()
           
 boolean isConsumerAdvisory()
           
 boolean isDeleted()
           
 boolean isExclusive()
           
 boolean isOrdered()
           
 boolean isProducerAdvisory()
           
 boolean isQueue()
          Returns true if a Queue Destination
 boolean isTempDestinationAdvisory()
           
 boolean isTemporary()
          Returns true if a temporary Destination
 boolean isTopic()
          Returns true if a Topic Destination
 boolean isWildcard()
           
 boolean matches(ActiveMQDestination destination)
           
protected  void populateProperties(java.util.Properties props)
          Initialize the instance from properties stored in JNDI
static ActiveMQDestination readFromStream(java.io.DataInput dataIn)
          Read an ActiveMQDestination from a Stream
 void setAdvisory(boolean advisory)
           
 void setChildDestinations(ActiveMQDestination[] children)
           
 void setDeleted(boolean value)
          det the deleted flag to the new value
 void setExclusive(boolean exclusive)
           
 void setOrdered(boolean ordered)
           
 void setOrderedTarget(java.lang.String orderedTarget)
           
 void setPhysicalName(java.lang.String name)
           
 void setSessionCreatedBy(org.activemq.ActiveMQSession orginatingSession)
           
 void setStats(org.activemq.management.JMSDestinationStats stats)
           
 java.lang.String toString()
          Convert this Object to a human-readable String.
static ActiveMQDestination transformDestination(javax.jms.Destination destination)
           
static void writeToStream(ActiveMQDestination destination, java.io.DataOutput dataOut)
          Write an ActiveMQDestination to a Stream
 
Methods inherited from class org.activemq.jndi.JNDIBaseStorable
getProperties, getReference, setProperties
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

serialVersionUID

static final long serialVersionUID
See Also:
Constant Field Values

ACTIVEMQ_TOPIC

public static final int ACTIVEMQ_TOPIC
Topic Destination object

See Also:
Constant Field Values

ACTIVEMQ_TEMPORARY_TOPIC

public static final int ACTIVEMQ_TEMPORARY_TOPIC
Temporary Topic Destination object

See Also:
Constant Field Values

ACTIVEMQ_QUEUE

public static final int ACTIVEMQ_QUEUE
Queue Destination object

See Also:
Constant Field Values

ACTIVEMQ_TEMPORARY_QUEUE

public static final int ACTIVEMQ_TEMPORARY_QUEUE
Temporary Queue Destination object

See Also:
Constant Field Values

ADVISORY_PREFIX

public static final java.lang.String ADVISORY_PREFIX
prefix for Advisory message destinations

See Also:
Constant Field Values

CONNECTION_ADVISORY_PREFIX

public static final java.lang.String CONNECTION_ADVISORY_PREFIX
prefix for connection advisory destinations

See Also:
Constant Field Values

CONSUMER_ADVISORY_PREFIX

public static final java.lang.String CONSUMER_ADVISORY_PREFIX
Deprecated. Use #getDestinationForConsumerAdvisory() instead.

prefix for consumer advisory destinations

See Also:
Constant Field Values

PRODUCER_ADVISORY_PREFIX

public static final java.lang.String PRODUCER_ADVISORY_PREFIX
Deprecated. Use #getDestinationForProducerAdvisory() instead.

prefix for producer advisory destinations

See Also:
Constant Field Values

TEMP_DESTINATION_ADVISORY_PREFIX

public static final java.lang.String TEMP_DESTINATION_ADVISORY_PREFIX
Deprecated. Use #getDestinationForTempAdvisory() instead.

prefix for connection advisory destinations

See Also:
Constant Field Values

DEFAULT_ORDERED_TARGET

public static final java.lang.String DEFAULT_ORDERED_TARGET
The default target for ordered destinations

See Also:
Constant Field Values

NULL_DESTINATION

private static final int NULL_DESTINATION
See Also:
Constant Field Values

TEMP_PREFIX

private static final java.lang.String TEMP_PREFIX
See Also:
Constant Field Values

TEMP_POSTFIX

private static final java.lang.String TEMP_POSTFIX
See Also:
Constant Field Values

COMPOSITE_SEPARATOR

private static final java.lang.String COMPOSITE_SEPARATOR
See Also:
Constant Field Values

QUEUE_PREFIX

private static final java.lang.String QUEUE_PREFIX
See Also:
Constant Field Values

TOPIC_PREFIX

private static final java.lang.String TOPIC_PREFIX
See Also:
Constant Field Values

physicalName

private java.lang.String physicalName

filter

private transient org.activemq.filter.DestinationFilter filter

stats

private transient org.activemq.management.JMSDestinationStats stats

paths

private transient java.lang.String[] paths

consumerCounter

private transient int consumerCounter

deleted

private transient boolean deleted

exclusive

private boolean exclusive

ordered

private boolean ordered

advisory

private boolean advisory

wildcard

private boolean wildcard

composite

private boolean composite

orderedTarget

private java.lang.String orderedTarget

sessionCreatedBy

private transient org.activemq.ActiveMQSession sessionCreatedBy
Constructor Detail

ActiveMQDestination

protected ActiveMQDestination()
The Default Constructor


ActiveMQDestination

protected ActiveMQDestination(java.lang.String name)
Construct the ActiveMQDestination with a defined physical name;

Method Detail

getSessionCreatedBy

public org.activemq.ActiveMQSession getSessionCreatedBy()

setSessionCreatedBy

public void setSessionCreatedBy(org.activemq.ActiveMQSession orginatingSession)

isAdvisory

public final boolean isAdvisory()

setAdvisory

public final void setAdvisory(boolean advisory)

isConsumerAdvisory

public boolean isConsumerAdvisory()

isProducerAdvisory

public boolean isProducerAdvisory()

isConnectionAdvisory

public boolean isConnectionAdvisory()

isTempDestinationAdvisory

public final boolean isTempDestinationAdvisory()

isExclusive

public final boolean isExclusive()

setExclusive

public final void setExclusive(boolean exclusive)

isOrdered

public final boolean isOrdered()

setOrdered

public final void setOrdered(boolean ordered)

getOrderedTarget

public java.lang.String getOrderedTarget()

setOrderedTarget

public void setOrderedTarget(java.lang.String orderedTarget)

inspect

public static java.lang.String inspect(javax.jms.Destination destination)
A helper method to return a descriptive string for the topic or queue


transformDestination

public static ActiveMQDestination transformDestination(javax.jms.Destination destination)
                                                throws javax.jms.JMSException

writeToStream

public static void writeToStream(ActiveMQDestination destination,
                                 java.io.DataOutput dataOut)
                          throws java.io.IOException
Write an ActiveMQDestination to a Stream


readFromStream

public static ActiveMQDestination readFromStream(java.io.DataInput dataIn)
                                          throws java.io.IOException
Read an ActiveMQDestination from a Stream


createDestination

public static ActiveMQDestination createDestination(int type,
                                                    java.lang.String pyhsicalName)
Create a Destination


createTemporaryName

public static java.lang.String createTemporaryName(java.lang.String clientId)
Create a temporary name from the clientId


getClientId

public static java.lang.String getClientId(ActiveMQDestination destination)
From a temporary destination find the clientId of the Connection that created it


compareTo

public int compareTo(java.lang.Object o)
Description copied from interface: java.lang.Comparable
Compares this object with another, and returns a numerical result based on the comparison. If the result is negative, this object sorts less than the other; if 0, the two are equal, and if positive, this object sorts greater than the other. To translate this into boolean, simply perform o1.compareTo(o2) <op> 0, where op is one of <, <=, =, !=, >, or >=.

You must make sure that the comparison is mutual, ie. sgn(x.compareTo(y)) == -sgn(y.compareTo(x)) (where sgn() is defined as -1, 0, or 1 based on the sign). This includes throwing an exception in either direction if the two are not comparable; hence, compareTo(null) should always throw an Exception.

You should also ensure transitivity, in two forms: x.compareTo(y) > 0 && y.compareTo(z) > 0 implies x.compareTo(z) > 0; and x.compareTo(y) == 0 implies x.compareTo(z) == y.compareTo(z).

Specified by:
compareTo in interface java.lang.Comparable

compareTo

public int compareTo(ActiveMQDestination that)
Lets sort by name first then lets sort topics greater than queues


getDestinationType

public abstract int getDestinationType()

getPhysicalName

public java.lang.String getPhysicalName()

setPhysicalName

public void setPhysicalName(java.lang.String name)

isTemporary

public boolean isTemporary()
Returns true if a temporary Destination


isTopic

public boolean isTopic()
Returns true if a Topic Destination


isQueue

public boolean isQueue()
Returns true if a Queue Destination


isComposite

public final boolean isComposite()
Returns true if this destination represents a collection of destinations; allowing a set of destinations to be published to or subscribed from in one JMS operation.

If this destination is a composite then you can call getChildDestinations() 55 to return the list of child destinations.


getChildDestinations

public java.util.List getChildDestinations()
Returns a list of child destinations if this destination represents a composite destination.


setChildDestinations

public void setChildDestinations(ActiveMQDestination[] children)

toString

public java.lang.String toString()
Description copied from class: java.lang.Object
Convert this Object to a human-readable String. There are no limits placed on how long this String should be or what it should contain. We suggest you make it as intuitive as possible to be able to place it into System.out.println() 55 and such.

It is typical, but not required, to ensure that this method never completes abruptly with a java.lang.RuntimeException.

This method will be called when performing string concatenation with this object. If the result is null, string concatenation will instead use "null".

The default implementation returns getClass().getName() + "@" + Integer.toHexString(hashCode()).


hashCode

public int hashCode()
Description copied from class: java.lang.Object
Get a value that represents this Object, as uniquely as possible within the confines of an int.

There are some requirements on this method which subclasses must follow:

  • Semantic equality implies identical hashcodes. In other words, if a.equals(b) is true, then a.hashCode() == b.hashCode() must be as well. However, the reverse is not necessarily true, and two objects may have the same hashcode without being equal.
  • It must be consistent. Whichever value o.hashCode() returns on the first invocation must be the value returned on all later invocations as long as the object exists. Notice, however, that the result of hashCode may change between separate executions of a Virtual Machine, because it is not invoked on the same object.

Notice that since hashCode is used in java.util.Hashtable and other hashing classes, a poor implementation will degrade the performance of hashing (so don't blindly implement it as returning a constant!). Also, if calculating the hash is time-consuming, a class may consider caching the results.

The default implementation returns System.identityHashCode(this)


equals

public boolean equals(java.lang.Object obj)
if the object passed in is equivalent, return true


isWildcard

public boolean isWildcard()

matches

public boolean matches(ActiveMQDestination destination)

getDestinationFilter

public org.activemq.filter.DestinationFilter getDestinationFilter()

getDestinationPaths

public java.lang.String[] getDestinationPaths()

getStats

public org.activemq.management.JMSDestinationStats getStats()

setStats

public void setStats(org.activemq.management.JMSDestinationStats stats)

incrementConsumerCounter

public void incrementConsumerCounter()
increment counter for number of interested consumers


decrementConsumerCounter

public void decrementConsumerCounter()
descrement counter for number interested consumers


isDeleted

public boolean isDeleted()

setDeleted

public void setDeleted(boolean value)
det the deleted flag to the new value


delete

public void delete()
            throws javax.jms.JMSException
Used to Deletes a temporary destination. If there are existing consumers still using it, a JMSException will be thrown.


createDestination

protected abstract javax.jms.Destination createDestination(java.lang.String name)
Factory method to create a child destination if this destination is a composite


createDestinationStats

protected abstract org.activemq.management.JMSDestinationStats createDestinationStats()
Factory method to create a statistics counter object


buildFromProperties

protected void buildFromProperties(java.util.Properties props)
Set the properties that will represent the instance in JNDI


populateProperties

protected void populateProperties(java.util.Properties props)
Initialize the instance from properties stored in JNDI


getTopicForTempAdvisory

public ActiveMQTopic getTopicForTempAdvisory()

getTopicForConsumerAdvisory

public ActiveMQTopic getTopicForConsumerAdvisory()

getTopicForProducerAdvisory

public ActiveMQTopic getTopicForProducerAdvisory()

getDestinationBeingAdvised

public ActiveMQDestination getDestinationBeingAdvised()

getAdvisoryDestinationTypePrefix

private java.lang.String getAdvisoryDestinationTypePrefix()

createDestinationFromAdvisoryName

private ActiveMQDestination createDestinationFromAdvisoryName(java.lang.String advisoryName)