org.apache.camel.impl
Class DefaultExchange

java.lang.Object
  extended by org.apache.camel.impl.DefaultExchange
All Implemented Interfaces:
Exchange
Direct Known Subclasses:
BeanExchange, FileExchange, JMXExchange

public class DefaultExchange
extends Object
implements Exchange

A default implementation of Exchange

Version:
$Revision: 564677 $

Field Summary
protected  CamelContext context
           
 
Constructor Summary
DefaultExchange(CamelContext context)
           
 
Method Summary
protected  void configureMessage(Message message)
          Configures the message after it has been set on the exchange
 Exchange copy()
          Creates a copy of the current message exchange so that it can be forwarded to another destination
 void copyFrom(Exchange exchange)
          Copies the data into this exchange from the given exchange #param source is the source from which headers and messages will be copied
protected  Message createInMessage()
          Factory method used to lazily create the IN message
protected  Message createOutMessage()
          Factory method to lazily create the OUT message
 CamelContext getContext()
          Returns the container so that a processor can resolve endpoints from URIs
 Throwable getException()
          Returns the exception associated with this exchange
 String getExchangeId()
          Returns the exchange id
 Message getFault()
          Returns the fault message
 Message getIn()
          Returns the inbound request message
 Message getOut()
          Returns the outbound message, lazily creating one if one has not already been associated with this exchange.
 Message getOut(boolean lazyCreate)
          Returns the outbound message; optionally lazily creating one if one has not been associated with this exchange
 Map<String,Object> getProperties()
          Returns all of the properties associated with the exchange
 Object getProperty(String name)
          Returns a property associated with this exchange by name
<T> T
getProperty(String name, Class<T> type)
          Returns a property associated with this exchange by name and specifying the type required
 Exchange newInstance()
           
 void setException(Throwable exception)
          Sets the exception associated with this exchange
 void setExchangeId(String id)
          Set the exchange id
 void setFault(Message fault)
           
 void setIn(Message in)
           
 void setOut(Message out)
           
 void setProperties(Map<String,Object> properties)
           
 void setProperty(String name, Object value)
          Sets a property on the exchange
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

context

protected final CamelContext context
Constructor Detail

DefaultExchange

public DefaultExchange(CamelContext context)
Method Detail

toString

public String toString()
Overrides:
toString in class Object

copy

public Exchange copy()
Description copied from interface: Exchange
Creates a copy of the current message exchange so that it can be forwarded to another destination

Specified by:
copy in interface Exchange

copyFrom

public void copyFrom(Exchange exchange)
Description copied from interface: Exchange
Copies the data into this exchange from the given exchange #param source is the source from which headers and messages will be copied

Specified by:
copyFrom in interface Exchange

newInstance

public Exchange newInstance()

getContext

public CamelContext getContext()
Description copied from interface: Exchange
Returns the container so that a processor can resolve endpoints from URIs

Specified by:
getContext in interface Exchange
Returns:
the container which owns this exchange

getProperty

public Object getProperty(String name)
Description copied from interface: Exchange
Returns a property associated with this exchange by name

Specified by:
getProperty in interface Exchange
Parameters:
name - the name of the property
Returns:
the value of the given header or null if there is no property for the given name

getProperty

public <T> T getProperty(String name,
                         Class<T> type)
Description copied from interface: Exchange
Returns a property associated with this exchange by name and specifying the type required

Specified by:
getProperty in interface Exchange
Parameters:
name - the name of the property
type - the type of the property
Returns:
the value of the given header or null if there is no property for the given name or null if it cannot be converted to the given type

setProperty

public void setProperty(String name,
                        Object value)
Description copied from interface: Exchange
Sets a property on the exchange

Specified by:
setProperty in interface Exchange
Parameters:
name - of the property
value - to associate with the name

getProperties

public Map<String,Object> getProperties()
Description copied from interface: Exchange
Returns all of the properties associated with the exchange

Specified by:
getProperties in interface Exchange
Returns:
all the headers in a Map

setProperties

public void setProperties(Map<String,Object> properties)

getIn

public Message getIn()
Description copied from interface: Exchange
Returns the inbound request message

Specified by:
getIn in interface Exchange
Returns:
the message

setIn

public void setIn(Message in)

getOut

public Message getOut()
Description copied from interface: Exchange
Returns the outbound message, lazily creating one if one has not already been associated with this exchange. If you want to inspect this property but not force lazy creation then invoke the Exchange.getOut(boolean) method passing in null

Specified by:
getOut in interface Exchange
Returns:
the response

getOut

public Message getOut(boolean lazyCreate)
Description copied from interface: Exchange
Returns the outbound message; optionally lazily creating one if one has not been associated with this exchange

Specified by:
getOut in interface Exchange
Returns:
the response

setOut

public void setOut(Message out)

getException

public Throwable getException()
Description copied from interface: Exchange
Returns the exception associated with this exchange

Specified by:
getException in interface Exchange
Returns:
the exception (or null if no faults)

setException

public void setException(Throwable exception)
Description copied from interface: Exchange
Sets the exception associated with this exchange

Specified by:
setException in interface Exchange

getFault

public Message getFault()
Description copied from interface: Exchange
Returns the fault message

Specified by:
getFault in interface Exchange
Returns:
the fault

setFault

public void setFault(Message fault)

getExchangeId

public String getExchangeId()
Description copied from interface: Exchange
Returns the exchange id

Specified by:
getExchangeId in interface Exchange
Returns:
the unique id of the exchange

setExchangeId

public void setExchangeId(String id)
Description copied from interface: Exchange
Set the exchange id

Specified by:
setExchangeId in interface Exchange

createInMessage

protected Message createInMessage()
Factory method used to lazily create the IN message


createOutMessage

protected Message createOutMessage()
Factory method to lazily create the OUT message


configureMessage

protected void configureMessage(Message message)
Configures the message after it has been set on the exchange



Copyright © 2007 Apache Software Foundation. All Rights Reserved.