Dear Julian,
I was trying to integrate OpenLog into a small Java I was writing in Eclipse. I use the "Two-Headed beast" method because the DDE Editors just bug me, and the debugging is yummy in native Eclipse. I couldn't get OpenLog to work correctly because this line in useDefaultLogDb was failing - currentDatabase was null.
logDb = session.getDatabase(currentDatabase.getServer(), logDbName);
There might be a better way to to this, but I created a new constructor for the OpenLogItem object
public OpenLogItem (Session s, Database callingdb, String agentName) {
try {
thisDatabase = callingdb.getFilePath();
this.currentDatabase = callingdb;
thisAgent = agentName;
session = NotesFactory.createSession();
thisServer = session.getServerName();
if (thisServer == null)
thisServer = "";
userName = session.getUserName();
clientVersion = new Vector();
String cver = session.getNotesVersion();
if (cver != null) {
if (cver.indexOf("|") > 0) {
clientVersion.addElement(cver.substring(0, cver.indexOf("|")));
clientVersion.addElement(cver.substring(cver.indexOf("|") + 1));
} else {
clientVersion.addElement(cver);
}
}
startTime = session.createDateTime("Today");
startTime.setNow();
resetFields();
} catch(Exception e) {
debugPrint(e);
}
}
and modified the calling agent thus:
public void NotesMain() {
Session s;
Database db;
AgentContext ac;
OpenLogItem oli;
// do we get Session from debug member var,
// or from agent context?
try {
if (this.m_Session != null) {
s = this.m_Session;
ac = this.m_Ctx;
oli = new OpenLogItem(s, ac.getCurrentDatabase(), "Clean up Roaming Training Users");
} else {
s = this.getSession();
ac = s.getAgentContext();
oli = new OpenLogItem(s);
}
} catch (Exception e) {
e.printStackTrace();
return;
}
// from this point on, agent code is common to
// both debug and "real agent" environments
try {
Hope you see this as a helpful "Open Source Contribution" - and it might also simply be that I have missed something really obvious, in which case I will bribe you with beer to get this feature request deleted.
All the best
Andrew