Example usage for java.util Properties get

List of usage examples for java.util Properties get

Introduction

In this page you can find the example usage for java.util Properties get.

Prototype

@Override
    public Object get(Object key) 

Source Link

Usage

From source file:edu.mayo.cts2.framework.core.plugin.SupplementalPropetiesLoader.java

@Override
public void afterPropertiesSet() throws Exception {
    File overridesDir = new File(this.configInitializer.getContextConfigDirectory().getPath() + File.separator
            + ConfigConstants.CONFIG_DIRECTORY);

    if (overridesDir.exists()) {
        FileFilter nonDeploymentConfigFiles = new FileFilter() {
            @Override// www  .j  av  a  2  s. c  o  m
            public boolean accept(File file) {
                return !StringUtils.equals(ConfigConstants.CTS2_DEPLOYMENT_CONFIG_FILE_NAME, file.getName());
            }
        };

        for (File file : overridesDir.listFiles(nonDeploymentConfigFiles)) {
            Properties props = ConfigUtils.loadProperties(file);
            String pid = (String) props.get(Constants.SERVICE_PID);

            if (pid == null) {
                throw new IllegalStateException(
                        "Overriding Properties File must include a " + Constants.SERVICE_PID + " propery.");
            }

            this.overrides.put(pid, props);
        }
    }
}

From source file:coral.PolypVsetServable.java

@Override
public void init(Properties properties, BlockingQueue<Message> loopQueue, Linker linker) {

    shell = (Shell) properties.get("shell");

    res = new File(properties.getProperty("coral.polyp.res", "res/"));

    robotfilename = properties.getProperty("coral.polyp.robot");
    mainfilename = properties.getProperty("coral.polyp.main", "main.html");

    setup();/* w  w w  .  j  a v a 2  s  . co m*/

    int noclients = Integer.parseInt(properties.getProperty("coral.polyp.number", "1"));

    int perrow = (int) Math.round(Math.ceil(Math.sqrt(noclients)));

    if (noclients > 1) {
        GridData gd = new GridData();
        gd.grabExcessHorizontalSpace = true;
        gd.grabExcessVerticalSpace = true;
        gd.widthHint = shell.getSize().x / perrow;
        gd.heightHint = shell.getSize().y / perrow;
        gd.horizontalAlignment = GridData.FILL;
        gd.verticalAlignment = GridData.FILL;

        browser.setLayoutData(gd);
        browser.setSize(shell.getSize().x / perrow, shell.getSize().y / perrow);

        logger.debug("set client to size with x:" + shell.getSize().x + " y:" + shell.getSize().y + " perrow:"
                + perrow + "");
        logger.debug("layout " + browser.getLayout());
        logger.debug("layout " + shell.getLayout());

    }
}

From source file:com.evolveum.midpoint.web.component.menu.top.LocaleDescriptor.java

public LocaleDescriptor(Properties properties) {
    Validate.notNull(properties);/*w w w.ja  v  a  2  s  .c o  m*/

    this.name = (String) properties.get(PROPERTY_NAME);
    this.flag = (String) properties.get(PROPERTY_FLAG);

    String locale = (String) properties.get(PROPERTY_LOCALE);
    if (StringUtils.isEmpty(locale)) {
        throw new IllegalStateException("Property file - locale descriptor doesn't contain property '"
                + PROPERTY_LOCALE + "' with locale definition.");
    }
    this.locale = WebMiscUtil.getLocaleFromString(locale);
}

From source file:de.iritgo.aktario.betwixt.command.LoadBetwixtBean.java

/**
 * Set the command Properties//from  ww w.j  ava  2s  .  co m
 *
 * @param properties The properties.
 */
@Override
public void setProperties(Properties properties) {
    super.setProperties(properties);

    bean = (Object) properties.get("bean");

    path = (String) properties.get("path");

    if (path == null) {
        path = Engine.instance().getSystemDir() + Engine.instance().getFileSeparator();
    }

    filename = (String) properties.get("filename");

    if (filename == null) {
        filename = bean.getClass().getName();
    }
}

From source file:com.carrotgarden.maven.aws.grv.TestCarrotGroovyRunner.java

@Test
public void testFile() throws Exception {

    final Properties properties = new Properties();
    properties.put("prop-key", "prop-value-1");

    assertEquals(properties.get("prop-key"), "prop-value-1");

    final MavenProject project = mock(MavenProject.class);

    when(project.getProperties()).thenReturn(properties);

    final CarrotGroovyRunner runner = new CarrotGroovyRunner(project);

    final File script = new File("./src/test/resources/script.groovy");

    final Object result = runner.execute(script);

    assertEquals(result, "result");

    assertEquals(properties.get("prop-key"), "prop-value-2");

}

From source file:com.carrotgarden.maven.aws.grv.TestCarrotGroovyRunner.java

@Test
public void testString() throws Exception {

    final Properties properties = new Properties();
    properties.put("prop-key", "prop-value-1");

    assertEquals(properties.get("prop-key"), "prop-value-1");

    final MavenProject project = mock(MavenProject.class);

    when(project.getProperties()).thenReturn(properties);

    final CarrotGroovyRunner runner = new CarrotGroovyRunner(project);

    final File file = new File("./src/test/resources/script.groovy");

    final String script = FileUtils.readFileToString(file);

    final Object result = runner.execute(script);

    assertEquals(result, "result");

    assertEquals(properties.get("prop-key"), "prop-value-2");

}

From source file:coral.ScreenshotServable.java

@Override
public void init(Properties properties, BlockingQueue<Message> loopQueue, Linker linker) {

    this.shell = (Shell) properties.get("shell");

    logger.debug("ready");

}

From source file:de.iritgo.aktario.betwixt.command.SaveBaseObjects.java

/**
 * Set the command Properties/*w w  w . j  av a  2s.c o  m*/
 *
 * @param properties The properties.
 */
@Override
public void setProperties(Properties properties) {
    path = (String) properties.get("path");

    if (path == null) {
        path = Engine.instance().getSystemDir() + Engine.instance().getFileSeparator();
    }
}

From source file:de.extra.client.starter.ExtraClientPropertiesTest.java

@Test
public void testProperties() throws Exception {
    final ApplicationContext context = extraClient.createApplicationContext();
    final Properties basicProperties = context.getBean(ExtraClient.BEAN_NAME_EXTRA_PROPERTIES_BASIC,
            Properties.class);
    assertEquals("DRV", basicProperties.get("extra.mandant"));
    assertEquals("drv property content", basicProperties.get("drv.property"));
}

From source file:hu.bme.mit.trainbenchmark.benchmark.blazegraph.driver.BlazegraphDriver.java

public BlazegraphDriver(final boolean inferencing) throws IOException, RepositoryException {
    super(inferencing);

    // remove Blazegraph banner text
    System.getProperties().setProperty("com.bigdata.Banner.quiet", "true");
    System.getProperties().setProperty("com.bigdata.util.config.LogUtil.quiet", "true");

    // load journal properties from resources
    final Properties props = loadProperties("/blazegraph.properties");
    // instantiate a sail
    final String journalFile = (String) props.get("com.bigdata.journal.AbstractJournal.file");
    FileUtils.deleteQuietly(new File(journalFile));

    sail = new BigdataSail(props);
    repository = new BigdataSailRepository(sail);
    repository.initialize();/*from   w ww  . j a  v a2s . co  m*/
}