public Triple insert(Triple t) { if(t.key == null) return null; List<Triple> list = triplestore.get(t.key); if(list == null) list = new ArrayList<Triple>(); Triple prev = addtriple(list,t); triplestore.put(t.key,list); return prev; }
static public void set(String key, String value) { // TODO: think about the rc properties naming hierarchy assert(key != null); if(USEGROUPSKEY.equals(key)) { useGroups = booleanize(value); } else if(VERIFYSERVERKEY.equals(key)) { verifyServer = booleanize(value); } else if(ALLOWSELFSIGNEDKEY.equals(key)) { allowSelfSigned = booleanize(value); } }
/** * Allow users to add to the default rc * @param key * @param value * @param url null => not url specific */ static synchronized public void add(String key, String value, String url) { if(key == null) return; if(!initialized) RC.initialize(); Triple t = new Triple(key,value,url); dfaltRC.insert(t); // recompute well-knowns setWellKnown(); }
static synchronized public void initialize() { if(!initialized) { initialized = true; RC.loadDefaults(); RC.setWellKnown(); RC.loadFromJava(); } }
/** * Allow users to search the default rc * @param key * @param url null => not url specific * @return value corresponding to key+url, or null if does not exist */ static synchronized public String find(String key, String url) { if(key == null) return null; if(!initialized) RC.initialize(); Triple t = dfaltRC.lookup(key,url); return (t==null?null:t.value); }
/** * Record some well known parameters */ static void setWellKnown() { if(dfaltRC.triplestore.size() == 0) return; // Walk the set of triples looking for those that have no url for(String key: dfaltRC.keySet()) { Triple triple = dfaltRC.lookup(key); if(triple.url == null) { RC.set(key,triple.value); // let set sort it out } } }
static public String getDAPName(String name, Variable context) { if (RC.getUseGroups()) { // leave off leading '/' for root entries Group xg = context.getParentGroup(); if (!xg.isRoot()) { // Get the list of parent groups List<Group> path = Group.collectPath(xg); Formatter dapname = new Formatter(); for (int i = 1; i < path.size(); i++) { // start at 1 to skip root group Group g = path.get(i); dapname.format("/%s", g.getShortName()); } dapname.format("/%s", name); name = dapname.toString(); } } return name; }
public String toString() { StringBuilder rc = new StringBuilder(); for (String key : keySet()) { List<Triple> list = getTriples(key); for (Triple triple : list) { String line = triple.toString(); rc.append(line); rc.append("\n"); } } return rc.toString(); }
static void loadDefaults() { RC rc0 = new RC(); String[] locations = new String[]{ System.getProperty("user.home"), System.getProperty("user.dir"), }; boolean found1 = false; for (String loc : locations) { if (loc == null) continue; String dir = loc.replace('\\', '/'); if (dir.endsWith("/")) dir = dir.substring(0, dir.length() - 1); for (String rcpath : rcfilelist) { String filepath = loc + "/" + rcpath; if (rc0.load(filepath)) found1 = true; } } if (!found1) if (showlog) log.debug("No .rc file found"); dfaltRC = rc0; }
static public boolean getVerifyServer() { if (!initialized) RC.initialize(); return verifyServer; }
static synchronized public void initialize() { if (!initialized) { initialized = true; RC.loadDefaults(); RC.setWellKnown(); RC.loadFromJava(); } }
/** * Record some well known parameters */ static void setWellKnown() { if (dfaltRC.triplestore.size() == 0) return; // Walk the set of triples looking for those that have no url for (String key : dfaltRC.keySet()) { Triple triple = dfaltRC.lookup(key); if (triple.url == null) { RC.set(key, triple.value); // let set sort it out } } }
static public String getDAPName(String name, Variable context) { if (RC.getUseGroups()) { // leave off leading '/' for root entries Group xg = context.getParentGroup(); if (!xg.isRoot()) { // Get the list of parent groups List<Group> path = Group.collectPath(xg); Formatter dapname = new Formatter(); for (int i = 1; i < path.size(); i++) { // start at 1 to skip root group Group g = path.get(i); dapname.format("/%s", g.getShortName()); } dapname.format("/%s", name); name = dapname.toString(); } } return name; }
public String toString() { StringBuilder rc = new StringBuilder(); for(String key: keySet()) { List<Triple> list = getTriples(key); for(Triple triple: list) { String line = triple.toString(); rc.append(line); rc.append("\n"); } } return rc.toString(); }
/** * Allow users to search the default rc * * @param key * @param url null => not url specific * @return value corresponding to key+url, or null if does not exist */ static synchronized public String find(String key, String url) { if (key == null) return null; if (!initialized) RC.initialize(); Triple t = dfaltRC.lookup(key, url); return (t == null ? null : t.value); }
static void loadDefaults() { RC rc0 = new RC(); String[] locations = new String[] { System.getProperty("user.home"), System.getProperty("user.dir"), }; boolean found1 = false; for(String loc: locations) { if(loc == null) continue; String dir = loc.replace('\\','/'); if(dir.endsWith("/")) dir = dir.substring(0,dir.length()-1); for(String rcpath: rcfilelist) { String filepath = loc + "/" + rcpath; if(rc0.load(filepath)) found1 = true; } } if(!found1) if(showlog) log.debug("No .rc file found"); dfaltRC = rc0; }
static public boolean getAllowSelfSigned() { if (!initialized) RC.initialize(); return allowSelfSigned; }
static synchronized public void initialize() { if(!initialized) { initialized = true; RC.loadDefaults(); RC.setWellKnown(); RC.loadFromJava(); } }
/** * Record some well known parameters */ static void setWellKnown() { if(dfaltRC.triplestore.size() == 0) return; // Walk the set of triples looking for those that have no url for(String key: dfaltRC.keySet()) { Triple triple = dfaltRC.lookup(key); if(triple.url == null) { RC.set(key,triple.value); // let set sort it out } } }
/** * Allow users to add to the default rc * @param key * @param value * @param url null => not url specific */ static synchronized public void add(String key, String value, String url) { if(key == null) return; if(!initialized) RC.initialize(); Triple t = new Triple(key,value,url); dfaltRC.insert(t); // recompute well-knowns setWellKnown(); }