Package org.apache.commons.configuration

Examples of org.apache.commons.configuration.HierarchicalConfiguration


            List<String> c = ((HandlersPackage) obj).getHandlers();

            for (Iterator<String> i = c.iterator(); i.hasNext(); ) {
                String cName = i.next();

                HierarchicalConfiguration cmdConf = addHandler(cName);

                loadClass(cName, cmdConf);
            }

        } else {
View Full Code Here


     * @param className The class name
     * @return DefaultConfiguration
     * @throws ConfigurationException
     */
    private HierarchicalConfiguration addHandler(String className) throws ConfigurationException {
        HierarchicalConfiguration hConf = new DefaultConfigurationBuilder();
        hConf.addProperty("handler.[@class]", className);
        return hConf;
    }
View Full Code Here

    @SuppressWarnings("unchecked")
    protected void loadCommands(HierarchicalConfiguration configuration) throws Exception {

        final List<HierarchicalConfiguration> commandConfs = configuration.configurationsAt("commands.command");
        for (int index = 0; index < commandConfs.size(); index++) {
            HierarchicalConfiguration commandConf = commandConfs.get(index);
            String commandName = commandConf.getString("[@name]").toLowerCase();
            String className = commandConf.getString("[@class]");
            loadCommand(commandName, className, commandConf);
        }
    }
View Full Code Here

   * @return the configuration for the given  moduleType
   */
  @NotNull
  public HierarchicalConfiguration getModuleConfiguration( @NotNull Class<?> moduleType ) {
    String moduleTypeName = moduleType.getName().replaceAll( "\\$", "." );
    HierarchicalConfiguration modulesConfiguration = getModulesConfiguration();
    try {
      return modulesConfiguration.configurationAt( moduleTypeName );
    } catch ( IllegalArgumentException ignore ) {
      modulesConfiguration.addProperty( moduleTypeName, "" );
      return modulesConfiguration.configurationAt( moduleTypeName );
    }
  }
View Full Code Here

     * @param client
     *            the client
     */
    protected void configureProxy(XMLConfiguration config, HttpClient client) {
        if (config.containsKey("proxy")) {
            final HierarchicalConfiguration proxy = config
                    .configurationAt("proxy");
            if (null != proxy) {
                final String username = proxy.getString("username", "admin");
                final String password = proxy.getString("password", "admin1");
                final String host = proxy.getString("server", "localhost");
                final int port = proxy.getInt("port", 80);

                final UsernamePasswordCredentials defaultcreds = new UsernamePasswordCredentials(
                        username, password);
                final HttpHost newProxy = new HttpHost(host, port);
                client.getParams().setParameter(ConnRoutePNames.DEFAULT_PROXY,
View Full Code Here

   * @return the configuration for the given  moduleType
   */
  @NotNull
  public HierarchicalConfiguration getModuleConfiguration( @NotNull Class<?> moduleType ) {
    String moduleTypeName = moduleType.getName().replaceAll( "\\$", "." );
    HierarchicalConfiguration modulesConfiguration = getModulesConfiguration();
    try {
      return modulesConfiguration.configurationAt( moduleTypeName );
    } catch ( IllegalArgumentException ignore ) {
      modulesConfiguration.addProperty( moduleTypeName, "" );
      return modulesConfiguration.configurationAt( moduleTypeName );
    }
  }
View Full Code Here

    @Test
    public void testPerformance() {
        MyListener listener = new MyListener();
        BaseConfiguration baseConfig = new BaseConfiguration();
        baseConfig.addConfigurationListener(listener);
        HierarchicalConfiguration hConfig = new HierarchicalConfiguration();
        hConfig.addConfigurationListener(listener);
        ConcurrentMapConfiguration conf = new ConcurrentMapConfiguration();
        conf.addConfigurationListener(listener);
        testConfigurationSet(baseConfig);
        testConfigurationSet(hConfig);
        testConfigurationSet(conf);
View Full Code Here

    private void configureScriptEngine() {
        // the EngineController needs to be configured statically before requests start serving so that it can
        // properly construct ScriptEngine objects with the correct reset policy. allow script engines to be
        // configured so that folks can drop in different gremlin flavors.

        HierarchicalConfiguration config = new HierarchicalConfiguration();

        config.setProperty("name", "gremlin-groovy");
        config.setProperty("reset-threshold", "-1");

        List<String> imports = new ArrayList<>();
        imports.add("com.tinkerpop.gremlin.*");
        imports.add("com.tinkerpop.gremlin.java.*");
        imports.add("com.tinkerpop.gremlin.pipes.filter.*");
        imports.add("com.tinkerpop.gremlin.pipes.sideeffect.*");
        imports.add("com.tinkerpop.gremlin.pipes.transform.*");
        imports.add("com.tinkerpop.blueprints.*");
        imports.add("com.tinkerpop.blueprints.impls.*");
        imports.add("com.tinkerpop.blueprints.impls.tg.*");
        imports.add("com.tinkerpop.blueprints.impls.neo4j.*");
        imports.add("com.tinkerpop.blueprints.impls.neo4j.batch.*");
        imports.add("com.tinkerpop.blueprints.impls.orient.*");
        imports.add("com.tinkerpop.blueprints.impls.orient.batch.*");
        imports.add("com.tinkerpop.blueprints.impls.dex.*");
        imports.add("com.tinkerpop.blueprints.impls.rexster.*");
        imports.add("com.tinkerpop.blueprints.impls.sail.*");
        imports.add("com.tinkerpop.blueprints.impls.sail.impls.*");
        imports.add("com.tinkerpop.blueprints.util.*");
        imports.add("com.tinkerpop.blueprints.util.io.*");
        imports.add("com.tinkerpop.blueprints.util.io.gml.*");
        imports.add("com.tinkerpop.blueprints.util.io.graphml.*");
        imports.add("com.tinkerpop.blueprints.util.io.graphson.*");
        imports.add("com.tinkerpop.blueprints.util.wrappers.*");
        imports.add("com.tinkerpop.blueprints.util.wrappers.batch.*");
        imports.add("com.tinkerpop.blueprints.util.wrappers.batch.cache.*");
        imports.add("com.tinkerpop.blueprints.util.wrappers.event.*");
        imports.add("com.tinkerpop.blueprints.util.wrappers.event.listener.*");
        imports.add("com.tinkerpop.blueprints.util.wrappers.id.*");
        imports.add("com.tinkerpop.blueprints.util.wrappers.partition.*");
        imports.add("com.tinkerpop.blueprints.util.wrappers.readonly.*");
        imports.add("com.tinkerpop.blueprints.oupls.sail.*");
        imports.add("com.tinkerpop.blueprints.oupls.sail.pg.*");
        imports.add("com.tinkerpop.blueprints.oupls.jung.*");
        imports.add("com.tinkerpop.pipes.*");
        imports.add("com.tinkerpop.pipes.branch.*");
        imports.add("com.tinkerpop.pipes.filter.*");
        imports.add("com.tinkerpop.pipes.sideeffect.*");
        imports.add("com.tinkerpop.pipes.transform.*");
        imports.add("com.tinkerpop.pipes.util.*");
        imports.add("com.tinkerpop.pipes.util.iterators.*");
        imports.add("com.tinkerpop.pipes.util.structures.*");
        imports.add("org.apache.commons.configuration.*");
        imports.add("com.thinkaurelius.titan.core.*");
        imports.add("com.thinkaurelius.titan.core.attribute.*");
        imports.add("com.thinkaurelius.titan.core.util.*");
        imports.add("com.thinkaurelius.titan.example.*");
        imports.add("org.apache.commons.configuration.*");
        imports.add("com.tinkerpop.gremlin.Tokens.T");
        imports.add("com.tinkerpop.gremlin.groovy.*");
        config.setProperty("imports", imports);

        List<String> staticImports = new ArrayList<>();
        staticImports.add("com.tinkerpop.blueprints.Direction.*");
        staticImports.add("com.tinkerpop.blueprints.TransactionalGraph$Conclusion.*");
        staticImports.add("com.tinkerpop.blueprints.Compare.*");
        staticImports.add("com.thinkaurelius.titan.core.attribute.Geo.*");
        staticImports.add("com.thinkaurelius.titan.core.attribute.Text.*");
        staticImports.add("com.thinkaurelius.titan.core.TypeMaker$UniquenessConsistency.*");
        staticImports.add("com.tinkerpop.blueprints.Query$Compare.*");
        config.setProperty("static-imports", staticImports);

        EngineConfiguration engineConfiguration = new EngineConfiguration(config);

        List<EngineConfiguration> engineConfigurations = new ArrayList<>();
        engineConfigurations.add(engineConfiguration);
View Full Code Here

     *            the httpClient
     */
    protected void configureProxy(final XMLConfiguration config,
            final HttpClient client) {
        if (config.containsKey("proxy")) {
            final HierarchicalConfiguration proxy = config
                    .configurationAt("proxy");
            if (null != proxy) {
                final String username = proxy.getString("username", "admin");
                final String password = proxy.getString("password", "admin1");
                final String host = proxy.getString("server", "localhost");
                final int port = proxy.getInt("port", 80);

                final Credentials defaultcreds = new UsernamePasswordCredentials(
                        username, password);
                client.getState().setProxyCredentials(
                        new AuthScope(host, port, AuthScope.ANY_REALM),
View Full Code Here

        {
            throw new ConfigurationException("Only one external virtualhosts configuration file allowed, multiple filenames found.");
        }

        // Virtualhost configuration object
        Configuration vhostConfiguration = new HierarchicalConfiguration();

        // Load from embedded configuration if possible
        if (!vhostConfig.subset("virtualhost").isEmpty())
        {
            vhostConfiguration = vhostConfig;
        }
        else
        {
        // Load from the external configuration if possible
        for (String fileName : vhostFiles)
          {
              // Open the vhosts XML file and copy values from it to our config
                _vhostsFile = new File(fileName);
                if (!_vhostsFile.exists())
                {
                    throw new ConfigurationException("Virtualhosts file does not exist");
                }
            vhostConfiguration = parseConfig(new File(fileName));

                // save the default virtualhost name
                String defaultVirtualHost = vhostConfiguration.getString("default");
                _configuration.setProperty("virtualhosts.default", defaultVirtualHost);
            }
        }

        // Now extract the virtual host names from the configuration object
        List hosts = vhostConfiguration.getList("virtualhost.name");
        for (int j = 0; j < hosts.size(); j++)
        {
            String name = (String) hosts.get(j);

            // Add the virtual hosts to the server configuration
            VirtualHostConfiguration virtualhost = new VirtualHostConfiguration(name, vhostConfiguration.subset("virtualhost." + name));
            _virtualHosts.put(virtualhost.getName(), virtualhost);
        }
    }
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.