diff --git a/numass-client/build.gradle b/numass-client/build.gradle deleted file mode 100644 index 205b4ab5..00000000 --- a/numass-client/build.gradle +++ /dev/null @@ -1,14 +0,0 @@ -apply plugin: 'application' - -if (!hasProperty('mainClass')) { - ext.mainClass = 'inr.numass.client.Cli' -} - -mainClassName = mainClass - -dependencies { - compile project(':numass-core') - compile 'commons-cli:commons-cli:1.4' - compile "hep.dataforge:dataforge-messages" - compile 'org.zeroturnaround:zt-zip:1.13' -} \ No newline at end of file diff --git a/numass-client/src/main/java/inr/numass/client/Cli.java b/numass-client/src/main/java/inr/numass/client/Cli.java deleted file mode 100644 index 12a46ead..00000000 --- a/numass-client/src/main/java/inr/numass/client/Cli.java +++ /dev/null @@ -1,142 +0,0 @@ -/* - * To change this license header, choose License Headers in Project Properties. - * To change this template file, choose Tools | Templates - * and open the template in the editor. - */ -package inr.numass.client; - -import hep.dataforge.meta.Meta; -import hep.dataforge.storage.commons.StorageManager; -import hep.dataforge.values.Value; -import org.apache.commons.cli.*; -import org.slf4j.LoggerFactory; - -import java.io.BufferedReader; -import java.io.IOException; -import java.io.InputStreamReader; -import java.util.Map; - -/** - * CLI interface for numass client - * @author Alexander Nozik - */ -public class Cli { - - public static void main(String[] args) { - new StorageManager().startGlobal(); - - Options options = buildOptions(); - - CommandLineParser parser = new DefaultParser(); - - CommandLine cli; - try { - cli = parser.parse(options, args, false); - } catch (ParseException ex) { - System.out.println("Error: command line"); - LoggerFactory.getLogger("NumassClient").error("Error while parsing command line", ex); - System.exit(1); - return; - } - - runComand(cli.getOptionValue("a", "192.168.11.1"), Integer.valueOf(cli.getOptionValue("p", "8335")), cli.getArgs()); - - } - - public static void runComand(String ip, int port, String... args) { - checkArgLength(1, args); - try (NumassClient client = new NumassClient(ip, port)) { - switch (args[0]) { - case "getRun": - Meta getRun = client.getCurrentRun(); - if (getRun.getBoolean("success", true)) { - System.out.println(getRun.getString("run.path")); - } else { - System.out.println("Error: operaton failed"); - } - return; - case "setRun": - checkArgLength(2, args); - Meta setRun = client.startRun(args[1]); - if (setRun.getBoolean("success", true)) { - System.out.println(setRun.getString("run.path")); - } else { - System.out.println("Error: operaton failed"); - } - return; - case "getState": - checkArgLength(2, args); - String stateName = args[1]; - Map states = client.getStates(stateName); - if (states != null) { - System.out.println(states.get(stateName).getString()); - } else { - System.out.println("Error: operaton failed"); - } - return; - case "setState": - checkArgLength(3, args); - String setStateName = args[1]; - String setStateValue = args[2]; - Meta setStateMeta = client.setState(setStateName, setStateValue); - if (setStateMeta.getBoolean("success", true)) { - System.out.println("OK"); - } else { - System.out.println("Error: operaton failed"); - } - return; - case "pushPoint": - checkArgLength(2, args); - String path; - String fileName; - if (args.length == 2) { - path = ""; - fileName = args[1]; - } else { - path = args[1]; - fileName = args[2]; - } - - Meta pushPoint = client.sendNumassData(path, fileName); -// LoggerFactory.getLogger("Numass-client").debug(pushPoint.toString()); - if (pushPoint.getBoolean("success", true)) { - System.out.println("OK"); - } else { - System.out.println("Error: operaton failed"); - } - return; - case "addNote": -// checkArgLength(2, args); -// String note = args[1]; - String note = new BufferedReader(new InputStreamReader(System.in)).readLine(); - Meta addNote = client.addNote(note, null); - if (addNote.getBoolean("success", true)) { - System.out.println("OK"); - } else { - System.out.println("Error: operaton failed"); - } - } - - } catch (IOException ex) { - System.out.println("Error: connection failed"); - LoggerFactory.getLogger("NumassClient").error("Error while initializing connection", ex); - System.exit(1); - } - } - - private static void checkArgLength(int length, String... args) { - if (args.length < length) { - LoggerFactory.getLogger("NumassClient").error("Command line to short"); - System.exit(1); - } - } - - private static Options buildOptions() { - Options options = new Options(); - - options.addOption("a", "ip", true, "IP address of the server. Default: 192.168.111.1"); - options.addOption("p", "port", true, "Server port. Default: 8335"); - - return options; - } -} diff --git a/numass-client/src/main/java/inr/numass/client/ClientUtils.java b/numass-client/src/main/java/inr/numass/client/ClientUtils.java deleted file mode 100644 index 39b24566..00000000 --- a/numass-client/src/main/java/inr/numass/client/ClientUtils.java +++ /dev/null @@ -1,24 +0,0 @@ -package inr.numass.client; - -import hep.dataforge.meta.Meta; - -import java.io.IOException; - -/** - * Created by darksnake on 09-Oct-16. - */ -public class ClientUtils { - public static String getRunName(Meta config) { - if (config.hasValue("numass.run")) { - return config.getString("numass.run"); - } else if (config.hasMeta("numass.server")) { - try { - return new NumassClient(config.getMeta("numass.server")).getCurrentRun().getString("path"); - } catch (IOException e) { - return ""; - } - } else { - return ""; - } - } -} diff --git a/numass-client/src/main/java/inr/numass/client/NumassClient.java b/numass-client/src/main/java/inr/numass/client/NumassClient.java deleted file mode 100644 index 7811f48a..00000000 --- a/numass-client/src/main/java/inr/numass/client/NumassClient.java +++ /dev/null @@ -1,258 +0,0 @@ -/* - * Copyright 2015 Alexander Nozik. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package inr.numass.client; - -import hep.dataforge.io.envelopes.DefaultEnvelopeReader; -import hep.dataforge.io.envelopes.DefaultEnvelopeType; -import hep.dataforge.io.envelopes.Envelope; -import hep.dataforge.io.envelopes.EnvelopeBuilder; -import hep.dataforge.messages.Responder; -import hep.dataforge.meta.Meta; -import hep.dataforge.meta.MetaBuilder; -import hep.dataforge.values.Value; -import hep.dataforge.values.Values; -import inr.numass.data.storage.NumassStorage; -import org.jetbrains.annotations.NotNull; -import org.slf4j.LoggerFactory; -import org.zeroturnaround.zip.ZipUtil; - -import java.io.*; -import java.net.Socket; -import java.nio.ByteBuffer; -import java.nio.channels.FileChannel; -import java.nio.file.StandardOpenOption; -import java.time.Instant; -import java.util.Arrays; -import java.util.Collection; -import java.util.HashMap; -import java.util.Map; - -import static hep.dataforge.messages.MessagesKt.*; - -/** - * @author darksnake - */ -public class NumassClient implements AutoCloseable, Responder { - - Socket socket; - - public NumassClient(String address, int port) throws IOException { - socket = new Socket(address, port); - socket.setSoTimeout(300); - } - - - public NumassClient(Meta meta) throws IOException { - this(meta.getString("ip", "192.168.111.1"), meta.getInt("port", 8335)); - } - - @Override - public void close() throws IOException { - if (!socket.isClosed()) { - write(getTerminator(), socket.getOutputStream()); - } - socket.close(); - } - - @NotNull - @Override - public Envelope respond(@NotNull Envelope message) { - try { - write(message, socket.getOutputStream()); - return read(socket.getInputStream()); - } catch (IOException ex) { - LoggerFactory.getLogger(getClass()).error("Error in envelope exchange", ex); - return errorResponseBase(message, ex).build(); - } - } - - private Envelope read(InputStream is) throws IOException { - return new DefaultEnvelopeReader().readWithData(is); - } - - private void write(Envelope envelope, OutputStream os) throws IOException { - DefaultEnvelopeType.Companion.getINSTANCE().getWriter().write(os, envelope); - os.flush(); - } - - private EnvelopeBuilder requestActionBase(String type, String action) { - return requestBase(type).setMetaValue("action", action); - } - - public Meta getCurrentRun() { - return respond(requestActionBase("numass.run", "get").build()).getMeta(); - } - - public Meta startRun(String name) { - return respond(requestActionBase("numass.run", "start") - .setMetaValue("path", name) - .build()).getMeta(); - } - - public Meta resetRun() { - return respond(requestActionBase("numass.run", "reset") - .build()).getMeta(); - } - - public Meta sendNumassData(String path, String fileName) { - try { - File file = new File(fileName); - ByteBuffer buffer; - String zipName = null; - if (file.isDirectory()) { - File tmpFile = File.createTempFile(file.getName(), NumassStorage.NUMASS_ZIP_EXTENSION); - tmpFile.deleteOnExit(); - ZipUtil.pack(file, tmpFile); - zipName = file.getName(); - file = tmpFile; - } - - if (file.toString().endsWith(NumassStorage.NUMASS_ZIP_EXTENSION)) { - FileChannel channel = FileChannel.open(file.toPath(), StandardOpenOption.READ); - buffer = ByteBuffer.allocate((int) channel.size()); - channel.read(buffer); - if (zipName == null) { - zipName = file.getName().replace(NumassStorage.NUMASS_ZIP_EXTENSION, ""); - } - } else { - return getErrorMeta(new FileNotFoundException(fileName)); - } - - Envelope bin = requestBase("numass.data") - .setMetaValue("action", "push") - .setMetaValue("path", path) - .setMetaValue("name", zipName) - .data(buffer) - .build(); - - return respond(bin).getMeta(); - } catch (IOException ex) { - return getErrorMeta(ex); - } - } - - /** - * Get state map for given state names from the root state loader. If - * stateNames is empty, return all states. - * - * @param stateNames - * @return - */ - public Map getStates(String... stateNames) { - EnvelopeBuilder env = requestActionBase("numass.state", "get"); - - if (stateNames.length > 0) { - env.setMetaValue("name", Arrays.asList(stateNames)); - } - - Meta response = respond(env.build()).getMeta(); - if (response.getBoolean("success", true)) { - Map res = new HashMap<>(); - response.getMetaList("state").forEach((stateMeta) -> { - res.put(stateMeta.getString("name"), stateMeta.getValue("value")); - }); - return res; - } else { - return null; - } - } - - /** - * Set a single state and return resulting envelope meta - * - * @param name - * @param value - * @return - */ - public Meta setState(String name, Object value) { - EnvelopeBuilder env = requestActionBase("numass.state", "set"); - env.putMetaNode(new MetaBuilder("state") - .setValue("name", name) - .setValue("value", value) - .build()); - - return respond(env.build()).getMeta(); - } - - /** - * Set states and return resulting meta - * - * @param stateMap - * @return - */ - public Meta setState(Map stateMap) { - EnvelopeBuilder env = requestActionBase("numass.state", "set"); - stateMap.entrySet().forEach((state) -> { - env.putMetaNode(new MetaBuilder("state") - .setValue("name", state.getKey()) - .setValue("value", state.getValue()) - .build()); - }); - return respond(env.build()).getMeta(); - } - - public Meta addNote(String text, Instant time) { - EnvelopeBuilder env = requestActionBase("numass.notes", "push"); - env.setMetaValue("note.text", text); - if (time != null) { - env.setMetaValue("note.time", time); - } - return respond(env.build()).getMeta(); - } - - public Meta getNotes(int limit) { - EnvelopeBuilder env = requestActionBase("numass.notes", "pull"); - if (limit > 0) { - env.setMetaValue("limit", limit); - } - return respond(env.build()).getMeta(); - } - - /** - * Create remote storage with given meta - * - * @param path full path relative to root storage - * @param meta - * @return - */ - public Envelope createStorage(String path, Meta meta) { - throw new UnsupportedOperationException(); - } - - /** - * Create remote loader - * - * @param shelf full path to the shelf - * @param name the name of the loader - * @param meta loader meta - * @return - */ - public Envelope createLoader(String shelf, String name, Meta meta) { - throw new UnsupportedOperationException(); - } - - /** - * Send points to existing point loader - * - * @param shelf - * @param loaderName - * @param points - * @return - */ - public Envelope sendDataPoints(String shelf, String loaderName, Collection points) { - throw new UnsupportedOperationException(); - } -} diff --git a/numass-control/build.gradle b/numass-control/build.gradle index e6472c60..cbf2f947 100644 --- a/numass-control/build.gradle +++ b/numass-control/build.gradle @@ -16,10 +16,13 @@ allprojects { } dependencies { - compile project(':numass-client') compile "hep.dataforge:plots-jfc" // project(':dataforge-plots:plots-jfc') compile "hep.dataforge:dataforge-control" //project(':dataforge-control') compile "hep.dataforge:dataforge-gui" + + // https://mvnrepository.com/artifact/commons-cli/commons-cli + compile group: 'commons-cli', name: 'commons-cli', version: '1.4' + } task installAll(type: Copy) { diff --git a/numass-control/control-room/build.gradle b/numass-control/control-room/build.gradle index 31954a8d..24a8919b 100644 --- a/numass-control/control-room/build.gradle +++ b/numass-control/control-room/build.gradle @@ -23,7 +23,7 @@ configurations { dependencies { //DataForge dependencies compile project(':numass-control') - compile project(':numass-server') + //compile project(':numass-server') // optional device classpath devices project(':numass-control:cryotemp') diff --git a/numass-control/dante/build.gradle b/numass-control/dante/build.gradle index 4d901304..5289c705 100644 --- a/numass-control/dante/build.gradle +++ b/numass-control/dante/build.gradle @@ -18,4 +18,5 @@ version = "0.1.0" dependencies { compile project(':numass-control') + compile project(':numass-core') } \ No newline at end of file diff --git a/numass-control/msp/src/main/kotlin/inr/numass/control/msp/MspDisplay.kt b/numass-control/msp/src/main/kotlin/inr/numass/control/msp/MspDisplay.kt index ba92fc2a..626aa8a6 100644 --- a/numass-control/msp/src/main/kotlin/inr/numass/control/msp/MspDisplay.kt +++ b/numass-control/msp/src/main/kotlin/inr/numass/control/msp/MspDisplay.kt @@ -86,7 +86,7 @@ class MspDisplay() : DeviceDisplayFX(), NamedValueListener { .setValue("xAxis.type", "time") - JFreeChartFrame(basePlotConfig).apply { + JFreeChartFrame().apply { configure(basePlotConfig) }.apply { PlotUtils.setXAxis(this, "timestamp", "", "time") configure(plotFrameMeta) } diff --git a/numass-control/src/main/kotlin/inr/numass/control/NumassControlUtils.kt b/numass-control/src/main/kotlin/inr/numass/control/NumassControlUtils.kt index 7b2d59d6..bf0b89e5 100644 --- a/numass-control/src/main/kotlin/inr/numass/control/NumassControlUtils.kt +++ b/numass-control/src/main/kotlin/inr/numass/control/NumassControlUtils.kt @@ -12,13 +12,13 @@ import hep.dataforge.meta.Meta import hep.dataforge.nullable import hep.dataforge.storage.commons.StorageConnection import hep.dataforge.storage.commons.StorageManager -import inr.numass.client.ClientUtils import javafx.application.Application import javafx.stage.Stage import org.slf4j.LoggerFactory import java.nio.file.Files import java.nio.file.Paths + /** * Created by darksnake on 08-May-17. */ @@ -26,9 +26,19 @@ const val DEFAULT_CONFIG_LOCATION = "./numass-control.xml" //val STORING_STATE = "storing" //val dfIcon: Image = Image(Global::class.java.getResourceAsStream("/img/df.png")) +fun getRunName(config: Meta): String { + return if (config.hasValue("numass.run")) { + config.getString("numass.run") + } else if (config.hasMeta("numass.server")) { + TODO("Not implemented") + + } else { + "" + } +} + /** * Create a single or multiple storage connections for a device - * @param device * * * @param config @@ -36,7 +46,7 @@ const val DEFAULT_CONFIG_LOCATION = "./numass-control.xml" fun connectStorage(device: Device, config: Meta) { //TODO add on reset listener if (config.hasMeta("storage") && device.acceptsRole(Roles.STORAGE_ROLE)) { - val numassRun = ClientUtils.getRunName(config) + val numassRun = getRunName(config) config.getMetaList("storage").forEach { node -> device.context.logger.info("Creating storage for device with getMeta: {}", node) //building storage in a separate thread diff --git a/numass-main/src/main/kotlin/inr/numass/scripts/timeanalysis/AnalyzePoint.kt b/numass-main/src/main/kotlin/inr/numass/scripts/timeanalysis/AnalyzePoint.kt index 9a3b9276..e2516f55 100644 --- a/numass-main/src/main/kotlin/inr/numass/scripts/timeanalysis/AnalyzePoint.kt +++ b/numass-main/src/main/kotlin/inr/numass/scripts/timeanalysis/AnalyzePoint.kt @@ -8,6 +8,7 @@ import hep.dataforge.plots.jfreechart.JFreeChartPlugin import inr.numass.NumassPlugin import inr.numass.actions.TimeAnalyzerAction import inr.numass.data.NumassDataUtils +import inr.numass.data.analyzers.TimeAnalyzer import inr.numass.data.api.NumassPoint import inr.numass.data.api.NumassSet import inr.numass.data.api.SimpleNumassPoint @@ -18,8 +19,8 @@ fun main(args: Array) { val context = buildContext("NUMASS", NumassPlugin::class.java, JFreeChartPlugin::class.java) { output = FXOutputManager() - rootDir = "D:\\Work\\Numass\\sterile2017_11" - dataDir = "D:\\Work\\Numass\\data\\2017_11" + rootDir = "D:\\Work\\Numass\\sterile2017_05" + dataDir = "D:\\Work\\Numass\\data\\2017_05" } val storage = NumassDirectory.read(context, "Fill_2")!! @@ -27,19 +28,19 @@ fun main(args: Array) { val meta = buildMeta { "t0" to 3000 "binNum" to 200 - "t0Step" to 600 - //"chunkSize" to 3000 - //"mean" to TimeAnalyzer.AveragingMethod.ARITHMETIC + "t0Step" to 100 + "chunkSize" to 3000 + "mean" to TimeAnalyzer.AveragingMethod.ARITHMETIC //"separateParallelBlocks" to true "window" to { - "lo" to 400 + "lo" to 0 "up" to 4000 } //"plot.showErrors" to false } //def sets = ((2..14) + (22..31)).collect { "set_$it" } - val sets = (22..22).map { "set_$it" } + val sets = (2..12).map { "set_$it" } //def sets = (16..31).collect { "set_$it" } //def sets = (20..28).collect { "set_$it" } @@ -49,7 +50,7 @@ fun main(args: Array) { val all = NumassDataUtils.join("sum", loaders) - val hvs = listOf(14000.0, 15000.0)//, 15000d, 15200d, 15400d, 15600d, 15800d] + val hvs = listOf(14500.0)//, 15000d, 15200d, 15400d, 15600d, 15800d] //listOf(18500.0, 18600.0, 18995.0, 19000.0) val data = DataSet.edit(NumassPoint::class).apply { diff --git a/numass-test/build.gradle b/numass-test/build.gradle deleted file mode 100644 index fa112b25..00000000 --- a/numass-test/build.gradle +++ /dev/null @@ -1,32 +0,0 @@ -apply plugin: 'groovy' - -description = "Test module for numass client and server" - - -task runServer(type: JavaExec) { - description 'Start numass server locally' - - // Set main property to name of Groovy script class. - main = 'inr.numass.scripts.TestServer' - - // Set classpath for running the Groovy script. - classpath = sourceSets.main.runtimeClasspath - standardInput = System.in -} - -task runClient(type: JavaExec) { - description 'Start numass client locally' - - // Set main property to name of Groovy script class. - main = 'inr.numass.scripts.TestClient' - - // Set classpath for running the Groovy script. - classpath = sourceSets.main.runtimeClasspath - standardInput = System.in -} - -dependencies { - compile project(':numass-client') - compile project(':numass-server') - compile "hep.dataforge:grind" //project(':dataforge-grind') -} diff --git a/numass-test/src/main/groovy/inr/numass/scripts/FixStampEndings.groovy b/numass-test/src/main/groovy/inr/numass/scripts/FixStampEndings.groovy deleted file mode 100644 index 3171aa79..00000000 --- a/numass-test/src/main/groovy/inr/numass/scripts/FixStampEndings.groovy +++ /dev/null @@ -1,27 +0,0 @@ -/* - * Copyright 2015 Alexander Nozik. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -import static groovy.io.FileType.FILES - -def fixStampEndings(File directory){ - directory.eachFileRecurse(FILES){ - byte[] bytes = it.bytes - bytes[26] = '!' - bytes[27] = '#' - it.bytes = bytes - } -} - -fixStampEndings(new File("C:\\Users\\darksnake\\Dropbox\\PlayGround\\data-test\\")) \ No newline at end of file diff --git a/numass-test/src/main/groovy/inr/numass/scripts/StartRun.groovy b/numass-test/src/main/groovy/inr/numass/scripts/StartRun.groovy deleted file mode 100644 index 713bcddc..00000000 --- a/numass-test/src/main/groovy/inr/numass/scripts/StartRun.groovy +++ /dev/null @@ -1,12 +0,0 @@ -/* - * To change this license header, choose License Headers in Project Properties. - * To change this template file, choose Tools | Templates - * and open the template in the editor. - */ - -package inr.numass.scripts - -import inr.numass.client.NumassClient - -NumassClient client = new NumassClient("192.168.111.1", 8335); -print client.startRun("2016_04") \ No newline at end of file diff --git a/numass-test/src/main/groovy/inr/numass/scripts/TestClient.groovy b/numass-test/src/main/groovy/inr/numass/scripts/TestClient.groovy deleted file mode 100644 index f867fd6e..00000000 --- a/numass-test/src/main/groovy/inr/numass/scripts/TestClient.groovy +++ /dev/null @@ -1,36 +0,0 @@ -/* - * Copyright 2015 Alexander Nozik. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package inr.numass.scripts - -import hep.dataforge.storage.commons.StorageManager - -new StorageManager().startGlobal(); - - -println "Starting Numass test client..." - -String line = ""; - -BufferedReader br = new BufferedReader(new InputStreamReader(System.in)) -while(line == null || !line.startsWith("exit")){ - // print ">" - line = br.readLine(); - if(line!= null && !line.startsWith("exit")){ - Cli.runComand("127.0.0.1", 8335, line.split(" ")); - } -} - - diff --git a/numass-test/src/main/groovy/inr/numass/scripts/TestFileTransfer.groovy b/numass-test/src/main/groovy/inr/numass/scripts/TestFileTransfer.groovy deleted file mode 100644 index a3a51f1f..00000000 --- a/numass-test/src/main/groovy/inr/numass/scripts/TestFileTransfer.groovy +++ /dev/null @@ -1,36 +0,0 @@ -/* - * To change this license header, choose License Headers in Project Properties. - * To change this template file, choose Tools | Templates - * and open the template in the editor. - */ - -package inr.numass.scripts - -import hep.dataforge.io.JSONMetaWriter -import hep.dataforge.io.MetaStreamWriter -import hep.dataforge.meta.Meta -import hep.dataforge.storage.commons.StorageManager -import inr.numass.client.NumassClient - -new StorageManager().startGlobal(); - -new NumassClient("127.0.0.1",8335).withCloseable{ - - MetaStreamWriter writer = JSONMetaWriter.INSTANCE - - Meta startRun = it.startRun("test") - - println writer.writeString(startRun); - - Meta run = it.getCurrentRun(); - println writer.writeString(run); - - Meta response = it.sendNumassData("C:\\Users\\darksnake\\Dropbox\\PlayGround\\data-test\\zip\\20150703143643_1.nm.zip"); - - println writer.writeString(response); - - response = it.sendNumassData("C:\\Users\\darksnake\\Dropbox\\PlayGround\\data-test\\20150703144707_2"); - - println writer.writeString(response); -} - \ No newline at end of file diff --git a/numass-test/src/main/groovy/inr/numass/scripts/TestNotes.groovy b/numass-test/src/main/groovy/inr/numass/scripts/TestNotes.groovy deleted file mode 100644 index 5d436346..00000000 --- a/numass-test/src/main/groovy/inr/numass/scripts/TestNotes.groovy +++ /dev/null @@ -1,14 +0,0 @@ -/* - * To change this license header, choose License Headers in Project Properties. - * To change this template file, choose Tools | Templates - * and open the template in the editor. - */ - -package inr.numass.scripts - -import hep.dataforge.storage.commons.StorageManager -import inr.numass.client.NumassClient - -new StorageManager().startGlobal(); - -NumassClient.runComand("127.0.0.1", 8336, "addNote", "This is my note with html"); diff --git a/numass-test/src/main/groovy/inr/numass/scripts/TestRemoteClient.groovy b/numass-test/src/main/groovy/inr/numass/scripts/TestRemoteClient.groovy deleted file mode 100644 index 85301b99..00000000 --- a/numass-test/src/main/groovy/inr/numass/scripts/TestRemoteClient.groovy +++ /dev/null @@ -1,37 +0,0 @@ -/* - * Copyright 2015 Alexander Nozik. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package inr.numass.scripts - -import hep.dataforge.storage.commons.StorageManager -import inr.numass.client.NumassClient - -new StorageManager().startGlobal(); - - -println "Starting Numass test client..." - -String line = ""; - -BufferedReader br = new BufferedReader(new InputStreamReader(System.in)) -while(line == null || !line.startsWith("exit")){ - // print ">" - line = br.readLine(); - if(!line.startsWith("exit")){ - NumassClient.runComand("192.168.111.1", 8335, line.split(" ")); - } -} - - diff --git a/numass-test/src/main/groovy/inr/numass/scripts/TestServer.groovy b/numass-test/src/main/groovy/inr/numass/scripts/TestServer.groovy deleted file mode 100644 index ad3aff88..00000000 --- a/numass-test/src/main/groovy/inr/numass/scripts/TestServer.groovy +++ /dev/null @@ -1,44 +0,0 @@ -/* - * Copyright 2015 Alexander Nozik. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package inr.numass.scripts - -import hep.dataforge.meta.Meta -import inr.numass.data.storage.NumassStorage -import inr.numass.server.NumassServer - -String path = "D:\\Work\\Numass\\data\\2016_10\\" - -//FileObject file = VFSUtils.getLocalFile(new File(path)) - -NumassStorage storage = NumassStorage.buildLocalNumassRoot(new File(path), true, true); - -println "Starting test numass listener in " + path - -NumassServer listener = new NumassServer(storage, Meta.empty()); - -listener.open() - -String stopLine = ""; - -BufferedReader br = new BufferedReader(new InputStreamReader(System.in)) -while (stopLine == null || !stopLine.startsWith("exit")) { -// print ">" - stopLine = br.readLine(); -} - -listener.close() - -println "Stopping test numass listener" diff --git a/numass-test/src/main/groovy/inr/numass/scripts/TestStateChange.groovy b/numass-test/src/main/groovy/inr/numass/scripts/TestStateChange.groovy deleted file mode 100644 index 109e5039..00000000 --- a/numass-test/src/main/groovy/inr/numass/scripts/TestStateChange.groovy +++ /dev/null @@ -1,32 +0,0 @@ -/* - * To change this license header, choose License Headers in Project Properties. - * To change this template file, choose Tools | Templates - * and open the template in the editor. - */ - -package inr.numass.scripts - -import hep.dataforge.io.JSONMetaWriter -import hep.dataforge.io.MetaStreamWriter -import hep.dataforge.meta.Meta -import hep.dataforge.storage.commons.StorageManager -import inr.numass.client.NumassClient - -new StorageManager().startGlobal(); - -new NumassClient("127.0.0.1",8335).withCloseable{ - - MetaStreamWriter writer = JSONMetaWriter.INSTANCE - - Meta startRun = it.startRun("test") - - println writer.writeString(startRun); - - Meta set1 = it.setState("myState", 112); - - println writer.writeString(set1); - - Meta set2 = it.setState("otherState.property", ["a", "b", "c"]) - - println it.getStates() -} diff --git a/numass-test/src/main/groovy/inr/numass/scripts/TestStorageAccess.groovy b/numass-test/src/main/groovy/inr/numass/scripts/TestStorageAccess.groovy deleted file mode 100644 index ed0b09ce..00000000 --- a/numass-test/src/main/groovy/inr/numass/scripts/TestStorageAccess.groovy +++ /dev/null @@ -1,56 +0,0 @@ -/* - * To change this license header, choose License Headers in Project Properties. - * To change this template file, choose Tools | Templates - * and open the template in the editor. - */ - -package inr.numass.scripts - -import hep.dataforge.io.JSONMetaWriter -import hep.dataforge.io.MetaStreamWriter -import hep.dataforge.io.envelopes.Envelope -import hep.dataforge.meta.Meta -import hep.dataforge.meta.MetaBuilder -import hep.dataforge.storage.commons.LoaderFactory -import hep.dataforge.storage.commons.StorageManager -import hep.dataforge.values.ValueMap -import inr.numass.client.NumassClient - -new StorageManager().startGlobal(); - -new NumassClient("127.0.0.1",8335).withCloseable{ - - MetaStreamWriter writer = JSONMetaWriter.INSTANCE - - Meta startRun = it.startRun("test") - - println writer.writeString(startRun); - - - MetaBuilder target = new MetaBuilder("target") - .setValue("type","loader") - .setValue("name", "testPointLoader") - .putNode(LoaderFactory.buildTableLoaderMeta("testPointLoader","a", DataFormat.forNames("a", "b", "c")).rename("meta")) - - MetaBuilder data = new MetaBuilder("data"); - - String[] names = ["a","b","c"] - - - for(int i = 0; i<5; i++){ - data.putNode(DataPoint.write(new ValueMap(names,i, 2*i,3*i))); - } - - - Envelope bin = it.requestBase("numass.storage") - .putMetaValue("action","push") - .putMetaNode(target) - .putMetaNode(data) - .build(); - - - def response = it.respond(bin); - - println writer.writeString(response.getMeta()); - -} \ No newline at end of file diff --git a/settings.gradle b/settings.gradle index 1d5c50b2..6f1c182a 100644 --- a/settings.gradle +++ b/settings.gradle @@ -5,17 +5,13 @@ include ":numass-control:cryotemp" include ":numass-control:magnet" include ":numass-control:msp" include ":numass-control:vac" -include ":numass-control:control-room" +//include ":numass-control:control-room" include ":numass-control:dante" // include ":numass-main" // include ":numass-core" -include ":numass-client" -include ":numass-server" -include ":numass-server" -//include ":numass-web" -include ":numass-test" +//include ":numass-server" // include ":numass-viewer"