All Implemented Interfaces:
BasicFileStore, CSVFileStore, SecureConnectorExtension, VirtualConnectorExtension

public class CSVFileStoreConnector extends BasicFileStoreConnector implements CSVFileStore
CSVFileStoreConnector works with structured files to retrieve simple tables of data.
  • Constructor Details

    • CSVFileStoreConnector

      public CSVFileStoreConnector()
  • Method Details

    • start

      Indicates that the connector is completely configured and can begin processing.
      Overrides:
      start in class BasicFileStoreConnector
      Throws:
      ConnectorCheckedException - there is a problem within the connector.
      UserNotAuthorizedException - the connector was disconnected before/during start
    • getSuppliedColumnNames

      public List<String> getSuppliedColumnNames()
      Return any fixed column names defined by the connector
      Returns:
      list of configured column names
    • getDelimiterChar

      public char getDelimiterChar()
      Return the defined delimiter character.
      Returns:
      char
    • getQuoteChar

      public char getQuoteChar()
      Return the defined quote char.
      Returns:
      char
    • getRecordCount

      public long getRecordCount() throws FileException, FileReadException
      Return the number of records in the file. This is achieved by scanning the file and counting the records - not recommended for very large files.
      Specified by:
      getRecordCount in interface CSVFileStore
      Returns:
      count
      Throws:
      FileException - problem accessing the file
      FileReadException - unable to find, open or scan the file.
    • getColumnNames

      public List<String> getColumnNames() throws FileException, FileReadException
      Return the list of column names associated with this structured file. This may be embedded in the first line of the file or encoded in the connection object used to create a connector instance.
      Specified by:
      getColumnNames in interface CSVFileStore
      Returns:
      a list of column names
      Throws:
      FileException - problem accessing the file
      FileReadException - unable to retrieve the column names
    • readRecord

      public List<String> readRecord(long dataRecordNumber) throws FileException, FileReadException
      Return the requested data record. The first record is record 0. If the first line of the file is the column names then record 0 is the line following the column names.
      Specified by:
      readRecord in interface CSVFileStore
      Parameters:
      dataRecordNumber - long
      Returns:
      List of strings, each string is the value from the column.
      Throws:
      FileException - problem accessing the file
      FileReadException - unable to find, open or read the file, or the file does not include the requested record.
    • disconnect

      public void disconnect()
      Close the file
      Overrides:
      disconnect in class BasicFileStoreConnector