Fw: [jade-develop] containers


Subject: Fw: [jade-develop] containers
From: Alexander Osherenko (a.ocherenko@gmx.de)
Date: Wed Aug 14 2002 - 11:57:31 MET DST


Hi Giovanni,

I've tried it myself. The results are attached. I've changed three files
(jade.core.Profile, jade.core.AgentContainerImpl,
jade.core.MainContainerImpl) and added a constant to the Profile (the
changes are really tiny). The only problem I have is that if I instantiate
several agents each in a personal container with the same name (e.g.
JADEContainer) the agents go in the first container JADEContainer and there
are some more empty container JADEContainer.

I create my agents as follows:

public MyContainer(String args[])
{
   //parse params to read parameters for the number and location of the
agents
   parseParams(args);
   try
   {
    Runtime rt = Runtime.instance();

    // Create a default profile
    Profile p = new ProfileImpl();

    //AO: I've added this constant
    p.setParameter(Profile.CONTAINER_NAME, "MyContainer");

    // Create a new non-main container, connecting to the default
    // main container (i.e. on this host, port 1099)
    //AO: If there is a container with the given name
    // JADE creates an additional container that remains empty
    //and the agents are going to the first container and not in the created
one
    AgentContainer ac = rt.createAgentContainer(p);

    //create inka agents
    for (int i=1;i<=numberAgents_;i++)
    {
     // Create a new prefix_ agent
     // and pass it a reference to an Object
     AgentController dummy = null;
                                 if (numberAgents_>1)
                                     dummy = ac.createNewAgent(prefix_+i,
                                         prefix_, new Object[0]);
                                 else
                                     dummy = ac.createNewAgent(prefix_,
                                         prefix_, new Object[0]);

     // Fire up the agent
     dummy.start();
    }
    }
  catch(Exception e) {
    e.printStackTrace();
  }

   }

 Is it possible to get a list of containers that I can check whether a
container is available or not and add new agents to the existing container?

 Cheers

 Alexander Osherenko

> ----- Original Message -----
> From: "Caire Giovanni" <Giovanni.Caire@TILAB.COM>
> To: "JADE" <jade-develop@sharon.cselt.it>; "Alexander Osherenko"
> <a.ocherenko@gmx.de>
> Sent: Tuesday, August 13, 2002 8:42 AM
> Subject: RE: [jade-develop] containers
>
>
> > Hi Alexander,
> >
> > Currently it's not possible to assign a specific name to a container,
> though it shouldn't be difficult to implement. Would you be interested in
> trying it yourself?
> >
> > The jade.wrapper.AgentContainer class allows you to control the local
> container only (i.e. the container that is running in the local JVM).
> Therefore there is no method like rt.getAgentContainer().
> > However you can launch and kill agents on a given (local or remote)
> container by requesting the AMS to do that. All these actions are included
> in the JADEManagementOntology.
> >
> > Bye
> >
> > Giovanni
> >
> > > ----------
> > > From: Alexander Osherenko[SMTP:a.ocherenko@gmx.de]
> > > Sent: luned́ 12 agosto 2002 17.09
> > > To: JADE
> > > Subject: [jade-develop] containers
> > >
> > >
> > > Hello!
> > >
> > > I'm wondering if I can assign a container a specified name. I thought
it
> would be possible to set the container name in this code:
> > >
> > > Profile p = new ProfileImpl();
> > > // Create a new non-main container, connecting to the default
> > > // main container (i.e. on this host, port 1099)
> > > //How can I set my container name?
> > > AgentContainer ac = rt.createAgentContainer(p);
> > >
> > > Can I get the container under a specified name? Something like this:
> > >
> > > AgentContainer ac = rt.getAgentContainer("myname");
> > >
> > > Thanks in advance
> > >
> > > Alexander Osherenko
> > >
> >
> > _______________________________________________
> > jade-develop mailing list
> > jade-develop@sharon.cselt.it
> > http://sharon.cselt.it/mailman/listinfo/jade-develop
> > UNSUBSCRIBE INSTRUCTIONS AT http://jade.cselt.it/mailing.htm#unsubscribe
> >
>




This archive was generated by hypermail 2a22 : Wed Aug 14 2002 - 11:55:45 MET DST