Package org.apache.commons.configuration

Examples of org.apache.commons.configuration.DefaultConfigurationBuilder$ConfigurationDeclaration


            CombinedConfiguration configuration;
            if ( StringUtils.isNotBlank( properties ) )
            {
                try
                {
                    DefaultConfigurationBuilder builder = new DefaultConfigurationBuilder();
                    DefaultExpressionEngine expressionEngine = new DefaultExpressionEngine();
                    expressionEngine.setPropertyDelimiter( propertyDelimiter );
                    builder.setExpressionEngine( expressionEngine );

                    StringSearchInterpolator interpolator = new StringSearchInterpolator( "${", "}" );
                    // interpolation as plexus did it before
                    interpolator.addValueSource( new PropertiesBasedValueSource( System.getProperties() ) );

                    String interpolatedProps = interpolator.interpolate( properties );

                    logger.debug( "Loading configuration into commons-configuration, xml {}", interpolatedProps );
                    builder.load( new StringReader( interpolatedProps ) );
                    configuration = builder.getConfiguration( false );
                    configuration.setExpressionEngine( expressionEngine );
                    //configuration.set
                }
                catch ( InterpolationException e )
                {
View Full Code Here


            CombinedConfiguration configuration;
            if ( StringUtils.isNotBlank( properties ) )
            {
                try
                {
                    DefaultConfigurationBuilder builder = new DefaultConfigurationBuilder();
                    DefaultExpressionEngine expressionEngine = new DefaultExpressionEngine();
                    expressionEngine.setPropertyDelimiter( propertyDelimiter );
                    builder.setExpressionEngine( expressionEngine );

                    StringSearchInterpolator interpolator = new StringSearchInterpolator( "${", "}" );
                    // interpolation as plexus did it before
                    interpolator.addValueSource( new PropertiesBasedValueSource( System.getProperties() ) );

                    String interpolatedProps = interpolator.interpolate( properties );

                    logger.debug( "Loading configuration into commons-configuration, xml {}", interpolatedProps );
                    builder.load( new StringReader( interpolatedProps ) );
                    configuration = builder.getConfiguration( false );
                    configuration.setExpressionEngine( expressionEngine );
                    //configuration.set
                }
                catch ( InterpolationException e )
                {
View Full Code Here

            throw e;
        }
    }

    private Object selectRepository(MailStore store, String type) throws Exception {
        DefaultConfigurationBuilder objectConfiguration
            = new DefaultConfigurationBuilder();

        objectConfiguration.addProperty("[@destinationURL]", destination);
        objectConfiguration.addProperty("[@type]", type);
        objectConfiguration.addProperty("[@model]", "SYNCHRONOUS");
        return store.select(objectConfiguration);
    }
View Full Code Here

public class EngineTest {

  @Test
  public void testEngine() throws Exception {
    DefaultConfigurationBuilder factory = new DefaultConfigurationBuilder(
        "config.xml");
    Engine eng = new Engine(factory.getConfiguration());
    eng.execute();
  }
View Full Code Here

        // only used for dbfile
        MockMailStore mockStore = new MockMailStore();
        FilePersistentStreamRepository file_Persistent_Stream_Repository = new FilePersistentStreamRepository();
        file_Persistent_Stream_Repository.setFileSystem(fs);
        file_Persistent_Stream_Repository.setLog(new SimpleLog("MockLog"));
        DefaultConfigurationBuilder defaultConfiguration2 = new DefaultConfigurationBuilder();
        defaultConfiguration2.addProperty("[@destinationURL]", "file://target/var/mr/testrepo");
        file_Persistent_Stream_Repository.configure(defaultConfiguration2);
        file_Persistent_Stream_Repository.init();
        mockStore.add("STREAM.mr", file_Persistent_Stream_Repository);
       
        DefaultConfigurationBuilder defaultConfiguration = new DefaultConfigurationBuilder();
        defaultConfiguration.addProperty("[@destinationURL]","db://maildb/mr/testrepo");
        defaultConfiguration.addProperty("sqlFile","file://conf/sqlResources.xml");
        defaultConfiguration.addProperty("[@type]","MAIL");
        mr.setFileSystem(fs);
        mr.setStore(mockStore);
        mr.setDatasource(datasource);
        mr.setLog(new SimpleLog("MockLog"));
        mr.configure(defaultConfiguration);
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

        } catch (Exception e) {
            // Ignore exception, default to false
        }

        try {
            DefaultConfigurationBuilder mailConf
                = new DefaultConfigurationBuilder();
            mailConf.addProperty("[@destinationURL]", repositoryPath);
            mailConf.addProperty("[@type]", "MAIL");
            repository = (MailRepository) mailStore.select(mailConf);
        } catch (Exception e) {
            log("Failed to retrieve Store component:" + e.getMessage());
        }
    }
View Full Code Here

       
        try {
            if (filestore != null) {
               
                //prepare Configurations for stream repositories
                DefaultConfigurationBuilder streamConfiguration
                    = new DefaultConfigurationBuilder();

                streamConfiguration.addProperty( "[@destinationURL]", filestore );
                streamConfiguration.addProperty( "[@type]", "STREAM" );
                streamConfiguration.addProperty( "[@model]", "SYNCHRONOUS" );
                sr = (StreamRepository) store.select(streamConfiguration);

                if (getLogger().isDebugEnabled()) {
                    getLogger().debug("Got filestore for JdbcMailRepository: " + filestore);
                }
View Full Code Here

        assertEquals(true, records.hasNext());
    }

    protected void setUp() throws Exception {
        dnsServer = new TestableDNSServer();
        DefaultConfigurationBuilder db = new DefaultConfigurationBuilder();

        db.load(new ByteArrayInputStream("<dnsserver><autodiscover>true</autodiscover><authoritative>false</authoritative></dnsserver>".getBytes()));
        dnsServer.setLog(new SimpleLog("MockLog"));
        dnsServer.configure(db);
        dnsServer.init();
       
       
View Full Code Here

            userName = addressParts[0];
        }

        StringBuffer destinationBuffer = new StringBuffer(192).append(repositoryUrl).append(userName).append("/");
        String destination = destinationBuffer.toString();
        DefaultConfigurationBuilder mboxConf = new DefaultConfigurationBuilder();
        mboxConf.addProperty("[@destinationURL]", destination);
        mboxConf.addProperty("[@type]", repositoryType);
        MailRepository userInbox;
        try {
            userInbox = (MailRepository) store.select(mboxConf);
        } catch (Exception e) {
            log("Cannot open repository " + e);
View Full Code Here

TOP

Related Classes of org.apache.commons.configuration.DefaultConfigurationBuilder$ConfigurationDeclaration

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.