I have written a simple Avalon Component, consisting of an Interface:

public interface FSOLEnvironment extends Component {
        String ROLE = "com.cooley.fsol.sys.FSOLEnvironment";
}

and a Component Class, whose only purpose is to retrieve the path to an xml
config file and call loadConfiguration on a singleton CGConfig:

public class FSOLEnvironmentBootstrap
extends AbstractLogEnabled
implements FSOLEnvironment, Configurable, Composable, Initializable,
           Disposable, Component, ThreadSafe
{
    private boolean initialized = false;
    private boolean disposed = false;
    private ComponentManager manager = null;
    private String configurationPath = null;

    public FSOLEnvironmentBootstrap() {}

    public final void configure(Configuration conf)
        throws ConfigurationException
    {
        if (initialized || disposed)
        {
            throw new IllegalStateException ("Illegal call");
        }

        if ( this.configurationPath == null )
        {
            this.configurationPath = conf.getChild("configPath").getValue();
            getLogger().debug( "Bootstrapping FSOL" );
            getLogger().debug("Using Configuration Path: " +
this.configurationPath);
            CGConfig.getInstance().loadConfiguration(
(org.apache.log.Logger)getLogger(), this.configurationPath );
        }
    }

    /**
     * Composition.  Notice that I check to see if the Component has
     * already been initialized or disposed?  This is done to enforce
     * the policy of proper lifecycle management.
     */
    public final void compose(ComponentManager cmanager)
        throws ComponentException
    {
        if (initialized || disposed)
        {
            throw new IllegalStateException ("Illegal call");
        }

        if (null == this.manager)
        {
            this.manager = cmanager;
        }
    }

    public final void initialize()
        throws Exception
    {
        if (null == this.manager)
        {
            throw new IllegalStateException("Not Composed");
        }

                /*
        if (null == this.dbResource)
        {
            throw new IllegalStateException("Not Configured");
        }
                */

        if (disposed)
        {
            throw new IllegalStateException("Already disposed");
        }

        this.initialized = true;
    }

    public final void dispose()
    {
        this.disposed = true;
        this.manager = null;
    }
}

These classes have been compiled into jar files and placed in WEB-INF/lib.

I then added the following line to my cocoon.xconf

  <!-- ======================= FSOL =========================== -->
  <component class="com.cooley.fsol.sys.FSOLEnvironmentBootstrap"
role="com.cooley.fsol.sys.FSOLEnvironment"/>

hoping that when cocoon loads, it will compose my component, but that is not
happening.

Can anyone tell me what I am doing wrong/missing?

Thanks


---------------------------------------------------------------------
Please check that your question has not already been answered in the
FAQ before posting. <http://xml.apache.org/cocoon/faqs.html>

To unsubscribe, e-mail: <[EMAIL PROTECTED]>
For additional commands, e-mail: <[EMAIL PROTECTED]>

Reply via email to