Examples: replicate method

This agent replicates the local database dbexamples.nsf with its replica on notesua1.

import lotus.domino.*;
public class JavaAgent extends AgentBase {
  public void NotesMain() {
    try {
      Session session = getSession();
      AgentContext agentContext = 
         session.getAgentContext();
      // (Your code goes here) 
      Database db = 
         session.getDatabase(null, "dbexamples");
      if (db.isOpen()) {
        String title = db.getTitle();
        if (db.replicate("notesua1"))
          System.out.println
          ("\"" + title + "\" has replicated");
        else
          System.out.println
          ("Error replicating \"" + title + "\""); }
      else
        System.out.println("No such database");
    } catch(Exception e) {
      e.printStackTrace();
    }
  }
}