public class SqlDataSourceFactory extends Object implements DataSourceFactory<SqlQuery,SqlQueryResult>, PluginAware, Serviceable
Modifier and Type | Field and Description |
---|---|
private String |
_id |
private SQLDatabaseTypeExtensionPoint |
_sqlDatabaseTypeExtensionPoint |
private SQLDataSourceManager |
_sqlDataSourceManager |
static List<String> |
QUERY_CONFIGURATION_PARAMETERS
Query configuration parameters.
|
static String |
QUERY_CONFIGURATION_QUERYSTRING
Query string configuration parameter.
|
Constructor and Description |
---|
SqlDataSourceFactory() |
Modifier and Type | Method and Description |
---|---|
SqlQuery |
buildQuery(String id,
String type,
String name,
String description,
Query.ResultType resultType,
String dataSourceId,
Map<String,String> additionalConfiguration)
Build a query with the specified information.
|
SqlQueryResult |
execute(SqlQuery query,
Map<String,String> parameterValues)
Execute the query with the specified parameter values.
|
SqlQueryResult |
execute(SqlQuery sqlQuery,
Map<String,String> parameterValues,
int offset,
int limit)
Execute the query with the specified parameter values.
|
Collection<DataSourceClientInteraction.DataSourceType> |
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.
|
void |
service(ServiceManager manager) |
void |
setPluginInfo(String pluginName,
String featureName,
String id)
Sets the plugin info relative to the current component.
Note : The feature name may be null if the targeted component in declared at plugin level. |
public static final String QUERY_CONFIGURATION_QUERYSTRING
public static final List<String> QUERY_CONFIGURATION_PARAMETERS
private SQLDatabaseTypeExtensionPoint _sqlDatabaseTypeExtensionPoint
private SQLDataSourceManager _sqlDataSourceManager
public SqlDataSourceFactory()
public void setPluginInfo(String pluginName, String featureName, String id)
PluginAware
setPluginInfo
in interface PluginAware
pluginName
- Unique identifier for the plugin hosting the extensionfeatureName
- Unique feature identifier (unique for a given pluginName)id
- Unique identifier of this componentpublic void service(ServiceManager manager) throws ServiceException
service
in interface Serviceable
ServiceException
public Collection<DataSourceClientInteraction.DataSourceType> getHandledTypes()
DataSourceFactory
getHandledTypes
in interface DataSourceFactory<SqlQuery,SqlQueryResult>
public Collection<String> getQueryConfigurationParameters(String type)
DataSourceFactory
getQueryConfigurationParameters
in interface DataSourceFactory<SqlQuery,SqlQueryResult>
type
- the type of the Query.public SqlQuery buildQuery(String id, String type, String name, String description, Query.ResultType resultType, String dataSourceId, Map<String,String> additionalConfiguration) throws DataInclusionException
DataSourceFactory
buildQuery
in interface DataSourceFactory<SqlQuery,SqlQueryResult>
id
- the Query ID.type
- the Query type.name
- the Query name.description
- the Query description.resultType
- the Query result type (single/multiple).dataSourceId
- the id of data sourceadditionalConfiguration
- additional query configuration parameter values as a Map<parameterName, parameterValue>.DataInclusionException
- if an error occurs trying to create the Query.public SqlQueryResult execute(SqlQuery query, Map<String,String> parameterValues) throws DataInclusionException
DataSourceFactory
execute
in interface DataSourceFactory<SqlQuery,SqlQueryResult>
query
- The queryparameterValues
- the parameter values as a Map (name -> value).DataInclusionException
- if an error occurs while executing the querypublic SqlQueryResult execute(SqlQuery sqlQuery, Map<String,String> parameterValues, int offset, int limit) throws DataInclusionException
DataSourceFactory
execute
in interface DataSourceFactory<SqlQuery,SqlQueryResult>
sqlQuery
- The queryparameterValues
- the parameter values as a Map (name -> value).offset
- The start index of searchlimit
- The max number of result to returnDataInclusionException
- if an error occurs while executing the query