org.apache.openjpa.jdbc.schema
Class TableSchemaFactory

java.lang.Object
  extended by org.apache.openjpa.jdbc.schema.TableSchemaFactory
All Implemented Interfaces:
SchemaFactory, Configurable

public class TableSchemaFactory
extends Object
implements SchemaFactory, Configurable

Factory that uses an XML schema definition stored in a database table to record the system schema.

Author:
Abe White

Field Summary
static String ACTION_ADD
           
static String ACTION_DROP
           
 
Constructor Summary
TableSchemaFactory()
           
 
Method Summary
 void dropTable()
          Drops the sequence table in the DB.
 void endConfiguration()
          Invoked upon completion of bean property configuration for this object.
 JDBCConfiguration getConfiguration()
           
 String getPrimaryKeyColumn()
          The name of the primary key column on the schema definition table.
 String getSchemaColumn()
          The name of the schema column on the schema definition table.
 String getTable()
          The name of the schema definition table.
static void main(String[] args)
          Usage: java org.apache.openjpa.jdbc.schema.TableSchemaFactory [option]* -action/-a <add | drop> Where the following options are recognized.
 SchemaGroup readSchema()
          Return the schema group for the current object model and database.
 String readSchemaColumn()
          Returns the schema as an XML string.
 void refreshTable()
          Creates the schema table in the DB.
static boolean run(JDBCConfiguration conf, String action)
          Run the tool.
static boolean run(JDBCConfiguration conf, String[] args, Options opts)
          Run the tool.
 void setConfiguration(Configuration conf)
          Invoked prior to setting bean properties.
 void setPrimaryKeyColumn(String name)
          The name of the primary key column on the schema definition table.
 void setSchemaColumn(String name)
          The name of the schema column on the schema definition table.
 void setTable(String name)
          The name of the schema definition table.
 void setTableName(String name)
          Deprecated. Use setTable(java.lang.String). Retained for backwards-compatible auto-configuration.
 void startConfiguration()
          Invoked before bean property configuration is begun on this object.
 void storeSchema(SchemaGroup schema)
          Record the schema group after changes may have been made.
 void writeSchemaColumn(String schema)
          Writes the schema 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
See Also:
Constant Field Values

ACTION_DROP

public static final String ACTION_DROP
See Also:
Constant Field Values
Constructor Detail

TableSchemaFactory

public TableSchemaFactory()
Method Detail

getTable

public String getTable()
The name of the schema definition table. Defaults to OPENJPA_SCHEMA.


setTable

public void setTable(String name)
The name of the schema definition table. Defaults to OPENJPA_SCHEMA.


setTableName

public void setTableName(String name)
Deprecated. Use setTable(java.lang.String). Retained for backwards-compatible auto-configuration.


setPrimaryKeyColumn

public void setPrimaryKeyColumn(String name)
The name of the primary key column on the schema definition table. Defaults to ID.


getPrimaryKeyColumn

public String getPrimaryKeyColumn()
The name of the primary key column on the schema definition table. Defaults to ID.


setSchemaColumn

public void setSchemaColumn(String name)
The name of the schema column on the schema definition table. Defaults to SCHEMA_DEF.


getSchemaColumn

public String getSchemaColumn()
The name of the schema column on the schema definition table. Defaults to SCHEMA_DEF.


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

readSchema

public SchemaGroup readSchema()
Description copied from interface: SchemaFactory
Return the schema group for the current object model and database.

Specified by:
readSchema in interface SchemaFactory

storeSchema

public void storeSchema(SchemaGroup schema)
Description copied from interface: SchemaFactory
Record the schema group after changes may have been made.

Specified by:
storeSchema in interface SchemaFactory
Parameters:
schema - the schema definition for the entire system

refreshTable

public void refreshTable()
                  throws SQLException
Creates the schema table in the DB.

Throws:
SQLException

dropTable

public void dropTable()
               throws SQLException
Drops the sequence table in the DB.

Throws:
SQLException

readSchemaColumn

public String readSchemaColumn()
                        throws SQLException
Returns the schema as an XML string.

Throws:
SQLException

writeSchemaColumn

public void writeSchemaColumn(String schema)
                       throws SQLException
Writes the schema as a string to the database.

Throws:
SQLException

main

public static void main(String[] args)
                 throws IOException,
                        SQLException
Usage: java org.apache.openjpa.jdbc.schema.TableSchemaFactory [option]* -action/-a <add | drop> Where the following options are recognized. The various actions are as follows.

Throws:
IOException
SQLException

run

public static boolean run(JDBCConfiguration conf,
                          String[] args,
                          Options opts)
                   throws IOException,
                          SQLException
Run the tool. Returns false if invalid options were given.

Throws:
IOException
SQLException
See Also:
main(java.lang.String[])

run

public static boolean run(JDBCConfiguration conf,
                          String action)
                   throws IOException,
                          SQLException
Run the tool.

Throws:
IOException
SQLException


Copyright © 2006 Apache Software Foundation. All Rights Reserved.