<?xml version="1.0"?>
<!--
     Licensed to the Apache Software Foundation (ASF) under one or more
     contributor license agreements.  See the NOTICE file distributed with
     this work for additional information regarding copyright ownership.
     The ASF licenses this file to You under the Apache License, Version 2.0
     (the "License"); you may not use this file except in compliance with
     the License.  You may obtain a copy of the License at
     
     http://www.apache.org/licenses/LICENSE-2.0
     
     Unless required by applicable law or agreed to in writing, software
     distributed  under the  License is distributed on an "AS IS" BASIS,
     WITHOUT  WARRANTIES OR CONDITIONS  OF ANY KIND, either  express  or
     implied.
     
     See the License for the specific language governing permissions and
     limitations under the License.
-->
<document>
    <properties>
        <title>Extension Interfaces</title>
    </properties>
    <body>
        <section name="Lifestyle Extension Interfaces">

            <p>
        A container manages extensions using an extension handler.  Handlers
        may implement the
                <code>Creator</code> and/or
                <code>Accessor</code>
        interfaces. A creator extension will be activated during the create and
        destroy stages of a component lifecycle. A accessor extension will be 
        activated during the access and release stages.
            </p>

            <section name="The Creator Interface">

                <p>
          The
                    <code>Creator</code> interface describes the create and destroy
          stages that occur between a component and a container
          during service management.  Lifecycle extensions supporting create
          and destroy stages must implement this interface.
                </p>

                <source>
 package org.apache.avalon.lifecycle;

 import org.apache.avalon.framework.context.Context;

 public interface Creator
 {
    /**
     * Create stage handler.
     *
     * @param object the object that is being created
     * @param context the context instance required by the create handler
     *    implementation
     * @exception Exception if an error occurs
     */
    void create( Object object, Context context )
        throws Exception;

    /**
     * Destroy stage handler.
     *
     * @param object the object that is being destroyed
     * @param context the context instance required by the handler
     *    implementation
     */
    void destroy( Object object, Context context );

 }
                </source>
            </section>

            <section name="Accessor Interface">
                <p>
          The
                    <code>Accessor</code> interface describes the access and release
          stages that occur between a service or component manager and a 
          container during service deployment. Lifecycle extensions supporting 
          access and release stages must implement this interface.
                </p>
                <source>
 package org.apache.avalon.lifecycle;

 import org.apache.avalon.framework.context.Context;

 public interface Accessor
 {
    /**
     * Access stage handler.
     *
     * @param object the object that is being accessed
     * @param context the context instance required by the access handler
     *    implementation
     * @exception Exception if an error occurs
     */
    void access( Object object, Context context )
        throws Exception;

    /**
     * Release stage handler.
     *
     * @param object the object that is being released
     * @param context the context instance required by the release handler
     *    implementation
     */
    void release( Object object, Context context );

 }
                </source>
            </section>
        </section>
    </body>
</document>
