Thursday 22 December 2011

Retrieve version of Lotus Notes by java

Retrieve version of Lotus Notes by java
This task use java to retrieve version of Lotus Notes.
Extract version of Lotus Notes
  1. Create getNotesVersion method as following
  2. Call getNotesVersion method as following
Call method
try {
    String idfile = "path to your id file";
    String password = "your password";
    NotesThread.sinitThread();
    Session s = NotesFactory.createSessionWithFullAccess();
    s.createRegistration().switchToID(idfile, password);
    String version = getNotesVersion(s);
    logger.info(version);
} catch (Exception e) {
    logger.info("", e);
}
    
getNotesVersion method
private String getNotesVersion(Session session) throws Exception {
    String version = session.getNotesVersion();
    int pos = version.indexOf("|");
    if (pos >= 0) {
        version = version.substring(0, pos);
    }
    pos = version.indexOf("Release ");
    if (pos >= 0) {
        version = version.substring(pos + 8);
    }
    return version;
}
    

  Protected by Copyscape Online Copyright Protection

No comments:

Post a Comment