Examples: registerNewServer method

This agent registers server2.id with cert.id.

import lotus.domino.*;

public class JavaAgent extends AgentBase {

  public void NotesMain() {

    try {
      Session session = getSession();
      AgentContext agentContext = session.getAgentContext();

      // (Your code goes here) 
      Registration reg = session.createRegistration();
      reg.setRegistrationServer("AceOne");
      reg.setCreateMailDb(false);
      reg.setCertifierIDFile("d:\\NotesAdministrator\\cert.id");
      DateTime dt = session.createDateTime("Today");
      dt.setNow();
      dt.adjustYear(1);
      reg.setExpiration(dt);
      reg.setIDType(Registration.ID_HIERARCHICAL);
      reg.setMinPasswordLength(5); // password strength
      reg.setNorthAmerican(true);
      reg.setOrgUnit("AceHardwareNE");
      reg.setRegistrationLog("log.nsf");
      reg.setUpdateAddressBook(true);
      reg.setStoreIDInAddressBook(true);
      if (reg.registerNewServer("AceTwo", // server name
        "d:\\NotesAdministrator\\server2.id", // file to be created
        "AceHardware", // domain name
        "AceHardware", // password for server ID
        "AceHardware", // certifier password
        "", // location field
        "", // comment field
        "", // Notes named network
        "Roberta Person/AceHardwareCertifier", // server administrator
        "Ace Two")) // Domino Directory title field
        { System.out.println("Registration succeeded"); }
        else { System.out.println("Registration failed"); }

    } catch(NotesException e) {
      System.out.println(e.id + " " + e.text);
      e.printStackTrace();
    }
  }
}