Storage servlet update

This commit is contained in:
Alexander Nozik 2017-05-02 16:57:03 +03:00
parent e8f8d2dcc1
commit 5eb59a9f98
3 changed files with 11 additions and 13 deletions

View File

@ -36,5 +36,3 @@ task runServer(dependsOn: classes, type: JavaExec){
standardInput = System.in standardInput = System.in
standardOutput = System.out standardOutput = System.out
} }
ratpack.baseDir = file('ratpack')

View File

@ -3,7 +3,7 @@ package inr.numass.server;
import hep.dataforge.io.MetaFileReader; import hep.dataforge.io.MetaFileReader;
import hep.dataforge.meta.Meta; import hep.dataforge.meta.Meta;
import hep.dataforge.meta.SimpleConfigurable; import hep.dataforge.meta.SimpleConfigurable;
import hep.dataforge.storage.filestorage.FileStorage; import inr.numass.storage.NumassStorage;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
@ -20,7 +20,7 @@ public class ServerRunner extends SimpleConfigurable implements AutoCloseable {
private static final String LISTENER_ELEMENT = "listener"; private static final String LISTENER_ELEMENT = "listener";
private static final String NUMASS_REPO_PATH_PROPERTY = "numass.repository.path"; private static final String NUMASS_REPO_PATH_PROPERTY = "numass.repository.path";
private final static Logger logger = LoggerFactory.getLogger("NUMASS-SERVER"); private final static Logger logger = LoggerFactory.getLogger("NUMASS-SERVER");
FileStorage root; NumassStorage root;
NumassServer listener; NumassServer listener;
public ServerRunner() throws IOException, ParseException { public ServerRunner() throws IOException, ParseException {
@ -52,12 +52,12 @@ public class ServerRunner extends SimpleConfigurable implements AutoCloseable {
public ServerRunner start() throws Exception { public ServerRunner start() throws Exception {
String repoPath = meta().getString(NUMASS_REPO_PATH_PROPERTY, "."); String repoPath = meta().getString(NUMASS_REPO_PATH_PROPERTY, ".");
Meta repoConfig = null; // Meta repoConfig = null;
if (meta().hasMeta(NUMASS_REPO_ELEMENT)) { // if (meta().hasMeta(NUMASS_REPO_ELEMENT)) {
repoConfig = meta().getMeta(NUMASS_REPO_ELEMENT); // repoConfig = meta().getMeta(NUMASS_REPO_ELEMENT);
} // }
logger.info("Initializing file storage in {}", repoPath); logger.info("Initializing file storage in {}", repoPath);
root = FileStorage.in(new File(repoPath), repoConfig); root = NumassStorage.buildLocalNumassRoot(new File(repoPath),true);//in(new File(repoPath), repoConfig);
logger.info("Starting numass server"); logger.info("Starting numass server");
if (root != null) { if (root != null) {
@ -88,7 +88,6 @@ public class ServerRunner extends SimpleConfigurable implements AutoCloseable {
} }
} }
if (root != null) { if (root != null) {
try { try {
root.close(); root.close();

View File

@ -30,7 +30,7 @@
<br/> <br/>
<#if serverRootState??> <#if serverRootState??>
<div class="container"> <div class="container">
<h3> Current root state: </h3> <h3> Server root state: </h3>
<div class="well well-lg"> <div class="well well-lg">
${serverRootState} ${serverRootState}
</div> </div>
@ -38,7 +38,7 @@
</#if> </#if>
<br/> <br/>
<#if runPresent> <#if runPresent>
<h2> Current run configuration </h2> <#-- <h2> Current run configuration </h2>
<#if runMeta??> <#if runMeta??>
<div class="container"> <div class="container">
<h3> Run metadata: </h3> <h3> Run metadata: </h3>
@ -47,6 +47,7 @@
</div> </div>
</div> </div>
</#if> </#if>
-->
<#if runState?? > <#if runState?? >
<div class="container"> <div class="container">
<h3> Current run state: </h3> <h3> Current run state: </h3>