public synchronized void reconfigure()

in src/java/org/apache/fulcrum/yaafi/framework/container/ServiceContainerImpl.java [509:560]


    public synchronized void reconfigure(Configuration configuration) throws ConfigurationException
    {
        Validate.notNull( configuration, "configuration" );

        int exceptionCounter = 0;
        ServiceComponent serviceComponent;

        this.getLogger().warn( "Reconfiguring all services ..." );

        // 1) wait for some time

        this.waitForReconfiguration();

        // 2) store the new configuration

        this.serviceConfiguration = configuration;

        Properties componentConfigurationProperties = this.loadComponentConfigurationProperties();

        ConfigurationUtil.expand( this.getLogger(), (DefaultConfiguration) this.serviceConfiguration,
                componentConfigurationProperties );

        // 3) reconfigure the services

        for (int i = 0; i < this.getServiceList().size(); i++)
        {
            serviceComponent = (ServiceComponent) this.getServiceList().get( i );

            Configuration serviceComponentConfiguration = this.serviceConfiguration
                    .getChild( serviceComponent.getShorthand() );

            try
            {
                serviceComponent.setConfiguration( serviceComponentConfiguration );
                serviceComponent.reconfigure();
            } catch (Throwable t)
            {
                String msg = "Reconfiguring of " + serviceComponent.getShorthand() + " failed";
                this.getLogger().error( msg );
                exceptionCounter++;
            }
        }

        // 4) check the result

        if (exceptionCounter > 0)
        {
            String msg = "The reconfiguration failed with " + exceptionCounter + " exception(s)";
            this.getLogger().error( msg );
            throw new ConfigurationException( msg );
        }
    }