Examples: Session class

This application creates a new Session object and accesses its properties.

import java.util.*;
import lotus.domino.*;
public class sessionprops extends NotesThread
{
  public static void main(String argv[])
    {
        sessionprops t = new sessionprops();
        t.start();
    }
  public void runNotes()
    {
    try
      {
        Session s = NotesFactory.createSession();
        System.out.println("User name = " +
        (String)s.getUserName());
        Name no = s.getUserNameObject();
        if (no.isHierarchical())
          System.out.println("Common name = " +
          (String)s.getCommonUserName());
        System.out.println("Domino " +
        (String)s.getNotesVersion() + " running on " +
        (String)s.getPlatform());
        System.out.println("***Address books***");
        Database db;
        Vector books = s.getAddressBooks();
        Enumeration e = books.elements();
        while (e.hasMoreElements()) {
          db = (Database)e.nextElement();
          String fn = db.getFileName();
          String server;
          if (db.getServer() != null)
            server = db.getServer();
          else 
            server = "Local";
          String title = db.getTitle();
          System.out.println(server + " " + fn + " \"" + 
            title + "\"");
        }
      }
    catch (Exception e)
      {
        e.printStackTrace();
      }
    }
}