|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object net.sourceforge.fluxion.datapublisher.sql.impl.SQLBeanFactory
public abstract class SQLBeanFactory
An implementation of BeanFactory that generates beans from an SQL datasource connection.
Field Summary | |
---|---|
protected java.util.Set<BeanConfig> |
beanConfigs
|
protected java.sql.Connection |
connection
|
protected java.util.Map<java.lang.String,java.lang.String> |
connectionDetails
|
protected java.util.Set<java.lang.String> |
filterTables
|
protected java.util.Set<java.lang.Class> |
metaBeans
|
protected java.lang.String |
packageName
|
protected boolean |
usingTableFiltering
|
Constructor Summary | |
---|---|
SQLBeanFactory()
|
Method Summary | |
---|---|
protected void |
analyseColumns(BeanConfig tableBC,
java.sql.ResultSet column,
java.lang.String fieldName,
java.util.List<java.lang.String> keyNames)
|
protected void |
analyseKeys(BeanConfig tableBC,
java.sql.DatabaseMetaData metadata,
java.lang.String schemaName,
java.lang.String tableName,
boolean multipleSchemas)
|
protected void |
analyseTable(BeanConfig tableBC,
java.sql.DatabaseMetaData metadata,
java.lang.String schemaName,
java.lang.String tableName,
boolean multipleSchemas)
|
void |
donotUseTableFiltering()
Use this if a single factory is used to generate multiple sets of beans, and you want to stop tables from being filtered. |
void |
generateBeans(java.io.File sourceDirectory,
java.lang.String packageName,
java.util.Set<java.lang.Class> metaBeans,
java.lang.String... schemas)
Generate javabeans from sql metadata specific to the supplied connection |
java.util.Map<java.lang.String,java.lang.String> |
getDatasourceConnectionParameters()
Returns the map of connection parameters supplied for this BeanFactory. |
protected abstract java.lang.String |
getJavaType(java.lang.String sqlType)
Returns a string giving the name of a java field type, given a specified type in the datasource. |
java.lang.String |
getPackageName()
Returns the package name known for this BeanFactory |
protected abstract java.lang.Class |
getQueryGeneratorClass()
Return the class that concrete BeanFactory implementations use to the create a query. |
protected void |
makeExportedObjectPropertyMethods(BeanConfig tableBC,
java.lang.String linkedTableName,
java.util.Map<java.lang.String,java.lang.String> key2keyMap,
boolean multipleRoles,
boolean compoundKeys)
|
protected void |
makeImportedObjectPropertyMethods(BeanConfig tableBC,
java.lang.String linkedTableName,
java.util.Map<java.lang.String,java.lang.String> key2keyMap,
boolean multipleRoles,
boolean compoundKeys)
|
protected void |
readTableFilterFile(java.io.File tableFilterFile)
This reads a plain text file that contains a list of tables to represent in OWL. |
protected void |
setType(BeanConfig config,
java.lang.String structureType)
|
void |
useTableFiltering(java.io.File tableFilterFile)
Enables filtering of tables by parsing a plain text file. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Methods inherited from interface net.sourceforge.fluxion.datapublisher.beangen.BeanFactory |
---|
acquireDatasourceConnection, dbms, terminateDatasourceConnection |
Field Detail |
---|
protected java.sql.Connection connection
protected java.util.Map<java.lang.String,java.lang.String> connectionDetails
protected boolean usingTableFiltering
protected java.util.Set<java.lang.String> filterTables
protected java.lang.String packageName
protected java.util.Set<java.lang.Class> metaBeans
protected java.util.Set<BeanConfig> beanConfigs
Constructor Detail |
---|
public SQLBeanFactory()
Method Detail |
---|
public java.util.Map<java.lang.String,java.lang.String> getDatasourceConnectionParameters()
getDatasourceConnectionParameters
in interface BeanFactory
public void useTableFiltering(java.io.File tableFilterFile) throws java.io.IOException
BeanFactory
useTableFiltering
in interface BeanFactory
tableFilterFile
- the file to read that restricts the created owl
classes
java.io.IOException
- if there is a problem reading from the filepublic void donotUseTableFiltering()
BeanFactory
donotUseTableFiltering
in interface BeanFactory
public void generateBeans(java.io.File sourceDirectory, java.lang.String packageName, java.util.Set<java.lang.Class> metaBeans, java.lang.String... schemas) throws BeanGenerationException
generateBeans
in interface BeanFactory
packageName
- the name of the package the generate beans should be
placed insourceDirectory
- The location for the generated source files to be
written tometaBeans
- the set of classes representing the database
metadataschemas
- an array of database schema names to use in
generating the beans
BeanGenerationException
public java.lang.String getPackageName()
BeanFactory
getPackageName
in interface BeanFactory
protected void analyseTable(BeanConfig tableBC, java.sql.DatabaseMetaData metadata, java.lang.String schemaName, java.lang.String tableName, boolean multipleSchemas) throws java.sql.SQLException, BeanGenerationException
java.sql.SQLException
BeanGenerationException
protected void analyseColumns(BeanConfig tableBC, java.sql.ResultSet column, java.lang.String fieldName, java.util.List<java.lang.String> keyNames) throws java.sql.SQLException, BeanGenerationException
java.sql.SQLException
BeanGenerationException
protected void analyseKeys(BeanConfig tableBC, java.sql.DatabaseMetaData metadata, java.lang.String schemaName, java.lang.String tableName, boolean multipleSchemas) throws java.sql.SQLException
java.sql.SQLException
protected abstract java.lang.Class getQueryGeneratorClass()
QueryGeneratorClass for BeanFactory
concrete implementationsprotected abstract java.lang.String getJavaType(java.lang.String sqlType) throws BeanGenerationException
sqlType
- the name underlying datasource type
BeanGenerationException
- if the datasource type is not recognised by
the factory implementationprotected void setType(BeanConfig config, java.lang.String structureType)
protected void makeImportedObjectPropertyMethods(BeanConfig tableBC, java.lang.String linkedTableName, java.util.Map<java.lang.String,java.lang.String> key2keyMap, boolean multipleRoles, boolean compoundKeys)
protected void makeExportedObjectPropertyMethods(BeanConfig tableBC, java.lang.String linkedTableName, java.util.Map<java.lang.String,java.lang.String> key2keyMap, boolean multipleRoles, boolean compoundKeys)
protected void readTableFilterFile(java.io.File tableFilterFile) throws java.io.IOException
tableFilterFile
- the file containing the tables to read
java.io.FileNotFoundException
- if there is some problem reading the
file
java.io.IOException
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |