CSVObjects Framework

Package net.sf.anupam.csv

Provides a framework for parsing and reading CSV files transparently, via meta-data definitions, a'la Hibernate.

See:
          Description

Class Summary
CSVParser Parses CSV files and creates the mapped POJO objects.
CSVParserFactory Singleton factory for creating the CSVParser parser objects for clients' of the framework.
CSVReader Reads a CSV file and parses the individual fields for each CSV record in the file.
 

Package net.sf.anupam.csv Description

Provides a framework for parsing and reading CSV files transparently, via meta-data definitions, a'la Hibernate. This allows yor application's CSV processing and parsing logic to be completely transparent and dependent only on POJO JavaBean representation of the the CSV records.

The main class for the framework is CSVParser, which provides a Iterable interface for parsing and retrieving the POJO beans from the CSV records transparently. Configuration of the parser is done via XML mapping files.

The CSVParserFactory is the main factory for creation and instantiation on the CSV parsers.

Implementation of the framework is based on Stephen Ostermiller's excellent CSV parsing engine.

Configuration

Configuration of the CSV to POJO mapping is done via an XML mapping file, which should be named csv-mapping.xml. The file needs to be present in the CLASSPATH at the root level.

The parser framework provides convenience Xdoclet tagsets and templates for auto-generation of the mapping XML file directly from the POJOs being mapped. This is similar to the Xdoclet support for Hibernate persistance framework, and behaves in a similar fashion in terms of the mapping and configuration generation.

Format of the file is:
<?xml version="1.0"?>
<csv-mapping>
<bean-mapping name="declarative name of the POJO bean to be mapped"
class="fully qualified name of the POJO's class">
</bean-mapping>
</csv-mapping>

Logging and Debugging

The framework uses the Jakarta Commons logging as its logging framework. Any standard setup (including Log4j) can be used as the actual logger.

Notes


SourceForge.net Logo

© Anupam Sengupta 2005