New envelope format, FileStorage overhaul

This commit is contained in:
Alexander Nozik 2017-03-01 18:11:55 +03:00
parent 134e5c771d
commit 69d1a3a848
5 changed files with 25 additions and 19 deletions

View File

@ -160,7 +160,7 @@ public class PrepareDataAction extends OneToOneAction<NumassData, Table> {
} else { } else {
head = dataFile.getName(); head = dataFile.getName();
} }
head = head + "\n" + new XMLMetaWriter().writeString(meta, null) + "\n"; head = head + "\n" + new XMLMetaWriter().writeString(meta) + "\n";
ListTable data = new ListTable(format, dataList); ListTable data = new ListTable(format, dataList);

View File

@ -45,9 +45,9 @@ public class ReadLegacyDataAction extends OneToOneAction<Binary, NMFile> {
protected NMFile execute(Context context, String name, Binary source, Laminate meta) throws ContentException { protected NMFile execute(Context context, String name, Binary source, Laminate meta) throws ContentException {
// log.logString("File '%s' started", source.getName()); // log.logString("File '%s' started", source.getName());
RawNMFile raw = getNumassData(source, meta); RawNMFile raw = getNumassData(source, meta);
if (meta.getBoolean("paw", false)) { // if (meta.getBoolean("paw", false)) {
raw.generatePAW(buildActionOutput(context, name + ".paw")); // raw.generatePAW(buildActionOutput(context, name + ".paw"));
} // }
if (meta.getNodeNames(false).contains("debunch")) { if (meta.getNodeNames(false).contains("debunch")) {
DebunchAction debunch = new DebunchAction(); DebunchAction debunch = new DebunchAction();

View File

@ -26,7 +26,6 @@ import hep.dataforge.storage.api.Storage;
import hep.dataforge.storage.filestorage.FileEnvelope; import hep.dataforge.storage.filestorage.FileEnvelope;
import hep.dataforge.storage.loaders.AbstractLoader; import hep.dataforge.storage.loaders.AbstractLoader;
import hep.dataforge.tables.Table; import hep.dataforge.tables.Table;
import hep.dataforge.values.Value;
import org.apache.commons.vfs2.FileObject; import org.apache.commons.vfs2.FileObject;
import org.apache.commons.vfs2.VFS; import org.apache.commons.vfs2.VFS;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
@ -329,17 +328,20 @@ public class NumassDataLoader extends AbstractLoader implements ObjectLoader<Env
@Override @Override
public Instant startTime() { public Instant startTime() {
if (meta.hasValue("start_time")) {
return meta().getValue("start_time").timeValue();
} else return null;
//Temporary substitution for meta tag //Temporary substitution for meta tag
Envelope hvEnvelope = getHVEnvelope(); // Envelope hvEnvelope = getHVEnvelope();
if (hvEnvelope != null) { // if (hvEnvelope != null) {
try { // try {
return Value.of(new Scanner(hvEnvelope.getData().getStream()).next()).timeValue(); // return Value.of(new Scanner(hvEnvelope.getData().getStream()).next()).timeValue();
} catch (IOException ex) { // } catch (IOException ex) {
return null; // return null;
} // }
} else { // } else {
return null; // return null;
} // }
} }
@Override @Override

View File

@ -281,7 +281,7 @@ public class NumassLoaderViewComponent extends AnchorPane implements Initializab
private void setupInfo(NumassData loader) { private void setupInfo(NumassData loader) {
Meta info = loader.meta(); Meta info = loader.meta();
infoTextBox.setText(new JSONMetaWriter().writeString(info, null). infoTextBox.setText(new JSONMetaWriter().writeString(info).
replace("\\r", "\r\t").replace("\\n", "\n\t")); replace("\\r", "\r\t").replace("\\n", "\n\t"));
} }

View File

@ -15,23 +15,27 @@
*/ */
package inr.numass.viewer; package inr.numass.viewer;
import ch.qos.logback.classic.Level;
import ch.qos.logback.classic.Logger;
import hep.dataforge.exceptions.StorageException; import hep.dataforge.exceptions.StorageException;
import hep.dataforge.storage.commons.StorageManager; import hep.dataforge.storage.commons.StorageManager;
import java.io.IOException;
import javafx.application.Application; import javafx.application.Application;
import javafx.fxml.FXMLLoader; import javafx.fxml.FXMLLoader;
import javafx.scene.Parent; import javafx.scene.Parent;
import javafx.scene.Scene; import javafx.scene.Scene;
import javafx.stage.Stage; import javafx.stage.Stage;
import org.slf4j.LoggerFactory;
import java.io.IOException;
/** /**
*
* @author Alexander Nozik * @author Alexander Nozik
*/ */
public class Viewer extends Application { public class Viewer extends Application {
@Override @Override
public void start(Stage primaryStage) throws StorageException, IOException { public void start(Stage primaryStage) throws StorageException, IOException {
((Logger) LoggerFactory.getLogger(Logger.ROOT_LOGGER_NAME)).setLevel(Level.INFO);
new StorageManager().startGlobal(); new StorageManager().startGlobal();
FXMLLoader fxml = new FXMLLoader(getClass().getResource("/fxml/MainView.fxml")); FXMLLoader fxml = new FXMLLoader(getClass().getResource("/fxml/MainView.fxml"));