次のエージェントは、現在のデータベースから未処理の DXL を生成します。
import lotus.domino.*;
public class JavaAgent extends AgentBase {
public void NotesMain() {
try {
Session session = getSession();
AgentContext agentContext = session.getAgentContext();
// (Your code goes here)
// Get current database
Database db = agentContext.getCurrentDatabase();
// Export to file
String filename = "c:¥¥dxl¥¥exporteddb.dxl";
Stream stream = session.createStream();
if (stream.open(filename)) {
stream.truncate(); // Any existing file is erased
DxlExporter exporter = session.createDxlExporter();
exporter.setForceNoteFormat(true);
System.out.println("Exported " +
stream.writeText(exporter.exportDxl(db)) +
" bytes to " + filename);
}
else
System.out.println("Cannot open " + filename);
} catch(Exception e) {
e.printStackTrace();
}
}
}