JAVA/CORBA CLASSES


Example: DxlExporter class
This agent generates DXL from the current database.

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();
       System.out.println("Exported " +
          stream.writeText(exporter.exportDxl(db)) +
         " bytes to " + filename);
     }
     else
       System.out.println("Cannot open " + filename);

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

The file generated by this code can be imported using the code specified in Example 1 of the DXLImporter class.

See Also