Examples: IsOpen property

This agent prints the result of isOpen before and after opening a database.

import lotus.domino.*;
public class JavaAgent extends AgentBase {
  
  public void isitopen(Database db) throws NotesException {
    if (db.isOpen())
      System.out.println("\"" + db.getTitle() + 
           "\" is open");
    else
      System.out.println("\"" + db.getTitle() + 
           "\" is not open"); }
  public void NotesMain() {
    try {
      Session session = getSession();
      AgentContext agentContext = session.getAgentContext();
      // (Your code goes here)
      DbDirectory Dir = session.getDbDirectory(null);
      Database db = 
         Dir.getFirstDatabase(DbDirectory.DATABASE);
      isitopen(db);
      db.open();
      isitopen(db);
    } catch(Exception e) {
      e.printStackTrace();
    }
  }
}