Permalink
Browse files

Attempt to recover from gitastrophe

  • Loading branch information...
DMaddison committed Sep 10, 2017
1 parent 7a38c8a commit 207668194542d3c5494313101837135aa840cbc7
View
@@ -12,8 +12,9 @@
<classpathentry excluding="docs/mesquite/BeanTree/" kind="src" path="Resources"/>
<classpathentry kind="src" path="Source"/>
<classpathentry exported="true" kind="lib" path="jars/commons-codec-1.6.jar"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/Java 1.8"/>
<classpathentry exported="true" kind="lib" path="jars/gson-2.6.2.jar"/>
<classpathentry exported="true" kind="lib" path="jars/httpclient-4.3.6.jar"/>
<classpathentry exported="true" kind="lib" path="jars/commons-io-2.5.jar"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
<classpathentry kind="output" path="Mesquite_Folder"/>
</classpath>
@@ -1,11 +1,11 @@
eclipse.preferences.version=1
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.1
org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
org.eclipse.jdt.core.compiler.compliance=1.5
org.eclipse.jdt.core.compiler.compliance=1.3
org.eclipse.jdt.core.compiler.debug.lineNumber=generate
org.eclipse.jdt.core.compiler.debug.localVariable=generate
org.eclipse.jdt.core.compiler.debug.sourceFile=generate
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
org.eclipse.jdt.core.compiler.source=1.5
org.eclipse.jdt.core.compiler.problem.assertIdentifier=ignore
org.eclipse.jdt.core.compiler.problem.enumIdentifier=ignore
org.eclipse.jdt.core.compiler.source=1.3
@@ -363,7 +363,7 @@ else if (!(firstTaxon==0 && lastTaxon==matrix.getNumTaxa())) { // we are doing
String arguments = argumentsForLogging.toString();
arguments=StringUtil.stripBoundingWhitespace(arguments);
externalRunner = new ExternalProcessManager(this, rootDir, getProgramPath(), arguments,getName(), outputFilePaths, this, this, false);
externalRunner = new ExternalProcessManager(this, rootDir, getProgramPath(), arguments,getName(), outputFilePaths, this, this, true);
//ShellScriptUtil.changeDirectory(rootDir, rootDir);
externalRunner.setStdOutFileName(outFileName);
success = externalRunner.executeInShell();
@@ -125,7 +125,8 @@ protected boolean checkUsernamePassword(boolean tellUserAboutSystem){
if (getPassword()!=null)
passwordString.setValue(getPassword());
String help = "You need an account on the "+getSystemName()+" REST system to use this service. To register, go to " + getRegistrationURL();
new UserNamePasswordDialog(ownerModule.containerOfModule(), "Sign in to "+getSystemName(), help, getRegistrationURL(), "Username", "Password", answer, usernameString, passwordString);
String registrationHint = "Touch on the web link icon on the left to register for this service.";
new UserNamePasswordDialog(ownerModule.containerOfModule(), "Sign in to "+getSystemName(), help, getRegistrationURL(), registrationHint, "Username", "Password", answer, usernameString, passwordString);
if (answer.getValue()){
setUserName(usernameString.getValue());
setPassword(passwordString.getValue());
@@ -15,23 +15,23 @@
import java.io.*;
import org.apache.commons.io.input.*;
public class MesquiteExternalProcess {
OutputStream inputToProcess;
OutputStreamWriter inputStreamsWriter;
BufferedWriter inputBufferedWriter;
StandardOutputsStreamReader errorReader;
StandardOutputsStreamReader outputReader;
FileWriter outputWriter;
FileWriter errorWriter;
OutputFileTailer errorReader;
OutputFileTailer outputReader;
Process proc;
String directoryPath;
String outputFilePath;
String errorFilePath;
MesquiteInteger errorCode;
public MesquiteExternalProcess(Process proc) {
this.proc = proc;
@@ -46,19 +46,28 @@ public Process getProcess() {
public int getErrorCode() {
if (errorCode!=null)
return errorCode.getValue();
return ShellScriptUtil.NOERROR;
return ProcessUtil.NOERROR;
}
/*.................................................................................................................*/
public void restart(String directoryPath, String outputFilePath, String errorFilePath) {
this.directoryPath = directoryPath;
this.outputFilePath = outputFilePath;
this.errorFilePath = errorFilePath;
errorCode = new MesquiteInteger(ProcessUtil.NOERROR);
}
/*.................................................................................................................*/
public void start(String directoryPath, String outputFilePath, String errorFilePath, String...command) {
this.directoryPath = directoryPath;
this.outputFilePath = outputFilePath;
this.errorFilePath = errorFilePath;
errorCode = new MesquiteInteger(ShellScriptUtil.NOERROR);
this.proc = ShellScriptUtil.startProcess(errorCode, directoryPath, outputFilePath, errorFilePath, command);
errorCode = new MesquiteInteger(ProcessUtil.NOERROR);
this.proc = ProcessUtil.startProcess(errorCode, directoryPath, outputFilePath, errorFilePath, command);
}
/*.................................................................................................................*/
@@ -73,6 +82,8 @@ public void kill () {
errorStream.close();
OutputStream outputStream = proc.getOutputStream();
outputStream.close();
endFileTailers();
} catch (IOException e) {
MesquiteMessage.println("Couldn't close streams of process.");
}
@@ -85,7 +96,7 @@ public void kill () {
}
}
}
/*.................................................................................................................*/
public int exitValue () {
if (proc!=null)
@@ -96,12 +107,7 @@ public int exitValue () {
/*.................................................................................................................*/
public void dispose() {
/* try {
if (inputBufferedWriter!=null)
inputBufferedWriter.close();
}
catch (Exception e) {
}*/
endFileTailers();
}
/*.................................................................................................................*/
@@ -115,120 +121,34 @@ public boolean processRunning() {
}
return false;
}
public void startStandardOutputsReaders(File outputFile, File errorFile) {
try {
errorWriter = new FileWriter(errorFile);
outputWriter = new FileWriter(outputFile);
}
catch (FileNotFoundException e) {
MesquiteMessage.warnProgrammer("Output file not found");
}
catch (IOException e) {
MesquiteMessage.warnProgrammer("IOException");
}
Debugg.println("\n|||||||||||||||");
Debugg.println("errorWriter: "+ errorWriter);
Debugg.println("outputWriter: "+ outputWriter);
Debugg.println("\n|||||||||||||||");
errorReader = new StandardOutputsStreamReader(proc.getErrorStream(), errorWriter);
outputReader = new StandardOutputsStreamReader(proc.getInputStream(), outputWriter);
if (errorReader!=null)
errorReader.start();
public void endFileTailers() {
if (outputReader!=null)
outputReader.start();
}
/*.................................................................................................................*
public void flushStandardOutputsReaders() {
if (fos!=null) {
try {
fos.flush();
}
catch (IOException e) {
MesquiteMessage.warnProgrammer("IOException on standard output file.");
}
}
}
public void endStandardOutputsReaders() {
if (fos!=null) {
try {
fos.close();
}
catch (IOException e) {
MesquiteMessage.warnProgrammer("IOException on standard output file.");
}
}
outputReader.stop();
if (errorReader!=null)
errorReader.stop();
}
/*.................................................................................................................*
public void sendStringToProcess(String s) {
if (proc==null)
return;
if (inputToProcess==null)
inputToProcess = proc.getOutputStream();
if (inputToProcess!=null && inputStreamsWriter==null)
inputStreamsWriter = new OutputStreamWriter(inputToProcess);
if (inputToProcess==null || inputStreamsWriter==null)
return;
if (inputBufferedWriter==null)
inputBufferedWriter = new BufferedWriter(inputStreamsWriter);
if (inputBufferedWriter==null)
return;
try {
try {
inputBufferedWriter.write(s);
} finally {
inputBufferedWriter.flush();
// inputBufferedWriter.close();
}
} catch (Exception e) {
}
public void startFileTailers(File outputFile, File errorFile) {
errorReader = new OutputFileTailer(errorFile);
outputReader = new OutputFileTailer(outputFile);
errorReader.start();
outputReader.start();
}
/*.................................................................................................................*/
}
class StandardOutputsStreamReader extends Thread {
InputStream is;
FileWriter os;
StandardOutputsStreamReader(InputStream is, FileWriter os) {
this.is = is;
this.os = os;
}
StandardOutputsStreamReader(InputStream is) {
this(is, null);
public String getStdErrContents() {
if (errorReader!=null)
return errorReader.getFileContents();
return null;
}
public void run() {
try {
/* PrintWriter pw = null;
if (os != null)
pw = new PrintWriter(os);
*/
InputStreamReader isr = new InputStreamReader(is);
BufferedReader br = new BufferedReader(isr);
String line=null;
while ( (line = br.readLine()) != null) {
if (os != null) {
os.write(line+StringUtil.lineEnding());
}
}
if (os != null) {
os.flush();
os.close();
}
} catch (IOException ioe) {
ioe.printStackTrace();
}
public String getStdOutContents() {
if (outputReader!=null)
return outputReader.getFileContents();
return null;
}
}
@@ -68,7 +68,7 @@ module is compatible with a particular condition (e.g. operating on continuous-v
/*.................................................................................................................*/
/** returns build date of the Mesquite system (e.g., "22 September 2003") */
public final static String getBuildDate() {
return "5 September 2017";
return "9 September 2017";
}
/*.................................................................................................................*/
/** returns version of the Mesquite system */
@@ -86,7 +86,7 @@ public final static String getBuildLetter() {
public final static int getBuildNumber() {
//as of 26 Dec 08, build naming changed from letter + number to just number. Accordingly j105 became 473, based on
// highest build numbers of d51+e81+g97+h66+i69+j105 + 3 for a, b, c
return 848;
return 849;
}
//0.95.80 14 Mar 01 - first beta release
//0.96 2 April 01 beta - second beta release
@@ -0,0 +1,49 @@
package mesquite.lib;
import java.io.File;
import org.apache.commons.io.input.Tailer;
import org.apache.commons.io.input.TailerListenerAdapter;
public class OutputFileTailer {
File fileToTail;
StringBuffer fileContents;
Tailer tailer;
OutputFileTailer(File fileToTail) {
this.fileToTail = fileToTail;
fileContents = new StringBuffer();
}
public void start () {
OutputFileListener listener = new OutputFileListener(this);
tailer = Tailer.create(fileToTail, listener, 500);
}
public void stop() {
if (tailer!=null)
tailer.stop();
}
public void appendToFileContents(String s) {
fileContents.append(s);
}
public String getFileContents() {
return fileContents.toString();
}
}
class OutputFileListener extends TailerListenerAdapter {
OutputFileTailer tailer;
OutputFileListener(OutputFileTailer tailer) {
this.tailer = tailer;
}
public void handle(String line) {
if (tailer != null) {
tailer.appendToFileContents(line+StringUtil.lineEnding());
}
}
}
Oops, something went wrong.

0 comments on commit 2076681

Please sign in to comment.