Overview | Package | Class | Tree | Deprecated | Index | Help
| SolarMetric Kodo JDO 2.5.0 Reverse Schema Tool
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## com.solarmetric.rd.kodo.impl.jdbc.meta
Class SingleRowDBMappingFactory

    java.lang.Object
      |
      +--com.solarmetric.rd.kodo.impl.jdbc.meta.SingleRowDBMappingFactory

All Implemented Interfaces:
  MappingFactory

public class SingleRowDBMappingFactory
extends java.lang.Object
implements MappingFactory

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

Field Summary
`static java.lang.String` | `ACTION_ADD`
`static java.lang.String` | `ACTION_DROP`

Constructor Summary
`SingleRowDBMappingFactory()`

Method Summary
`boolean` | `dropMappings(com.solarmetric.rd.kodo.meta.ClassMetaData[] types)` Delete the given mappings.
`void` | `dropTable()` Drops the mapping table in the DB.
`com.solarmetric.rd.kodo.impl.jdbc.meta.ClassIndicator[]` | `getAvailableClassIndicators()` Return a list of all available class indicators, ordered from most to least general.
`com.solarmetric.rd.kodo.impl.jdbc.meta.ClassMapping[]` | `getAvailableClassMappings()` Return a list of all available class mappings, ordered from most to least general.
`com.solarmetric.rd.kodo.impl.jdbc.meta.FieldMapping[]` | `getAvailableFieldMappings()` Return a list of all available field mappings, ordered from least to most general.
`com.solarmetric.rd.kodo.impl.jdbc.meta.VersionIndicator[]` | `getAvailableVersionIndicators()` Return a list of all available version indicators, ordered from most to least general.
`com.solarmetric.rd.kodo.impl.jdbc.schema.Column` | `getBKColumn()`
`com.solarmetric.rd.kodo.impl.jdbc.conf.JDBCConfiguration` | `getConfiguration()`
`protected java.sql.Connection` | `getConnection()` Return a connection to use.
`com.solarmetric.rd.kodo.impl.jdbc.schema.Column` | `getMappingColumn()`
`com.solarmetric.rd.kodo.impl.jdbc.schema.Column` | `getPKColumn()`
`boolean` | `isSingleOperation()` Return true if this factory reads and writes all system mappings at once.
`static void` | `main(java.lang.String[] args)` Usage: java com.solarmetric.kodo.impl.jdbc.schema.SingleRowDBMappingFactory [option]* -action/-a <add | drop>
`void` | `readMapping(com.solarmetric.rd.kodo.meta.ClassMetaData type, com.solarmetric.rd.kodo.impl.jdbc.meta.MappingInfoRepository repos)` Read the object-relational mapping for the given persistent type and add it to the given repository.
`java.lang.String` | `readMappingColumn()` Returns the mappings as an XML string.
`void` | `refreshTable()` Creates the mapping table in the DB.
`boolean` | `revertMappings(com.solarmetric.rd.kodo.meta.ClassMetaData[] types)` Revert the mappings to their last saved state, or return false if any cannot be reverted.
`static boolean` | `run(com.solarmetric.rd.kodo.impl.jdbc.conf.JDBCConfiguration conf, java.lang.String action)` Run the tool.
`void` | `setConfiguration(com.solarmetric.rd.kodo.impl.jdbc.conf.JDBCConfiguration conf)` Set the configuration for the factory.
`void` | `storeMappings(com.solarmetric.rd.kodo.impl.jdbc.meta.MappingInfoRepository mappings, com.solarmetric.rd.kodo.meta.JDOMetaDataRepository repos)` Store any changes made to the given mappings, including their field mappings.
`void` | `writeMappingColumn(java.lang.String mapping, java.lang.String lastMapping)` 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 java.lang.String ACTION_ADD

See Also:
  Constant Field Values

### ACTION_DROP

    public static final java.lang.String ACTION_DROP

See Also:
  Constant Field Values

Constructor Detail

### SingleRowDBMappingFactory

    public SingleRowDBMappingFactory()

Method Detail

### getConfiguration

    public com.solarmetric.rd.kodo.impl.jdbc.conf.JDBCConfiguration getConfiguration()

### setConfiguration

    public void setConfiguration(com.solarmetric.rd.kodo.impl.jdbc.conf.JDBCConfiguration conf)

  Description copied from interface: `MappingFactory`
  Set the configuration for the factory.

  Specified by:
    `setConfiguration` in interface `MappingFactory`

### getPKColumn

    public com.solarmetric.rd.kodo.impl.jdbc.schema.Column getPKColumn()

### getMappingColumn

    public com.solarmetric.rd.kodo.impl.jdbc.schema.Column getMappingColumn()

### getBKColumn

    public com.solarmetric.rd.kodo.impl.jdbc.schema.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(com.solarmetric.rd.kodo.meta.ClassMetaData, com.solarmetric.rd.kodo.impl.jdbc.meta.MappingInfoRepository)` and `MappingFactory.revertMappings(com.solarmetric.rd.kodo.meta.ClassMetaData[])` calls that pass in a null meta data argument.

  Specified by:
    `isSingleOperation` in interface `MappingFactory`

### readMapping

    public void readMapping(com.solarmetric.rd.kodo.meta.ClassMetaData type,
                            com.solarmetric.rd.kodo.impl.jdbc.meta.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`
  Parameters:
    `type` - the type to read mapping information for
    `repos` - add the mapping information to this repository

### storeMappings

    public void storeMappings(com.solarmetric.rd.kodo.impl.jdbc.meta.MappingInfoRepository mappings,
                              com.solarmetric.rd.kodo.meta.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`
  Parameters:
    `mappings` - the changed mappings
    `repos` - can be used to access class metadata if needed

### refreshTable

    public void refreshTable()
                      throws java.sql.SQLException

  Creates the mapping table in the DB.

    `java.sql.SQLException`

### dropTable

    public void dropTable()
                   throws java.sql.SQLException

  Drops the mapping table in the DB.

    `java.sql.SQLException`

### revertMappings

    public boolean revertMappings(com.solarmetric.rd.kodo.meta.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`
  Parameters:
    `types` - the types to revert
  Returns:
    true if all mappings were reverted, false otherwise

### dropMappings

    public boolean dropMappings(com.solarmetric.rd.kodo.meta.ClassMetaData[] types)

  Description copied from interface: `MappingFactory`
  Delete the given mappings.

  Specified by:
    `dropMappings` in interface `MappingFactory`
  Parameters:
    `types` - the types to drop
  Returns:
    true if all mappings were dropped, false otherwise

### getAvailableClassMappings

    public com.solarmetric.rd.kodo.impl.jdbc.meta.ClassMapping[] getAvailableClassMappings()

  Description copied from interface: `MappingFactory`
  Return a list of all available class mappings, ordered from most to least general.

  Specified by:
    `getAvailableClassMappings` in interface `MappingFactory`

### getAvailableFieldMappings

    public com.solarmetric.rd.kodo.impl.jdbc.meta.FieldMapping[] getAvailableFieldMappings()

  Description copied from interface: `MappingFactory`
  Return a list of all available field mappings, ordered from least to most general. When creating a default mapping for a new field, we call the `Mapping.map()` method on a new instance of each returned mapping util one returns true, or until the list is exhausted. Implementations are free to use or add to the standard mappings list available from `FieldMapping.getDefaults()`.

  Specified by:
    `getAvailableFieldMappings` in interface `MappingFactory`

### getAvailableVersionIndicators

    public com.solarmetric.rd.kodo.impl.jdbc.meta.VersionIndicator[] getAvailableVersionIndicators()

  Description copied from interface: `MappingFactory`
  Return a list of all available version indicators, ordered from most to least general.

  Specified by:
    `getAvailableVersionIndicators` in interface `MappingFactory`

### getAvailableClassIndicators

    public com.solarmetric.rd.kodo.impl.jdbc.meta.ClassIndicator[] getAvailableClassIndicators()

  Description copied from interface: `MappingFactory`
  Return a list of all available class indicators, ordered from most to least general.

  Specified by:
    `getAvailableClassIndicators` in interface `MappingFactory`

### readMappingColumn

    public java.lang.String readMappingColumn()
                                       throws java.sql.SQLException

  Returns the mappings as an XML string.

    `java.sql.SQLException`

### writeMappingColumn

    public void writeMappingColumn(java.lang.String mapping,
                                   java.lang.String lastMapping)
                            throws java.sql.SQLException

  Writes the mappings as a string to the database.

    `java.sql.SQLException`

### getConnection

    protected java.sql.Connection getConnection()
                                         throws java.sql.SQLException

  Return a connection to use. The connection will log SQL.

    `java.sql.SQLException`

### main

    public static void main(java.lang.String[] args)
                     throws java.io.IOException,
                            java.sql.SQLException

  Usage: java com.solarmetric.kodo.impl.jdbc.schema.SingleRowDBMappingFactory [option]* -action/-a <add | drop>

  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.

    `java.io.IOException`
    `java.sql.SQLException`

### run

    public static boolean run(com.solarmetric.rd.kodo.impl.jdbc.conf.JDBCConfiguration conf,
                              java.lang.String action)
                       throws java.sql.SQLException

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

    `java.sql.SQLException`

Overview | Package | Class | Tree | Deprecated | Index | Help
| SolarMetric Kodo JDO 2.5.0 Reverse Schema Tool
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

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