/** * Convert a <code>Properties</code> located at <code>propURI</code> into a * <code>Map</code>. * * @param propUri * The URI of the Properties to convert * @return The map * @throws IOException If there is a problem with getting the properties from the URI */ public static PropertyMap properties2Map(URI propUri) throws IOException { return NetUtil.loadProperties(propUri); }
/** * Take the data stored permanently and copy it to the local storage area, * using the configured storage area * * @param uri the location of the permanent storage * @throws IOException if there was a problem getting the permanent config info */ public void permanentToLocal(URI uri) throws IOException { setProperties(NetUtil.loadProperties(uri)); }
/** * Load the predictive timings if any * * @return the length of progress */ private int loadPredictions() { int maxAge = UNKNOWN; try { currentPredictionMap = new HashMap<String, Integer>(); PropertyMap temp = NetUtil.loadProperties(predictionMapURI); // Determine the predicted time from the current prediction map for (String title : temp.keySet()) { String timestr = temp.get(title); try { Integer time = Integer.valueOf(timestr); currentPredictionMap.put(title, time); // if this time is later than the latest int age = time.intValue(); if (maxAge < age) { maxAge = age; } } catch (NumberFormatException ex) { log.error("Time format error", ex); } } } catch (IOException ex) { log.debug("Failed to load prediction times - guessing"); } return maxAge; }
private InstalledIndex() { props = new PropertyMap(); URI propURI = getPropertyFileURI(); try { // props = ResourceUtil.getProperties(getClass()); if (NetUtil.canRead(propURI)) { props = NetUtil.loadProperties(propURI); } /* Initial values if prop file empty */ if (props.size() == 0) { props.put(INSTALLED_INDEX_DEFAULT_VERSION, String.valueOf(DEFAULT_INSTALLED_INDEX_VERSION)); storeInstalledIndexMetadata(); } } catch (IOException e) { log.error("Property file read error: " + propURI.toString(), e); } }