Example usage for java.util Properties keySet

List of usage examples for java.util Properties keySet

Introduction

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

Prototype

@Override
    public Set<Object> keySet() 

Source Link

Usage

From source file:info.magnolia.cms.beans.config.PropertiesInitializer.java

/**
 * @deprecated since 4.5, replaced by a new ClasspathPropertySource("/mgnl-beans.properties").
 * @see info.magnolia.init.DefaultMagnoliaConfigurationProperties
 *//*w  ww . j a  v  a  2 s . c o  m*/
public void loadBeanProperties() {
    InputStream mgnlbeansStream = getClass().getResourceAsStream(MGNL_BEANS_PROPERTIES);

    if (mgnlbeansStream != null) {
        Properties mgnlbeans = new Properties();
        try {
            mgnlbeans.load(mgnlbeansStream);
        } catch (IOException e) {
            log.error("Unable to load {} due to an IOException: {}", MGNL_BEANS_PROPERTIES, e.getMessage());
        } finally {
            IOUtils.closeQuietly(mgnlbeansStream);
        }

        for (Iterator<Object> iter = mgnlbeans.keySet().iterator(); iter.hasNext();) {
            String key = (String) iter.next();
            SystemProperty.setProperty(key, mgnlbeans.getProperty(key));
        }

    } else {
        log.warn(
                "{} not found in the classpath. Check that all the needed implementation classes are defined in your custom magnolia.properties file.",
                MGNL_BEANS_PROPERTIES);
    }
}

From source file:pl.project13.maven.git.GitCommitIdMojo.java

private void logProperties(@NotNull Properties properties) {
    for (Object key : properties.keySet()) {
        String keyString = key.toString();
        if (isOurProperty(keyString)) {
            log.info("found property {}", keyString);
        }/*from ww  w .  j  a  va2 s.c o  m*/
    }
}

From source file:com.mirth.connect.server.controllers.DefaultExtensionController.java

@Override
public void setPluginProperties(String pluginName, Properties properties) throws ControllerException {
    configurationController.removePropertiesForGroup(pluginName);

    for (Object name : properties.keySet()) {
        configurationController.saveProperty(pluginName, (String) name, (String) properties.get(name));
    }/*w  w  w  .j  a v a2  s  .c o  m*/
}

From source file:com.redhat.satellite.search.config.Configuration.java

private void parseStream(Properties props, String namespace, InputStream is) throws IOException {

    props.load(is);//w  w  w  .  jav  a 2s.c  om

    // loop through all of the config values in the properties file
    // making sure the prefix is there.
    Properties newProps = new Properties();
    for (Iterator j = props.keySet().iterator(); j.hasNext();) {
        String key = (String) j.next();
        String newKey = key;
        if (!key.startsWith(namespace)) {
            newKey = namespace + "." + key;
        }
        logger.debug("Adding: " + newKey + ": " + props.getProperty(key));
        // translate the original key
        newKey = translateKey(key);
        newProps.put(newKey, props.getProperty(key));
    }
    configValues.putAll(newProps);
}

From source file:com.jaspersoft.studio.utils.jasper.JasperReportsConfiguration.java

@Override
public Map<String, String> getProperties() {
    if (isPropsCached)
        return getPropertiesMap();
    setPropertiesMap(null);/* ww  w .  java 2s  . c  o  m*/
    Map<String, String> smap = super.getProperties();
    Map<String, String> propmap = new HashMap<String, String>();
    if (smap != null && !smap.isEmpty())
        propmap.putAll(smap);
    setPropertiesMap(propmap);
    // get properties from eclipse stored jr properties (eclipse, project, file level)
    Properties props = getJRProperties();
    for (Object key : props.keySet()) {
        if (!(key instanceof String))
            continue;
        String val = props.getProperty((String) key);
        if (val != null)
            propmap.put((String) key, val);
    }
    isPropsCached = true;
    // let's look also into the preferences maybe there are some properties
    pstore.setWithDefault(false);
    for (String key : propmap.keySet()) {
        String val = Misc.nullIfEmpty(pstore.getString(key));
        if (val != null)
            propmap.put(key, val);
    }
    pstore.setWithDefault(true);
    return propmap;
}

From source file:org.apache.servicemix.jbi.deployer.impl.ComponentInstaller.java

public void configure(Properties props) throws Exception {
    if (props != null && props.size() > 0) {
        ObjectName on = getInstallerConfigurationMBean();
        if (on == null) {
            LOGGER.warn(//ww w.j av a  2 s.c o  m
                    "Could not find installation configuration MBean. Installation properties will be ignored.");
        } else {
            MBeanServer mbs = deployer.getMbeanServer();
            for (Object o : props.keySet()) {
                String key = (String) o;
                String val = props.getProperty(key);
                try {
                    mbs.setAttribute(on, new Attribute(key, val));
                } catch (JMException e) {
                    throw new DeploymentException("Could not set installation property: (" + key + " = " + val,
                            e);
                }
            }
        }
    }
}

From source file:com.wabacus.config.ConfigLoadManager.java

public static Map convertPropertiesToResources(Properties props) {
    Map mResults = new HashMap();
    if (props == null || props.isEmpty()) {
        return null;
    }/*from  ww  w .j  av  a 2  s  . com*/
    Iterator itKeys = props.keySet().iterator();
    while (itKeys.hasNext()) {
        String key = (String) itKeys.next();
        String value = (String) props.get(key);
        //                try
        //                    e.printStackTrace();
        if (mResults.containsKey(key)) {
            throw new WabacusConfigLoadingException(
                    "??key" + key + "???");
        }
        mResults.put(key, value);
    }
    return mResults;
}

From source file:de.iritgo.aktario.framework.IritgoEngine.java

/**
 * Initialize the framework./*  www  .ja  va 2 s . co  m*/
 *
 * @param options The command line options.
 * @throws InitIritgoException If an error occurred during initialization.
 */
private void init(CommandLine options) {
    try {
        commandLine = options;

        File sysDir = new File(".");

        if (commandLine.hasOption("s")) {
            sysDir = new File(commandLine.getOptionValue("s").trim());
        }

        try {
            Properties sysProperties = new Properties();

            sysProperties.load(new FileInputStream(new File(sysDir, "sys.properties")));

            for (Object key : sysProperties.keySet()) {
                System.setProperty(key.toString(), sysProperties.get(key).toString());
            }
        } catch (FileNotFoundException x1) {
        } catch (IOException x1) {
        }

        AppContext appContext = AppContext.instance();
        ServerAppContext serverAppContext = ServerAppContext.serverInstance();

        if (options.hasOption("d")) {
            Log.setLevel(NumberTools.toInt(options.getOptionValue("d"), Log.ERROR));
        } else if (System.getProperty("iritgo.debug.level") != null) {
            Log.setLevel(NumberTools.toInt(System.getProperty("iritgo.debug.level"), Log.ERROR));
        } else {
            Log.setLevel(Log.ERROR);
        }

        initEngine();

        if (mode == IritgoEngine.START_CLIENT) {
            try {
                //TODO: xml rpc port Hack!
                String xmlRPCPort = commandLine.getOptionValue("x");

                if (!StringTools.isEmpty(xmlRPCPort)) {
                    System.out.println("****************** xmlRPCPort:" + xmlRPCPort);
                    appContext.put("xmlrpcport", xmlRPCPort);
                }

                splash = (Splash) Class.forName("de.iritgo.aktario.core.splash.CustomSplash").newInstance();
            } catch (Exception x) {
                splash = new Splash();
            }
        }

        if (splash != null) {
            splash.setText("Initializing: Engine");
        }

        initIdGenerator();
        registerDefaultActions();
        registerDefaultManager();
        registerConsoleCommands();
        initCommandProcessor();
        initConfiguration();

        if (mode == IritgoEngine.START_SERVER) {
            server = Server.instance();
            server.init();
            serverAppContext.setServer(true);
            serverAppContext.setClient(false);
            appContext.setServer(true);
            appContext.setClient(false);
        }

        if (mode == IritgoEngine.START_CLIENT) {
            checkLoginOptions(commandLine);
            client = Client.instance();
            client.init();
            serverAppContext.setServer(false);
            serverAppContext.setClient(true);
            appContext.setServer(false);
            appContext.setClient(true);
        }

        initPlugins();
        AgentManager.createAgentManager(mode);

        registerDefaultDataObjects();

        if (mode == IritgoEngine.START_SERVER) {
            server = Server.instance();
            server.start();
        }

        if (mode == IritgoEngine.START_CLIENT) {
            splash.setText("Initializing: Client");
            client = Client.instance();
            client.initGUI();
            client.startGUI();
            client.startApplication();
            splash.startCoolDown();
        }
    } catch (InitIritgoException x) {
        if (engine != null) {
            engine.stop();
        }
    }
}

From source file:hydrograph.ui.expression.editor.composites.CategoriesDialogTargetComposite.java

public void loadPackagesFromPropertyFileSettingFolder() {
    Properties properties = new Properties();
    IFolder folder = BuildExpressionEditorDataSturcture.INSTANCE.getCurrentProject()
            .getFolder(PathConstant.PROJECT_RESOURCES_FOLDER);
    IFile file = folder.getFile(PathConstant.EXPRESSION_EDITOR_EXTERNAL_JARS_PROPERTIES_FILES);
    try {//w  w w.  ja v  a2s .  c  o  m
        LOGGER.debug("Loading property file");
        targetList.removeAll();
        if (file.getLocation().toFile().exists()) {
            FileInputStream inStream = new FileInputStream(file.getLocation().toString());
            properties.load(inStream);
            for (Object key : properties.keySet()) {
                String jarFileName = StringUtils.trim(StringUtils.substringAfter((String) key, Constants.DASH));
                if (BuildExpressionEditorDataSturcture.INSTANCE.getIPackageFragment(jarFileName) != null) {
                    targetList.add((String) key + SWT.SPACE + Constants.DASH + SWT.SPACE
                            + properties.getProperty((String) key));
                }
            }
        }
    } catch (IOException | RuntimeException exception) {
        LOGGER.error("Exception occurred while loading jar files from projects setting folder", exception);
    }

}

From source file:org.apache.sqoop.mapreduce.odps.HdfsOdpsImportJob.java

private Map<String, OdpsType> getColTypeMap() {
    Map colTypeMap = Maps.newLinkedHashMap();
    Properties userMapping = options.getMapColumnOdps();
    String[] columnNames = options.getColumns();

    for (Object column : userMapping.keySet()) {
        boolean found = false;
        for (String c : columnNames) {
            if (c.equals(column)) {
                found = true;//www  . jav  a2 s . co  m
                break;
            }
        }
        if (!found) {
            throw new IllegalArgumentException(
                    "No column by the name " + column + "found while importing data");
        }
    }
    for (String col : columnNames) {
        String userType = userMapping.getProperty(col);
        if (userType != null) {
            colTypeMap.put(col, OdpsType.valueOf(userType.toUpperCase()));
        } else {
            LOG.warn("Column " + col + " type not specified, defaulting to STRING.");
            colTypeMap.put(col, OdpsType.STRING);
        }
    }
    return colTypeMap;
}