The Basics – Logging On/Off

Establishing a session with the Content Server is one of the most basic and first operations a Documentum programmer must master.  There are three primary classes involved in establishing a session with the Content Server:

  • IDfSessionManager – The session manager manages identities, pooled sessions and transactions.  It is also required to release a session (i.e., log off ) when you are through with it.
  • IDfLoginInfo – The login info object encapsulates the information needed to validate and login a user to a repository. It stores the user’s credential information in addition to options that affect the server login process.
  • IDfSession – The session object encapsulates a session with a Documentum repository.

Here are my logon and logoff methods:

public static IDfSession logon(String docbase,
                               String username,
                               String password) throws DfException {
    IDfSession session = null;

    // validate arguments
    if ((docbase == null) || (docbase.trim().isEmpty()) )
      throw new DfException ("Docbase name is null or blank.");

    if ((username == null) || (username.trim().isEmpty()) )
      throw new DfException ("Username name is null or blank.");

    if ((password == null) || (password.trim().isEmpty()) )
      throw new DfException ("Password is null or blank.");

    // create login info
    IDfLoginInfo li = new DfLoginInfo();

    // get session manager
    IDfSessionManager sessionMgr = DfClient.getLocalClient().newSessionManager();

    // login
    if (sessionMgr != null) {
      sessionMgr.setIdentity(docbase, li);
      session = sessionMgr.getSession(docbase);
     } else {
       throw new DfException("Could not create Session Manager.");
     return session;

public static void logoff(IDfSession session) {
  // release session when done
  if (session != null) {

Here is an example of using the logon() and logoff() methods in a program:

public static void main(String[] args) {
  private IDfSession session = null;

  try {
    System.out.println("Logging on...");
    session = login("repo1", "dmadmin", "dmadmin");
    if (session != null) {
      System.out.println("Success: session ID = " + session.getSessionId());

      // do stuff here

      // release session when done
      System.out.println("Logging off...");

    } else {
      System.out.println("Logon failed: Session is null");

  } catch (DfException dfe) {
    System.out.print("Logon failed:  ");


UPDATE:  I have created a DCTMBasics JAR file that contains most of the code discussed in this series.

%d bloggers like this: