Class 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.
    • Field Summary

      • Fields inherited from class org.apache.camel.support.service.BaseService

        BUILT, FAILED, INITIALIZED, INITIALIZING, lock, NEW, SHUTDOWN, SHUTTING_DOWN, STARTED, STARTING, status, STOPPED, STOPPING, SUSPENDED, SUSPENDING
    • 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 characters
      void 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 characters
      void 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 system
      void setSplitRows​(boolean splitRows)
      Sets the Component to send each row as a separate exchange once parsed
      void 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 interface org.apache.camel.Endpoint

        getEndpointBaseUri, isSingletonProducer
      • Methods inherited from interface org.apache.camel.Service

        build, close, init, start, stop
      • Methods inherited from interface org.apache.camel.ShutdownableService

        shutdown
      • Methods inherited from interface org.apache.camel.StatefulService

        getStatus, isRunAllowed, isStarted, isStarting, isStopped, isStopping, isSuspending
      • Methods inherited from interface org.apache.camel.SuspendableService

        isSuspended, resume, suspend
    • Constructor Detail

      • FlatpackEndpoint

        public FlatpackEndpoint()
      • FlatpackEndpoint

        public FlatpackEndpoint​(String endpointUri,
                                org.apache.camel.Component component,
                                String resourceUri)
    • Method Detail

      • createProducer

        public org.apache.camel.Producer createProducer()
                                                 throws Exception
        Throws:
        Exception
      • createConsumer

        public org.apache.camel.Consumer createConsumer​(org.apache.camel.Processor processor)
                                                 throws Exception
        Specified by:
        createConsumer in interface org.apache.camel.Endpoint
        Overrides:
        createConsumer in class org.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
      • 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()
      • 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).