Skip to content
Open
Show file tree
Hide file tree
Changes from 9 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file added WorkbenchProject/Cache/hostname.encrypted
Binary file not shown.
Binary file added WorkbenchProject/Cache/username.encrypted
Binary file not shown.
Binary file added WorkbenchProject/Key
Binary file not shown.
Binary file added WorkbenchProject/LastSimulation/message
Binary file not shown.
108 changes: 108 additions & 0 deletions WorkbenchProject/LastSimulation/model.ttl
Original file line number Diff line number Diff line change
@@ -0,0 +1,108 @@
@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
@prefix xsd: <http://www.w3.org/2000/10/XMLSchema#> .
@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
@prefix remote: <otachi.uwb.edu#> .
@prefix prov: <http://www.w3.org/ns/prov#> .
@prefix local: <DESKTOP-3N8B16A@205.175.118.10#> .

<local:~/WorkbenchSimulations/trial404/configfilestrial404.xml>
a prov:Entity ;
rdfs:label "simulationConfigurationFile" ;
prov:wasDerivedFrom <local:C:/Users/Administrator/WorkbenchProjects/Default/trial404/configfiles/trial404.xml> ;
prov:wasGeneratedBy <local:upload_SimConfig> .

<local:~/WorkbenchSimulations/trial404/configfiles/NListActiveNList.xml>
a prov:Entity ;
rdfs:label "nlist" ;
prov:wasDerivedFrom <local:C:/Users/Administrator/WorkbenchProjects/Default/trial404/configfiles/NList/ActiveNList.xml> ;
prov:wasGeneratedBy <local:upload_ACTIVE_NList> .

<local:upload_SimConfig>
a prov:Activity ;
rdfs:label "upload" ;
prov:endedAtTime "2023-03-01T00:04:26.626Z"^^<http://www.w3.org/2001/XMLSchema#dateTime> ;
prov:generated <local:~/WorkbenchSimulations/trial404/configfilestrial404.xml> ;
prov:startedAtTime "2023-03-01T00:04:26.298Z"^^<http://www.w3.org/2001/XMLSchema#dateTime> ;
prov:used <local:C:/Users/Administrator/WorkbenchProjects/Default/trial404/configfiles/trial404.xml> ;
prov:wasAssociatedWith <local:workbench> .

<local:C:/Users/Administrator/WorkbenchProjects/Default/trial404/configfiles/NList/ActiveNList.xml>
a prov:Entity ;
rdfs:label "nlist" .

<local:~/WorkbenchSimulations/trial404/configfiles/NListprobedNList.xml>
a prov:Entity ;
rdfs:label "nlist" ;
prov:wasDerivedFrom <local:C:/Users/Administrator/WorkbenchProjects/Default/trial404/configfiles/NList/probedNList.xml> ;
prov:wasGeneratedBy <local:upload_PROBED_NList> .

<local:C:/Users/Administrator/WorkbenchProjects/Default/trial404/configfiles/NList/probedNList.xml>
a prov:Entity ;
rdfs:label "nlist" .

<local:uploadScript> a prov:Activity ;
rdfs:label "upload" ;
prov:endedAtTime "2023-03-01T00:04:25.333Z"^^<http://www.w3.org/2001/XMLSchema#dateTime> ;
prov:generated <local:~/WorkbenchSimulations/trial404/trial404_script.sh> ;
prov:startedAtTime "2023-03-01T00:04:25.026Z"^^<http://www.w3.org/2001/XMLSchema#dateTime> ;
prov:used <local:C:/Users/Administrator/WorkbenchProjects/Default/trial404/script/trial404_script.sh> ;
prov:wasAssociatedWith <local:workbench> .

<local:workbench> a prov:SoftwareAgent .

<local:upload_INHIBITORY_NList>
a prov:Activity ;
rdfs:label "upload" ;
prov:endedAtTime "2023-03-01T00:04:25.99Z"^^<http://www.w3.org/2001/XMLSchema#dateTime> ;
prov:generated <local:~/WorkbenchSimulations/trial404/configfiles/NListInhibitoryNList.xml> ;
prov:startedAtTime "2023-03-01T00:04:25.682Z"^^<http://www.w3.org/2001/XMLSchema#dateTime> ;
prov:used <local:C:/Users/Administrator/WorkbenchProjects/Default/trial404/configfiles/NList/InhibitoryNList.xml> ;
prov:wasAssociatedWith <local:workbench> .

<local:upload_PROBED_NList>
a prov:Activity ;
rdfs:label "upload" ;
prov:endedAtTime "2023-03-01T00:04:26.298Z"^^<http://www.w3.org/2001/XMLSchema#dateTime> ;
prov:generated <local:~/WorkbenchSimulations/trial404/configfiles/NListprobedNList.xml> ;
prov:startedAtTime "2023-03-01T00:04:25.991Z"^^<http://www.w3.org/2001/XMLSchema#dateTime> ;
prov:used <local:C:/Users/Administrator/WorkbenchProjects/Default/trial404/configfiles/NList/probedNList.xml> ;
prov:wasAssociatedWith <local:workbench> .

<local:C:/Users/Administrator/WorkbenchProjects/Default/trial404/configfiles/NList/InhibitoryNList.xml>
a prov:Entity ;
rdfs:label "nlist" .

<local:upload_ACTIVE_NList>
a prov:Activity ;
rdfs:label "upload" ;
prov:endedAtTime "2023-03-01T00:04:25.682Z"^^<http://www.w3.org/2001/XMLSchema#dateTime> ;
prov:generated <local:~/WorkbenchSimulations/trial404/configfiles/NListActiveNList.xml> ;
prov:startedAtTime "2023-03-01T00:04:25.333Z"^^<http://www.w3.org/2001/XMLSchema#dateTime> ;
prov:used <local:C:/Users/Administrator/WorkbenchProjects/Default/trial404/configfiles/NList/ActiveNList.xml> ;
prov:wasAssociatedWith <local:workbench> .

<local:simulation_input_file_generation>
a prov:Activity ;
prov:generated <local:C:/Users/Administrator/WorkbenchProjects/Default/trial404/configfiles/trial404.xml> ;
prov:wasAssociatedWith <local:workbench> .

<local:C:/Users/Administrator/WorkbenchProjects/Default/trial404/configfiles/trial404.xml>
a prov:Entity ;
rdfs:label "simulationConfigurationFile" ;
prov:wasGeneratedBy <local:simulation_input_file_generation> .

<local:~/WorkbenchSimulations/trial404/configfiles/NListInhibitoryNList.xml>
a prov:Entity ;
rdfs:label "nlist" ;
prov:wasDerivedFrom <local:C:/Users/Administrator/WorkbenchProjects/Default/trial404/configfiles/NList/InhibitoryNList.xml> ;
prov:wasGeneratedBy <local:upload_INHIBITORY_NList> .

<local:C:/Users/Administrator/WorkbenchProjects/Default/trial404/script/trial404_script.sh>
a prov:Entity ;
rdfs:label "script" .

<local:~/WorkbenchSimulations/trial404/trial404_script.sh>
a prov:Entity ;
rdfs:label "script" ;
prov:wasDerivedFrom <local:C:/Users/Administrator/WorkbenchProjects/Default/trial404/script/trial404_script.sh> ;
prov:wasGeneratedBy <local:uploadScript> .
Binary file added WorkbenchProject/LastSimulation/simName
Binary file not shown.
Binary file added WorkbenchProject/LastSimulation/simdir
Binary file not shown.
Binary file added WorkbenchProject/LastSimulation/simulation
Binary file not shown.
3 changes: 3 additions & 0 deletions WorkbenchProject/LastSimulation/uri
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
C:\Users\Administrator\WorkbenchProjects\Default\trial404\provenance\trial404.ttl
DESKTOP-3N8B16A@205.175.118.10#
null
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.PrintStream;
import java.io.Serializable;
import java.net.InetAddress;
import java.net.URL;
import java.net.URLConnection;
Expand Down Expand Up @@ -50,7 +51,7 @@
* @author Del Davis, Extended by Joseph Conquest
* @version 1.2
*/
public class ProvMgr {
public class ProvMgr implements Serializable {

// <editor-fold defaultstate="collapsed" desc="Members">
private static final Logger LOG = Logger.getLogger(ProvMgr.class.getName());
Expand All @@ -71,6 +72,50 @@ public class ProvMgr {
private Model model;
// </editor-fold>

/**
Comment thread
BenYang2002 marked this conversation as resolved.
Outdated
* The getter for provURI.
*
* @return return the provURI.
*
*/
public String getProvURI() {
Comment thread
BenYang2002 marked this conversation as resolved.
Outdated
return provOutputFileURI;
Comment thread
BenYang2002 marked this conversation as resolved.
Outdated
}

/**
Comment thread
BenYang2002 marked this conversation as resolved.
Outdated
* The getter for LocalURI.
*
* @return return the LocalURI.
*
*/
public String getLocalURI() {
Comment thread
BenYang2002 marked this conversation as resolved.
Outdated
return localNameSpaceURI;
Comment thread
BenYang2002 marked this conversation as resolved.
Outdated
}

/**
Comment thread
BenYang2002 marked this conversation as resolved.
Outdated
* The getter for RemoteURI.
*
* @return return the RemoteURI.
*
*/
public String getRemoteURI() {
return remoteNameSpaceURI;
}
Comment thread
BenYang2002 marked this conversation as resolved.
Outdated
/**
* The constructor used by resume Lastsimulation.
*
* @param provURI the provURI
Comment thread
BenYang2002 marked this conversation as resolved.
Outdated
* @param localURI the localURI
Comment thread
BenYang2002 marked this conversation as resolved.
Outdated
* @param remoteURI the remoteURI
Comment thread
BenYang2002 marked this conversation as resolved.
Outdated
* @param model the model
*/
public ProvMgr(String provURI, String localURI, String remoteURI, Model model) {
Comment thread
BenYang2002 marked this conversation as resolved.
Outdated
Comment thread
BenYang2002 marked this conversation as resolved.
Outdated
Comment thread
BenYang2002 marked this conversation as resolved.
Outdated
Comment thread
BenYang2002 marked this conversation as resolved.
Outdated
this.provOutputFileURI = provURI;
this.localNameSpaceURI = localURI;
this.remoteNameSpaceURI = remoteURI;
this.model = model;
}
Comment thread
BenYang2002 marked this conversation as resolved.
Outdated

// <editor-fold defaultstate="collapsed" desc="Construction">
/**
* Constructs the Provenance Constructor object from a previously recorded provenance file.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -175,13 +175,22 @@ public static Path getCurrentProjectDirectory() {
return getProjectsDirectory().resolve(WorkbenchManager.getInstance().getProjectName());
}

private static String workingDir() {
String dir = System.getProperty("user.dir");
String target = "\\target";
if (dir.endsWith(target)) {
dir = dir.substring(0, dir.length() - target.length());
}
return dir;
}

/**
* Provides the working directory of the current user.
*
* @return The working directory of the current user
*/
public static Path getUserDir() {
return Paths.get(System.getProperty("user.dir"));
return Paths.get(workingDir());
Comment thread
BenYang2002 marked this conversation as resolved.
Outdated
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,10 @@
import com.jcraft.jsch.JSchException;
import com.jcraft.jsch.SftpException;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.ObjectOutputStream;
import java.nio.file.Files;
import java.nio.file.Path;
import java.util.HashMap;
Expand Down Expand Up @@ -56,6 +59,14 @@ public final class WorkbenchManager {
private Project project;
private Simulation simulation;
private ProvMgr prov;

public void simulationSetter(Simulation inputSimulation) {
this.simulation = inputSimulation;
}

public void provMgrSetter(ProvMgr inputProv) {
this.prov = inputProv;
}
// </editor-fold>

// <editor-fold defaultstate="collapsed" desc="Construction">
Expand Down Expand Up @@ -516,26 +527,44 @@ public boolean generateScript() {
* @return True if all files were uploaded/copied successfully and the script was started,
* otherwise false
*/
public boolean runScript() {
boolean success = false;
ScriptManager sm = new ScriptManager();
try {
String simulationName = simulation.getName();
String scriptPath = simulation.getScriptFilePath();
String[] neuronLists = FileManager.getNeuronListFilenames(simulationName);
success = sm.runScript(prov, simulation.getSimSpec(), simulationName, scriptPath,
neuronLists, simulation.getSimConfigFilename());
simulation.setScriptRan(success);
simulation.setScriptStartedAt();
messageAccumulator += sm.getOutstandingMessages();
} catch (JSchException | SftpException | IOException | NullPointerException e) {
messageAccumulator += "\n" + "Script did not run do to "
+ e.getClass() + "...\n";
messageAccumulator += "Exception message: " + e.getMessage();
}

return success;
}
public boolean runScript() {
boolean success = false;
ScriptManager sm = new ScriptManager();
try {
String simulationName = simulation.getName();
String scriptPath = simulation.getScriptFilePath();
String[] neuronLists = FileManager.getNeuronListFilenames(simulationName);
success = sm.runScript(prov, simulation.getSimSpec(), simulationName, scriptPath,
neuronLists, simulation.getSimConfigFilename());
simulation.setScriptRan(success);
simulation.setScriptStartedAt();
if (success) {
File simulationFile = new File(workingDir() + "\\LastSimulation\\simulation");
FileOutputStream simOut = new FileOutputStream(simulationFile);
ObjectOutputStream simObjOut = new ObjectOutputStream(simOut);
simObjOut.writeObject(simulation);
}

//save the simulation here
Comment thread
BenYang2002 marked this conversation as resolved.
Outdated
messageAccumulator += sm.getOutstandingMessages();
Comment thread
BenYang2002 marked this conversation as resolved.
Outdated
} catch (JSchException | SftpException | IOException | NullPointerException e) {
Comment thread
BenYang2002 marked this conversation as resolved.
Outdated
e.printStackTrace();
Comment thread
BenYang2002 marked this conversation as resolved.
Outdated
messageAccumulator += "\n" + "Script did not run do to "
Comment thread
BenYang2002 marked this conversation as resolved.
Outdated
+ e.getClass() + "...\n";
messageAccumulator += "Exception message: " + e.getMessage();
Comment thread
BenYang2002 marked this conversation as resolved.
Outdated
}
Comment thread
BenYang2002 marked this conversation as resolved.
Outdated

return success;
Comment thread
BenYang2002 marked this conversation as resolved.
Outdated
}

private static String workingDir() {
String dir = System.getProperty("user.dir");
String target = "\\target";
if (dir.endsWith(target)) {
dir = dir.substring(0, dir.length() - target.length());
}
return dir;
}

/**
* Analyzes the redirected provenance output from an executed script.
Expand Down Expand Up @@ -735,6 +764,15 @@ public String getMessages() {
return messageAccumulator;
}

/**
Comment thread
BenYang2002 marked this conversation as resolved.
Outdated
* Set the message for message Accumulator, used for remember last simulation.
*
* @param msg msg to set
*/
public void setMessages(String msg) {
Comment thread
BenYang2002 marked this conversation as resolved.
Outdated
messageAccumulator = msg;
Comment thread
BenYang2002 marked this conversation as resolved.
Outdated
}
Comment thread
BenYang2002 marked this conversation as resolved.
Outdated

/**
* Clears the accumulated messages for this manager.
*/
Expand Down
Loading