Spring Integration

org.springframework.integration.gateway
Class GatewayProxyFactoryBean

java.lang.Object
  extended by org.springframework.integration.context.IntegrationObjectSupport
      extended by org.springframework.integration.endpoint.AbstractEndpoint
          extended by org.springframework.integration.gateway.GatewayProxyFactoryBean
All Implemented Interfaces:
org.aopalliance.aop.Advice, org.aopalliance.intercept.Interceptor, org.aopalliance.intercept.MethodInterceptor, org.springframework.beans.factory.Aware, org.springframework.beans.factory.BeanClassLoaderAware, org.springframework.beans.factory.BeanFactoryAware, org.springframework.beans.factory.BeanNameAware, org.springframework.beans.factory.FactoryBean<java.lang.Object>, org.springframework.beans.factory.InitializingBean, org.springframework.context.Lifecycle, org.springframework.context.Phased, org.springframework.context.SmartLifecycle, NamedComponent, TrackableComponent

public class GatewayProxyFactoryBean
extends AbstractEndpoint
implements TrackableComponent, org.springframework.beans.factory.FactoryBean<java.lang.Object>, org.aopalliance.intercept.MethodInterceptor, org.springframework.beans.factory.BeanClassLoaderAware

Generates a proxy for the provided service interface to enable interaction with messaging components without application code being aware of them allowing for POJO-style interaction. This component is also aware of the ConversionService set on the enclosing BeanFactory under the name IntegrationContextUtils.INTEGRATION_CONVERSION_SERVICE_BEAN_NAME to perform type conversions when necessary (thanks to Jon Schneider's contribution and suggestion in INT-1230).

Author:
Mark Fisher, Oleg Zhurakousky, Gary Russell

Field Summary
 
Fields inherited from class org.springframework.integration.context.IntegrationObjectSupport
logger
 
Constructor Summary
GatewayProxyFactoryBean()
          Create a Factory whose service interface type can be configured by setter injection.
GatewayProxyFactoryBean(java.lang.Class<?> serviceInterface)
           
 
Method Summary
protected  void doStart()
          Subclasses must implement this method with the start behavior.
protected  void doStop()
          Subclasses must implement this method with the stop behavior.
 java.lang.Object getObject()
           
 java.lang.Class<?> getObjectType()
           
 java.lang.Object invoke(org.aopalliance.intercept.MethodInvocation invocation)
           
 boolean isSingleton()
           
protected  void onInit()
          Subclasses may implement this for initialization logic.
 void setAsyncExecutor(java.util.concurrent.Executor executor)
           
 void setBeanClassLoader(java.lang.ClassLoader beanClassLoader)
           
 void setDefaultReplyChannel(MessageChannel defaultReplyChannel)
          Set the default reply channel.
 void setDefaultReplyTimeout(long defaultReplyTimeout)
          Set the default timeout value for receiving reply messages.
 void setDefaultRequestChannel(MessageChannel defaultRequestChannel)
          Set the default request channel.
 void setDefaultRequestTimeout(long defaultRequestTimeout)
          Set the default timeout value for sending request messages.
 void setErrorChannel(MessageChannel errorChannel)
          Set the error channel.
 void setMethodMetadataMap(java.util.Map<java.lang.String,org.springframework.integration.gateway.GatewayMethodMetadata> methodMetadataMap)
           
 void setServiceInterface(java.lang.Class<?> serviceInterface)
          Set the interface class that the generated proxy should implement.
 void setShouldTrack(boolean shouldTrack)
           
 void setTypeConverter(org.springframework.beans.TypeConverter typeConverter)
           
 
Methods inherited from class org.springframework.integration.endpoint.AbstractEndpoint
getPhase, isAutoStartup, isRunning, setAutoStartup, setPhase, setTaskScheduler, start, stop, stop
 
Methods inherited from class org.springframework.integration.context.IntegrationObjectSupport
afterPropertiesSet, getBeanFactory, getComponentName, getComponentType, getConversionService, getTaskScheduler, setBeanFactory, setBeanName, setComponentName, setConversionService, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface org.springframework.integration.context.NamedComponent
getComponentName, getComponentType
 

Constructor Detail

GatewayProxyFactoryBean

public GatewayProxyFactoryBean()
Create a Factory whose service interface type can be configured by setter injection. If none is set, it will fall back to the default service interface type, RequestReplyExchanger, upon initialization.


GatewayProxyFactoryBean

public GatewayProxyFactoryBean(java.lang.Class<?> serviceInterface)
Method Detail

setServiceInterface

public void setServiceInterface(java.lang.Class<?> serviceInterface)
Set the interface class that the generated proxy should implement. If none is provided explicitly, the default is RequestReplyExchanger.


setDefaultRequestChannel

public void setDefaultRequestChannel(MessageChannel defaultRequestChannel)
Set the default request channel.

Parameters:
defaultRequestChannel - the channel to which request messages will be sent if no request channel has been configured with an annotation

setDefaultReplyChannel

public void setDefaultReplyChannel(MessageChannel defaultReplyChannel)
Set the default reply channel. If no default reply channel is provided, and no reply channel is configured with annotations, an anonymous, temporary channel will be used for handling replies.

Parameters:
defaultReplyChannel - the channel from which reply messages will be received if no reply channel has been configured with an annotation

setErrorChannel

public void setErrorChannel(MessageChannel errorChannel)
Set the error channel. If no error channel is provided, this gateway will propagate Exceptions to the caller. To completely suppress Exceptions, provide a reference to the "nullChannel" here.


setDefaultRequestTimeout

public void setDefaultRequestTimeout(long defaultRequestTimeout)
Set the default timeout value for sending request messages. If not explicitly configured with an annotation, this value will be used.

Parameters:
defaultRequestTimeout - the timeout value in milliseconds

setDefaultReplyTimeout

public void setDefaultReplyTimeout(long defaultReplyTimeout)
Set the default timeout value for receiving reply messages. If not explicitly configured with an annotation, this value will be used.

Parameters:
defaultReplyTimeout - the timeout value in milliseconds

setShouldTrack

public void setShouldTrack(boolean shouldTrack)
Specified by:
setShouldTrack in interface TrackableComponent

setAsyncExecutor

public void setAsyncExecutor(java.util.concurrent.Executor executor)

setTypeConverter

public void setTypeConverter(org.springframework.beans.TypeConverter typeConverter)

setMethodMetadataMap

public void setMethodMetadataMap(java.util.Map<java.lang.String,org.springframework.integration.gateway.GatewayMethodMetadata> methodMetadataMap)

setBeanClassLoader

public void setBeanClassLoader(java.lang.ClassLoader beanClassLoader)
Specified by:
setBeanClassLoader in interface org.springframework.beans.factory.BeanClassLoaderAware

onInit

protected void onInit()
Description copied from class: IntegrationObjectSupport
Subclasses may implement this for initialization logic.

Overrides:
onInit in class IntegrationObjectSupport

getObjectType

public java.lang.Class<?> getObjectType()
Specified by:
getObjectType in interface org.springframework.beans.factory.FactoryBean<java.lang.Object>

getObject

public java.lang.Object getObject()
                           throws java.lang.Exception
Specified by:
getObject in interface org.springframework.beans.factory.FactoryBean<java.lang.Object>
Throws:
java.lang.Exception

isSingleton

public boolean isSingleton()
Specified by:
isSingleton in interface org.springframework.beans.factory.FactoryBean<java.lang.Object>

invoke

public java.lang.Object invoke(org.aopalliance.intercept.MethodInvocation invocation)
                        throws java.lang.Throwable
Specified by:
invoke in interface org.aopalliance.intercept.MethodInterceptor
Throws:
java.lang.Throwable

doStart

protected void doStart()
Description copied from class: AbstractEndpoint
Subclasses must implement this method with the start behavior. This method will be invoked while holding the AbstractEndpoint.lifecycleLock.

Specified by:
doStart in class AbstractEndpoint

doStop

protected void doStop()
Description copied from class: AbstractEndpoint
Subclasses must implement this method with the stop behavior. This method will be invoked while holding the AbstractEndpoint.lifecycleLock.

Specified by:
doStop in class AbstractEndpoint

Spring Integration