2 * Jalview - A Sequence Alignment Editor and Viewer ($$Version-Rel$$)
3 * Copyright (C) $$Year-Rel$$ The Jalview Authors
5 * This file is part of Jalview.
7 * Jalview is free software: you can redistribute it and/or
8 * modify it under the terms of the GNU General Public License
9 * as published by the Free Software Foundation, either version 3
10 * of the License, or (at your option) any later version.
12 * Jalview is distributed in the hope that it will be useful, but
13 * WITHOUT ANY WARRANTY; without even the implied warranty
14 * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
15 * PURPOSE. See the GNU General Public License for more details.
17 * You should have received a copy of the GNU General Public License
18 * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
19 * The Jalview Authors are detailed in the 'AUTHORS' file.
23 import groovy.lang.Binding;
24 import groovy.util.GroovyScriptEngine;
26 import jalview.ext.so.SequenceOntology;
27 import jalview.gui.AlignFrame;
28 import jalview.gui.Desktop;
29 import jalview.gui.PromptUserConfig;
30 import jalview.io.AppletFormatAdapter;
31 import jalview.io.BioJsHTMLOutput;
32 import jalview.io.FileLoader;
33 import jalview.io.FormatAdapter;
34 import jalview.io.HtmlSvgOutput;
35 import jalview.io.IdentifyFile;
36 import jalview.io.NewickFile;
37 import jalview.io.gff.SequenceOntologyFactory;
38 import jalview.schemes.ColourSchemeI;
39 import jalview.schemes.ColourSchemeProperty;
40 import jalview.schemes.UserColourScheme;
41 import jalview.util.MessageManager;
42 import jalview.util.Platform;
43 import jalview.ws.jws2.Jws2Discoverer;
45 import java.io.BufferedReader;
47 import java.io.FileOutputStream;
48 import java.io.IOException;
49 import java.io.InputStreamReader;
50 import java.io.OutputStreamWriter;
51 import java.io.PrintWriter;
52 import java.net.MalformedURLException;
55 import java.security.AllPermission;
56 import java.security.CodeSource;
57 import java.security.PermissionCollection;
58 import java.security.Permissions;
59 import java.security.Policy;
60 import java.util.HashMap;
62 import java.util.Vector;
64 import javax.swing.UIManager;
67 * Main class for Jalview Application <br>
69 * start with java -Djava.ext.dirs=$PATH_TO_LIB$ jalview.bin.Jalview
77 * singleton instance of this class
79 private static Jalview instance;
81 private Desktop desktop;
83 public static AlignFrame currentAlignFrame;
87 // grab all the rights we can the JVM
88 Policy.setPolicy(new Policy()
91 public PermissionCollection getPermissions(CodeSource codesource)
93 Permissions perms = new Permissions();
94 perms.add(new AllPermission());
106 * keep track of feature fetching tasks.
114 * TODO: generalise to track all jalview events to orchestrate batch
118 private int queued = 0;
120 private int running = 0;
122 public FeatureFetcher()
127 public void addFetcher(final AlignFrame af,
128 final Vector<String> dasSources)
130 final long id = System.currentTimeMillis();
132 final FeatureFetcher us = this;
133 new Thread(new Runnable()
145 af.setProgressBar(MessageManager
146 .getString("status.das_features_being_retrived"), id);
147 af.featureSettings_actionPerformed(null);
148 af.featureSettings.fetchDasFeatures(dasSources, true);
149 af.setProgressBar(null, id);
158 public synchronized boolean allFinished()
160 return queued == 0 && running == 0;
165 public static Jalview getInstance()
171 * main class for Jalview application
174 * open <em>filename</em>
176 public static void main(String[] args)
178 instance = new Jalview();
179 instance.doMain(args);
185 void doMain(String[] args)
187 System.setSecurityManager(null);
188 System.out.println("Java version: "
189 + System.getProperty("java.version"));
190 System.out.println(System.getProperty("os.arch") + " "
191 + System.getProperty("os.name") + " "
192 + System.getProperty("os.version"));
194 ArgsParser aparser = new ArgsParser(args);
195 boolean headless = false;
197 if (aparser.contains("help") || aparser.contains("h"))
202 if (aparser.contains("nodisplay") || aparser.contains("nogui")
203 || aparser.contains("headless"))
205 System.setProperty("java.awt.headless", "true");
208 String usrPropsFile = aparser.getValue("props");
209 Cache.loadProperties(usrPropsFile); // must do this before
210 if (usrPropsFile != null)
212 System.out.println("CMD [-props " + usrPropsFile
213 + "] executed successfully!");
218 final String jabawsUrl = aparser.getValue("jabaws");
219 if (jabawsUrl != null)
223 Jws2Discoverer.getDiscoverer().setPreferredUrl(jabawsUrl);
224 System.out.println("CMD [-jabaws " + jabawsUrl
225 + "] executed successfully!");
226 } catch (MalformedURLException e)
228 System.err.println("Invalid jabaws parameter: " + jabawsUrl
233 String defs = aparser.getValue("setprop");
236 int p = defs.indexOf('=');
239 System.err.println("Ignoring invalid setprop argument : " + defs);
243 System.out.println("Executing setprop argument: " + defs);
244 // DISABLED FOR SECURITY REASONS
245 // TODO: add a property to allow properties to be overriden by cli args
246 // Cache.setProperty(defs.substring(0,p), defs.substring(p+1));
248 defs = aparser.getValue("setprop");
250 if (System.getProperty("java.awt.headless") != null
251 && System.getProperty("java.awt.headless").equals("true"))
255 System.setProperty("http.agent",
256 "Jalview Desktop/" + Cache.getDefault("VERSION", "Unknown"));
260 } catch (NoClassDefFoundError error)
262 error.printStackTrace();
264 .println("\nEssential logging libraries not found."
265 + "\nUse: java -Djava.ext.dirs=$PATH_TO_LIB$ jalview.bin.Jalview");
273 UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
274 } catch (Exception ex)
277 if (Platform.isAMac())
279 System.setProperty("com.apple.mrj.application.apple.menu.about.name",
281 System.setProperty("apple.laf.useScreenMenuBar", "true");
284 UIManager.setLookAndFeel(ch.randelshofer.quaqua.QuaquaManager
286 } catch (Throwable e)
288 System.err.println("Failed to set QuaQua look and feel: "
294 * configure 'full' SO model if preferences say to,
295 * else use the default (SO Lite)
297 if (Cache.getDefault("USE_FULL_SO", false))
299 SequenceOntologyFactory.setInstance(new SequenceOntology());
304 desktop = new Desktop();
305 desktop.setInBatchMode(true); // indicate we are starting up
306 desktop.setVisible(true);
307 desktop.startServiceDiscovery();
308 if (!aparser.contains("nousagestats"))
310 startUsageStats(desktop);
314 System.err.println("CMD [-nousagestats] executed successfully!");
317 if (!aparser.contains("noquestionnaire"))
319 String url = aparser.getValue("questionnaire");
322 // Start the desktop questionnaire prompter with the specified
324 Cache.log.debug("Starting questionnaire url at " + url);
325 desktop.checkForQuestionnaire(url);
326 System.out.println("CMD questionnaire[-" + url
327 + "] executed successfully!");
331 if (Cache.getProperty("NOQUESTIONNAIRES") == null)
333 // Start the desktop questionnaire prompter with the specified
336 // "http://anaplog.compbio.dundee.ac.uk/cgi-bin/questionnaire.pl";
338 String defurl = "http://www.jalview.org/cgi-bin/questionnaire.pl";
339 Cache.log.debug("Starting questionnaire with default url: "
341 desktop.checkForQuestionnaire(defurl);
347 System.err.println("CMD [-noquestionnaire] executed successfully!");
350 if (!aparser.contains("nonews"))
352 desktop.checkForNews();
355 BioJsHTMLOutput.updateBioJS();
358 String file = null, protocol = null, format = null, data = null;
359 FileLoader fileLoader = new FileLoader(!headless);
360 Vector<String> getFeatures = null; // vector of das source nicknames to
364 String groovyscript = null; // script to execute after all loading is
365 // completed one way or another
366 // extract groovy argument and execute if necessary
367 groovyscript = aparser.getValue("groovy", true);
368 file = aparser.getValue("open", true);
370 if (file == null && desktop == null)
372 System.out.println("No files to open!");
375 String vamsasImport = aparser.getValue("vdoc");
376 String vamsasSession = aparser.getValue("vsess");
377 if (vamsasImport != null || vamsasSession != null)
379 if (desktop == null || headless)
382 .println("Headless vamsas sessions not yet supported. Sorry.");
385 // if we have a file, start a new session and import it.
386 boolean inSession = false;
387 if (vamsasImport != null)
391 String viprotocol = AppletFormatAdapter
392 .checkProtocol(vamsasImport);
393 if (viprotocol == jalview.io.FormatAdapter.FILE)
395 inSession = desktop.vamsasImport(new File(vamsasImport));
397 else if (viprotocol == FormatAdapter.URL)
399 inSession = desktop.vamsasImport(new URL(vamsasImport));
402 } catch (Exception e)
404 System.err.println("Exeption when importing " + vamsasImport
405 + " as a vamsas document.");
410 System.err.println("Failed to import " + vamsasImport
411 + " as a vamsas document.");
415 System.out.println("Imported Successfully into new session "
416 + desktop.getVamsasApplication().getCurrentSession());
419 if (vamsasSession != null)
421 if (vamsasImport != null)
423 // close the newly imported session and import the Jalview specific
424 // remnants into the new session later on.
425 desktop.vamsasStop_actionPerformed(null);
427 // now join the new session
430 if (desktop.joinVamsasSession(vamsasSession))
432 System.out.println("Successfully joined vamsas session "
437 System.err.println("WARNING: Failed to join vamsas session "
440 } catch (Exception e)
442 System.err.println("ERROR: Failed to join vamsas session "
446 if (vamsasImport != null)
448 // the Jalview specific remnants can now be imported into the new
449 // session at the user's leisure.
451 .info("Skipping Push for import of data into existing vamsas session."); // TODO:
456 // desktop.getVamsasApplication().push_update();
461 // Finally, deal with the remaining input data.
466 desktop.setProgressBar(MessageManager
467 .getString("status.processing_commandline_args"),
468 progress = System.currentTimeMillis());
470 System.out.println("CMD [-open " + file + "] executed successfully!");
472 if (!file.startsWith("http://"))
474 if (!(new File(file)).exists())
476 System.out.println("Can't find " + file);
484 protocol = AppletFormatAdapter.checkProtocol(file);
486 format = new IdentifyFile().identify(file, protocol);
488 AlignFrame af = fileLoader.LoadFileWaitTillLoaded(file, protocol,
492 System.out.println("error");
496 setCurrentAlignFrame(af);
497 data = aparser.getValue("colour", true);
500 data.replaceAll("%20", " ");
502 ColourSchemeI cs = ColourSchemeProperty.getColour(af
503 .getViewport().getAlignment(), data);
507 UserColourScheme ucs = new UserColourScheme("white");
508 ucs.parseAppletParameter(data);
513 System.out.println("CMD [-color " + data
514 + "] executed successfully!");
519 // Must maintain ability to use the groups flag
520 data = aparser.getValue("groups", true);
523 af.parseFeaturesFile(data,
524 AppletFormatAdapter.checkProtocol(data));
525 // System.out.println("Added " + data);
526 System.out.println("CMD groups[-" + data
527 + "] executed successfully!");
529 data = aparser.getValue("features", true);
532 af.parseFeaturesFile(data,
533 AppletFormatAdapter.checkProtocol(data));
534 // System.out.println("Added " + data);
535 System.out.println("CMD [-features " + data
536 + "] executed successfully!");
539 data = aparser.getValue("annotations", true);
542 af.loadJalviewDataFile(data, null, null, null);
543 // System.out.println("Added " + data);
544 System.out.println("CMD [-annotations " + data
545 + "] executed successfully!");
547 // set or clear the sortbytree flag.
548 if (aparser.contains("sortbytree"))
550 af.getViewport().setSortByTree(true);
551 if (af.getViewport().getSortByTree())
553 System.out.println("CMD [-sortbytree] executed successfully!");
556 if (aparser.contains("no-annotation"))
558 af.getViewport().setShowAnnotation(false);
559 if (!af.getViewport().isShowAnnotation())
561 System.out.println("CMD no-annotation executed successfully!");
564 if (aparser.contains("nosortbytree"))
566 af.getViewport().setSortByTree(false);
567 if (!af.getViewport().getSortByTree())
570 .println("CMD [-nosortbytree] executed successfully!");
573 data = aparser.getValue("tree", true);
576 jalview.io.NewickFile fin = null;
579 System.out.println("CMD [-tree " + data
580 + "] executed successfully!");
581 fin = new NewickFile(data,
582 AppletFormatAdapter.checkProtocol(data));
585 af.getViewport().setCurrentTree(
586 af.ShowNewickTree(fin, data).getTree());
588 } catch (IOException ex)
590 System.err.println("Couldn't add tree " + data);
591 ex.printStackTrace(System.err);
594 // TODO - load PDB structure(s) to alignment JAL-629
595 // (associate with identical sequence in alignment, or a specified
598 getFeatures = checkDasArguments(aparser);
599 if (af != null && getFeatures != null)
601 FeatureFetcher ff = startFeatureFetching(getFeatures);
604 while (!ff.allFinished() || af.operationInProgress())
606 // wait around until fetching is finished.
610 } catch (Exception e)
616 getFeatures = null; // have retrieved features - forget them now.
618 if (groovyscript != null)
620 // Execute the groovy script after we've done all the rendering stuff
621 // and before any images or figures are generated.
622 System.out.println("Executing script " + groovyscript);
623 executeGroovyScript(groovyscript, af);
624 System.out.println("CMD groovy[" + groovyscript
625 + "] executed successfully!");
628 String imageName = "unnamed.png";
629 while (aparser.getSize() > 1)
631 format = aparser.nextValue();
632 file = aparser.nextValue();
634 if (format.equalsIgnoreCase("png"))
636 af.createPNG(new File(file));
637 imageName = (new File(file)).getName();
638 System.out.println("Creating PNG image: " + file);
641 else if (format.equalsIgnoreCase("svg"))
643 File imageFile = new File(file);
644 imageName = imageFile.getName();
645 af.createSVG(imageFile);
646 System.out.println("Creating SVG image: " + file);
649 else if (format.equalsIgnoreCase("html"))
651 File imageFile = new File(file);
652 imageName = imageFile.getName();
653 HtmlSvgOutput htmlSVG = new HtmlSvgOutput(af.alignPanel);
654 htmlSVG.generateHtmlSvgOutput(new File(file));
656 System.out.println("Creating HTML image: " + file);
659 else if (format.equalsIgnoreCase("biojsmsa"))
661 BioJsHTMLOutput.updateBioJS();
665 } catch (InterruptedException e)
669 BioJsHTMLOutput bjs = new BioJsHTMLOutput(af.alignPanel, af);
670 bjs.exportJalviewAlignmentAsBioJsHtmlFile(file);
671 System.out.println("Creating BioJS MSA Viwer HTML file: "
675 else if (format.equalsIgnoreCase("imgMap"))
677 af.createImageMap(new File(file), imageName);
678 System.out.println("Creating image map: " + file);
681 else if (format.equalsIgnoreCase("eps"))
683 File outputFile = new File(file);
684 System.out.println("Creating EPS file: "
685 + outputFile.getAbsolutePath());
686 af.createEPS(outputFile);
690 if (af.saveAlignment(file, format))
692 System.out.println("Written alignment in " + format
693 + " format to " + file);
697 System.out.println("Error writing file " + file + " in "
698 + format + " format!!");
703 while (aparser.getSize() > 0)
705 System.out.println("Unknown arg: " + aparser.nextValue());
709 AlignFrame startUpAlframe = null;
710 // We'll only open the default file if the desktop is visible.
712 // ////////////////////
714 if (!headless && file == null && vamsasImport == null
715 && jalview.bin.Cache.getDefault("SHOW_STARTUP_FILE", true))
717 file = jalview.bin.Cache.getDefault(
719 jalview.bin.Cache.getDefault("www.jalview.org",
720 "http://www.jalview.org")
721 + "/examples/exampleFile_2_7.jar");
722 if (file.equals("http://www.jalview.org/examples/exampleFile_2_3.jar"))
724 // hardwire upgrade of the startup file
725 file.replace("_2_3.jar", "_2_7.jar");
726 // and remove the stale setting
727 jalview.bin.Cache.removeProperty("STARTUP_FILE");
732 if (file.indexOf("http:") > -1)
737 if (file.endsWith(".jar"))
743 format = new IdentifyFile().identify(file, protocol);
746 startUpAlframe = fileLoader.LoadFileWaitTillLoaded(file, protocol,
748 getFeatures = checkDasArguments(aparser);
749 // extract groovy arguments before anything else.
751 // If the user has specified features to be retrieved,
752 // or a groovy script to be executed, do them if they
753 // haven't been done already
754 // fetch features for the default alignment
755 if (getFeatures != null)
757 if (startUpAlframe != null)
759 startFeatureFetching(getFeatures);
762 // Once all other stuff is done, execute any groovy scripts (in order)
763 if (groovyscript != null)
765 if (Cache.groovyJarsPresent())
767 System.out.println("Executing script " + groovyscript);
768 executeGroovyScript(groovyscript, startUpAlframe);
773 .println("Sorry. Groovy Support is not available, so ignoring the provided groovy script "
777 // and finally, turn off batch mode indicator - if the desktop still exists
782 desktop.setProgressBar(null, progress);
784 desktop.setInBatchMode(false);
788 private static void showUsage()
791 .println("Usage: jalview -open [FILE] [OUTPUT_FORMAT] [OUTPUT_FILE]\n\n"
792 + "-nodisplay\tRun Jalview without User Interface.\n"
793 + "-props FILE\tUse the given Jalview properties file instead of users default.\n"
794 + "-colour COLOURSCHEME\tThe colourscheme to be applied to the alignment\n"
795 + "-annotations FILE\tAdd precalculated annotations to the alignment.\n"
796 + "-tree FILE\tLoad the given newick format tree file onto the alignment\n"
797 + "-features FILE\tUse the given file to mark features on the alignment.\n"
798 + "-fasta FILE\tCreate alignment file FILE in Fasta format.\n"
799 + "-clustal FILE\tCreate alignment file FILE in Clustal format.\n"
800 + "-pfam FILE\tCreate alignment file FILE in PFAM format.\n"
801 + "-msf FILE\tCreate alignment file FILE in MSF format.\n"
802 + "-pileup FILE\tCreate alignment file FILE in Pileup format\n"
803 + "-pir FILE\tCreate alignment file FILE in PIR format.\n"
804 + "-blc FILE\tCreate alignment file FILE in BLC format.\n"
805 + "-json FILE\tCreate alignment file FILE in JSON format.\n"
806 + "-jalview FILE\tCreate alignment file FILE in Jalview format.\n"
807 + "-png FILE\tCreate PNG image FILE from alignment.\n"
808 + "-svg FILE\tCreate SVG image FILE from alignment.\n"
809 + "-html FILE\tCreate HTML file from alignment.\n"
810 + "-biojsMSA FILE\tCreate BioJS MSA Viewer HTML file from alignment.\n"
811 + "-imgMap FILE\tCreate HTML file FILE with image map of PNG image.\n"
812 + "-eps FILE\tCreate EPS file FILE from alignment.\n"
813 + "-questionnaire URL\tQueries the given URL for information about any Jalview user questionnaires.\n"
814 + "-noquestionnaire\tTurn off questionnaire check.\n"
815 + "-nonews\tTurn off check for Jalview news.\n"
816 + "-nousagestats\tTurn off google analytics tracking for this session.\n"
817 + "-sortbytree OR -nosortbytree\tEnable or disable sorting of the given alignment by the given tree\n"
819 // "-setprop PROPERTY=VALUE\tSet the given Jalview property, after all other properties files have been read\n\t (quote the 'PROPERTY=VALUE' pair to ensure spaces are passed in correctly)"
820 + "-jabaws URL\tSpecify URL for Jabaws services (e.g. for a local installation).\n"
821 + "-dasserver nickname=URL\tAdd and enable a das server with given nickname\n\t\t\t(alphanumeric or underscores only) for retrieval of features for all alignments.\n"
822 + "\t\t\tSources that also support the sequence command may be specified by prepending the URL with sequence:\n"
823 + "\t\t\t e.g. sequence:http://localdas.somewhere.org/das/source)\n"
824 + "-fetchfrom nickname\tQuery nickname for features for the alignments and display them.\n"
826 // "-vdoc vamsas-document\tImport vamsas document into new session or join existing session with same URN\n"
827 // + "-vses vamsas-session\tJoin session with given URN\n"
828 + "-groovy FILE\tExecute groovy script in FILE, after all other arguments have been processed (if FILE is the text 'STDIN' then the file will be read from STDIN)\n"
829 + "\n~Read documentation in Application or visit http://www.jalview.org for description of Features and Annotations file~\n\n");
832 private static void startUsageStats(final Desktop desktop)
835 * start a User Config prompt asking if we can log usage statistics.
837 PromptUserConfig prompter = new PromptUserConfig(
840 "Jalview Usage Statistics",
841 "Do you want to help make Jalview better by enabling "
842 + "the collection of usage statistics with Google Analytics ?"
843 + "\n\n(you can enable or disable usage tracking in the preferences)",
850 .debug("Initialising googletracker for usage stats.");
851 Cache.initGoogleTracker();
852 Cache.log.debug("Tracking enabled.");
859 Cache.log.debug("Not enabling Google Tracking.");
862 desktop.addDialogThread(prompter);
866 * Locate the given string as a file and pass it to the groovy interpreter.
868 * @param groovyscript
869 * the script to execute
870 * @param jalviewContext
871 * the Jalview Desktop object passed in to the groovy binding as the
874 private void executeGroovyScript(String groovyscript, AlignFrame af)
877 * for scripts contained in files
884 if (groovyscript.trim().equals("STDIN"))
886 // read from stdin into a tempfile and execute it
889 tfile = File.createTempFile("jalview", "groovy");
890 PrintWriter outfile = new PrintWriter(new OutputStreamWriter(
891 new FileOutputStream(tfile)));
892 BufferedReader br = new BufferedReader(new InputStreamReader(
895 while ((line = br.readLine()) != null)
897 outfile.write(line + "\n");
903 } catch (Exception ex)
905 System.err.println("Failed to read from STDIN into tempfile "
906 + ((tfile == null) ? "(tempfile wasn't created)" : tfile
908 ex.printStackTrace();
913 sfile = tfile.toURI().toURL();
914 } catch (Exception x)
917 .println("Unexpected Malformed URL Exception for temporary file created from STDIN: "
927 sfile = new URI(groovyscript).toURL();
928 } catch (Exception x)
930 tfile = new File(groovyscript);
933 System.err.println("File '" + groovyscript + "' does not exist.");
936 if (!tfile.canRead())
938 System.err.println("File '" + groovyscript + "' cannot be read.");
941 if (tfile.length() < 1)
943 System.err.println("File '" + groovyscript + "' is empty.");
948 sfile = tfile.getAbsoluteFile().toURI().toURL();
949 } catch (Exception ex)
951 System.err.println("Failed to create a file URL for "
952 + tfile.getAbsoluteFile());
959 Map<String, Object> vbinding = new HashMap<String, Object>();
960 vbinding.put("Jalview", this);
963 vbinding.put("currentAlFrame", af);
965 Binding gbinding = new Binding(vbinding);
966 GroovyScriptEngine gse = new GroovyScriptEngine(new URL[] { sfile });
967 gse.run(sfile.toString(), gbinding);
968 if ("STDIN".equals(groovyscript))
970 // delete temp file that we made -
971 // only if it was successfully executed
974 } catch (Exception e)
976 System.err.println("Exception Whilst trying to execute file " + sfile
977 + " as a groovy script.");
978 e.printStackTrace(System.err);
984 * Check commandline for any das server definitions or any fetchfrom switches
986 * @return vector of DAS source nicknames to retrieve from
988 private static Vector<String> checkDasArguments(ArgsParser aparser)
990 Vector<String> source = null;
992 String locsources = Cache.getProperty(Cache.DAS_LOCAL_SOURCE);
993 while ((data = aparser.getValue("dasserver", true)) != null)
995 String nickname = null;
997 int pos = data.indexOf('=');
998 // determine capabilities
1001 nickname = data.substring(0, pos);
1003 url = data.substring(pos + 1);
1005 && (url.startsWith("http:") || url
1006 .startsWith("sequence:http:")))
1008 if (nickname == null)
1012 if (locsources == null)
1020 locsources = locsources + nickname + "|" + url;
1022 .println("NOTE! dasserver parameter not yet really supported (got args of "
1023 + nickname + "|" + url);
1026 source = new Vector<String>();
1028 source.addElement(nickname);
1030 System.out.println("CMD [-dasserver " + data
1031 + "] executed successfully!");
1032 } // loop until no more server entries are found.
1033 if (locsources != null && locsources.indexOf('|') > -1)
1035 Cache.log.debug("Setting local source list in properties file to:\n"
1037 Cache.setProperty(Cache.DAS_LOCAL_SOURCE, locsources);
1039 while ((data = aparser.getValue("fetchfrom", true)) != null)
1041 System.out.println("adding source '" + data + "'");
1044 source = new Vector<String>();
1046 source.addElement(data);
1052 * start a feature fetcher for every alignment frame
1056 private FeatureFetcher startFeatureFetching(
1057 final Vector<String> dasSources)
1059 FeatureFetcher ff = new FeatureFetcher();
1060 AlignFrame afs[] = Desktop.getAlignFrames();
1061 if (afs == null || afs.length == 0)
1065 for (int i = 0; i < afs.length; i++)
1067 ff.addFetcher(afs[i], dasSources);
1072 public static boolean isHeadlessMode()
1074 String isheadless = System.getProperty("java.awt.headless");
1075 if (isheadless != null && isheadless.equalsIgnoreCase("true"))
1082 public AlignFrame[] getAlignFrames()
1084 return desktop == null ? new AlignFrame[] { getCurrentAlignFrame() }
1085 : Desktop.getAlignFrames();
1090 * Quit method delegates to Desktop.quit - unless running in headless mode
1091 * when it just ends the JVM
1095 if (desktop != null)
1105 public static AlignFrame getCurrentAlignFrame()
1107 return Jalview.currentAlignFrame;
1110 public static void setCurrentAlignFrame(AlignFrame currentAlignFrame)
1112 Jalview.currentAlignFrame = currentAlignFrame;