aspose file tools*
The moose likes Other Open Source Projects and the fly likes I need help urgently Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Products » Other Open Source Projects
Bookmark "I need help urgently" Watch "I need help urgently" New topic
Author

I need help urgently

Dan Dales
Greenhorn

Joined: Jul 20, 2011
Posts: 8
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.
Maneesh Godbole
Saloon Keeper

Joined: Jul 26, 2007
Posts: 10535
    
    9

Please EaseUp. There is no such thing like "urgent".
What is this mobile agent/station stationary agents/arrival at any remote system? Always TellTheDetails


[How to ask questions] [Donate a pint, save a life!] [Onff-turn it on!]
Dan Dales
Greenhorn

Joined: Jul 20, 2011
Posts: 8
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
Paul Clapham
Bartender

Joined: Oct 14, 2005
Posts: 18989
    
    8

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

Joined: Jul 20, 2011
Posts: 8
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

Joined: Jul 20, 2011
Posts: 8
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

Joined: Jul 20, 2011
Posts: 8
Thanks Maneesh Godbole and Paul Clapham for your respons.
I have fixed the problem. The agent is working as I wanted.

Thanks a lot.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: I need help urgently