X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;f=src%2Fext%2Fedu%2Fucsf%2Frbvi%2Fstrucviz2%2FChimeraManager.java;h=2c40e1ce271b60cf181da4b11446da1764b7a4ab;hb=31f1b88951cc5ff3aea7ae0bc1a9d8fbdd264ea3;hp=b45404e964e92e732e08dd3fc7465108b18303aa;hpb=95e0cdd0a7da15cad5d1d3adbb621419d84e135a;p=jalview.git diff --git a/src/ext/edu/ucsf/rbvi/strucviz2/ChimeraManager.java b/src/ext/edu/ucsf/rbvi/strucviz2/ChimeraManager.java index b45404e..2c40e1c 100644 --- a/src/ext/edu/ucsf/rbvi/strucviz2/ChimeraManager.java +++ b/src/ext/edu/ucsf/rbvi/strucviz2/ChimeraManager.java @@ -29,12 +29,6 @@ public class ChimeraManager { private static final boolean debug = false; - /* - * true: use REST API (recommended), false: use stdout/stdin (deprecated) - */ - // TODO remove once definitely happy with using REST - private static final boolean USE_REST = true; - private int chimeraRestPort; private Process chimera; @@ -224,10 +218,14 @@ public class ChimeraManager modelNumbers[0], modelNumbers[1]); currentModelsMap.put(modelNumber, newModel); models.add(newModel); + + // // patch for Jalview - set model name in Chimera + // sendChimeraCommand("setattr M name " + modelName + " #" + modelNumbers[0], false); // end patch for Jalview + modelNumbers = null; } } @@ -370,15 +368,7 @@ public class ChimeraManager { chimera = null; currentModelsMap.clear(); - if (USE_REST) - { this.chimeraRestPort = 0; - } - else - { - chimeraListenerThread.requestStop(); - chimeraListenerThread = null; - } structureManager.clearOnChimeraExit(); } @@ -549,13 +539,11 @@ public class ChimeraManager List args = new ArrayList(); args.add(chimeraPath); args.add("--start"); - args.add(USE_REST ? "RESTServer" : "ReadStdin"); + args.add("RESTServer"); ProcessBuilder pb = new ProcessBuilder(args); chimera = pb.start(); error = ""; workingPath = chimeraPath; - logger.info("Starting " + chimeraPath + " with " - + (USE_REST ? "REST API" : "stdin/stdout")); break; } catch (Exception e) { @@ -566,18 +554,9 @@ public class ChimeraManager // If no error, then Chimera was launched successfully if (error.length() == 0) { - if (USE_REST) - { - this.chimeraRestPort = getPortNumber(); - System.out.println("Chimera REST API on port " + chimeraRestPort); - } - else - { - // Initialize the listener threads - chimeraListenerThread = new ListenerThreads(chimera, - structureManager); - chimeraListenerThread.start(); - } + this.chimeraRestPort = getPortNumber(); + System.out.println("Chimera REST API started on port " + + chimeraRestPort); // structureManager.initChimTable(); structureManager.setChimeraPathProperty(workingPath); // TODO: [Optional] Check Chimera version and show a warning if below 1.8 @@ -766,22 +745,17 @@ public class ChimeraManager } catch (InterruptedException q) { } - ; } busy = true; long startTime = System.currentTimeMillis(); try { - if (USE_REST) - { - return sendRestCommand(command); - } - else - { - return sendStdinCommand(command, reply); - } + return sendRestCommand(command); } finally { + /* + * Make sure busy flag is reset come what may! + */ busy = false; if (debug) {