are.morf-core.2.21.1.source-code.overview.html Maven / Gradle / Ivy
Show all versions of morf-core Show documentation
Database Support Library
Provides interfaces and classes for managing databases and datasets.
Functionality is provided in the following areas:
- Database meta data functionality defined by interfaces in the package
com.chpconsulting.database.metadata.
- Database deployment and upgrade functionality is available through FullDeployment
and a class that hasn't been implemented yet.
- Data set functionality is available for streaming data between data bases and file systems in the package in the package
com.chpconsulting.database.dataset.
Key Data Set Concepts
Cryo functionality is divided into the following behavioural categories:
Producers
Producers define sources of data. The main producer interface is DataSetProducer.
Producers allow random access to tables and then provide iterators over the records within those tables.
Consumers
Consumers define destinations for data. The main consumer interface is DataSetConsumer.
Consumers are modelled on SAX semantics and expect to have data set 'events' pushed onto them.
Connectors
Connectors link producers to consumers. The main connector class is DataSetConnector.
Given a producer and a consumer connectors can transmit all information from one to the other.
Adapters
Adapters typically modify a data set in transit either by wrapping a data set producer or by wrapping a data set consumer. They can then be added to
the chain Producer -> Adapter -> Connector -> Consumer or Producer -> Connector -> Adapter -> Consumer or even both.
Typical Usage
Extracting data from a database to an XML file
DataSetProducer producer = new DatabaseDataSetProducer(connectionResources);
DataSetConsumer consumer = new XmlDataSetConsumer(writer);
new DataSetConnector(producer, consumer).connect();
Inserting data from an XML file to a database
DataSetProducer producer = new XmlDataSetProducer(reader);
DataSetConsumer consumer = new DatabaseDataSetConsumer(connectionResources);
new DataSetConnector(producer, consumer).connect();