Menu

About HelloWorld Example in Eclipse

AFME
2012-03-03
2013-03-03
  • fakraoui aymen

    fakraoui aymen - 2012-03-03

    --------- main.java -----------------------

    import com.agentfactory.platform.impl.DefaultAgentPlatform;
    import com.agentfactory.platform.impl.DefaultRunConfiguration;
    import com.agentfactory.service.ams.AgentManagementService;
    import com.agentfactory.agentspeak.interpreter.AgentSpeakArchitectureFactory;

    public class Main {
    public static class MyConfig extends DefaultRunConfiguration {
    public String getName() {
    return "helloworld";
    }

    public String getDomain() {
    return "ucd.ie";
    }

    public void configure() {
    super.configure();
    addArchitectureFactory(new AgentSpeakArchitectureFactory());
    addAgent("Bob", "helloworld.aspeak");
    }
    }

    public static void main(String args) {
    new MyConfig().configure();
    // configurer la plateforme
    DefaultAgentPlatform platform = new DefaultAgentPlatform();
    platform.setName("test");
    platform.setDomain("ucd.ie");

            // ancienne plateforme service
    AgentManagementService ams = (AgentManagementService) platform.getPlatformServiceManager().getServiceByName(AgentManagementService.NAME);
    try {
    ams.createAgent("hello", HelloAgent.class);
    } catch (Exception ex) {
    }
    }
    }

    -------------------- helloagent.java ---------------------------

    import java.util.Observable;

    import com.agentfactory.platform.impl.AbstractAgent;

    public class HelloAgent extends AbstractAgent {

    public HelloAgent(String name) {
    super(name);
    // TODO Auto-generated constructor stub
    }

    @Override
    public String getType() {
    // TODO Auto-generated method stub
    return null;
    }

    @Override
    public void initialise(String data) {
    // TODO Auto-generated method stub

    }

    @Override
    public void execute() {
    // TODO Auto-generated method stub
    System.out.println("Hello World!");
            this.endOfIteration();

    }

    @Override
    public void update(Observable arg0, Object arg1) {
    // TODO Auto-generated method stub

    }

    }


    --->  The problem is that nothing appears in the console

     
  • Conor

    Conor - 2012-03-05

    hi,

    This post should be placed in the standard Agent Factory help forum (https://sourceforge.net/projects/agentfactory/forums/forum/394540), rather than here, as you are using standard Agent Factory rather than AFME

     
  • fakraoui aymen

    fakraoui aymen - 2012-03-06

    merci pour votre réponse je vais plaçer le sujet dans le forum convenable.

     

Log in to post a comment.

Auth0 Logo