From: <jom...@us...> - 2014-06-27 22:57:38
|
Revision: 1791 http://sourceforge.net/p/jason/svn/1791 Author: jomifred Date: 2014-06-27 22:57:36 +0000 (Fri, 27 Jun 2014) Log Message: ----------- improve jade run mas Modified Paths: -------------- trunk/src/jason/infra/jade/RunJadeMAS.java Modified: trunk/src/jason/infra/jade/RunJadeMAS.java =================================================================== --- trunk/src/jason/infra/jade/RunJadeMAS.java 2014-06-10 15:00:32 UTC (rev 1790) +++ trunk/src/jason/infra/jade/RunJadeMAS.java 2014-06-27 22:57:36 UTC (rev 1791) @@ -32,6 +32,9 @@ import jade.wrapper.StaleProxyException; import jason.JasonException; import jason.architecture.MindInspectorAgArch; +import jason.asSyntax.ASSyntax; +import jason.asSyntax.Literal; +import jason.asSyntax.StringTerm; import jason.asSyntax.directives.DirectiveProcessor; import jason.asSyntax.directives.Include; import jason.control.ExecutionControlGUI; @@ -54,6 +57,7 @@ import javax.swing.ImageIcon; import javax.swing.JButton; + /** * Runs MASProject using JADE infrastructure. * @@ -96,7 +100,6 @@ targetContainer = args[i+1]; } } - return super.init(args); } @@ -145,12 +148,30 @@ protected boolean startContainer() { try { // source based on jade.Boot + try { + String m = getProject().getInfrastructure().getParameter("main_container_host"); + if (m != null) { + Literal ml = ASSyntax.parseLiteral(m); + m = ((StringTerm)(ml.getTerm(0))).getString(); + int pos = m.indexOf(":"); + if (pos > 0) { + try { + initArgs.add("-port"); initArgs.add(m.substring(pos+1)); + initArgs.add("-host"); initArgs.add(m.substring(0,pos)); + initArgs.add("-container"); initArgs.add(m.substring(0,pos)); + } catch (Exception e) { + e.printStackTrace(); + } + } + } + } catch (Exception e) {} profile = new BootProfileImpl(prepareArgs( (String[])initArgs.toArray(new String[0]))); - + //System.out.println(profile); if (profile.getBooleanProperty(Profile.MAIN, true)) { cc = Runtime.instance().createMainContainer(profile); } else { cc = Runtime.instance().createAgentContainer(profile); + logger.info("Agent Container started with "+profile); } //Runtime.instance().setCloseVM(true); // Exit the JVM when there are no more containers around return cc != null; @@ -219,7 +240,7 @@ String numberedAg = agName; if (ap.qty > 1) numberedAg += (cAg + 1); //String.format("%0"+String.valueOf(ap.qty).length()+"d", cAg + 1); - logger.fine("Creating agent " + numberedAg + " (" + (cAg + 1) + "/" + ap.qty + ")"); + logger.info("Creating agent " + numberedAg + " (" + (cAg + 1) + "/" + ap.qty + ")"); AgentController ac = cc.createNewAgent(numberedAg, JadeAgArch.class.getName(), new Object[] { ap, isDebug(), getProject().getControlClass() != null }); ags.put(numberedAg,ac); } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |