org.apache.camel.impl
Class DefaultEndpoint

java.lang.Object
  extended by org.apache.camel.impl.DefaultEndpoint
All Implemented Interfaces:
CamelContextAware, Endpoint, IsSingleton
Direct Known Subclasses:
BrowseEndpoint, DirectEndpoint, MockEndpoint, ScheduledPollEndpoint, SedaEndpoint, TimerEndpoint

public abstract class DefaultEndpoint
extends Object
implements Endpoint, CamelContextAware

A default endpoint useful for implementation inheritance

Version:
$Revision: 795369 $

Constructor Summary
protected DefaultEndpoint()
           
protected DefaultEndpoint(String endpointUri)
           
protected DefaultEndpoint(String endpointUri, CamelContext camelContext)
           
protected DefaultEndpoint(String endpointUri, Component component)
           
 
Method Summary
 void configureProperties(Map options)
          Configure properties on this endpoint.
 Exchange convertTo(Class<Exchange> type, Exchange exchange)
          Converts the given exchange to the specified exchange type
protected  String createEndpointUri()
          A factory method to lazily create the endpointUri if none is specified
 Exchange createExchange()
          Create a new exchange for communicating with this endpoint
 Exchange createExchange(Exchange exchange)
          Creates a new exchange for communicating with this exchange using the given exchange to pre-populate the values of the headers and messages
 Exchange createExchange(ExchangePattern pattern)
          Create a new exchange for communicating with this endpoint with the specified ExchangePattern such as whether its going to be an ExchangePattern.InOnly or ExchangePattern.InOut exchange
 PollingConsumer createPollingConsumer()
          Creates a new Polling Consumer so that the caller can poll message exchanges from the consumer using PollingConsumer.receive(), PollingConsumer.receiveNoWait() or PollingConsumer.receive(long) whenever it is ready to do so rather than using the Event Based Consumer returned by Endpoint.createConsumer(Processor)
protected  ScheduledExecutorService createScheduledExecutorService()
           
 boolean equals(Object object)
           
 CamelContext getCamelContext()
          Returns the context which created the endpoint
 Component getComponent()
           
 String getEndpointKey()
          Returns a string key of this endpoint.
 String getEndpointUri()
          Returns the string representation of the endpoint URI
 ExchangePattern getExchangePattern()
           
 Class<Exchange> getExchangeType()
          Returns the type of the exchange which is generated by this component
 ExecutorService getExecutorService()
           
 ScheduledExecutorService getScheduledExecutorService()
           
 int hashCode()
           
 boolean isLenientProperties()
          Should all properties be known or does the endpoint allow unknown options?

lenient = false means that the endpoint should validate that all given options is known and configured properly.

 void setCamelContext(CamelContext camelContext)
          Injects the CamelContext
protected  void setEndpointUri(String endpointUri)
           
 void setEndpointUriIfNotSpecified(String value)
          Sets the endpointUri if it has not been specified yet via some kind of dependency injection mechanism.
 void setExchangePattern(ExchangePattern exchangePattern)
           
 void setExecutorService(ExecutorService executorService)
           
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface org.apache.camel.Endpoint
createConsumer, createProducer
 
Methods inherited from interface org.apache.camel.IsSingleton
isSingleton
 

Constructor Detail

DefaultEndpoint

protected DefaultEndpoint(String endpointUri,
                          Component component)

DefaultEndpoint

protected DefaultEndpoint(String endpointUri,
                          CamelContext camelContext)

DefaultEndpoint

protected DefaultEndpoint(String endpointUri)

DefaultEndpoint

protected DefaultEndpoint()
Method Detail

hashCode

public int hashCode()
Overrides:
hashCode in class Object

equals

public boolean equals(Object object)
Overrides:
equals in class Object

toString

public String toString()
Overrides:
toString in class Object

getEndpointUri

public String getEndpointUri()
Description copied from interface: Endpoint
Returns the string representation of the endpoint URI

Specified by:
getEndpointUri in interface Endpoint
Returns:
the endpoint URI

getEndpointKey

public String getEndpointKey()
Description copied from interface: Endpoint
Returns a string key of this endpoint.

This key is used by LifecycleStrategy when registering endpoint. This allows to register different instances of endpoints with the same key.

For JMX mbeans this allows us to use the same JMX Mbean for all endpoints that are logical the same but have different parameters. For instance the http endpoint.

Specified by:
getEndpointKey in interface Endpoint
Returns:
the endpoint key

getCamelContext

public CamelContext getCamelContext()
Description copied from interface: Endpoint
Returns the context which created the endpoint

Specified by:
getCamelContext in interface Endpoint
Returns:
the context which created the endpoint

getComponent

public Component getComponent()

setCamelContext

public void setCamelContext(CamelContext camelContext)
Description copied from interface: CamelContextAware
Injects the CamelContext

Specified by:
setCamelContext in interface CamelContextAware
Specified by:
setCamelContext in interface Endpoint
Parameters:
camelContext - the Camel context

getExecutorService

public ExecutorService getExecutorService()

getScheduledExecutorService

public ScheduledExecutorService getScheduledExecutorService()

setExecutorService

public void setExecutorService(ExecutorService executorService)

createPollingConsumer

public PollingConsumer createPollingConsumer()
                                      throws Exception
Description copied from interface: Endpoint
Creates a new Polling Consumer so that the caller can poll message exchanges from the consumer using PollingConsumer.receive(), PollingConsumer.receiveNoWait() or PollingConsumer.receive(long) whenever it is ready to do so rather than using the Event Based Consumer returned by Endpoint.createConsumer(Processor)

Specified by:
createPollingConsumer in interface Endpoint
Returns:
a newly created pull consumer
Throws:
Exception - if the pull consumer could not be created

convertTo

public Exchange convertTo(Class<Exchange> type,
                          Exchange exchange)
Converts the given exchange to the specified exchange type


createExchange

public Exchange createExchange(Exchange exchange)
Description copied from interface: Endpoint
Creates a new exchange for communicating with this exchange using the given exchange to pre-populate the values of the headers and messages

Specified by:
createExchange in interface Endpoint
Parameters:
exchange - given exchange to use for pre-populate
Returns:
a new exchange

getExchangeType

public Class<Exchange> getExchangeType()
Returns the type of the exchange which is generated by this component


createExchange

public Exchange createExchange()
Description copied from interface: Endpoint
Create a new exchange for communicating with this endpoint

Specified by:
createExchange in interface Endpoint
Returns:
a new exchange

createExchange

public Exchange createExchange(ExchangePattern pattern)
Description copied from interface: Endpoint
Create a new exchange for communicating with this endpoint with the specified ExchangePattern such as whether its going to be an ExchangePattern.InOnly or ExchangePattern.InOut exchange

Specified by:
createExchange in interface Endpoint
Parameters:
pattern - the message exchange pattern for the exchange
Returns:
a new exchange

getExchangePattern

public ExchangePattern getExchangePattern()

setExchangePattern

public void setExchangePattern(ExchangePattern exchangePattern)

createScheduledExecutorService

protected ScheduledExecutorService createScheduledExecutorService()

configureProperties

public void configureProperties(Map options)
Description copied from interface: Endpoint
Configure properties on this endpoint.

Specified by:
configureProperties in interface Endpoint
Parameters:
options - the options (properties)

createEndpointUri

protected String createEndpointUri()
A factory method to lazily create the endpointUri if none is specified


setEndpointUriIfNotSpecified

public void setEndpointUriIfNotSpecified(String value)
Sets the endpointUri if it has not been specified yet via some kind of dependency injection mechanism. This allows dependency injection frameworks such as Spring or Guice to set the default endpoint URI in cases where it has not been explicitly configured using the name/context in which an Endpoint is created.


setEndpointUri

protected void setEndpointUri(String endpointUri)

isLenientProperties

public boolean isLenientProperties()
Description copied from interface: Endpoint
Should all properties be known or does the endpoint allow unknown options?

lenient = false means that the endpoint should validate that all given options is known and configured properly. lenient = true means that the endpoint allows additional unknown options to be passed to it but does not throw a ResolveEndpointFailedException when creating the endpoint.

This options is used by a few components for instance the HTTP based that can have dynamic URI options appended that is targeted for an external system.

Most endpoints is configured to be not lenient.

Specified by:
isLenientProperties in interface Endpoint
Returns:
whether properties is lenient or not


Apache CAMEL