net.sourceforge.fluxion.datapublisher.postgresql.impl
Class PostgresqlBeanFactory

java.lang.Object
  extended by net.sourceforge.fluxion.datapublisher.sql.impl.SQLBeanFactory
      extended by net.sourceforge.fluxion.datapublisher.postgresql.impl.PostgresqlBeanFactory
All Implemented Interfaces:
BeanFactory

@ServiceProvider
public class PostgresqlBeanFactory
extends SQLBeanFactory

An implementation of BeanFactory that can generate a bean model for databases in postgresql format.

Version:
0.3
Author:
Tony Burdett

Nested Class Summary
protected static class PostgresqlBeanFactory.DataType
           
 
Field Summary
 
Fields inherited from class net.sourceforge.fluxion.datapublisher.sql.impl.SQLBeanFactory
beanConfigs, connection, connectionDetails, filterTables, metaBeans, packageName, usingTableFiltering
 
Constructor Summary
PostgresqlBeanFactory()
           
 
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.
protected  java.lang.String getJavaType(java.lang.String sqlType)
          Get the Java Type that matches the given postgres SQL type
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, generateBeans, 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

PostgresqlBeanFactory

public PostgresqlBeanFactory()
Method Detail

dbms

public boolean dbms(java.lang.String dbms)
Description copied from interface: BeanFactory
Determines whether a BeanFactory implementation can generate beans for the given dbms. Returns true if this is a valid dbms name for this service provider, false otherwise.

Parameters:
dbms - the name of the dbms for a service provider, e.g. "mysql"
Returns:
true if this service provider can generate beans for the given dbms

acquireDatasourceConnection

public void acquireDatasourceConnection(java.util.Map<java.lang.String,java.lang.String> connectionDetails)
                                 throws BeanGenerationException
Description copied from interface: BeanFactory
Acquire a connection to the underlying datasource. This map should contain parameters for databse URL, username, and password. Use 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).

Parameters:
connectionDetails - a map containing parameters for connection to the database.
Throws:
BeanGenerationException - if the connection could not be acquired

terminateDatasourceConnection

public void terminateDatasourceConnection()
                                   throws BeanGenerationException
Description copied from interface: BeanFactory
Close the connection to the underlying datasource. Any open connection will be closed, and it is very important that implementations of this class close all connections correclty to prevent future access problems.

Throws:
BeanGenerationException - if there is a problem closing the connection

getQueryGeneratorClass

protected java.lang.Class getQueryGeneratorClass()
Description copied from class: SQLBeanFactory
Return the class that concrete BeanFactory implementations use to the create a query.

Specified by:
getQueryGeneratorClass in class SQLBeanFactory
Returns:
the corresponding QueryGeneratorClass for BeanFactory concrete implementations

getJavaType

protected java.lang.String getJavaType(java.lang.String sqlType)
                                throws BeanGenerationException
Get the Java Type that matches the given postgres SQL type

Specified by:
getJavaType in class SQLBeanFactory
Parameters:
sqlType - the type to match
Returns:
the corresponding java type
Throws:
BeanGenerationException - if the type submitted could not be matched


Copyright © 2010. All Rights Reserved.