List of usage examples for java.util Properties get
@Override
public Object get(Object key)
From source file:org.jasig.cas.CasEnvironmentContextListener.java
/** * Collect environment info with// w ww . ja v a 2 s. c o m * details on the java and os deployment * versions. * * @return environment info */ private String collectEnvironmentInfo() { final Properties properties = System.getProperties(); final Formatter formatter = new Formatter(); formatter.format("\n******************** Welcome to CAS ********************\n"); formatter.format("CAS Version: %s\n", CasVersion.getVersion()); formatter.format("Java Home: %s\n", properties.get("java.home")); formatter.format("Java Vendor: %s\n", properties.get("java.vendor")); formatter.format("Java Version: %s\n", properties.get("java.version")); formatter.format("OS Architecture: %s\n", properties.get("os.arch")); formatter.format("OS Name: %s\n", properties.get("os.name")); formatter.format("OS Version: %s\n", properties.get("os.version")); formatter.format("*******************************************************\n"); return formatter.toString(); }
From source file:com.consol.citrus.admin.service.ProjectServiceTest.java
@Test(dataProvider = "projectProvider") public void testGetProjectProperties(String projectHome, String description, Map<String, String> properties, boolean connectorActive) throws Exception { Project testProject = new Project(new ClassPathResource(projectHome).getFile().getCanonicalPath()); projectService.setActiveProject(testProject); Properties projectProperties = projectService.getProjectProperties(); Assert.assertEquals(projectProperties.size(), properties.size()); for (Map.Entry<String, String> propEntry : properties.entrySet()) { Assert.assertEquals(projectProperties.get(propEntry.getKey()), propEntry.getValue()); }// w w w . j a v a 2 s . c o m }
From source file:hydrograph.ui.expression.editor.buttons.OperatorToolCombo.java
private void loadDropDownItems() { Properties properties = new Properties(); InputStream inStream;/*from w w w . j a v a 2 s. co m*/ try { inStream = ExpressionEditorUtil.INSTANCE.getPropertyFilePath(PathConstant.OPERATOR_CONFIG_FILE); properties.load(inStream); for (Object key : properties.keySet()) { if (key != null && properties.get(key) != null) { String operatorName = StringUtils.replaceChars((String) key, '_', SWT.SPACE); this.add(operatorName); this.setData(operatorName, (String) properties.get(key)); } } } catch (IOException | RuntimeException exception) { LOGGER.error("Exception occurred while loading property file.", exception); StringBuffer buffer = new StringBuffer(); buffer.append(Messages.OPERATOR_FILE_NOT_FOUND); new CustomMessageBox(SWT.ICON_WARNING, buffer.toString(), Messages.WARNING).open(); } }
From source file:com.heliosapm.streams.collector.ds.pool.PoolConfig.java
/** * Creates and deploys an ObjectPool based on the passed config props * @param p The configuration properties * @return the created GenericObjectPool *//* www. ja v a 2s . c om*/ @SuppressWarnings({ "rawtypes", "unchecked" }) private static GenericObjectPool<?> deployPool(final Properties p) { final String factoryName = (String) p.remove(POOLED_OBJECT_FACTORY_KEY); final String poolName = p.getProperty(NAME.name().toLowerCase()); if (poolName == null || poolName.trim().isEmpty()) throw new RuntimeException("Pool was not assigned a name"); if (factoryName == null || factoryName.trim().isEmpty()) throw new RuntimeException("No pooled object factory defined"); final GenericObjectPoolConfig cfg = DEFAULT_CONFIG.clone(); try { final Class<PooledObjectFactoryBuilder<?>> clazz = loadFactoryClass(factoryName); final Constructor<PooledObjectFactoryBuilder<?>> ctor = clazz.getDeclaredConstructor(Properties.class); final PooledObjectFactoryBuilder<?> factory = ctor.newInstance(p); for (final String key : p.stringPropertyNames()) { if (isPoolConfig(key)) { final PoolConfig pc = decode(key); pc.apply(cfg, p.get(key)); } } final PooledObjectFactory<?> pooledObjectFactory = factory.factory(); GenericObjectPool<?> pool = new GenericObjectPool(pooledObjectFactory, cfg); pool.setSwallowedExceptionListener(EX_LISTENER); if (factory instanceof PoolAwareFactory) { ((PoolAwareFactory) factory).setPool(pool); } GlobalCacheService.getInstance().put("pool/" + poolName, pool); pool.setAbandonedConfig(Abandoned.create(p)); pool.preparePool(); return pool; } catch (Exception ex) { throw new RuntimeException("Failed to create GenericObjectPool from properties [" + p + "]", ex); } }
From source file:com.alibaba.rocketmq.tools.command.broker.GetBrokerConfigCommand.java
protected void getAndPrint(final MQAdminExt defaultMQAdminExt, final String printPrefix, final String addr) throws InterruptedException, RemotingConnectException, UnsupportedEncodingException, RemotingTimeoutException, MQBrokerException, RemotingSendRequestException { System.out.print(printPrefix); Properties properties = defaultMQAdminExt.getBrokerConfig(addr); if (properties == null) { System.out.printf("Broker[%s] has no config property!\n", addr); return;/*from w ww .j a v a2 s.c om*/ } for (Object key : properties.keySet()) { System.out.printf("%-50s= %s\n", key, properties.get(key)); } System.out.printf("%n"); }
From source file:com.seeyon.apps.m1.common.manager.menu.impl.MMenuManagerImpl.java
@Override public MList<MMenuItemsCount> getMenusCount() throws BusinessException { MList<MMenuItemsCount> mlist = new MList<MMenuItemsCount>(); List<MMenuItemsCount> list = new ArrayList<MMenuItemsCount>(); MMenuItemsCount mcount = new MMenuItemsCount(); // ????//w w w. j a v a 2s. c om mcount.setModuleType(MConstant.C_iModuleType_Collaboration); mcount.setCount(MMenuUtils.getColCount(colManager)); list.add(mcount); // C_menu_log.info( // "**********************************???*************************" + // mcount.getCount()); // ? mcount = new MMenuItemsCount(); mcount.setModuleType(MConstant.C_iModuleType_EDoc); mcount.setCount(MMenuUtils.getEdocCount(edocListManager)); list.add(mcount); // C_menu_log.info( // "***********************************************************" + // mcount.getCount()); // ? if (mMeetingManager != null) { mcount = new MMenuItemsCount(); mcount.setModuleType(MConstant.C_iModuleType_Meeting); mcount.setCount(MMenuUtils.getMMeetingCount(mMeetingManager)); list.add(mcount); } try { // ?32?? String ssoTicket = mloginManager.getDataByLoginname(AppContext.currentUserLoginName()); if (ssoTicket != null) { InputStream input = null; input = MLoginManagerImpl.class.getClassLoader().getResourceAsStream("getMessage.properties"); Properties config = new Properties(); config.load(input); String app1Url = StringUtils.trim((String) config.get("app1Url")); String app2Url = StringUtils.trim((String) config.get("app2Url")); String app3Url = StringUtils.trim((String) config.get("app3Url")); mcount = new MMenuItemsCount(); mcount.setModuleType(2001); if (app1Url != null && app1Url.length() > 10) { if (app1Url.indexOf("?") == -1) { app1Url = app1Url + "?ticket=" + ssoTicket; } else { app1Url = app1Url + "&ticket=" + ssoTicket; } } mcount.setCount(getNum(app1Url)); list.add(mcount); mcount = new MMenuItemsCount(); mcount.setModuleType(2002); if (app2Url != null && app2Url.length() > 10) { if (app2Url.indexOf("?") == -1) { app2Url = app2Url + "?ticket=" + ssoTicket; } else { app2Url = app2Url + "&ticket=" + ssoTicket; } } mcount.setCount(getNum(app2Url)); list.add(mcount); mcount = new MMenuItemsCount(); mcount.setModuleType(2003); if (app3Url != null && app3Url.length() > 10) { if (app3Url.indexOf("?") == -1) { app3Url = app3Url + "?ticket=" + ssoTicket; } else { app3Url = app3Url + "&ticket=" + ssoTicket; } } mcount.setCount(getNum(app3Url)); list.add(mcount); } } catch (Exception e) { // TODO Auto-generated catch block e.printStackTrace(); } mlist.setValue(list); return mlist; }
From source file:any.servable.VsetServable.java
@Override public void init(Properties properties, BlockingQueue<Message> loopQueue, Linker linker) { this.loopqueue = loopQueue; this.shell = (Shell) properties.get("shell"); this.res = new File(properties.getProperty("any.res", "res/")); this.mainfilename = properties.getProperty("any.main", "main.html"); setup();// ww w. j ava 2 s .com }
From source file:net.jforum.util.JForumConfig.java
private void loadCustomProperties() throws Exception { InputStream is = this.getClass().getResourceAsStream("/jforumConfig/jforum-custom.properties"); if (is != null) { Properties custom = new Properties(); custom.load(is);/*from w w w .j av a 2s .c o m*/ for (Enumeration<?> e = custom.keys(); e.hasMoreElements();) { String key = (String) e.nextElement(); this.clearProperty(key); this.addProperty(key, custom.get(key)); } } }
From source file:com.haulmont.cuba.uberjar.ServerRunner.java
protected int getDefaultWebPort() { ClassLoader classLoader = Thread.currentThread().getContextClassLoader(); try {/*from w w w . j av a 2 s . c o m*/ Properties properties = new Properties(); properties.load(classLoader.getResourceAsStream(getPropertiesForPort(classLoader))); String webPort = (String) properties.get("cuba.webPort"); if (webPort != null && !webPort.isEmpty()) { return Integer.parseInt(webPort); } } catch (Exception e) { System.out.println("Error while parsing port, use default port"); } return 8080; }
From source file:org.solmix.runtime.cm.support.SpringConfigureUnitManager.java
/** * @param props/*from w ww. ja v a2 s .co m*/ */ private void checkSystemProperties(Properties properties) { if (properties != null) { Enumeration<Object> en = properties.keys(); while (en.hasMoreElements()) { Object key = en.nextElement(); Object value = properties.get(key); if (value != null) { value = DataUtils.getTemplateValue(value.toString()); } properties.put(key, value); } } }