org.apache.servicemix.jbi.nmr
Class DefaultBroker

java.lang.Object
  extended by org.apache.servicemix.jbi.management.BaseLifeCycle
      extended by org.apache.servicemix.jbi.management.BaseSystemService
          extended by org.apache.servicemix.jbi.nmr.DefaultBroker
All Implemented Interfaces:
javax.jbi.management.LifeCycleMBean, MBeanInfoProvider, Broker, BrokerMBean
Direct Known Subclasses:
SecuredBroker

public class DefaultBroker
extends BaseSystemService
implements Broker

The Broker handles Nomalised Message Routing within ServiceMix

Version:
$Revision: 384328 $

Field Summary
 
Fields inherited from class org.apache.servicemix.jbi.management.BaseSystemService
container
 
Fields inherited from class org.apache.servicemix.jbi.management.BaseLifeCycle
currentState, INITIALIZED, listener
 
Fields inherited from interface javax.jbi.management.LifeCycleMBean
SHUTDOWN, STARTED, STOPPED, UNKNOWN
 
Constructor Summary
DefaultBroker()
          Constructor
 
Method Summary
protected  EndpointFilter createEndpointFilter(ComponentContextImpl context, MessageExchangeImpl exchange)
          Factory method to create an endpoint filter for the given component context and message exchange
 JBIContainer getContainer()
           
 String getContainerName()
          Get the name of the Container
 FlowChooser getDefaultFlowChooser()
           
 EndpointChooser getDefaultInterfaceChooser()
           
 EndpointChooser getDefaultServiceChooser()
           
 String getDescription()
          Get the description
 String getFlowNames()
           
 Flow[] getFlows()
           
protected  EndpointChooser getInterfaceChooser(MessageExchangeImpl exchange)
          Returns the endpoint chooser for endpoints found by service which will use the chooser on the exchange's activation spec if available otherwise will use the default
 ManagementContext getManagementContext()
          Get the ManagementContext
protected  javax.jbi.servicedesc.ServiceEndpoint[] getMatchingEndpoints(javax.jbi.servicedesc.ServiceEndpoint[] endpoints, MessageExchangeImpl exchange)
          Filter the given endpoints by asking to the provider and consumer if they are both ok to process the exchange.
 MBeanOperationInfo[] getOperationInfos()
          Get an array of MBeanOperationInfo
 Registry getRegistry()
          Get the Registry
protected  EndpointChooser getServiceChooser(MessageExchangeImpl exchange)
          Returns the endpoint chooser for endpoints found by service which will use the chooser on the exchange's activation spec if available otherwise will use the default
protected  Class<BrokerMBean> getServiceMBean()
           
 String getSubscriptionFlowName()
           
 SubscriptionManager getSubscriptionManager()
           
 void init(JBIContainer container)
          initialize the broker
protected  void resolveAddress(MessageExchangeImpl exchange)
           
 void resume()
          resume message exchange processing
 void sendExchangePacket(javax.jbi.messaging.MessageExchange me)
          Route an ExchangePacket to a destination
 void setDefaultFlowChooser(FlowChooser defaultFlowChooser)
           
 void setDefaultInterfaceChooser(EndpointChooser defaultInterfaceChooser)
          Set the default EndpointChooser
 void setDefaultServiceChooser(EndpointChooser defaultServiceChooser)
          Set default EndpointChooser
 void setFlowNames(String flowNames)
           
 void setFlows(Flow[] flows)
          Set the flow
 void setSubscriptionFlowName(String subscriptionFlowName)
          Set the subscription flow name
 void setSubscriptionManager(SubscriptionManager subscriptionManager)
          Sets the subscription manager
 void shutDown()
          shutdown all Components
 void start()
          start brokering
 void stop()
          stop brokering
 void suspend()
          suspend the flow to prevent any message exchanges
 
Methods inherited from class org.apache.servicemix.jbi.management.BaseSystemService
getName, getType
 
Methods inherited from class org.apache.servicemix.jbi.management.BaseLifeCycle
firePropertyChanged, getAttributeInfos, getCurrentState, getObjectToManage, getSubType, init, isInitialized, isShutDown, isStarted, isStopped, isUnknown, setCurrentState, setPropertyChangeListener
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface javax.jbi.management.LifeCycleMBean
getCurrentState
 

Constructor Detail

DefaultBroker

public DefaultBroker()
Constructor

Method Detail

getDescription

public String getDescription()
Get the description

Specified by:
getDescription in interface MBeanInfoProvider
Returns:
description

getSubscriptionManager

public SubscriptionManager getSubscriptionManager()

setSubscriptionManager

public void setSubscriptionManager(SubscriptionManager subscriptionManager)
Sets the subscription manager


init

public void init(JBIContainer container)
          throws javax.jbi.JBIException
initialize the broker

Specified by:
init in interface Broker
Overrides:
init in class BaseSystemService
Parameters:
container -
Throws:
javax.jbi.JBIException

getServiceMBean

protected Class<BrokerMBean> getServiceMBean()
Specified by:
getServiceMBean in class BaseSystemService

getContainerName

public String getContainerName()
Get the name of the Container

Returns:
containerName

getManagementContext

public ManagementContext getManagementContext()
Get the ManagementContext

Returns:
the managementContext

getRegistry

public Registry getRegistry()
Get the Registry

Returns:
the registry

start

public void start()
           throws javax.jbi.JBIException
start brokering

Specified by:
start in interface javax.jbi.management.LifeCycleMBean
Overrides:
start in class BaseLifeCycle
Throws:
javax.jbi.JBIException

stop

public void stop()
          throws javax.jbi.JBIException
stop brokering

Specified by:
stop in interface javax.jbi.management.LifeCycleMBean
Overrides:
stop in class BaseLifeCycle
Throws:
javax.jbi.JBIException

shutDown

public void shutDown()
              throws javax.jbi.JBIException
shutdown all Components

Specified by:
shutDown in interface javax.jbi.management.LifeCycleMBean
Overrides:
shutDown in class BaseSystemService
Throws:
javax.jbi.JBIException

getFlowNames

public String getFlowNames()
Returns:
Returns the flow.

setFlowNames

public void setFlowNames(String flowNames)
Parameters:
flowName - The flow to set.

getSubscriptionFlowName

public String getSubscriptionFlowName()
Returns:
the subscriptionFlowName

setSubscriptionFlowName

public void setSubscriptionFlowName(String subscriptionFlowName)
Set the subscription flow name

Parameters:
subscriptionFlowName -

setFlows

public void setFlows(Flow[] flows)
Set the flow

Parameters:
flow -

getFlows

public Flow[] getFlows()
Returns:
the Flow

suspend

public void suspend()
suspend the flow to prevent any message exchanges

Specified by:
suspend in interface Broker

resume

public void resume()
resume message exchange processing

Specified by:
resume in interface Broker

sendExchangePacket

public void sendExchangePacket(javax.jbi.messaging.MessageExchange me)
                        throws javax.jbi.JBIException
Route an ExchangePacket to a destination

Specified by:
sendExchangePacket in interface Broker
Parameters:
exchange -
Throws:
javax.jbi.JBIException

resolveAddress

protected void resolveAddress(MessageExchangeImpl exchange)
                       throws javax.jbi.JBIException
Throws:
javax.jbi.JBIException

getMatchingEndpoints

protected javax.jbi.servicedesc.ServiceEndpoint[] getMatchingEndpoints(javax.jbi.servicedesc.ServiceEndpoint[] endpoints,
                                                                       MessageExchangeImpl exchange)
Filter the given endpoints by asking to the provider and consumer if they are both ok to process the exchange.

Parameters:
endpoints - an array of internal endpoints to check
exchange - the exchange that will be serviced
Returns:
an array of endpoints on which both consumer and provider agrees

getDefaultInterfaceChooser

public EndpointChooser getDefaultInterfaceChooser()
Returns:
the default EndpointChooser

setDefaultInterfaceChooser

public void setDefaultInterfaceChooser(EndpointChooser defaultInterfaceChooser)
Set the default EndpointChooser

Parameters:
defaultInterfaceChooser -

getDefaultServiceChooser

public EndpointChooser getDefaultServiceChooser()
Returns:
the default EndpointChooser

setDefaultServiceChooser

public void setDefaultServiceChooser(EndpointChooser defaultServiceChooser)
Set default EndpointChooser

Parameters:
defaultServiceChooser -

getDefaultFlowChooser

public FlowChooser getDefaultFlowChooser()
Returns:
the defaultFlowChooser

setDefaultFlowChooser

public void setDefaultFlowChooser(FlowChooser defaultFlowChooser)
Parameters:
defaultFlowChooser - the defaultFlowChooser to set

getServiceChooser

protected EndpointChooser getServiceChooser(MessageExchangeImpl exchange)
Returns the endpoint chooser for endpoints found by service which will use the chooser on the exchange's activation spec if available otherwise will use the default

Parameters:
exchange -
Returns:
the EndpointChooser

getInterfaceChooser

protected EndpointChooser getInterfaceChooser(MessageExchangeImpl exchange)
Returns the endpoint chooser for endpoints found by service which will use the chooser on the exchange's activation spec if available otherwise will use the default

Parameters:
exchange -
Returns:
the EndpointChooser

createEndpointFilter

protected EndpointFilter createEndpointFilter(ComponentContextImpl context,
                                              MessageExchangeImpl exchange)
Factory method to create an endpoint filter for the given component context and message exchange

Parameters:
context -
exchange -
Returns:
the EndpointFilter

getOperationInfos

public MBeanOperationInfo[] getOperationInfos()
                                       throws JMException
Get an array of MBeanOperationInfo

Specified by:
getOperationInfos in interface MBeanInfoProvider
Overrides:
getOperationInfos in class BaseLifeCycle
Returns:
array of OperationInfos
Throws:
JMException

getContainer

public JBIContainer getContainer()
Specified by:
getContainer in interface Broker
Overrides:
getContainer in class BaseSystemService


Copyright © 2005-2008 Apache Software Foundation. All Rights Reserved.