diff --git a/numass-control/cryotemp/src/main/java/inr/numass/cryotemp/PKT8MainViewController.java b/numass-control/cryotemp/src/main/java/inr/numass/cryotemp/PKT8MainViewController.java index 360ee258..8f24f3e9 100644 --- a/numass-control/cryotemp/src/main/java/inr/numass/cryotemp/PKT8MainViewController.java +++ b/numass-control/cryotemp/src/main/java/inr/numass/cryotemp/PKT8MainViewController.java @@ -47,6 +47,7 @@ import java.io.IOException; import java.net.URISyntaxException; import java.net.URL; import java.text.ParseException; +import java.time.Duration; import java.time.Instant; import java.util.Collection; import java.util.ResourceBundle; @@ -156,6 +157,8 @@ public class PKT8MainViewController implements Initializable, DeviceListener, Me */ private synchronized void setupPlotFrame(Meta plotFrameMeta) { plottables = new TimePlottableGroup(); + plottables.setMaxItems(plotFrameMeta.getInt("maxItems",3000)); + plottables.setMaxAge(Duration.parse(plotFrameMeta.getString("maxAge","PT2H"))); plotArea.getChildren().clear(); plotFrame = new JFreeChartFrame(plotFrameMeta); PlotUtils.setXAxis(plotFrame, "timestamp", null, "time"); diff --git a/numass-control/cryotemp/src/main/resources/config/thermo-1.xml b/numass-control/cryotemp/src/main/resources/config/thermo-1.xml index 2141e114..f66e256d 100644 --- a/numass-control/cryotemp/src/main/resources/config/thermo-1.xml +++ b/numass-control/cryotemp/src/main/resources/config/thermo-1.xml @@ -25,7 +25,7 @@ coefs="[23.894, -358.42, 2355.2, -7509.8, 12893.0, -10454.0, 3403.9]"/> - + \ No newline at end of file diff --git a/numass-storage/numass-server/src/main/groovy/inr/numass/scripts/TestServer.groovy b/numass-storage/numass-server/src/main/groovy/inr/numass/scripts/TestServer.groovy index 19865fc9..667a7e63 100644 --- a/numass-storage/numass-server/src/main/groovy/inr/numass/scripts/TestServer.groovy +++ b/numass-storage/numass-server/src/main/groovy/inr/numass/scripts/TestServer.groovy @@ -15,12 +15,16 @@ */ package inr.numass.scripts -import hep.dataforge.storage.filestorage.FileStorage +import hep.dataforge.storage.filestorage.VFSUtils import inr.numass.server.NumassServer +import inr.numass.storage.NumassStorage +import org.apache.commons.vfs2.FileObject String path = "D:\\temp\\test\\numass-server\\" -FileStorage storage = FileStorage.in(new File(path), null); +FileObject file = VFSUtils.getLocalFile(new File(path)) + +NumassStorage storage = new NumassStorage(file,null) println "Starting test numass listener in "+path diff --git a/numass-storage/numass-server/src/main/java/inr/numass/server/NumassServer.java b/numass-storage/numass-server/src/main/java/inr/numass/server/NumassServer.java index 121494e9..0af79bdd 100644 --- a/numass-storage/numass-server/src/main/java/inr/numass/server/NumassServer.java +++ b/numass-storage/numass-server/src/main/java/inr/numass/server/NumassServer.java @@ -25,17 +25,17 @@ import hep.dataforge.storage.commons.LoaderFactory; import hep.dataforge.storage.commons.StorageManager; import hep.dataforge.storage.filestorage.FileStorage; import inr.numass.storage.NumassStorage; -import java.io.File; -import java.io.IOException; -import java.net.InetAddress; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import ratpack.handling.Chain; -import ratpack.server.BaseDir; import ratpack.server.RatpackServer; import ratpack.server.RatpackServerSpec; import ratpack.server.ServerConfigBuilder; +import java.io.File; +import java.io.IOException; +import java.net.InetAddress; + /** * * @author darksnake @@ -83,7 +83,7 @@ public class NumassServer extends AbstractNetworkListener { int port = meta().getInt("ratpack.port", 8336); ratpack = RatpackServer.start((RatpackServerSpec server) -> server .serverConfig((ServerConfigBuilder config) -> config - .baseDir(BaseDir.find()) + .findBaseDir() .address(InetAddress.getLocalHost()) .port(port)) .handlers((Chain chain) -> chain diff --git a/numass-storage/numass-server/src/main/java/inr/numass/server/NumassStorageHandler.java b/numass-storage/numass-server/src/main/java/inr/numass/server/NumassStorageHandler.java index e9bd0770..f43816a9 100644 --- a/numass-storage/numass-server/src/main/java/inr/numass/server/NumassStorageHandler.java +++ b/numass-storage/numass-server/src/main/java/inr/numass/server/NumassStorageHandler.java @@ -7,28 +7,25 @@ package inr.numass.server; import freemarker.template.Template; import hep.dataforge.exceptions.StorageException; +import hep.dataforge.meta.MetaBuilder; import hep.dataforge.storage.api.ObjectLoader; import hep.dataforge.storage.api.PointLoader; import hep.dataforge.storage.api.Storage; import hep.dataforge.storage.servlet.StorageRatpackHandler; import hep.dataforge.storage.servlet.Utils; +import org.slf4j.LoggerFactory; +import ratpack.handling.Context; + import java.io.StringWriter; import java.time.ZoneId; import java.time.format.DateTimeFormatter; import java.time.format.FormatStyle; -import java.util.Comparator; -import java.util.HashMap; -import java.util.List; -import java.util.Locale; -import java.util.Map; +import java.util.*; import java.util.function.Function; import java.util.stream.Collectors; import java.util.stream.Stream; -import org.slf4j.LoggerFactory; -import ratpack.handling.Context; /** - * * @author Alexander Nozik */ public class NumassStorageHandler extends StorageRatpackHandler { @@ -69,20 +66,20 @@ public class NumassStorageHandler extends StorageRatpackHandler { } @Override - protected String pointLoaderPlotOptions(PointLoader loader) { + protected MetaBuilder pointLoaderPlotOptions(PointLoader loader) { + MetaBuilder builder = super.pointLoaderPlotOptions(loader); if (loader.getName().contains("msp") || loader.getName().contains("vac")) { - return " legend: { \n" - + " position: 'bottom' \n" - + " },\n" - + " title: '" + loader.getName() + "',\n" - + " vAxis:{\n" - + " logScale: true\n" - + " }"; - } else { - return super.pointLoaderPlotOptions(loader); + builder.putValue("legend.position", "bottom"); + builder.putValue("title", "\"" + loader.getName() + "\""); + builder.putNode(new MetaBuilder("vAxis") + .putValue("logScale", true) + .putValue("format", "scientific") + ); } + return builder; } + private String render(NumassNote note) { return String.format("%s %s", note.ref(), formatter.format(note.time()), note.content()); } @@ -94,7 +91,7 @@ public class NumassStorageHandler extends StorageRatpackHandler { */ @SuppressWarnings("unchecked") private Stream getNotes(ObjectLoader noteLoader) { - return noteLoader.fragmentNames().stream().map(new Function() { + return noteLoader.fragmentNames().stream().map(new Function() { @Override public NumassNote apply(String name) { try {