List of usage examples for java.util Properties get
@Override
public Object get(Object key)
From source file:com.ny.apps.executor.jedis.SimpleJedisCacheTools.java
public SimpleJedisCacheTools() { Resource resource = new ClassPathResource("/jedis.properties"); try {//from ww w . j a va 2 s . c om Properties props = PropertiesLoaderUtils.loadProperties(resource); this.maxActiveNumber = Integer.parseInt((String) props.get("maxActiveNumber")); this.maxIdleNumber = Integer.parseInt((String) props.get("maxIdleNumber")); this.maxWaitSecond = Integer.parseInt((String) props.get("maxWaitSecond")); this.isTestOnBorrow = Boolean.parseBoolean((String) props.get("isTestOnBorrow")); this.host = (String) props.get("host"); this.port = Integer.parseInt((String) props.get("port")); } catch (IOException e) { e.printStackTrace(); return; } if (this.jedisPool == null) { JedisPoolConfig config = new JedisPoolConfig(); config.setMaxActive(maxActiveNumber); config.setMaxIdle(maxIdleNumber); config.setMaxWait(1000 * maxWaitSecond); config.setTestOnBorrow(isTestOnBorrow); jedisPool = new JedisPool(config, host, port); } }
From source file:ca.gnewton.lusql.core.LuSqlMain.java
static void explainPlugin() throws ClassNotFoundException, NoSuchMethodException, InstantiationException, IllegalAccessException, java.lang.reflect.InvocationTargetException { String[] explain = getExplainPlugins(); for (int i = 0; i < explain.length; i++) { Class<?> docSourceClass = Class.forName(explain[i]); Constructor<? extends Object> constructor = docSourceClass.getConstructor(); Plugin plugin = (Plugin) constructor.newInstance(); String pluginType = "Plugin"; if (plugin instanceof DocFilter) pluginType = "Filter"; else if (plugin instanceof DocSource) pluginType = "Source"; if (plugin instanceof DocSink) pluginType = "Sink"; Properties ex = plugin.explainProperties(); log.info(explain[i]);// w w w . j av a 2 s . c o m log.info("Description: " + plugin.description()); if (ex == null) { System.err.println("\tNo properties"); return; } Iterator<Object> it = ex.keySet().iterator(); while (it.hasNext()) { String key = (String) it.next(); log.info("Property: " + key + ": " + ex.get(key)); } } }
From source file:com.bellman.bible.service.readingplan.ReadingPlanDao.java
/** * get readings for one day/*from www. j a v a 2 s . c o m*/ */ public OneDaysReadingsDto getReading(String planName, int dayNo) { Properties properties = getPlanProperties(planName); String readings = (String) properties.get(Integer.toString(dayNo)); Log.d(TAG, "Readings for day:" + readings); return new OneDaysReadingsDto(dayNo, readings, getReadingPlanInfoDto(planName)); }
From source file:egovframework.com.utl.wed.filter.CkFilter.java
public void init(FilterConfig filterConfig) throws ServletException { String properties = filterConfig.getInitParameter("properties"); InputStream inStream = Thread.currentThread().getContextClassLoader().getResourceAsStream(properties); Properties props = new Properties(); try {//ww w. j a v a 2 s . c o m props.load(inStream); } catch (IOException e) { log.error(e); } String imageBaseDir = (String) props.get(IMAGE_BASE_DIR_KEY); String imageDomain = (String) props.get(IMAGE_BASE_URL_KEY); String[] allowFileTypeArr = null; String allowFileType = (String) props.get(IMAGE_ALLOW_TYPE_KEY); if (StringUtils.isNotBlank(allowFileType)) { allowFileTypeArr = StringUtils.split(allowFileType, ","); } String saveManagerClass = (String) props.get(IMAGE_SAVE_CLASS_KEY); ckImageSaver = new CkImageSaver(imageBaseDir, imageDomain, allowFileTypeArr, saveManagerClass); }
From source file:com.dc.tes.adapter.startup.remote.StartUpRemoteForReply.java
/** * "?"?,???/* w w w. jav a 2s . c o m*/ * @param props ???(ComLayer.config.xml) */ public void startAdapter(Properties props) { String adapterName = props.getProperty("CHANNELNAME"); try { String clsName = "com.dc.tes.adapterlib." + (String) props.get("adapterPlugIn"); m_replyAdapterInstance = (IReplyAdapter) ConfigHelper.class.getClassLoader().loadClass(clsName) .newInstance(); System.out.println("???" + clsName); log.error("???" + clsName); // License m_props.setProperty("SIMTYPE", m_replyAdapterInstance.AdapterType()); m_adpterHelper = new DefaultReplyAdapterHelper(m_props); // byte[] config = m_adpterHelper.reg2TES(); // ? if (m_replyAdapterInstance.Init(new DefaultReplyAdapterEnvContext(config, m_adpterHelper))) { m_adpterHelper.SetConfigProperty(m_replyAdapterInstance.GetAdapterConfigProperties()); System.out.println("??" + adapterName + "?Init?."); log.info("??" + adapterName + "?Init?."); // ??? m_replyAdapterInstance.Start(); } else { m_adpterHelper.unReg2TES(); // ?m_replyAdapterInstance.Stop() System.out.println("??" + adapterName + "?Init."); log.error("??" + adapterName + "?Init."); } } catch (InstantiationException e) { log.error("??!?"); System.out.println("??!?"); } catch (IllegalAccessException e) { log.error("??!?[" + e.getMessage() + "]"); System.out.println( "??!?[" + e.getMessage() + "]"); } catch (ClassNotFoundException e) { log.error("???!?[" + e.getMessage() + "]"); System.out.println( "???!?[" + e.getMessage() + "]"); } catch (Exception e) { log.error("??[" + e.getMessage()); System.out.println("??[" + e.getMessage()); } System.out.println("??" + adapterName + "??."); log.info("??" + adapterName + "??."); }
From source file:com.bluexml.side.Framework.alfresco.signature.integration.SignatureHelper.java
private boolean testProps(Properties props) { if (props.get("Service.signature.location") == null) { props.setProperty("Service.signature.reason", ""); }// w w w . ja va2s . co m if (props.get("Service.signature.location") == null) { props.setProperty("Service.signature.location", ""); } if (props.get("Service.signature.key.password") == null || props.get("Service.signature.key.password").equals("") || props.get("Service.signature.keystore.path") == null || props.get("Service.signature.keystore.path").equals("") || props.get("Service.signature.key.alias") == null || props.get("Service.signature.key.alias").equals("") || props.get("Service.signature.keystore.name") == null || props.get("Service.signature.keystore.name").equals("") || props.get("Service.signature.keystore.password") == null || props.get("Service.signature.keystore.password").equals("") || props.get("Service.signature.visibility") == null || props.get("Service.signature.visibility").equals("") || props.get("Service.signature.key.type") == null || props.get("Service.signature.key.type").equals("") || props.get("Service.signature.width") == null || props.get("Service.signature.width").equals("") || props.get("Service.signature.heigth") == null || props.get("Service.signature.heigth").equals("") || props.get("Service.signature.position.x") == null || props.get("Service.signature.position.x").equals("") || props.get("Service.signature.signed.file.name") == null || props.get("Service.signature.signed.file.name").equals("") || props.get("Service.signature.position.y") == null || props.get("Service.signature.position.y").equals("")) { return true; } else { return false; } }
From source file:ar.com.zauber.commons.spring.exceptions.StatusSimpleMappingExceptionHandler.java
/** * Sets the Status mappings (for each view name, it determines an http error * code). The key are the view names (Strings) and the values must be * integers/*from w ww .j ava 2 s . c o m*/ */ public final void setStatusMappings(final Properties values) { if (values != null) { // fail fast if the configuration is wrong for (Object k : values.keySet()) { if (k instanceof String) { final Object v = values.get(k); Integer value = null; if (v instanceof String) { value = Integer.parseInt((String) v); } else if (v instanceof Number) { value = ((Number) v).intValue(); } else { throw new IllegalArgumentException("values must be integers"); } Validate.notNull(value, "null status for " + k); statusMappings.put((String) k, value); } else { throw new IllegalArgumentException("keys are view names, " + "and view names must be strings"); } } } }
From source file:com.magnet.tools.tests.ScenarioUtils.java
@And("^the property file \"([^\"]*)\" should be:$") public static void the_property_file_should_be(String path, List<PropertyEntry> entries) throws Throwable { File propertyFile = new File(expandVariables(path)); Assert.assertTrue(propertyFile.exists()); Properties props = new Properties(); InputStream fis = null;//from ww w . j a va 2 s . com try { fis = new FileInputStream(propertyFile); props.load(fis); } finally { if (null != fis) { try { fis.close(); } catch (Exception e) { /* do nothing */ } } } for (PropertyEntry entry : entries) { if (props.containsKey(expandVariables(entry.key))) { Assert.assertEquals(expandVariables(entry.value), props.get(expandVariables(entry.key))); } else { Assert.fail(entry.key + " key not found in file " + propertyFile); } } }
From source file:org.agatom.springatom.core.locale.SAMessageSource.java
@Override public Map<String, String> getAllMessages(final Locale locale) { final Properties properties = this.getMergedProperties(locale).getProperties(); final Map<String, String> map = Maps.newHashMapWithExpectedSize(properties.size()); for (final Object propKey : properties.keySet()) { map.put(propKey.toString(), properties.get(propKey).toString()); }//from w w w .j a v a 2 s . com return map; }
From source file:com.edgenius.wiki.service.impl.SystemPropertyPlaceholderConfigurer.java
@Override public void postProcessBeanFactory(ConfigurableListableBeanFactory beanFactory) throws BeansException { Properties props = loadProperties(); DefaultResourceLoader loader = new DefaultResourceLoader(); Resource globalConf = loader.getResource(props.get(DataRoot.rootKey) + Global.FILE); initGlobal(globalConf);/*from ww w . j a v a 2s. c o m*/ super.postProcessBeanFactory(beanFactory); }