Examples: IsDirectoryCatalog property

The following agent determines if databases are Directory Catalogs.

import lotus.domino.*;
import java.util.*;

public class JavaAgent extends AgentBase {

  public void NotesMain() {

    try {
      Session session = getSession();
      AgentContext agentContext = session.getAgentContext();

      // (Your code goes here) 
      Database db;
      String server;
      String iscatalog;
      Vector books = session.getAddressBooks();
      Enumeration e = books.elements();
      while (e.hasMoreElements()) {
        db = (Database)e.nextElement();
        String fn = db.getFileName();
        if (db.getServer() != null)
          server = db.getServer();
        else 
          server = "Local";
        System.out.println(server + " " + fn);
        // Must have access to database
        try {
          if (db.open()) {
            if (db.isDirectoryCatalog())
              iscatalog = "Is directory catalog";
            else
              iscatalog = "Is not directory catalog";
            System.out.println("\t" + iscatalog);
          }
          else
            System.out.println("\tCannot open database");
        } catch(NotesException ne) {
          System.out.println("\t" + ne.id + " " + ne.text);
        }
      } // end while

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