/** * Returns the properties accessible for this system. * * @return a Properties object */ public static Properties getProperties() { return PropertiesUtil.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()); }
/** * Load the given properties into the global properties. * * @param resourceName the resource to load */ private static void loadGlobalProperties(String resourceName) { LOG.info("Finding global properties file " + resourceName); if (loadProperties(globalProperties, resourceName) == null) { throw new RuntimeException("Could not load required global properties resource " + resourceName); } }
/** * 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; } }
PropertiesUtil.serialize(keys)); Properties props = PropertiesUtil.getPropertiesStartingWith(osName); props = PropertiesUtil.stripStart(osName, props);
Properties props = PropertiesUtil.getPropertiesStartingWith("pathquery.range.", allProps); for (String key: props.stringPropertyNames()) {
public void testStripStartNullProps() throws Exception { try { PropertiesUtil.stripStart(null, new Properties()); fail("Expected: NullPointerException"); } catch (NullPointerException e) { } }
oss = new ObjectStoreSummary(os, config); MetadataManager.store(db, MetadataManager.OS_SUMMARY, PropertiesUtil.serialize(oss.toProperties()));
private static void initGlobalProperties() { globalProperties = new Properties(); // Read Properties from the following files // default.intermine.properties: Common runtime Properties // intermine.properties: User runtime properties loadGlobalProperties("default.intermine.properties"); loadGlobalProperties("intermine.properties"); }
/** * Returns all InterMine properties * * @return the global properties for InterMine */ public static Properties getProperties() { if (globalProperties == null) { initGlobalProperties(); } return globalProperties; }
/** * 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; } }
PropertiesUtil.serialize(keys)); Properties props = PropertiesUtil.getPropertiesStartingWith(osName); props = PropertiesUtil.stripStart(osName, props);
Properties props = PropertiesUtil.getPropertiesStartingWith("pathquery.range.", allProps); for (String key: props.stringPropertyNames()) {
public void testStripStartNullProperties() throws Exception { try { PropertiesUtil.stripStart("blahblah", null); fail("Expected: NullPointerException"); } catch (NullPointerException e) { } }
oss = new ObjectStoreSummary(os, config); MetadataManager.store(db, MetadataManager.OS_SUMMARY, PropertiesUtil.serialize(oss.toProperties()));
private static void initGlobalProperties() { globalProperties = new Properties(); // Read Properties from the following files // default.intermine.properties: Common runtime Properties // intermine.properties: User runtime properties loadGlobalProperties("default.intermine.properties"); loadGlobalProperties("intermine.properties"); }
/** * Returns all InterMine properties * * @return the global properties for InterMine */ public static Properties getProperties() { if (globalProperties == null) { initGlobalProperties(); } return globalProperties; }
/** * 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 the properties accessible for this system. * * @return a Properties object */ public static Properties getProperties() { return PropertiesUtil.getProperties(); }
public void testStartingWithNullProperties() throws Exception { try { PropertiesUtil.getPropertiesStartingWith("blahblah", null); fail("Expected: NullPointerException"); } catch (NullPointerException e) { } }