org.apache.camel.component.feed
Class FeedEndpoint

java.lang.Object
  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.component.feed.FeedEndpoint
All Implemented Interfaces:
CamelContextAware, Endpoint, IsSingleton, Service, HasId
Direct Known Subclasses:
AtomEndpoint, RssEndpoint

public abstract class FeedEndpoint
extends DefaultPollingEndpoint

A base class for feed (atom, RSS) endpoints.


Field Summary
protected  String feedUri
           
protected  boolean filter
           
protected  Date lastUpdate
           
protected  boolean splitEntries
           
 
Constructor Summary
FeedEndpoint()
           
FeedEndpoint(String endpointUri)
           
FeedEndpoint(String endpointUri, FeedComponent component, String feedUri)
           
FeedEndpoint(String endpointUri, String feedUri)
           
 
Method Summary
 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
protected abstract  FeedPollingConsumer createEntryPollingConsumer(FeedEndpoint feedEndpoint, Processor processor, boolean filter, Date lastUpdate, boolean throttleEntries)
           
abstract  Exchange createExchange(Object feed)
          Creates an Exchange with the entries as the in body.
abstract  Exchange createExchange(Object feed, Object entry)
          Creates an Exchange with the given entry as the in body.
protected  Exchange createExchangeWithFeedHeader(Object feed, String header)
           
protected abstract  FeedPollingConsumer createPollingConsumer(FeedEndpoint feedEndpoint, Processor processor)
           
 Producer createProducer()
          Creates a new producer which is used send messages into the endpoint
 String getEndpointKey()
          Returns a string key of this endpoint.
 String getFeedUri()
           
 Date getLastUpdate()
           
 boolean isFeedHeader()
           
 boolean isFilter()
           
 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.

 boolean isSingleton()
          Whether this class supports being singleton or not.
 boolean isSortEntries()
           
 boolean isSplitEntries()
           
 boolean isThrottleEntries()
           
 void setFeedHeader(boolean feedHeader)
          Sets whether to add the feed object as a header
 void setFeedUri(String feedUri)
           
 void setFilter(boolean filter)
          Sets whether to use filtering or not of the entries.
 void setLastUpdate(Date lastUpdate)
          Sets the timestamp to be used for filtering entries from the atom feeds.
 void setSortEntries(boolean sortEntries)
          Sets whether to sort entries by published date.
 void setSplitEntries(boolean splitEntries)
          Sets whether or not entries should be sent individually or whether the entire feed should be sent as a single message
 void setThrottleEntries(boolean throttleEntries)
          Sets whether all entries identified in a single feed poll should be delivered immediately.
 
Methods inherited from class org.apache.camel.impl.ScheduledPollEndpoint
configureConsumer, configureProperties, getConsumerProperties, setConsumerProperties
 
Methods inherited from class org.apache.camel.impl.DefaultEndpoint
createExchange, createExchange, createExchange, createPollingConsumer, equals, getCamelContext, getComponent, getEndpointUri, getExchangePattern, getExchangeType, getId, hashCode, isSynchronous, sanitizeUri, setCamelContext, setEndpointUri, setEndpointUriIfNotSpecified, setExchangePattern, setSynchronous, start, stop, toString
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

feedUri

protected String feedUri

splitEntries

protected boolean splitEntries

lastUpdate

protected Date lastUpdate

filter

protected boolean filter
Constructor Detail

FeedEndpoint

public FeedEndpoint()

FeedEndpoint

public FeedEndpoint(String endpointUri,
                    FeedComponent component,
                    String feedUri)

FeedEndpoint

public FeedEndpoint(String endpointUri,
                    String feedUri)

FeedEndpoint

public FeedEndpoint(String endpointUri)
Method Detail

isSingleton

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

Returns:
true to be a single shared instance, false to create new instances.

createProducer

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

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

createPollingConsumer

protected abstract FeedPollingConsumer createPollingConsumer(FeedEndpoint feedEndpoint,
                                                             Processor processor)

createEntryPollingConsumer

protected abstract FeedPollingConsumer createEntryPollingConsumer(FeedEndpoint feedEndpoint,
                                                                  Processor processor,
                                                                  boolean filter,
                                                                  Date lastUpdate,
                                                                  boolean throttleEntries)

createExchangeWithFeedHeader

protected Exchange createExchangeWithFeedHeader(Object feed,
                                                String header)

createExchange

public abstract Exchange createExchange(Object feed)
Creates an Exchange with the entries as the in body.

Parameters:
feed - the atom feed
Returns:
the created exchange

createExchange

public abstract Exchange createExchange(Object feed,
                                        Object entry)
Creates an Exchange with the given entry as the in body.

Parameters:
feed - the feed
entry - the entry as the in body
Returns:
the created exchange

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

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
Overrides:
getEndpointKey in class DefaultEndpoint
Returns:
the endpoint key

getFeedUri

public String getFeedUri()

setFeedUri

public void setFeedUri(String feedUri)

isSplitEntries

public boolean isSplitEntries()

setSplitEntries

public void setSplitEntries(boolean splitEntries)
Sets whether or not entries should be sent individually or whether the entire feed should be sent as a single message


getLastUpdate

public Date getLastUpdate()

setLastUpdate

public void setLastUpdate(Date lastUpdate)
Sets the timestamp to be used for filtering entries from the atom feeds. This options is only in conjunction with the splitEntries.


isFilter

public boolean isFilter()

setFilter

public void setFilter(boolean filter)
Sets whether to use filtering or not of the entries.


setFeedHeader

public void setFeedHeader(boolean feedHeader)
Sets whether to add the feed object as a header


isFeedHeader

public boolean isFeedHeader()

setSortEntries

public void setSortEntries(boolean sortEntries)
Sets whether to sort entries by published date. Only works when splitEntries = true.


isSortEntries

public boolean isSortEntries()

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
Overrides:
isLenientProperties in class DefaultEndpoint
Returns:
whether properties is lenient or not

setThrottleEntries

public void setThrottleEntries(boolean throttleEntries)
Sets whether all entries identified in a single feed poll should be delivered immediately. If true, only one entry is processed per consumer.delay. Only applicable when splitEntries = true.


isThrottleEntries

public boolean isThrottleEntries()


Apache CAMEL