Examples of DefaultConfigurationBuilder

Whitespace handling. Since mixed content is not allowed in the configurations, whitespace is completely discarded in non-leaf nodes. For the leaf nodes the default behavior is to trim the space surrounding the value. This can be changed by specifying xml:space attribute with value of preserve in that case the whitespace is left intact.

@author Avalon Development Team @version CVS $Revision: 1.33 $ $Date: 2004/04/03 23:55:54 $
  • org.apache.commons.configuration.DefaultConfigurationBuilder
    pache.org/configuration/team-list.html">Commons Configuration team @version $Id: DefaultConfigurationBuilder.java 595043 2007-11-14 20:44:43Z oheger $

  • Examples of org.apache.avalon.framework.configuration.DefaultConfigurationBuilder

            log.debug("Config File: " + sysConfigFilename);
            log.debug("Role File:   " + roleConfigFilename);

            // process configuration files

            DefaultConfigurationBuilder builder = new DefaultConfigurationBuilder();
            Configuration sysConfig  = builder.buildFromFile(sysConfigFilename);
            Configuration roleConfig = builder.buildFromFile(roleConfigFilename);

            // Create the LoggerManager for Log4J
            LoggerManager lm = new Log4JLoggerManager();

            // Setup the RoleManager
    View Full Code Here

    Examples of org.apache.avalon.framework.configuration.DefaultConfigurationBuilder

            // Make sure same hierarchy is used
            Hierarchy hier = Hierarchy.getDefaultHierarchy();
            LogKitLoggerManager manager = new LogKitLoggerManager(null, hier, null, null);

            DefaultConfigurationBuilder builder = new DefaultConfigurationBuilder();
            try {
                Configuration c = builder.buildFromFile(cfg);
                Context ctx = new DefaultContext();
                manager.contextualize(ctx);
                manager.configure(c);
            } catch (IllegalArgumentException e) {
                // This happens if the default log-target id-ref specifies a non-existent target
    View Full Code Here

    Examples of org.apache.avalon.framework.configuration.DefaultConfigurationBuilder

      protected Configuration loadFOPConfig() throws MojoExecutionException {
              String fontPath  = (null != localFontPath && localFontPath != "") ? localFontPath : (new File(getAutopdfTargetDirectory().getParentFile(), "fonts")).getAbsolutePath();
        StringTemplateGroup templateGroup = new StringTemplateGroup("fonts", fontPath);
        StringTemplate template = templateGroup.getInstanceOf("fontconfig");
        DefaultConfigurationBuilder builder = new DefaultConfigurationBuilder();
        template.setAttribute ("fontPath",fontPath);
        final String config = template.toString();
        if (getLog().isDebugEnabled()) {
          getLog().debug(config);
        }
        try {
          return builder.build(IOUtils.toInputStream(config));
        } catch (IOException ioe) {
          throw new MojoExecutionException("Failed to load FOP config.", ioe);
        } catch (SAXException saxe) {
          throw new MojoExecutionException("Failed to parse FOP config.",
              saxe);
    View Full Code Here

    Examples of org.apache.avalon.framework.configuration.DefaultConfigurationBuilder

        protected Configuration loadFOPConfig() throws MojoExecutionException {
            System.out.println ("At load config");
            String fontPath = (null != localFontPath && localFontPath != "")? localFontPath: (new File(getTargetDirectory().getParentFile(), "fonts")).getAbsolutePath();
            StringTemplateGroup templateGroup = new StringTemplateGroup("fonts", fontPath);
            StringTemplate template = templateGroup.getInstanceOf("fontconfig");
            DefaultConfigurationBuilder builder = new DefaultConfigurationBuilder();
            template.setAttribute ("fontPath",fontPath);
            final String config = template.toString();
            if (getLog().isDebugEnabled()) {
                getLog().debug(config);
            }
            try {
                return builder.build(IOUtils.toInputStream(config));
            } catch (IOException ioe) {
                throw new MojoExecutionException("Failed to load FOP config.", ioe);
            } catch (SAXException saxe) {
                throw new MojoExecutionException("Failed to parse FOP config.",
                        saxe);
    View Full Code Here

    Examples of org.apache.avalon.framework.configuration.DefaultConfigurationBuilder

            throws Exception
        {
            m_logger = setupLogger();
            m_logger.debug( "LogKitManagementTest.initialize" );

            final DefaultConfigurationBuilder builder = new DefaultConfigurationBuilder();
            final Configuration conf = builder.build( testconf );
            final Context context = setupContext( conf.getChild( "context" ) );

            final DefaultLogKitManager lkm = new DefaultLogKitManager();
            lkm.enableLogging( new LogKitLogger( m_logger ) );
            lkm.contextualize( context );
    View Full Code Here

    Examples of org.apache.avalon.framework.configuration.DefaultConfigurationBuilder

            if( null != debugURL )
            {
                try
                {
                    final File rootContext = (File)m_context.get( "context-root" );
                    DefaultConfigurationBuilder builder = new DefaultConfigurationBuilder();
                    Configuration debugCategories = builder.buildFromFile( new File( rootContext, debugURL ) );
                    final Configuration[] debugCat = debugCategories.getChildren( "category" );
                    setupLoggers( targetManager, m_prefix, debugCat );
                }
                catch( ConfigurationException ce )
                {
    View Full Code Here

    Examples of org.apache.avalon.framework.configuration.DefaultConfigurationBuilder


        public void testBuildFromFileName()
            throws Exception
        {
             m_builder = new DefaultConfigurationBuilder();
             m_nsBuilder = new DefaultConfigurationBuilder(true); // switch on namespace support
             Configuration conf = m_builder.buildFromFile( TEST_PATH + SIMPLE_FILE_NAME );
             simpleAssertions( conf );
             conf = m_builder.buildFromFile( TEST_PATH + NS_FILE_NAME );
             simpleAssertionsNS( conf );
             conf = m_nsBuilder.buildFromFile( TEST_PATH + NS_FILE_NAME );
    View Full Code Here

    Examples of org.apache.avalon.framework.configuration.DefaultConfigurationBuilder

        }

        public void testBuildFromFile()
            throws Exception
        {
            m_builder = new DefaultConfigurationBuilder();
            m_nsBuilder = new DefaultConfigurationBuilder(true); // switch on namespace support
            Configuration conf =  m_builder.buildFromFile( m_file );
            simpleAssertions( conf );
            conf = m_builder.buildFromFile( m_nsFile );
            simpleAssertionsNS( conf );
            conf = m_nsBuilder.buildFromFile( m_nsFile );
    View Full Code Here

    Examples of org.apache.avalon.framework.configuration.DefaultConfigurationBuilder

        }

        public void testBuild()
            throws Exception
        {
            m_builder = new DefaultConfigurationBuilder();
            m_nsBuilder = new DefaultConfigurationBuilder(true); // switch on namespace support
            Configuration conf =  m_builder.build( m_file.toURL().toString() );
            simpleAssertions( conf );
            conf = m_builder.buildFromFile( m_nsFile );
            simpleAssertionsNS( conf );
            conf = m_nsBuilder.buildFromFile( m_nsFile );
    View Full Code Here

    Examples of org.apache.avalon.framework.configuration.DefaultConfigurationBuilder

         * space preserving processing instructions are present.
         */
        public void testSpaceTrimming()
            throws Exception
        {
            DefaultConfigurationBuilder builder = new DefaultConfigurationBuilder();
            InputStream in = new ByteArrayInputStream( spaceTrimmingCheckXML.getBytes() );
            Configuration conf = builder.build( in );
            assertEquals( "Value is trimmed by default",
                          "value",
                          conf.getChild( "trimmed-item" ).getValue() );
            assertEquals( "After trimming turned off value is preserved",
                          "\n a space\r a CR, then a trailing space ",
    View Full Code Here
    TOP
    Copyright © 2018 www.massapi.com. 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.