Thanks Paul Clapham for your prompt response
My question is how can the stationary agent passes the password and mysql database name to the
mobile agent who just arrived on a remote system's tahiti server?
I was able to achieve that only if the two agents are created in the same context.
May be
you should take a look at the code below:
The code for the stationary agent is:
package examples.itinerary;
import com.ibm.aglet.*;
public class RemotePass extends Aglet {
private
String [] msg = new String[2];
public void onCreation(Object init) {
msg[0] = new String("dbname");
msg[1] = new String("dbpass");
AgletContext ac = getAgletContext();
ac.setProperty("RemotePass", getAgletID());
}
public String [] getmsg() {
return msg;
}
}
the code above drops dbname and dbpass at the contex so that on arrival,
the mobile agent pick them up and then have access to the database.
The game plan is, if I want to access any system's database then, I station a an agent there
who will inform the mobile agent of the dbname and password on arrival. That is, if I want to access
three computers' databases then I need a copy of each of the stationary agent on each of the computers.
If the computer A has this stationary agent loaded to the tahiti server, then on loading the mobile agent
to the server, the logic works perfectly fine. But when I try dispatching the mobile agent to the remaining
computers it throws the following errors:
java.lang.ClassCastException: examples.itinerary.RemotePass
at examples.itinerary.CirculateAglet.run(CirculateAglet.java:73)
at examples.itinerary.CirculateAglet$1.onArrival(CirculateAglet.java:54)
at com.ibm.aglet.event.AgletEventListener.onArrival(Unknown Source)
at com.ibm.aglet.Aglet.processMobilityEvent(Unknown Source)
at com.ibm.aglet.Aglet.dispatchEvent(Unknown Source)
at com.ibm.aglets.LocalAgletRef.dispatchEvent(Unknown Source)
at com.ibm.aglets.EventMessage.handle(Unknown Source)
at com.ibm.aglets.AgletThread.run(Unknown Source)
java.lang.ClassCastException: examples.itinerary.RemotePass
at examples.itinerary.CirculateAglet.run(CirculateAglet.java:73)
at com.ibm.aglets.SystemMessage.handle(Unknown Source)
at com.ibm.aglets.AgletThread.run(Unknown Source)
No integrity check because no security domain is authenticated.
java.lang.InterruptedException
Sorry for bogging you with the lengthy explanation. Hope I have been able to explain myself?
The question once again is:
How can the stationary agent passes the password and mysql database name to the
mobile agent who just arrived on a remote system's tahiti server?
Hoping to hear from you soon.
Thanks