List of usage examples for java.util Properties remove
@Override public synchronized Object remove(Object key)
From source file:fr.fastconnect.factory.tibco.bw.maven.packaging.MergePropertiesMojo.java
protected Properties removeWildCards(Properties properties) { String key;/*from ww w. j a v a 2 s . c o m*/ Enumeration<Object> e = properties.keys(); while (e.hasMoreElements()) { key = (String) e.nextElement(); if (isAWildCard(key)) { properties.remove(key); } } return properties; }
From source file:org.openflexo.localization.LocalizedDelegateImpl.java
public void removeEntry(String key) { // Remove from all dictionaries for (Language language : Language.availableValues()) { Properties dict = getDictionary(language); dict.remove(key); // saveDictionary(language, dict); }//from w ww . j av a 2 s.c o m entries = null; setChanged(); notifyObservers(); }
From source file:com.zotoh.maedr.device.netty.RestIO.java
@SuppressWarnings("unchecked") protected CmdLineSequence getCmdSeq(ResourceBundle rcb, Properties props) throws Exception { props.put("resources", new HashMap<String, String>()); CmdLineQuestion q3 = new CmdLineMandatory("resproc", getResourceStr(rcb, "cmd.rest.resproc")) { protected String onAnswerSetOutput(String answer, Properties props) { Map<String, String> m = (Map<String, String>) props.get("resources"); String uri = (String) props.remove("resuri"); m.put(uri, answer);/*from ww w . j a va 2 s .co m*/ return "resptr"; } }; CmdLineQuestion q2 = new CmdLineMandatory("resptr", getResourceStr(rcb, "cmd.rest.resptr")) { protected String onAnswerSetOutput(String answer, Properties props) { if (isEmpty(answer)) { return ""; } props.put("resuri", answer); return "resproc"; } }; final CmdLineQuestion q1 = new CmdLineQuestion("ctx", getResourceStr(rcb, "cmd.http.ctx")) { protected String onAnswerSetOutput(String answer, Properties props) { props.put("contextpath", answer); return "resptr"; } }; return new CmdLineSequence(super.getCmdSeq(rcb, props), q1, q2, q3) { protected String onStart() { return q1.getId(); } }; }
From source file:net.sf.joost.plugins.traxfilter.THResolver.java
/** * Creates new TH instance out of TrAX factory * @param method/*w w w . j a v a 2 s. c o m*/ * @param source * @return TH */ protected TransformerHandler newTHOutOfTrAX(String method, Source source, Hashtable params, ErrorListener errorListener, URIResolver uriResolver) throws SAXException { if (DEBUG) log.debug("newTHOutOfTrAX()"); SAXTransformerFactory saxtf; if (FACTORY.getValueStr().length() > 0) { // create factory as asked by the client try { saxtf = (SAXTransformerFactory) (Class.forName(FACTORY.getValueStr())).newInstance(); if (DEBUG) log.debug("newTHOutOfTrAX(): use custom TrAX factory " + FACTORY.getValueStr()); } catch (InstantiationException e) { throw new SAXException(e); } catch (ClassNotFoundException e) { throw new SAXException(e); } catch (IllegalAccessException e) { throw new SAXException(e); } } else if (STX_METHOD.equals(method)) { saxtf = new TransformerFactoryImpl(); if (DEBUG) log.debug("newTHOutOfTrAX(): use default Joost factory " + saxtf.getClass().toString()); } else { final String TFPROP = "javax.xml.transform.TransformerFactory"; final String STXIMP = "net.sf.joost.trax.TransformerFactoryImpl"; synchronized (SYNCHRONIZE_GUARD) { String propVal = System.getProperty(TFPROP); boolean propChanged = false; String xsltFac = System.getProperty(TrAXConstants.KEY_XSLT_FACTORY); if (xsltFac != null || STXIMP.equals(propVal)) { // change this property, // otherwise we wouldn't get an XSLT transformer if (xsltFac != null) System.setProperty(TFPROP, xsltFac); else { Properties props = System.getProperties(); props.remove(TFPROP); System.setProperties(props); } propChanged = true; } saxtf = (SAXTransformerFactory) TransformerFactory.newInstance(); if (propChanged) { // reset property if (propVal != null) System.setProperty(TFPROP, propVal); else { Properties props = System.getProperties(); props.remove(TFPROP); System.setProperties(props); } } } if (DEBUG) log.debug("newTHOutOfTrAX(): use default TrAX factory " + saxtf.getClass().toString()); } // set factory attributes setTraxFactoryAttributes(saxtf, params); setupTransformerFactory(saxtf, errorListener, uriResolver); try { if (DEBUG) log.debug("newTHOutOfTrAX(): creating factory's reusable TH"); // TrAX way to create TH TransformerHandler th = saxtf.newTransformerHandler(source); setupTransformer(th.getTransformer(), errorListener, uriResolver); return th; } catch (TransformerConfigurationException ex) { throw new SAXException(ex); } }
From source file:org.wso2.developerstudio.eclipse.distribution.project.ui.wizard.DistributionProjectExportWizard.java
private Properties identifyNonProjectProperties(Properties properties) { Map<String, DependencyData> dependencies = projectList; for (Iterator iterator = dependencies.values().iterator(); iterator.hasNext();) { DependencyData dependency = (DependencyData) iterator.next(); String artifactInfoAsString = DistProjectUtils.getArtifactInfoAsString(dependency.getDependency()); if (properties.containsKey(artifactInfoAsString)) { properties.remove(artifactInfoAsString); }//ww w . ja v a 2s. co m } //Removing the artifact.type properties.remove("artifact.types"); return properties; }
From source file:com.meltmedia.cadmium.core.util.WarUtils.java
/** * <p>Loads a properties file from a zip file and updates 2 properties in that properties file.</p> * <p>The properties file in the zip is not written back to the zip file with the updates.</p> * @param inZip The zip file to load the properties file from. * @param cadmiumPropertiesEntry The entry of a properties file in the zip to load. * @param repoUri The value to set the "com.meltmedia.cadmium.git.uri" property with. * @param branch The value to set the "com.meltmedia.cadmium.branch" property with. * @param configRepoUri The value to set the "com.meltmedia.cadmium.config.git.uri" property with. * @param configBranch The value to set the "com.meltmedia.cadmium.config.branch" property with. * @return The updated properties object that was loaded from the zip file. * @throws IOException/*w w w . j a v a2 s. com*/ */ public static Properties updateProperties(ZipFile inZip, ZipEntry cadmiumPropertiesEntry, String repoUri, String branch, String configRepoUri, String configBranch) throws IOException { Properties cadmiumProps = new Properties(); cadmiumProps.load(inZip.getInputStream(cadmiumPropertiesEntry)); if (org.apache.commons.lang3.StringUtils.isNotBlank(repoUri)) { cadmiumProps.setProperty("com.meltmedia.cadmium.git.uri", repoUri); } if (branch != null) { cadmiumProps.setProperty("com.meltmedia.cadmium.branch", branch); } if (org.apache.commons.lang3.StringUtils.isNotBlank(configRepoUri) && !org.apache.commons.lang3.StringUtils .equals(configRepoUri, cadmiumProps.getProperty("com.meltmedia.cadmium.git.uri"))) { cadmiumProps.setProperty("com.meltmedia.cadmium.config.git.uri", configRepoUri); } else if (org.apache.commons.lang3.StringUtils.equals(configRepoUri, cadmiumProps.getProperty("com.meltmedia.cadmium.git.uri"))) { cadmiumProps.remove("com.meltmedia.cadmium.config.git.uri"); } if (configBranch != null) { cadmiumProps.setProperty("com.meltmedia.cadmium.config.branch", configBranch); } return cadmiumProps; }
From source file:edu.umich.ctools.sectionsUtilityTool.Friend.java
/** * Returns to uninitialized state.//w w w .j a va 2s . c o m */ public void destroy() { M_log.info(this + ".destroy()"); if (sslInitialized) { // remove ssl system settings // configure JSSE system properties: // http://fusesource.com/docs/broker/5.3/security/SSL-SysProps.html Properties systemProps = System.getProperties(); //systemProps.remove("javax.net.debug"); //important: http://stackoverflow.com/questions/6680416/apache-cxf-exception-in-ssl-communication-sockettimeout //java.lang.System.setProperty("sun.security.ssl.allowUnsafeRenegotiation", "true"); systemProps.remove("javax.net.ssl.keyStoreType"); systemProps.remove("javax.net.ssl.trustStoreType"); systemProps.remove("javax.net.ssl.keyStore"); systemProps.remove("javax.net.ssl.keyStorePassword"); System.setProperties(systemProps); sslInitialized = false; } }
From source file:org.cesecore.certificates.ca.catoken.CATokenTestBase.java
protected void doActivateDeactivate(CryptoToken cryptoToken) throws KeyStoreException, NoSuchAlgorithmException, CertificateException, IOException, CryptoTokenOfflineException, NoSuchProviderException, InvalidKeyException, SignatureException, CryptoTokenAuthenticationFailedException, InvalidAlgorithmParameterException { // Remove auto activate Properties prop = cryptoToken.getProperties(); prop.remove(CryptoToken.AUTOACTIVATE_PIN_PROPERTY); cryptoToken.setProperties(prop);//from ww w. ja va2 s .co m CAToken catoken = new CAToken(cryptoToken); try { // Set key sequence so that next sequence will be 00001 (this is the default though so not really needed here) catoken.setKeySequence(CAToken.DEFAULT_KEYSEQUENCE); catoken.setKeySequenceFormat(StringTools.KEY_SEQUENCE_FORMAT_NUMERIC); catoken.setSignatureAlgorithm(AlgorithmConstants.SIGALG_SHA1_WITH_RSA); catoken.setEncryptionAlgorithm(AlgorithmConstants.SIGALG_SHA1_WITH_RSA); // First we start by deleting all old entries try { catoken.getCryptoToken().deleteEntry(tokenpin.toCharArray(), "rsatest00001"); assertTrue("Should throw", false); } catch (CryptoTokenOfflineException e) { // NOPMD } catoken.getCryptoToken().activate(tokenpin.toCharArray()); catoken.getCryptoToken().deleteEntry(tokenpin.toCharArray(), "rsatest00001"); catoken.getCryptoToken().deleteEntry(tokenpin.toCharArray(), "rsatest00002"); catoken.getCryptoToken().deleteEntry(tokenpin.toCharArray(), "rsatest00003"); // Before this there are no keys. catoken.generateKeys(tokenpin.toCharArray(), false, true); KeyTools.testKey(catoken.getPrivateKey(CATokenConstants.CAKEYPURPOSE_CERTSIGN), catoken.getPublicKey(CATokenConstants.CAKEYPURPOSE_CERTSIGN), catoken.getCryptoToken().getSignProviderName()); // We have not set auto activate, so the internal key storage in CryptoToken is emptied catoken.getCryptoToken().deactivate(); try { KeyTools.testKey(catoken.getPrivateKey(CATokenConstants.CAKEYPURPOSE_CERTSIGN), catoken.getPublicKey(CATokenConstants.CAKEYPURPOSE_CERTSIGN), catoken.getCryptoToken().getSignProviderName()); assertTrue(false); } catch (CryptoTokenOfflineException e) { assertEquals(getProvider(), e.getMessage()); } // Activate with wrong PIN should not work try { catoken.getCryptoToken().activate("foo123".toCharArray()); assertTrue("should throw", false); } catch (CryptoTokenAuthenticationFailedException e) { String strsoft = "PKCS12 key store mac invalid - wrong password or corrupted file."; String strp11 = "Failed to initialize PKCS11 provider slot '1'."; assert (e.getMessage().equals(strsoft) || e.getMessage().equals(strp11)); } catoken.getCryptoToken().activate(tokenpin.toCharArray()); KeyTools.testKey(catoken.getPrivateKey(CATokenConstants.CAKEYPURPOSE_CERTSIGN), catoken.getPublicKey(CATokenConstants.CAKEYPURPOSE_CERTSIGN), catoken.getCryptoToken().getSignProviderName()); // Try to generate keys with wrong password // The pkcs#11 session is already open and does not care what password we use. // The p11 password is only used by p11 when creating the session. SO we could put wrong pwd here for P11, but not for soft try { catoken.generateKeys(tokenpin.toCharArray(), false, true); KeyTools.testKey(catoken.getPrivateKey(CATokenConstants.CAKEYPURPOSE_CERTSIGN), catoken.getPublicKey(CATokenConstants.CAKEYPURPOSE_CERTSIGN), catoken.getCryptoToken().getSignProviderName()); } catch (CryptoTokenAuthenticationFailedException e) { assertTrue("should not throw", false); } } finally { // End by deleting all old entries catoken.getCryptoToken().deleteEntry(tokenpin.toCharArray(), "rsatest00000"); catoken.getCryptoToken().deleteEntry(tokenpin.toCharArray(), "rsatest00001"); catoken.getCryptoToken().deleteEntry(tokenpin.toCharArray(), "rsatest00002"); catoken.getCryptoToken().deleteEntry(tokenpin.toCharArray(), "rsatest00003"); } }
From source file:emenda.kwopenproject.Activator.java
public boolean storeProperties(Properties prop) { if (prop != null) { //Remove temporary filepath value from file before storing String filepath = prop.getProperty(PROP_TEMP_FILEPATH); prop.remove(PROP_TEMP_FILEPATH); try {//from w ww . j a va2s.co m logging.writeLog("Storing properties file: " + filepath + "..."); prop.store(new FileOutputStream(filepath), null); logging.writeLog("Storing properties file: " + filepath + "... SUCCESS"); } catch (Exception e) { logging.writeLog("Exception while writing Klocwork Sync properties to file: " + prop.getProperty(PROP_TEMP_FILEPATH) + "\nMessage: " + e.getMessage()); return false; } } return true; }
From source file:org.wso2.carbon.identity.notification.mgt.NotificationMgtConfigBuilder.java
/** * Build and store per module configuration objects *///from w w w .ja v a 2s. co m private void build() { Properties moduleNames = NotificationManagementUtils .getSubProperties(NotificationMgtConstants.Configs.MODULE_NAME, notificationMgtConfigProperties); Enumeration propertyNames = moduleNames.propertyNames(); // Iterate through events and build event objects while (propertyNames.hasMoreElements()) { String key = (String) propertyNames.nextElement(); String moduleName = (String) moduleNames.remove(key); moduleConfiguration.put(moduleName, buildModuleConfigurations(moduleName)); } }