SolarMetric Kodo JDO 2.5.0 Reverse Schema Tool

com.solarmetric.rd.kodo.impl.jdbc.schema
Class DBSequenceFactory

java.lang.Object
  |
  +--com.solarmetric.rd.kodo.impl.jdbc.schema.DBSequenceFactory
All Implemented Interfaces:
SequenceFactory

public class DBSequenceFactory
extends java.lang.Object
implements SequenceFactory

SequenceFactory implementation that uses a database table for sequence number generation. The table is automatically created if not already present.


Field Summary
static java.lang.String ACTION_ADD
           
static java.lang.String ACTION_DROP
           
static java.lang.String ACTION_INCREMENT
           
 
Constructor Summary
DBSequenceFactory()
           
 
Method Summary
 void dropTable()
          Drops the sequence table in the DB.
 int getIncrement()
          Return the increment to us when updating the sequence table.
 long getNext(java.lang.Class cls, java.lang.String user, java.lang.String pass)
          Return a unique primary key value.
static void main(java.lang.String[] args)
          Usage: java com.solarmetric.kodo.impl.jdbc.schema.DBSequenceFactory [option]* -action/-a <add | drop | increment>
 void refreshTable(java.lang.String user, java.lang.String pass)
          Creates the sequence table in the DB.
static boolean run(com.solarmetric.rd.kodo.impl.jdbc.conf.JDBCConfiguration conf, java.lang.String action, java.io.Writer out)
          Run the tool.
 void setConfiguration(com.solarmetric.rd.kodo.impl.jdbc.conf.JDBCConfiguration conf)
          Set the configuration for this factory; allows access to database connection information, etc.
 void setIncrement(int inc)
          Set the increment to use when updating the sequence table.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

ACTION_DROP

public static final java.lang.String ACTION_DROP
See Also:
Constant Field Values

ACTION_ADD

public static final java.lang.String ACTION_ADD
See Also:
Constant Field Values

ACTION_INCREMENT

public static final java.lang.String ACTION_INCREMENT
See Also:
Constant Field Values
Constructor Detail

DBSequenceFactory

public DBSequenceFactory()
Method Detail

getIncrement

public int getIncrement()
Return the increment to us when updating the sequence table. Sequence numbers will be grabbed in blocks of this value to reduce the number of transactions that must be performed on the sequence table.


setIncrement

public void setIncrement(int inc)
Set the increment to use when updating the sequence table. Defaults to 50, meaning a transaction has to take place on the sequence table only every 50 new objects created.


setConfiguration

public void setConfiguration(com.solarmetric.rd.kodo.impl.jdbc.conf.JDBCConfiguration conf)
Description copied from interface: SequenceFactory
Set the configuration for this factory; allows access to database connection information, etc.

Specified by:
setConfiguration in interface SequenceFactory

getNext

public long getNext(java.lang.Class cls,
                    java.lang.String user,
                    java.lang.String pass)
Description copied from interface: SequenceFactory
Return a unique primary key value.

Specified by:
getNext in interface SequenceFactory
Parameters:
cls - the class of the object being persisted
user - the authentication information for connecting to the database
pass - the authentication information for connecting to the database

refreshTable

public void refreshTable(java.lang.String user,
                         java.lang.String pass)
                  throws java.sql.SQLException
Creates the sequence table in the DB.

java.sql.SQLException

dropTable

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

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.DBSequenceFactory [option]* -action/-a <add | drop | increment>

Where the following options are recognized.

The various actions are as follows.

java.io.IOException
java.sql.SQLException

run

public static boolean run(com.solarmetric.rd.kodo.impl.jdbc.conf.JDBCConfiguration conf,
                          java.lang.String action,
                          java.io.Writer out)
                   throws java.io.IOException,
                          java.sql.SQLException
Run the tool. Return false if an invalid option was given.

java.io.IOException
java.sql.SQLException

SolarMetric Kodo JDO 2.5.0 Reverse Schema Tool

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