/** * Returns the value of the boolean property specified. * The runtime exception will be thrown if the specified property has no boolean representation. * @param propertyKey the property * @return the boolean value */ public boolean getBooleanProperty(DroidGlobalProperty propertyKey) { return props.getBoolean(propertyKey.getName()); }
/** * @return all settings in a map */ public Map<String, Object> getPropertiesMap() { final Map<String, Object> allSettings = new HashMap<String, Object>(); for (Iterator<String> it = props.getKeys(); it.hasNext();) { String key = it.next(); DroidGlobalProperty property = DroidGlobalProperty.forName(key); if (property != null) { allSettings.put(key, property.getType().getTypeSafeValue(props, key)); } } // BNO: To note - The available hash algorithms are better hard coded here than in the // droid.properties file since the list is not user configurable. However, the existing droid.properties // profile.hashAlgorithm can still be used to indicate the default selection. List<String> availableHashAlgorithms = new ArrayList<String>(); availableHashAlgorithms.add("md5"); availableHashAlgorithms.add("sha1"); availableHashAlgorithms.add("sha256"); allSettings.put(AVAILABLE_HASH_ALGORITHMS, availableHashAlgorithms); return allSettings; }
/** * @param key the name * @return a DroidGlobalProperty */ public static DroidGlobalProperty forName(String key) { DroidGlobalProperty property = allValues.get(key); return property != null && property.isUserConfigurable() ? property : null; }
/** * {@inheritDoc} */ @Override public void configurationChanged(ConfigurationEvent event) { final String propertyName = event.getPropertyName(); if (propertyName.startsWith("update.proxy")) { DroidGlobalProperty property = DroidGlobalProperty.forName(propertyName); switch (property) { case UPDATE_PROXY_HOST: setProxyHost((String) event.getPropertyValue()); break; case UPDATE_PROXY_PORT: setProxyPort((Integer) event.getPropertyValue()); break; case UPDATE_USE_PROXY: setEnabled((Boolean) event.getPropertyValue()); break; default: log.error(String.format("Invalid proxy setting [%s]", propertyName)); } notifyProxySubscribers(); } }
/** * {@inheritDoc} */ @Override public void configurationChanged(ConfigurationEvent event) { final String propertyName = event.getPropertyName(); if (propertyName.startsWith("update.proxy")) { DroidGlobalProperty property = DroidGlobalProperty.forName(propertyName); switch (property) { case UPDATE_PROXY_HOST: setProxyHost((String) event.getPropertyValue()); break; case UPDATE_PROXY_PORT: setProxyPort((Integer) event.getPropertyValue()); break; case UPDATE_USE_PROXY: setEnabled((Boolean) event.getPropertyValue()); break; default: log.error(String.format("Invalid proxy setting [%s]", propertyName)); } notifyProxySubscribers(); } }
/** * Returns the value of the boolean property specified. * The runtime exception will be thrown if the specified property has no boolean representation. * @param propertyKey the property * @return the boolean value */ public boolean getBooleanProperty(DroidGlobalProperty propertyKey) { return props.getBoolean(propertyKey.getName()); }
/** * @return all settings in a map */ public Map<String, Object> getPropertiesMap() { final Map<String, Object> allSettings = new HashMap<String, Object>(); for (Iterator<String> it = props.getKeys(); it.hasNext();) { String key = it.next(); DroidGlobalProperty property = DroidGlobalProperty.forName(key); if (property != null) { allSettings.put(key, property.getType().getTypeSafeValue(props, key)); } } // BNO: To note - The available hash algorithms are better hard coded here than in the // droid.properties file since the list is not user configurable. However, the existing droid.properties // profile.hashAlgorithm can still be used to indicate the default selection. List<String> availableHashAlgorithms = new ArrayList<String>(); availableHashAlgorithms.add("md5"); availableHashAlgorithms.add("sha1"); availableHashAlgorithms.add("sha256"); allSettings.put(AVAILABLE_HASH_ALGORITHMS, availableHashAlgorithms); return allSettings; }
/** * @param key the name * @return a DroidGlobalProperty */ public static DroidGlobalProperty forName(String key) { DroidGlobalProperty property = allValues.get(key); return property != null && property.isUserConfigurable() ? property : null; }
/** * {@inheritDoc} */ @Override public void closeProfile(String profileName) { log.info("Closing profile: " + profileName); profileContextLocator.removeProfileContext(profileName); if (!config.getProperties().getBoolean(DroidGlobalProperty.DEV_MODE.getName())) { File profileHome = new File(config.getProfilesDir(), profileName); FileUtils.deleteQuietly(profileHome); } }
/** * {@inheritDoc} */ @Override public void configurationChanged(ConfigurationEvent evt) { final String propertyName = evt.getPropertyName(); if (propertyName.equals(DroidGlobalProperty.CONTAINER_UPDATE_URL.getName())) { setEndpointUrl((String) evt.getPropertyValue()); } }
/** * {@inheritDoc} */ @Override public void configurationChanged(ConfigurationEvent evt) { final String propertyName = evt.getPropertyName(); if (propertyName.equals(DroidGlobalProperty.BINARY_UPDATE_URL.getName())) { setEndpointUrl((String) evt.getPropertyValue()); } }
/** * {@inheritDoc} */ @Override public void configurationChanged(ConfigurationEvent evt) { final String propertyName = evt.getPropertyName(); if (propertyName.equals(DroidGlobalProperty.BINARY_UPDATE_URL.getName())) { setEndpointUrl((String) evt.getPropertyValue()); } }
/** * {@inheritDoc} */ @Override public void configurationChanged(ConfigurationEvent evt) { final String propertyName = evt.getPropertyName(); if (propertyName.equals(DroidGlobalProperty.CONTAINER_UPDATE_URL.getName())) { setEndpointUrl((String) evt.getPropertyValue()); } }
DroidGlobalProperty defaultSigFile = defaultVersionProperties.get(type); String defaultSigFileKey = config.getProperties().getString(defaultSigFile.getName()); if (StringUtils.isNotBlank(defaultSigFileKey)) { SignatureFileInfo sigFileInfo = sigs.get(defaultSigFileKey); if (sigFileInfo == null) { String errorMessage = String.format(errorMessagePattern, config.getProperties() .getString(defaultVersionProperties.get(type).getName())); throw new SignatureFileException(errorMessage, ErrorCode.FILE_NOT_FOUND);
DroidGlobalProperty defaultSigFile = defaultVersionProperties.get(type); String defaultSigFileKey = config.getProperties().getString(defaultSigFile.getName()); if (StringUtils.isNotBlank(defaultSigFileKey)) { SignatureFileInfo sigFileInfo = sigs.get(defaultSigFileKey); if (sigFileInfo == null) { String errorMessage = String.format(errorMessagePattern, config.getProperties() .getString(defaultVersionProperties.get(type).getName())); throw new SignatureFileException(errorMessage, ErrorCode.FILE_NOT_FOUND);
/** * {@inheritDoc} */ @Override public void init(DroidGlobalConfig config) { setEndpointUrl(config.getProperties().getString(DroidGlobalProperty.BINARY_UPDATE_URL.getName())); }
/** * {@inheritDoc} */ @Override public void init(DroidGlobalConfig config) { setEndpointUrl(config.getProperties().getString(DroidGlobalProperty.BINARY_UPDATE_URL.getName())); }
/** * {@inheritDoc} */ @Override public void init(DroidGlobalConfig config) { setEndpointUrl(config.getProperties().getString(DroidGlobalProperty.CONTAINER_UPDATE_URL.getName())); } }
/** * Generates a URL to an external page from a PUID. * @param puid the puid * @return URL to a resource */ String getPronumURLPrefix(String puid) { // get it from configuration. String puidUrl = droidMainUi.getGlobalContext().getGlobalConfig().getProperties().getString( DroidGlobalProperty.PUID_URL_PATTERN.getName()); return String.format(puidUrl, puid); }
/** * {@inheritDoc} */ @Override public void init(DroidGlobalConfig config) { setEndpointUrl(config.getProperties().getString(DroidGlobalProperty.CONTAINER_UPDATE_URL.getName())); } }