main app now accepting argument: --start-trains
This commit is contained in:
2
pom.xml
2
pom.xml
@@ -4,7 +4,7 @@
|
|||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
<groupId>de.srsoftware</groupId>
|
<groupId>de.srsoftware</groupId>
|
||||||
<artifactId>web4rail</artifactId>
|
<artifactId>web4rail</artifactId>
|
||||||
<version>0.11.32</version>
|
<version>1.0.1</version>
|
||||||
<name>Web4Rail</name>
|
<name>Web4Rail</name>
|
||||||
<packaging>jar</packaging>
|
<packaging>jar</packaging>
|
||||||
<description>Java Model Railway Control</description>
|
<description>Java Model Railway Control</description>
|
||||||
|
|||||||
@@ -40,6 +40,7 @@ import de.srsoftware.web4rail.tiles.Contact;
|
|||||||
*/
|
*/
|
||||||
public class Application extends BaseClass{
|
public class Application extends BaseClass{
|
||||||
private static final Logger LOG = LoggerFactory.getLogger(Application.class);
|
private static final Logger LOG = LoggerFactory.getLogger(Application.class);
|
||||||
|
private static final String START_TRAINS = "--start-trains";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* entry point for the application:<br/>
|
* entry point for the application:<br/>
|
||||||
@@ -71,6 +72,13 @@ public class Application extends BaseClass{
|
|||||||
plan = new Plan();
|
plan = new Plan();
|
||||||
}
|
}
|
||||||
Desktop.getDesktop().browse(URI.create("http://"+InetAddress.getLocalHost().getHostName()+":"+config.getInt(PORT)+"/plan"));
|
Desktop.getDesktop().browse(URI.create("http://"+InetAddress.getLocalHost().getHostName()+":"+config.getInt(PORT)+"/plan"));
|
||||||
|
for (String arg : args) {
|
||||||
|
switch (arg) {
|
||||||
|
case START_TRAINS:
|
||||||
|
Train.startAll();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -642,6 +642,10 @@ public class Train extends BaseClass implements Comparable<Train> {
|
|||||||
return t("Started {}",this);
|
return t("Started {}",this);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static void startAll() {
|
||||||
|
for (Train train : list()) train.automatic();
|
||||||
|
}
|
||||||
|
|
||||||
private void startSimulation() {
|
private void startSimulation() {
|
||||||
for (Contact contact : route.contacts()) {
|
for (Contact contact : route.contacts()) {
|
||||||
if (contact.addr() != 0) return; // simulate train only when all contacts are non-physical
|
if (contact.addr() != 0) return; // simulate train only when all contacts are non-physical
|
||||||
|
|||||||
Reference in New Issue
Block a user