|
SolarMetric Kodo JDO 2.5.0 Reverse Schema Tool | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Object | +--com.solarmetric.rd.kodo.impl.jdbc.meta.ReverseMappingTool
Reverse-maps a schema into class mappings and the assiciated java code. Generates an XML schema definition file, an XML mapping file, java code files for persistent classes and their application IDs, and metadata files for these classes. The schema definition file and XML mapping file can then be imported into the schema factory and mapping factory of your choosing.
| Field Summary | |
static java.lang.String |
LEVEL_CLASS
|
static java.lang.String |
LEVEL_PACKAGE
|
| Constructor Summary | |
ReverseMappingTool(com.solarmetric.rd.kodo.impl.jdbc.conf.JDBCConfiguration conf)
Constructor. |
|
| Method Summary | |
void |
addClassIndicator(com.solarmetric.rd.kodo.impl.jdbc.meta.ClassIndicator cls,
com.solarmetric.rd.kodo.impl.jdbc.meta.ClassMapping owner)
Add a mapping. |
boolean |
addClassMapping(com.solarmetric.rd.kodo.impl.jdbc.meta.ClassMapping mapping)
Add a mapping. |
boolean |
addFieldMapping(com.solarmetric.rd.kodo.impl.jdbc.meta.FieldMapping field,
com.solarmetric.rd.kodo.impl.jdbc.meta.ClassMapping owner)
Add a mapping. |
void |
addVersionIndicator(com.solarmetric.rd.kodo.impl.jdbc.meta.VersionIndicator version,
com.solarmetric.rd.kodo.impl.jdbc.meta.ClassMapping owner)
Add a mapping. |
java.lang.Class |
generateClass(java.lang.String name,
java.lang.Class parent)
Generate a new class with the given name. |
void |
generateMappings()
Generate mappings and class code for the current schema group. |
com.solarmetric.rd.kodo.impl.jdbc.meta.ClassMapping |
getClassMapping(com.solarmetric.rd.kodo.impl.jdbc.schema.Table table)
Return the class mapping for the given table, or null if none. |
java.lang.String |
getClassName(com.solarmetric.rd.kodo.impl.jdbc.schema.Table table)
Return a Java identifier-formatted name for the given table name, using the default package. |
java.io.File |
getCodeDirectory()
The file to output the generated code to, or null for the current directory. |
serp.util.CodeFormat |
getCodeFormat()
The code formatter for the generated Java code. |
com.solarmetric.rd.kodo.impl.jdbc.conf.JDBCConfiguration |
getConfiguration()
Return the configuration provided on construction. |
com.solarmetric.rd.kodo.impl.jdbc.meta.ReverseCustomizer |
getCustomizer()
Return the customizer in use, or null if none. |
java.lang.String |
getFieldName(java.lang.String name,
com.solarmetric.rd.kodo.meta.ClassMetaData fieldOwner)
Return a default Java identifier-formatted name for the given column/table name. |
java.lang.Class |
getFieldType(com.solarmetric.rd.kodo.impl.jdbc.schema.Column col,
boolean forceObject)
Return the default field type for the given column. |
com.solarmetric.rd.kodo.impl.jdbc.meta.ClassMapping[] |
getMappings()
Return the generated mappings. |
boolean |
getNullableAsObject()
Return whether even nullable columns will be mapped to wrappers rather than primitives. |
java.lang.String |
getPackageName()
Return the default package for the generated classes, or null if unset. |
boolean |
getPrimaryKeyOnJoin()
Return true if join tables are allowed to have primary keys, false if all primary key tables will be mapped as persistent classes. |
java.lang.String |
getRelationName(java.lang.Class fieldType,
boolean coll,
com.solarmetric.rd.kodo.impl.jdbc.schema.ForeignKey fk,
boolean inverse,
com.solarmetric.rd.kodo.meta.ClassMetaData fieldOwner)
Return a default java identifier-formatted field relation name for the given class name. |
com.solarmetric.rd.kodo.impl.jdbc.meta.MappingRepository |
getRepository()
Return the mapping repository used to hold generated mappings. |
com.solarmetric.rd.kodo.impl.jdbc.schema.SchemaGroup |
getSchemaGroup()
Return the schema group to reverse map. |
boolean |
getUseDatastoreIdentity()
Whether to use datastore identity when possible. |
boolean |
getUseForeignKeyName()
Return whether the foreign key name will be used to generate relation names. |
boolean |
getUseSchemaName()
Return true if the schema name will be included in the generated class name for each table. |
static void |
main(java.lang.String[] args)
Usage: java com.solarmetric.kodo.impl.jdbc.meta.ReverseMappingTool [option]* <.schema file or resource>* |
com.solarmetric.rd.kodo.meta.ClassMetaData |
newClassMetaData(java.lang.Class cls,
java.lang.Class pcParent,
int idType)
Return a new class metadata for the given name and parent. |
com.solarmetric.rd.kodo.meta.FieldMetaData |
newFieldMetaData(java.lang.String name,
java.lang.Class type,
com.solarmetric.rd.kodo.meta.ClassMetaData owner)
Return a new field metadata for the given name, type, and owner. |
static void |
run(com.solarmetric.rd.kodo.impl.jdbc.conf.JDBCConfiguration conf,
java.lang.String[] args,
java.lang.String packageName,
java.io.File codeDir,
boolean useSchemaName,
boolean useFKName,
boolean nullAsObj,
boolean pkOnJoin,
boolean datastore,
java.lang.String metaLevel,
java.lang.String mappingLevel,
com.solarmetric.rd.kodo.impl.jdbc.meta.ReverseCustomizer customizer,
serp.util.CodeFormat format,
java.lang.ClassLoader loader)
Run the tool. |
void |
setCodeDirectory(java.io.File dir)
The file to output the generated code to, or null for the current directory. |
void |
setCodeFormat(serp.util.CodeFormat format)
Set the code formatter for the generated Java code. |
void |
setCustomizer(com.solarmetric.rd.kodo.impl.jdbc.meta.ReverseCustomizer customizer)
Set the customizer. |
void |
setNullableAsObject(boolean nullAsObj)
Set whether even nullable columns will be mapped to wrappers rather than primitives. |
void |
setPackageName(java.lang.String packageName)
Set the default package for the generated classes; use null to indicate no package. |
void |
setPrimaryKeyOnJoin(boolean pkOnJoin)
Set to true if join tables are allowed to have primary keys, false if all primary key tables will be mapped as persistent classes. |
void |
setRepository(com.solarmetric.rd.kodo.impl.jdbc.meta.MappingRepository repos)
Set the repository to use. |
void |
setSchemaGroup(com.solarmetric.rd.kodo.impl.jdbc.schema.SchemaGroup schema)
Set the schema to reverse map. |
void |
setUseDatastoreIdentity(boolean datastore)
Whether to use datastore identity when possible. |
void |
setUseForeignKeyName(boolean useFK)
Set whether the foreign key name will be used to generate relation names. |
void |
setUseSchemaName(boolean useSchema)
Set whether the schema name will be included in the generated class name for each table. |
void |
writeApplicationIdentityCode()
Uses the ApplicationIdTool to write identity classes to the
proper packages. |
void |
writeCode()
Uses CodeGenerators to write the Java code for the generated
mappings to the proper packages. |
void |
writeMappings(boolean perClass)
Uses the XMLMappingInfoSerializer to write the generated
metadata to the proper packages. |
void |
writeMetaData(boolean perClass)
Uses the JDOMetaDataSerializer to write the generated metadata
to the proper packages. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
public static final java.lang.String LEVEL_PACKAGE
public static final java.lang.String LEVEL_CLASS
| Constructor Detail |
public ReverseMappingTool(com.solarmetric.rd.kodo.impl.jdbc.conf.JDBCConfiguration conf)
| Method Detail |
public com.solarmetric.rd.kodo.impl.jdbc.conf.JDBCConfiguration getConfiguration()
public java.lang.String getPackageName()
public void setPackageName(java.lang.String packageName)
public java.io.File getCodeDirectory()
public void setCodeDirectory(java.io.File dir)
public boolean getUseSchemaName()
public void setUseSchemaName(boolean useSchema)
public boolean getUseForeignKeyName()
public void setUseForeignKeyName(boolean useFK)
public boolean getNullableAsObject()
public void setNullableAsObject(boolean nullAsObj)
public boolean getPrimaryKeyOnJoin()
public void setPrimaryKeyOnJoin(boolean pkOnJoin)
public boolean getUseDatastoreIdentity()
public void setUseDatastoreIdentity(boolean datastore)
public serp.util.CodeFormat getCodeFormat()
public void setCodeFormat(serp.util.CodeFormat format)
public com.solarmetric.rd.kodo.impl.jdbc.meta.ReverseCustomizer getCustomizer()
public void setCustomizer(com.solarmetric.rd.kodo.impl.jdbc.meta.ReverseCustomizer customizer)
public com.solarmetric.rd.kodo.impl.jdbc.meta.MappingRepository getRepository()
public void setRepository(com.solarmetric.rd.kodo.impl.jdbc.meta.MappingRepository repos)
public com.solarmetric.rd.kodo.impl.jdbc.schema.SchemaGroup getSchemaGroup()
public void setSchemaGroup(com.solarmetric.rd.kodo.impl.jdbc.schema.SchemaGroup schema)
public com.solarmetric.rd.kodo.impl.jdbc.meta.ClassMapping[] getMappings()
public void generateMappings()
public void writeCode()
throws java.io.IOException
CodeGenerators to write the Java code for the generated
mappings to the proper packages.
java.io.IOException
public void writeMetaData(boolean perClass)
throws java.io.IOException
JDOMetaDataSerializer to write the generated metadata
to the proper packages.
java.io.IOException
public void writeMappings(boolean perClass)
throws java.io.IOException
XMLMappingInfoSerializer to write the generated
metadata to the proper packages.
java.io.IOException
public void writeApplicationIdentityCode()
throws java.io.IOException
ApplicationIdTool to write identity classes to the
proper packages.
java.io.IOExceptionpublic com.solarmetric.rd.kodo.impl.jdbc.meta.ClassMapping getClassMapping(com.solarmetric.rd.kodo.impl.jdbc.schema.Table table)
public boolean addClassMapping(com.solarmetric.rd.kodo.impl.jdbc.meta.ClassMapping mapping)
public boolean addFieldMapping(com.solarmetric.rd.kodo.impl.jdbc.meta.FieldMapping field,
com.solarmetric.rd.kodo.impl.jdbc.meta.ClassMapping owner)
public void addVersionIndicator(com.solarmetric.rd.kodo.impl.jdbc.meta.VersionIndicator version,
com.solarmetric.rd.kodo.impl.jdbc.meta.ClassMapping owner)
public void addClassIndicator(com.solarmetric.rd.kodo.impl.jdbc.meta.ClassIndicator cls,
com.solarmetric.rd.kodo.impl.jdbc.meta.ClassMapping owner)
public com.solarmetric.rd.kodo.meta.ClassMetaData newClassMetaData(java.lang.Class cls,
java.lang.Class pcParent,
int idType)
idType - ClassMetaData.ID_APPLICATION or
ClassMetaData.ID_DATASTOREpcParent - nearest persistent parent class, or null
public com.solarmetric.rd.kodo.meta.FieldMetaData newFieldMetaData(java.lang.String name,
java.lang.Class type,
com.solarmetric.rd.kodo.meta.ClassMetaData owner)
public java.lang.String getClassName(com.solarmetric.rd.kodo.impl.jdbc.schema.Table table)
public java.lang.String getFieldName(java.lang.String name,
com.solarmetric.rd.kodo.meta.ClassMetaData fieldOwner)
public java.lang.String getRelationName(java.lang.Class fieldType,
boolean coll,
com.solarmetric.rd.kodo.impl.jdbc.schema.ForeignKey fk,
boolean inverse,
com.solarmetric.rd.kodo.meta.ClassMetaData fieldOwner)
public java.lang.Class getFieldType(com.solarmetric.rd.kodo.impl.jdbc.schema.Column col,
boolean forceObject)
public java.lang.Class generateClass(java.lang.String name,
java.lang.Class parent)
public static void main(java.lang.String[] args)
throws java.io.IOException,
java.sql.SQLException
Usage: java com.solarmetric.kodo.impl.jdbc.meta.ReverseMappingTool [option]* <.schema file or resource>*
Where the following options are recognized.
JDOConfiguration. Optional.JDBCConfiguration can be set by
using their names and supplying a value. For example:
-licenseKey adslfja83r3lkadfReverseCustomizer implementation to use to
customize the reverse mapping process. Optional.ReverseCustomizer.CodeFormat.Each schema given as an argument will be reverse-mapped into JDO classes and associated metadata. If no arguments are given, the database schemas defined by the system configuration will be reverse-mapped.
java.io.IOException
java.sql.SQLException
public static void run(com.solarmetric.rd.kodo.impl.jdbc.conf.JDBCConfiguration conf,
java.lang.String[] args,
java.lang.String packageName,
java.io.File codeDir,
boolean useSchemaName,
boolean useFKName,
boolean nullAsObj,
boolean pkOnJoin,
boolean datastore,
java.lang.String metaLevel,
java.lang.String mappingLevel,
com.solarmetric.rd.kodo.impl.jdbc.meta.ReverseCustomizer customizer,
serp.util.CodeFormat format,
java.lang.ClassLoader loader)
throws java.io.IOException,
java.sql.SQLException
java.io.IOException
java.sql.SQLException
|
SolarMetric Kodo JDO 2.5.0 Reverse Schema Tool | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||