例: ReplicationEntry class

  1. 次のエージェントは、複製エントリを取得し、そのプロパティを表示します。
    import lotus.domino.*;
    
    public class JavaAgent extends AgentBase {
    
      public void NotesMain() {
    
        try {
          Session session = getSession();
          AgentContext agentContext = session.getAgentContext();
    
          // (Your code goes here) 
          String server = "Server1/East/Acme";
          String database = "test¥¥DatabaseJava";
          String AnyServer = "-";
          Database db = session.getDatabase(server, database);
          if (db.isOpen()) {
            Replication rep = db.getReplicationInfo();
            ReplicationEntry re = rep.getEntry(AnyServer, AnyServer, false);
            if (re != null) {
              System.out.println("Source: " + re.getSource());
              System.out.println("Destination: " + re.getDestination());
              System.out.println("Formula: " + re.getFormula());
              System.out.println("Views: " + re.getViews());
              System.out.println("IsIncludeACL: " + re.isIncludeACL());
              System.out.println("IsIncludeAgents: " + re.isIncludeAgents());
              System.out.println(
                "IsIncludeDocuments: " + re.isIncludeDocuments());
              System.out.println("IsIncludeForms: " + re.isIncludeForms());
              System.out.println(
                "IsIncludeFormulas: " + re.isIncludeFormulas());
            }
            else
              System.out.println("No entry for ");
          }
          else
            System.out.println(
              "Can't get " + database + " on " + server);
    
        } catch(Exception e) {
          e.printStackTrace();
        }
      }
    }
  2. 次のエージェントは、複製エントリを作成します。
    import lotus.domino.*;
    
    public class JavaAgent extends AgentBase {
    
      public void NotesMain() {
    
        try {
          Session session = getSession();
          AgentContext agentContext = session.getAgentContext();
    
          // (Your code goes here) 
          String server = "Server1/East/Acme";
          String database = "test¥¥DatabaseJava";
          String AnyServer = "-";
          Database db = session.getDatabase(server, database);
          if (db.isOpen()) {
            Replication rep = db.getReplicationInfo();
            ReplicationEntry re = rep.getEntry(AnyServer, AnyServer, false);
            if (re == null) {
              re = rep.getEntry(AnyServer, AnyServer, true);
              re.save();
              System.out.println("Entry created");
            }
            else
              System.out.println("Entry already exists");
          }
          else
            System.out.println(
              "Can't get " + database + " on " + server);
    
        } catch(Exception e) {
          e.printStackTrace();
        }
      }
    }