Skip to main content

developerWorks >  WebSphere  >  Forums  >  IBM WebSphere Portlet Factory - Lotus Collaboration Extension  >  developerWorks

Convert Domino Java agent to Java class    Point your RSS reader here for a feed of the latest messages in this thread


Tags for this thread: 

     

 
 

My developerWorks
 Welcome, Guest
Sign in or register
Permlink Replies: 5 - Pages: 1 - Last Post: Aug 4, 2009 11:01 AM Last Post By: salexander
brittany_lazarski

Posts: 72
Registered: Aug 29, 2007 02:14:00 PM
Convert Domino Java agent to Java class
Posted: Sep 25, 2007 03:41:12 PM
Click to report abuse...   Click to reply to this thread Reply
I am new to the Java world, so forgive me if this is an easy question. I am trying to create a new class in my Portlet Factory project. I want to basically copy my Domino Java agent into this new class, but am having a hard time with it. I tried to do an import of lotus.domino.*, but it doesn't like it, and therefore cannot resolve what "AgentBase" is. I have the ncso.jar file in my build path. Do I have anything blatently wrong here?

package com.bradycorp.DominoAgents;
import lotus.domino.*;

public class GetNamesAgent extends AgentBase {
public void NotesMain() {
try {
Session session = getSession();
AgentContext agentContext = session.getAgentContext();
// (Rest of code will go here)

} catch(Exception e) {
e.printStackTrace();
}
}
}
mburati

Posts: 1,686
Registered: May 10, 2006 03:35:21 PM
Re: Convert Domino Java agent to Java class
Posted: Sep 25, 2007 03:45:21 PM   in response to: brittany_lazarski in response to: brittany_lazarski's post
Click to report abuse...   Click to reply to this thread Reply
I'm not a Domino/NCSO expert, but I just opened NCSO.jar in WinZip and I don't see an AgentBase class in the jar. Are you sure that's a class that should be supported by the NCSO API?

..mb1
salexander

Posts: 182
Registered: Mar 14, 2007 01:29:36 PM
Re: Convert Domino Java agent to Java class
Posted: Sep 26, 2007 03:43:59 PM   in response to: brittany_lazarski in response to: brittany_lazarski's post
Click to report abuse...   Click to reply to this thread Reply
Hi,
I assume you want to use Portlet Factory and its Domino builders to access an existing Domino database. Tell me more about what you want your application to do. Are you trying to resuse an existing Domino java agent that you have written? The more detail the better.

I believe AgentBase is only used (and accessible) when you are writing an agent in Domino Designer and the agent is run and called by the Domino web server. (Your sample below is the skeleton code provided when you create a new Domino agent in Domino Designer) Like mb1 says, it it not part of ncso.jar, so AgentBase is not meant to be used remotely.

Since you are new to Portlet Factory and the Java world, you might want to start by looking at the Getting Started guide. Start menu > IBM WebSphere > Portlet Factory > Gettting Started Guide. Then, we also have a sample of using Portlet Factory to connect to Domino here: http://www.ibm.com/developerworks/websphere/zones/portal/portletfactory/samples/datasvc.html

The Domino builders in Portlet Factory support create, retrieve, update, and delete operations, and a few other operations (see the Domino Help). If you are trying to use Portlet Factory and the Domino Java API to do some additional custom coding, we provide many "back doors" into the API. For instance, the Domino builders contain method that will return you the lotus.domino.Session object and the lotus.domino.Database objects. (See the Domino builder help). You could use these in a Method or Linked Java Object builder.

Once you read the Getting Started and Domino samples, do tell me a little more about what you are trying to do, and I can probably tailor my response accordingly.

Stick with it. There is a learning curve with Portlet Factory, but once you get it, you'll realize its power and flexibility!

Sam

> I am new to the Java world, so forgive me if this is
> an easy question. I am trying to create a new class
> in my Portlet Factory project. I want to basically
> copy my Domino Java agent into this new class, but am
> having a hard time with it. I tried to do an import
> of lotus.domino.*, but it doesn't like it, and
> therefore cannot resolve what "AgentBase" is. I have
> the ncso.jar file in my build path. Do I have
> anything blatently wrong here?
>
> package com.bradycorp.DominoAgents;
> import lotus.domino.*;
>
> public class GetNamesAgent extends AgentBase {
> public void NotesMain() {
> try {
> Session session = getSession();
> AgentContext agentContext =
> text = session.getAgentContext();
> // (Rest of code will go here)
>
> } catch(Exception e) {
> e.printStackTrace();
> }
> }
> }
salexander

Posts: 182
Registered: Mar 14, 2007 01:29:36 PM
Re: Convert Domino Java agent to Java class
Posted: Sep 26, 2007 03:59:18 PM   in response to: salexander in response to: salexander's post
Click to report abuse...   Click to reply to this thread Reply
Hi,
I just realized your previous posts, and that you've had success with PF and the Domino builders. So you do have familiarity with PF and the Domino builders.

Based on your previous posts, it sounds like you are needing to write some custom Java using the Domino API to do something we don't already do in the builder. This is a common use case, and the builder provides "backdoors" into the Domino API to let you do this. Check out the getDominoSession() (returns a lotus.domino.Session) and getDominoDatabase() (returns a lotus.domino.Database) methods provided by the builder. Once you get the Session or the Database, you can likely do what you need to do.

If your code is pretty small, consider using a Method builder. If your code is more complex, consider writing your own Java classes, and use a Linked Java Object builder in your model to access the class.

With this approach, you don't need AgentBase.

Hopefully this helps.

Sam
Byju Joy

Posts: 4
Registered: Dec 22, 2007 02:37:48 PM
Re: Convert Domino Java agent to Java class
Posted: Aug 03, 2009 01:35:50 AM   in response to: salexander in response to: salexander's post
Click to report abuse...   Click to reply to this thread Reply
A dummy AgentBase class can be created to avoid compilation issue. Like the code given below.
This is just for resolving compilation. Not for running. As mentioned in one of the previous posts Agent should run locally in Domino..


import lotus.domino.Session;

public class AgentBase {
public Session getSession(){
return null;
}
}

salexander

Posts: 182
Registered: Mar 14, 2007 01:29:36 PM
Re: Convert Domino Java agent to Java class
Posted: Aug 04, 2009 11:01:44 AM   in response to: Byju Joy in response to: Byju Joy's post
Click to report abuse...   Click to reply to this thread Reply
Hi,
Not sure if you realized it, but the thread is two years old.

Also, I don't really think making a dummy AgentBase class would help the user and I would not recommend this approach. When using Portlet Factory's Domino builders, you don't need AgentBase at all. If you're trying to run an existing agent from Portlet Factory, the Domino builders have the ability to run named agents. (In some cases the agent might need to be tweaked a bit) and they also expose the lotus.domino.Session and lotus.domino.Database objects, so if you need to write custom Domino Java api code in your app, you can do so.

Sam
 Tags
Help

Use the search field to find all types of content in My developerWorks with that tag.

Use the slider bar to see more or fewer tags.

Popular tags shows the top tags for this particular type of content or application that you're viewing.

My tags shows your tags for this particular type of content or application that you're viewing.

 

MoreLess 


Point your RSS reader here for a feed of the latest messages in all forums