/** * 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; } }
int refreshInterval = getIntProperty("friendlymines.refresh.interval", 3600); Properties requesterConfig = PropertiesUtil.stripStart(REQUESTER_CONFIG, webProperties); requester.configure(requesterConfig); newMines.put(localMine.getID(), localMine); Properties props = PropertiesUtil.stripStart("intermines", PropertiesUtil.getPropertiesStartingWith("intermines", webProperties)); String mineId = (String) propNames.nextElement(); mineId = mineId.substring(0, mineId.indexOf(".")); Properties mineProps = PropertiesUtil.stripStart(mineId, PropertiesUtil.getPropertiesStartingWith(mineId, props));
public void testStripStartNullProps() throws Exception { try { PropertiesUtil.stripStart(null, new Properties()); fail("Expected: NullPointerException"); } catch (NullPointerException e) { } }
public void testStripStartNullProperties() throws Exception { try { PropertiesUtil.stripStart("blahblah", null); fail("Expected: NullPointerException"); } catch (NullPointerException e) { } }
int refreshInterval = getIntProperty("friendlymines.refresh.interval", 3600); Properties requesterConfig = PropertiesUtil.stripStart(REQUESTER_CONFIG, webProperties); requester.configure(requesterConfig); newMines.put(localMine.getID(), localMine); Properties props = PropertiesUtil.stripStart("intermines", PropertiesUtil.getPropertiesStartingWith("intermines", webProperties)); String mineId = (String) propNames.nextElement(); mineId = mineId.substring(0, mineId.indexOf(".")); Properties mineProps = PropertiesUtil.stripStart(mineId, PropertiesUtil.getPropertiesStartingWith(mineId, props));
+ alias + "'"); props = PropertiesUtil.stripStart(alias, props);
+ alias + "'"); props = PropertiesUtil.stripStart(alias, props);
try { Properties props = PropertiesUtil.getPropertiesStartingWith(osName); props = PropertiesUtil.stripStart(osName, props);
public void testStripStartNotExists() throws Exception { Properties p = PropertiesUtil.stripStart("nothing", props); assertEquals(0, p.size()); }
+ alias + "'"); props = PropertiesUtil.stripStart(alias, props); String integrationWriterClassName = props.getProperty("class"); if (integrationWriterClassName == null) {
+ alias + "'"); props = PropertiesUtil.stripStart(alias, props); String integrationWriterClassName = props.getProperty("class"); if (integrationWriterClassName == null) {
+ alias + "'"); props = PropertiesUtil.stripStart(alias, props); String clsName = props.getProperty("class"); if (clsName == null) {
+ alias + "'"); props = PropertiesUtil.stripStart(alias, props); String clsName = props.getProperty("class"); if (clsName == null) {
dsProps = PropertiesUtil.stripStart("datasource", dsProps);
dsProps = PropertiesUtil.stripStart("datasource", dsProps);
props = PropertiesUtil.stripStart(osName, props);
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")); }