JAVA/CORBA CLASSES
Examples: ServerName property
1. This agent prints the name and server name of the current agent.
import lotus.domino.*;
public class JavaAgent extends AgentBase {
public void NotesMain() {
try {
Session session = getSession();
AgentContext agentContext =
session.getAgentContext();
// (Your code goes here)
String u = session.getServerName();
System.out.println("Server name = " + u);
} catch(Exception e) {
e.printStackTrace();
}
}
}
2. This agent sets the server name of the agent named "Agent To Run" to the asterisk (*), indicating that the agent can run on any server.
import lotus.domino.*;
import java.util.*;
public class JavaAgent extends AgentBase {
public void NotesMain() {
try {
Session session = getSession();
AgentContext agentContext =
session.getAgentContext();
// (Your code goes here)
Database db = agentContext.getCurrentDatabase();
Vector agents = db.getAgents();
Enumeration e = db.getAgents().elements();
String msg = "Agent not found";
while (e.hasMoreElements()) {
Agent agent = (Agent)e.nextElement();
String name = agent.getName();
if (name.compareTo("Agent To Run") == 0) {
agent.setServerName("*");
agent.save();
msg = "Agent server name set to *";
break;
}
}
System.out.println(msg);
} catch(Exception e) {
e.printStackTrace();
}
}
}
See Also
ServerName property
Glossary
Feedback on
Help
or
Product Usability
?
Help on Help
All Help Contents
Glossary