|
||||||||||
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 net.sourceforge.fluxion.datapublisher.mysql.impl.MySQLBeanFactory
@ServiceProvider public class MySQLBeanFactory
An implementation of BeanFactory that generates beans from an SQL datasource connection.
Nested Class Summary | |
---|---|
protected static class |
MySQLBeanFactory.DataType
Contains mappings of the java datatypes to all types available in the MySQL format |
Field Summary |
---|
Fields inherited from class net.sourceforge.fluxion.datapublisher.sql.impl.SQLBeanFactory |
---|
beanConfigs, connection, connectionDetails, filterTables, metaBeans, packageName, usingTableFiltering |
Constructor Summary | |
---|---|
MySQLBeanFactory()
|
Method Summary | |
---|---|
void |
acquireDatasourceConnection(java.util.Map<java.lang.String,java.lang.String> connectionDetails)
Acquire a connection to the underlying datasource. |
boolean |
dbms(java.lang.String dbms)
Determines whether a BeanFactory implementation can generate beans for the given dbms. |
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 |
protected java.lang.String |
getJavaType(java.lang.String sqlType)
Get the java type that matches the given sqlType |
protected java.lang.Class |
getQueryGeneratorClass()
Return the class that concrete BeanFactory implementations use to the create a query. |
void |
terminateDatasourceConnection()
Close the connection to the underlying datasource. |
Methods inherited from class net.sourceforge.fluxion.datapublisher.sql.impl.SQLBeanFactory |
---|
analyseColumns, analyseKeys, analyseTable, donotUseTableFiltering, getDatasourceConnectionParameters, getPackageName, makeExportedObjectPropertyMethods, makeImportedObjectPropertyMethods, readTableFilterFile, setType, useTableFiltering |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public MySQLBeanFactory()
Method Detail |
---|
public boolean dbms(java.lang.String dbms)
BeanFactory
dbms
- the name of the dbms for a service provider, e.g. "mysql"
public void generateBeans(java.io.File sourceDirectory, java.lang.String packageName, java.util.Set<java.lang.Class> metaBeans, java.lang.String... schemas) throws BeanGenerationException
SQLBeanFactory
generateBeans
in interface BeanFactory
generateBeans
in class SQLBeanFactory
sourceDirectory
- The location for the generated source files to be
written topackageName
- the name of the package the generate beans should be
placed inmetaBeans
- the set of classes representing the database
metadataschemas
- an array of database schema names to use in
generating the beans
BeanGenerationException
- if the beans could not be generatedpublic void acquireDatasourceConnection(java.util.Map<java.lang.String,java.lang.String> connectionDetails) throws BeanGenerationException
BeanFactory
getDatasourceConnectionParameters().keySet()
to get the
parameters that must be set. Or do a lookup on these key values to get the
default values (e.g. "anonymous" is the default username). This way, those
parameters which have been set can be used, whilst null fields will be
ignored if possible (for example, in the case where password="" in
accessing a public MySql database).
connectionDetails
- a map containing parameters for connection to the
database.
BeanGenerationException
- if the connection could not be acquiredpublic void terminateDatasourceConnection() throws BeanGenerationException
BeanFactory
BeanGenerationException
- if there is a problem closing the
connectionprotected java.lang.Class getQueryGeneratorClass()
SQLBeanFactory
getQueryGeneratorClass
in class SQLBeanFactory
QueryGeneratorClass for BeanFactory
concrete implementationsprotected java.lang.String getJavaType(java.lang.String sqlType) throws BeanGenerationException
getJavaType
in class SQLBeanFactory
sqlType
- the name fo the sqlType
BeanGenerationException
- if the sqlType passed in is not recognized
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |