From: Jim Procter Date: Tue, 26 Jun 2018 15:38:14 +0000 (+0100) Subject: Merge branch 'tasks/JAL-3035_remove_dasobert_dependency' into Jalview-BH/JAL-3026 X-Git-Tag: Develop-2_11_2_0-d20201215~24^2~68^2~629^2~2^2~2 X-Git-Url: http://source.jalview.org/gitweb/?a=commitdiff_plain;h=66b1a1e003d38ea506f87c42173bb5de37b38edc;hp=-c;p=jalview.git Merge branch 'tasks/JAL-3035_remove_dasobert_dependency' into Jalview-BH/JAL-3026 --- 66b1a1e003d38ea506f87c42173bb5de37b38edc diff --combined src/jalview/bin/Cache.java index d374682,83bc810..1f031b2 --- a/src/jalview/bin/Cache.java +++ b/src/jalview/bin/Cache.java @@@ -28,8 -28,6 +28,6 @@@ import jalview.schemes.UserColourScheme import jalview.structure.StructureImportSettings; import jalview.urls.IdOrgSettings; import jalview.util.ColorUtils; - import jalview.ws.dbsources.das.api.DasSourceRegistryI; - import jalview.ws.dbsources.das.datamodel.DasSourceRegistry; import jalview.ws.sifts.SiftsSettings; import java.awt.Color; @@@ -288,8 -286,7 +286,8 @@@ public class Cach /** Default file is ~/.jalview_properties */ static String propertiesFile; - private static boolean propsAreReadOnly = false; + private static boolean propsAreReadOnly = /** @j2sNative true || */ + false; public static void initLogger() { @@@ -400,8 -397,7 +398,8 @@@ // LOAD THE AUTHORS FROM THE authors.props file try { - String authorDetails = "jar:" + String authorDetails = /** @j2sNative "xxx" || */ + "jar:" .concat(Cache.class.getProtectionDomain().getCodeSource() .getLocation().toString().concat("!/authors.props")); @@@ -423,8 -419,7 +421,8 @@@ // VERSION MAY HAVE CHANGED SINCE LAST USING JALVIEW try { - String buildDetails = "jar:".concat(Cache.class.getProtectionDomain() + String buildDetails = /** @j2sNative "xxx" || */ + "jar:".concat(Cache.class.getProtectionDomain() .getCodeSource().getLocation().toString() .concat("!/.build_properties")); @@@ -985,22 -980,6 +983,6 @@@ return null; } - private static DasSourceRegistryI sourceRegistry = null; - - /** - * initialise and .. - * - * @return instance of the das source registry - */ - public static DasSourceRegistryI getDasSourceRegistry() - { - if (sourceRegistry == null) - { - sourceRegistry = new DasSourceRegistry(); - } - return sourceRegistry; - } - /** * Set the specified value, or remove it if null or empty. Does not save the * properties file. diff --combined src/jalview/bin/Jalview.java index 0d7143d,ea2f1d6..018adb1 --- a/src/jalview/bin/Jalview.java +++ b/src/jalview/bin/Jalview.java @@@ -77,9 -77,6 +77,9 @@@ import groovy.util.GroovyScriptEngine */ public class Jalview { + + // BH 6/19/2018 starting to work on JS version - just discovering issues + /* * singleton instance of this class */ @@@ -89,14 -86,8 +89,14 @@@ public static AlignFrame currentAlignFrame; + public static boolean isJS = /** @j2sNative true || */ // BH 2018 + false; + static { + + if (!isJS) + { // BH 2018 // grab all the rights we can the JVM Policy.setPolicy(new Policy() { @@@ -113,8 -104,6 +113,8 @@@ { } }); + + } } /** @@@ -160,7 -149,6 +160,6 @@@ af.setProgressBar(MessageManager .getString("status.das_features_being_retrived"), id); af.featureSettings_actionPerformed(null); - af.featureSettings.fetchDasFeatures(dasSources, true); af.setProgressBar(null, id); synchronized (us) { @@@ -199,12 -187,7 +198,12 @@@ */ void doMain(String[] args) { - System.setSecurityManager(null); + + if (!isJS) + { + System.setSecurityManager(null); + } + System.out .println("Java version: " + System.getProperty("java.version")); System.out.println(System.getProperty("os.arch") + " " @@@ -214,6 -197,17 +213,6 @@@ ArgsParser aparser = new ArgsParser(args); boolean headless = false; - if (aparser.contains("help") || aparser.contains("h")) - { - showUsage(); - System.exit(0); - } - if (aparser.contains("nodisplay") || aparser.contains("nogui") - || aparser.contains("headless")) - { - System.setProperty("java.awt.headless", "true"); - headless = true; - } String usrPropsFile = aparser.getValue("props"); Cache.loadProperties(usrPropsFile); // must do this before if (usrPropsFile != null) @@@ -222,41 -216,23 +221,41 @@@ "CMD [-props " + usrPropsFile + "] executed successfully!"); } - // anything else! - - final String jabawsUrl = aparser.getValue("jabaws"); - if (jabawsUrl != null) + /** + * BH 2018 ignoring this section for JS + * + * @j2sNative + */ { - try + if (aparser.contains("help") || aparser.contains("h")) { - Jws2Discoverer.getDiscoverer().setPreferredUrl(jabawsUrl); - System.out.println( - "CMD [-jabaws " + jabawsUrl + "] executed successfully!"); - } catch (MalformedURLException e) + showUsage(); + System.exit(0); + } + if (aparser.contains("nodisplay") || aparser.contains("nogui") + || aparser.contains("headless")) { - System.err.println( - "Invalid jabaws parameter: " + jabawsUrl + " ignored"); + System.setProperty("java.awt.headless", "true"); + headless = true; + } + // anything else! + + final String jabawsUrl = aparser.getValue("jabaws"); + if (jabawsUrl != null) + { + try + { + Jws2Discoverer.getDiscoverer().setPreferredUrl(jabawsUrl); + System.out.println( + "CMD [-jabaws " + jabawsUrl + "] executed successfully!"); + } catch (MalformedURLException e) + { + System.err.println( + "Invalid jabaws parameter: " + jabawsUrl + " ignored"); + } } - } + } String defs = aparser.getValue("setprop"); while (defs != null) { @@@ -353,65 -329,55 +352,65 @@@ desktop = new Desktop(); desktop.setInBatchMode(true); // indicate we are starting up desktop.setVisible(true); - desktop.startServiceDiscovery(); - if (!aparser.contains("nousagestats")) - { - startUsageStats(desktop); - } - else - { - System.err.println("CMD [-nousagestats] executed successfully!"); - } - if (!aparser.contains("noquestionnaire")) + /** + * BH 2018 JS bypass this section + * + * @j2sNative + * + */ { - String url = aparser.getValue("questionnaire"); - if (url != null) + desktop.startServiceDiscovery(); + if (!aparser.contains("nousagestats")) { - // Start the desktop questionnaire prompter with the specified - // questionnaire - Cache.log.debug("Starting questionnaire url at " + url); - desktop.checkForQuestionnaire(url); - System.out.println( - "CMD questionnaire[-" + url + "] executed successfully!"); + startUsageStats(desktop); } else { - if (Cache.getProperty("NOQUESTIONNAIRES") == null) + System.err.println("CMD [-nousagestats] executed successfully!"); + } + + if (!aparser.contains("noquestionnaire")) + { + String url = aparser.getValue("questionnaire"); + if (url != null) { // Start the desktop questionnaire prompter with the specified // questionnaire - // String defurl = - // "http://anaplog.compbio.dundee.ac.uk/cgi-bin/questionnaire.pl"; - // // - String defurl = "http://www.jalview.org/cgi-bin/questionnaire.pl"; - Cache.log.debug( - "Starting questionnaire with default url: " + defurl); - desktop.checkForQuestionnaire(defurl); + Cache.log.debug("Starting questionnaire url at " + url); + desktop.checkForQuestionnaire(url); + System.out.println("CMD questionnaire[-" + url + + "] executed successfully!"); + } + else + { + if (Cache.getProperty("NOQUESTIONNAIRES") == null) + { + // Start the desktop questionnaire prompter with the specified + // questionnaire + // String defurl = + // "http://anaplog.compbio.dundee.ac.uk/cgi-bin/questionnaire.pl"; + // // + String defurl = "http://www.jalview.org/cgi-bin/questionnaire.pl"; + Cache.log.debug( + "Starting questionnaire with default url: " + defurl); + desktop.checkForQuestionnaire(defurl); + } } } - } - else - { - System.err.println("CMD [-noquestionnaire] executed successfully!"); - } + else + { + System.err + .println("CMD [-noquestionnaire] executed successfully!"); + } - if (!aparser.contains("nonews")) - { - desktop.checkForNews(); - } + if (!aparser.contains("nonews")) + { + desktop.checkForNews(); + } - BioJsHTMLOutput.updateBioJS(); + BioJsHTMLOutput.updateBioJS(); + } } String file = null, data = null; @@@ -531,7 -497,7 +530,7 @@@ } System.out.println("CMD [-open " + file + "] executed successfully!"); - if (!file.startsWith("http://")) + if (!isJS && !file.startsWith("http://")) { if (!(new File(file)).exists()) { @@@ -543,7 -509,7 +542,7 @@@ } } - protocol = AppletFormatAdapter.checkProtocol(file); + protocol = AppletFormatAdapter.checkProtocol(file); try { @@@ -774,8 -740,7 +773,8 @@@ // And the user // //////////////////// - if (!headless && file == null && vamsasImport == null + if (/** @j2sNative false && */ // BH 2018 + !headless && file == null && vamsasImport == null && jalview.bin.Cache.getDefault("SHOW_STARTUP_FILE", true)) { file = jalview.bin.Cache.getDefault("STARTUP_FILE", diff --combined src/jalview/gui/SequenceFetcher.java index 0a51c7f,8754fbb..7603242 --- a/src/jalview/gui/SequenceFetcher.java +++ b/src/jalview/gui/SequenceFetcher.java @@@ -24,6 -24,7 +24,6 @@@ import jalview.api.FeatureSettingsModel import jalview.bin.Cache; import jalview.datamodel.AlignmentI; import jalview.datamodel.DBRefEntry; -import jalview.datamodel.SequenceFeature; import jalview.datamodel.SequenceI; import jalview.fts.core.GFTSPanel; import jalview.fts.service.pdb.PDBFTSPanel; @@@ -33,7 -34,6 +33,6 @@@ import jalview.io.gff.SequenceOntologyI import jalview.util.DBRefUtils; import jalview.util.MessageManager; import jalview.util.Platform; - import jalview.ws.dbsources.das.api.DasSourceRegistryI; import jalview.ws.seqfetcher.DbSourceProxy; import java.awt.BorderLayout; @@@ -110,10 -110,6 +109,6 @@@ public class SequenceFetcher extends JP private static jalview.ws.SequenceFetcher sfetch = null; - private static long lastDasSourceRegistry = -3; - - private static DasSourceRegistryI dasRegistry = null; - private static boolean _initingFetcher = false; private static Thread initingThread = null; @@@ -164,11 -160,7 +159,7 @@@ Thread.currentThread().hashCode()); } } - if (sfetch == null || dasRegistry != Cache.getDasSourceRegistry() - || lastDasSourceRegistry != (Cache.getDasSourceRegistry() - .getDasRegistryURL() - + Cache.getDasSourceRegistry().getLocalSourceString()) - .hashCode()) + if (sfetch == null) { _initingFetcher = true; initingThread = Thread.currentThread(); @@@ -182,16 -174,12 +173,12 @@@ "status.init_sequence_database_fetchers"), Thread.currentThread().hashCode()); } - dasRegistry = Cache.getDasSourceRegistry(); - dasRegistry.refreshSources(); jalview.ws.SequenceFetcher sf = new jalview.ws.SequenceFetcher(); if (guiWindow != null) { guiWindow.setProgressBar(null, Thread.currentThread().hashCode()); } - lastDasSourceRegistry = (dasRegistry.getDasRegistryURL() - + dasRegistry.getLocalSourceString()).hashCode(); sfetch = sf; _initingFetcher = false; initingThread = null; @@@ -563,15 -551,10 +550,10 @@@ dbeg.setText(MessageManager.formatMessage("label.example_query_param", new String[] { eq })); + // TODO this should be a property of the SequenceFetcher whether commas are and + // colons are allowed in the IDs... + boolean enablePunct = !(eq != null && eq.indexOf(",") > -1); - for (DbSourceProxy dbs : database.getSelectedSources()) - { - if (dbs instanceof jalview.ws.dbsources.das.datamodel.DasSequenceSource) - { - enablePunct = false; - break; - } - } replacePunctuation.setEnabled(enablePunct); } catch (Exception ex) @@@ -1026,8 -1009,9 +1008,8 @@@ // Alignments? } - SequenceFeature[] sfs = null; - List alsqs; - synchronized (alsqs = al.getSequences()) + List alsqs = al.getSequences(); + synchronized (alsqs) { for (SequenceI sq : alsqs) {