New envelope format, FileStorage overhaul
This commit is contained in:
parent
134e5c771d
commit
69d1a3a848
@ -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);
|
||||||
|
|
||||||
|
@ -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();
|
||||||
|
@ -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;
|
||||||
@ -189,7 +188,7 @@ public class NumassDataLoader extends AbstractLoader implements ObjectLoader<Env
|
|||||||
|
|
||||||
double timeCoef = envelope.meta().getDouble("time_coeff", 50);
|
double timeCoef = envelope.meta().getDouble("time_coeff", 50);
|
||||||
try (ReadableByteChannel inChannel = envelope.getData().getChannel()) {
|
try (ReadableByteChannel inChannel = envelope.getData().getChannel()) {
|
||||||
ByteBuffer buffer = ByteBuffer.allocate(7*1000); // one event is 7b
|
ByteBuffer buffer = ByteBuffer.allocate(7 * 1000); // one event is 7b
|
||||||
buffer.order(ByteOrder.LITTLE_ENDIAN);
|
buffer.order(ByteOrder.LITTLE_ENDIAN);
|
||||||
while (inChannel.read(buffer) > 0) {
|
while (inChannel.read(buffer) > 0) {
|
||||||
buffer.flip();
|
buffer.flip();
|
||||||
@ -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
|
||||||
|
@ -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"));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -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"));
|
||||||
|
Loading…
Reference in New Issue
Block a user