Class MappingGenerator
- java.lang.Object
-
- com.sun.jdo.api.persistence.mapping.ejb.MappingGenerator
-
- Direct Known Subclasses:
MappingGenerator
public class MappingGenerator extends Object
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classMappingGenerator.SQLTypeUtilThe contents of this class will eventually be added to SQLTypeUtil in dbmodel.
-
Constructor Summary
Constructors Constructor Description MappingGenerator(EJBInfoHelper infoHelper, ClassLoader loader, boolean skipGeneratedFields)Constructor
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description voidcleanup()Clean up strong reference.DatabaseGenerator.ResultsgenerateMappingClasses(String dbName, Boolean uniqueTableNames, Properties userPolicy, String inputFilesPath)Create mapping classes and schema based on database vendor name.protected ClassLoadergetClassLoader()protected ConversionHelpergetConversionHelper()protected EJBInfoHelpergetInfoHelper()protected AbstractNameMappergetNameMapper()protected booleanisPropertyDefined(String propertyValue)Returnstrueif the specified propertyValue represents a defined value,falseotherwise.protected MaploadMappingClasses(SunCmpMappings sunMapping, ClassLoader classLoader)load mapping classes from SunCmpMappings objectstatic voidupdateColumn(org.netbeans.modules.dbschema.ColumnElement column, int jdbcType, Integer length, Integer scale, Integer precision)Update column in the SchemaElement with jdbc type and its length, scale and precision.static voidupdateProperties(Properties prop, String className, String fieldName, int jdbcType, Integer length, Integer scale, Integer precision)This method updates properties which stores user override policy.
-
-
-
Constructor Detail
-
MappingGenerator
public MappingGenerator(EJBInfoHelper infoHelper, ClassLoader loader, boolean skipGeneratedFields)
Constructor- Parameters:
infoHelper- an instance of an EJBInfoHelperloader- a class loaderskipGeneratedFields- a boolean indicating to remove generated fields from jdo model and mapping model
-
-
Method Detail
-
getInfoHelper
protected EJBInfoHelper getInfoHelper()
-
getClassLoader
protected ClassLoader getClassLoader()
-
getNameMapper
protected AbstractNameMapper getNameMapper()
-
getConversionHelper
protected ConversionHelper getConversionHelper()
-
generateMappingClasses
public DatabaseGenerator.Results generateMappingClasses(String dbName, Boolean uniqueTableNames, Properties userPolicy, String inputFilesPath) throws IOException, org.netbeans.modules.schema2beans.Schema2BeansException, ModelException, org.netbeans.modules.dbschema.DBException, ConversionException
Create mapping classes and schema based on database vendor name.- Parameters:
dbName- a string for database vendor nameuniqueTableNames- a Boolean to determin if use unique table names during database generationuserPolicy- a property object holding user overridesinputFilesPath- a directory where sun-cmp-mappings.xml is located- Throws:
IOExceptionorg.netbeans.modules.schema2beans.Schema2BeansExceptionModelExceptionorg.netbeans.modules.dbschema.DBExceptionConversionException
-
loadMappingClasses
protected Map loadMappingClasses(SunCmpMappings sunMapping, ClassLoader classLoader) throws org.netbeans.modules.dbschema.DBException, ModelException, ConversionException
load mapping classes from SunCmpMappings object- Parameters:
sunMapping- a SunCmpMappings object representing sun-cmp-mappings.xml in memoryclassLoader- a class loader object- Returns:
- a map object containing ejb names and mapping classes
- Throws:
org.netbeans.modules.dbschema.DBExceptionModelExceptionConversionException
-
cleanup
public void cleanup()
Clean up strong reference. It should be called by end of deployment or deploytool.
-
isPropertyDefined
protected boolean isPropertyDefined(String propertyValue)
Returnstrueif the specified propertyValue represents a defined value,falseotherwise. This implementation returnstrueif the value is not empty, but subclasses may override this method to compare to a constant which represents an undefined value.- Parameters:
propertyValue- the value to be tested for defined- Returns:
trueif the specified propertyValue represents a defined value,falseotherwise
-
updateColumn
public static void updateColumn(org.netbeans.modules.dbschema.ColumnElement column, int jdbcType, Integer length, Integer scale, Integer precision) throws org.netbeans.modules.dbschema.DBExceptionUpdate column in the SchemaElement with jdbc type and its length, scale and precision.- Parameters:
column- a ColumnElement to be updatedjdbcType- jdbc type from java.sql.Typeslength- an Integer for length ornullif it does not applyscale- an Integer for scale ornullif it does not applyprecision- an Integer for precision ornullif it does not apply- Throws:
org.netbeans.modules.dbschema.DBException
-
updateProperties
public static void updateProperties(Properties prop, String className, String fieldName, int jdbcType, Integer length, Integer scale, Integer precision)
This method updates properties which stores user override policy.- Parameters:
prop- the property for user overrideclassName- a string for bean classfieldName- a string for fieldjdbcType- jdbc type from java.sql.Typeslength- an Integer for length ornullif it does not applyscale- an Integer for scale ornullif it does not applyprecision- an Integer for precision ornullif it does not apply
-
-