Package org.apache.avalon.framework.configuration

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


    {
        if (value == null)
        {
            value = "";
        }
        DefaultConfiguration config =
            new DefaultConfiguration("property", "property");

        config.setAttribute("name", name);
        config.setValue(value);
        config.setAttribute(XML_SPACE, PRESERVE);
        return config;
    }
View Full Code Here


        this.roleName = getRoleName(config);

        // Pass a copy of the top-level object to superclass so that
        // our name is properly initialized
        // FIXME : could be avoided if parent m_role was protected or had protected accessors
        DefaultConfiguration temp = new DefaultConfiguration(config.getName(), config.getLocation());
        if (config.getAttribute("role", null) != null) {
            temp.setAttribute("role", this.roleName);
        }
        super.configure(temp);

        // Get default hint
        this.defaultHint = config.getAttribute(this.getDefaultHintAttributeName(), null);
View Full Code Here

        // Don't check namespace here : this will be done by node builders
        Configuration config = tree.getChild("components", false);

        if (config == null) {
            getLogger().debug("Sitemap has no components definition at " + tree.getLocation());
            config = new DefaultConfiguration("", "");
        }

        ComponentManager manager = new CocoonComponentManager(this.parentManager);

        LifecycleHelper.setupComponent(manager,
View Full Code Here

                                       LogKitManager logKitManager)
            throws Exception {

        return ComponentHandler.getComponentHandler(
                program,
                new DefaultConfiguration("", "GeneratorSelector"),
                manager, context, roles, logKitManager);
    }
View Full Code Here

     */
    private void _setup(SourceResolver resolver, String location)
        throws Exception {

        // configure the factory to log correctly and cache catalogues
        DefaultConfiguration configuration =
            new DefaultConfiguration("name", "location");
        DefaultConfiguration cacheConf =
            new DefaultConfiguration(
                XMLResourceBundleFactory.ConfigurationKeys.CACHE_AT_STARTUP,
                "location"
            );
        cacheConf.setValue(new Boolean(cacheAtStartup).toString());
        configuration.addChild(cacheConf);

        // set the root location for message catalogues
        DefaultConfiguration dirConf =
            new DefaultConfiguration(
                XMLResourceBundleFactory.ConfigurationKeys.ROOT_DIRECTORY,
                "location"
            );

        debug("catalog location:" + location);
        Source source = resolver.resolve(location);
        try {
            String systemId = source.getSystemId();
            if (!systemId.startsWith(FILE)) {
                throw new ResourceNotFoundException(
                    systemId + " does not denote a directory"
                );
            }
            debug("catalog directory:" + systemId);
            dirConf.setValue(systemId);
            configuration.addChild(dirConf);
        } finally {
            source.recycle();
        }

View Full Code Here

    public void initialize() /*throws Exception*/ {

    // FIXME : need to catch exceptions since ECS doesn't propagate the throws clause of Initializable
    try {

        Configuration emptyConfig = new DefaultConfiguration("", "");

        // Ensure all system-defined hints exist.
        // NOTE : checking this here means they can be user-defined in the sitemap
        switch(this.roleId) {
            case GENERATOR :
View Full Code Here

    protected File file;
    protected Class clazz;
    protected DefaultConfiguration config;

    public JavascriptProgram(File file, Class clazz, Collection dependecies) {
        DefaultConfiguration child;

        this.file = file;
        this.clazz = clazz;

        config = new DefaultConfiguration("", "GeneratorSelector");
        child = new DefaultConfiguration("file", "");
        child.setValue(file.toString());
        config.addChild(child);

        for (Iterator i = dependecies.iterator(); i.hasNext(); ) {
            child = new DefaultConfiguration("dependency", "");
            child.setValue(i.next().toString());
            config.addChild(child);
        }
    }
View Full Code Here

     *         would not contain any information.
     */
    Configuration saveState()
    {
        boolean empty = true;
        DefaultConfiguration state = new DefaultConfiguration( "instrument", "-" );
        state.setAttribute( "name", m_name );
       
        InstrumentSample[] samples = getInstrumentSamples();
        for ( int i = 0; i < samples.length; i++ )
        {
            Configuration childState = samples[i].saveState();
            if ( childState != null )
            {
                state.addChild( childState );
                empty = false;
            }
        }
       
        // Only return a state if it contains information.
View Full Code Here

            return null;
        }

        synchronized( this )
        {
            DefaultConfiguration state = new DefaultConfiguration( "sample", "-" );
            state.setAttribute( "type",
                                InstrumentSampleUtils.getInstrumentSampleTypeName( getType() ) );
            state.setAttribute( "interval", Long.toString( m_interval ) );
            state.setAttribute( "size", Integer.toString( m_size ) );

            state.setAttribute( "time", Long.toString( m_time ) );
            if( getLeaseExpirationTime() > 0 )
            {
                state.setAttribute( "lease-expiration", Long.toString( getLeaseExpirationTime() ) );
                state.setAttribute( "description", m_description );
            }

            // Save the history samples so that the newest is first.
            DefaultConfiguration samples = new DefaultConfiguration( "history", "-" );
            int[] history = getHistorySnapshot();

            // Build up a string of the sample points.
            StringBuffer sb = new StringBuffer();
            // Store the first value outside the loop to simplify the loop.
            sb.append( history[ history.length - 1 ] );
            for( int i = history.length - 2; i >= 0; i-- )
            {
                sb.append( ',' );
                sb.append( history[ i ] );
            }
            samples.setValue( sb.toString() );
            state.addChild( samples );

            saveState( state );

            return state;
View Full Code Here

     *
     * @return The Instrument Manager's state as a Configuration object.
     */
    public Configuration saveStateToConfiguration()
    {
        DefaultConfiguration state = new DefaultConfiguration( "instrument-manager-state", "-" );

        InstrumentableProxy[] instrumentableProxies = m_instrumentableProxyArray;
        if( instrumentableProxies == null )
        {
            instrumentableProxies = updateInstrumentableProxyArray();
        }

        for( int i = 0; i < instrumentableProxies.length; i++ )
        {
            Configuration childState = instrumentableProxies[ i ].saveState();
            if ( childState != null )
            {
                state.addChild( childState );
            }
        }

        return state;
    }
View Full Code Here

TOP

Related Classes of org.apache.avalon.framework.configuration.DefaultConfiguration

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.