例: openByReplicaID method

次のエージェントは、特定のサーバー上の現在のデータベースのレプリカを開こうとします。

import lotus.domino.*;

public class JavaAgent extends AgentBase {

  public void NotesMain() {

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

      // (Your code goes here) 
      String id = agentContext.getCurrentDatabase().getReplicaID();
      String server = "Slapper/East/Acme";
      Database db = session.getDatabase(null, null);
      if (db.openByReplicaID(server, id))
      {
        System.out.println("Replica of current database on Slapper");
        System.out.println("Server = " + db.getServer());
        System.out.println("Filepath = " + db.getFilePath());
        System.out.println("Title = " + db.getTitle());
      }
      else
        System.out.println("No replica of current database on Slapper");

    } catch(Exception e) {
      e.printStackTrace();
    }
  }
}