minor fixes

This commit is contained in:
Alexander Nozik 2016-10-13 22:49:01 +03:00
parent ed1ed6b2b6
commit f3ecec7dfc
10 changed files with 66 additions and 31 deletions

View File

@ -0,0 +1,10 @@
apply plugin: 'application'
description = "Joint measurement for vacuum, msp and temperature measurements"
dependencies{
compile project(':numass-control:cryotemp')
compile project(':numass-control:msp')
compile project(':numass-control:vac')
compile project(':numass-storage:numass-server')
}

View File

@ -0,0 +1,18 @@
package inr.numass.control.miranda;/**
* Created by darksnake on 13-Oct-16.
*/
import javafx.application.Application;
import javafx.stage.Stage;
public class MirandaApp extends Application {
public static void main(String[] args) {
launch(args);
}
@Override
public void start(Stage primaryStage) {
}
}

View File

@ -18,7 +18,7 @@ task runClient(type: JavaExec) {
}
dependencies {
compile(project(':numass-storage'))
compile project(':numass-storage')
compile 'commons-cli:commons-cli:1.3.1'
compile 'org.zeroturnaround:zt-zip:1.9'
}

View File

@ -17,6 +17,7 @@ import java.io.InputStreamReader;
import java.util.Map;
/**
* CLI interface for numass client
* @author Alexander Nozik
*/
public class Cli {

View File

@ -40,7 +40,7 @@ public class RemoteNumassStorage extends AbstractStorage {
@Override
public Loader buildLoader(Meta loaderConfiguration) throws StorageException {
return null;
throw new UnsupportedOperationException();
}
@Override

View File

@ -6,7 +6,6 @@
package inr.numass.server;
import freemarker.template.Template;
import hep.dataforge.exceptions.StorageException;
import hep.dataforge.storage.api.Loader;
import hep.dataforge.storage.api.StateLoader;
import hep.dataforge.storage.api.Storage;
@ -17,14 +16,13 @@ import ratpack.handling.Context;
import ratpack.handling.Handler;
import java.io.StringWriter;
import java.util.Comparator;
import java.util.HashMap;
import java.util.Map;
import static hep.dataforge.storage.servlet.StorageRenderer.renderStorage;
import static inr.numass.server.HandlerUtils.renderStates;
/**
*
* @author Alexander Nozik
*/
@SuppressWarnings("unchecked")
@ -66,7 +64,9 @@ public class NumassRootHandler implements Handler {
try {
StringBuilder b = new StringBuilder();
renderStorage(ctx, b, server.getRun().getStorage());
Storage rootStorage = server.getRun().getStorage();
rootStorage.refresh();
renderStorage(b, rootStorage);
data.put("storageContent", b.toString());
} catch (Exception ex) {
data.put("storageContent", ex.toString());
@ -86,24 +86,24 @@ public class NumassRootHandler implements Handler {
}
}
private void renderStorage(Context ctx, StringBuilder b, Storage storage){
try {
b.append("<div class=\"shifted\">\n");
storage.shelves().values().stream().sorted(Comparator.comparing(it -> it.getName())).forEach(shelf -> {
b.append(String.format("<p><strong>+ %s</strong></p>%n", shelf.getName()));
renderStorage(ctx, b, shelf);
});
b.append("<div class=\"shifted\">\n");
storage.loaders().values().stream().sorted(Comparator.comparing(it->it.getName())).forEach(loader -> renderLoader(ctx, b, loader));
b.append("</div>\n");
b.append("</div>\n");
}catch (StorageException ex){
throw new RuntimeException(ex);
}
}
// private void renderStorage(Context ctx, StringBuilder b, Storage storage){
// try {
// b.append("<div class=\"shifted\">\n");
// storage.shelves().values().stream().sorted(Comparator.comparing(it -> it.getName())).forEach(shelf -> {
// b.append(String.format("<p><strong>+ %s</strong></p>%n", shelf.getName()));
// renderStorage(ctx, b, shelf);
// });
//
// b.append("<div class=\"shifted\">\n");
//
// storage.loaders().values().stream().sorted(Comparator.comparing(it->it.getName())).forEach(loader -> renderLoader(ctx, b, loader));
//
// b.append("</div>\n");
// b.append("</div>\n");
// }catch (StorageException ex){
// throw new RuntimeException(ex);
// }
// }
private void renderLoader(Context ctx, StringBuilder b, Loader loader) {
String href = "/storage?path=" + loader.getPath();

View File

@ -71,7 +71,7 @@ public class NumassRun implements Annotated, Responder {
public NumassRun(String path, NumassStorage workStorage, MessageFactory factory) throws StorageException {
this.storage = workStorage;
this.states = LoaderFactory.buildStateLoder(storage, RUN_STATE, null);
this.noteLoader = LoaderFactory.buildObjectLoder(storage, RUN_NOTES, null);
this.noteLoader = (ObjectLoader<NumassNote>) LoaderFactory.buildObjectLoder(storage, RUN_NOTES, null);
this.factory = factory;
this.runPath = path;
logger = LoggerFactory.getLogger("CURRENT_RUN");

View File

@ -32,7 +32,6 @@ import ratpack.server.RatpackServer;
import ratpack.server.RatpackServerSpec;
import ratpack.server.ServerConfigBuilder;
import java.io.File;
import java.io.IOException;
import java.net.InetAddress;
@ -55,11 +54,11 @@ public class NumassServer extends AbstractNetworkListener {
init(storage);
}
public NumassServer(String rootPath, Meta rootConfig, Meta listnerConfig) throws StorageException {
super(listnerConfig);
logger.info("Initializing file storage in {}", rootPath);
init(FileStorage.in(new File(rootPath), rootConfig));
}
// public NumassServer(String rootPath, Meta rootConfig, Meta listnerConfig) throws StorageException {
// super(listnerConfig);
// logger.info("Initializing file storage in {}", rootPath);
// init(FileStorage.in(new File(rootPath), rootConfig));
// }
/**
* Init the root storage and state loader

View File

@ -85,6 +85,7 @@ public class NumassServerDaemon implements Daemon, Annotated {
}
logger.info("Initializing file storage in {}", repoPath);
root = FileStorage.in(new File(repoPath), repoConfig);
// root.toggleMonitor(true);
}
@Override

View File

@ -77,6 +77,12 @@ public class NumassStorageHandler extends StorageRatpackHandler {
.putValue("logScale", true)
.putValue("format", "scientific")
);
builder.putNode(new MetaBuilder("hAxis")
.putValue("title", "timestamp")
// .putValue("gridlines.count", -1)
// .putValues("gridlines.units.days.format", "MMM dd")
// .putValues("gridlines.units.hours.format", "HH:mm", "ha")
);
}
return builder;
}