Overview | Package | Class | Tree | Deprecated | Index | Help
| SolarMetric Kodo JDO 3.2.4 generated on January 7 2005
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## kodo.jdbc.meta
Class DBMappingFactory

    java.lang.Object
      |
      +--kodo.jdbc.meta.DBMappingFactory

All Implemented Interfaces:
  Configurable, MappingFactory

public class DBMappingFactory
extends Object
implements MappingFactory, Configurable

Factory that uses an XML mapping definition stored in the database to record the system mappings.

Field Summary
`static String` | `ACTION_ADD`
`static String` | `ACTION_CLEAN`
`static String` | `ACTION_DROP`

Constructor Summary
`DBMappingFactory()`

Method Summary
`void` | `addExtensionKeys(Collection exts, Mapping mapping)` Add any metadata extension keys that this MappingFactory uses to store mapping information.
`void` | `clean(ClassLoader loader)` Removes all records stored for non-existant classes.
`boolean` | `dropMappings(ClassMetaData[] types)` Delete the given mappings.
`void` | `dropTable()` Drops the mapping table in the DB.
`void` | `endConfiguration()` Invoked upon completion of bean property configuration for this object.
`Column` | `getBKColumn()`
`JDBCConfiguration` | `getConfiguration()`
`protected Connection` | `getConnection()` Return a database connection.
`Column` | `getMappingColumn()`
`Column` | `getPKColumn()`
`String` | `getTableName()` The name of the mapping information table.
`boolean` | `isSingleOperation()` Return true if this factory reads and writes all system mappings at once.
`boolean` | `isSingleRow()` Whether to use a single row for all mapping data, or to place the data for each class in a separate row.
`static void` | `main(String[] args)` Usage: java kodo.jdbc.schema.DBMappingFactory [option]* -action/-a <add | drop | clean>
`void` | `readMapping(ClassMetaData type, MappingInfoRepository repos)` Read the object-relational mapping for the given persistent type and add it to the given repository.
`String` | `readMappingColumn(String clsName)` Returns the mapping as an XML string, or null if none.
`void` | `refreshTable()` Creates the mapping table in the DB.
`boolean` | `revertMappings(ClassMetaData[] types)` Revert the mappings to their last saved state, or return false if any cannot be reverted.
`static boolean` | `run(JDBCConfiguration conf, String[] args, serp.util.Options opts)` Run the tool.
`static boolean` | `run(JDBCConfiguration conf, String action, ClassLoader loader)` Run the tool.
`void` | `setConfiguration(Configuration conf)` Invoked prior to setting bean properties.
`void` | `setSingleRow(boolean singleRow)` Whether to use a single row for all mapping data, or to place the data for each class in a separate row.
`void` | `setTableName(String name)` The name of the mapping information table.
`void` | `startConfiguration()` Invoked before bean property configuration is begun on this object.
`void` | `storeMappings(MappingInfoRepository mappings, JDOMetaDataRepository repos)` Store any changes made to the given mappings, including their field mappings.
`void` | `writeMappingColumn(String clsName, String mapping, String lastMapping, boolean insert)` Writes the mappings as a string to the database.

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

Field Detail

### ACTION_ADD

    public static final String ACTION_ADD

### ACTION_DROP

    public static final String ACTION_DROP

### ACTION_CLEAN

    public static final String ACTION_CLEAN

Constructor Detail

### DBMappingFactory

    public DBMappingFactory()

Method Detail

### isSingleRow

    public boolean isSingleRow()

  Whether to use a single row for all mapping data, or to place the data for each class in a separate row.

### setSingleRow

    public void setSingleRow(boolean singleRow)

  Whether to use a single row for all mapping data, or to place the data for each class in a separate row.

### getTableName

    public String getTableName()

  The name of the mapping information table. Defaults to `JDO_MAPPINGS`.

### setTableName

    public void setTableName(String name)

  The name of the mapping information table. Defaults to `JDO_MAPPINGS`.

### getConfiguration

    public JDBCConfiguration getConfiguration()

### setConfiguration

    public void setConfiguration(Configuration conf)

  Description copied from interface: `Configurable`
  Invoked prior to setting bean properties.
  Specified by:
    `setConfiguration` in interface `Configurable`

### startConfiguration

    public void startConfiguration()

  Description copied from interface: `Configurable`
  Invoked before bean property configuration is begun on this object.
  Specified by:
    `startConfiguration` in interface `Configurable`

### endConfiguration

    public void endConfiguration()

  Description copied from interface: `Configurable`
  Invoked upon completion of bean property configuration for this object.
  Specified by:
    `endConfiguration` in interface `Configurable`

### getPKColumn

    public Column getPKColumn()

### getMappingColumn

    public Column getMappingColumn()

### getBKColumn

    public Column getBKColumn()

### isSingleOperation

    public boolean isSingleOperation()

  Description copied from interface: `MappingFactory`
  Return true if this factory reads and writes all system mappings at once. Knowing this lets us optimize some operations. If a factory returns true to this method, then it should be able to handle `MappingFactory.readMapping(kodo.meta.ClassMetaData, kodo.jdbc.meta.MappingInfoRepository)` and `MappingFactory.revertMappings(kodo.meta.ClassMetaData[])` calls that pass in a null meta data argument.
  Specified by:
    `isSingleOperation` in interface `MappingFactory`

### readMapping

    public void readMapping(ClassMetaData type,
                            MappingInfoRepository repos)

  Description copied from interface: `MappingFactory`
  Read the object-relational mapping for the given persistent type and add it to the given repository.
  Specified by:
    `readMapping` in interface `MappingFactory`
  Following copied from interface: `kodo.jdbc.meta.MappingFactory`
  Parameters:
    `type` - the type to read mapping information for
    `repos` - add the mapping information to this repository

### storeMappings

    public void storeMappings(MappingInfoRepository mappings,
                              JDOMetaDataRepository repos)

  Description copied from interface: `MappingFactory`
  Store any changes made to the given mappings, including their field mappings.
  Specified by:
    `storeMappings` in interface `MappingFactory`
  Following copied from interface: `kodo.jdbc.meta.MappingFactory`
  Parameters:
    `mappings` - the changed mappings
    `repos` - can be used to access class metadata if needed

### revertMappings

    public boolean revertMappings(ClassMetaData[] types)

  Description copied from interface: `MappingFactory`
  Revert the mappings to their last saved state, or return false if any cannot be reverted.
  Specified by:
    `revertMappings` in interface `MappingFactory`
  Following copied from interface: `kodo.jdbc.meta.MappingFactory`
  Parameters:
    `types` - the types to revert
  Returns:
    true if all mappings were reverted, false otherwise

### dropMappings

    public boolean dropMappings(ClassMetaData[] types)

  Description copied from interface: `MappingFactory`
  Delete the given mappings.
  Specified by:
    `dropMappings` in interface `MappingFactory`
  Following copied from interface: `kodo.jdbc.meta.MappingFactory`
  Parameters:
    `types` - the types to drop
  Returns:
    true if all mappings were dropped, false otherwise

### addExtensionKeys

    public void addExtensionKeys(Collection exts,
                                 Mapping mapping)

  Description copied from interface: `MappingFactory`
  Add any metadata extension keys that this MappingFactory uses to store mapping information.
  Specified by:
    `addExtensionKeys` in interface `MappingFactory`
  Following copied from interface: `kodo.jdbc.meta.MappingFactory`
  Parameters:
    `exts` - the collection to which to add the extension keys
    `mapping` - the mapping for which to add the keys

### refreshTable

    public void refreshTable()
                      throws SQLException

  Creates the mapping table in the DB.

### dropTable

    public void dropTable()
                   throws SQLException

  Drops the mapping table in the DB.

### readMappingColumn

    public String readMappingColumn(String clsName)
                             throws SQLException

  Returns the mapping as an XML string, or null if none.

### writeMappingColumn

    public void writeMappingColumn(String clsName,
                                   String mapping,
                                   String lastMapping,
                                   boolean insert)
                            throws SQLException

  Writes the mappings as a string to the database.

### clean

    public void clean(ClassLoader loader)
               throws SQLException

  Removes all records stored for non-existant classes. Relies on all valid classes being compiled and loadable via the given class loader.

### getConnection

    protected Connection getConnection()
                                throws SQLException

  Return a database connection.

### main

    public static void main(String[] args)
                     throws IOException,
                            SQLException

  Usage: java kodo.jdbc.schema.DBMappingFactory [option]* -action/-a <add | drop | clean>

  Where the following options are recognized.

  - -properties <properties file or resource>: The path or resource name of a Kodo properties file containing information such as the license key and connection data as outlined in `JDBCConfiguration`. Optional.
  - -<property name> <property value>: All bean properties of the Kodo `JDBCConfiguration` can be set by using their names and supplying a value. For example: `-licenseKey adslfja83r3lkadf`

  The various actions are as follows.

  - add: Create the mapping table.
  - drop: Drop the mapping table.
  - clean: Remove all mapping table records for classes that can't be instantiated via a `Class.forName` call.

### run

    public static boolean run(JDBCConfiguration conf,
                              String[] args,
                              serp.util.Options opts)
                       throws IOException,
                              SQLException

  Run the tool. Returns false if invalid options are given.

### run

    public static boolean run(JDBCConfiguration conf,
                              String action,
                              ClassLoader loader)
                       throws SQLException

  Run the tool. Return false if an invalid option was given.

Overview | Package | Class | Tree | Deprecated | Index | Help
| SolarMetric Kodo JDO 3.2.4 generated on January 7 2005
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright 2001,2002 SolarMetric, Inc. All Rights Reserved.