• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

I need help urgently

 
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi all,
I am developing a mobile agent application that should retrieve information from
remote databases. I want that on arrival at any remote system, the agent should
retrieve data from the database and move on to another remote host and do the same
thing. The challenge is, to be able to access a mysql database for instance, the agent
must know the database name as well as the password.

I have tried to station stationary agents at the remote systems so that on arrival
there will be a communication between the two but I seem not to be having a head way.

Please does any body know how I can achieve this?

Expecting a respose soon.
Thanks.
 
Bartender
Posts: 11497
19
Android Google Web Toolkit Mac Eclipse IDE Ubuntu Java
  • Likes 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Please EaseUp. There is no such thing like "urgent".
What is this mobile agent/station stationary agents/arrival at any remote system? Always TellTheDetails
 
Dan Dales
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks for your reply, Maneesh Godbole .

Let me explain what I mean.
A stationary agent does not move. It is stationed on a system (waiting for another agent to arrive or just there doing something).
A mobile agent on the other hand moves. It goes from one system to another doing its job.

What I actually want is this: I have a stationary agent one one system waiting for the mobile agent to
arrive. On arrival, there is a communication between the two.

What do i mean by a communication?
I mean there is an exchange of material between the two.
The exchanged material in this case is the mysql database name and the password of the system
where the stationary agent is residing. The stationary agent passes the password and mysql database name to the
mobile agent who just arrived.

This will enable the mobile agent to access the database of that system and retrieve information which
it then takes back to it home system.

The communication is very necessary because, for a mysql database to be accessed the password and database
name must be specified.

Hope my explanation made sense. Hoping to hear from you soon.
Thanks
 
Marshal
Posts: 28193
95
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Yes, but what is your question? I see something which looks like a high-level sketch of some requirements, but that's all. I can't tell what it is that you can't do.

You also posted this in the "Other Open Source Projects" forum. Was that because your question was supposed to be about some particular open source project? Sorry to be so obtuse, but I really can't tell what you want.
 
Dan Dales
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
 
Dan Dales
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello Maneesh Godbole,

I tried solving the problem by letting the agent read from an input text file
but am not having a head way. It is throwing the following exception:

java.security.AccessControlException: access denied (java.io.FilePermission infi
le.txt read)
at java.security.AccessControlContext.checkPermission(AccessControlConte
xt.java:267)
at java.security.AccessController.checkPermission(AccessController.java:
394)
at java.lang.SecurityManager.checkPermission(SecurityManager.java:540)
at com.ibm.aglets.tahiti.AgletsSecurityManager.checkPermission(Unknown S
ource)
at java.lang.SecurityManager.checkRead(SecurityManager.java:885)
at java.io.FileInputStream.<init>(FileInputStream.java:56)
at java.io.FileReader.<init>(FileReader.java:33)
at myfirst.MyAglet.onCreation(MyAglet.java:33)
at com.ibm.aglets.SystemMessage.handle(Unknown Source)
at com.ibm.aglets.AgletThread.run(Unknown Source)

I have tried to grant permission in the policy file with this code: permission java.io.FilePermission "C:\\infile.txt", "read";
but it is still throwing the same exception.

Please do you know how I can overcome this problem? Thanks.
 
Dan Dales
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks Maneesh Godbole and Paul Clapham for your respons.
I have fixed the problem. The agent is working as I wanted.

Thanks a lot.
 
reply
    Bookmark Topic Watch Topic
  • New Topic