I have heard that it is possible to...
Articles and Tips: qna
01 Jun 2003
Q.
I have heard that it is possible to schedule eDirectory background processes such as the skulker and janitor processes. What API do I use to do this, and how do I use it?
A.
Obviously you missed the most excellent LDAP extensions for JNDI class at Novell's recent Brain-
Share Conference. At any rate, you need to use the novbp.jar file, which is a part of the LDAP extensions for JNDI SDK available at http://developer.novell. com.The API in question is the TriggerBackground ProcessRequestclass.Sample code of how to use this class in your Java program follows:
import java.util.Hashtable; import javax.naming.Context; import javax.naming.NamingException; import javax.naming.ldap.InitialLdapContext; import javax.naming.ldap.LdapContext; import com.novell.service.ndssdk.jndi.ldap.ext. TriggerBackgroundProcessRequest; public class TriggerBackgroundProcess { public static void main(String[] args) { if( args.length != 4 ) { usage(); } String hostURL = args[0]; String loginDN = args[1]; String passWord = args[2]; int processID = Integer.parseInt(args[3]); try { String backgroundProcess; // create a Hashtable object. Hashtable env = new Hashtable(5, 0.75f); env.put(Context.INITIAL_CONTEXT_FACTORY,"com.sun.jndi.ldap. LdapCtxFactory"); env.put(Context.PROVIDER_URL, hostURL); env.put(Context.SECURITY_AUTHENTICATION, "simple" ); env.put(Context.SECURITY_PRINCIPAL, loginDN ); env.put(Context.SECURITY_CREDENTIALS, passWord ); // Construct a LdapContext object. LdapContext ctx = new InitialLdapContext(env, null); /* create extended operation request object to trigger * one of the following NDS background processes. * The process IDs used are: * BACKGROUND_PROCESS_BKLINKER = 1; * BACKGROUND_PROCESS_JANITOR = 2; * BACKGROUND_PROCESS_LIMBER = 3; * BACKGROUND_PROCESS_PART_PURGE = 4; * BACKGROUND_PROCESS_SCHEMA_SYNC = 5; * BACKGROUND_PROCESS_SKULKER = 6; */ TriggerBackgroundProcessRequest reqs =new TriggerBackgroundProcessRequest ( processID ); // call extended operation to trigger background process ctx.extendedOperation(reqs); System.out.println("Background process" + reqs.getBackgroundProcessName() + "is scheduled."); } catch(NamingException e) { System.err.println("Background process could not be scheduled."); e.printStackTrace(); } finally{ System.exit(0); } } public static void usage() { System.out.println("Usage : java TriggerBackgroundProcess" + " <host URL> <login dn> <password>"); System.out.println("Example: java TriggerBackgroundProcess" + " ldap://Acme.com:389 cn=admin,o=Acme secret"); System.exit(1); } }
* Originally published in Novell AppNotes
Disclaimer
The origin of this information may be internal or external to Novell. While Novell makes all reasonable efforts to verify this information, Novell does not make explicit or implied claims to its validity.