Sunday, December 19, 2010

How the Importer works

The Importer is a simple mechanism that performs four basic steps to import from a source to destination within four corresponding components:
  1. A Service which obtains a source.
  2. An Importer that gets the data from the source.
  3. An Updater that updates one or more destinations with the data.
  4. A Handler that takes whatever action is required after the import has completed. Typical actions include handling individual update errors and informing the source provider of the status of the import.




Because there are a variety of ways to perform each of the four steps, the Importer is designed so each of the four corresponding components can be extended or replaced. The points where components can be extended are colored red in the following:

 

It isn't necessary to extend any of the components other than TableDataUpdater, however, because the Importer comes with the following stock implementations to cover common uses:
  1. Both DirectoryWatch and Queue Services for monitoring directories and queues respectively for source data.
  2. An Importer that extracts data from delimited text sources.
  3. A Handler that saves records that were rejected by Updaters and provides a user interface for editing and re-submitting them.
The only component that needs to be extended is TableDataUpdater, and it only requires one override, getMatchingEntityWhereClause(), to help it identify unique destination records. ValidateValues() can also be overridden if necessary to customize the logic used to validate records before updating the destination. Otherwise, TableDataUpdater already implements basic validation and all the CRUD functionality required to update virtually any relational database destination 'out of the box'.



Extensible yet simple, the Importer provides both a foundation for new functionality as well as basic functionality required to import from text files to destination tables almost entirely through configuration.

No comments:

Post a Comment