diff --git a/INSTALL.md b/BUILD.md similarity index 100% rename from INSTALL.md rename to BUILD.md diff --git a/README.md b/README.md index ec73ad4..5502a53 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,13 @@ ## VisualizerLauncher -Launches a GenePattern visualizer from the desktop. Use this as a replacement for the 'Open Visualizer' link embedded in the web page. The application is available for download directly from the [releases](https://github.com/genepattern/VisualizerLauncher/releases/latest) page. -See the [INSTALL page](INSTALL.md) for instructions on building the application. +Launch a GenePattern visualizer from the desktop. Use this as a replacement for the 'Open Visualizer' link on the Job Status page. -See the [home page](https://genepattern.github.io/VisualizerLauncher/) for more usage instructions. +See the [home page](https://genepattern.github.io/VisualizerLauncher/) for usage instructions. + +### Developer documentation + +See the [BUILD page](BUILD.md) for instructions on building the application from source code. + +### Release archive + +See the [releases page](https://github.com/genepattern/VisualizerLauncher/releases/latest) for release notes and older versions. diff --git a/pom.xml b/pom.xml index 928dc15..d15f425 100644 --- a/pom.xml +++ b/pom.xml @@ -33,7 +33,7 @@ 4.0.0 genepattern.org visualizerLauncher - 1.2.4 + 1.2.5 VisualizerLauncher http://maven.apache.org diff --git a/src/main/java/org/genepattern/desktop/JobInfo.java b/src/main/java/org/genepattern/desktop/JobInfo.java index 43339f0..38f9162 100644 --- a/src/main/java/org/genepattern/desktop/JobInfo.java +++ b/src/main/java/org/genepattern/desktop/JobInfo.java @@ -10,7 +10,7 @@ public class JobInfo private String jobNumber; private GPTask gpTask; private String[] commandLine; - private Map inputURLToFilePathMap; + private Map inputURLToFilePathMap; public String getJobNumber() { return jobNumber; @@ -40,7 +40,7 @@ public Map getInputURLToFilePathMap() { return inputURLToFilePathMap; } - public void setInputURLToFilePathMap(Map inputURLToFilePathMap) { + public void setInputURLToFilePathMap(Map inputURLToFilePathMap) { this.inputURLToFilePathMap = inputURLToFilePathMap; } } diff --git a/src/main/java/org/genepattern/desktop/Util.java b/src/main/java/org/genepattern/desktop/Util.java index c9d2713..57b6a96 100644 --- a/src/main/java/org/genepattern/desktop/Util.java +++ b/src/main/java/org/genepattern/desktop/Util.java @@ -108,18 +108,18 @@ protected static String retrieveJobDetails(final String basicAuthHeader, final S * @param dir, The directory to download the URL to. * @param filename, The filename to download the URL to. */ - public static File downloadFile(String authString, URL fromUrl, File toDir, String filename) throws IOException { + public static File downloadFile(final String authString, final URL fromUrl, final File toDir, final String filename) throws IOException { InputStream is = null; FileOutputStream fos = null; - File file = null; + File toFile = null; try { URLConnection conn = fromUrl.openConnection(); conn.setRequestProperty("Authorization", authString); is = conn.getInputStream(); toDir.mkdirs(); - file = new File(toDir, filename); - fos = new FileOutputStream(file); + toFile = new File(toDir, filename); + fos = new FileOutputStream(toFile); byte[] buf = new byte[100000]; int j; while ((j = is.read(buf, 0, buf.length)) != -1) { @@ -136,6 +136,7 @@ public static File downloadFile(String authString, URL fromUrl, File toDir, Stri is.close(); } catch (IOException e) { + log.error("Unexpected error closing input stream, fromUrl="+fromUrl, e); } } if (fos != null) { @@ -143,10 +144,11 @@ public static File downloadFile(String authString, URL fromUrl, File toDir, Stri fos.close(); } catch (IOException e) { + log.error("Unexpected error closing output stream, toFile="+toFile, e); } } } - return file; + return toFile; } /** create thread to read from a process output or error stream */ diff --git a/src/main/java/org/genepattern/desktop/VisualizerLauncher.java b/src/main/java/org/genepattern/desktop/VisualizerLauncher.java index 00b3a4b..1f07b24 100644 --- a/src/main/java/org/genepattern/desktop/VisualizerLauncher.java +++ b/src/main/java/org/genepattern/desktop/VisualizerLauncher.java @@ -64,7 +64,7 @@ public class VisualizerLauncher { this.jobInfo = new JobInfo(); } - private void login() { + private void run() { JPanel panel = new JPanel(new GridLayout(4, 1)); panel.setBorder(BorderFactory.createEmptyBorder(20, 20, 20, 20)); @@ -182,10 +182,6 @@ public void actionPerformed(ActionEvent e) { frame.setVisible(true); } - public void run() { - login(); - } - private void downloadSupportFiles(final GPTask task) throws Exception { for(final String supportFileURL : task.getSupportFileUrls()) { final int slashIndex = supportFileURL.lastIndexOf('='); @@ -317,6 +313,10 @@ private void prepareCommandLineStep() throws IOException { final String[] cmdLineList = new String[cmdLineArr.length()]; for(int i=0;i< cmdLineArr.length(); i++) { String argValue = cmdLineArr.getString(i); + if (argValue.startsWith("/gp/")) { + // e.g. gpServer=http://127.0.0.1:8080/gp + argValue=argValue.replaceFirst("/gp", gpServer); + } if(inputURLMap.containsKey(argValue)) { argValue = downloadLocation.getAbsolutePath() + "/" + inputURLMap.get(argValue); } @@ -355,17 +355,28 @@ protected void downloadInputFiles() throws Exception { final JSONArray inputFiles=inputFilesJsonObj.getJSONArray("inputFiles"); final Map map = new HashMap(); for(int i=0;i")) { - inputFile=inputFile.replaceFirst("", gpServer+"/"); - } - final String filenameWithExtension=filenameWithExt(inputFile); - final URL fileURL = downloadInputFile(inputFile); + final String inputFile = inputFiles.getString(i); + final String inputFileUrlStr=initInputFileUrlStr(inputFile); + final String filenameWithExtension=filenameWithExt(inputFileUrlStr); + final URL fileURL = downloadInputFile(inputFileUrlStr); map.put(fileURL.toString(), filenameWithExtension); } jobInfo.setInputURLToFilePathMap(map); } + protected String initInputFileUrlStr(final String inputFile) { + if (inputFile.startsWith("")) { + return inputFile.replaceFirst("", gpServer+"/"); + } + else if (inputFile.startsWith("/gp/")) { + // e.g. gpServer=http://127.0.0.1:8080/gp + return inputFile.replaceFirst("/gp", gpServer); + } + else { + return inputFile; + } + } + protected String filenameWithExt(final String inputFile) { final int slashIndex = inputFile.lastIndexOf('/'); final String filenameWithExtension = inputFile.substring(slashIndex + 1);