Interface DataSourceFactory<Q extends Query,R extends QueryResult>

Type Parameters:
Q - The query
R - 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 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 DataInclusionException
      Build 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 source
      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.
    • execute

      R execute(Q query, Map<String,String> parameterValues) throws DataInclusionException
      Execute the query with the specified parameter values.
      Parameters:
      query - The query
      parameterValues - 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 DataInclusionException
      Execute the query with the specified parameter values.
      Parameters:
      query - The query
      parameterValues - the parameter values as a Map (name -> value).
      offset - The start index of search
      limit - The max number of result to return
      Returns:
      the query result.
      Throws:
      DataInclusionException - if an error occurs while executing the query