Example usage for org.apache.commons.configuration.plist XMLPropertyListConfiguration getKeys

List of usage examples for org.apache.commons.configuration.plist XMLPropertyListConfiguration getKeys

Introduction

In this page you can find the example usage for org.apache.commons.configuration.plist XMLPropertyListConfiguration getKeys.

Prototype

public Iterator getKeys() 

Source Link

Usage

From source file:com.photon.phresco.impl.IPhonePhrescoApplicationProcessor.java

private List<Configuration> getConfigFromPlist(String plistPath) throws PhrescoException {
    List<Configuration> configs = new ArrayList<Configuration>();
    try {//from w w  w  .j av  a2  s .c  o  m
        Configuration config = null;
        File plistFile = new File(plistPath);
        if (plistFile.isFile()) {
            config = new Configuration(plistFile.getName(), FEATURES);
        } else {
            return Collections.EMPTY_LIST;
        }

        // get all the key and value pairs
        Properties properties = new Properties();
        XMLPropertyListConfiguration conf = new XMLPropertyListConfiguration(plistPath);
        Iterator it = conf.getKeys();
        while (it.hasNext()) {
            String key = (String) it.next();
            Object property = conf.getProperty(key);
            String value = property.toString();
            properties.setProperty(key, value);
        }
        config.setProperties(properties);
        configs.add(config);
    } catch (ConfigurationException e) {
        throw new PhrescoException(e);
    }
    return configs;
}

From source file:com.photon.phresco.impl.IPhoneApplicationProcessor.java

private List<Configuration> getConfigFromPlist(String plistPath) throws PhrescoException {
    List<Configuration> configs = new ArrayList<Configuration>();
    try {/* www. jav a  2 s .c o m*/
        Configuration config = null;
        File plistFile = new File(plistPath);
        if (plistFile.isFile()) {
            config = new Configuration(plistFile.getName(), FEATURES);
        } else {
            return Collections.EMPTY_LIST;
        }

        // get all the key and value pairs
        Properties properties = new Properties();
        XMLPropertyListConfiguration conf = new XMLPropertyListConfiguration(plistPath);
        Iterator it = conf.getKeys();
        while (it.hasNext()) {
            String key = (String) it.next();
            Object property = conf.getProperty(key);
            String value = property.toString();
            properties.setProperty(key, value);
        }
        config.setProperties(properties);
        configs.add(config);
    } catch (org.apache.commons.configuration.ConfigurationException e) {
        throw new PhrescoException(e);
    }
    return configs;
}