net.sourceforge.fluxion.datapublisher.sql.impl
Class SQLQueryFactory
java.lang.Object
net.sourceforge.fluxion.datapublisher.sql.impl.SQLQueryFactory
- All Implemented Interfaces:
- QueryGenerator
- Direct Known Subclasses:
- MySQLQueryFactory, ODBCQueryFactory, PostgresqlQueryFactory
public abstract class SQLQueryFactory
- extends java.lang.Object
- implements QueryGenerator
Generates a Query
that can be executed against a MySQL database.
- Version:
- 0.2
- Author:
- Tony Burdett
- See Also:
SQLQuery
Constructor Summary |
SQLQueryFactory(java.lang.String dbUrl,
java.lang.String user,
java.lang.String password)
|
Method Summary |
|
generateQuery(Filter<F> filter)
Create a query that can then be used to obtain data from a database. |
protected abstract
|
makeQueryInstance(java.lang.Class<F> beanClass,
Filter filter,
java.lang.String dbUrl,
java.lang.String user,
java.lang.String password)
Instantiate a new query instance from the parameters given. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
SQLQueryFactory
public SQLQueryFactory(java.lang.String dbUrl,
java.lang.String user,
java.lang.String password)
generateQuery
public <F> Query<F> generateQuery(Filter<F> filter)
throws QueryGenerationException
- Description copied from interface:
QueryGenerator
- Create a query that can then be used to obtain data from a database. The
returned query will be typed by the bean which the Filter is typed by - so
if
generateQuery(Filter?Foo>)
is called, a
Query?Foo>
will be returned.
- Specified by:
generateQuery
in interface QueryGenerator
- Parameters:
filter
- the filter to use to make the query
- Returns:
- the query, typed by the bean being queried
- Throws:
QueryGenerationException
- if there was a probelm generating the
query
makeQueryInstance
protected abstract <F> SQLQuery<F> makeQueryInstance(java.lang.Class<F> beanClass,
Filter filter,
java.lang.String dbUrl,
java.lang.String user,
java.lang.String password)
- Instantiate a new query instance from the parameters given. This
effectively defers the decision about the type of the Query to be
instantiated to the concrete implementations of this class. Usually,
implementations of this class will be extremely simple - a single line to
instantiate a new concrete implementation of the appropriate class.
- Parameters:
beanClass
- the beanClass a Query is needed forfilter
- the filter used to make this querydbUrl
- the URL of the databaseuser
- the username to use to connect to the databasepassword
- the password to connect to the database with @return a new
SQLQuery instance of appropriate type
- Returns:
- the SQLQuery that can be executed
Copyright © 2010. All Rights Reserved.