Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.jasig.portal.tools.dbloader
Class DbLoader

    java.lang.Object
      org.jasig.portal.tools.dbloader.DbLoader

    public class DbLoader

extends java.lang.Object

A tool to set up a uPortal database. This tool was created so that uPortal developers would only have to maintain a single set of xml documents to define the uPortal database schema and data. Previously it was necessary to maintain different scripts for each database we wanted to support.

DbLoader reads the generic types that are specified in tables.xml and tries to map them to local types by querying the database metadata via methods implemented by the JDBC driver. Fallback mappings can be supplied in dbloader.xml for cases where the JDBC driver is not able to determine the appropriate mapping. Such cases will be reported to standard out.

An xsl transformation is used to produce the DROP TABLE and CREATE TABLE SQL statements. These statements can be altered by modifying tables.xsl

Generic data types (as defined in java.sql.Types) which may be specified in tables.xml include: `BIT, TINYINT, SMALLINT, INTEGER, BIGINT, FLOAT, REAL, DOUBLE, NUMERIC, DECIMAL, CHAR, VARCHAR, LONGVARCHAR, DATE, TIME, TIMESTAMP, BINARY, VARBINARY, LONGVARBINARY, NULL, OTHER, JAVA_OBJECT, DISTINCT, STRUCT, ARRAY, BLOB, CLOB, REF, DATALINK, BOOLEAN`

WARNING: YOU MAY WANT TO MAKE A BACKUP OF YOUR DATABASE BEFORE RUNNING DbLoader

DbLoader will perform the following steps:

1. Read configurable properties from dbloader.xml
2. Get database connection from RDBMServices (reads JDBC database settings from rdbm.properties).
3. Read tables.xml and issue corresponding DROP TABLE and CREATE TABLE SQL statements.
4. Read data.xml and issue corresponding INSERT/UPDATE/DELETE SQL statements.

Since:
  uPortal 2.0
Version:
  $Revision: 1.31 $
Author:
  Ken Weiner, kweiner@unicon.net, Mark Boyd, mboyd@sungardsct.com
See Also:
  `Types`

Field Summary
`private Configuration` | `config`

Constructor Summary
`DbLoader()` Creates a default DbLoader with no configuration object installed.
`DbLoader(Configuration c)`

Method Summary
`(package private) static void` | `exit(Configuration config)`
`private static java.net.URL` | `getDataFileUri(java.lang.String file)`
`private static org.xml.sax.XMLReader` | `getXMLReader()`
`private static void` | `initScript(Configuration config)`
`static void` | `loadConfiguration(Configuration config)`
`static void` | `main(java.lang.String[] args)`
`void` | `process()`
`private static void` | `readOverrides(Configuration config, java.lang.String[] args)`
`void` | `setConfig(Configuration c)` Set the configuration object to govern DbLoader's behavior.

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Field Detail

### config

    private Configuration config

Constructor Detail

### DbLoader

    public DbLoader(Configuration c)

### DbLoader

    public DbLoader()

  Creates a default DbLoader with no configuration object installed. Before DbLoader can work it must have a configuration object set.

Method Detail

### setConfig

    public void setConfig(Configuration c)

  Set the configuration object to govern DbLoader's behavior.

  Parameters:
    `c` -

### main

    public static void main(java.lang.String[] args)

### process

    public void process()
                 throws java.sql.SQLException,
                        PortalException,
                        java.io.IOException,
                        org.xml.sax.SAXException,
                        javax.xml.parsers.ParserConfigurationException

  Throws:
    `java.sql.SQLException`
    `PortalException`
    `java.io.IOException`
    `org.xml.sax.SAXException`
    `javax.xml.parsers.ParserConfigurationException`

### loadConfiguration

    public static void loadConfiguration(Configuration config)
                                  throws javax.xml.parsers.ParserConfigurationException,
                                         org.xml.sax.SAXException,
                                         java.io.IOException

  Throws:
    `javax.xml.parsers.ParserConfigurationException`
    `org.xml.sax.SAXException`
    `java.io.IOException`

### readOverrides

    private static void readOverrides(Configuration config,
                                      java.lang.String[] args)
                               throws java.net.MalformedURLException

  Parameters:
    `config` -
  Throws:
    `java.net.MalformedURLException`

### getDataFileUri

    private static java.net.URL getDataFileUri(java.lang.String file)
                                        throws java.lang.IllegalArgumentException

  Parameters:
    `file` -
  Returns:
  Throws:
    `java.lang.IllegalArgumentException`

### getXMLReader

    private static org.xml.sax.XMLReader getXMLReader()
                                               throws org.xml.sax.SAXException,
                                                      javax.xml.parsers.ParserConfigurationException

  Throws:
    `org.xml.sax.SAXException`
    `javax.xml.parsers.ParserConfigurationException`

### initScript

    private static void initScript(Configuration config)
                            throws java.io.IOException

  Throws:
    `java.io.IOException`

### exit

    static void exit(Configuration config)

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD