Class LdapDataSourceFactory
- java.lang.Object
 - 
- org.ametys.runtime.plugin.component.AbstractLogEnabled
 - 
- org.ametys.core.util.ldap.AbstractLDAPConnector
 - 
- org.ametys.plugins.externaldata.data.ldap.LdapDataSourceFactory
 
 
 
 
- 
- All Implemented Interfaces:
 DataSourceFactory<LdapQuery,LdapQueryResult>,LogEnabled,PluginAware,Serviceable
public class LdapDataSourceFactory extends AbstractLDAPConnector implements DataSourceFactory<LdapQuery,LdapQueryResult>, PluginAware
LDAP Data Source factory. 
- 
- 
Field Summary
Fields Modifier and Type Field Description private String_idstatic StringQUERY_CONFIGURATION_ATTRIBUTESThe LDAp attributes to returnstatic StringQUERY_CONFIGURATION_CONSTRAINTConstraint query parameter.static List<String>QUERY_CONFIGURATION_PARAMETERSQuery configuration parameters.static StringQUERY_CONFIGURATION_RELATIVE_DNThe relative DN for usersstatic StringQUERY_CONFIGURATION_SCOPEThe search scope of the query- 
Fields inherited from class org.ametys.core.util.ldap.AbstractLDAPConnector
__DEFAULT_PAGE_SIZE, _ldapAdminPassword, _ldapAdminRelativeDN, _ldapAliasDerefMode, _ldapAuthenticationMethod, _ldapBaseDN, _ldapFollowReferrals, _ldapUrl, _ldapUseSSL, _pagingSupported, _serverSideSorting 
 - 
 
- 
Constructor Summary
Constructors Constructor Description LdapDataSourceFactory() 
- 
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected int_getScope(String scopeStr)Get the scope as an integer (handlable by the SearchControls) from the scope string.protected SearchControls_getSearchControls(Collection<String> attributes, String scopeStr)Get the LDAP search controls.LdapQuerybuildQuery(String id, String type, String name, String description, Query.ResultType resultType, String dataSourceId, Map<String,String> additionalConfiguration)Build a query with the specified information.LdapQueryResultexecute(LdapQuery query, Map<String,String> parameterValues)Execute the query with the specified parameter values.LdapQueryResultexecute(LdapQuery query, 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.voidsetPluginInfo(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.- 
Methods inherited from class org.ametys.core.util.ldap.AbstractLDAPConnector
_cleanup, _delayedInitialize, _getConfigParameter, _getContextEnv, _getFilter, _getRootContextEnv, _getSearchScope, _hasMoreEntries, _search, _search, _search, _search, _setResultsControls, _testConnectionsPooled, _testPagingSupported, getSortByFields, isPagingSupported, service 
- 
Methods inherited from class org.ametys.runtime.plugin.component.AbstractLogEnabled
getLogger, setLogger 
 - 
 
 - 
 
- 
- 
Field Detail
- 
QUERY_CONFIGURATION_RELATIVE_DN
public static final String QUERY_CONFIGURATION_RELATIVE_DN
The relative DN for users- See Also:
 - Constant Field Values
 
 
- 
QUERY_CONFIGURATION_SCOPE
public static final String QUERY_CONFIGURATION_SCOPE
The search scope of the query- See Also:
 - Constant Field Values
 
 
- 
QUERY_CONFIGURATION_ATTRIBUTES
public static final String QUERY_CONFIGURATION_ATTRIBUTES
The LDAp attributes to return- See Also:
 - Constant Field Values
 
 
- 
QUERY_CONFIGURATION_CONSTRAINT
public static final String QUERY_CONFIGURATION_CONSTRAINT
Constraint query parameter.- See Also:
 - Constant Field Values
 
 
- 
QUERY_CONFIGURATION_PARAMETERS
public static final List<String> QUERY_CONFIGURATION_PARAMETERS
Query configuration parameters. 
 - 
 
- 
Constructor Detail
- 
LdapDataSourceFactory
public LdapDataSourceFactory()
 
 - 
 
- 
Method Detail
- 
setPluginInfo
public void setPluginInfo(String pluginName, String featureName, String id)
Description copied from interface:PluginAwareSets the plugin info relative to the current component.
Note : The feature name may be null if the targeted component in declared at plugin level.- Specified by:
 setPluginInfoin interfacePluginAware- Parameters:
 pluginName- Unique identifier for the plugin hosting the extensionfeatureName- Unique feature identifier (unique for a given pluginName)id- Unique identifier of this component
 
- 
getHandledTypes
public Collection<DataSourceClientInteraction.DataSourceType> getHandledTypes()
Description copied from interface:DataSourceFactoryGet the types that the factory can build.- Specified by:
 getHandledTypesin interfaceDataSourceFactory<LdapQuery,LdapQueryResult>- Returns:
 - the handled types as a Collection.
 
 
- 
getQueryConfigurationParameters
public Collection<String> getQueryConfigurationParameters(String type)
Description copied from interface:DataSourceFactoryThe configuration parameters needed to build a Query of the specified type.- Specified by:
 getQueryConfigurationParametersin interfaceDataSourceFactory<LdapQuery,LdapQueryResult>- Parameters:
 type- the type of the Query.- Returns:
 - the configuration parameters as a Collection.
 
 
- 
buildQuery
public LdapQuery buildQuery(String id, String type, String name, String description, Query.ResultType resultType, String dataSourceId, Map<String,String> additionalConfiguration) throws DataInclusionException
Description copied from interface:DataSourceFactoryBuild a query with the specified information.- Specified by:
 buildQueryin interfaceDataSourceFactory<LdapQuery,LdapQueryResult>- 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
public LdapQueryResult execute(LdapQuery query, Map<String,String> parameterValues) throws DataInclusionException
Description copied from interface:DataSourceFactoryExecute the query with the specified parameter values.- Specified by:
 executein interfaceDataSourceFactory<LdapQuery,LdapQueryResult>- 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
public LdapQueryResult execute(LdapQuery query, Map<String,String> parameterValues, int offset, int limit) throws DataInclusionException
Description copied from interface:DataSourceFactoryExecute the query with the specified parameter values.- Specified by:
 executein interfaceDataSourceFactory<LdapQuery,LdapQueryResult>- 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
 
- 
_getSearchControls
protected SearchControls _getSearchControls(Collection<String> attributes, String scopeStr) throws DataInclusionException
Get the LDAP search controls.- Parameters:
 attributes- the attributes to return.scopeStr- the scope as a String.- Returns:
 - the search controls.
 - Throws:
 DataInclusionException- If an error occurred
 
- 
_getScope
protected int _getScope(String scopeStr) throws DataInclusionException
Get the scope as an integer (handlable by the SearchControls) from the scope string.- Parameters:
 scopeStr- the scope string.- Returns:
 - the scope as an integer.
 - Throws:
 DataInclusionException- If an error occurred
 
 - 
 
 -