From cf2d81d34ca92dc583974065b88b23cf8fe6b237 Mon Sep 17 00:00:00 2001 From: jprocter Date: Thu, 4 Dec 2008 10:24:02 +0000 Subject: [PATCH] local das source properties string constants and routine for generating sequence and feature sources from local source property --- src/jalview/bin/Cache.java | 40 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) diff --git a/src/jalview/bin/Cache.java b/src/jalview/bin/Cache.java index d315626..bae40ca 100755 --- a/src/jalview/bin/Cache.java +++ b/src/jalview/bin/Cache.java @@ -22,6 +22,7 @@ import java.io.*; import java.util.*; import org.apache.log4j.*; +import org.biojava.dasobert.dasregistry.Das1Source; /** * Stores and retrieves Jalview Application Properties Lists and fields within @@ -131,6 +132,10 @@ public class Cache public static final String DAS_LOCAL_SOURCE = "DAS_LOCAL_SOURCE"; + public static final String DAS_REGISTRY_URL = "DAS_REGISTRY_URL"; + + public static final String DAS_ACTIVE_SOURCE = "DAS_ACTIVE_SOURCE"; + /** * Initialises the Jalview Application Log */ @@ -485,4 +490,39 @@ public class Cache return (groovyJarsArePresent > 0); } + /** + * generate Das1Sources from the local das source list + * @return Vector of Das1Sources + */ + public static Vector getLocalDasSources() + { + Vector localSources = new Vector(); + String local = jalview.bin.Cache.getProperty("DAS_LOCAL_SOURCE"); + if (local != null) + { + StringTokenizer st = new StringTokenizer(local, "\t"); + while (st.hasMoreTokens()) + { + String token = st.nextToken(); + int bar = token.indexOf("|"); + Das1Source source = new Das1Source(); + source.setUrl(token.substring(bar + 1)); + if (source.getUrl().startsWith("sequence:")) + { + source.setUrl(source.getUrl().substring(9)); + // this source also serves sequences as well as features + source.setCapabilities(new String[] { "sequence", "features"}); + } else { + // default is that all user added sources serve features + source.setCapabilities(new String[] { "features"}); + } + + source.setNickname(token.substring(0, bar)); + + localSources.addElement(source); + } + } + return localSources; + } + } -- 1.7.10.2