Kodo 4.2.0. generated on July 28 2008

kodo.jdo.jdbc
Class TableJDORMappingFactory

java.lang.Object
  extended by org.apache.openjpa.meta.AbstractMetaDataFactory
      extended by kodo.jdo.jdbc.TableJDORMappingFactory
All Implemented Interfaces:
Configurable, MetaDataFactory, MetaDataModes

public class TableJDORMappingFactory
extends AbstractMetaDataFactory
implements Configurable

Plugin to load and store JDO mapping data in a database table. This should be combined with a standard MetaDataFactory in a MetaDataPlusMappingFactory.


Field Summary
static String ACTION_ADD
           
static String ACTION_DROP
           
static int TYPE_CLASS
           
static int TYPE_CLASS_QUERY
           
static int TYPE_QUERY
           
static int TYPE_SEQUENCE
           
 
Fields inherited from class org.apache.openjpa.meta.AbstractMetaDataFactory
dir, log, repos, store, strict, types
 
Fields inherited from interface org.apache.openjpa.meta.MetaDataFactory
STORE_DEFAULT, STORE_PER_CLASS, STORE_VERBOSE
 
Fields inherited from interface org.apache.openjpa.meta.MetaDataModes
MODE_ALL, MODE_ANN_MAPPING, MODE_MAPPING, MODE_MAPPING_INIT, MODE_META, MODE_NONE, MODE_QUERY
 
Constructor Summary
TableJDORMappingFactory()
           
 
Method Summary
 void clear()
           
 int deleteMappingRow(String name, int type, boolean startsWith)
          Delete the row with the given name and type values.
 boolean drop(Class[] cls, int mode, ClassLoader envLoader)
           
 void dropTable()
          Drops the mapping table in the DB.
 void endConfiguration()
           
 boolean getConstraintNames()
          Whether to write out constraint names in generated mapping data.
 MetaDataDefaults getDefaults()
           
 String getMappingColumn()
          The name of the mapping column on the mapping definition table.
 String getNameColumn()
          The name of the name on the mapping table.
 JDORMetaDataParser getParser()
          Return metadata parser, creating it if it does not already exist.
 String getTable()
          The name of the mapping definition table.
 String getTypeColumn()
          The name of the type column on the mapping definition table.
 void load(Class cls, int mode, ClassLoader envLoader)
           
 void loadXMLMetaData(FieldMetaData fieldMetaData)
           
static void main(String[] args)
          Usage: java kodo.jdbc.meta.TableJDORMappingFactory [option]* -action/-a <add | drop>
 List readMappingColumn(String name, int type, boolean startsWith)
          Returns the mapping column data for the given class.
 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)
           
 void setConstraintNames(boolean cnames)
          Whether to write out constraint names in generated mapping data.
 void setMappingColumn(String name)
          The name of the mapping column on the mapping definition table.
 void setNameColumn(String name)
          The name of the name on the mapping table.
 void setParser(JDORMetaDataParser parser)
          Set the metadata parser.
 void setTable(String name)
          The name of the schema definition table.
 void setTypeColumn(String name)
          The name of the type column on the mapping definition table.
 void setUseSchemaValidation(boolean useSchema)
          Whether to use XSD schema validation (as opposed to DTD).
 void startConfiguration()
           
 boolean store(ClassMetaData[] metas, QueryMetaData[] queries, SequenceMetaData[] seqs, int mode, Map output)
           
 boolean useSchemaValidation()
          Whether to use XSD schema validation (as opposed to DTD).
 void writeMappingColumn(String name, int type, String mapping)
          Writes the mapping as a string to the database.
 
Methods inherited from class org.apache.openjpa.meta.AbstractMetaDataFactory
addClassExtensionKeys, addFieldExtensionKeys, getPersistentTypeNames, getQueryScope, getResultSetMappingScope, newClassArgParser, setRepository, setStoreDirectory, setStoreMode, setStrict, setTypes, setTypes
 
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

TYPE_CLASS

public static final int TYPE_CLASS
See Also:
Constant Field Values

TYPE_SEQUENCE

public static final int TYPE_SEQUENCE
See Also:
Constant Field Values

TYPE_QUERY

public static final int TYPE_QUERY
See Also:
Constant Field Values

TYPE_CLASS_QUERY

public static final int TYPE_CLASS_QUERY
See Also:
Constant Field Values
Constructor Detail

TableJDORMappingFactory

public TableJDORMappingFactory()
Method Detail

getTable

public String getTable()
The name of the mapping definition table. Defaults to KODO_JDO_MAPPINGS.


setTable

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


setNameColumn

public void setNameColumn(String name)
The name of the name on the mapping table. Defaults to NAME.


getNameColumn

public String getNameColumn()
The name of the name on the mapping table. Defaults to NAME.


setMappingColumn

public void setMappingColumn(String name)
The name of the mapping column on the mapping definition table. Defaults to MAPPING_DEF.


getMappingColumn

public String getMappingColumn()
The name of the mapping column on the mapping definition table. Defaults to MAPPING_DEF.


setTypeColumn

public void setTypeColumn(String name)
The name of the type column on the mapping definition table. Defaults to MAPPING_TYPE.


getTypeColumn

public String getTypeColumn()
The name of the type column on the mapping definition table. Defaults to MAPPING_TYPE.


getConstraintNames

public boolean getConstraintNames()
Whether to write out constraint names in generated mapping data. Defaults to false.


setConstraintNames

public void setConstraintNames(boolean cnames)
Whether to write out constraint names in generated mapping data. Defaults to false.


useSchemaValidation

public boolean useSchemaValidation()
Whether to use XSD schema validation (as opposed to DTD). Defaults to false.


setUseSchemaValidation

public void setUseSchemaValidation(boolean useSchema)
Whether to use XSD schema validation (as opposed to DTD). Defaults to false.


getParser

public JDORMetaDataParser getParser()
Return metadata parser, creating it if it does not already exist.


setParser

public void setParser(JDORMetaDataParser parser)
Set the metadata parser.


clear

public void clear()
Specified by:
clear in interface MetaDataFactory
Overrides:
clear in class AbstractMetaDataFactory

loadXMLMetaData

public void loadXMLMetaData(FieldMetaData fieldMetaData)
Specified by:
loadXMLMetaData in interface MetaDataFactory

load

public void load(Class cls,
                 int mode,
                 ClassLoader envLoader)
Specified by:
load in interface MetaDataFactory

store

public boolean store(ClassMetaData[] metas,
                     QueryMetaData[] queries,
                     SequenceMetaData[] seqs,
                     int mode,
                     Map output)
Specified by:
store in interface MetaDataFactory
Overrides:
store in class AbstractMetaDataFactory

drop

public boolean drop(Class[] cls,
                    int mode,
                    ClassLoader envLoader)
Specified by:
drop in interface MetaDataFactory
Overrides:
drop in class AbstractMetaDataFactory

getDefaults

public MetaDataDefaults getDefaults()
Specified by:
getDefaults in interface MetaDataFactory

refreshTable

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

Throws:
SQLException

dropTable

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

Throws:
SQLException

readMappingColumn

public List readMappingColumn(String name,
                              int type,
                              boolean startsWith)
                       throws SQLException
Returns the mapping column data for the given class.

Throws:
SQLException

writeMappingColumn

public void writeMappingColumn(String name,
                               int type,
                               String mapping)
                        throws SQLException
Writes the mapping as a string to the database.

Throws:
SQLException

deleteMappingRow

public int deleteMappingRow(String name,
                            int type,
                            boolean startsWith)
                     throws SQLException
Delete the row with the given name and type values.

Returns:
the update count
Throws:
SQLException

setConfiguration

public void setConfiguration(Configuration conf)
Specified by:
setConfiguration in interface Configurable

startConfiguration

public void startConfiguration()
Specified by:
startConfiguration in interface Configurable

endConfiguration

public void endConfiguration()
Specified by:
endConfiguration in interface Configurable

main

public static void main(String[] args)
                 throws IOException,
                        SQLException

Usage: java kodo.jdbc.meta.TableJDORMappingFactory [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

Kodo 4.2.0. generated on July 28 2008

Copyright 2001-2006 BEA Systems, Inc. All Rights Reserved.