JAVA/CORBA CLASSES


Examples: compact method
This agent compacts a database if less than 75% of its disk space is occupied by real data. The user supplies the database name as the agent's comment.

import lotus.domino.*;
public class JavaAgent extends AgentBase {
 public void NotesMain() {
   try {
     Session session = getSession();
     AgentContext agentContext =
         session.getAgentContext();
     // (Your code goes here)
     Agent agent = agentContext.getCurrentAgent();
     String dbName = agent.getComment();
     Database db = session.getDatabase(null, dbName);
     String title = db.getTitle();
     double percentUsed = db.getPercentUsed();
     if (percentUsed < 75) {
       int saved = db.compact();
       System.out.println("Compacting database \"" +
       title + "\""); }
     System.out.println
     ("Database \"" + title + "\" is " +
     (int)percentUsed + " percent used");
   } catch(Exception e) {
     e.printStackTrace();
   }
 }
}

See Also