org.ametys.plugins.datainclusion.data.sql
Class SqlDataSourceFactory

java.lang.Object
  extended by org.ametys.plugins.datainclusion.data.sql.SqlDataSourceFactory
All Implemented Interfaces:
DataSourceFactory

public class SqlDataSourceFactory
extends Object
implements DataSourceFactory

SQL Data Source & Query Factory. Must provide these additional configuration information for the Data Source : - "driver" : JDBC driver. - "url" : JDBC url. - "user" : JDBC user. - "password" : JDBC password. Must provide these additional configuration information for the Query : - "queryString" : the SQL query as a String, which can contain parameters in the form ${parameterName}.


Field Summary
static String DATASOURCE_CONFIGURATION_DRIVER
          Driver configuration parameter.
static List<String> DATASOURCE_CONFIGURATION_PARAMETERS
          Data Source configuration parameters.
static String DATASOURCE_CONFIGURATION_PASSWORD
          Password configuration parameter.
static String DATASOURCE_CONFIGURATION_URL
          URL configuration parameter.
static String DATASOURCE_CONFIGURATION_USER
          User configuration parameter.
static List<String> QUERY_CONFIGURATION_PARAMETERS
          Query configuration parameters.
static String QUERY_CONFIGURATION_QUERYSTRING
          Query string configuration parameter.
 
Constructor Summary
SqlDataSourceFactory()
           
 
Method Summary
 SqlDataSource buildDataSource(String id, String type, String name, String description, Map<String,String> additionalConfiguration)
          Build a data source with the specified information.
 SqlQuery buildQuery(String id, String type, String name, String description, Query.ResultType resultType, DataSource dataSource, Map<String,String> additionalConfiguration)
          Build a query with the specified information.
 Collection<String> getDataSourceConfigurationParameters(String type)
          The configuration parameters needed to build a DataSource of the specified type.
 Collection<String> getHandledTypes()
          Get the types that the factory can build.
 Collection<String> getQueryConfigurationParameters(String type)
          The configuration parameters needed to build a Query of the specified type.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DATASOURCE_CONFIGURATION_DRIVER

public static final String DATASOURCE_CONFIGURATION_DRIVER
Driver configuration parameter.

See Also:
Constant Field Values

DATASOURCE_CONFIGURATION_URL

public static final String DATASOURCE_CONFIGURATION_URL
URL configuration parameter.

See Also:
Constant Field Values

DATASOURCE_CONFIGURATION_USER

public static final String DATASOURCE_CONFIGURATION_USER
User configuration parameter.

See Also:
Constant Field Values

DATASOURCE_CONFIGURATION_PASSWORD

public static final String DATASOURCE_CONFIGURATION_PASSWORD
Password configuration parameter.

See Also:
Constant Field Values

DATASOURCE_CONFIGURATION_PARAMETERS

public static final List<String> DATASOURCE_CONFIGURATION_PARAMETERS
Data Source configuration parameters.


QUERY_CONFIGURATION_QUERYSTRING

public static final String QUERY_CONFIGURATION_QUERYSTRING
Query string configuration parameter.

See Also:
Constant Field Values

QUERY_CONFIGURATION_PARAMETERS

public static final List<String> QUERY_CONFIGURATION_PARAMETERS
Query configuration parameters.

Constructor Detail

SqlDataSourceFactory

public SqlDataSourceFactory()
Method Detail

getHandledTypes

public Collection<String> getHandledTypes()
Description copied from interface: DataSourceFactory
Get the types that the factory can build.

Specified by:
getHandledTypes in interface DataSourceFactory
Returns:
the handled types as a Collection.

getDataSourceConfigurationParameters

public Collection<String> getDataSourceConfigurationParameters(String type)
Description copied from interface: DataSourceFactory
The configuration parameters needed to build a DataSource of the specified type.

Specified by:
getDataSourceConfigurationParameters in interface DataSourceFactory
Parameters:
type - the type of the DataSource.
Returns:
the configuration parameters as a Collection.

getQueryConfigurationParameters

public Collection<String> getQueryConfigurationParameters(String type)
Description copied from interface: DataSourceFactory
The configuration parameters needed to build a Query of the specified type.

Specified by:
getQueryConfigurationParameters in interface DataSourceFactory
Parameters:
type - the type of the Query.
Returns:
the configuration parameters as a Collection.

buildDataSource

public SqlDataSource buildDataSource(String id,
                                     String type,
                                     String name,
                                     String description,
                                     Map<String,String> additionalConfiguration)
                              throws DataInclusionException
Description copied from interface: DataSourceFactory
Build a data source with the specified information.

Specified by:
buildDataSource in interface DataSourceFactory
Parameters:
id - the DataSource ID.
type - the DataSource type.
name - the DataSource name.
description - the DataSource description.
additionalConfiguration - additional data source configuration parameter values as a Map<parameterName, parameterValue>.
Returns:
the data source.
Throws:
DataInclusionException - if an error occurs trying to create the DataSource.

buildQuery

public SqlQuery buildQuery(String id,
                           String type,
                           String name,
                           String description,
                           Query.ResultType resultType,
                           DataSource dataSource,
                           Map<String,String> additionalConfiguration)
                    throws DataInclusionException
Description copied from interface: DataSourceFactory
Build a query with the specified information.

Specified by:
buildQuery in interface DataSourceFactory
Parameters:
id - the Query ID.
type - the Query type.
name - the Query name.
description - the Query description.
resultType - the Query result type (single/multiple).
dataSource - the DataSource the Query depends on.
additionalConfiguration - additional query configuration parameter values as a Map<parameterName, parameterValue>.
Returns:
the query.
Throws:
DataInclusionException - if an error occurs trying to create the Query.


Copyright © 2010 Anyware Services. All Rights Reserved.