org.enableit.db.darrt
Class SchemaHandler

java.lang.Object
  |
  +--org.enableit.db.darrt.AbstractFileHandler
        |
        +--org.enableit.db.darrt.AbstractSchemaHandler
              |
              +--org.enableit.db.darrt.SchemaHandler

public class SchemaHandler
extends AbstractSchemaHandler

The entry point or facade for the library. External tools should only need to access this class.

This class expects always to have a reference and a target schema. Sometimes they may be taken from the same XML file, as in the case of installing a .dar file. On other occasions they may be completly separate as with the case of comparing two online datasources.

Either schema may be specified in a range of ways such as by setting the URL where a darrt-schema document may be found, specifying online datasources or providing pre-instantiated object representations.

Author:
default

Field Summary
 
Fields inherited from class org.enableit.db.darrt.AbstractFileHandler
ABOUT
 
Constructor Summary
SchemaHandler()
          Default constructor.
 
Method Summary
 void alterSchema()
          Compares the reference and target schemas, then modifies the target as necessary to match the reference.
 void changeTarget()
          Changes the target database defined by the reference schema XML document to the values held in the target provider.
 void createSchema()
          Creates the reference schema at the location identified first by the provider parameter or if null by the provider details inside the target schema.
 org.enableit.db.beans.Database export()
          Export the schema identified by the reference provider property.
 java.util.List orderDependencies(org.enableit.db.beans.Schema schema)
          Order the schema's tables for data import (i.e.
 
Methods inherited from class org.enableit.db.darrt.AbstractSchemaHandler
addListener, addListeners, diffSchemas, getDatabase, getDebug, getListeners, getOnlineRefSchema, getOnlineTargetSchema, getRefDatabase, getRefSchemaName, getRefSchemaUrl, getTablePattern, getTargetDatabase, getTargetSchemaUrl, setDebug, setOnlineRefSchema, setOnlineTargetSchema, setRefDatabase, setRefSchemaName, setRefSchemaUrl, setTablePattern, setTargetDatabase, setTargetSchemaUrl
 
Methods inherited from class org.enableit.db.darrt.AbstractFileHandler
getOperDir, setOperDir
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SchemaHandler

public SchemaHandler()
Default constructor.

Method Detail

export

public org.enableit.db.beans.Database export()
Export the schema identified by the reference provider property.

Returns:
Database instance representing the exported schema.

createSchema

public void createSchema()
                  throws SchemaHandlingException
Creates the reference schema at the location identified first by the provider parameter or if null by the provider details inside the target schema.

Note that if this method is used to create a schema in a database where any tables exist with the same names, then those tables will be modified to fit the reference schema.

SchemaHandlingException

alterSchema

public void alterSchema()
                 throws SchemaHandlingException
Compares the reference and target schemas, then modifies the target as necessary to match the reference.

SchemaHandlingException

changeTarget

public void changeTarget()
                  throws SchemaHandlingException
Changes the target database defined by the reference schema XML document to the values held in the target provider.

SchemaHandlingException

orderDependencies

public java.util.List orderDependencies(org.enableit.db.beans.Schema schema)
Order the schema's tables for data import (i.e. referenced tables first)

Parameters:
schema - The schema to order tables for.
Returns:
List of table names.


Copyright © 1999-2004 enableIT.org. All Rights Reserved.