public InfrastructureFactory getInfrastructureFactory() throws JasonException { if (infraFac == null) { try { String facClass = Config.get().getInfrastructureFactoryClass(infrastructure.getClassName()); infraFac = (InfrastructureFactory) Class.forName(facClass).newInstance(); } catch (Exception e) { throw new JasonException( "The project's infrastructure ('" + infrastructure + "') is unknown!"); } } return infraFac; }
public String toString() { StringBuilder s = new StringBuilder(); s.append("/*\n"); s.append(" Jason Project\n\n"); s.append( " -- created on " + new SimpleDateFormat("MMMM dd, yyyy").format(new Date()) + "\n"); s.append("*/\n\n"); s.append("MAS " + getSocName() + " {\n"); s.append(" infrastructure: " + getInfrastructure() + "\n\n"); if (getEnvClass() != null && !getEnvClass().getClassName().equals(jason.environment.Environment.class.getName())) { s.append(" environment: " + getEnvClass()); if (envClass.getHost() != null) { s.append(" at \"" + envClass.getHost() + "\""); } s.append("\n\n"); } if (getControlClass() != null) { s.append(" executionControl: " + getControlClass()); if (getControlClass().getHost() != null) { s.append(" at \"" + getControlClass().getHost() + "\""); } s.append("\n\n"); } // agents s.append(" agents:\n"); Iterator<AgentParameters> i = agents.iterator(); while (i.hasNext()) { s.append(" " + i.next()); s.append("\n"); } s.append("\n"); // directives if (directiveClasses.size() > 0) { s.append(" directives: "); for (String d : directiveClasses.keySet()) { s.append(d + "=" + directiveClasses.get(d) + "; "); } s.append("\n"); } // classpath if (classpaths.size() > 0) { s.append(" classpath: "); for (String cp : classpaths) { s.append("\"" + cp + "\"; "); } s.append("\n"); } // sourcepath if (sourcepaths.size() > 0) { s.append(" aslSourcePath: "); for (String cp : sourcepaths) { s.append("\"" + cp + "\"; "); } s.append("\n"); } s.append("}"); return s.toString(); }
public void addDirectiveClass(String id, ClassParameters classname) { directiveClasses.put(id, classname.getClassName()); }