Global update on storages. Adopted connections instead of listeners for them

This commit is contained in:
Alexander Nozik 2017-05-24 22:13:07 +03:00
parent 6aeaf89d69
commit 315e4f0811
4 changed files with 11 additions and 5 deletions

View File

@ -20,7 +20,7 @@ dependencies {
task debug(dependsOn: classes, type: JavaExec) {
main mainClass
args "--debug=true"
args "--config.resource=/config-debug/devices.xml"
classpath = sourceSets.main.runtimeClasspath
description "Start application in debug mode with default virtual port"
group "debug"

View File

@ -22,6 +22,7 @@ import hep.dataforge.control.connections.Roles;
import hep.dataforge.control.connections.StorageConnection;
import hep.dataforge.control.devices.Device;
import hep.dataforge.control.devices.PortSensor;
import hep.dataforge.control.devices.StateDef;
import hep.dataforge.control.measurements.AbstractMeasurement;
import hep.dataforge.control.measurements.Measurement;
import hep.dataforge.control.ports.PortHandler;
@ -54,6 +55,7 @@ import java.util.stream.Collectors;
@RoleDef(name = Roles.STORAGE_ROLE)
@RoleDef(name = Roles.VIEW_ROLE)
@ValueDef(name = "port", def = "virtual", info = "The name of the port for this PKT8")
@StateDef(name = "storing")
public class PKT8Device extends PortSensor<PKT8Result> {
public static final String PKT8_DEVICE_TYPE = "numass:pkt8";

View File

@ -2,9 +2,8 @@
<config>
<storage path="D:/temp/test"/>
<numass run="serverTest"/>
<device type="PKT8">
<device type="PKT8" port = "virtual" abuf = "120">
<!--<connection ip="192.168.111.137" port="4001"/>-->
<abuf>120</abuf>
<channel designation="a" name="a-channel" r0="1000" transformationType="hyperbolic" coefs="[1.0,1.0]"
color="black"/>
<channel designation="b" name="b-channel" r0="1000" transformationType="hyperbolic" coefs="[1.1,1.1]"/>

View File

@ -68,10 +68,15 @@ public class NumassControlUtils {
}
public static Optional<Meta> getConfig(Application app) {
String debugConfig = app.getParameters().getNamed().get("config.resource");
if (debugConfig != null) {
return Optional.ofNullable(readResourceMeta(debugConfig));
}
String configFileName = app.getParameters().getNamed().get("config");
Logger logger = LoggerFactory.getLogger(app.getClass());
if (configFileName == null) {
logger.info("Configuration path not defined. Loading configuration from {}",DEFAULT_CONFIG_LOCATION);
logger.info("Configuration path not defined. Loading configuration from {}", DEFAULT_CONFIG_LOCATION);
configFileName = DEFAULT_CONFIG_LOCATION;
}
File configFile = new File(configFileName);
@ -100,7 +105,7 @@ public class NumassControlUtils {
return ctx;
}
public static void setDFStageIcon(Stage stage){
public static void setDFStageIcon(Stage stage) {
stage.getIcons().add(new Image(NumassControlUtils.class.getResourceAsStream("/img/df.png")));
}