|
Keel 2.1RC2 | ||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||
java.lang.Objectorg.keel.core.container.AbstractKeelServiceable
org.keel.services.query.jdbc.DefaultQuery
Default JDBC-based implementation of Query, using simple JDBC/SQL access to a database to get query results.
| Field Summary | |
private Configuration[] |
criteria |
private java.util.Map |
criteriaInput |
private DataSourceComponent |
dataSourceData source service itself. |
private java.lang.String |
dataSourceNameThe name of the data source we will access for this query. |
private static java.lang.String |
headerCriteriaNameIf the criteria specified contains the special criteria name "headers", we include a row header automatically. |
private static Logger |
log |
protected java.lang.String |
myNameName of this Query |
private Configuration[] |
resultFields |
private java.lang.String |
sql |
protected ServiceConfig |
svcConfig |
| Fields inherited from class org.keel.core.container.AbstractKeelServiceable |
|
| Fields inherited from interface org.keel.services.query.Query |
ROLE |
| Constructor Summary | |
DefaultQuery() |
|
| Method Summary | |
private SuperString |
bindParameters(int myQueryId)Bind parameters to actual values in the sql statement |
private int |
cacheObjectKeys(java.util.SortedSet objectKeys, int myQueryId, java.sql.Connection myConnection) |
void |
configure(Configuration configuration)Pass the Configuration to the Configurable class. |
private void |
deCacheObjectKeys(int myQueryId, java.sql.Connection myConnection) |
void |
dispose()The dispose operation is called at the end of a components lifecycle. |
void |
enableLogging(Logger newLog)Provide component with a logger. |
private java.util.List |
executeQuery(java.sql.Connection myConnection, SuperString myStatement)Run sql query, returning the query result as a set of Maps, where each map represents one row of the result. |
java.util.List |
getQueryResult(ObjectKey objectKey)Creates the tabular report rows, where there is exactly one object of interest. |
java.util.List |
getQueryResults()Creates the tabular report rows, in the case where there are no object keys (because the criteria service wasn't used). |
java.util.List |
getQueryResults(java.util.SortedSet objectKeys)Creates the tabular report rows. |
void |
initialize()Initialize the component. |
void |
recycle()This method should be implemented to remove all costly resources in object. |
private java.util.List |
runQuery(java.sql.Connection myConnection, int myQueryId)Bind parameters to actual values in the sql statement, run the sql statement, and create the queryResults as a List of Maps. |
void |
setCriteria(java.lang.String criteriaCode, java.lang.Object criteriaValue)Provide named "criteria" to control the operation of the query |
| Methods inherited from class org.keel.core.container.AbstractKeelServiceable |
getService, getService, getService, getService, getServiceManager, getServiceSelector, releaseService, releaseServices, service |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
private static Logger log
protected ServiceConfig svcConfig
private static final java.lang.String headerCriteriaName
private java.util.Map criteriaInput
private Configuration[] criteria
private Configuration[] resultFields
private java.lang.String sql
private java.lang.String dataSourceName
private DataSourceComponent dataSource
protected java.lang.String myName
| Constructor Detail |
public DefaultQuery()
| Method Detail |
public void setCriteria(java.lang.String criteriaCode,
java.lang.Object criteriaValue)
QuerysetCriteria in interface QuerycriteriaCode - Name of the criteria being specifiedcriteriaValue - Value of the criteriaorg.keel.services.query.Query#setCriteria(java.lang.String, java. lang. Object)
public java.util.List getQueryResults(java.util.SortedSet objectKeys)
throws QueryException
getQueryResults in interface QueryobjectKeys - The unique Keys of those objects for which tabular data is to be returned.QueryException - Thrown in the case of system failure.Query.getQueryResults(java.util.SortedSet)
public java.util.List getQueryResults()
throws QueryException
getQueryResults in interface QueryQueryException - Thrown in the case of system failure.Query.getQueryResults()
public java.util.List getQueryResult(ObjectKey objectKey)
throws QueryException
getQueryResult in interface QueryobjectKey - The unique Key of an object for which tabular data is to be returned.QueryException - Thrown in the case of system failure.org.keel.services.query.Query#getQueryResults(ObjectKey)
private int cacheObjectKeys(java.util.SortedSet objectKeys,
int myQueryId,
java.sql.Connection myConnection)
throws QueryException
QueryException
private void deCacheObjectKeys(int myQueryId,
java.sql.Connection myConnection)
throws QueryException
QueryException
private java.util.List runQuery(java.sql.Connection myConnection,
int myQueryId)
throws QueryException
myConnection - The database connectionmyQueryId - The identifier of the cache of objectKeysQueryException - if the service failed
private SuperString bindParameters(int myQueryId)
throws QueryException
myQueryId - The identifier of the cache of objectKeysQueryException - Thrown if the Query service fails
private java.util.List executeQuery(java.sql.Connection myConnection,
SuperString myStatement)
throws QueryException
myStatement - The sql statement to be runQueryException - Thrown in the case of system failure.public void enableLogging(Logger newLog)
LogEnabledenableLogging in interface LogEnablednewLog - the logger. Must not be null.
public void initialize()
throws QueryException
Initializableinitialize in interface InitializableQueryException
public void configure(Configuration configuration)
throws ConfigurationException
ConfigurableConfiguration to the Configurable class.
configure in interface Configurableconfiguration - the class configurations. Must not be null.ConfigurationException - if an error occurspublic void recycle()
Recyclablerecycle in interface Recyclablepublic void dispose()
Disposabledispose in interface Disposable
|
Keel 2.1RC2 | ||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||