Class FlatpackEndpoint
- java.lang.Object
-
- org.apache.camel.support.service.BaseService
-
- org.apache.camel.support.service.ServiceSupport
-
- org.apache.camel.support.DefaultEndpoint
-
- org.apache.camel.support.ScheduledPollEndpoint
-
- org.apache.camel.support.DefaultPollingEndpoint
-
- org.apache.camel.component.flatpack.FlatpackEndpoint
-
- All Implemented Interfaces:
AutoCloseable
,org.apache.camel.CamelContextAware
,org.apache.camel.Endpoint
,org.apache.camel.IsSingleton
,org.apache.camel.Service
,org.apache.camel.ShutdownableService
,org.apache.camel.spi.HasId
,org.apache.camel.StatefulService
,org.apache.camel.SuspendableService
@UriEndpoint(firstVersion="1.4.0", scheme="flatpack", title="Flatpack", syntax="flatpack:type:resourceUri", category=TRANSFORMATION, headersClass=FlatpackConstants.class) public class FlatpackEndpoint extends org.apache.camel.support.DefaultPollingEndpoint
Parse fixed width and delimited files using the FlatPack library.
-
-
Constructor Summary
Constructors Constructor Description FlatpackEndpoint()
FlatpackEndpoint(String endpointUri, org.apache.camel.Component component, String resourceUri)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description org.apache.camel.Consumer
createConsumer(org.apache.camel.Processor processor)
net.sf.flatpack.Parser
createDelimitedParser(org.apache.camel.Exchange exchange)
protected net.sf.flatpack.Parser
createFixedParser(String resourceUri, Reader bodyReader)
net.sf.flatpack.Parser
createParser(org.apache.camel.Exchange exchange)
org.apache.camel.Producer
createProducer()
char
getDelimiter()
org.apache.camel.processor.loadbalancer.LoadBalancer
getLoadBalancer()
net.sf.flatpack.ParserFactory
getParserFactory()
String
getResourceUri()
char
getTextQualifier()
FlatpackType
getType()
boolean
isAllowShortLines()
boolean
isIgnoreExtraColumns()
boolean
isIgnoreFirstRecord()
boolean
isSplitRows()
void
processDataSet(org.apache.camel.Exchange originalExchange, net.sf.flatpack.DataSet dataSet, int counter)
void
setAllowShortLines(boolean allowShortLines)
Allows for lines to be shorter than expected and ignores the extra charactersvoid
setDelimiter(char delimiter)
The default character delimiter for delimited files.void
setIgnoreExtraColumns(boolean ignoreExtraColumns)
Allows for lines to be longer than expected and ignores the extra charactersvoid
setIgnoreFirstRecord(boolean ignoreFirstRecord)
Whether the first line is ignored for delimited files (for the column headers).void
setLoadBalancer(org.apache.camel.processor.loadbalancer.LoadBalancer loadBalancer)
void
setParserFactory(net.sf.flatpack.ParserFactory parserFactory)
void
setResourceUri(String resourceUri)
URL for loading the flatpack mapping file from classpath or file systemvoid
setSplitRows(boolean splitRows)
Sets the Component to send each row as a separate exchange once parsedvoid
setTextQualifier(char textQualifier)
The text qualifier for delimited files.void
setType(FlatpackType type)
Whether to use fixed or delimiter-
Methods inherited from class org.apache.camel.support.ScheduledPollEndpoint
configureConsumer, configureProperties, configureScheduledPollConsumerProperties, doConfigureConsumer, doStart, doStop, getBackoffErrorThreshold, getBackoffIdleThreshold, getBackoffMultiplier, getDefaultDelay, getDelay, getInitialDelay, getPollStrategy, getRepeatCount, getRunLoggingLevel, getScheduledExecutorService, getScheduler, getSchedulerProperties, getTimeUnit, isGreedy, isSendEmptyMessageWhenIdle, isStartScheduler, isUseFixedDelay, setBackoffErrorThreshold, setBackoffIdleThreshold, setBackoffMultiplier, setDelay, setGreedy, setInitialDelay, setPollStrategy, setRepeatCount, setRunLoggingLevel, setScheduledExecutorService, setScheduler, setSchedulerProperties, setSendEmptyMessageWhenIdle, setStartScheduler, setTimeUnit, setUseFixedDelay
-
Methods inherited from class org.apache.camel.support.DefaultEndpoint
configureExchange, configurePollingConsumer, createAsyncProducer, createEndpointUri, createExchange, createExchange, createPollingConsumer, doInit, equals, getCamelContext, getComponent, getEndpointKey, getEndpointUri, getExceptionHandler, getExchangePattern, getId, getPollingConsumerBlockTimeout, getPollingConsumerQueueSize, hashCode, isAutowiredEnabled, isBridgeErrorHandler, isLazyStartProducer, isLenientProperties, isPollingConsumerBlockWhenFull, isPollingConsumerCopy, isSingleton, setAutowiredEnabled, setBridgeErrorHandler, setCamelContext, setComponent, setEndpointUri, setEndpointUriIfNotSpecified, setExceptionHandler, setExchangePattern, setLazyStartProducer, setPollingConsumerBlockTimeout, setPollingConsumerBlockWhenFull, setPollingConsumerCopy, setPollingConsumerQueueSize, setProperties, toString
-
Methods inherited from class org.apache.camel.support.service.BaseService
build, doBuild, doFail, doLifecycleChange, doResume, doShutdown, doSuspend, fail, getStatus, init, isBuild, isInit, isNew, isRunAllowed, isShutdown, isStarted, isStarting, isStartingOrStarted, isStopped, isStopping, isStoppingOrStopped, isSuspended, isSuspending, isSuspendingOrSuspended, resume, shutdown, start, stop, suspend
-
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
-
-
-
-
Method Detail
-
createConsumer
public org.apache.camel.Consumer createConsumer(org.apache.camel.Processor processor) throws Exception
- Specified by:
createConsumer
in interfaceorg.apache.camel.Endpoint
- Overrides:
createConsumer
in classorg.apache.camel.support.DefaultPollingEndpoint
- Throws:
Exception
-
processDataSet
public void processDataSet(org.apache.camel.Exchange originalExchange, net.sf.flatpack.DataSet dataSet, int counter) throws Exception
- Throws:
Exception
-
createParser
public net.sf.flatpack.Parser createParser(org.apache.camel.Exchange exchange) throws Exception
- Throws:
Exception
-
createFixedParser
protected net.sf.flatpack.Parser createFixedParser(String resourceUri, Reader bodyReader) throws IOException
- Throws:
IOException
-
createDelimitedParser
public net.sf.flatpack.Parser createDelimitedParser(org.apache.camel.Exchange exchange) throws org.apache.camel.InvalidPayloadException, IOException
- Throws:
org.apache.camel.InvalidPayloadException
IOException
-
getResourceUri
public String getResourceUri()
-
getParserFactory
public net.sf.flatpack.ParserFactory getParserFactory()
-
setParserFactory
public void setParserFactory(net.sf.flatpack.ParserFactory parserFactory)
-
getLoadBalancer
public org.apache.camel.processor.loadbalancer.LoadBalancer getLoadBalancer()
-
setLoadBalancer
public void setLoadBalancer(org.apache.camel.processor.loadbalancer.LoadBalancer loadBalancer)
-
isSplitRows
public boolean isSplitRows()
-
setSplitRows
public void setSplitRows(boolean splitRows)
Sets the Component to send each row as a separate exchange once parsed
-
isAllowShortLines
public boolean isAllowShortLines()
-
setAllowShortLines
public void setAllowShortLines(boolean allowShortLines)
Allows for lines to be shorter than expected and ignores the extra characters
-
setIgnoreExtraColumns
public void setIgnoreExtraColumns(boolean ignoreExtraColumns)
Allows for lines to be longer than expected and ignores the extra characters
-
isIgnoreExtraColumns
public boolean isIgnoreExtraColumns()
-
getType
public FlatpackType getType()
-
setType
public void setType(FlatpackType type)
Whether to use fixed or delimiter
-
setResourceUri
public void setResourceUri(String resourceUri)
URL for loading the flatpack mapping file from classpath or file system
-
getDelimiter
public char getDelimiter()
-
setDelimiter
public void setDelimiter(char delimiter)
The default character delimiter for delimited files.
-
getTextQualifier
public char getTextQualifier()
-
setTextQualifier
public void setTextQualifier(char textQualifier)
The text qualifier for delimited files.
-
isIgnoreFirstRecord
public boolean isIgnoreFirstRecord()
-
setIgnoreFirstRecord
public void setIgnoreFirstRecord(boolean ignoreFirstRecord)
Whether the first line is ignored for delimited files (for the column headers).
-
-