peer1Server = ServerAnnotationProcessor.getLdapServer( provDirService );
peer1Server.setReplicationReqHandler( new SyncReplRequestHandler() );
peer1Server.startReplicationProducer();
final ReplicationConsumerImpl consumer = ( ReplicationConsumerImpl ) ServerAnnotationProcessor.createConsumer();
List<ReplicationConsumer> replConsumers = new ArrayList<ReplicationConsumer>();
replConsumers.add( consumer );
peer1Server.setReplConsumers( replConsumers );
peer1Server.startReplicationConsumers();
Runnable r = new Runnable()
{
public void run()
{
try
{
DirectoryService ds = peer1Server.getDirectoryService();
System.out.println(ds.getInstanceLayout().getInstanceDirectory());
Dn configDn = new Dn( ds.getSchemaManager(), "ads-replConsumerId=localhost,ou=system" );
consumer.getConfig().setConfigEntryDn( configDn );
Entry provConfigEntry = new DefaultEntry( ds.getSchemaManager(), configDn,
"objectClass: ads-replConsumer",
"ads-replConsumerId: localhost",
"ads-searchBaseDN", consumer.getConfig().getBaseDn(),
"ads-replProvHostName", consumer.getConfig().getRemoteHost(),
"ads-replProvPort", String.valueOf( consumer.getConfig().getRemotePort() ),
"ads-replRefreshInterval", String.valueOf( consumer.getConfig().getRefreshInterval() ),
"ads-replRefreshNPersist", String.valueOf( consumer.getConfig().isRefreshNPersist() ),
"ads-replSearchScope", consumer.getConfig().getSearchScope().getLdapUrlValue(),
"ads-replSearchFilter", consumer.getConfig().getFilter(),
"ads-replSearchSizeLimit", String.valueOf( consumer.getConfig().getSearchSizeLimit() ),
"ads-replSearchTimeOut", String.valueOf( consumer.getConfig().getSearchTimeout() ),
"ads-replUserDn", consumer.getConfig().getReplUserDn(),
"ads-replUserPassword", consumer.getConfig().getReplUserPassword() );
provConfigEntry.put( "ads-replAliasDerefMode", consumer.getConfig().getAliasDerefMode()
.getJndiValue() );
provConfigEntry.put( "ads-replAttributes", consumer.getConfig().getAttributes() );
CoreSession consumerSession = peer1Server.getDirectoryService().getAdminSession();
consumerSession.add( provConfigEntry );
}
catch ( Exception e )