org.apache.servicemix.client
Class DefaultServiceMixClient

java.lang.Object
  extended by org.apache.servicemix.jbi.management.BaseLifeCycle
      extended by org.apache.servicemix.components.util.PojoSupport
          extended by org.apache.servicemix.components.util.ComponentSupport
              extended by org.apache.servicemix.client.DefaultServiceMixClient
All Implemented Interfaces:
javax.jbi.component.Component, javax.jbi.component.ComponentLifeCycle, javax.jbi.management.LifeCycleMBean, org.apache.servicemix.jbi.api.ServiceMixClient, MBeanInfoProvider
Direct Known Subclasses:
RemoteServiceMixClient

public class DefaultServiceMixClient
extends ComponentSupport
implements ServiceMixClient

The default implementation of the ServiceMixClient API.

Version:
$Revision: 690848 $

Field Summary
 
Fields inherited from class org.apache.servicemix.components.util.PojoSupport
logger
 
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
protected DefaultServiceMixClient()
           
  DefaultServiceMixClient(JBIContainer container)
          Provides the JBI container used for message dispatch.
  DefaultServiceMixClient(JBIContainer container, ActivationSpec activationSpec)
          Provides the JBI container and the activation specification, which can be used to register this client at a specific endpoint so that default container routing rules can be configured via dependency injection and the client endpoint metadata can be configured to allow services to talk to this client.
 
Method Summary
 void close()
           
protected  void configureEndpoint(javax.jbi.messaging.MessageExchange exchange, EndpointResolver resolver)
           
protected  void configureEndpoint(javax.jbi.messaging.MessageExchange exchange, org.apache.servicemix.jbi.api.EndpointResolver resolver)
           
 Destination createDestination(String uri)
           
 javax.jbi.messaging.InOnly createInOnlyExchange()
           
 javax.jbi.messaging.InOnly createInOnlyExchange(EndpointResolver resolver)
           
 javax.jbi.messaging.InOnly createInOnlyExchange(org.apache.servicemix.jbi.api.EndpointResolver resolver)
           
 javax.jbi.messaging.InOptionalOut createInOptionalOutExchange()
           
 javax.jbi.messaging.InOptionalOut createInOptionalOutExchange(EndpointResolver resolver)
           
 javax.jbi.messaging.InOptionalOut createInOptionalOutExchange(org.apache.servicemix.jbi.api.EndpointResolver resolver)
           
 javax.jbi.messaging.InOut createInOutExchange()
           
 javax.jbi.messaging.InOut createInOutExchange(EndpointResolver resolver)
           
 javax.jbi.messaging.InOut createInOutExchange(org.apache.servicemix.jbi.api.EndpointResolver resolver)
           
 EndpointResolver createResolverForExternalInterface(QName interfaceName)
           
 EndpointResolver createResolverForExternalInterface(QName service, String endpoint)
           
 EndpointResolver createResolverForExternalService(QName service)
           
 EndpointResolver createResolverForService(QName service)
           
 EndpointResolver createResolverInterface(QName interfaceName)
           
 javax.jbi.messaging.RobustInOnly createRobustInOnlyExchange()
           
 javax.jbi.messaging.RobustInOnly createRobustInOnlyExchange(EndpointResolver resolver)
           
 javax.jbi.messaging.RobustInOnly createRobustInOnlyExchange(org.apache.servicemix.jbi.api.EndpointResolver resolver)
           
 void done(javax.jbi.messaging.MessageExchange exchange)
          A helper method to indicate that the message exchange is complete which will set the status to ExchangeStatus.DONE and send the message on the delivery channel.
 void fail(javax.jbi.messaging.MessageExchange exchange, Exception error)
          A helper method which fails and completes the given exchange with the specified error
 void fail(javax.jbi.messaging.MessageExchange exchange, javax.jbi.messaging.Fault fault)
          A helper method which fails and completes the given exchange with the specified fault
 javax.jbi.component.ComponentContext getContext()
           
 javax.jbi.messaging.DeliveryChannel getDeliveryChannel()
           
 javax.jbi.messaging.MessageExchangeFactory getExchangeFactory()
          Provide access to the default message exchange exchangeFactory, lazily creating one.
 EndpointFilter getFilter()
           
 PojoMarshaler getMarshaler()
           
protected  void populateExchangeProperties(javax.jbi.messaging.MessageExchange exchange, Map properties)
           
protected  void populateMessage(javax.jbi.messaging.MessageExchange exchange, Map exchangeProperties, Map inMessageProperties, Object content)
           
protected  void populateMessageProperties(javax.jbi.messaging.NormalizedMessage message, Map properties)
           
 javax.jbi.messaging.MessageExchange receive()
           
 javax.jbi.messaging.MessageExchange receive(long timeout)
           
 Object request(EndpointResolver resolver, Map exchangeProperties, Map inMessageProperties, Object content)
           
 Object request(org.apache.servicemix.jbi.api.EndpointResolver resolver, Map exchangeProperties, Map inMessageProperties, Object content)
           
 Object request(Map inMessageProperties, Object content)
           
 javax.jbi.servicedesc.ServiceEndpoint resolveEndpointReference(String uri)
          Resolves a WS-Addressing endpoint reference String into a JBI ServiceEndpoint reference so that message exchanges can be directed to an endpoint
 void send(EndpointResolver resolver, Map exchangeProperties, Map inMessageProperties, Object content)
           
 void send(org.apache.servicemix.jbi.api.EndpointResolver resolver, Map exchangeProperties, Map inMessageProperties, Object content)
           
 void send(Map inMessageProperties, Object content)
           
 void send(org.apache.servicemix.jbi.api.Message message)
           
 void send(Message message)
           
 void send(javax.jbi.messaging.MessageExchange exchange)
           
 boolean sendSync(EndpointResolver resolver, Map exchangeProperties, Map inMessageProperties, Object content)
           
 boolean sendSync(org.apache.servicemix.jbi.api.EndpointResolver resolver, Map exchangeProperties, Map inMessageProperties, Object content)
           
 boolean sendSync(Map inMessageProperties, Object content)
           
 boolean sendSync(javax.jbi.messaging.MessageExchange exchange)
           
 boolean sendSync(javax.jbi.messaging.MessageExchange exchange, long timeout)
           
 void setFilter(EndpointFilter filter)
          Sets the filter used to exclude possible endpoints based on their capabilities
 void setMarshaler(PojoMarshaler marshaler)
          Sets the marshaler used to convert objects which are not already JAXP Source instances into the normalized message content.
 
Methods inherited from class org.apache.servicemix.components.util.ComponentSupport
createComponentLifeCycle, createInOnlyExchange, createInOnlyExchange, createInOnlyExchange, createInOptionalOutExchange, createInOutExchange, createInOutExchange, createRobustInOnlyExchange, createServiceUnitManager, creatInOutExchange, forwardToExchange, forwardToExchange, getInMessage, getLifeCycle, getMessageTransformer, getServiceDescription, getServiceUnitManager, initializeServiceUnitManager, invoke, isExchangeWithConsumerOkay, isExchangeWithProviderOkay, propagateCorrelationId, resolveEndpointReference, setMessageTransformer
 
Methods inherited from class org.apache.servicemix.components.util.PojoSupport
answer, getBody, getDescription, getEndpoint, getExtensionMBeanName, getService, init, init, isInAndOut, setBody, setEndpoint, setExtensionMBeanName, setService, shutDown
 
Methods inherited from class org.apache.servicemix.jbi.management.BaseLifeCycle
firePropertyChanged, getAttributeInfos, getCurrentState, getName, getObjectToManage, getOperationInfos, getSubType, getType, isInitialized, isShutDown, isStarted, isStopped, isUnknown, setCurrentState, setPropertyChangeListener, start, stop
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface javax.jbi.component.ComponentLifeCycle
start, stop
 

Constructor Detail

DefaultServiceMixClient

protected DefaultServiceMixClient()

DefaultServiceMixClient

public DefaultServiceMixClient(JBIContainer container)
                        throws javax.jbi.JBIException
Provides the JBI container used for message dispatch.

Throws:
javax.jbi.JBIException

DefaultServiceMixClient

public DefaultServiceMixClient(JBIContainer container,
                               ActivationSpec activationSpec)
                        throws javax.jbi.JBIException
Provides the JBI container and the activation specification, which can be used to register this client at a specific endpoint so that default container routing rules can be configured via dependency injection and the client endpoint metadata can be configured to allow services to talk to this client.

Throws:
javax.jbi.JBIException
Method Detail

createInOnlyExchange

public javax.jbi.messaging.InOnly createInOnlyExchange()
                                                throws javax.jbi.messaging.MessagingException
Specified by:
createInOnlyExchange in interface org.apache.servicemix.jbi.api.ServiceMixClient
Throws:
javax.jbi.messaging.MessagingException

createInOnlyExchange

public javax.jbi.messaging.InOnly createInOnlyExchange(EndpointResolver resolver)
                                                throws javax.jbi.JBIException
Throws:
javax.jbi.JBIException

createInOutExchange

public javax.jbi.messaging.InOut createInOutExchange()
                                              throws javax.jbi.messaging.MessagingException
Specified by:
createInOutExchange in interface org.apache.servicemix.jbi.api.ServiceMixClient
Throws:
javax.jbi.messaging.MessagingException

createInOutExchange

public javax.jbi.messaging.InOut createInOutExchange(EndpointResolver resolver)
                                              throws javax.jbi.JBIException
Throws:
javax.jbi.JBIException

createInOptionalOutExchange

public javax.jbi.messaging.InOptionalOut createInOptionalOutExchange()
                                                              throws javax.jbi.messaging.MessagingException
Specified by:
createInOptionalOutExchange in interface org.apache.servicemix.jbi.api.ServiceMixClient
Throws:
javax.jbi.messaging.MessagingException

createInOptionalOutExchange

public javax.jbi.messaging.InOptionalOut createInOptionalOutExchange(EndpointResolver resolver)
                                                              throws javax.jbi.JBIException
Throws:
javax.jbi.JBIException

createRobustInOnlyExchange

public javax.jbi.messaging.RobustInOnly createRobustInOnlyExchange()
                                                            throws javax.jbi.messaging.MessagingException
Specified by:
createRobustInOnlyExchange in interface org.apache.servicemix.jbi.api.ServiceMixClient
Throws:
javax.jbi.messaging.MessagingException

createRobustInOnlyExchange

public javax.jbi.messaging.RobustInOnly createRobustInOnlyExchange(EndpointResolver resolver)
                                                            throws javax.jbi.JBIException
Throws:
javax.jbi.JBIException

createDestination

public Destination createDestination(String uri)
                              throws javax.jbi.messaging.MessagingException
Specified by:
createDestination in interface org.apache.servicemix.jbi.api.ServiceMixClient
Throws:
javax.jbi.messaging.MessagingException

send

public void send(javax.jbi.messaging.MessageExchange exchange)
          throws javax.jbi.messaging.MessagingException
Specified by:
send in interface org.apache.servicemix.jbi.api.ServiceMixClient
Overrides:
send in class PojoSupport
Throws:
javax.jbi.messaging.MessagingException

send

public void send(org.apache.servicemix.jbi.api.Message message)
          throws javax.jbi.messaging.MessagingException
Specified by:
send in interface org.apache.servicemix.jbi.api.ServiceMixClient
Throws:
javax.jbi.messaging.MessagingException

sendSync

public boolean sendSync(javax.jbi.messaging.MessageExchange exchange)
                 throws javax.jbi.messaging.MessagingException
Specified by:
sendSync in interface org.apache.servicemix.jbi.api.ServiceMixClient
Overrides:
sendSync in class PojoSupport
Throws:
javax.jbi.messaging.MessagingException

sendSync

public boolean sendSync(javax.jbi.messaging.MessageExchange exchange,
                        long timeout)
                 throws javax.jbi.messaging.MessagingException
Specified by:
sendSync in interface org.apache.servicemix.jbi.api.ServiceMixClient
Overrides:
sendSync in class PojoSupport
Throws:
javax.jbi.messaging.MessagingException

receive

public javax.jbi.messaging.MessageExchange receive()
                                            throws javax.jbi.messaging.MessagingException
Specified by:
receive in interface org.apache.servicemix.jbi.api.ServiceMixClient
Throws:
javax.jbi.messaging.MessagingException

receive

public javax.jbi.messaging.MessageExchange receive(long timeout)
                                            throws javax.jbi.messaging.MessagingException
Specified by:
receive in interface org.apache.servicemix.jbi.api.ServiceMixClient
Throws:
javax.jbi.messaging.MessagingException

getContext

public javax.jbi.component.ComponentContext getContext()
Specified by:
getContext in interface org.apache.servicemix.jbi.api.ServiceMixClient
Overrides:
getContext in class PojoSupport

getDeliveryChannel

public javax.jbi.messaging.DeliveryChannel getDeliveryChannel()
                                                       throws javax.jbi.messaging.MessagingException
Specified by:
getDeliveryChannel in interface org.apache.servicemix.jbi.api.ServiceMixClient
Overrides:
getDeliveryChannel in class PojoSupport
Throws:
javax.jbi.messaging.MessagingException

getExchangeFactory

public javax.jbi.messaging.MessageExchangeFactory getExchangeFactory()
                                                              throws javax.jbi.messaging.MessagingException
Description copied from class: PojoSupport
Provide access to the default message exchange exchangeFactory, lazily creating one.

Specified by:
getExchangeFactory in interface org.apache.servicemix.jbi.api.ServiceMixClient
Overrides:
getExchangeFactory in class PojoSupport
Throws:
javax.jbi.messaging.MessagingException

done

public void done(javax.jbi.messaging.MessageExchange exchange)
          throws javax.jbi.messaging.MessagingException
Description copied from class: PojoSupport
A helper method to indicate that the message exchange is complete which will set the status to ExchangeStatus.DONE and send the message on the delivery channel.

Specified by:
done in interface org.apache.servicemix.jbi.api.ServiceMixClient
Overrides:
done in class PojoSupport
Throws:
javax.jbi.messaging.MessagingException

fail

public void fail(javax.jbi.messaging.MessageExchange exchange,
                 javax.jbi.messaging.Fault fault)
          throws javax.jbi.messaging.MessagingException
Description copied from class: PojoSupport
A helper method which fails and completes the given exchange with the specified fault

Specified by:
fail in interface org.apache.servicemix.jbi.api.ServiceMixClient
Overrides:
fail in class PojoSupport
Throws:
javax.jbi.messaging.MessagingException

fail

public void fail(javax.jbi.messaging.MessageExchange exchange,
                 Exception error)
          throws javax.jbi.messaging.MessagingException
Description copied from class: PojoSupport
A helper method which fails and completes the given exchange with the specified error

Specified by:
fail in interface org.apache.servicemix.jbi.api.ServiceMixClient
Overrides:
fail in class PojoSupport
Throws:
javax.jbi.messaging.MessagingException

request

public Object request(Map inMessageProperties,
                      Object content)
               throws javax.jbi.JBIException
Specified by:
request in interface org.apache.servicemix.jbi.api.ServiceMixClient
Throws:
javax.jbi.JBIException

send

public void send(Map inMessageProperties,
                 Object content)
          throws javax.jbi.JBIException
Specified by:
send in interface org.apache.servicemix.jbi.api.ServiceMixClient
Throws:
javax.jbi.JBIException

sendSync

public boolean sendSync(Map inMessageProperties,
                        Object content)
                 throws javax.jbi.JBIException
Specified by:
sendSync in interface org.apache.servicemix.jbi.api.ServiceMixClient
Throws:
javax.jbi.JBIException

send

public void send(EndpointResolver resolver,
                 Map exchangeProperties,
                 Map inMessageProperties,
                 Object content)
          throws javax.jbi.JBIException
Throws:
javax.jbi.JBIException

sendSync

public boolean sendSync(EndpointResolver resolver,
                        Map exchangeProperties,
                        Map inMessageProperties,
                        Object content)
                 throws javax.jbi.JBIException
Throws:
javax.jbi.JBIException

request

public Object request(EndpointResolver resolver,
                      Map exchangeProperties,
                      Map inMessageProperties,
                      Object content)
               throws javax.jbi.JBIException
Throws:
javax.jbi.JBIException

resolveEndpointReference

public javax.jbi.servicedesc.ServiceEndpoint resolveEndpointReference(String uri)
Resolves a WS-Addressing endpoint reference String into a JBI ServiceEndpoint reference so that message exchanges can be directed to an endpoint

Specified by:
resolveEndpointReference in interface org.apache.servicemix.jbi.api.ServiceMixClient

createResolverForService

public EndpointResolver createResolverForService(QName service)
Specified by:
createResolverForService in interface org.apache.servicemix.jbi.api.ServiceMixClient

createResolverInterface

public EndpointResolver createResolverInterface(QName interfaceName)
Specified by:
createResolverInterface in interface org.apache.servicemix.jbi.api.ServiceMixClient

createResolverForExternalService

public EndpointResolver createResolverForExternalService(QName service)
Specified by:
createResolverForExternalService in interface org.apache.servicemix.jbi.api.ServiceMixClient

createResolverForExternalInterface

public EndpointResolver createResolverForExternalInterface(QName interfaceName)
Specified by:
createResolverForExternalInterface in interface org.apache.servicemix.jbi.api.ServiceMixClient

createResolverForExternalInterface

public EndpointResolver createResolverForExternalInterface(QName service,
                                                           String endpoint)
Specified by:
createResolverForExternalInterface in interface org.apache.servicemix.jbi.api.ServiceMixClient

close

public void close()
           throws javax.jbi.JBIException
Specified by:
close in interface org.apache.servicemix.jbi.api.ServiceMixClient
Throws:
javax.jbi.JBIException

getFilter

public EndpointFilter getFilter()

setFilter

public void setFilter(EndpointFilter filter)
Sets the filter used to exclude possible endpoints based on their capabilities

Parameters:
filter -

getMarshaler

public PojoMarshaler getMarshaler()

setMarshaler

public void setMarshaler(PojoMarshaler marshaler)
Sets the marshaler used to convert objects which are not already JAXP Source instances into the normalized message content.

Parameters:
marshaler -

configureEndpoint

protected void configureEndpoint(javax.jbi.messaging.MessageExchange exchange,
                                 EndpointResolver resolver)
                          throws javax.jbi.JBIException
Throws:
javax.jbi.JBIException

populateMessage

protected void populateMessage(javax.jbi.messaging.MessageExchange exchange,
                               Map exchangeProperties,
                               Map inMessageProperties,
                               Object content)
                        throws javax.jbi.messaging.MessagingException
Throws:
javax.jbi.messaging.MessagingException

populateExchangeProperties

protected void populateExchangeProperties(javax.jbi.messaging.MessageExchange exchange,
                                          Map properties)

populateMessageProperties

protected void populateMessageProperties(javax.jbi.messaging.NormalizedMessage message,
                                         Map properties)

send

public void send(Message message)
          throws javax.jbi.messaging.MessagingException
Throws:
javax.jbi.messaging.MessagingException

createInOnlyExchange

public javax.jbi.messaging.InOnly createInOnlyExchange(org.apache.servicemix.jbi.api.EndpointResolver resolver)
                                                throws javax.jbi.JBIException
Specified by:
createInOnlyExchange in interface org.apache.servicemix.jbi.api.ServiceMixClient
Throws:
javax.jbi.JBIException

createInOptionalOutExchange

public javax.jbi.messaging.InOptionalOut createInOptionalOutExchange(org.apache.servicemix.jbi.api.EndpointResolver resolver)
                                                              throws javax.jbi.JBIException
Specified by:
createInOptionalOutExchange in interface org.apache.servicemix.jbi.api.ServiceMixClient
Throws:
javax.jbi.JBIException

createInOutExchange

public javax.jbi.messaging.InOut createInOutExchange(org.apache.servicemix.jbi.api.EndpointResolver resolver)
                                              throws javax.jbi.JBIException
Specified by:
createInOutExchange in interface org.apache.servicemix.jbi.api.ServiceMixClient
Throws:
javax.jbi.JBIException

createRobustInOnlyExchange

public javax.jbi.messaging.RobustInOnly createRobustInOnlyExchange(org.apache.servicemix.jbi.api.EndpointResolver resolver)
                                                            throws javax.jbi.JBIException
Specified by:
createRobustInOnlyExchange in interface org.apache.servicemix.jbi.api.ServiceMixClient
Throws:
javax.jbi.JBIException

request

public Object request(org.apache.servicemix.jbi.api.EndpointResolver resolver,
                      Map exchangeProperties,
                      Map inMessageProperties,
                      Object content)
               throws javax.jbi.JBIException
Specified by:
request in interface org.apache.servicemix.jbi.api.ServiceMixClient
Throws:
javax.jbi.JBIException

send

public void send(org.apache.servicemix.jbi.api.EndpointResolver resolver,
                 Map exchangeProperties,
                 Map inMessageProperties,
                 Object content)
          throws javax.jbi.JBIException
Specified by:
send in interface org.apache.servicemix.jbi.api.ServiceMixClient
Throws:
javax.jbi.JBIException

sendSync

public boolean sendSync(org.apache.servicemix.jbi.api.EndpointResolver resolver,
                        Map exchangeProperties,
                        Map inMessageProperties,
                        Object content)
                 throws javax.jbi.JBIException
Specified by:
sendSync in interface org.apache.servicemix.jbi.api.ServiceMixClient
Throws:
javax.jbi.JBIException

configureEndpoint

protected void configureEndpoint(javax.jbi.messaging.MessageExchange exchange,
                                 org.apache.servicemix.jbi.api.EndpointResolver resolver)
                          throws javax.jbi.JBIException
Throws:
javax.jbi.JBIException


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