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;
54 import java.net.URISyntaxException;
56 import java.security.AllPermission;
57 import java.security.CodeSource;
58 import java.security.PermissionCollection;
59 import java.security.Permissions;
60 import java.security.Policy;
61 import java.util.HashMap;
63 import java.util.Vector;
65 import javax.swing.UIManager;
68 * Main class for Jalview Application <br>
70 * start with java -Djava.ext.dirs=$PATH_TO_LIB$ jalview.bin.Jalview
78 * singleton instance of this class
80 private static Jalview instance;
82 private Desktop desktop;
84 public static AlignFrame currentAlignFrame;
88 // grab all the rights we can the JVM
89 Policy.setPolicy(new Policy()
92 public PermissionCollection getPermissions(CodeSource codesource)
94 Permissions perms = new Permissions();
95 perms.add(new AllPermission());
100 public void refresh()
107 * keep track of feature fetching tasks.
115 * TODO: generalise to track all jalview events to orchestrate batch
119 private int queued = 0;
121 private int running = 0;
123 public FeatureFetcher()
128 public void addFetcher(final AlignFrame af,
129 final Vector<String> dasSources)
131 final long id = System.currentTimeMillis();
133 final FeatureFetcher us = this;
134 new Thread(new Runnable()
146 af.setProgressBar(MessageManager
147 .getString("status.das_features_being_retrived"), id);
148 af.featureSettings_actionPerformed(null);
149 af.featureSettings.fetchDasFeatures(dasSources, true);
150 af.setProgressBar(null, id);
159 public synchronized boolean allFinished()
161 return queued == 0 && running == 0;
166 public static Jalview getInstance()
172 * main class for Jalview application
175 * open <em>filename</em>
177 public static void main(String[] args)
179 instance = new Jalview();
180 instance.doMain(args);
186 void doMain(String[] args)
188 System.setSecurityManager(null);
189 System.out.println("Java version: "
190 + System.getProperty("java.version"));
191 System.out.println(System.getProperty("os.arch") + " "
192 + System.getProperty("os.name") + " "
193 + System.getProperty("os.version"));
195 ArgsParser aparser = new ArgsParser(args);
196 boolean headless = false;
198 if (aparser.contains("help") || aparser.contains("h"))
203 if (aparser.contains("nodisplay") || aparser.contains("nogui")
204 || aparser.contains("headless"))
206 System.setProperty("java.awt.headless", "true");
209 String usrPropsFile = aparser.getValue("props");
210 Cache.loadProperties(usrPropsFile); // must do this before
211 if (usrPropsFile != null)
213 System.out.println("CMD [-props " + usrPropsFile
214 + "] executed successfully!");
219 final String jabawsUrl = aparser.getValue("jabaws");
220 if (jabawsUrl != null)
224 Jws2Discoverer.getDiscoverer().setPreferredUrl(jabawsUrl);
225 System.out.println("CMD [-jabaws " + jabawsUrl
226 + "] executed successfully!");
227 } catch (MalformedURLException e)
229 System.err.println("Invalid jabaws parameter: " + jabawsUrl
234 String defs = aparser.getValue("setprop");
237 int p = defs.indexOf('=');
240 System.err.println("Ignoring invalid setprop argument : " + defs);
244 System.out.println("Executing setprop argument: " + defs);
245 // DISABLED FOR SECURITY REASONS
246 // TODO: add a property to allow properties to be overriden by cli args
247 // Cache.setProperty(defs.substring(0,p), defs.substring(p+1));
249 defs = aparser.getValue("setprop");
251 if (System.getProperty("java.awt.headless") != null
252 && System.getProperty("java.awt.headless").equals("true"))
256 System.setProperty("http.agent",
257 "Jalview Desktop/" + Cache.getDefault("VERSION", "Unknown"));
261 } catch (NoClassDefFoundError error)
263 error.printStackTrace();
265 .println("\nEssential logging libraries not found."
266 + "\nUse: java -Djava.ext.dirs=$PATH_TO_LIB$ jalview.bin.Jalview");
274 UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
275 } catch (Exception ex)
278 if (Platform.isAMac())
280 System.setProperty("com.apple.mrj.application.apple.menu.about.name",
282 System.setProperty("apple.laf.useScreenMenuBar", "true");
285 UIManager.setLookAndFeel(ch.randelshofer.quaqua.QuaquaManager
287 } catch (Throwable e)
289 System.err.println("Failed to set QuaQua look and feel: "
295 * configure 'full' SO model if preferences say to,
296 * else use the default (SO Lite)
298 if (Cache.getDefault("USE_FULL_SO", false))
300 SequenceOntologyFactory.setInstance(new SequenceOntology());
305 desktop = new Desktop();
306 desktop.setInBatchMode(true); // indicate we are starting up
307 desktop.setVisible(true);
308 desktop.startServiceDiscovery();
309 if (!aparser.contains("nousagestats"))
311 startUsageStats(desktop);
315 System.err.println("CMD [-nousagestats] executed successfully!");
318 if (!aparser.contains("noquestionnaire"))
320 String url = aparser.getValue("questionnaire");
323 // Start the desktop questionnaire prompter with the specified
325 Cache.log.debug("Starting questionnaire url at " + url);
326 desktop.checkForQuestionnaire(url);
327 System.out.println("CMD questionnaire[-" + url
328 + "] executed successfully!");
332 if (Cache.getProperty("NOQUESTIONNAIRES") == null)
334 // Start the desktop questionnaire prompter with the specified
337 // "http://anaplog.compbio.dundee.ac.uk/cgi-bin/questionnaire.pl";
339 String defurl = "http://www.jalview.org/cgi-bin/questionnaire.pl";
340 Cache.log.debug("Starting questionnaire with default url: "
342 desktop.checkForQuestionnaire(defurl);
348 System.err.println("CMD [-noquestionnaire] executed successfully!");
351 if (!aparser.contains("nonews"))
353 desktop.checkForNews();
356 BioJsHTMLOutput.updateBioJS();
359 String file = null, protocol = null, format = null, data = null;
360 FileLoader fileLoader = new FileLoader(!headless);
361 Vector<String> getFeatures = null; // vector of das source nicknames to
365 String groovyscript = null; // script to execute after all loading is
366 // completed one way or another
367 // extract groovy argument and execute if necessary
368 groovyscript = aparser.getValue("groovy", true);
369 file = aparser.getValue("open", true);
371 if (file == null && desktop == null)
373 System.out.println("No files to open!");
376 String vamsasImport = aparser.getValue("vdoc");
377 String vamsasSession = aparser.getValue("vsess");
378 if (vamsasImport != null || vamsasSession != null)
380 if (desktop == null || headless)
383 .println("Headless vamsas sessions not yet supported. Sorry.");
386 // if we have a file, start a new session and import it.
387 boolean inSession = false;
388 if (vamsasImport != null)
392 String viprotocol = AppletFormatAdapter
393 .checkProtocol(vamsasImport);
394 if (viprotocol == jalview.io.FormatAdapter.FILE)
396 inSession = desktop.vamsasImport(new File(vamsasImport));
398 else if (viprotocol == FormatAdapter.URL)
400 inSession = desktop.vamsasImport(new URL(vamsasImport));
403 } catch (Exception e)
405 System.err.println("Exeption when importing " + vamsasImport
406 + " as a vamsas document.");
411 System.err.println("Failed to import " + vamsasImport
412 + " as a vamsas document.");
416 System.out.println("Imported Successfully into new session "
417 + desktop.getVamsasApplication().getCurrentSession());
420 if (vamsasSession != null)
422 if (vamsasImport != null)
424 // close the newly imported session and import the Jalview specific
425 // remnants into the new session later on.
426 desktop.vamsasStop_actionPerformed(null);
428 // now join the new session
431 if (desktop.joinVamsasSession(vamsasSession))
433 System.out.println("Successfully joined vamsas session "
438 System.err.println("WARNING: Failed to join vamsas session "
441 } catch (Exception e)
443 System.err.println("ERROR: Failed to join vamsas session "
447 if (vamsasImport != null)
449 // the Jalview specific remnants can now be imported into the new
450 // session at the user's leisure.
452 .info("Skipping Push for import of data into existing vamsas session."); // TODO:
457 // desktop.getVamsasApplication().push_update();
462 // Finally, deal with the remaining input data.
467 desktop.setProgressBar(MessageManager
468 .getString("status.processing_commandline_args"),
469 progress = System.currentTimeMillis());
471 System.out.println("CMD [-open " + file + "] executed successfully!");
473 if (!file.startsWith("http://"))
475 if (!(new File(file)).exists())
477 System.out.println("Can't find " + file);
485 protocol = AppletFormatAdapter.checkProtocol(file);
487 format = new IdentifyFile().identify(file, protocol);
489 AlignFrame af = fileLoader.LoadFileWaitTillLoaded(file, protocol,
493 System.out.println("error");
497 setCurrentAlignFrame(af);
498 data = aparser.getValue("colour", true);
501 data.replaceAll("%20", " ");
503 ColourSchemeI cs = ColourSchemeProperty.getColour(af
504 .getViewport().getAlignment(), data);
508 UserColourScheme ucs = new UserColourScheme("white");
509 ucs.parseAppletParameter(data);
514 System.out.println("CMD [-color " + data
515 + "] executed successfully!");
520 // Must maintain ability to use the groups flag
521 data = aparser.getValue("groups", true);
524 af.parseFeaturesFile(data,
525 AppletFormatAdapter.checkProtocol(data));
526 // System.out.println("Added " + data);
527 System.out.println("CMD groups[-" + data
528 + "] executed successfully!");
530 data = aparser.getValue("features", true);
533 af.parseFeaturesFile(data,
534 AppletFormatAdapter.checkProtocol(data));
535 // System.out.println("Added " + data);
536 System.out.println("CMD [-features " + data
537 + "] executed successfully!");
540 data = aparser.getValue("annotations", true);
543 af.loadJalviewDataFile(data, null, null, null);
544 // System.out.println("Added " + data);
545 System.out.println("CMD [-annotations " + data
546 + "] executed successfully!");
548 // set or clear the sortbytree flag.
549 if (aparser.contains("sortbytree"))
551 af.getViewport().setSortByTree(true);
552 if (af.getViewport().getSortByTree())
554 System.out.println("CMD [-sortbytree] executed successfully!");
557 if (aparser.contains("no-annotation"))
559 af.getViewport().setShowAnnotation(false);
560 if (!af.getViewport().isShowAnnotation())
562 System.out.println("CMD no-annotation executed successfully!");
565 if (aparser.contains("nosortbytree"))
567 af.getViewport().setSortByTree(false);
568 if (!af.getViewport().getSortByTree())
571 .println("CMD [-nosortbytree] executed successfully!");
574 data = aparser.getValue("tree", true);
577 jalview.io.NewickFile fin = null;
580 System.out.println("CMD [-tree " + data
581 + "] executed successfully!");
582 fin = new NewickFile(data,
583 AppletFormatAdapter.checkProtocol(data));
586 af.getViewport().setCurrentTree(
587 af.ShowNewickTree(fin, data).getTree());
589 } catch (IOException ex)
591 System.err.println("Couldn't add tree " + data);
592 ex.printStackTrace(System.err);
595 // TODO - load PDB structure(s) to alignment JAL-629
596 // (associate with identical sequence in alignment, or a specified
599 getFeatures = checkDasArguments(aparser);
600 if (af != null && getFeatures != null)
602 FeatureFetcher ff = startFeatureFetching(getFeatures);
605 while (!ff.allFinished() || af.operationInProgress())
607 // wait around until fetching is finished.
611 } catch (Exception e)
617 getFeatures = null; // have retrieved features - forget them now.
619 if (groovyscript != null)
621 // Execute the groovy script after we've done all the rendering stuff
622 // and before any images or figures are generated.
623 System.out.println("Executing script " + groovyscript);
624 executeGroovyScript(groovyscript, af);
625 System.out.println("CMD groovy[" + groovyscript
626 + "] executed successfully!");
629 String imageName = "unnamed.png";
630 while (aparser.getSize() > 1)
632 format = aparser.nextValue();
633 file = aparser.nextValue();
635 if (format.equalsIgnoreCase("png"))
637 af.createPNG(new File(file));
638 imageName = (new File(file)).getName();
639 System.out.println("Creating PNG image: " + file);
642 else if (format.equalsIgnoreCase("svg"))
644 File imageFile = new File(file);
645 imageName = imageFile.getName();
646 af.createSVG(imageFile);
647 System.out.println("Creating SVG image: " + file);
650 else if (format.equalsIgnoreCase("html"))
652 File imageFile = new File(file);
653 imageName = imageFile.getName();
654 HtmlSvgOutput htmlSVG = new HtmlSvgOutput(af.alignPanel);
655 htmlSVG.exportHTML(file);
657 System.out.println("Creating HTML image: " + file);
660 else if (format.equalsIgnoreCase("biojsmsa"))
664 System.err.println("The output html file must not be null");
670 .refreshVersionInfo(BioJsHTMLOutput.BJS_TEMPLATES_LOCAL_DIRECTORY);
671 } catch (URISyntaxException e)
675 BioJsHTMLOutput bjs = new BioJsHTMLOutput(af.alignPanel);
676 bjs.exportHTML(file);
677 System.out.println("Creating BioJS MSA Viwer HTML file: "
681 else if (format.equalsIgnoreCase("imgMap"))
683 af.createImageMap(new File(file), imageName);
684 System.out.println("Creating image map: " + file);
687 else if (format.equalsIgnoreCase("eps"))
689 File outputFile = new File(file);
690 System.out.println("Creating EPS file: "
691 + outputFile.getAbsolutePath());
692 af.createEPS(outputFile);
696 if (af.saveAlignment(file, format))
698 System.out.println("Written alignment in " + format
699 + " format to " + file);
703 System.out.println("Error writing file " + file + " in "
704 + format + " format!!");
709 while (aparser.getSize() > 0)
711 System.out.println("Unknown arg: " + aparser.nextValue());
715 AlignFrame startUpAlframe = null;
716 // We'll only open the default file if the desktop is visible.
718 // ////////////////////
720 if (!headless && file == null && vamsasImport == null
721 && jalview.bin.Cache.getDefault("SHOW_STARTUP_FILE", true))
723 file = jalview.bin.Cache.getDefault(
725 jalview.bin.Cache.getDefault("www.jalview.org",
726 "http://www.jalview.org")
727 + "/examples/exampleFile_2_7.jar");
728 if (file.equals("http://www.jalview.org/examples/exampleFile_2_3.jar"))
730 // hardwire upgrade of the startup file
731 file.replace("_2_3.jar", "_2_7.jar");
732 // and remove the stale setting
733 jalview.bin.Cache.removeProperty("STARTUP_FILE");
738 if (file.indexOf("http:") > -1)
743 if (file.endsWith(".jar"))
749 format = new IdentifyFile().identify(file, protocol);
752 startUpAlframe = fileLoader.LoadFileWaitTillLoaded(file, protocol,
754 getFeatures = checkDasArguments(aparser);
755 // extract groovy arguments before anything else.
757 // If the user has specified features to be retrieved,
758 // or a groovy script to be executed, do them if they
759 // haven't been done already
760 // fetch features for the default alignment
761 if (getFeatures != null)
763 if (startUpAlframe != null)
765 startFeatureFetching(getFeatures);
768 // Once all other stuff is done, execute any groovy scripts (in order)
769 if (groovyscript != null)
771 if (Cache.groovyJarsPresent())
773 System.out.println("Executing script " + groovyscript);
774 executeGroovyScript(groovyscript, startUpAlframe);
779 .println("Sorry. Groovy Support is not available, so ignoring the provided groovy script "
783 // and finally, turn off batch mode indicator - if the desktop still exists
788 desktop.setProgressBar(null, progress);
790 desktop.setInBatchMode(false);
794 private static void showUsage()
797 .println("Usage: jalview -open [FILE] [OUTPUT_FORMAT] [OUTPUT_FILE]\n\n"
798 + "-nodisplay\tRun Jalview without User Interface.\n"
799 + "-props FILE\tUse the given Jalview properties file instead of users default.\n"
800 + "-colour COLOURSCHEME\tThe colourscheme to be applied to the alignment\n"
801 + "-annotations FILE\tAdd precalculated annotations to the alignment.\n"
802 + "-tree FILE\tLoad the given newick format tree file onto the alignment\n"
803 + "-features FILE\tUse the given file to mark features on the alignment.\n"
804 + "-fasta FILE\tCreate alignment file FILE in Fasta format.\n"
805 + "-clustal FILE\tCreate alignment file FILE in Clustal format.\n"
806 + "-pfam FILE\tCreate alignment file FILE in PFAM format.\n"
807 + "-msf FILE\tCreate alignment file FILE in MSF format.\n"
808 + "-pileup FILE\tCreate alignment file FILE in Pileup format\n"
809 + "-pir FILE\tCreate alignment file FILE in PIR format.\n"
810 + "-blc FILE\tCreate alignment file FILE in BLC format.\n"
811 + "-json FILE\tCreate alignment file FILE in JSON format.\n"
812 + "-jalview FILE\tCreate alignment file FILE in Jalview format.\n"
813 + "-png FILE\tCreate PNG image FILE from alignment.\n"
814 + "-svg FILE\tCreate SVG image FILE from alignment.\n"
815 + "-html FILE\tCreate HTML file from alignment.\n"
816 + "-biojsMSA FILE\tCreate BioJS MSA Viewer HTML file from alignment.\n"
817 + "-imgMap FILE\tCreate HTML file FILE with image map of PNG image.\n"
818 + "-eps FILE\tCreate EPS file FILE from alignment.\n"
819 + "-questionnaire URL\tQueries the given URL for information about any Jalview user questionnaires.\n"
820 + "-noquestionnaire\tTurn off questionnaire check.\n"
821 + "-nonews\tTurn off check for Jalview news.\n"
822 + "-nousagestats\tTurn off google analytics tracking for this session.\n"
823 + "-sortbytree OR -nosortbytree\tEnable or disable sorting of the given alignment by the given tree\n"
825 // "-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)"
826 + "-jabaws URL\tSpecify URL for Jabaws services (e.g. for a local installation).\n"
827 + "-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"
828 + "\t\t\tSources that also support the sequence command may be specified by prepending the URL with sequence:\n"
829 + "\t\t\t e.g. sequence:http://localdas.somewhere.org/das/source)\n"
830 + "-fetchfrom nickname\tQuery nickname for features for the alignments and display them.\n"
832 // "-vdoc vamsas-document\tImport vamsas document into new session or join existing session with same URN\n"
833 // + "-vses vamsas-session\tJoin session with given URN\n"
834 + "-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"
835 + "\n~Read documentation in Application or visit http://www.jalview.org for description of Features and Annotations file~\n\n");
838 private static void startUsageStats(final Desktop desktop)
841 * start a User Config prompt asking if we can log usage statistics.
843 PromptUserConfig prompter = new PromptUserConfig(
846 "Jalview Usage Statistics",
847 "Do you want to help make Jalview better by enabling "
848 + "the collection of usage statistics with Google Analytics ?"
849 + "\n\n(you can enable or disable usage tracking in the preferences)",
856 .debug("Initialising googletracker for usage stats.");
857 Cache.initGoogleTracker();
858 Cache.log.debug("Tracking enabled.");
865 Cache.log.debug("Not enabling Google Tracking.");
868 desktop.addDialogThread(prompter);
872 * Locate the given string as a file and pass it to the groovy interpreter.
874 * @param groovyscript
875 * the script to execute
876 * @param jalviewContext
877 * the Jalview Desktop object passed in to the groovy binding as the
880 private void executeGroovyScript(String groovyscript, AlignFrame af)
883 * for scripts contained in files
890 if (groovyscript.trim().equals("STDIN"))
892 // read from stdin into a tempfile and execute it
895 tfile = File.createTempFile("jalview", "groovy");
896 PrintWriter outfile = new PrintWriter(new OutputStreamWriter(
897 new FileOutputStream(tfile)));
898 BufferedReader br = new BufferedReader(new InputStreamReader(
901 while ((line = br.readLine()) != null)
903 outfile.write(line + "\n");
909 } catch (Exception ex)
911 System.err.println("Failed to read from STDIN into tempfile "
912 + ((tfile == null) ? "(tempfile wasn't created)" : tfile
914 ex.printStackTrace();
919 sfile = tfile.toURI().toURL();
920 } catch (Exception x)
923 .println("Unexpected Malformed URL Exception for temporary file created from STDIN: "
933 sfile = new URI(groovyscript).toURL();
934 } catch (Exception x)
936 tfile = new File(groovyscript);
939 System.err.println("File '" + groovyscript + "' does not exist.");
942 if (!tfile.canRead())
944 System.err.println("File '" + groovyscript + "' cannot be read.");
947 if (tfile.length() < 1)
949 System.err.println("File '" + groovyscript + "' is empty.");
954 sfile = tfile.getAbsoluteFile().toURI().toURL();
955 } catch (Exception ex)
957 System.err.println("Failed to create a file URL for "
958 + tfile.getAbsoluteFile());
965 Map<String, Object> vbinding = new HashMap<String, Object>();
966 vbinding.put("Jalview", this);
969 vbinding.put("currentAlFrame", af);
971 Binding gbinding = new Binding(vbinding);
972 GroovyScriptEngine gse = new GroovyScriptEngine(new URL[] { sfile });
973 gse.run(sfile.toString(), gbinding);
974 if ("STDIN".equals(groovyscript))
976 // delete temp file that we made -
977 // only if it was successfully executed
980 } catch (Exception e)
982 System.err.println("Exception Whilst trying to execute file " + sfile
983 + " as a groovy script.");
984 e.printStackTrace(System.err);
990 * Check commandline for any das server definitions or any fetchfrom switches
992 * @return vector of DAS source nicknames to retrieve from
994 private static Vector<String> checkDasArguments(ArgsParser aparser)
996 Vector<String> source = null;
998 String locsources = Cache.getProperty(Cache.DAS_LOCAL_SOURCE);
999 while ((data = aparser.getValue("dasserver", true)) != null)
1001 String nickname = null;
1003 int pos = data.indexOf('=');
1004 // determine capabilities
1007 nickname = data.substring(0, pos);
1009 url = data.substring(pos + 1);
1011 && (url.startsWith("http:") || url
1012 .startsWith("sequence:http:")))
1014 if (nickname == null)
1018 if (locsources == null)
1026 locsources = locsources + nickname + "|" + url;
1028 .println("NOTE! dasserver parameter not yet really supported (got args of "
1029 + nickname + "|" + url);
1032 source = new Vector<String>();
1034 source.addElement(nickname);
1036 System.out.println("CMD [-dasserver " + data
1037 + "] executed successfully!");
1038 } // loop until no more server entries are found.
1039 if (locsources != null && locsources.indexOf('|') > -1)
1041 Cache.log.debug("Setting local source list in properties file to:\n"
1043 Cache.setProperty(Cache.DAS_LOCAL_SOURCE, locsources);
1045 while ((data = aparser.getValue("fetchfrom", true)) != null)
1047 System.out.println("adding source '" + data + "'");
1050 source = new Vector<String>();
1052 source.addElement(data);
1058 * start a feature fetcher for every alignment frame
1062 private FeatureFetcher startFeatureFetching(
1063 final Vector<String> dasSources)
1065 FeatureFetcher ff = new FeatureFetcher();
1066 AlignFrame afs[] = Desktop.getAlignFrames();
1067 if (afs == null || afs.length == 0)
1071 for (int i = 0; i < afs.length; i++)
1073 ff.addFetcher(afs[i], dasSources);
1078 public static boolean isHeadlessMode()
1080 String isheadless = System.getProperty("java.awt.headless");
1081 if (isheadless != null && isheadless.equalsIgnoreCase("true"))
1088 public AlignFrame[] getAlignFrames()
1090 return desktop == null ? new AlignFrame[] { getCurrentAlignFrame() }
1091 : Desktop.getAlignFrames();
1096 * Quit method delegates to Desktop.quit - unless running in headless mode
1097 * when it just ends the JVM
1101 if (desktop != null)
1111 public static AlignFrame getCurrentAlignFrame()
1113 return Jalview.currentAlignFrame;
1116 public static void setCurrentAlignFrame(AlignFrame currentAlignFrame)
1118 Jalview.currentAlignFrame = currentAlignFrame;