List of usage examples for java.util Properties remove
@Override public synchronized Object remove(Object key)
From source file:org.netxilia.api.impl.storage.DataSourceConfigurationServiceImpl.java
@Override public synchronized void deleteConfigurationForWorkbook(WorkbookId workbookKey) throws StorageException, NotFoundException { init();/* w w w .j a va 2s .c o m*/ Properties props = loadWorkbookToDataSourceFile(); if (props.containsKey(workbookKey.getKey())) { notifyDeleteConfigurationForWorkbook(workbookKey); props.remove(workbookKey.getKey()); saveWorkbookToDataSourceFile(props); } }
From source file:org.glimpse.server.manager.xml.XmlUserManager.java
public synchronized void deleteUser(String userId) { FileInputStream fis = null;// www . j a v a2 s . c o m FileOutputStream fos = null; try { Properties properties = new Properties(); if (passwordsFile.exists()) { fis = new FileInputStream(passwordsFile); properties.load(fis); fis.close(); } properties.remove(userId); fos = new FileOutputStream(passwordsFile); properties.store(fos, ""); File userDir = new File(usersDirectory, userId); FileUtils.deleteDirectory(userDir); } catch (IOException e) { throw new RuntimeException(e); } finally { IOUtils.closeQuietly(fis); IOUtils.closeQuietly(fos); } }
From source file:org.openmrs.module.web.WebModuleUtil.java
/** * Method visibility is package-private for testing * * @param mod/*from w w w . j av a2 s. c o m*/ * @param realPath * @should prefix messages with module id * @should not prefix messages with module id if override setting is specified */ static void copyModuleMessagesIntoWebapp(Module mod, String realPath) { for (Entry<String, Properties> localeEntry : mod.getMessages().entrySet()) { if (log.isDebugEnabled()) { log.debug("Copying message property file: " + localeEntry.getKey()); } Properties props = localeEntry.getValue(); if (!"true".equalsIgnoreCase( props.getProperty(ModuleConstants.MESSAGE_PROPERTY_ALLOW_KEYS_OUTSIDE_OF_MODULE_NAMESPACE))) { // set all properties to start with 'moduleName.' if not already List<Object> keys = new Vector<Object>(); keys.addAll(props.keySet()); for (Object obj : keys) { String key = (String) obj; if (!key.startsWith(mod.getModuleId())) { props.put(mod.getModuleId() + "." + key, props.get(key)); props.remove(key); } } } String lang = "_" + localeEntry.getKey(); if (lang.equals("_en") || lang.equals("_")) { lang = ""; } insertIntoModuleMessagePropertiesFile(realPath, props, lang); } }
From source file:eu.dnetlib.maven.plugin.properties.WritePredefinedProjectProperties.java
/** * Removes properties which should not be written. * @param properties/*from www . ja v a 2 s. co m*/ * @param omitCSV * @param includeCSV * @throws MojoExecutionException */ protected void trim(Properties properties, String omitCSV, String includeCSV) throws MojoExecutionException { List<String> omitKeys = getListFromCSV(omitCSV); for (String key : omitKeys) { properties.remove(key); } List<String> includeKeys = getListFromCSV(includeCSV); // mh: including keys from predefined properties if (includePropertyKeysFromFiles != null && includePropertyKeysFromFiles.length > 0) { for (String currentIncludeLoc : includePropertyKeysFromFiles) { if (validate(currentIncludeLoc)) { Properties p = getProperties(currentIncludeLoc); for (String key : p.stringPropertyNames()) { includeKeys.add(key); } } } } if (includeKeys != null && !includeKeys.isEmpty()) { // removing only when include keys provided Set<String> keys = properties.stringPropertyNames(); for (String key : keys) { if (!includeKeys.contains(key)) { properties.remove(key); } } } }
From source file:de.willuhn.jameica.hbci.passports.pintan.Controller.java
/** * Speichert die Konfiguration./*from w w w .ja v a2 s. c o m*/ * @return true, wenn die Config gespeichert werden konnte. */ public synchronized boolean handleStore() { try { Logger.info("storing pin/tan config"); PinTanConfig config = getConfig(); Konto[] konten = null; List checked = getKontoAuswahl().getItems(); if (checked != null && checked.size() > 0) konten = (Konto[]) checked.toArray(new Konto[checked.size()]); config.setKonten(konten); String version = (String) getHBCIVersion().getValue(); config.setFilterType((String) getFilterType().getValue()); config.setBezeichnung((String) getBezeichnung().getValue()); config.setShowTan(((Boolean) getShowTan().getValue()).booleanValue()); config.setHBCIVersion(version); config.setPort((Integer) getPort().getValue()); config.setCardReader((String) getCardReaders().getValue()); PtSecMech secMech = config.getCurrentSecMech(); if (secMech != null && secMech.useUSB()) { CheckboxInput check = this.getChipTANUSB(); Button button = (Button) check.getControl(); if (button != null && !button.isDisposed()) { boolean gray = button.getGrayed(); config.setChipTANUSB((Boolean) (gray ? null : check.getValue())); } } AbstractHBCIPassport p = (AbstractHBCIPassport) config.getPassport(); PassportChangeRequest change = new PassportChangeRequest(p, (String) getCustomerId().getValue(), (String) getUserId().getValue()); new PassportChange().handleAction(change); if (getHBCIVersion().hasChanged()) { // Das triggert beim naechsten Verbindungsaufbau // HBCIHandler.<clinit> // -> HBCIHandler.registerUser() // -> HBCIUser.register() // -> HBCIUser.updateUserData() // -> HBCIUser.fetchSysId() - und das holt die BPD beim naechsten mal ueber einen nicht-anonymen Dialog Logger.info("hbci version has changed to \"" + version + "\" - set sysId to 0 to force BPD reload on next connect"); Properties props = p.getBPD(); if (props != null) { props.remove("BPA.version"); p.syncSysId(); } } PinTanConfigFactory.store(config); this.passport = null; // force reload GUI.getStatusBar().setSuccessText(i18n.tr("Konfiguration gespeichert")); return true; } catch (ApplicationException e) { Logger.error("error while storing config", e); GUI.getStatusBar().setErrorText(i18n.tr(e.getMessage())); } catch (Throwable t) { Logger.error("error while creating config", t); GUI.getStatusBar().setErrorText(i18n.tr("Fehler beim Speichern der Konfiguration")); } return false; }
From source file:org.jahia.osgi.FrameworkService.java
private Map<String, String> filterOutSystemProperties() { if (!"was".equals(SettingsBean.getInstance().getServer())) { // we skip filtering out system properties on any server except WebSphere, which sets OSGi-related properties for its internal // container return null; }/*www. j a va 2 s . c om*/ Map<String, String> filteredOutSystemProperties = new HashMap<>(); Properties sysProps = System.getProperties(); for (String prop : sysProps.stringPropertyNames()) { if (prop.startsWith("org.osgi.framework.")) { logger.info("Filtering out system property {}", prop); filteredOutSystemProperties.put(prop, sysProps.getProperty(prop)); sysProps.remove(prop); } } return filteredOutSystemProperties; }
From source file:org.wso2.carbon.identity.event.EventMgtConfigBuilder.java
/** * Build a list of subscription by a particular module * * @param moduleName Name of the module * @param moduleProperties Set of properties which * @return A list of subscriptions by the module *//*www . ja va 2 s .co m*/ private List<Subscription> buildSubscriptionList(String moduleName, Properties moduleProperties) { // Get subscribed events Properties subscriptions = EventManagementUtils.getSubProperties(moduleName + "." + "subscription", moduleProperties); List<Subscription> subscriptionList = new ArrayList<Subscription>(); Enumeration propertyNames = subscriptions.propertyNames(); // Iterate through events and build event objects while (propertyNames.hasMoreElements()) { String key = (String) propertyNames.nextElement(); String subscriptionName = (String) subscriptions.remove(key); // Read all the event properties starting from the event prefix Properties subscriptionProperties = EventManagementUtils.getPropertiesWithPrefix( moduleName + "." + "subscription" + "." + subscriptionName, moduleProperties); Subscription subscription = new Subscription(subscriptionName, subscriptionProperties); subscriptionList.add(subscription); } return subscriptionList; }
From source file:org.wso2.carbon.identity.event.IdentityEventConfigBuilder.java
/** * Build a list of subscription by a particular module * * @param moduleName Name of the module * @param moduleProperties Set of properties which * @return A list of subscriptions by the module *//* www . j av a 2 s.co m*/ private List<Subscription> buildSubscriptionList(String moduleName, Properties moduleProperties) { // Get subscribed events Properties subscriptions = IdentityEventUtils.getSubProperties(moduleName + "." + "subscription", moduleProperties); List<Subscription> subscriptionList = new ArrayList<Subscription>(); Enumeration propertyNames = subscriptions.propertyNames(); // Iterate through events and build event objects while (propertyNames.hasMoreElements()) { String key = (String) propertyNames.nextElement(); String subscriptionName = (String) subscriptions.remove(key); // Read all the event properties starting from the event prefix Properties subscriptionProperties = IdentityEventUtils.getPropertiesWithPrefix( moduleName + "." + "subscription" + "." + subscriptionName, moduleProperties); Subscription subscription = new Subscription(subscriptionName, subscriptionProperties); subscriptionList.add(subscription); } return subscriptionList; }
From source file:org.nuxeo.ecm.core.persistence.HibernateConfiguration.java
@Override public EntityManagerFactory getFactory(String txType) { Map<String, String> properties = new HashMap<String, String>(); if (txType == null) { txType = getTxType();/* w ww .j av a 2 s .co m*/ } properties.put(HibernatePersistence.TRANSACTION_TYPE, txType); if (txType.equals(JTA)) { Class<?> transactionFactoryClass; if (ConnectionHelper.useSingleConnection(null)) { transactionFactoryClass = NuxeoTransactionFactory.class; } else { transactionFactoryClass = JoinableCMTTransactionFactory.class; } properties.put(Environment.TRANSACTION_STRATEGY, transactionFactoryClass.getName()); properties.put(Environment.TRANSACTION_MANAGER_STRATEGY, NuxeoTransactionManagerLookup.class.getName()); } else if (txType.equals(RESOURCE_LOCAL)) { properties.put(Environment.TRANSACTION_STRATEGY, JDBCTransactionFactory.class.getName()); } if (cfg == null) { setupConfiguration(properties); } Properties props = cfg.getProperties(); if (props.get(Environment.URL) == null) { // don't set up our connection provider for unit tests // that use an explicit driver + connection URL and so use // a DriverManagerConnectionProvider props.put(Environment.CONNECTION_PROVIDER, NuxeoConnectionProvider.class.getName()); } if (txType.equals(RESOURCE_LOCAL)) { props.remove(Environment.DATASOURCE); } else { String dsname = props.getProperty(Environment.DATASOURCE); dsname = DataSourceHelper.getDataSourceJNDIName(dsname); props.put(Environment.DATASOURCE, dsname); } return createEntityManagerFactory(properties); }
From source file:it.greenvulcano.gvesb.api.controller.GvConfigurationControllerRest.java
@DELETE @Path("/property/{key}") @RolesAllowed({ Authority.ADMINISTRATOR, Authority.MANAGER }) public void deleteProperty(@PathParam("key") String key) { try {/*from w w w .j ava 2s . c o m*/ Properties configProperties = gvConfigurationManager.getXMLConfigProperties(); configProperties.remove(key); gvConfigurationManager.saveXMLConfigProperties(configProperties); } catch (FileNotFoundException e) { throw new WebApplicationException(Response.status(Response.Status.NOT_FOUND).build()); } catch (Exception e) { LOG.error("Failed to update XMLConfigProperties ", e); throw new WebApplicationException(Response.status(Response.Status.SERVICE_UNAVAILABLE).build()); } }