Package org.apache.commons.configuration

Examples of org.apache.commons.configuration.HierarchicalConfiguration


        }

        final boolean highAvailabilityMode = context.getProperties().getBoolean(Tokens.REXSTER_GRAPH_HA, false);

        // get the <properties> section of the xml configuration
        final HierarchicalConfiguration graphSectionConfig = (HierarchicalConfiguration) context.getProperties();
        SubnodeConfiguration neo4jSpecificConfiguration;

        try {
            neo4jSpecificConfiguration = graphSectionConfig.configurationAt(Tokens.REXSTER_GRAPH_PROPERTIES);
        } catch (IllegalArgumentException iae) {
            throw new GraphConfigurationException("Check graph configuration. Missing or empty configuration element: " + Tokens.REXSTER_GRAPH_PROPERTIES);
        }

        try {
View Full Code Here


        log.debug("populateFromConfig: "+ repositoryData.printValues());
  }

  @NotNull
  public HierarchicalConfiguration toConfiguration()  {
    HierarchicalConfiguration config = super.toConfiguration();
        config.setProperty(Constants.PLASTIC_REPOSITORY, repositoryData.repository);
        config.setProperty(Constants.PLASTIC_REPOSITORYSERVER, repositoryData.repositoryserver);
        config.setProperty(Constants.PLASTIC_BRANCH_TO_TRACK, repositoryData.branch);

        log.debug("toConfiguration: "+ repositoryData.printValues());
    return config;
  }
View Full Code Here

        }
       
        logger.info("Defaultdomain: " + defaultDomain);
       
        if (conf.getKeys("helloName").hasNext()) {
            HierarchicalConfiguration helloNameConfig = conf.configurationAt("helloName");
            boolean autodetect = helloNameConfig.getBoolean("[@autodetect]", true);
            if (autodetect) {
                try {
                    helloName = dns.getHostName(dns.getLocalHost());
                } catch (UnknownHostException e) {
                    helloName = "localhost";
View Full Code Here

    }

    @Override
    protected void doConfigure(final HierarchicalConfiguration configuration) throws ConfigurationException {
        super.doConfigure(configuration);
        HierarchicalConfiguration handlerConfiguration = configuration.configurationAt("handler");
        lengthReset = handlerConfiguration.getInteger("lengthReset", lengthReset);
        if (getLogger().isInfoEnabled()) {
            getLogger().info("The idle timeout will be reset every " + lengthReset + " bytes.");
        }
    }
View Full Code Here

            Processor mailProcessor = new MailCamelProcessor();
            Processor removePropsProcessor = new RemovePropertiesProcessor();
           
            List<HierarchicalConfiguration> processorConfs = config.configurationsAt("processor");
            for (int i = 0; i < processorConfs.size(); i++) {
                final HierarchicalConfiguration processorConf = processorConfs.get(i);
                String processorName = processorConf.getString("[@name]");
               
                if (processorName.equals(Mail.GHOST)) throw new ConfigurationException("ProcessorName of " + Mail.GHOST + " is reserved for internal use, choose a different name");
               
                mailets.put(processorName, new ArrayList<MailetManagement>());
                matchers.put(processorName, new ArrayList<MatcherManagement>());

                RouteDefinition processorDef = from(getEndpoint(processorName)).routeId(processorName).inOnly()
                // store the logger in properties
                .setProperty(MatcherSplitter.LOGGER_PROPERTY, constant(logger));  

                // load composite matchers if there are any
                Map<String,MatcherManagement> compositeMatchers = new HashMap<String, MatcherManagement>();
                loadCompositeMatchers(processorName, compositeMatchers, processorConf.configurationsAt("matcher"));
               
               
                final List<HierarchicalConfiguration> mailetConfs = processorConf.configurationsAt("mailet");
               
                // Loop through the mailet configuration, load
                // all of the matcher and mailets, and add
                // them to the processor.
                for (int j = 0; j < mailetConfs.size(); j++) {
                    HierarchicalConfiguration c = mailetConfs.get(j);

                    // We need to set this because of correctly parsing comma
                    String mailetClassName = c.getString("[@class]");
                    String matcherName = c.getString("[@match]", null);
                    String invertedMatcherName = c.getString("[@notmatch]", null);
               
                    Mailet mailet = null;
                    Matcher matcher = null;
                    try {
View Full Code Here

        List<HierarchicalConfiguration> allAccounts = configuration.configurationsAt("accounts");
        if (allAccounts.size() < 1)
            throw new ConfigurationException("Missing <accounts> section.");
        if (allAccounts.size() > 1)
            throw new ConfigurationException("Too many <accounts> sections, there must be exactly one");
        HierarchicalConfiguration accounts = allAccounts.get(0);

   
        if (accounts.getKeys().hasNext() == false)
            throw new ConfigurationException("Missing <account> section.");

        List<Node> accountsChildren = accounts.getRoot().getChildren();
        int i = 0;

        // Create an Account for every configured account
        for (Node accountsChild: accountsChildren) {
           
            String accountsChildName = accountsChild.getName();
       
            HierarchicalConfiguration accountsChildConfig = accounts.configurationAt(accountsChildName);
            if ("alllocal".equals(accountsChildName))
            {
                // <allLocal> is dynamic, save the parameters for accounts to
                // be created when the task is triggered
                getParsedDynamicAccountParameters().add(
                    new ParsedDynamicAccountParameters(i, accountsChildConfig));
                continue;
            }

            if ("account".equals(accountsChildName))
            {
                // Create an Account for the named user and
                // add it to the list of static accounts
                getStaticAccounts().add(
                    new Account(
                        i,
                        parsedConfiguration,
                        accountsChildConfig.getString("[@user]"),
                        accountsChildConfig.getString("[@password]"),
                        accountsChildConfig.getString("[@recipient]"),
                        accountsChildConfig.getBoolean(
                            "[@ignorercpt-header]"),
                        accountsChildConfig.getString("[@customrcpt-header]",""),
                        getSession()));
                continue;
            }

            throw new ConfigurationException(
View Full Code Here

            }
        }
    }

    public HierarchicalConfiguration getConfiguration(String name) throws ConfigurationException {
        HierarchicalConfiguration conf = confMap.get(name);
        if (conf != null) {
            return conf;
        } else {
            Resource r = loader.getResource(getConfigPrefix()+ name + ".xml");
            if (r.exists()) {
View Full Code Here

            Properties properties = getSession().getProperties();
            List<HierarchicalConfiguration> allProperties =
                configuration.configurationsAt("javaMailProperties.property");
            for (int i = 0; i < allProperties.size(); i++)
            {
                HierarchicalConfiguration propConf = allProperties.get(i);
                properties.setProperty(
                        propConf.getString("[@name]"),
                        propConf.getString("[@value]"));
                if (logger.isDebugEnabled())
                {
                    StringBuilder messageBuffer =
                        new StringBuilder("Set property name: ");
                    messageBuffer.append(propConf.getString("[@name]"));
                    messageBuffer.append(" to: ");
                    messageBuffer.append(
                        propConf.getString("[@value]"));
                    logger.debug(messageBuffer.toString());
                }
            }
        }
    }   
View Full Code Here

    private ConfigurationProvider provider;

    @Override
    protected void executeLifecycleMethodBeforeInitChecked(Configurable bean, String beanname) throws Exception {
        HierarchicalConfiguration config = provider.getConfiguration(beanname);
        bean.configure(config);

    }
View Full Code Here

            List<HierarchicalConfiguration> fetchConfs = conf.configurationsAt("fetch");
            for (int i = 0; i < fetchConfs.size(); i++)
            {
                // read configuration
                HierarchicalConfiguration fetchConf = fetchConfs.get(i);
                Long interval = fetchConf.getLong("interval");

                FetchMail fetcher = new FetchMail();
                   
                fetcher.setLog(logger);
                fetcher.setDNSService(dns);
View Full Code Here

TOP

Related Classes of org.apache.commons.configuration.HierarchicalConfiguration

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.