Skip to content
Open
Show file tree
Hide file tree
Changes from 6 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@73.225.90.139#> .

<local:C:/Users/Yang Mobei/WorkbenchProjects/Trial/23/script/23_script.sh>
a prov:Entity ;
rdfs:label "script" .

<local:C:/Users/Yang Mobei/WorkbenchProjects/Trial/23/configfiles/23.xml>
a prov:Entity ;
rdfs:label "simulationConfigurationFile" ;
prov:wasGeneratedBy <local:simulation_input_file_generation> .

<local:upload_SimConfig>
a prov:Activity ;
rdfs:label "upload" ;
prov:endedAtTime "2023-02-28T08:19:20.003Z"^^<http://www.w3.org/2001/XMLSchema#dateTime> ;
prov:generated <local:~/WorkbenchSimulations/23/configfiles23.xml> ;
prov:startedAtTime "2023-02-28T08:19:19.454Z"^^<http://www.w3.org/2001/XMLSchema#dateTime> ;
prov:used <local:C:/Users/Yang Mobei/WorkbenchProjects/Trial/23/configfiles/23.xml> ;
prov:wasAssociatedWith <local:workbench> .

<local:C:/Users/Yang Mobei/WorkbenchProjects/Trial/23/configfiles/NList/ActiveNList.xml>
a prov:Entity ;
rdfs:label "nlist" .

<local:~/WorkbenchSimulations/23/23_script.sh>
a prov:Entity ;
rdfs:label "script" ;
prov:wasDerivedFrom <local:C:/Users/Yang Mobei/WorkbenchProjects/Trial/23/script/23_script.sh> ;
prov:wasGeneratedBy <local:uploadScript> .

<local:~/WorkbenchSimulations/23/configfiles/NListInhibitoryNList.xml>
a prov:Entity ;
rdfs:label "nlist" ;
prov:wasDerivedFrom <local:C:/Users/Yang Mobei/WorkbenchProjects/Trial/23/configfiles/NList/InhibitoryNList.xml> ;
prov:wasGeneratedBy <local:upload_INHIBITORY_NList> .

<local:C:/Users/Yang Mobei/WorkbenchProjects/Trial/23/configfiles/NList/probedNList.xml>
a prov:Entity ;
rdfs:label "nlist" .

<local:uploadScript> a prov:Activity ;
rdfs:label "upload" ;
prov:endedAtTime "2023-02-28T08:19:17.839Z"^^<http://www.w3.org/2001/XMLSchema#dateTime> ;
prov:generated <local:~/WorkbenchSimulations/23/23_script.sh> ;
prov:startedAtTime "2023-02-28T08:19:17.285Z"^^<http://www.w3.org/2001/XMLSchema#dateTime> ;
prov:used <local:C:/Users/Yang Mobei/WorkbenchProjects/Trial/23/script/23_script.sh> ;
prov:wasAssociatedWith <local:workbench> .

<local:workbench> a prov:SoftwareAgent .

<local:upload_INHIBITORY_NList>
a prov:Activity ;
rdfs:label "upload" ;
prov:endedAtTime "2023-02-28T08:19:18.918Z"^^<http://www.w3.org/2001/XMLSchema#dateTime> ;
prov:generated <local:~/WorkbenchSimulations/23/configfiles/NListInhibitoryNList.xml> ;
prov:startedAtTime "2023-02-28T08:19:18.385Z"^^<http://www.w3.org/2001/XMLSchema#dateTime> ;
prov:used <local:C:/Users/Yang Mobei/WorkbenchProjects/Trial/23/configfiles/NList/InhibitoryNList.xml> ;
prov:wasAssociatedWith <local:workbench> .

<local:upload_PROBED_NList>
a prov:Activity ;
rdfs:label "upload" ;
prov:endedAtTime "2023-02-28T08:19:19.454Z"^^<http://www.w3.org/2001/XMLSchema#dateTime> ;
prov:generated <local:~/WorkbenchSimulations/23/configfiles/NListprobedNList.xml> ;
prov:startedAtTime "2023-02-28T08:19:18.919Z"^^<http://www.w3.org/2001/XMLSchema#dateTime> ;
prov:used <local:C:/Users/Yang Mobei/WorkbenchProjects/Trial/23/configfiles/NList/probedNList.xml> ;
prov:wasAssociatedWith <local:workbench> .

<local:~/WorkbenchSimulations/23/configfiles23.xml>
a prov:Entity ;
rdfs:label "simulationConfigurationFile" ;
prov:wasDerivedFrom <local:C:/Users/Yang Mobei/WorkbenchProjects/Trial/23/configfiles/23.xml> ;
prov:wasGeneratedBy <local:upload_SimConfig> .

<local:upload_ACTIVE_NList>
a prov:Activity ;
rdfs:label "upload" ;
prov:endedAtTime "2023-02-28T08:19:18.385Z"^^<http://www.w3.org/2001/XMLSchema#dateTime> ;
prov:generated <local:~/WorkbenchSimulations/23/configfiles/NListActiveNList.xml> ;
prov:startedAtTime "2023-02-28T08:19:17.84Z"^^<http://www.w3.org/2001/XMLSchema#dateTime> ;
prov:used <local:C:/Users/Yang Mobei/WorkbenchProjects/Trial/23/configfiles/NList/ActiveNList.xml> ;
prov:wasAssociatedWith <local:workbench> .

<local:simulation_input_file_generation>
a prov:Activity ;
prov:generated <local:C:/Users/Yang Mobei/WorkbenchProjects/Trial/23/configfiles/23.xml> ;
prov:wasAssociatedWith <local:workbench> .

<local:~/WorkbenchSimulations/23/configfiles/NListActiveNList.xml>
a prov:Entity ;
rdfs:label "nlist" ;
prov:wasDerivedFrom <local:C:/Users/Yang Mobei/WorkbenchProjects/Trial/23/configfiles/NList/ActiveNList.xml> ;
prov:wasGeneratedBy <local:upload_ACTIVE_NList> .

<local:C:/Users/Yang Mobei/WorkbenchProjects/Trial/23/configfiles/NList/InhibitoryNList.xml>
a prov:Entity ;
rdfs:label "nlist" .

<local:~/WorkbenchSimulations/23/configfiles/NListprobedNList.xml>
a prov:Entity ;
rdfs:label "nlist" ;
prov:wasDerivedFrom <local:C:/Users/Yang Mobei/WorkbenchProjects/Trial/23/configfiles/NList/probedNList.xml> ;
prov:wasGeneratedBy <local:upload_PROBED_NList> .
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\Yang Mobei\WorkbenchProjects\Trial\23\provenance\23.ttl
DESKTOP-3N8B16A@73.225.90.139#
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) {
Comment thread
BenYang2002 marked this conversation as resolved.
Outdated
this.simulation = inputSimulation;
Comment thread
BenYang2002 marked this conversation as resolved.
Outdated
}
Comment thread
BenYang2002 marked this conversation as resolved.
Outdated

public void provMgrSetter(ProvMgr inputProv) {
Comment thread
BenYang2002 marked this conversation as resolved.
Outdated
this.prov = inputProv;
Comment thread
BenYang2002 marked this conversation as resolved.
Outdated
}
Comment thread
BenYang2002 marked this conversation as resolved.
Outdated
// </editor-fold>

// <editor-fold defaultstate="collapsed" desc="Construction">
Expand Down Expand Up @@ -527,8 +538,17 @@ public boolean runScript() {
neuronLists, simulation.getSimConfigFilename());
simulation.setScriptRan(success);
simulation.setScriptStartedAt();
if (success) {
Comment thread
BenYang2002 marked this conversation as resolved.
Outdated
File simulationFile = new File(workingDir() + "\\LastSimulation\\simulation");
Comment thread
BenYang2002 marked this conversation as resolved.
Outdated
FileOutputStream simOut = new FileOutputStream(simulationFile);
Comment thread
BenYang2002 marked this conversation as resolved.
Outdated
ObjectOutputStream simObjOut = new ObjectOutputStream(simOut);
Comment thread
BenYang2002 marked this conversation as resolved.
Outdated
simObjOut.writeObject(simulation);
Comment thread
BenYang2002 marked this conversation as resolved.
Outdated
}
Comment thread
BenYang2002 marked this conversation as resolved.
Outdated

//save the simulation here
messageAccumulator += sm.getOutstandingMessages();
} catch (JSchException | SftpException | IOException | NullPointerException e) {
e.printStackTrace();
Comment thread
BenYang2002 marked this conversation as resolved.
Outdated
messageAccumulator += "\n" + "Script did not run do to "
+ e.getClass() + "...\n";
messageAccumulator += "Exception message: " + e.getMessage();
Expand All @@ -537,6 +557,15 @@ public boolean runScript() {
return success;
}

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
Original file line number Diff line number Diff line change
@@ -1,19 +1,31 @@
package edu.uwb.braingrid.workbench.comm;

import com.jcraft.jsch.Channel;
import com.jcraft.jsch.ChannelExec;
import com.jcraft.jsch.ChannelSftp;
import com.jcraft.jsch.JSch;
import com.jcraft.jsch.JSchException;
import com.jcraft.jsch.Session;
import com.jcraft.jsch.SftpException;
import com.jcraft.jsch.SftpProgressMonitor;

import edu.uwb.braingrid.workbench.WorkbenchManager;
Comment thread
BenYang2002 marked this conversation as resolved.
import edu.uwb.braingrid.workbench.ui.SimulationRuntimeDialog;
import javafx.scene.control.TextArea;
import riotcmd.infer;

import java.io.BufferedReader;
Comment thread
BenYang2002 marked this conversation as resolved.
Comment thread
BenYang2002 marked this conversation as resolved.
import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
Comment thread
BenYang2002 marked this conversation as resolved.
Outdated
import java.util.Date;

import javax.swing.JFrame;
Comment thread
BenYang2002 marked this conversation as resolved.
Outdated
Comment thread
BenYang2002 marked this conversation as resolved.
Outdated
import javax.swing.JOptionPane;
Comment thread
BenYang2002 marked this conversation as resolved.
Outdated

/**
* Provides abbreviated SSF/FTP functionality. This includes uploading/downloading files and
* execution of commands on a remote machine.
Expand Down Expand Up @@ -273,4 +285,82 @@ private boolean readInputStream(InputStream in, ChannelExec cExec) {
return success;
}
// </editor-fold>

/**
Comment thread
BenYang2002 marked this conversation as resolved.
Outdated
* Connects to the last simulation.
*
* @param hostname The name of the host machine to connect to.
* @param username The user's login username.
* @param password The user's login password.
* @param simName The last simulation to connect to.
* @param manager The temp place holder.
*/

public void checkLastSim(String hostname, String username,
String password, String simName, WorkbenchManager manager) {
JSch jsch = new JSch();
try {
session = jsch.getSession(username, hostname, PORT);
session.setPassword(password);
session.setConfig("StrictHostKeyChecking", "no"); //optional
session.connect();

Channel channel = session.openChannel("exec");
((ChannelExec) channel).setInputStream(null);
((ChannelExec) channel).setCommand("cd WorkbenchSimulations/ && ls");
channel.connect();

InputStream in;
try {
Comment thread
BenYang2002 marked this conversation as resolved.
Outdated
in = channel.getInputStream();
BufferedReader reader = new BufferedReader(new InputStreamReader(in));
String files;
while ((files = reader.readLine()) != null) {
if (files.equals(simName)) {
Channel channel2 = session.openChannel("sftp");
Comment thread
BenYang2002 marked this conversation as resolved.
Outdated
channel2.connect();
Comment thread
BenYang2002 marked this conversation as resolved.
Outdated
//((ChannelSftp) channel2).setInputStream(null);
try {
Comment thread
BenYang2002 marked this conversation as resolved.
Outdated
((ChannelSftp) channel2).cd(
Comment thread
BenYang2002 marked this conversation as resolved.
Outdated
"WorkbenchSimulations//" + simName + "//Output//Debug");
InputStream workBenchLOG = ((ChannelSftp) channel2).get("workbench.txt");
Comment thread
BenYang2002 marked this conversation as resolved.
Outdated
Comment thread
BenYang2002 marked this conversation as resolved.
Outdated
BufferedReader readLOG = new BufferedReader(new InputStreamReader(workBenchLOG));
Comment thread
BenYang2002 marked this conversation as resolved.
Outdated
Comment thread
BenYang2002 marked this conversation as resolved.
Outdated
String line;
Comment thread
BenYang2002 marked this conversation as resolved.
Outdated
String lastline = "";
Comment thread
BenYang2002 marked this conversation as resolved.
Outdated
while ((line = readLOG.readLine()) != null) {
Comment thread
BenYang2002 marked this conversation as resolved.
Outdated
lastline = line;
Comment thread
BenYang2002 marked this conversation as resolved.
Outdated
}
Comment thread
BenYang2002 marked this conversation as resolved.
Outdated
String completion = "Complete";
Comment thread
BenYang2002 marked this conversation as resolved.
Outdated
lastline = lastline.substring(
Comment thread
BenYang2002 marked this conversation as resolved.
Outdated
lastline.length() - completion.length(), lastline.length());
if (lastline.equals("Complete")) {
Comment thread
BenYang2002 marked this conversation as resolved.
Outdated
displayDownloadFrame(channel2, manager);
Comment thread
BenYang2002 marked this conversation as resolved.
Outdated
break;
Comment thread
BenYang2002 marked this conversation as resolved.
Outdated
}
Comment thread
BenYang2002 marked this conversation as resolved.
Outdated
} catch (SftpException e) {
e.printStackTrace();
}
}
}
} catch (IOException e) {
Comment thread
BenYang2002 marked this conversation as resolved.
Outdated
e.printStackTrace();
Comment thread
BenYang2002 marked this conversation as resolved.
Outdated
}
Comment thread
BenYang2002 marked this conversation as resolved.
Outdated

} catch (JSchException e) {
e.printStackTrace();
}
}

private void displayDownloadFrame(Channel channel, WorkbenchManager manager) {
JFrame frame = new JFrame();
String[] options = {"Download", "Cancel"};
int option = JOptionPane.showOptionDialog(frame,
"Last simlation completed, do you want to download?", "Last Simulation Completed",
JOptionPane.YES_NO_OPTION, JOptionPane.QUESTION_MESSAGE,
null, options, options[0]);
if (option == JOptionPane.YES_NO_OPTION) {
Comment thread
BenYang2002 marked this conversation as resolved.
Outdated
SimulationRuntimeDialog srd = new SimulationRuntimeDialog(
Comment thread
BenYang2002 marked this conversation as resolved.
Outdated
new TextArea(manager.getMessages()));
}
Comment thread
BenYang2002 marked this conversation as resolved.
Outdated
}
}
Original file line number Diff line number Diff line change
@@ -1,13 +1,15 @@
package edu.uwb.braingrid.workbench.model;

import java.io.Serializable;

import edu.uwb.braingrid.workbench.utils.DateTime;

/**
* Represents the history for a script associated with a simulation.
*
* @author Aaron Conrad
*/
public class ScriptHistory {
public class ScriptHistory implements Serializable {

// <editor-fold defaultstate="collapsed" desc="Members">
private long startedAt;
Expand Down
Loading