By default the Domain Synchronization feature in LiveCycle can only be triggered via explicit UI action or schedule via Cron expression. Not possible to to do it on demand
The domain synch can be triggered via a remote method invocation using the ServiceClient
In a typical LiveCycle (LC) deployment one would create/configure an Enterprise domain which synchronizes the user, group information from an external repository. Using the User Manager (UM) UI you can trigger the synch directly or configure it to be run periodically via a cron exp. This would be sufficient for most requirement.
There may be some case where an Administartor would want to trigger synch in a more controlled way say if the user repository gets updated frequently and such changes are required to be pushed to LC. In that case you can invoke the synch via API exposed in UserManagerUtilService .
package com.adobe.livecycle.sample;
import java.util.HashSet;
import java.util.Map;
import java.util.Set;
import com.adobe.idp.um.api.DirectoryManager;
import com.adobe.idp.um.api.UMException;
import com.adobe.idp.um.api.dsc.ManagerBaseDSC;
import com.adobe.idp.um.api.infomodel.DirectorySyncInfo;
import
com.adobe.idp.um.dsc.util.client.UserManagerUtilServiceClient;
import
com.adobe.livecycle.usermanager.client.DirectoryManagerServiceClient;
/**
* An example demonstrating how to trigger domain synch via API
*/
public class SynchDomainSample{
public static void main(String[] args) throws UMException {
//Following call are asynchronous and would just schedule a
synch to be triggered in a separate
//thread
UserManagerUtilServiceClient umutil = new
UserManagerUtilServiceClient(getServiceClientFactory());
//This would schedule a synch for all the domains
configured in LC
umutil.scheduleSynchronization();
//To schedule a synch for specific domains pass the names
Set<String> domainNames = new
HashSet<String>();
domainNames.add("domain1");
umutil.scheduleSynchronization(domainNames);
DirectoryManager dm = new
DirectoryManagerServiceClient(getServiceClientFactory());
Map<String, DirectorySyncInfo> synchStatus =
dm.getDirectorySyncStatus(domainNames);
String domainName = "domain1";
DirectorySyncInfo di = synchStatus.get(domainName);
if(di.getSyncStatus() ==
DirectorySyncInfo.SYNCSTATUS_COMPLETED){
System.out.println("Directory synch for domain
"+domainName+" is complete");
}
}
private static ServiceClientFactory getServiceClientFactory(){
//Create -> Configure and return an instance of service
client factory
//The later call require the user to authenticate
}
}
Couple of points to note here
+