org.apache.camel.component.language
Class LanguageEndpoint

java.lang.Object
  extended by org.apache.camel.support.ServiceSupport
      extended by org.apache.camel.impl.DefaultEndpoint
          extended by org.apache.camel.impl.ScheduledPollEndpoint
              extended by org.apache.camel.impl.DefaultPollingEndpoint
                  extended by org.apache.camel.impl.ProcessorEndpoint
                      extended by org.apache.camel.component.ResourceEndpoint
                          extended by org.apache.camel.component.language.LanguageEndpoint
All Implemented Interfaces:
ManagedResourceEndpointMBean, CamelContextAware, Endpoint, IsSingleton, Service, ShutdownableService, HasId, StatefulService, SuspendableService

@UriEndpoint(scheme="language")
public class LanguageEndpoint
extends ResourceEndpoint

Language endpoint.

Version:

Field Summary
 
Fields inherited from class org.apache.camel.component.ResourceEndpoint
log
 
Fields inherited from class org.apache.camel.support.ServiceSupport
shutdown, shuttingdown, started, starting, stopped, stopping, suspended, suspending
 
Constructor Summary
LanguageEndpoint()
           
LanguageEndpoint(String endpointUri, Component component, Language language, Expression expression, String resourceUri)
           
 
Method Summary
 void clearContentCache()
           
 Consumer createConsumer(Processor processor)
          Creates a new Event Driven Consumer which consumes messages from the endpoint using the given processor
protected  String createEndpointUri()
          A factory method to lazily create the endpointUri if none is specified
 Producer createProducer()
          Creates a new producer which is used send messages into the endpoint
 Expression getExpression()
           
 Language getLanguage()
           
 String getScript()
           
 boolean isCacheScript()
           
 boolean isContentResolvedFromResource()
           
 boolean isSingleton()
          Whether this class supports being singleton or not.
 boolean isTransform()
           
protected  String resolveScript(String script)
          Resolves the script.
 void setCacheScript(boolean cacheScript)
          Whether to cache the compiled script and reuse

Notice reusing the script can cause side effects from processing one Camel Exchange to the next Exchange.

 void setContentResolvedFromResource(boolean contentResolvedFromResource)
           
 void setExpression(Expression expression)
           
 void setLanguageName(String languageName)
          Sets the name of the language to use
 void setScript(String script)
          Sets the script to execute
 void setTransform(boolean transform)
          Whether or not the result of the script should be used as message body.
 
Methods inherited from class org.apache.camel.component.ResourceEndpoint
getCamelId, getCamelManagementName, getResourceAsInputStream, getResourceAsInputStreamWithoutCache, getResourceUri, getState, isContentCache, isContentCacheCleared, loadResource, setContentCache, setResourceUri
 
Methods inherited from class org.apache.camel.impl.ProcessorEndpoint
createPollingConsumer, createProcessor, getProcessor, onExchange, setProcessor
 
Methods inherited from class org.apache.camel.impl.ScheduledPollEndpoint
configurePollingConsumer, configureProperties, configureScheduledPollConsumerProperties
 
Methods inherited from class org.apache.camel.impl.DefaultEndpoint
configureConsumer, createEndpointConfiguration, createExchange, createExchange, createExchange, doStart, doStop, equals, getCamelContext, getComponent, getConsumerProperties, getEndpointConfiguration, getEndpointKey, getEndpointUri, getExchangePattern, getId, getPollingConsumerQueueSize, hashCode, isLenientProperties, isPollingConsumerBlockWhenFull, isSynchronous, setCamelContext, setConsumerProperties, setEndpointConfiguration, setEndpointUri, setEndpointUriIfNotSpecified, setExchangePattern, setPollingConsumerBlockWhenFull, setPollingConsumerQueueSize, setProperties, setSynchronous, toString
 
Methods inherited from class org.apache.camel.support.ServiceSupport
doResume, doShutdown, doSuspend, getStatus, getVersion, isRunAllowed, isStarted, isStarting, isStopped, isStopping, isStoppingOrStopped, isSuspended, isSuspending, resume, shutdown, start, stop, suspend
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface org.apache.camel.Service
start, stop
 

Constructor Detail

LanguageEndpoint

public LanguageEndpoint()

LanguageEndpoint

public LanguageEndpoint(String endpointUri,
                        Component component,
                        Language language,
                        Expression expression,
                        String resourceUri)
Method Detail

createProducer

public Producer createProducer()
                        throws Exception
Description copied from interface: Endpoint
Creates a new producer which is used send messages into the endpoint

Specified by:
createProducer in interface Endpoint
Overrides:
createProducer in class ProcessorEndpoint
Returns:
a newly created producer
Throws:
Exception - can be thrown

createConsumer

public Consumer createConsumer(Processor processor)
                        throws Exception
Description copied from interface: Endpoint
Creates a new Event Driven Consumer which consumes messages from the endpoint using the given processor

Specified by:
createConsumer in interface Endpoint
Overrides:
createConsumer in class DefaultPollingEndpoint
Parameters:
processor - the given processor
Returns:
a newly created consumer
Throws:
Exception - can be thrown

resolveScript

protected String resolveScript(String script)
                        throws IOException
Resolves the script.

Parameters:
script - script or uri for a script to load
Returns:
the script
Throws:
IOException - is thrown if error loading the script

isSingleton

public boolean isSingleton()
Description copied from interface: IsSingleton
Whether this class supports being singleton or not.

Specified by:
isSingleton in interface IsSingleton
Overrides:
isSingleton in class ProcessorEndpoint
Returns:
true to be a single shared instance, false to create new instances.

createEndpointUri

protected String createEndpointUri()
Description copied from class: DefaultEndpoint
A factory method to lazily create the endpointUri if none is specified

Overrides:
createEndpointUri in class DefaultEndpoint

getLanguage

public Language getLanguage()

getExpression

public Expression getExpression()

setExpression

public void setExpression(Expression expression)

isTransform

public boolean isTransform()

setTransform

public void setTransform(boolean transform)
Whether or not the result of the script should be used as message body.

This options is default true.

Parameters:
transform - true to use result as new message body, false to keep the existing message body

setLanguageName

public void setLanguageName(String languageName)
Sets the name of the language to use

Parameters:
languageName - the name of the language

setScript

public void setScript(String script)
Sets the script to execute

Parameters:
script - the script

getScript

public String getScript()

isContentResolvedFromResource

public boolean isContentResolvedFromResource()

setContentResolvedFromResource

public void setContentResolvedFromResource(boolean contentResolvedFromResource)

isCacheScript

public boolean isCacheScript()

setCacheScript

public void setCacheScript(boolean cacheScript)
Whether to cache the compiled script and reuse

Notice reusing the script can cause side effects from processing one Camel Exchange to the next Exchange.


clearContentCache

public void clearContentCache()
Specified by:
clearContentCache in interface ManagedResourceEndpointMBean
Overrides:
clearContentCache in class ResourceEndpoint


Apache Camel