Hi.
their methods directly. If you want them to perform an action you can
interface (which is well documented). That's also why the
createNewAgent() mehtod returns a controller and not the agent itself.
the application.
Hope this helps.
Regards.
Post by Victor De PonteHi! thanks for your quick reply!
The snippet you provided is very similar to the snippet I mentioned (Section
3.8 Using JADE from external Java applications, from the Programmer's
Guide). The thing is, this code show how to start an agent from an
AgentController class, but it doesn't give me access to the Agent class
(DummyAgent in the code from the docs, AgentManager in your case). Likewise,
it doesn't give me access to the Container class, but to a
ContainerController class. The docs I've read so far don't say anything
about what I need. I would like you to please guide me on where to look at
when reading the docs, and, if you can, provide me with useful snippets of
code.
Other thing that I haven't found so far is how to stop/kill
agents/containers/platforms. I know that I have access to the following
AgentController.kill()
ContainerController.kill()
Runtime.shutdown()
I have started a platform (a MainContainer), and an DummyAgent, but when I
try to stop them using the mentioned methods, it doesn't seem to work, since
the process does not terminate. Im using Netbeans 8 to run my app, which is
a JavaFX app, and even though I stop the JavaFX part (by calling
Platform.exit(0) method), the process does not terminate, and the output
suggest that JADE has not terminated. I found an earlier similar question,
and they suggested to call those methods from a separate thread, which I
tried too, obtaining the same results. I would like to know how to
successfully terminate a JADE platform from code.
I really appreciate your help! thank you for all...
Regards,
On Sat, Jun 7, 2014 at 8:40 AM, Luis Lezcano Airaldi <luislezcair at gmail.com>
Post by Luis Lezcano AiraldiPost by Victor De PonteHi!
I've been reading the docs, and some community publications, but the ones
i've read so far assume I want to run JADE standalone, from cli. Only in
JADE Programmer's Guide there is a small section (3.8 Using JADE from
external Java applications) which shows a little snippet of code.
In my project, I would like to use JADE as a library, and embed it into my
own project. Is it possible? If affirmative, how do I start/stop
agents/containers/platforms programatically? I would like to know how to
do this, or where to reade on these subjects.
Thanks for your help!
regards,
Hello! It's very easy to use Jade as a library. Here's an example from a small
//Main method of a common Java program
public static void main(String[] args) {
// This is the important method. This launches the jade platform.
Runtime rt = Runtime.instance();
Profile profile = new ProfileImpl();
// With the Profile you can set some options for the container
profile.setParameter(Profile.PLATFORM_ID, "Platform Name");
profile.setParameter(Profile.CONTAINER_NAME, "Container Name");
// Create the Main Container
AgentContainer mainContainer = rt.createMainContainer(profile);
try {
// Here I create an agent in the main container and start it.
AgentController ac = mainContainer.createNewAgent("manager",
"ia.main.AgentManager", params);
ac.start();
} catch(StaleProxyException e) {
e.printStackTrace();
}
}
And that's it! You can read the docs to know how to create containers, launch
agents, and so on.
Regards.
_______________________________________________
jade-develop mailing list
jade-develop at avalon.tilab.com
https://avalon.cselt.it/mailman/listinfo/jade-develop
UNSUBSCRIBE INSTRUCTIONS AT
http://jade.tilab.com/community-mailinglist.htm
--
Victor Manuel De Ponte Olivares
Linux Registered User #513208