pl.edu.agh.cast.data.importer.data
Class AbstractDataImporterBase

java.lang.Object
  extended by pl.edu.agh.cast.data.importer.data.AbstractDataImporterBase
All Implemented Interfaces:
IDataImporter
Direct Known Subclasses:
AbstractXlsDataImporter, AckDataImporter, CsvDataImporter, TxtDataImporter

public abstract class AbstractDataImporterBase
extends Object
implements IDataImporter

Abstract data importer class, which defines the basic validation for importers.

Author:
AGH CAST Team

Field Summary
protected  ImporterUtil importerUtil
          Importer helper class.
 
Constructor Summary
protected AbstractDataImporterBase()
           
 
Method Summary
 Map<String,String> getOptions()
          Retrieves the importer options.
protected static int removeEmptyCellsFromRowEnd(DataRow resultRow)
           
 void setImporterUtil(ImporterUtil importerUtil)
           
 boolean validate(InputStream dataIs, Map<String,String> options)
          Validate if importer is good.
 boolean validateImporter(InputStream dataIs, Map<String,String> options)
          Basic validation for importers.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface pl.edu.agh.cast.data.importer.data.IDataImporter
readData
 

Field Detail

importerUtil

protected ImporterUtil importerUtil
Importer helper class.

Constructor Detail

AbstractDataImporterBase

protected AbstractDataImporterBase()
Method Detail

setImporterUtil

public void setImporterUtil(ImporterUtil importerUtil)

validate

public final boolean validate(InputStream dataIs,
                              Map<String,String> options)
Validate if importer is good. This method tries not to change the state of dataIs parameter. If dataIs parameter is null, the method returns false.

Specified by:
validate in interface IDataImporter
Parameters:
dataIs - The data input stream to be transformed
options - Options passed to data importer
Returns:
true is the importer is valid; false otherwise
See Also:
IDataImporter.validate(java.io.InputStream, java.util.Map)

validateImporter

public boolean validateImporter(InputStream dataIs,
                                Map<String,String> options)
Basic validation for importers. True result is returned when more than half of first rows has at least 2 columns.

Parameters:
dataIs - input stream with sample data
options - importer options
Returns:
true is the importer is valid; false otherwise

getOptions

public Map<String,String> getOptions()
Description copied from interface: IDataImporter
Retrieves the importer options.

Specified by:
getOptions in interface IDataImporter
Returns:
importer options.

removeEmptyCellsFromRowEnd

protected static int removeEmptyCellsFromRowEnd(DataRow resultRow)


Copyright © 2007-2009 IISG AGH-UST Krakow, Poland. All Rights Reserved.