org.apache.camel.component
Class ResourceBasedEndpoint

java.lang.Object
  extended by org.apache.camel.impl.DefaultEndpoint<E>
      extended by org.apache.camel.impl.ScheduledPollEndpoint<E>
          extended by org.apache.camel.impl.DefaultPollingEndpoint<Exchange>
              extended by org.apache.camel.impl.ProcessorEndpoint
                  extended by org.apache.camel.component.ResourceBasedEndpoint
All Implemented Interfaces:
CamelContextAware, Endpoint<Exchange>

public abstract class ResourceBasedEndpoint
extends ProcessorEndpoint

A useful base class for endpoints which depend on a resource such as things like Velocity or XQuery based components.

Version:
$Revision: 736637 $

Field Summary
protected  org.apache.commons.logging.Log log
           
 
Constructor Summary
  ResourceBasedEndpoint(String endpointUri, Component component, String resourceUri, Processor processor)
           
protected ResourceBasedEndpoint(String endpointUri, Processor processor, String resourceUri)
           
 
Method Summary
 Resource getResource()
           
 InputStream getResourceAsInputStream()
          Gets the resource as an input stream considering the cache flag as well.
 ResourceLoader getResourceLoader()
           
 String getResourceUri()
           
 boolean isContentCache()
           
 void setContentCache(boolean contentCache)
          Sets wether to use resource content cache or not - default is false.
 void setResourceLoader(ResourceLoader resourceLoader)
           
 
Methods inherited from class org.apache.camel.impl.ProcessorEndpoint
createPollingConsumer, createProcessor, createProducer, getProcessor, isSingleton, onExchange
 
Methods inherited from class org.apache.camel.impl.DefaultPollingEndpoint
createConsumer
 
Methods inherited from class org.apache.camel.impl.ScheduledPollEndpoint
configureConsumer, configureProperties, getConsumerProperties, setConsumerProperties
 
Methods inherited from class org.apache.camel.impl.DefaultEndpoint
convertTo, createEndpointUri, createExchange, createExchange, createExchange, createExecutorService, equals, getCamelContext, getComponent, getContext, getEndpointUri, getExchangePattern, getExchangeType, getExecutorService, hashCode, isLenientProperties, setCamelContext, setContext, setEndpointUri, setEndpointUriIfNotSpecified, setExchangePattern, setExecutorService, toString
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

log

protected final transient org.apache.commons.logging.Log log
Constructor Detail

ResourceBasedEndpoint

public ResourceBasedEndpoint(String endpointUri,
                             Component component,
                             String resourceUri,
                             Processor processor)

ResourceBasedEndpoint

protected ResourceBasedEndpoint(String endpointUri,
                                Processor processor,
                                String resourceUri)
Method Detail

getResource

public Resource getResource()

isContentCache

public boolean isContentCache()

setContentCache

public void setContentCache(boolean contentCache)
Sets wether to use resource content cache or not - default is false.

See Also:
getResourceAsInputStream()

getResourceAsInputStream

public InputStream getResourceAsInputStream()
                                     throws IOException
Gets the resource as an input stream considering the cache flag as well.

If cache is enabled then the resource content is cached in an internal buffer and this content is returned to avoid loading the resource over and over again.

Returns:
the input stream
Throws:
IOException - is thrown if error loading the content of the resource to the local cache buffer

getResourceLoader

public ResourceLoader getResourceLoader()

setResourceLoader

public void setResourceLoader(ResourceLoader resourceLoader)

getResourceUri

public String getResourceUri()


Apache CAMEL