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:edu.cornell.med.icb.goby.modes.DiscoverSequenceVariantsMode.java

/**
 * Parse the group-definition file, in the format sample-id=group-id (Java properties file)
 *
 * @param groupsDefinitionFile file with sample=group mapping information.
 * @param inputFilenames//from  ww  w. j a  v a 2  s  . c o m
 * @return group definition in the format expected by the --groups argument.
 */
private String parseGroupFile(String groupsDefinitionFile, String[] inputFilenames) {
    Properties groupProps = new Properties();
    FileReader fileReader = null;
    try {
        fileReader = new FileReader(groupsDefinitionFile);
        groupProps.load(fileReader);
        Object2ObjectMap<String, MutableString> groupDefs = new Object2ObjectArrayMap<String, MutableString>();

        for (final Object key : groupProps.keySet()) {
            final String groupId = (String) groupProps.get(key);
            MutableString groupDef = groupDefs.get(groupId);
            if (groupDef == null) {
                groupDef = new MutableString();
                groupDefs.put(groupId, groupDef);
            }
            final String sampleId = (String) key;
            if (groupDef.indexOf(sampleId) == -1) {
                if (isInputFilename(inputFilenames, sampleId)) {
                    groupDef.append(sampleId);
                    groupDef.append(',');
                }
            }
        }
        MutableString result = new MutableString();
        for (final String groupId : groupDefs.keySet()) {
            result.append(groupId);
            result.append('=');
            result.append(groupDefs.get(groupId));
            // remove trailing coma:
            result.setLength(result.length() - 1);
            result.append('/');
        }
        result.setLength(result.length() - 1);
        System.out.println("generated group text: " + result);
        return result.toString();
    } catch (IOException e) {
        System.err.println("Cannot open or parse groups-file parameter " + groupsDefinitionFile);
        System.exit(1);
    } finally {

        IOUtils.closeQuietly(fileReader);
    }
    return null;
}

From source file:com.netspective.sparx.navigate.NavigationControllerServlet.java

protected void executAntBuild(ServletConfig servletConfig, File buildFile, String target)
        throws ServletException {
    log.debug("Executing Ant build " + buildFile + " target " + target);

    org.apache.tools.ant.Project antProject = AntProject.getConfiguredProject(buildFile);
    antProject.setProperty("app.home", servletConfig.getServletContext().getRealPath("/"));
    antProject.setProperty("app.init-count", Long.toString(getInitializationCount()));

    Properties servletOptionsProps = servletOptions.setProperties(new Properties(), "app.servlet-options",
            false);/*  w  w w .j a  v  a 2  s .  com*/
    for (Iterator i = servletOptionsProps.keySet().iterator(); i.hasNext();) {
        String propName = (String) i.next();
        antProject.setProperty(propName, servletOptionsProps.getProperty(propName));
    }

    ByteArrayOutputStream ostream = new ByteArrayOutputStream();
    PrintStream pstream = new PrintStream(ostream);

    BuildLogger logger = new NoBannerLogger();
    logger.setMessageOutputLevel(org.apache.tools.ant.Project.MSG_INFO);
    logger.setOutputPrintStream(pstream);
    logger.setErrorPrintStream(pstream);

    PrintStream saveOut = System.out;
    PrintStream saveErr = System.err;
    System.setOut(pstream);
    System.setErr(pstream);

    antProject.addBuildListener(logger);
    Exception exceptionThrown = null;
    try {
        Vector targets = new Vector();
        if (target != null) {
            String[] targetNames = TextUtils.getInstance().split(target, ",", true);
            for (int i = 0; i < targetNames.length; i++)
                targets.add(targetNames[i]);
        } else
            targets.add(antProject.getDefaultTarget());
        antProject.executeTargets(targets);
    } catch (Exception e) {
        exceptionThrown = e;
    }

    if (exceptionThrown != null) {
        log.error(ostream.toString());
        log.error("Error running ant build file " + buildFile + " target " + target, exceptionThrown);
    } else
        log.debug(ostream.toString());

    int extnPos = buildFile.getName().lastIndexOf('.');
    String nameNoExtn = extnPos != -1 ? buildFile.getName().substring(0, extnPos) : buildFile.getName();
    File logFile = servletOptions.getInitUsingAntLogFile() != null
            ? new File(servletOptions.getInitUsingAntLogFile())
            : new File(buildFile.getParentFile(), nameNoExtn + ".log");

    FileOutputStream fos = null;
    PrintWriter logWriter = null;
    try {
        fos = new FileOutputStream(logFile.getAbsolutePath(), logFile.exists());
        logWriter = new PrintWriter(fos);
        logWriter.println("-----------------------------------------------------------------------------");
        logWriter.println("Started build at " + SimpleDateFormat.getDateTimeInstance().format(new Date())
                + " in Servlet " + getServletName() + " (Context " + getServletContext().getServletContextName()
                + ", BuildFile " + buildFile.getAbsolutePath() + ")");
        logWriter.write(ostream.toString());
        if (exceptionThrown != null)
            logWriter.write(TextUtils.getInstance().getStackTrace(exceptionThrown));
        logWriter.println("Ended build at " + SimpleDateFormat.getDateTimeInstance().format(new Date())
                + " in Servlet " + getServletName() + " (Context " + getServletContext().getServletContextName()
                + ", BuildFile " + buildFile.getAbsolutePath() + ")");
    } catch (IOException e) {
        throw new ServletException(e);
    } finally {
        logWriter.close();
        try {
            fos.close();
        } catch (IOException e) {
            throw new ServletException(e);
        }
    }

    System.setOut(saveOut);
    System.setErr(saveErr);
}

From source file:org.apache.zeppelin.interpreter.remote.RemoteInterpreterServer.java

private void setSystemProperty(Properties properties) {
    for (Object key : properties.keySet()) {
        if (!RemoteInterpreterUtils.isEnvString((String) key)) {
            String value = properties.getProperty((String) key);
            if (!StringUtils.isBlank(value)) {
                System.setProperty((String) key, properties.getProperty((String) key));
            }/*from  w w  w  .  j a va2  s.  c om*/
        }
    }
}

From source file:cn.newgxu.lab.core.config.SpringBeans.java

@Bean
public LocalContainerEntityManagerFactoryBean entityManagerFactoryBean() {
    LocalContainerEntityManagerFactoryBean entityManagerFactoryBean = new LocalContainerEntityManagerFactoryBean();
    entityManagerFactoryBean.setDataSource(dataSource());
    entityManagerFactoryBean.setJpaVendorAdapter(jpaVendorAdapter());

    Properties properties = new Properties();
    properties.setProperty("hibernate.hbm2ddl.auto", "none");
    //      properties.setProperty("hibernate.hbm2ddl.auto", "update");
    entityManagerFactoryBean.setJpaProperties(properties);

    properties.clear();//from   w ww  .j ava2 s  .co  m
    InputStream in = null;
    try {
        in = this.getClass().getResourceAsStream("/config/entityPackages.properties");
        properties.load(in);
    } catch (IOException e) {
        L.error("?EntityManagerFactory", e);
    } finally {
        try {
            in.close();
        } catch (IOException e) {
            L.error("wtf!", e);
        }
    }
    String[] entityPackages = new String[properties.size()];
    int i = 0;
    for (Object pkg : properties.keySet()) {
        entityPackages[i++] = properties.getProperty(pkg.toString());
    }
    entityManagerFactoryBean.setPackagesToScan(entityPackages);
    return entityManagerFactoryBean;
}

From source file:com.redhat.rhn.common.conf.Config.java

/**
 * Parse all of the added files./*from ww w. j av a  2 s  .  c o m*/
 */
public void parseFiles() {
    for (Iterator<File> i = fileList.iterator(); i.hasNext();) {
        File curr = i.next();

        Properties props = new Properties();
        try {
            props.load(new InputStreamReader(new FileInputStream(curr), "UTF-8"));
        } catch (IOException e) {
            logger.error("Could not parse file " + curr, e);
        }
        String ns = makeNamespace(curr);
        logger.debug("Adding namespace: " + ns + " for file: " + curr.getAbsolutePath());

        // 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(ns)) {
                newKey = ns + "." + key;
            }
            logger.debug("Adding: " + newKey + ": " + props.getProperty(key));
            newProps.put(newKey, props.getProperty(key));
        }
        configValues.putAll(newProps);
    }
}

From source file:de.xwic.appkit.core.config.XmlConfigLoader.java

/**
 * @param element//  w w w . ja v  a2 s  .c o m
 * @throws IOException 
 * @throws ParseException 
 * @throws ConfigurationException 
 */
private void loadDomain(Element elDomain) throws IOException, ParseException, ConfigurationException {

    String id = elDomain.getAttribute("id");
    Domain domain;
    if (profileMode) {
        // the domain has already been loaded/specified. 
        domain = setup.getDomain(id);
    } else {
        domain = new Domain();
        domain.setId(id);
    }

    NodeList nl = elDomain.getChildNodes();
    for (int i = 0; i < nl.getLength(); i++) {
        Node node = nl.item(i);
        if (node.getNodeType() == Node.ELEMENT_NODE) {
            Element element = (Element) node;

            if (element.getNodeName().equals("bundle") && !profileMode) {
                String basename = element.getAttribute("basename");
                // load each configured language
                for (Iterator<Language> it = setup.getLanguages().iterator(); it.hasNext();) {
                    Language lang = it.next();
                    String filename = basename + "_" + lang.getId() + ".properties";
                    URL bundleUrl = new URL(location, filename);
                    fileList.add(bundleUrl);
                    if (!headerOnly) {
                        Properties prop = new Properties();
                        try {
                            InputStream in = bundleUrl.openStream();
                            prop.load(in);
                            in.close();
                            // use unsynchronized hashMap
                            HashMap<String, String> map = new HashMap<String, String>();
                            for (Object key : prop.keySet()) {
                                String strKey = (String) key;
                                map.put(strKey, prop.getProperty(strKey));
                            }
                            domain.addBundle(lang.getId(), new Bundle(map));
                        } catch (Exception e) {
                            // file might not exist. 
                            if (setup.getDefaultLangId().equals(lang.getId())) {
                                throw new ConfigurationException("The default language file for the bundle '"
                                        + basename + "' does not exist.");
                            }
                        }
                    }
                }
            } else if (element.getNodeName().equals("resource") && !profileMode) {
                Resource res = new Resource();
                res.setId(element.getAttribute("id"));
                URL resUrl = new URL(location, element.getAttribute("file"));
                res.setLocation(resUrl);
                res.setFilePath(element.getAttribute("file"));
                domain.addResource(res);
                fileList.add(resUrl);

            } else if (element.getNodeName().equals("entities")) {
                loadEntities(domain, element);
            } else if (element.getNodeName().equals("defaults")) {
                loadDefaults(domain, element);
            }
        }
    }
    if (!profileMode) {
        setup.addDomain(domain);
    }

}

From source file:dinistiq.Dinistiq.java

/**
 * Injects all available dependencies into a given bean and records all dependencies.
 *
 * @param key key / name/ id of the bean
 * @param bean bean instance/*  www.j  a va 2  s  .  co m*/
 * @param dependencies dependencies map where the dependecies of the bean are recorded with the given key
 * @throws Exception
 */
private void injectDependencies(Map<String, Set<Object>> dependencies, String key, Object bean)
        throws Exception {
    // Prepare values from properties files
    Properties beanProperties = getProperties(key);
    LOG.debug("injectDependencies({}) bean properties {}", key, beanProperties.keySet());

    // fill injected fields
    Class<? extends Object> beanClass = bean.getClass();
    String beanClassName = beanClass.getName();
    while (beanClass != Object.class) {
        if (bean instanceof Map) {
            fillMap(bean, getProperties(key));
            LOG.info("injectDependencies() filled map '{}' {}", key, bean);
            return; // If it's a map we don't need to inject anything beyond some map properties files.
        } // if
        for (Field field : beanClass.getDeclaredFields()) {
            LOG.debug("injectDependencies({}) field {}", key, field.getName());
            if (field.getAnnotation(Inject.class) != null) {
                Named named = field.getAnnotation(Named.class);
                String name = (named == null) ? null
                        : (StringUtils.isBlank(named.value()) ? field.getName() : named.value());
                LOG.info("injectDependencies({}) {} :{} needs injection with name {}", key, field.getName(),
                        field.getGenericType(), name);
                Object b = getValue(beanProperties, dependencies, key, field.getType(), field.getGenericType(),
                        name);
                final boolean accessible = field.isAccessible();
                try {
                    field.setAccessible(true);
                    field.set(bean, b);
                } catch (SecurityException | IllegalArgumentException | IllegalAccessException e) {
                    LOG.error("injectDependencies() error setting field " + field.getName() + " :"
                            + field.getType().getName() + " at '" + key + "' :" + beanClassName, e);
                } finally {
                    field.setAccessible(accessible);
                } // try/catch
            } // if
        } // for
        beanClass = beanClass.getSuperclass();
    } // while

    // call methods with annotated injections
    for (Method m : bean.getClass().getMethods()) {
        if (m.getAnnotation(Inject.class) != null) {
            LOG.debug("injectDependencies({}) inject parameters on method {}", key, m.getName());
            Class<? extends Object>[] parameterTypes = m.getParameterTypes();
            Type[] genericParameterTypes = m.getGenericParameterTypes();
            Annotation[][] parameterAnnotations = m.getParameterAnnotations();
            Object[] parameters = getParameters(beanProperties, dependencies, key, parameterTypes,
                    genericParameterTypes, parameterAnnotations);
            try {
                m.invoke(bean, parameters);
            } catch (IllegalAccessException | IllegalArgumentException | InvocationTargetException ex) {
                LOG.error("injectDependencies() error injecting for method " + m.getName() + " at '" + key
                        + "' :" + beanClassName, ex);
            } // try/catch
        } // if
    } // for

    // Fill in manually set values from properties file
    for (String property : beanProperties.stringPropertyNames()) {
        String methodName = "set" + property.substring(0, 1).toUpperCase() + property.substring(1);
        LOG.debug("injectDependencies({}) {} -> {}", key, property, methodName);
        Method m = null;
        // Have to find it just by name
        for (Method me : bean.getClass().getMethods()) {
            if (me.getName().equals(methodName) && (me.getParameterTypes().length > 0)) {
                m = me;
            } // if
        } // for
        if (m == null) {
            LOG.warn("injectDependencies({}) no setter method found for property {}", key, property);
        } else {
            String propertyName = Introspector.decapitalize(m.getName().substring(3));
            Class<?> parameterType = m.getParameterTypes()[0];
            Type genericType = m.getGenericParameterTypes()[0];
            LOG.debug("injectDependencies({}) writable property found {} :{} {}", key, propertyName,
                    parameterType, genericType);
            String propertyValue = beanProperties.getProperty(propertyName); // Must definetely be there without additional check
            boolean isBoolean = (parameterType == Boolean.class) || (m.getParameterTypes()[0] == Boolean.TYPE);
            boolean isCollection = Collection.class.isAssignableFrom(parameterType);
            Object[] parameters = new Object[1];
            LOG.debug("injectDependencies({}) trying to set value {} (bool {}) (collection {}) '{}'", key,
                    propertyName, isBoolean, isCollection, propertyValue);
            try {
                parameters[0] = getReferenceValue(propertyValue);
                if (isBoolean && (parameters[0] instanceof String)) {
                    parameters[0] = Boolean.valueOf(propertyValue);
                } // if
                if ("long".equals(parameterType.getName())) {
                    parameters[0] = new Long(propertyValue);
                } // if
                if ("int".equals(parameterType.getName())) {
                    parameters[0] = new Integer(propertyValue);
                } // if
                if ("float".equals(parameterType.getName())) {
                    parameters[0] = new Float(propertyValue);
                } // if
                if ("double".equals(parameterType.getName())) {
                    parameters[0] = new Double(propertyValue);
                } // if
                if (isCollection) {
                    if (!Collection.class.isAssignableFrom(parameters[0].getClass())) {
                        Collection<Object> values = List.class.isAssignableFrom(parameterType)
                                ? new ArrayList<>()
                                : new HashSet<>();
                        for (String value : propertyValue.split(",")) {
                            values.add(getReferenceValue(value));
                        } // for
                        parameters[0] = values;
                    } // if
                    if (dependencies != null) {
                        for (Object d : (Collection<?>) parameters[0]) {
                            if (beans.containsValue(d)) {
                                dependencies.get(key).add(d);
                            } // if
                        } // if
                    } // if
                } else {
                    if ((dependencies != null) && (beans.containsValue(parameters[0]))) {
                        dependencies.get(key).add(parameters[0]);
                    } // if
                } // if
                LOG.debug("injectDependencies({}) setting value {} '{}' :{}", key, propertyName, parameters[0],
                        parameters[0].getClass());
                m.invoke(bean, parameters);
            } catch (IllegalAccessException | IllegalArgumentException | InvocationTargetException ex) {
                LOG.error("injectDependencies() error setting property " + propertyName + " to '"
                        + propertyValue + "' at " + key + " :" + beanClassName, ex);
            } // try/catch
        } // if
    } // for
}

From source file:com.splicemachine.derby.utils.SpliceAdmin.java

/**
 * Get the values of all properties for the current connection.
 *
 * @param rs array of result set objects that contains all of the defined properties
 *           for the JVM, service, database, and app.
 * @throws SQLException Standard exception policy.
 **//*from w ww.  j  a  v  a2  s  .  co m*/
public static void SYSCS_GET_ALL_PROPERTIES(ResultSet[] rs) throws SQLException {
    try {
        LanguageConnectionContext lcc = ConnectionUtil.getCurrentLCC();
        TransactionController tc = lcc.getTransactionExecute();

        // Fetch all the properties.
        Properties jvmProps = addTypeToProperties(System.getProperties(), "JVM", true);
        Properties dbProps = addTypeToProperties(tc.getProperties()); // Includes both database and service properties.
        ModuleFactory monitor = Monitor.getMonitorLite();
        Properties appProps = addTypeToProperties(monitor.getApplicationProperties(), "APP", false);

        // Merge the properties using the correct search order.
        // SEARCH ORDER: JVM, Service, Database, App
        appProps.putAll(dbProps); // dbProps already has been overwritten with service properties.
        appProps.putAll(jvmProps);
        ArrayList<ExecRow> rows = new ArrayList<>(appProps.size());

        // Describe the format of the input rows (ExecRow).
        //
        // Columns of "virtual" row:
        //   KEY         VARCHAR
        //   VALUE         VARCHAR
        //   TYPE         VARCHAR (JVM, SERVICE, DATABASE, APP)
        DataValueDescriptor[] dvds = new DataValueDescriptor[] { new SQLVarchar(), new SQLVarchar(),
                new SQLVarchar() };
        int numCols = dvds.length;
        ExecRow dataTemplate = new ValueRow(numCols);
        dataTemplate.setRowArray(dvds);

        // Transform the properties into rows.  Sort the properties by key first.
        ArrayList<String> keyList = new ArrayList<>();
        for (Object o : appProps.keySet()) {
            if (o instanceof String)
                keyList.add((String) o);
        }
        Collections.sort(keyList);
        for (String key : keyList) {
            String[] typedValue = (String[]) appProps.get(key);
            dvds[0].setValue(key);
            dvds[1].setValue(typedValue[0]);
            dvds[2].setValue(typedValue[1]);
            rows.add(dataTemplate.getClone());
        }

        // Describe the format of the output rows (ResultSet).
        ResultColumnDescriptor[] columnInfo = new ResultColumnDescriptor[numCols];
        columnInfo[0] = new GenericColumnDescriptor("KEY",
                DataTypeDescriptor.getBuiltInDataTypeDescriptor(Types.VARCHAR, 50));
        columnInfo[1] = new GenericColumnDescriptor("VALUE",
                DataTypeDescriptor.getBuiltInDataTypeDescriptor(Types.VARCHAR, 40));
        columnInfo[2] = new GenericColumnDescriptor("TYPE",
                DataTypeDescriptor.getBuiltInDataTypeDescriptor(Types.VARCHAR, 10));
        EmbedConnection defaultConn = (EmbedConnection) getDefaultConn();
        Activation lastActivation = defaultConn.getLanguageConnection().getLastActivation();
        IteratorNoPutResultSet resultsToWrap = new IteratorNoPutResultSet(rows, columnInfo, lastActivation);
        resultsToWrap.openCore();
        EmbedResultSet ers = new EmbedResultSet40(defaultConn, resultsToWrap, false, null, true);
        rs[0] = ers;
    } catch (StandardException se) {
        throw PublicAPI.wrapStandardException(se);
    }
}

From source file:com.google.api.ads.adwords.awreporting.processors.onmemory.ReportProcessorOnMemory.java

/**
 * Generate all the mapped reports to the given account IDs.
 *
 * @param dateRangeType the date range type.
 * @param dateStart the starting date.//from  w  w  w  . j  av a 2  s  .  c  om
 * @param dateEnd the ending date.
 * @param accountIdsSet the account IDs.
 * @param properties the properties file
 * @throws Exception error reaching the API.
 */
@Override
public void generateReportsForMCC(String mccAccountId, ReportDefinitionDateRangeType dateRangeType,
        String dateStart, String dateEnd, Set<Long> accountIdsSet, Properties properties,
        ReportDefinitionReportType onDemandReportType, List<String> reportFieldsToInclude) throws Exception {

    LOGGER.info("*** Retrieving account IDs ***");

    if (accountIdsSet == null || accountIdsSet.size() == 0) {
        accountIdsSet = this.retrieveAccountIds(mccAccountId);
    } else {
        LOGGER.info("Accounts loaded from file.");
    }

    AdWordsSessionBuilderSynchronizer sessionBuilder = new AdWordsSessionBuilderSynchronizer(
            authenticator.authenticate(mccAccountId, false));

    LOGGER.info("*** Generating Reports for " + accountIdsSet.size() + " accounts ***");

    Stopwatch stopwatch = Stopwatch.createStarted();

    // reports
    Set<ReportDefinitionReportType> reports = this.csvReportEntitiesMapping.getDefinedReports();

    Set<Object> propertiesKeys = properties.keySet();
    for (Object key : propertiesKeys) {

        String reportDefinitionKey = key.toString();
        ReportDefinitionReportType reportType = this.extractReportTypeFromKey(reportDefinitionKey);
        if (reportType != null && reports.contains(reportType)) {
            this.downloadAndProcess(mccAccountId, sessionBuilder, reportType, dateRangeType, dateStart, dateEnd,
                    accountIdsSet, reportDefinitionKey, properties);
        }
    }

    stopwatch.stop();
    LOGGER.info("*** Finished processing all reports in " + (stopwatch.elapsed(TimeUnit.MILLISECONDS) / 1000)
            + " seconds ***\n");
}

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

@Override
public void initPlugins() {
    // Order all the plugins by their weight before loading any of them.
    Map<String, String> pluginNameMap = new HashMap<String, String>();
    NavigableMap<Integer, List<String>> weightedPlugins = new TreeMap<Integer, List<String>>();
    for (PluginMetaData pmd : getPluginMetaData().values()) {
        if (isExtensionEnabled(pmd.getName())) {
            if (pmd.getServerClasses() != null) {
                for (PluginClass pluginClass : pmd.getServerClasses()) {
                    String clazzName = pluginClass.getName();
                    int weight = pluginClass.getWeight();
                    pluginNameMap.put(clazzName, pmd.getName());

                    List<String> classList = weightedPlugins.get(weight);
                    if (classList == null) {
                        classList = new ArrayList<String>();
                        weightedPlugins.put(weight, classList);
                    }//from   ww  w  .j  a v  a  2 s  .  c om

                    classList.add(clazzName);
                }
            }
        } else {
            logger.warn("Plugin \"" + pmd.getName() + "\" is not enabled.");
        }
    }

    // Load the plugins in order of their weight
    for (List<String> classList : weightedPlugins.descendingMap().values()) {
        for (String clazzName : classList) {
            String pluginName = pluginNameMap.get(clazzName);

            try {
                ServerPlugin serverPlugin = (ServerPlugin) Class.forName(clazzName).newInstance();

                if (serverPlugin instanceof ServicePlugin) {
                    ServicePlugin servicePlugin = (ServicePlugin) serverPlugin;
                    /*
                     * load any properties that may currently be in the database
                     */
                    Properties currentProperties = getPluginProperties(pluginName);
                    /* get the default properties for the plugin */
                    Properties defaultProperties = servicePlugin.getDefaultProperties();

                    /*
                     * if there are any properties that not currently set, set them to the the
                     * default
                     */
                    for (Object key : defaultProperties.keySet()) {
                        if (!currentProperties.containsKey(key)) {
                            currentProperties.put(key, defaultProperties.get(key));
                        }
                    }

                    /* save the properties to the database */
                    setPluginProperties(pluginName, currentProperties);

                    /*
                     * initialize the plugin with those properties and add it to the list of
                     * loaded plugins
                     */
                    servicePlugin.init(currentProperties);
                    servicePlugins.put(servicePlugin.getPluginPointName(), servicePlugin);
                    serverPlugins.add(servicePlugin);
                    logger.debug("sucessfully loaded server plugin: " + serverPlugin.getPluginPointName());
                }

                if (serverPlugin instanceof ChannelPlugin) {
                    ChannelPlugin channelPlugin = (ChannelPlugin) serverPlugin;
                    channelPlugins.put(channelPlugin.getPluginPointName(), channelPlugin);
                    serverPlugins.add(channelPlugin);
                    logger.debug(
                            "sucessfully loaded server channel plugin: " + serverPlugin.getPluginPointName());
                }

                if (serverPlugin instanceof CodeTemplateServerPlugin) {
                    CodeTemplateServerPlugin codeTemplateServerPlugin = (CodeTemplateServerPlugin) serverPlugin;
                    codeTemplateServerPlugins.put(codeTemplateServerPlugin.getPluginPointName(),
                            codeTemplateServerPlugin);
                    serverPlugins.add(codeTemplateServerPlugin);
                    logger.debug("sucessfully loaded server code template plugin: "
                            + serverPlugin.getPluginPointName());
                }

                if (serverPlugin instanceof DataTypeServerPlugin) {
                    DataTypeServerPlugin dataTypePlugin = (DataTypeServerPlugin) serverPlugin;
                    dataTypePlugins.put(dataTypePlugin.getPluginPointName(), dataTypePlugin);
                    serverPlugins.add(dataTypePlugin);
                    logger.debug(
                            "sucessfully loaded server data type plugin: " + serverPlugin.getPluginPointName());
                }

                if (serverPlugin instanceof ResourcePlugin) {
                    ResourcePlugin resourcePlugin = (ResourcePlugin) serverPlugin;
                    resourcePlugins.put(resourcePlugin.getPluginPointName(), resourcePlugin);
                    serverPlugins.add(resourcePlugin);
                    logger.debug("Successfully loaded resource plugin: " + resourcePlugin.getPluginPointName());
                }

                if (serverPlugin instanceof TransmissionModeProvider) {
                    TransmissionModeProvider transmissionModeProvider = (TransmissionModeProvider) serverPlugin;
                    transmissionModeProviders.put(transmissionModeProvider.getPluginPointName(),
                            transmissionModeProvider);
                    serverPlugins.add(transmissionModeProvider);
                    logger.debug("Successfully loaded transmission mode provider plugin: "
                            + transmissionModeProvider.getPluginPointName());
                }

                if (serverPlugin instanceof AuthorizationPlugin) {
                    AuthorizationPlugin authorizationPlugin = (AuthorizationPlugin) serverPlugin;

                    if (this.authorizationPlugin != null) {
                        throw new Exception("Multiple Authorization Plugins are not permitted.");
                    }

                    this.authorizationPlugin = authorizationPlugin;
                    serverPlugins.add(authorizationPlugin);
                    logger.debug("sucessfully loaded server authorization plugin: "
                            + serverPlugin.getPluginPointName());
                }
            } catch (Exception e) {
                logger.error("Error instantiating plugin: " + pluginName, e);
            }
        }
    }
}