Skip to content

Commit

Permalink
agent name changes removed in platformagent
Browse files Browse the repository at this point in the history
  • Loading branch information
lb-actoron committed Feb 22, 2021
1 parent 163191d commit c4791ce
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 11 deletions.
31 changes: 21 additions & 10 deletions platform/base/src/main/java/jadex/platform/PlatformAgent.java
Original file line number Diff line number Diff line change
Expand Up @@ -377,9 +377,14 @@ else if (entry.getKey().lastModified() == moddates.get(entry.getKey()))
EnumInfo ei = (EnumInfo)ai.getValue("autostart");
if(ei==null)
System.out.println("No autostart agent: "+ci);
boolean ok = ei==null? true: "true".equals(ei.getValue().toLowerCase());

String name = ai.getValue("name")==null || ((String)ai.getValue("name")).length()==0? null: (String)ai.getValue("name");

if("rt".equals(name))
System.out.println("sdgjndfjk");

boolean ok = ei==null? true: "true".equals(ei.getValue().toLowerCase());

Boolean agentstart = null;
if(name!=null)
{
Expand All @@ -390,25 +395,31 @@ else if (entry.getKey().lastModified() == moddates.get(entry.getKey()))

if(agentstart==null)
{
name = SReflect.getUnqualifiedTypeName(ci.getClassName());
String typename = SReflect.getUnqualifiedTypeName(ci.getClassName());

if(getAgentStart(name.toLowerCase())!=null)
if(getAgentStart(typename.toLowerCase())!=null)
{
ok = getAgentStart(name.toLowerCase());
ok = getAgentStart(typename.toLowerCase());
if(name==null)
name = typename;
}
else
{
// check classname - suffix (BDI/Agent etc) in lowercase
int suf = SUtil.inndexOfLastUpperCaseCharacter(name);
int suf = SUtil.inndexOfLastUpperCaseCharacter(typename);
if(suf>0)
{
name = name.substring(0, suf).toLowerCase();
if(getAgentStart(name)!=null)
typename = typename.substring(0, suf).toLowerCase();
if(getAgentStart(typename)!=null)
{
ok = getAgentStart(name);
ok = getAgentStart(typename);
}
}
}

// only set name, if was not explicitly set
if(name==null)
name = typename;
}

if(ok)
Expand All @@ -422,7 +433,7 @@ else if (entry.getKey().lastModified() == moddates.get(entry.getKey()))
}

//for(CreationInfo ci: infos)
// System.out.println("creating: "+ci.getFilename());
// System.out.println("creating: "+ci);

agent.getFeature(ISubcomponentsFeature.class).createComponents(infos.toArray(new CreationInfo[infos.size()])).addResultListener(new IResultListener<Collection<IExternalAccess>>()
{
Expand Down Expand Up @@ -505,7 +516,7 @@ protected void addComponentToLevels(DependencyResolver<String> dr, ClassInfo ci,

String name = ai.getValue("name")==null || ((String)ai.getValue("name")).length()==0? null: (String)ai.getValue("name");
// String name = autostart.name().length()==0? null: autostart.name();

EnumInfo ei = (EnumInfo)ai.getValue("autostart");

String val = ei.getValue();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -570,5 +570,15 @@ public CreationInfo setPojo(Object pojo)
this.pojo = pojo;
return this;
}

/**
* Get the string representation.
* @return The string representation.
*/
@Override
public String toString()
{
return "CreationInfo(name=" + name + ", filename=" + filename + ")";
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,6 @@
import jadex.commons.future.Future;
import jadex.commons.future.IFuture;
import jadex.commons.future.IIntermediateFuture;
import jadex.commons.future.IIntermediateResultListener;
import jadex.commons.future.IResultListener;
import jadex.commons.future.ITerminableFuture;
import jadex.commons.future.IntermediateEmptyResultListener;
Expand Down

0 comments on commit c4791ce

Please sign in to comment.