Interface DataSourceFactory<Q extends Query,R extends QueryResult>
- Type Parameters:
Q
- The queryR
- The query result
- All Known Implementing Classes:
LdapDataSourceFactory
,SqlDataSourceFactory
public interface DataSourceFactory<Q extends Query,R extends QueryResult>
The DataSource Factory is responsible for building DataSource and Query objects.
It handles one or several DataSource/Query types.
-
Method Summary
Modifier and TypeMethodDescriptionbuildQuery
(String id, String type, String name, String description, Query.ResultType resultType, String dataSourceId, Map<String, String> additionalConfiguration) Build a query with the specified information.Execute the query with the specified parameter values.Execute the query with the specified parameter values.Get the types that the factory can build.The configuration parameters needed to build a Query of the specified type.
-
Method Details
-
getHandledTypes
Get the types that the factory can build.- Returns:
- the handled types as a Collection.
-
getQueryConfigurationParameters
The configuration parameters needed to build a Query of the specified type.- Parameters:
type
- the type of the Query.- Returns:
- the configuration parameters as a Collection.
-
buildQuery
Q buildQuery(String id, String type, String name, String description, Query.ResultType resultType, String dataSourceId, Map<String, String> additionalConfiguration) throws DataInclusionExceptionBuild a query with the specified information.- Parameters:
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>.- Returns:
- the query.
- Throws:
DataInclusionException
- if an error occurs trying to create the Query.
-
execute
Execute the query with the specified parameter values.- Parameters:
query
- The queryparameterValues
- the parameter values as a Map (name -> value).- Returns:
- the query result.
- Throws:
DataInclusionException
- if an error occurs while executing the query
-
execute
R execute(Q query, Map<String, String> parameterValues, int offset, int limit) throws DataInclusionExceptionExecute the query with the specified parameter values.- Parameters:
query
- The queryparameterValues
- the parameter values as a Map (name -> value).offset
- The start index of searchlimit
- The max number of result to return- Returns:
- the query result.
- Throws:
DataInclusionException
- if an error occurs while executing the query
-