/*
 * Launcher.java
 *
 * Created on December 15, 2004, 4:03 PM
 */

package DDMT.core;

import jade.*;
import jade.core.*;
import jade.wrapper.*;
/**
 *
 * @author  jk3
 */
public class Launcher {
    
    //The name of the monitor agent
    static final String monitorName = new String("MonitorAgent");
    static final String nodeName = new String("NodeAgent1");
    
    /** Creates a new instance of Launcher */
    public Launcher() {
    }
    
    /**
     * @param args the command line arguments
     */
    public static void main(String[] args) {
        
        launchAgent(monitorName, "DDMT.core.MonitorAgent");
        launchAgent(nodeName, "DDMT.Agents.NodeAgent");
    }
    
    private static void launchAgent( String name, String type )
    {
        //Launch the monitor agent.
        jade.core.Runtime rt = jade.core.Runtime.instance();
        
        //default profile
        Profile p = new ProfileImpl();
        jade.wrapper.AgentContainer ac = rt.createAgentContainer(p);
    
        //Create two instances of MessageAgent.java
        Object agentArgs[] = new Object[1];
        
        try{
            AgentController messageagent = ac.createNewAgent(name, type
                                                        , agentArgs);
            messageagent.start();
        }catch( Exception ex )
        {
            System.out.println("Critical error: Error starting monitor agent!");
            ex.printStackTrace();
        }
    }
}
