org.apache.qpid.server.exchange
Class AbstractExchange

java.lang.Object
  extended by org.apache.qpid.server.exchange.AbstractExchange
All Implemented Interfaces:
ConfiguredObject<ExchangeConfigType,ExchangeConfig>, ExchangeConfig, Exchange, ExchangeReferrer, Managable
Direct Known Subclasses:
DirectExchange, FanoutExchange, HeadersExchange, TopicExchange

public abstract class AbstractExchange
extends Object
implements Exchange, Managable


Nested Class Summary
 
Nested classes/interfaces inherited from interface org.apache.qpid.server.exchange.Exchange
Exchange.BindingListener, Exchange.Task
 
Field Summary
protected  boolean _autoDelete
          Whether the exchange is automatically deleted once all queues have detached from it
protected  boolean _durable
           
protected  AbstractExchangeMBean _exchangeMbean
           
protected  int _ticket
           
 
Constructor Summary
AbstractExchange(ExchangeType<? extends Exchange> type)
           
 
Method Summary
 void addBinding(Binding binding)
           
 void addBindingListener(Exchange.BindingListener listener)
           
 void addCloseTask(Exchange.Task task)
           
 void addReference(ExchangeReferrer exchange)
           
 void close()
           
protected abstract  AbstractExchangeMBean createMBean()
          Concrete exchanges must implement this method in order to create the managed representation.
protected abstract  ArrayList<? extends BaseQueue> doRoute(InboundMessage message)
           
 Exchange getAlternateExchange()
           
 Map<String,Object> getArguments()
           
 long getBindingCount()
           
 long getBindingCountHigh()
           
 Collection<Binding> getBindings()
           
 long getByteReceives()
           
 long getByteRoutes()
           
 ConfigStore getConfigStore()
           
 ExchangeConfigType getConfigType()
           
 long getCreateTime()
           
 UUID getId()
           
abstract  org.apache.log4j.Logger getLogger()
           
 ManagedObject getManagedObject()
           
 long getMsgReceives()
           
 long getMsgRoutes()
           
 String getName()
           
 org.apache.qpid.framing.AMQShortString getNameShortString()
           
 ConfiguredObject getParent()
           
 QueueRegistry getQueueRegistry()
           
 int getTicket()
           
 ExchangeType getType()
           
 org.apache.qpid.framing.AMQShortString getTypeShortString()
           
 VirtualHost getVirtualHost()
           
 boolean hasReferrers()
           
 void initialise(VirtualHost host, org.apache.qpid.framing.AMQShortString name, boolean durable, int ticket, boolean autoDelete)
           
 boolean isAutoDelete()
           
 boolean isBound(String bindingKey)
           
 boolean isBound(String bindingKey, AMQQueue queue)
           
 boolean isBound(String bindingKey, Map<String,Object> arguments, AMQQueue queue)
           
 boolean isDurable()
           
protected abstract  void onBind(Binding binding)
           
protected abstract  void onUnbind(Binding binding)
           
 void removeBinding(Binding binding)
           
 void removeBindingListener(Exchange.BindingListener listener)
           
 void removeCloseTask(Exchange.Task task)
           
 void removeReference(ExchangeReferrer exchange)
           
 ArrayList<? extends BaseQueue> route(InboundMessage message)
           
 void setAlternateExchange(Exchange exchange)
           
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface org.apache.qpid.server.exchange.Exchange
hasBindings, isBound, isBound, isBound, isBound
 

Field Detail

_durable

protected boolean _durable

_ticket

protected int _ticket

_exchangeMbean

protected AbstractExchangeMBean _exchangeMbean

_autoDelete

protected boolean _autoDelete
Whether the exchange is automatically deleted once all queues have detached from it

Constructor Detail

AbstractExchange

public AbstractExchange(ExchangeType<? extends Exchange> type)
Method Detail

getNameShortString

public org.apache.qpid.framing.AMQShortString getNameShortString()
Specified by:
getNameShortString in interface Exchange

getTypeShortString

public final org.apache.qpid.framing.AMQShortString getTypeShortString()
Specified by:
getTypeShortString in interface Exchange

createMBean

protected abstract AbstractExchangeMBean createMBean()
                                              throws JMException
Concrete exchanges must implement this method in order to create the managed representation. This is called during initialisation (template method pattern).

Returns:
the MBean
Throws:
JMException

initialise

public void initialise(VirtualHost host,
                       org.apache.qpid.framing.AMQShortString name,
                       boolean durable,
                       int ticket,
                       boolean autoDelete)
                throws org.apache.qpid.AMQException
Specified by:
initialise in interface Exchange
Throws:
org.apache.qpid.AMQException

getConfigStore

public ConfigStore getConfigStore()

getLogger

public abstract org.apache.log4j.Logger getLogger()

isDurable

public boolean isDurable()
Specified by:
isDurable in interface ConfiguredObject<ExchangeConfigType,ExchangeConfig>
Specified by:
isDurable in interface Exchange

isAutoDelete

public boolean isAutoDelete()
Specified by:
isAutoDelete in interface ExchangeConfig
Specified by:
isAutoDelete in interface Exchange
Returns:
true if the exchange will be deleted after all queues have been detached

getTicket

public int getTicket()
Specified by:
getTicket in interface Exchange

close

public void close()
           throws org.apache.qpid.AMQException
Specified by:
close in interface Exchange
Throws:
org.apache.qpid.AMQException

toString

public String toString()
Overrides:
toString in class Object

getManagedObject

public ManagedObject getManagedObject()
Specified by:
getManagedObject in interface Managable

getVirtualHost

public VirtualHost getVirtualHost()
Specified by:
getVirtualHost in interface ExchangeConfig

getQueueRegistry

public QueueRegistry getQueueRegistry()

isBound

public boolean isBound(String bindingKey,
                       Map<String,Object> arguments,
                       AMQQueue queue)

isBound

public boolean isBound(String bindingKey,
                       AMQQueue queue)
Specified by:
isBound in interface Exchange

isBound

public boolean isBound(String bindingKey)
Specified by:
isBound in interface Exchange

getAlternateExchange

public Exchange getAlternateExchange()
Specified by:
getAlternateExchange in interface ExchangeConfig
Specified by:
getAlternateExchange in interface Exchange

setAlternateExchange

public void setAlternateExchange(Exchange exchange)
Specified by:
setAlternateExchange in interface Exchange

removeReference

public void removeReference(ExchangeReferrer exchange)
Specified by:
removeReference in interface Exchange

addReference

public void addReference(ExchangeReferrer exchange)
Specified by:
addReference in interface Exchange

hasReferrers

public boolean hasReferrers()
Specified by:
hasReferrers in interface Exchange

addCloseTask

public void addCloseTask(Exchange.Task task)
Specified by:
addCloseTask in interface Exchange

removeCloseTask

public void removeCloseTask(Exchange.Task task)
Specified by:
removeCloseTask in interface Exchange

addBinding

public final void addBinding(Binding binding)
Specified by:
addBinding in interface Exchange

getBindingCountHigh

public long getBindingCountHigh()
Specified by:
getBindingCountHigh in interface ExchangeConfig

removeBinding

public final void removeBinding(Binding binding)
Specified by:
removeBinding in interface Exchange

getBindings

public final Collection<Binding> getBindings()
Specified by:
getBindings in interface Exchange

onBind

protected abstract void onBind(Binding binding)

onUnbind

protected abstract void onUnbind(Binding binding)

getName

public String getName()
Specified by:
getName in interface ExchangeConfig

getType

public ExchangeType getType()
Specified by:
getType in interface ExchangeConfig

getArguments

public Map<String,Object> getArguments()
Specified by:
getArguments in interface ExchangeConfig

getId

public UUID getId()
Specified by:
getId in interface ConfiguredObject<ExchangeConfigType,ExchangeConfig>

getConfigType

public ExchangeConfigType getConfigType()
Specified by:
getConfigType in interface ConfiguredObject<ExchangeConfigType,ExchangeConfig>

getParent

public ConfiguredObject getParent()
Specified by:
getParent in interface ConfiguredObject<ExchangeConfigType,ExchangeConfig>

getBindingCount

public long getBindingCount()
Specified by:
getBindingCount in interface ExchangeConfig

route

public final ArrayList<? extends BaseQueue> route(InboundMessage message)
Specified by:
route in interface Exchange

doRoute

protected abstract ArrayList<? extends BaseQueue> doRoute(InboundMessage message)

getMsgReceives

public long getMsgReceives()
Specified by:
getMsgReceives in interface ExchangeConfig

getMsgRoutes

public long getMsgRoutes()
Specified by:
getMsgRoutes in interface ExchangeConfig

getByteReceives

public long getByteReceives()
Specified by:
getByteReceives in interface ExchangeConfig

getByteRoutes

public long getByteRoutes()
Specified by:
getByteRoutes in interface ExchangeConfig

getCreateTime

public long getCreateTime()
Specified by:
getCreateTime in interface ConfiguredObject<ExchangeConfigType,ExchangeConfig>

addBindingListener

public void addBindingListener(Exchange.BindingListener listener)
Specified by:
addBindingListener in interface Exchange

removeBindingListener

public void removeBindingListener(Exchange.BindingListener listener)
Specified by:
removeBindingListener in interface Exchange


Licensed to the Apache Software Foundation