com.sun.jdo.api.persistence.mapping.ejb
Class MappingGenerator

java.lang.Object
  extended by com.sun.jdo.api.persistence.mapping.ejb.MappingGenerator

public class MappingGenerator
extends java.lang.Object


Nested Class Summary
static class MappingGenerator.SQLTypeUtil
          The contents of this class will eventually be added to SQLTypeUtil in dbmodel.
 
Constructor Summary
MappingGenerator(EJBInfoHelper infoHelper, java.lang.ClassLoader loader, boolean skipGeneratedFields)
          Constructor
 
Method Summary
 void cleanup()
          Clean up strong reference.
 DatabaseGenerator.Results generateMappingClasses(java.lang.String dbName, java.lang.Boolean uniqueTableNames, java.util.Properties userPolicy, java.lang.String inputFilesPath)
          Create mapping classes and schema based on database vendor name.
protected  java.lang.ClassLoader getClassLoader()
           
protected  ConversionHelper getConversionHelper()
           
protected  EJBInfoHelper getInfoHelper()
           
protected  AbstractNameMapper getNameMapper()
           
protected  boolean isPropertyDefined(java.lang.String propertyValue)
          Returns true if the specified propertyValue represents a defined value, false otherwise.
protected  java.util.Map loadMappingClasses(SunCmpMappings sunMapping, java.lang.ClassLoader classLoader)
          load mapping classes from SunCmpMappings object
static void updateColumn(org.netbeans.modules.dbschema.ColumnElement column, int jdbcType, java.lang.Integer length, java.lang.Integer scale, java.lang.Integer precision)
          Update column in the SchemaElement with jdbc type and its length, scale and precision.
static void updateProperties(java.util.Properties prop, java.lang.String className, java.lang.String fieldName, int jdbcType, java.lang.Integer length, java.lang.Integer scale, java.lang.Integer precision)
          This method updates properties which stores user override policy.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

MappingGenerator

public MappingGenerator(EJBInfoHelper infoHelper,
                        java.lang.ClassLoader loader,
                        boolean skipGeneratedFields)
Constructor

Parameters:
infoHelper - an instance of an EJBInfoHelper
loader - a class loader
skipGeneratedFields - a boolean indicating to remove generated fields from jdo model and mapping model
Method Detail

getInfoHelper

protected EJBInfoHelper getInfoHelper()

getClassLoader

protected java.lang.ClassLoader getClassLoader()

getNameMapper

protected AbstractNameMapper getNameMapper()

getConversionHelper

protected ConversionHelper getConversionHelper()

generateMappingClasses

public DatabaseGenerator.Results generateMappingClasses(java.lang.String dbName,
                                                        java.lang.Boolean uniqueTableNames,
                                                        java.util.Properties userPolicy,
                                                        java.lang.String inputFilesPath)
                                                 throws java.io.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 name
uniqueTableNames - a Boolean to determin if use unique table names during database generation
userPolicy - a property object holding user overrides
inputFilesPath - a directory where sun-cmp-mappings.xml is located
Throws:
java.io.IOException
org.netbeans.modules.schema2beans.Schema2BeansException
ModelException
org.netbeans.modules.dbschema.DBException
ConversionException

loadMappingClasses

protected java.util.Map loadMappingClasses(SunCmpMappings sunMapping,
                                           java.lang.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 memory
classLoader - a class loader object
Returns:
a map object containing ejb names and mapping classes
Throws:
org.netbeans.modules.dbschema.DBException
ModelException
ConversionException

cleanup

public void cleanup()
Clean up strong reference. It should be called by end of deployment or deploytool.


isPropertyDefined

protected boolean isPropertyDefined(java.lang.String propertyValue)
Returns true if the specified propertyValue represents a defined value, false otherwise. This implementation returns true if 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:
true if the specified propertyValue represents a defined value, false otherwise

updateColumn

public static void updateColumn(org.netbeans.modules.dbschema.ColumnElement column,
                                int jdbcType,
                                java.lang.Integer length,
                                java.lang.Integer scale,
                                java.lang.Integer precision)
                         throws org.netbeans.modules.dbschema.DBException
Update column in the SchemaElement with jdbc type and its length, scale and precision.

Parameters:
column - a ColumnElement to be updated
jdbcType - jdbc type from java.sql.Types
length - an Integer for length or null if it does not apply
scale - an Integer for scale or null if it does not apply
precision - an Integer for precision or null if it does not apply
Throws:
org.netbeans.modules.dbschema.DBException

updateProperties

public static void updateProperties(java.util.Properties prop,
                                    java.lang.String className,
                                    java.lang.String fieldName,
                                    int jdbcType,
                                    java.lang.Integer length,
                                    java.lang.Integer scale,
                                    java.lang.Integer precision)
This method updates properties which stores user override policy.

Parameters:
prop - the property for user override
className - a string for bean class
fieldName - a string for field
jdbcType - jdbc type from java.sql.Types
length - an Integer for length or null if it does not apply
scale - an Integer for scale or null if it does not apply
precision - an Integer for precision or null if it does not apply


Copyright © 2012 GlassFish Community. All Rights Reserved.