for ( ReplConsumerBean replBean : replConsumerBeans )
{
String className = replBean.getReplConsumerImpl();
ReplicationConsumer consumer = null;
Class<?> consumerClass = null;
SyncreplConfiguration config = null;
try
{
if ( className == null )
{
consumerClass = ReplicationConsumerImpl.class;
}
else
{
consumerClass = Class.forName( className );
}
consumer = ( ReplicationConsumer ) consumerClass.newInstance();
// we don't support any other configuration impls atm, but this configuration should suffice for many needs
config = new SyncreplConfiguration();
config.setBaseDn( replBean.getSearchBaseDn() );
config.setRemoteHost( replBean.getReplProvHostName() );
config.setRemotePort( replBean.getReplProvPort() );
config.setAliasDerefMode( AliasDerefMode.getDerefMode( replBean.getReplAliasDerefMode() ) );
config.setAttributes( replBean.getReplAttributes().toArray( new String[0] ) );
config.setRefreshInterval( replBean.getReplRefreshInterval() );
config.setRefreshNPersist( replBean.isReplRefreshNPersist() );
int scope = SearchScope.getSearchScope( replBean.getReplSearchScope() );
config.setSearchScope( SearchScope.getSearchScope( scope ) );
config.setFilter( replBean.getReplSearchFilter() );
config.setSearchTimeout( replBean.getReplSearchTimeOut() );
config.setReplUserDn( replBean.getReplUserDn() );
config.setReplUserPassword( replBean.getReplUserPassword() );
config.setUseTls( replBean.isReplUseTls() );
config.setStrictCertVerification( replBean.isReplStrictCertValidation() );
config.setConfigEntryDn( replBean.getDn() );
if ( replBean.getReplPeerCertificate() != null )
{
ReplicationTrustManager.addCertificate( replBean.getReplConsumerId(),
replBean.getReplPeerCertificate() );
}
consumer.setConfig( config );
lst.add( consumer );
}
catch ( Exception e )
{