Example usage for java.util Dictionary get

List of usage examples for java.util Dictionary get

Introduction

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

Prototype

public abstract V get(Object key);

Source Link

Document

Returns the value to which the key is mapped in this dictionary.

Usage

From source file:org.openhab.binding.dscalarm1.internal.DSCAlarmActiveBinding.java

/**
 * @{inheritDoc/*from   ww w  .  j  a va  2 s.  c  o  m*/
 */
@Override
public void updated(Dictionary<String, ?> config) throws ConfigurationException {
    logger.debug("updated(): Configuration? - {}", config != null ? true : false);

    if (config != null) {

        if (StringUtils.isNotBlank((String) config.get("deviceType"))) {

            String intType = (String) config.get("deviceType");

            if (intType.equals("it100")) {
                interfaceType = DSCAlarmInterfaceType.IT100;
            } else if (intType.equals("envisalink")) {
                interfaceType = DSCAlarmInterfaceType.ENVISALINK;
            } else {
                interfaceType = null;
                logger.error("updated(): Device type not configured!");
            }
        }

        if (StringUtils.isNotBlank((String) config.get("serialPort"))) {
            serialPort = (String) config.get("serialPort");
        }

        if (StringUtils.isNotBlank((String) config.get("ip"))) {
            ipAddress = (String) config.get("ip");
        }

        try {
            if (StringUtils.isNotBlank((String) config.get("tcpPort"))) {
                tcpPort = Integer.parseInt((String) config.get("tcpPort"));
            }
        } catch (NumberFormatException numberFormatException) {
            tcpPort = 4025;
            logger.error("updated(): TCP Port not configured correctly!");
            return;
        }

        if (serialPort != null && ipAddress != null) {
            logger.error(
                    "updated(): Can only configure one connection type at a time: Serial Port or Ip Address!");
            return;
        }

        if (serialPort != null) {

            if (interfaceType == null) {
                interfaceType = DSCAlarmInterfaceType.IT100;
            }

            if (connectorType == null) {
                connectorType = DSCAlarmConnectorType.SERIAL;
            }
            try {
                if (StringUtils.isNotBlank((String) config.get("baud"))) {
                    baudRate = Integer.parseInt((String) config.get("baud"));
                }
            } catch (NumberFormatException numberFormatException) {
                baudRate = 0;
                logger.error("updated(): Baud Rate not configured correctly!");
                return;
            }
        }

        if (ipAddress != null) {
            if (interfaceType == null) {
                interfaceType = DSCAlarmInterfaceType.ENVISALINK;
            }

            connectorType = DSCAlarmConnectorType.TCP;
        }

        logger.debug("updated(): Connector Type: {}, Interface Type: {}", connectorType, interfaceType);

        if (StringUtils.isNotBlank((String) config.get("password"))) {
            password = (String) config.get("password");
        }

        if (StringUtils.isNotBlank((String) config.get("usercode"))) {
            userCode = (String) config.get("usercode");
        }

        if (StringUtils.isNotBlank((String) config.get("pollPeriod"))) {
            try {
                pollPeriod = Integer.parseInt((String) config.get("pollperiod"));
            } catch (NumberFormatException numberFormatException) {
                logger.error("updated(): Poll Period not configured correctly!");
                return;
            }

            if (pollPeriod > 15) {
                pollPeriod = 15;
            } else if (pollPeriod < 1) {
                pollPeriod = 1;
            }
        } else {
            pollPeriod = DEFAULT_POLL_PERIOD;
        }

        if (StringUtils.isNotBlank((String) config.get("suppressAcknowledgementMsgs"))) {
            try {
                suppressAcknowledgementMsgs = Boolean
                        .parseBoolean((String) config.get("suppressAcknowledgementMsgs"));
            } catch (NumberFormatException numberFormatException) {
                suppressAcknowledgementMsgs = false;
                logger.error("updated(): Error parsing 'suppressAcknowledgementMsgs'. This must be boolean!");
            }
        }

    } else {
        logger.debug("updated(): No Configuration!");
        return;
    }

    initialize();
}

From source file:org.apache.sling.servlets.resolver.internal.SlingServletResolver.java

private Map<String, Object> createAuthenticationInfo(final Dictionary<String, Object> props) {
    final Map<String, Object> authInfo = new HashMap<String, Object>();
    // if a script user is configured we use this user to read the scripts
    final String scriptUser = OsgiUtil.toString(props.get(PROP_SCRIPT_USER), null);
    if (scriptUser != null && scriptUser.length() > 0) {
        authInfo.put(ResourceResolverFactory.USER_IMPERSONATION, scriptUser);
    }/* w  w  w . j a v a2  s. c o m*/
    return authInfo;
}

From source file:org.openhab.binding.owserver.internal.OWServerBinding.java

/**
 * {@inheritDoc}/*from  www  . j av a2 s.  c o m*/
 */
public void updated(Dictionary<String, ?> config) throws ConfigurationException {
    if (config != null) {
        Enumeration<String> keys = config.keys();

        if (serverList == null) {
            serverList = new HashMap<String, OWServerConfig>();
        }

        while (keys.hasMoreElements()) {
            String key = (String) keys.nextElement();

            // the config-key enumeration contains additional keys that we
            // don't want to process here ...
            if ("service.pid".equals(key)) {
                continue;
            }

            Matcher matcher = EXTRACT_CONFIG_PATTERN.matcher(key);

            if (!matcher.matches()) {
                continue;
            }

            matcher.reset();
            matcher.find();

            String serverId = matcher.group(1);

            OWServerConfig deviceConfig = serverList.get(serverId);

            if (deviceConfig == null) {
                deviceConfig = new OWServerConfig();
                serverList.put(serverId, deviceConfig);
            }

            String configKey = matcher.group(2);
            String value = (String) config.get(key);

            if ("host".equals(configKey)) {
                deviceConfig.host = value;
            } else if ("user".equals(configKey)) {
                deviceConfig.user = value;
            } else if ("password".equals(configKey)) {
                deviceConfig.password = value;
            } else {
                throw new ConfigurationException(configKey,
                        "The given OWServer configKey '" + configKey + "' is unknown");
            }
        }

        String timeoutString = (String) config.get("timeout");
        if (StringUtils.isNotBlank(timeoutString)) {
            timeout = Integer.parseInt(timeoutString);
        }

        String granularityString = (String) config.get("granularity");
        if (StringUtils.isNotBlank(granularityString)) {
            granularity = Integer.parseInt(granularityString);
        }

        String cacheString = (String) config.get("cache");
        if (StringUtils.isNotBlank(cacheString)) {
            cacheDuration = Integer.parseInt(cacheString);
        }

        setProperlyConfigured(true);
    }
}

From source file:org.openhab.binding.powermax.internal.PowerMaxBinding.java

/**
 * {@inheritDoc}/*from w  w w  .  j av  a  2  s  . c  o m*/
 */
@Override
public void updated(Dictionary<String, ?> config) throws ConfigurationException {
    logger.debug("updated(): updating configuration");

    closeConnection();

    serialPort = null;
    ipAddress = null;
    tcpPort = 0;
    motionOffDelay = DEFAULT_MOTION_OFF_DELAY;
    allowArming = false;
    allowDisarming = false;
    forceStandardMode = false;
    panelType = PowerMaxPanelType.POWERMAX_PRO;
    autoSyncTime = false;
    pinCode = null;

    PowerMaxReceiveType.POWERLINK.setHandlerClass(PowerMaxPowerlinkMessage.class);

    if (config != null) {
        String serialPortString = Objects.toString(config.get("serialPort"), null);
        if (StringUtils.isNotBlank(serialPortString)) {
            serialPort = serialPortString;
        }

        String ipString = Objects.toString(config.get("ip"), null);
        if (StringUtils.isNotBlank(ipString)) {
            ipAddress = ipString;
        }

        if (serialPort == null && ipAddress == null) {
            logger.warn(
                    "PowerMax alarm binding: one connection type (Serial Port or IP Address) must be defined");
            this.setProperlyConfigured(false);
            throw new ConfigurationException(null,
                    "one connection type (Serial Port or IP Address) must be defined");
        }

        if (serialPort != null && ipAddress != null) {
            logger.warn(
                    "PowerMax alarm binding: can only configure one connection type at a time: Serial Port or IP Address");
            this.setProperlyConfigured(false);
            throw new ConfigurationException(null,
                    "can only configure one connection type at a time: Serial Port or IP Address");
        }

        if (ipAddress != null) {
            String tcpPortString = Objects.toString(config.get("tcpPort"), null);
            if (StringUtils.isNotBlank(tcpPortString)) {
                try {
                    tcpPort = Integer.parseInt(tcpPortString);
                } catch (NumberFormatException numberFormatException) {
                    tcpPort = 0;
                    logger.warn(
                            "PowerMax alarm binding: TCP port not configured correctly (number expected, received '{}')",
                            tcpPortString);
                    this.setProperlyConfigured(false);
                    throw new ConfigurationException("tcpPort",
                            "TCP port not configured correctly (number expected, received '" + tcpPortString
                                    + "')");
                }
            }
        }

        String motionOffDelayString = Objects.toString(config.get("motionOffDelay"), null);
        if (StringUtils.isNotBlank(motionOffDelayString)) {
            try {
                motionOffDelay = Integer.parseInt(motionOffDelayString) * 60000;
            } catch (NumberFormatException numberFormatException) {
                motionOffDelay = DEFAULT_MOTION_OFF_DELAY;
                logger.warn(
                        "PowerMax alarm binding: motion off delay not configured correctly (number expected, received '{}')",
                        motionOffDelayString);
            }
        }

        String allowArmingString = Objects.toString(config.get("allowArming"), null);
        if (StringUtils.isNotBlank(allowArmingString)) {
            allowArming = Boolean.valueOf(allowArmingString);
        }
        String allowDisarmingString = Objects.toString(config.get("allowDisarming"), null);
        if (StringUtils.isNotBlank(allowDisarmingString)) {
            allowDisarming = Boolean.valueOf(allowDisarmingString);
        }
        String forceStandardModeString = Objects.toString(config.get("forceStandardMode"), null);
        if (StringUtils.isNotBlank(forceStandardModeString)) {
            forceStandardMode = Boolean.valueOf(forceStandardModeString);
            PowerMaxReceiveType.POWERLINK.setHandlerClass(
                    forceStandardMode ? PowerMaxBaseMessage.class : PowerMaxPowerlinkMessage.class);
        }

        String panelTypeString = Objects.toString(config.get("panelType"), null);
        if (StringUtils.isNotBlank(panelTypeString)) {
            try {
                panelType = PowerMaxPanelType.fromLabel(panelTypeString);
            } catch (IllegalArgumentException exception) {
                panelType = PowerMaxPanelType.POWERMAX_PRO;
                logger.warn("PowerMax alarm binding: panel type not configured correctly");
            }
        }
        PowerMaxPanelSettings.initPanelSettings(panelType);

        String autoSyncTimeString = Objects.toString(config.get("autoSyncTime"), null);
        if (StringUtils.isNotBlank(autoSyncTimeString)) {
            autoSyncTime = Boolean.valueOf(autoSyncTimeString);
        }

        String pinCodeString = Objects.toString(config.get("pinCode"), null);
        if (StringUtils.isNotBlank(pinCodeString)) {
            pinCode = pinCodeString;
        }

        this.setProperlyConfigured(true);
    }
}

From source file:org.openhab.binding.energenie.internal.EnergenieBinding.java

/**
 * @{inheritDoc}//from   w  w w  .  j  a  v a 2  s.  c om
 */
@Override
public void updated(Dictionary<String, ?> config) throws ConfigurationException {
    if (config != null) {
        Enumeration<String> keys = config.keys();
        while (keys.hasMoreElements()) {
            String key = (String) keys.nextElement();

            // the config-key enumeration contains additional keys that we
            // don't want to process here ...
            if ("service.pid".equals(key)) {
                continue;
            }

            Matcher matcher = EXTRACT_CONFIG_PATTERN.matcher(key);

            if (!matcher.matches()) {
                logger.debug("given config key '" + key
                        + "' does not follow the expected pattern '<id>.<host|password>'");
                continue;
            }

            matcher.reset();
            matcher.find();

            String deviceId = matcher.group(1);

            DeviceConfig deviceConfig = deviceConfigs.get(deviceId);

            if (deviceConfig == null) {
                deviceConfig = new DeviceConfig(deviceId);
                deviceConfigs.put(deviceId, deviceConfig);
            }

            String configKey = matcher.group(2);
            String value = (String) config.get(key);

            if ("host".equals(configKey)) {
                deviceConfig.host = value;
                pmsIpConfig.put(deviceId, value);
            } else if ("password".equals(configKey)) {
                deviceConfig.password = value;
                pmsPasswordConfig.put(deviceId, value);
            } else {
                throw new ConfigurationException(configKey,
                        "the given configKey '" + configKey + "' is unknown");
            }
        }
        String refreshIntervalString = (String) config.get("refresh");
        if (StringUtils.isNotBlank(refreshIntervalString)) {
            refreshInterval = Long.parseLong(refreshIntervalString);
        }

        setProperlyConfigured(true);
    }
}

From source file:org.codice.ddf.spatial.ogc.csw.catalog.source.CswSource.java

/**
 * Searches every query response for previously unknown content types
 *
 * @param response A Query Response// w w w . j a v a  2s  . co  m
 */
private void addContentTypes(SourceResponse response) {
    if (response == null || response.getResults() == null) {
        return;
    }

    if (contentTypeMappingUpdated) {
        LOGGER.debug("{}: The content type mapping has been updated. Removing all old content types.",
                cswSourceConfiguration.getId());
        contentTypes.clear();
    }

    for (Result result : response.getResults()) {
        Metacard metacard = result.getMetacard();
        if (metacard != null) {
            addContentType(metacard.getContentTypeName(), metacard.getContentTypeVersion(),
                    metacard.getContentTypeNamespace());
        }
    }

    Configuration[] managedConfigs = getManagedConfigs();
    if (managedConfigs != null) {

        for (Configuration managedConfig : managedConfigs) {
            Dictionary<String, Object> properties = managedConfig.getProperties();
            Set<String> current = new HashSet<String>(
                    Arrays.asList((String[]) properties.get(CONTENTTYPES_PROPERTY)));

            if (contentTypeMappingUpdated || (current != null && !current.containsAll(contentTypes.keySet()))) {
                LOGGER.debug("{}: Adding new content types {} for content type mapping: {}.",
                        cswSourceConfiguration.getId(), contentTypes.toString(),
                        cswSourceConfiguration.getContentTypeMapping());
                properties.put(CONTENTTYPES_PROPERTY, contentTypes.keySet().toArray(new String[0]));
                properties.put(CONTENT_TYPE_MAPPING_PROPERTY, cswSourceConfiguration.getContentTypeMapping());
                try {
                    LOGGER.debug("{}: Updating CSW Federated Source configuration with {}.",
                            cswSourceConfiguration.getId(), properties.toString());
                    managedConfig.update(properties);
                } catch (IOException e) {
                    LOGGER.warn("{}: Failed to update managedConfiguration with new contentTypes, Error: {}",
                            cswSourceConfiguration.getId(), e);
                }
            }
        }
    }
}

From source file:org.liveSense.misc.configloader.ConfigurationLoader.java

/**
 * Set the configuration based on the config file.
 *
 * @param f//from   w w w  .  j a va  2 s  .c  om
 *            Configuration file
 * @return
 * @throws Exception
 */
@SuppressWarnings("unchecked")
boolean setConfig(URL f) throws Exception {
    Properties p = new Properties();

    @SuppressWarnings("rawtypes")
    Dictionary ht = new Hashtable();

    InputStream in = new BufferedInputStream(f.openStream());
    try {
        // If the file name ends with .config, we using the Felix configuration format
        if (f.getFile().endsWith(".config")) {
            ht = ConfigurationHandler.read(in);
        } else {
            in.mark(1);
            boolean isXml = in.read() == '<';
            in.reset();
            if (isXml) {
                p.loadFromXML(in);
            } else {
                p.load(in);
            }
            ((Hashtable) ht).putAll(p);
        }
    } finally {
        in.close();
    }

    // Searching for templated config entry.
    // If we found one we get Java System properties
    // named as the macros. The config became activated if that
    // system proprty is set.

    Pattern macros = Pattern.compile("\\$\\{(.*?)\\}");
    boolean valid = true;

    Enumeration enumr = ht.keys();
    while (enumr.hasMoreElements()) {
        Object key = enumr.nextElement();
        if (ht.get(key) instanceof String) {
            String str = (String) ht.get(key);
            if (str != null) {
                Matcher matcher = macros.matcher(str);

                HashSet<String> propNames = new HashSet<String>();
                while (matcher.find()) {
                    propNames.add(matcher.group(1));
                }

                for (String prop : propNames) {
                    String sysProp = System.getProperty(prop);
                    if (sysProp == null) {
                        valid = false;
                    }
                    if (valid) {
                        str = StringUtils.replace(str, "${" + prop + "}", sysProp);
                        //str = str.replaceAll("\\$\\{"+prop+"\\}", sysProp);
                    }
                }
                if (valid) {
                    ht.put(key, str);
                }
            }
        }
    }

    if (valid) {
        Util.performSubstitution(p);
        String pid[] = parsePid(getName(f.getFile()));
        ht.put(CONFIGURATION_PROPERTY_NAME, getPidName(pid[0], pid[1]));

        Configuration config = getConfiguration(pid[0], pid[1]);

        /*
        // Backuping parameters for restore
        String persistanceName = pid[0]+(pid[1] == null ? "" : "-" + pid[1]);
        if (config.getProperties() != null && config.getProperties().get(CONFIGURATION_PROPERTY_NAME) == null) {
           if (persistence.load(persistanceName).isEmpty()) {
              persistence.store(persistanceName, config.getProperties());
           }
        }
         */
        if (config.getBundleLocation() != null) {
            config.setBundleLocation(null);
        }

        // If the configuration does not created by configuration loader we update it
        // In other cases (for example the user modified the loaded config) there is no configuration overwrite
        if (config.getProperties() == null || config.getProperties().get(CONFIGURATION_PROPERTY_NAME) == null
                || !config.getProperties().get(CONFIGURATION_PROPERTY_NAME).equals(getName(f.getFile()))) {
            config.update(ht);
        }
    }
    return true;
}

From source file:org.opennaas.core.protocols.sessionmanager.ProtocolSessionManager.java

private Dictionary<String, String> addWSRegistrationProperties(Dictionary<String, String> props)
        throws ProtocolException {
    IResource resource;//from   ww w. j a  v  a2s.com
    try {
        resource = getResource(resourceID);
        String resourceType = resource.getResourceDescriptor().getInformation().getType();
        String resourceName = resource.getResourceDescriptor().getInformation().getName();

        ConfigurationAdminUtil configurationAdmin = new ConfigurationAdminUtil(Activator.getBundleContext());
        String url = configurationAdmin.getProperty("org.opennaas", "ws.rest.url");

        if (props != null) {
            props.put("service.exported.interfaces", "*");
            props.put("service.exported.configs", "org.apache.cxf.rs");
            props.put("service.exported.intents", "HTTP");
            props.put("org.apache.cxf.rs.httpservice.context",
                    url + "/" + resourceType + "/" + resourceName + "/protocolSessionManager");
            props.put("org.apache.cxf.rs.address", "/");
            props.put("org.apache.cxf.httpservice.requirefilter", "true");
        }
        log.info("Registering ws in url: " + props.get("org.apache.cxf.rs.address"));
    } catch (ResourceException e) {
        throw new ProtocolException(e);
    } catch (IOException e) {
        throw new ProtocolException(e);
    }
    return props;
}

From source file:org.openhab.binding.ACDBCommon.internal.ACDBBinding.java

@Override
public void updated(Dictionary<String, ?> config) throws ConfigurationException {
    logger.debug(getBindingName() + ":calling updated(config)!");
    String lowerBindingName = StringUtils.lowerCase(getBindingName());
    if (config == null) {
        throw new ConfigurationException(lowerBindingName + ":url",
                "The SQL database URL is missing - please configure the " + lowerBindingName
                        + ":url parameter in openhab.cfg");
    }/*from  w w w.  ja va2  s.c o m*/

    // read DB Server connection Information
    DBManager.serverCache = new HashMap<String, ServerInfo>();
    Enumeration<String> keys = config.keys();
    while (keys.hasMoreElements()) {
        String key = (String) keys.nextElement();

        Matcher matcher = DEVICES_PATTERN.matcher(key);

        if (!matcher.matches()) {
            continue;
        }
        matcher.reset();
        matcher.find();

        String serverId = matcher.group(1);
        ServerInfo server = DBManager.serverCache.get(serverId);
        if (server == null) {
            server = new ServerInfo(serverId);
            DBManager.serverCache.put(serverId, server);
            logger.debug("Created new DBserver Info " + serverId);
        }

        String configKey = matcher.group(2);
        String value = (String) config.get(key);

        if ("url".equals(configKey)) {
            server.setUrl(value);
        } else if ("user".equals(configKey)) {
            server.setUser(value);
        } else if ("password".equals(configKey)) {
            server.setPassword(value);
        } else {
            throw new ConfigurationException(configKey, "the given configKey '" + configKey + "' is unknown");
        }
    }
    // read defult DBServer connection information
    String serverId = "DefultServer";
    ServerInfo server = new ServerInfo(serverId);
    server.setUrl((String) config.get("url"));
    server.setUser((String) config.get("user"));
    server.setPassword((String) config.get("password"));

    DBManager.serverCache.put("DefultServer", server);

    String refreshIntervalString = (String) config.get("refresh");
    if (StringUtils.isNotBlank(refreshIntervalString)) {
        refreshInterval = Long.parseLong(refreshIntervalString);
    }

    try {
        for (Map.Entry<String, ServerInfo> mapI : DBManager.serverCache.entrySet()) {
            ServerInfo serverI = mapI.getValue();
            serverI.setDriverClassName(getDriverClassName());
            if (StringUtils.isBlank(serverI.getUrl()) || StringUtils.isBlank(serverI.getUser())
                    || StringUtils.isBlank(serverI.getPassword())) {
                logger.warn("more information needed:" + serverI.toString());
                continue;
            }
            serverI.openConnection();
        }
    } catch (Exception e) {
        logger.error(getBindingName() + ":failed to connect DB.", e);
    }

    setProperlyConfigured(true);
    logger.debug(getBindingName() + ":updated(config) is called!");
}

From source file:org.energy_home.jemma.ah.internal.configurator.Configuratore.java

public void exportConfiguration(OutputStream os) throws Exception {
    // Ottiene un riferimento al servizio Configuration Admin
    ServiceReference sr = bc.getServiceReference(ConfigurationAdmin.class.getName());
    ConfigurationAdmin configurationAdmin = (ConfigurationAdmin) bc.getService(sr);

    // test();//w ww . j  av a2 s.  c om

    // Ottiene un array contenente tutte le configurazioni salvate nel
    // Configuration Admin
    Configuration[] configs = configurationAdmin.listConfigurations(null);

    // Stampa nello stream di output il file XML
    PrintWriter pw = new PrintWriter(os);
    pw.println("<?xml version=\"1.0\" encoding=\"UTF-8\" ?>");
    pw.println("<configurations>");

    // Export delle categories
    if (hacService != null) {
        ICategory[] categories = hacService.getCategories();
        if (categories != null) {
            pw.println("<categories>");
            for (int i = 0; i < categories.length; i++) {
                ICategory c = categories[i];
                pw.println("<category icon=\"" + c.getIconName() + "\" name = \"" + c.getName() + "\" pid = \""
                        + c.getPid() + "\"/>");
            }
            pw.println("</categories>");
        }
    }

    // Export delle rules
    if (connAdmin != null) {
        ArrayList rules = connAdmin.getBindRules();
        if (rules != null) {
            pw.println("<rules>");
            for (int i = 0; i < rules.size(); i++) {
                Filter f = (Filter) rules.get(i);
                pw.println("<rule filter =\"" + this.xmlContentEscape(f.toString()) + "\"/>");
            }
            pw.println("</rules>");
        }
    }

    // Export delle configurazioni
    if (configs != null && configs.length > 0) {
        Set factories = new HashSet();
        SortedMap sm = new TreeMap();
        for (int i = 0; i < configs.length; i++) {
            sm.put(configs[i].getPid(), configs[i]);
            String fpid = configs[i].getFactoryPid();
            if (null != fpid) {
                factories.add(fpid);
            }
        }

        for (Iterator mi = sm.values().iterator(); mi.hasNext();) {
            Configuration config = (Configuration) mi.next();
            pw.println("<configuration>");

            // Emette una ad una le proprieta' della configurazione
            Dictionary props = config.getProperties();
            if (props != null) {
                SortedSet keys = new TreeSet();
                for (Enumeration ke = props.keys(); ke.hasMoreElements();)
                    keys.add(ke.nextElement());
                for (Iterator ki = keys.iterator(); ki.hasNext();) {
                    String key = (String) ki.next();

                    pw.print("<property type=\"" + props.get(key).getClass().getSimpleName() + "\" name=\""
                            + key + "\">");

                    if (props.get(key).getClass().isArray() == true) {
                        pw.println();
                        Object value = props.get(key);
                        int len = Array.getLength(value);
                        for (int i = 0; i < len; i++) {
                            Object element = Array.get(value, i);
                            pw.print("<item>" + element.toString() + "</item>");
                        }
                    } else
                        pw.print(props.get(key));

                    pw.println("</property>");
                }
            }
            pw.println("</configuration>");
        }
    }
    pw.println("</configurations>");
    pw.flush();
}