|
SolarMetric Kodo JDO Enterprise Edition 2.3.1 generated on August 20 2002 | ||||||||
| 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 |
LIST
|
static String |
OUTPUT_STDOUT
|
static String |
REFRESH
|
static String |
REGISTER
|
static String |
UNREGISTER
|
| Constructor Summary | |
SchemaTool(JDBCConfiguration conf)
Construct a SchemaTool that will use the given database. |
|
| 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. |
boolean |
getCacheTables()
If true, only one call will be made to getTables() in the DatabaseMetaData. |
JDBCConfiguration |
getConfiguration()
Return the configuration in use by this tool. |
Connection |
getConnection()
Return a connection to the database. |
boolean |
getIgnoreErrors()
If true, SQLExceptions thrown during schema manipulation will be printed but ignored. |
String[] |
list()
Return a list of persistent types registered with the schema tool. |
static void |
main(JDBCConfiguration conf,
String action,
boolean ignoreErrors,
String outFile,
String[] args,
ClassLoader loader,
boolean dropCache)
Utility method to run the schematool on all items in args. |
static void |
main(String[] args)
Usage: java com.solarmetric.kodo.impl.schema.SchemaTool [option]* -action <add | refresh | drop | list | register | unregister> <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 |
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 |
register(String className)
Add the given class name to the list of registered classes. |
void |
register(String[] classNames)
Add the given class names to the list of registered classes. |
void |
setCacheTables(boolean cacheTables)
If true, only one call will be made to getTables() in the DatabaseMetaData. |
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 |
unregister(String className)
Remove the given class name from the list of registered classes. |
void |
unregister(String[] classNames)
Remove the given class names from the list of registered classes. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
public static String OUTPUT_STDOUT
public static String ADD
public static String REFRESH
public static String DROP
public static String UNREGISTER
public static String REGISTER
public static String LIST
| Constructor Detail |
public SchemaTool(JDBCConfiguration conf)
| Method Detail |
public JDBCConfiguration getConfiguration()
public Connection getConnection()
public void close()
throws SQLException
public boolean getIgnoreErrors()
public void setIgnoreErrors(boolean ignoreErrs)
public boolean getCacheTables()
public void setCacheTables(boolean cacheTables)
public void setOutputWriter(PrintWriter out)
throws IOException
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 String[] list()
throws SQLException
public void unregister(String className)
throws SQLException
public void unregister(String[] classNames)
throws SQLException
public void register(String className)
throws SQLException
public void register(String[] classNames)
throws SQLException
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 static void main(String[] args)
throws SQLException,
ClassNotFoundException,
IOException
Usage: java com.solarmetric.kodo.impl.schema.SchemaTool [option]* -action <add | refresh | drop | list | register | unregister> <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 adslfja83r3lkadffalsesystem.prefs, the name of the database to access;
optionalIf 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,
ClassLoader loader,
boolean dropCache)
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, UNREGISTER,
REGISTER, or LIST.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.
|
SolarMetric Kodo JDO Enterprise Edition 2.3.1 generated on August 20 2002 | ||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||