org.apache.servicemix.client
Class ServiceMixClientFacade

java.lang.Object
  extended by org.apache.servicemix.client.ServiceMixClientFacade
All Implemented Interfaces:
org.apache.servicemix.jbi.api.ServiceMixClient

public class ServiceMixClientFacade
extends Object
implements ServiceMixClient

A Facade around the ComponentContext to provide the ServiceMixClient API which is useful for working with JBI from inside a POJO based JBI Component which doesn't derive from PojoSupport

Version:
$Revision: 690190 $

Constructor Summary
ServiceMixClientFacade(javax.jbi.component.ComponentContext context)
           
ServiceMixClientFacade(JBIContainer container)
          Provides the JBI container used for message dispatch.
ServiceMixClientFacade(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, org.apache.servicemix.jbi.api.EndpointResolver resolver)
           
 Destination createDestination(String uri)
           
 javax.jbi.messaging.InOnly createInOnlyExchange()
           
 javax.jbi.messaging.InOnly createInOnlyExchange(org.apache.servicemix.jbi.api.EndpointResolver resolver)
           
 javax.jbi.messaging.InOptionalOut createInOptionalOutExchange()
           
 javax.jbi.messaging.InOptionalOut createInOptionalOutExchange(org.apache.servicemix.jbi.api.EndpointResolver resolver)
           
 javax.jbi.messaging.InOut createInOutExchange()
           
 javax.jbi.messaging.InOut createInOutExchange(org.apache.servicemix.jbi.api.EndpointResolver resolver)
           
 org.apache.servicemix.jbi.api.EndpointResolver createResolverForExternalInterface(QName interfaceName)
           
 org.apache.servicemix.jbi.api.EndpointResolver createResolverForExternalInterface(QName service, String endpoint)
           
 org.apache.servicemix.jbi.api.EndpointResolver createResolverForExternalService(QName service)
           
 org.apache.servicemix.jbi.api.EndpointResolver createResolverForService(QName service)
           
 org.apache.servicemix.jbi.api.EndpointResolver createResolverInterface(QName interfaceName)
           
 javax.jbi.messaging.RobustInOnly createRobustInOnlyExchange()
           
 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(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)
           
 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(javax.jbi.messaging.MessageExchange exchange)
           
 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 java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ServiceMixClientFacade

public ServiceMixClientFacade(javax.jbi.component.ComponentContext context)

ServiceMixClientFacade

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

Throws:
javax.jbi.JBIException

ServiceMixClientFacade

public ServiceMixClientFacade(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(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

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(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

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(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

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(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

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
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
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
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

getDeliveryChannel

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

getExchangeFactory

public javax.jbi.messaging.MessageExchangeFactory getExchangeFactory()
                                                              throws javax.jbi.messaging.MessagingException
Provide access to the default message exchange exchangeFactory, lazily creating one.

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

done

public void done(javax.jbi.messaging.MessageExchange exchange)
          throws javax.jbi.messaging.MessagingException
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
Parameters:
exchange -
Throws:
javax.jbi.messaging.MessagingException

fail

public void fail(javax.jbi.messaging.MessageExchange exchange,
                 javax.jbi.messaging.Fault fault)
          throws javax.jbi.messaging.MessagingException
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
Throws:
javax.jbi.messaging.MessagingException

fail

public void fail(javax.jbi.messaging.MessageExchange exchange,
                 Exception error)
          throws javax.jbi.messaging.MessagingException
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
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(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

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

resolveEndpointReference

public javax.jbi.servicedesc.ServiceEndpoint resolveEndpointReference(String uri)
Specified by:
resolveEndpointReference in interface org.apache.servicemix.jbi.api.ServiceMixClient

createResolverForService

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

createResolverInterface

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

createResolverForExternalService

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

createResolverForExternalInterface

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

createResolverForExternalInterface

public org.apache.servicemix.jbi.api.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,
                                 org.apache.servicemix.jbi.api.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)


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