Some questions concerning Java Agent programming

Hi,

so I’m currently diving into Notes development, but some aspects about e.g. programming an Agent in Java are still puzzling to me.

  1. Domino Designer (DD) always generates a source file called “JavaAgent.java” with a single public class. Ain’t there any way to decompose my agent into multiple separate class files and packages?

  2. Is there any form of auto-completion in DD for Java development? Because, right now I’m feeling so uncomfortable about DD, I just think about firing up Eclipse or NetBeans and do my coding there…

  3. The help index talks about a class called “NotesUIWorkspace” which one can use to bring up dialogs and stuff. However, trying to instantiate that class I only get a compiler error, because it can’t resolve that class. Looking at the “Reference” tab, there actually is no class by that name, and I was unable to find anything equivalent. So how do I spawn dialogs in the workspace?

  4. Is there a hotkey to trigger the compiler?

Thanks!

/Matt

Subject: Some questions concerning Java Agent programming

Matt,

here’s some answers, to the best of my knowledge, but I’ve changed the order–

  1. You can not access NotesUIWorkspace via Java in Notes 7. Java only works when doing backend processing in Notes. There is no hook into the UI via Java. (This may be different in Notes 8, but don’t quote me on that since I haven’t used/developed for Notes 8 yet.)

1 and 2) Since you can only process in the back end, JavaAgent.java is the java version of a Notes agent. The IDE is too daft to let you develop your classes separately. It’s kind of a crap development environment for Java. When i develop Java apps for Domino (which is rare) I do it in Eclipse and then either copy the code or import the .jar into Designer.

  1. Not that I know of.

sorry to be the bearer of bad news…

brandt

Subject: RE: Some questions concerning Java Agent programming

Hi Brandt,

thanks a lot! That’s indeed good to know, I wonder why the programming guide for DD7 doesn’t clearly mention that (or maybe I just missed/misinterpreted it). Anyway, this would then lead to another question, which I was also wondering about:

Since I will now have to pass around data between a background Java agent and some foreground LotusScript script, how is that done? I am particularly wondering about the @Command([AgentRun]; “MyAgent”) command in the Formula Language, as there doesn’t seem to be away to pass data (read: arguments) to the agent or retrieve results from it (which on a second thought would be sort of difficult, since a Java thread’s run method doesn’t return any data).

Or is an agent just a purely procedural component, which cannot communicate with other Lotus programs such as Formulas or LotusScript scripts?

Maybe it would be best for me to simply go ahead and do all my programming in LotusScript, but I can only do that if there is some facility in the Notes API for LotusScript which lets me issue HTTP POST messages to a Web server (Java 1.4 can do that e.g. using HttpURLConnection). For example, with Formula I can only send GET request using OpenURL (I think) so that is not feasible.

Best,

Matt

Subject: RE: Some questions concerning Java Agent programming

There are two ways of passing parameters (arguments) to an agent – one good, one not so good. the “good” method involves passing the required data in the fields of a document and using the optional ParameterNoteID in the call to the agent’s run method. The “not so good” method is to throw the data to the Notes environment (notes.ini entries). Formula Language allows the latter only; LotusScript code will allow the creation of the parameter document and a call to use it.

Subject: RE: Some questions concerning Java Agent programming

Hi Stan,

ah yes, I suspected something like that :slight_smile: Makes sense to use a document since it’s basically a record of fields and values. Since my Agent is running on existing email databases, does that mean I will have to create a new database holding e.g. parameter data on the client computer? I mean, a document (or note) in a mail database is an email right, so I suppose I can’t use that.

Best,

matt