|
SolarMetric Kodo JDO 3.3.5 generated on August 31 2005 | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--kodo.jdbc.schema.DBSequenceFactory
SequenceFactory
implementation that uses a database table
for sequence number generation. The table is automatically created
if not already present.
Inner Class Summary | |
protected static class |
DBSequenceFactory.Seq
Helper struct to hold sequence information. |
Field Summary | |
static String |
ACTION_ADD
|
static String |
ACTION_DROP
|
static String |
ACTION_INCREMENT
|
Constructor Summary | |
DBSequenceFactory()
|
Method Summary | |
protected Column |
addPrimaryKeyColumn(Table table)
Add the primary key column to the given table and return it. |
void |
addSchema(ClassMapping mapping,
SchemaGroup group)
Add any tables, etc needed by this factory for the given mapping to the given schema group, if they do not exist already. |
void |
dropTable()
Drops the sequence table in the DB. |
void |
endConfiguration()
Invoked upon completion of bean property configuration for this object. |
boolean |
ensureCapacity(int count,
ClassMapping cm,
DataSource ds)
Ensures that this sequence factory has sufficient capacity readily available to provide count new sequence
values. |
JDBCConfiguration |
getConfiguration()
|
protected Connection |
getConnection(DataSource ds)
Return a connection to use. |
int |
getIncrement()
Return the increment to us when updating the sequence table. |
long |
getNext(ClassMapping mapping,
DataSource ds)
Return a unique primary key value. |
protected void |
getNext(ClassMapping mapping,
DBSequenceFactory.Seq seq,
DataSource ds,
int inc)
|
protected void |
getNext(ClassMapping mapping,
DBSequenceFactory.Seq seq,
DataSource ds,
int inc,
boolean incrementCurrent)
|
protected Object |
getPrimaryKey(ClassMapping mapping)
Return the primary key value for the given mapping. |
String |
getPrimaryKeyColumn()
The name of the table's primary key column. |
protected DBSequenceFactory.Seq |
getSeq(ClassMapping mapping)
Return the appropriate sequence info object for the given mapping. |
String |
getSequenceColumn()
The name of the column that holds the sequence value. |
String |
getTableName()
The sequence table name. |
static void |
main(String[] args)
Usage: java kodo.jdbc.schema.DBSequenceFactory [option]* -action/-a <add | drop | increment> |
void |
refreshTable()
Creates the sequence table in the DB. |
static boolean |
run(JDBCConfiguration conf,
String[] args,
serp.util.Options opts)
Run the tool. |
static boolean |
run(JDBCConfiguration conf,
String action,
Writer out)
Run the tool. |
void |
setConfiguration(Configuration conf)
Invoked prior to setting bean properties. |
void |
setIncrement(int inc)
Set the increment to use when updating the sequence table. |
void |
setPrimaryKeyColumn(String primaryKeyColumn)
The name of the table's primary key column. |
void |
setSequenceColumn(String sequenceColumn)
The name of the column that holds the sequence value. |
void |
setTableName(String name)
The sequence table name. |
void |
startConfiguration()
Invoked before bean property configuration is begun on this object. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
public static final String ACTION_DROP
public static final String ACTION_ADD
public static final String ACTION_INCREMENT
Constructor Detail |
public DBSequenceFactory()
Method Detail |
public String getTableName()
JDO_SEQUENCE
. By
default, the table will be placed in the first schema listed in your
kodo.jdbc.Schemas
property, or in the default schema if
the property is not given. If you specify a table name in the form
<schema>.<table>
, then the given schema
will be used.public void setTableName(String name)
JDO_SEQUENCE
. By
default, the table will be placed in the first schema listed in your
kodo.jdbc.Schemas
property, or in the default schema if
the property is not given. If you specify a table name in the form
<schema>.<table>
, then the given schema
will be used.public String getSequenceColumn()
SEQUENCE_VALUE
.public void setSequenceColumn(String sequenceColumn)
SEQUENCE_VALUE
.public String getPrimaryKeyColumn()
ID
.public void setPrimaryKeyColumn(String primaryKeyColumn)
ID
.public int getIncrement()
public void setIncrement(int inc)
public JDBCConfiguration getConfiguration()
public void setConfiguration(Configuration conf)
Configurable
setConfiguration
in interface Configurable
public void startConfiguration()
Configurable
startConfiguration
in interface Configurable
public void endConfiguration()
Configurable
endConfiguration
in interface Configurable
public void addSchema(ClassMapping mapping, SchemaGroup group)
SequenceFactory
addSchema
in interface SequenceFactory
public long getNext(ClassMapping mapping, DataSource ds) throws Exception
SequenceFactory
getNext
in interface SequenceFactory
kodo.jdbc.schema.SequenceFactory
mapping
- metadata on the class of the object being persistedds
- the data source from which to obtain database
connections, if any are neededprotected void getNext(ClassMapping mapping, DBSequenceFactory.Seq seq, DataSource ds, int inc)
protected void getNext(ClassMapping mapping, DBSequenceFactory.Seq seq, DataSource ds, int inc, boolean incrementCurrent)
public boolean ensureCapacity(int count, ClassMapping cm, DataSource ds)
SequenceFactory
count
new sequence
values.ensureCapacity
in interface SequenceFactory
kodo.jdbc.schema.SequenceFactory
count
- number of sequence values to attempt to servecm
- metadata on the class of the object being persistedds
- the data source from which to obtain database
connections, if any are neededtrue
if the factory can service
count
requests without returning to the
datastore; else false
protected DBSequenceFactory.Seq getSeq(ClassMapping mapping)
protected Column addPrimaryKeyColumn(Table table)
protected Object getPrimaryKey(ClassMapping mapping)
protected Connection getConnection(DataSource ds) throws SQLException
public void refreshTable() throws SQLException
public void dropTable() throws SQLException
public static void main(String[] args) throws Exception
Usage: java kodo.jdbc.schema.DBSequenceFactory [option]* -action/-a <add | drop | increment>
Where the following options are recognized.
JDBCConfiguration
. Optional.JDBCConfiguration
can be set by
using their names and supplying a value. For example:
-licenseKey adslfja83r3lkadf
The various actions are as follows.
public static boolean run(JDBCConfiguration conf, String[] args, serp.util.Options opts) throws Exception
public static boolean run(JDBCConfiguration conf, String action, Writer out) throws Exception
|
SolarMetric Kodo JDO 3.3.5 generated on August 31 2005 | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |