/** * Returns all global Properties that begin with str * * @param str the String that the returned properties should start with * @return a Properties object containing the subset of the global properties */ public static Properties getPropertiesStartingWith(String str) { return getPropertiesStartingWith(str, getProperties()); }
/** * Returns all global Properties that begin with str * * @param str the String that the returned properties should start with * @return a Properties object containing the subset of the global properties */ public static Properties getPropertiesStartingWith(String str) { return getPropertiesStartingWith(str, getProperties()); }
Properties props = PropertiesUtil.getPropertiesStartingWith("pathquery.range.", allProps); for (String key: props.stringPropertyNames()) {
Properties props = PropertiesUtil.getPropertiesStartingWith("pathquery.range.", allProps); for (String key: props.stringPropertyNames()) {
/** * Construct an ObjectStore with some metadata * @param model the name of the model */ protected ObjectStoreAbstractImpl(Model model) { this.model = model; Properties props = PropertiesUtil.getPropertiesStartingWith("os.query"); props = PropertiesUtil.stripStart("os.query", props); if (props.get("max-limit") != null) { maxLimit = Integer.parseInt((String) props.get("max-limit")); } if (props.get("max-offset") != null) { maxOffset = Integer.parseInt((String) props.get("max-offset")); } if (props.get("max-time") != null) { maxTime = Long.parseLong((String) props.get("max-time")); } if (props.get("max-query-parse-time") != null) { maxQueryParseTime = Long.parseLong((String) props.get("max-query-parse-time")); } LOG.info("Creating new " + getClass().getName() + " with sequence = " + sequenceNumber + ", model = \"" + model.getName() + "\""); cache = new CacheMap<Integer, InterMineObject>(getClass().getName() + " with sequence = " + sequenceNumber + ", model = \"" + model.getName() + "\" getObjectById cache"); }
/** * Construct an ObjectStore with some metadata * @param model the name of the model */ protected ObjectStoreAbstractImpl(Model model) { this.model = model; Properties props = PropertiesUtil.getPropertiesStartingWith("os.query"); props = PropertiesUtil.stripStart("os.query", props); if (props.get("max-limit") != null) { maxLimit = Integer.parseInt((String) props.get("max-limit")); } if (props.get("max-offset") != null) { maxOffset = Integer.parseInt((String) props.get("max-offset")); } if (props.get("max-time") != null) { maxTime = Long.parseLong((String) props.get("max-time")); } if (props.get("max-query-parse-time") != null) { maxQueryParseTime = Long.parseLong((String) props.get("max-query-parse-time")); } LOG.info("Creating new " + getClass().getName() + " with sequence = " + sequenceNumber + ", model = \"" + model.getName() + "\""); cache = new CacheMap<Integer, InterMineObject>(getClass().getName() + " with sequence = " + sequenceNumber + ", model = \"" + model.getName() + "\" getObjectById cache"); }
/** * Returns a connection to the named database * * @param instance the name of the database * @return a connection to that database * @throws SQLException if there is a problem with the underlying database * @throws ClassNotFoundException if the class that the instance uses cannot be found */ public static Database getDatabase(String instance) throws SQLException, ClassNotFoundException { Database database; // Only one thread to configure or test for a DataSource synchronized (databases) { // If we have this DataSource already configured if (databases.containsKey(instance)) { database = databases.get(instance); } else { Properties props = PropertiesUtil.getPropertiesStartingWith(instance); try { database = new Database(PropertiesUtil.stripStart(instance, props)); } catch (Exception e) { throw new RuntimeException("Failed to initialise " + instance, e); } } } databases.put(instance, database); return database; } }
/** * Returns a connection to the named database * * @param instance the name of the database * @return a connection to that database * @throws SQLException if there is a problem with the underlying database * @throws ClassNotFoundException if the class that the instance uses cannot be found */ public static Database getDatabase(String instance) throws SQLException, ClassNotFoundException { Database database; // Only one thread to configure or test for a DataSource synchronized (databases) { // If we have this DataSource already configured if (databases.containsKey(instance)) { database = databases.get(instance); } else { Properties props = PropertiesUtil.getPropertiesStartingWith(instance); try { database = new Database(PropertiesUtil.stripStart(instance, props)); } catch (Exception e) { throw new RuntimeException("Failed to initialise " + instance, e); } } } databases.put(instance, database); return database; } }
public void testStartingWithNullProperties() throws Exception { try { PropertiesUtil.getPropertiesStartingWith("blahblah", null); fail("Expected: NullPointerException"); } catch (NullPointerException e) { } }
public void testStartingWithNullStr() throws Exception { try { PropertiesUtil.getPropertiesStartingWith(null, new Properties()); fail("Expected: NullPointerException"); } catch (NullPointerException e) { } }
throw new IllegalArgumentException("ObjectStore alias cannot be empty"); Properties props = PropertiesUtil.getPropertiesStartingWith(alias);
PropertiesUtil.getPropertiesStartingWith("intermines", webProperties)); mineId = mineId.substring(0, mineId.indexOf(".")); Properties mineProps = PropertiesUtil.stripStart(mineId, PropertiesUtil.getPropertiesStartingWith(mineId, props));
throw new IllegalArgumentException("ObjectStore alias cannot be empty"); Properties props = PropertiesUtil.getPropertiesStartingWith(alias);
public void testStartingWithNotExists() throws Exception { Properties p = PropertiesUtil.getPropertiesStartingWith("nothing", props); assertEquals(0, p.size()); }
PropertiesUtil.getPropertiesStartingWith("intermines", webProperties)); mineId = mineId.substring(0, mineId.indexOf(".")); Properties mineProps = PropertiesUtil.stripStart(mineId, PropertiesUtil.getPropertiesStartingWith(mineId, props));
throw new IllegalArgumentException("Integration alias cannot be empty"); Properties props = PropertiesUtil.getPropertiesStartingWith(alias); if (props.size() == 0) { throw new ObjectStoreException("No Integration properties were found for '"
public void testStartingWithExists() throws Exception { Properties p = PropertiesUtil.getPropertiesStartingWith("testprop", props); assertEquals(2, p.size()); assertEquals("myname", p.get("testprop.name")); assertEquals("myaddress", p.get("testprop.address")); }
public void testStripStartExists() throws Exception { Properties p1 = PropertiesUtil.getPropertiesStartingWith("testprop", props); Properties p2 = PropertiesUtil.stripStart("testprop", p1); assertEquals(2, p2.size()); assertEquals("myname", p2.get("name")); assertEquals("myaddress", p2.get("address")); }
Properties props = PropertiesUtil.getPropertiesStartingWith( "equivalentObjectFetcher"); if (!("false".equals(props.getProperty("equivalentObjectFetcher.useParallel")))) {
Properties props = PropertiesUtil.getPropertiesStartingWith( "equivalentObjectFetcher"); if (!("false".equals(props.getProperty("equivalentObjectFetcher.useParallel")))) {