|
SolarMetric Kodo JDO 2.5.8 generated on January 11 2004 | ||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Object | +--com.solarmetric.kodo.impl.jdbc.schema.SchemaTool
The SchemaTool is used to manage the database schema for JDO instances. The tool currently has the following limitations:
| Field Summary | |
static String |
ADD
|
static String |
DROP
|
static String |
OUTPUT_STDOUT
|
static String |
REFRESH
|
static String |
RELOAD
|
| Constructor Summary | |
SchemaTool(JDBCConfiguration conf,
ClassResolver resolver,
Connector connector)
Construct a SchemaTool that will use the given database. |
|
SchemaTool(JDBCConfiguration conf,
ClassResolver resolver,
Connector connector,
org.apache.commons.logging.Log sqllog,
org.apache.commons.logging.Log schemalog)
|
|
SchemaTool(JDBCConfiguration conf,
ClassResolver resolver,
SQLExecutionManager manager)
|
|
SchemaTool(JDBCConfiguration conf,
ClassResolver resolver,
SQLExecutionManager manager,
org.apache.commons.logging.Log sqllog,
org.apache.commons.logging.Log schemalog)
|
|
| Method Summary | |
void |
add(Class type)
Add the tables/columns used by the given class. |
void |
add(Class[] types)
Add the tables/columns used by the given classes. |
void |
addColumn(Column column)
Creates the given column in the DB, if it does not exist already. |
void |
addColumns(Column[] columns)
Creates the given columns in the DB if they do not exist already. |
void |
addTable(Table table)
Execute the SQL to create/refresh the given table in the DB. |
void |
addTables(Table[] tables)
Execute the SQL to create/refresh the given tables in the DB. |
void |
close()
Close the database connection used by the tool. |
void |
drop(Class type)
Drop the tables and/or columns used by the given class from the DB. |
void |
drop(Class[] types)
Drop the tables and/or columns used by the given classes from the DB. |
void |
dropColumn(Column column)
Drop the given column from the DB. |
void |
dropColumns(Column[] columns)
Drop the given columns from the DB. |
void |
dropTable(Table table)
Drop the given table from the DB. |
void |
dropTables(Table[] tables)
Drop the given tables from the DB. |
(package private) void |
executeSQL(SQLBuffer[] sql)
Executes the given array of non-selecting SQL statements, correctly logging the SQL calls and optionally ignoring errors. |
JDBCConfiguration |
getConfiguration()
Return the configuration in use by this tool. |
Connection |
getConnection()
Return a connection to the database. |
Connector |
getConnector()
Return a Connector for establishing connections. |
DBDictionary |
getDictionary()
|
boolean |
getIgnoreErrors()
If true, SQLExceptions thrown during schema manipulation will be printed but ignored. |
SQLExecutionManager |
getManager()
Returns the SQLExecutionManager currently in use by
this SchemaTool. |
(package private) com.solarmetric.kodo.impl.jdbc.schema.SchemaTool.SchemaCache |
getSchemaCache()
|
String[] |
list()
|
(package private) void |
log(Configuration conf,
String msg)
|
(package private) void |
log(String msg)
Log a message to this tool's log writer. |
static void |
main(JDBCConfiguration conf,
String action,
boolean ignoreErrors,
String outFile,
String[] args,
boolean dropCache,
ClassResolver resolver)
Utility method to run the schematool on all items in args. |
static void |
main(JDBCConfiguration conf,
String action,
boolean ignoreErrors,
String outFile,
String[] args,
boolean dropCache,
ClassResolver resolver,
org.apache.commons.logging.Log sqllog,
org.apache.commons.logging.Log schemalog)
|
static void |
main(String[] args)
Usage: java com.solarmetric.kodo.impl.schema.SchemaTool [option]* -action <add | refresh | drop> <class name | .class file | .jdo file<* |
void |
refresh(Class type)
Refresh/create the tables/columns used by the given class. |
void |
refresh(Class[] types)
Refresh/create the tables/columns used by the given classes. |
void |
refresh(Class[] types,
boolean dropUnused)
Refresh the schema for the given types, optionally dropping unused data. |
void |
refreshSequenceTables(Class[] types)
Determines the SequenceFactory for each of the types and
initializes their schema. |
void |
refreshTable(Table table)
Similar to addTable, but drops unused columns as well. |
void |
refreshTables(Table[] tables)
Similar to addTables, but drops unused columns as well. |
void |
setIgnoreErrors(boolean ignoreErrs)
If true, SQLExceptions thrown during schema manipulation will be printed but ignored. |
void |
setOutputWriter(PrintWriter out)
Specify a stream to log SQL commands to. |
void |
setSchemaLog(org.apache.commons.logging.Log log)
|
(package private) void |
warn(String msg)
Send a warning exception |
(package private) void |
warn(String msg,
Throwable t)
|
| Methods inherited from class java.lang.Object |
|
| Field Detail |
public static String OUTPUT_STDOUT
public static String ADD
public static String RELOAD
public static String REFRESH
public static String DROP
| Constructor Detail |
public SchemaTool(JDBCConfiguration conf,
ClassResolver resolver,
Connector connector)
throws SQLException
public SchemaTool(JDBCConfiguration conf,
ClassResolver resolver,
Connector connector,
org.apache.commons.logging.Log sqllog,
org.apache.commons.logging.Log schemalog)
throws SQLException
public SchemaTool(JDBCConfiguration conf,
ClassResolver resolver,
SQLExecutionManager manager)
public SchemaTool(JDBCConfiguration conf,
ClassResolver resolver,
SQLExecutionManager manager,
org.apache.commons.logging.Log sqllog,
org.apache.commons.logging.Log schemalog)
| Method Detail |
public JDBCConfiguration getConfiguration()
public Connection getConnection()
throws SQLException
public Connector getConnector()
throws SQLException
public DBDictionary getDictionary()
throws SQLException
com.solarmetric.kodo.impl.jdbc.schema.SchemaTool.SchemaCache getSchemaCache()
throws SQLException
public SQLExecutionManager getManager()
throws SQLException
SQLExecutionManager currently in use by
this SchemaTool.
public void close()
throws SQLException
public boolean getIgnoreErrors()
public void setIgnoreErrors(boolean ignoreErrs)
public void setOutputWriter(PrintWriter out)
throws IOException
public void setSchemaLog(org.apache.commons.logging.Log log)
public void drop(Class type)
throws SQLException
public void drop(Class[] types)
throws SQLException
public void add(Class type)
throws SQLException
public void add(Class[] types)
throws SQLException
public void refresh(Class type)
throws SQLException
public void refresh(Class[] types)
throws SQLException
public void refresh(Class[] types,
boolean dropUnused)
throws SQLException
public void refreshSequenceTables(Class[] types)
throws SQLException
SequenceFactory for each of the types and
initializes their schema.
public void dropTable(Table table)
throws SQLException
public void dropTables(Table[] tables)
throws SQLException
public void addTable(Table table)
throws SQLException
public void addTables(Table[] tables)
throws SQLException
public void refreshTable(Table table)
throws SQLException
public void refreshTables(Table[] tables)
throws SQLException
public void dropColumn(Column column)
throws SQLException
public void dropColumns(Column[] columns)
throws SQLException
public void addColumn(Column column)
throws SQLException
public void addColumns(Column[] columns)
throws SQLException
public String[] list()
void executeSQL(SQLBuffer[] sql)
throws SQLException
void log(String msg)
void warn(String msg)
void warn(String msg,
Throwable t)
void log(Configuration conf,
String msg)
public static void main(String[] args)
throws SQLException,
ClassNotFoundException,
IOException
Usage: java com.solarmetric.kodo.impl.schema.SchemaTool [option]* -action <add | refresh | drop> <class name | .class file | .jdo file<*
Where the following options are recognized.
Configuration;
optionalJDBCConfiguration can be set by using their
names and supplying a value; for example:
-licenseKey adslfja83r3lkadffalseIf the license key is not specified otherwise, Kodo will check for
default preference files with license keys as outlined in
DefaultConfiguration.
The various actions are as follows.
Each additional argument can be either the full class name of a type to act on, the path to the .class file for the type, or the path to a .jdo file listing one or more types. If no arguments are provided, the action will be peformed on all classes listed in the database in use.
public static void main(JDBCConfiguration conf,
String action,
boolean ignoreErrors,
String outFile,
String[] args,
boolean dropCache,
ClassResolver resolver)
throws SQLException,
ClassNotFoundException,
IOException
args.conf - The configuration to use for this schema toolaction - The action to perform. One of the string
constants ADD, REFRESH, DROP, or RELOAD.ignoreErrors - Whether or not errors should cause the
schema tool to abort.outFile - The file name to which SQL should be written,
or "stdout" write just SQL to standard output.args - The class names, class files, or .jdo files
to operate on.loader - The class loader to use for loading the
persistent typesdropCache - Whether or not the db cache should be dropped.
public static void main(JDBCConfiguration conf,
String action,
boolean ignoreErrors,
String outFile,
String[] args,
boolean dropCache,
ClassResolver resolver,
org.apache.commons.logging.Log sqllog,
org.apache.commons.logging.Log schemalog)
throws SQLException,
ClassNotFoundException,
IOException
|
SolarMetric Kodo JDO 2.5.8 generated on January 11 2004 | ||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||