Class ApacheCommonsCSVAdapter

  • All Implemented Interfaces:
    AdapterInterface, java.io.Serializable

    public abstract class ApacheCommonsCSVAdapter
    extends SimpleAdapter
    Abstract adapter for CSV input streams using Apache Commons CSV.
    This class (and its child classes) cannot be instanciated.
    They correspond to an Adapter configuration item.
    The only method to implement is the single line level processRecords method:
    @Override
     public String processRecord(long recordNumber, CSVRecord record) throws PlatformException, InterruptedException {
         // return the record transformed into a Simplicité XML block or null to ignore (e.g. if the line has been processed within this method)
         return null;
     }
    See Also:
    Serialized Form
    • Constructor Detail

      • ApacheCommonsCSVAdapter

        public ApacheCommonsCSVAdapter()
    • Method Detail

      • getSeparator

        public char getSeparator()
        Get separator.
        Returns:
        Separator
      • setSeparator

        public void setSeparator​(char sep)
        Set separator.
        Parameters:
        sep - Separator
      • getFormat

        public org.apache.commons.csv.CSVFormat getFormat()
        Get format.
        Returns:
        Format
      • setFormat

        public void setFormat​(org.apache.commons.csv.CSVFormat format)
        Set format.
        Parameters:
        format - Format
      • process

        public void process()
                     throws java.lang.InterruptedException
        Iterates input stream as individual record.
        Each record is passed to the processRecord method for processing.
        Throws:
        java.lang.InterruptedException
      • processRecord

        public abstract java.lang.String processRecord​(org.apache.commons.csv.CSVRecord record)
                                                throws PlatformException,
                                                       java.lang.InterruptedException
        CSV record processing to implement.
        Parameters:
        record - Record
        Returns:
        Processed line as XML statements or null
        Throws:
        PlatformException
        java.lang.InterruptedException