From 52e488697f5e9c8ae2f9c0150e3e7612bac3cf07 Mon Sep 17 00:00:00 2001 From: Alexander Nozik Date: Mon, 22 May 2017 18:54:31 +0300 Subject: [PATCH] Server fix. Update still not working --- .../kotlin/inr/numass/control/ServerView.kt | 6 ++-- .../numass/server/NumassStorageHandler.java | 4 ++- .../server/NumassStorageServerObject.java | 30 +++++++++++++++++++ 3 files changed, 36 insertions(+), 4 deletions(-) create mode 100644 numass-server/src/main/java/inr/numass/server/NumassStorageServerObject.java diff --git a/numass-control/control-room/src/main/kotlin/inr/numass/control/ServerView.kt b/numass-control/control-room/src/main/kotlin/inr/numass/control/ServerView.kt index dc22b486..e2aa5a0d 100644 --- a/numass-control/control-room/src/main/kotlin/inr/numass/control/ServerView.kt +++ b/numass-control/control-room/src/main/kotlin/inr/numass/control/ServerView.kt @@ -4,9 +4,9 @@ import hep.dataforge.context.Context import hep.dataforge.exceptions.StorageException import hep.dataforge.meta.Meta import hep.dataforge.server.ServerManager -import hep.dataforge.server.storage.StorageServeUtils import hep.dataforge.storage.commons.StorageFactory import inr.numass.client.ClientUtils +import inr.numass.server.NumassStorageServerObject import javafx.beans.property.SimpleObjectProperty import javafx.event.EventHandler import javafx.scene.control.Hyperlink @@ -40,7 +40,7 @@ class ServerView() : View("Numass server controller") { } } } - label = hyperlink{ + label = hyperlink { action { hostServices.showDocument(serverManager.link); } @@ -78,7 +78,7 @@ class ServerView() : View("Numass server controller") { } } - StorageServeUtils.addStorage(serverManager,storage,"numass-storage") + serverManager.bind(NumassStorageServerObject(serverManager, storage, "numass-storage")); } } } diff --git a/numass-server/src/main/java/inr/numass/server/NumassStorageHandler.java b/numass-server/src/main/java/inr/numass/server/NumassStorageHandler.java index 5de247d4..da2622bc 100644 --- a/numass-server/src/main/java/inr/numass/server/NumassStorageHandler.java +++ b/numass-server/src/main/java/inr/numass/server/NumassStorageHandler.java @@ -75,7 +75,9 @@ public class NumassStorageHandler extends StorageRatpackHandler { @Override protected MetaBuilder pointLoaderPlotOptions(PointLoader loader) { MetaBuilder builder = super.pointLoaderPlotOptions(loader); - if (loader.getName().startsWith("msp") || loader.getName().startsWith("vac") || loader.getName().startsWith("cryotemp")) { + if (loader.getName().startsWith("msp") + || loader.getName().startsWith("vac") + || loader.getName().startsWith("cryotemp")) { builder.putValue("legend.position", "bottom"); builder.putValue("title", "\"" + loader.getName() + "\""); builder.putNode(new MetaBuilder("vAxis") diff --git a/numass-server/src/main/java/inr/numass/server/NumassStorageServerObject.java b/numass-server/src/main/java/inr/numass/server/NumassStorageServerObject.java new file mode 100644 index 00000000..ea288cf5 --- /dev/null +++ b/numass-server/src/main/java/inr/numass/server/NumassStorageServerObject.java @@ -0,0 +1,30 @@ +package inr.numass.server; + +import hep.dataforge.server.ServerManager; +import hep.dataforge.server.ServerObject; +import hep.dataforge.server.storage.StorageServerObject; +import hep.dataforge.storage.api.Storage; +import ratpack.handling.Handler; + +/** + * Created by darksnake on 22-May-17. + */ +public class NumassStorageServerObject extends StorageServerObject { + public NumassStorageServerObject(ServerManager manager, Storage storage, String path) { + super(manager, storage, path); + } + + public NumassStorageServerObject(ServerObject parent, Storage storage) { + super(parent, storage); + } + + @Override + protected Handler buildHandler(Storage storage) { + return new NumassStorageHandler(getManager(), storage); + } + + @Override + protected StorageServerObject buildChildStorageObject(Storage shelf) { + return new NumassStorageServerObject(this, shelf); + } +}