/** * 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()); }
/** * 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()); }
/** * {@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()); } }
/** * {@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 closeProfile(String profileName) { log.info("Closing profile: " + profileName); profileContextLocator.removeProfileContext(profileName); if (!config.getProperties().getBoolean(DroidGlobalProperty.DEV_MODE.getName())) { final Path profileHome = config.getProfilesDir().resolve(profileName); FileUtil.deleteQuietly(profileHome); } }
/** * {@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); }
/** * Initailisation post-construct. */ public void init() { config.getProperties().addConfigurationListener(proxySettings); Configuration configuration = config.getProperties(); proxySettings = new ProxySettings(); proxySettings.setEnabled(configuration.getBoolean(DroidGlobalProperty.UPDATE_USE_PROXY.getName())); proxySettings.setProxyHost(configuration.getString(DroidGlobalProperty.UPDATE_PROXY_HOST.getName())); proxySettings.setProxyPort(configuration.getInt(DroidGlobalProperty.UPDATE_PROXY_PORT.getName())); proxySettings.setEnabled(configuration.getBoolean(DroidGlobalProperty.UPDATE_USE_PROXY.getName())); config.getProperties().addConfigurationListener(proxySettings); for (SignatureUpdateService subscriber : signatureUpdateServices.values()) { subscriber.init(config); proxySettings.addProxySubscriber(subscriber); config.getProperties().addConfigurationListener(subscriber); } proxySettings.notifyProxySubscribers(); }
/** * {@inheritDoc} */ @Override public SignatureFileInfo install(final SignatureType type, final Path signatureFile, final boolean setDefault) throws SignatureFileException { final SignatureInfoParser parser = new SignatureInfoParser(); final SignatureFileInfo sigFileInfo = forBinarySigFile(signatureFile, parser); try { final Path newSignatureFile = Files.copy(signatureFile, config.getSignatureFileDir()); sigFileInfo.setFile(newSignatureFile); if (setDefault) { config.getProperties().setProperty(defaultVersionProperties.get(type).getName(), FilenameUtils.getBaseName(FileUtil.fileName(newSignatureFile))); } return sigFileInfo; } catch (final IOException e) { log.error(e.getMessage(), e); throw new SignatureFileException(e.getMessage(), e, ErrorCode.FILE_NOT_FOUND); } }
/** * Initailisation post-construct. */ public void init() { config.getProperties().addConfigurationListener(proxySettings); Configuration configuration = config.getProperties(); proxySettings = new ProxySettings(); proxySettings.setEnabled(configuration.getBoolean(DroidGlobalProperty.UPDATE_USE_PROXY.getName())); proxySettings.setProxyHost(configuration.getString(DroidGlobalProperty.UPDATE_PROXY_HOST.getName())); proxySettings.setProxyPort(configuration.getInt(DroidGlobalProperty.UPDATE_PROXY_PORT.getName())); proxySettings.setEnabled(configuration.getBoolean(DroidGlobalProperty.UPDATE_USE_PROXY.getName())); config.getProperties().addConfigurationListener(proxySettings); for (SignatureUpdateService subscriber : signatureUpdateServices.values()) { subscriber.init(config); proxySettings.addProxySubscriber(subscriber); config.getProperties().addConfigurationListener(subscriber); } proxySettings.notifyProxySubscribers(); }
/** * @throws CommandExecutionException */ private void updateDefaultVersion(String key) throws CommandExecutionException { final PropertiesConfiguration properties = globalConfig.getProperties(); properties.setProperty(mapping.get(type).getName(), key); try { properties.save(); SignatureFileInfo sigFileInfo = signatureManager.getDefaultSignatures().get(type); printWriter.println(I18N.getResource(I18N.CONFIGURE_SIGNATURE_FILE_VERSION_SUCCESS, sigFileInfo.getVersion(), sigFileInfo.getFile().getFileName().toString())); } catch (ConfigurationException e) { throw new CommandExecutionException(e); } catch (SignatureFileException e) { throw new CommandExecutionException(e); } };
/** * {@inheritDoc} */ @Override public SignatureFileInfo install(SignatureType type, File signatureFile, boolean setDefault) throws SignatureFileException { SignatureInfoParser parser = new SignatureInfoParser(); SignatureFileInfo sigFileInfo = forBinarySigFile(signatureFile, parser); try { FileUtils.copyFileToDirectory(signatureFile, config.getSignatureFileDir(), true); File newSignatureFile = new File(config.getSignatureFileDir(), signatureFile.getName()); sigFileInfo.setFile(newSignatureFile); if (setDefault) { config.getProperties().setProperty(defaultVersionProperties.get(type).getName(), FilenameUtils.getBaseName(newSignatureFile.getName())); } return sigFileInfo; } catch (IOException e) { log.error(e); throw new SignatureFileException(e.getMessage(), e, ErrorCode.FILE_NOT_FOUND); } }
@Override public Object transform(Object id) { ProfileInstance profileInstance = new ProfileInstance(ProfileState.INITIALISING); profileInstance.setUuid((String) id); profileInstance.setThrottle(globalConfig.getProperties() .getInt(DroidGlobalProperty.DEFAULT_THROTTLE.getName())); profileInstance.setHashAlgorithm(globalConfig.getProperties() .getString(DroidGlobalProperty.HASH_ALGORITHM.getName())); profileInstance.setGenerateHash(globalConfig.getProperties() .getBoolean(DroidGlobalProperty.GENERATE_HASH.getName())); profileInstance.setProcessArchiveFiles(globalConfig.getProperties() .getBoolean(DroidGlobalProperty.PROCESS_ARCHIVES.getName())); profileInstance.setProcessWebArchiveFiles(globalConfig.getProperties() .getBoolean(DroidGlobalProperty.PROCESS_WEB_ARCHIVES.getName())); profileInstance.setMaxBytesToScan(globalConfig.getProperties() .getLong(DroidGlobalProperty.MAX_BYTES_TO_SCAN.getName())); profileInstance.setMatchAllExtensions(globalConfig.getProperties() .getBoolean(DroidGlobalProperty.EXTENSION_ALL.getName())); return profileInstance; } }