次のエージェントは、複製先サーバーの NotesDbDirectory オブジェクトを取得します。
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();
// Substitute for AnyServer as desired
ReplicationEntry re = rep.getEntry(AnyServer, AnyServer, false);
if (re != null) {
String destination = re.getDestination();
DbDirectory dbdir = null;
if (destination.equals(AnyServer))
dbdir = session.getDbDirectory(null);
else
dbdir = session.getDbDirectory(destination);
if (dbdir.getName().length() > 0)
System.out.println(dbdir.getName());
else
System.out.println("Local");
}
else
System.out.println("Entry does not exist");
}
else
System.out.println(
"Can't get " + database + " on " + server);
} catch(Exception e) {
e.printStackTrace();
}
}
}