org.springframework.integration.endpoint
Class AbstractEndpoint

java.lang.Object
  extended by org.springframework.integration.endpoint.AbstractEndpoint
All Implemented Interfaces:
org.springframework.beans.factory.BeanNameAware, MessageEndpoint, MessageTarget
Direct Known Subclasses:
AbstractRequestReplyEndpoint, InboundChannelAdapter, OutboundChannelAdapter

public abstract class AbstractEndpoint
extends java.lang.Object
implements MessageEndpoint, org.springframework.beans.factory.BeanNameAware

The base class for Message Endpoint implementations.

Author:
Mark Fisher

Field Summary
private  ErrorHandler errorHandler
           
protected  org.apache.commons.logging.Log logger
           
private  MessageExchangeTemplate messageExchangeTemplate
           
private  java.lang.String name
           
private  Schedule schedule
           
private  MessageSource<?> source
           
private  MessageTarget target
           
 
Constructor Summary
AbstractEndpoint()
           
 
Method Summary
protected  MessageExchangeTemplate getMessageExchangeTemplate()
           
 java.lang.String getName()
          Return the name of this endpoint.
 Schedule getSchedule()
           
 MessageSource<?> getSource()
           
 MessageTarget getTarget()
           
private  void handleException(MessagingException exception)
           
 boolean send(Message<?> message)
          Send a Message to this target.
protected abstract  boolean sendInternal(Message<?> message)
           
 void setBeanName(java.lang.String name)
           
 void setErrorHandler(ErrorHandler errorHandler)
          Provide an error handler for any Exceptions that occur upon invocation of this endpoint.
 void setSchedule(Schedule schedule)
           
 void setSource(MessageSource<?> source)
           
 void setTarget(MessageTarget target)
           
 java.lang.String 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.endpoint.MessageEndpoint
getInputChannelName, getOutputChannelName, setInputChannelName
 

Field Detail

logger

protected final org.apache.commons.logging.Log logger

name

private volatile java.lang.String name

source

private MessageSource<?> source

target

private MessageTarget target

schedule

private volatile Schedule schedule

errorHandler

private volatile ErrorHandler errorHandler

messageExchangeTemplate

private final MessageExchangeTemplate messageExchangeTemplate
Constructor Detail

AbstractEndpoint

public AbstractEndpoint()
Method Detail

getName

public java.lang.String getName()
Return the name of this endpoint.

Specified by:
getName in interface MessageEndpoint

setBeanName

public void setBeanName(java.lang.String name)
Specified by:
setBeanName in interface org.springframework.beans.factory.BeanNameAware

getSource

public MessageSource<?> getSource()
Specified by:
getSource in interface MessageEndpoint

setSource

public void setSource(MessageSource<?> source)
Specified by:
setSource in interface MessageEndpoint

getTarget

public MessageTarget getTarget()
Specified by:
getTarget in interface MessageEndpoint

setTarget

public void setTarget(MessageTarget target)
Specified by:
setTarget in interface MessageEndpoint

getSchedule

public Schedule getSchedule()
Specified by:
getSchedule in interface MessageEndpoint

setSchedule

public void setSchedule(Schedule schedule)
Specified by:
setSchedule in interface MessageEndpoint

getMessageExchangeTemplate

protected MessageExchangeTemplate getMessageExchangeTemplate()

setErrorHandler

public void setErrorHandler(ErrorHandler errorHandler)
Provide an error handler for any Exceptions that occur upon invocation of this endpoint. If none is provided, the Exception messages will be logged (at warn level), and the Exception rethrown.


send

public final boolean send(Message<?> message)
Description copied from interface: MessageTarget
Send a Message to this target. May throw a RuntimeException for non-recoverable errors. Otherwise, if the Message cannot be sent for a non-fatal reason such as timeout, then this method will return 'false', and if the Message is sent successfully, it will return 'true'.

Specified by:
send in interface MessageTarget
Parameters:
message - the Message to send
Returns:
whether the Message has been sent successfully

sendInternal

protected abstract boolean sendInternal(Message<?> message)

handleException

private void handleException(MessagingException exception)

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object