Package org.ametys.web.cache
Class SynchronizeUserPopulationsObserver
- java.lang.Object
-
- org.ametys.runtime.plugin.component.AbstractLogEnabled
-
- org.ametys.web.cache.SynchronizeUserPopulationsObserver
-
- All Implemented Interfaces:
Observer
,LogEnabled
,Serviceable
public class SynchronizeUserPopulationsObserver extends AbstractLogEnabled implements Observer, Serviceable
This observer asks the front offices to synchronize users populations and datasources
-
-
Field Summary
Fields Modifier and Type Field Description private CredentialProviderFactory
_credentialProviderFactory
private JSONUtils
_jsonUtils
private LDAPDataSourceManager
_ldapDatasourceManager
private ServiceManager
_manager
private PopulationContextHelper
_populationContextHelper
private SiteManager
_siteManager
private SQLDataSourceManager
_sqlDatasourceManager
private UserDirectoryFactory
_userDirectoryFactory
private UserPopulationDAO
_userPopulationDAO
-
Fields inherited from interface org.ametys.core.observation.Observer
MAX_PRIORITY, MIN_PRIORITY
-
-
Constructor Summary
Constructors Constructor Description SynchronizeUserPopulationsObserver()
-
Method Summary
-
Methods inherited from class org.ametys.runtime.plugin.component.AbstractLogEnabled
getLogger, setLogger
-
-
-
-
Field Detail
-
_manager
private ServiceManager _manager
-
_userDirectoryFactory
private UserDirectoryFactory _userDirectoryFactory
-
_siteManager
private SiteManager _siteManager
-
_populationContextHelper
private PopulationContextHelper _populationContextHelper
-
_userPopulationDAO
private UserPopulationDAO _userPopulationDAO
-
_sqlDatasourceManager
private SQLDataSourceManager _sqlDatasourceManager
-
_ldapDatasourceManager
private LDAPDataSourceManager _ldapDatasourceManager
-
_jsonUtils
private JSONUtils _jsonUtils
-
_credentialProviderFactory
private CredentialProviderFactory _credentialProviderFactory
-
-
Constructor Detail
-
SynchronizeUserPopulationsObserver
public SynchronizeUserPopulationsObserver()
-
-
Method Detail
-
service
public void service(ServiceManager manager) throws ServiceException
- Specified by:
service
in interfaceServiceable
- Throws:
ServiceException
-
getJSONUtils
private JSONUtils getJSONUtils()
-
getLDAPDataSourceManager
private LDAPDataSourceManager getLDAPDataSourceManager()
-
getSQLDataSourceManager
private SQLDataSourceManager getSQLDataSourceManager()
-
getSiteManager
private SiteManager getSiteManager()
-
getPopulationContextHelper
private PopulationContextHelper getPopulationContextHelper()
-
getUserPopulationDAO
private UserPopulationDAO getUserPopulationDAO()
-
getUserDirectoryFactory
private UserDirectoryFactory getUserDirectoryFactory()
-
getCredentialProviderFactory
private CredentialProviderFactory getCredentialProviderFactory()
-
getPriority
public int getPriority(Event event)
Description copied from interface:Observer
Retrieves the priority to observe this event.
This can be used to process a supported event before others observers.- Specified by:
getPriority
in interfaceObserver
- Parameters:
event
- the event.- Returns:
- the priority where 0 the max priority and Integer.MAX_VALUE the min priority.
-
supports
public boolean supports(Event event)
Description copied from interface:Observer
Checks if the event is supported. If true, the observe(Event) method will be called.
-
observe
public void observe(Event event, Map<String,Object> transientVars) throws Exception
Description copied from interface:Observer
Observes an event.- Specified by:
observe
in interfaceObserver
- Parameters:
event
- the event.transientVars
- transientVars passed from one Observer to another when processing a single Event. This may allow optimizations between observers.- Throws:
Exception
- if an error occurs. All exceptions will be logged but not propagated, as the observation mechanism should never fail.
-
testFrontOfficesDatasources
public Map<String,Map<String,Map<String,Object>>> testFrontOfficesDatasources(List<String> populationIds) throws Exception
This method will call every front-office and will ask them to test the datasources implied by the chosen populations- Parameters:
populationIds
- The chosen populations. Cannot be null.- Returns:
- The error messages
- Throws:
Exception
- If an error occurred while testing
-
_handleLDAPResponse
private void _handleLDAPResponse(Map<String,Map<String,Map<String,Object>>> issues, String datasourceId, AbstractDataSourceManager.DataSourceDefinition dataSourceDefinition, Map<String,Object> response) throws IOException, ParserConfigurationException, SAXException, TransformerException
-
_handleSQLResponse
private void _handleSQLResponse(Map<String,Map<String,Map<String,Object>>> issues, String datasourceId, AbstractDataSourceManager.DataSourceDefinition dataSourceDefinition, Map<String,Object> response) throws IOException, ParserConfigurationException, SAXException, TransformerException
-
_addEntry
private void _addEntry(Map<String,Map<String,Map<String,Object>>> issues, String key, String subKey, I18nizableText label, String value)
-
_getSQLTestParameters
private List<org.apache.http.NameValuePair> _getSQLTestParameters(Map<String,Object> parameters)
-
_getLDAPTestParameters
private List<org.apache.http.NameValuePair> _getLDAPTestParameters(Map<String,Object> parameters)
-
_getPopulationsIdsUsedBySites
private Set<String> _getPopulationsIdsUsedBySites()
-
_getPopulationsUsedBySites
private Set<UserPopulation> _getPopulationsUsedBySites()
-
_getDatasourcesUsedByPopulations
private Set<String> _getDatasourcesUsedByPopulations(Set<UserPopulation> usedPopulations)
-
-