Commit feb093bd authored by Marian Dovgialo's avatar Marian Dovgialo

Merge branch 'dev/46180_bugfixes_for_svarog_dmg_under_mac' into 'development'

#46180 bugfixes_for_svarog_dmg_under_mac dev

See merge request brain/svarog2!184
parents 0801c5f1 00cb09cb
......@@ -21,6 +21,9 @@
import com.thoughtworks.xstream.XStream;
import com.thoughtworks.xstream.annotations.Annotations;
import com.thoughtworks.xstream.annotations.XStreamAlias;
import java.io.File;
import java.nio.file.Files;
import org.signalml.method.mp5.MP5BundledProcessExecutor;
/** MP5ExecutorManager
*
......@@ -37,9 +40,23 @@
private transient EventListenerList listenerList = new EventListenerList();
public MP5ExecutorManager() {
defaultExecutor = MP5LocalProcessExecutor.pathExecutor();
MP5Executor path_executor = MP5LocalProcessExecutor.pathExecutor();
MP5BundledProcessExecutor bundled_executor = new MP5BundledProcessExecutor();
String execPath = bundled_executor.getMp5ExecutablePath();
File execFile = new File(execPath);
if (execFile.exists())
{
defaultExecutor = bundled_executor;
}
else
{
defaultExecutor = path_executor;
}
executors = new ArrayList<MP5Executor>();
executors.add(defaultExecutor);
executors.add(path_executor);
executors.add(bundled_executor);
}
@Override
......@@ -55,7 +72,8 @@ private XStream createExecutorStreamer() {
Annotations.configureAliases(
streamer,
MP5ExecutorManager.class,
MP5LocalProcessExecutor.class
MP5LocalProcessExecutor.class,
MP5BundledProcessExecutor.class
//MP5RemoteExecutor.class,
//MP5RemotePasswordExecutor.class
);
......
......@@ -29,8 +29,8 @@
/**
* Files that are used to store temporary filtering results.
*/
private File temporaryFile1 = new File("exportsub1.bin.tmp");
private File temporaryFile2 = new File("exportsub2.bin.tmp");
private File temporaryFile1 = File.createTempFile("svarog_IIR_", "exportsub1.bin.tmp");
private File temporaryFile2 = File.createTempFile("svarog_IIR_", "exportsub2.bin.tmp");
/**
* A {@link RawSignalWriter} for writing the temporary results to files.
......
......@@ -2,6 +2,7 @@
import java.io.File;
import java.io.IOException;
import java.nio.file.Files;
import org.signalml.app.model.signal.SignalExportDescriptor;
import org.signalml.domain.montage.Montage;
......@@ -27,8 +28,8 @@
/**
* Files storing the temporary results of the filtering.
*/
private File inputFile = new File("export2.bin.tmp");
private File outputFile = new File("export1.bin.tmp");
private File inputFile = File.createTempFile("svarog_filter_", "export2.bin");
private File outputFile = File.createTempFile("svarog_filter_", "export1.bin");
private RawSignalWriter rawSignalWriter = new RawSignalWriter();
/**
......
package org.signalml.method.mp5;
import com.thoughtworks.xstream.annotations.XStreamAlias;
import java.io.File;
import java.util.Locale;
import static org.signalml.app.util.i18n.SvarogI18n._;
@XStreamAlias("mp5bundledexecutor")
public class MP5BundledProcessExecutor extends MP5LocalProcessExecutor{
public MP5BundledProcessExecutor()
{
super();
setName(_("execute from bundled executor"));
}
@Override
public void setMp5ExecutablePath(String mp5ExecutablePath) {
}
@Override
public String getMp5ExecutablePath() {
File jar = new File(MP5LocalProcessExecutor.class.getProtectionDomain().getCodeSource().getLocation().getPath());
String jarDir = jar.getParentFile().getPath();
String executor_folder;
String OS = System.getProperty("os.name", "generic").toLowerCase(Locale.ENGLISH);
String bits = System.getProperty("sun.arch.data.model");
if ((OS.contains("mac")) || (OS.contains("darwin"))) {
executor_folder = "/mp/osx64/empi-osx64";
} else if (OS.contains("win")) {
executor_folder = "/mp/win" + bits + "/empi-win"+ bits+ ".exe";
} else if (OS.indexOf("nux") >= 0) {
executor_folder = "/mp/linux/empi-lin" + bits;
} else {
executor_folder = "";
}
return jarDir + executor_folder;
}
}
......@@ -21,6 +21,8 @@
import org.signalml.method.MethodExecutionTracker;
import com.thoughtworks.xstream.annotations.XStreamAlias;
import java.net.URLDecoder;
import java.util.Locale;
/** MP5LocalProcessExecutor
*
......@@ -37,7 +39,7 @@
private String uid;
private String name;
private String mp5ExecutablePath;
protected String mp5ExecutablePath;
private transient MP5ConfigCreator configCreator = new MP5ConfigCreator();
private transient RawSignalWriter rawSignalWriter = new RawSignalWriter();
......@@ -138,7 +140,7 @@ public boolean execute(MP5Data data, int segment, File resultFile, MethodExecuti
tracker.setMessage(_("Starting executable"));
boolean executionOk = processController.executeProcess(workingDirectory, mp5ExecutablePath, configFile, tracker);
boolean executionOk = processController.executeProcess(workingDirectory, getMp5ExecutablePath(), configFile, tracker);
if (!executionOk) {
return false;
}
......
......@@ -234,6 +234,15 @@
<minExclusive value="0"></minExclusive>
</restriction>
</simpleType>
<simpleType name="isBackup">
<annotation>
<documentation>
LEGACY OPTION FOR BACKWARD COMPATABILITY, DOES NOTHING
</documentation>
</annotation>
<restriction base="boolean" />
</simpleType>
<complexType name="rawSignalInfo">
<sequence minOccurs="1" maxOccurs="1">
......@@ -404,6 +413,11 @@
<documentation>The timestamp of the first sample in the signal.</documentation>
</annotation>
</element>
<element name="isBackup" type="rs:isBackup" maxOccurs="1" minOccurs="0">
<annotation>
<documentation>LEGACY OPTION FOR BACKWARD COMPATABILITY, DOES NOTHING</documentation>
</annotation>
</element>
</sequence>
</complexType>
......@@ -418,6 +432,7 @@
<element name="calibrationParam" type="rs:calibrationParam" minOccurs="1" maxOccurs="unbounded"></element>
</sequence>
</complexType>
<element name="rawSignal" type="rs:rawSignalInfo">
<annotation>
......@@ -425,4 +440,5 @@
</annotation>
</element>
</schema>
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment