avalon-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From blorit...@apache.org
Subject cvs commit: avalon-excalibur/fortress/src/java/org/apache/avalon/fortress/impl/handler AbstractComponentHandler.java ComponentFactory.java LEAwareComponentHandler.java PassThroughInvocationHandler.java ProxyHelper.java ProxyObjectFactory.java
Date Thu, 06 Mar 2003 19:42:09 GMT
bloritsch    2003/03/06 11:42:08

  Modified:    fortress/src/java/org/apache/avalon/fortress/impl/handler
                        AbstractComponentHandler.java ComponentFactory.java
                        LEAwareComponentHandler.java
                        PassThroughInvocationHandler.java ProxyHelper.java
                        ProxyObjectFactory.java
  Log:
  fix the ObjectFactory to pass through Instrumentable Object Factories.
  
  Revision  Changes    Path
  1.7       +353 -353  avalon-excalibur/fortress/src/java/org/apache/avalon/fortress/impl/handler/AbstractComponentHandler.java
  
  Index: AbstractComponentHandler.java
  ===================================================================
  RCS file: /home/cvs/avalon-excalibur/fortress/src/java/org/apache/avalon/fortress/impl/handler/AbstractComponentHandler.java,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -u -r1.6 -r1.7
  --- AbstractComponentHandler.java	25 Feb 2003 16:28:26 -0000	1.6
  +++ AbstractComponentHandler.java	6 Mar 2003 19:42:08 -0000	1.7
  @@ -1,353 +1,353 @@
  -/*
  -
  - ============================================================================
  -                   The Apache Software License, Version 1.1
  - ============================================================================
  -
  - Copyright (C) @year@ The Apache Software Foundation. All rights reserved.
  -
  - Redistribution and use in source and binary forms, with or without modifica-
  - tion, are permitted provided that the following conditions are met:
  -
  - 1. Redistributions of  source code must  retain the above copyright  notice,
  -    this list of conditions and the following disclaimer.
  -
  - 2. Redistributions in binary form must reproduce the above copyright notice,
  -    this list of conditions and the following disclaimer in the documentation
  -    and/or other materials provided with the distribution.
  -
  - 3. The end-user documentation included with the redistribution, if any, must
  -    include  the following  acknowledgment:  "This product includes  software
  -    developed  by the  Apache Software Foundation  (http://www.apache.org/)."
  -    Alternately, this  acknowledgment may  appear in the software itself,  if
  -    and wherever such third-party acknowledgments normally appear.
  -
  - 4. The names "Jakarta", "Avalon", "Excalibur" and "Apache Software Foundation"
  -    must not be used to endorse or promote products derived from this  software
  -    without  prior written permission. For written permission, please contact
  -    apache@apache.org.
  -
  - 5. Products  derived from this software may not  be called "Apache", nor may
  -    "Apache" appear  in their name,  without prior written permission  of the
  -    Apache Software Foundation.
  -
  - THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES,
  - INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
  - FITNESS  FOR A PARTICULAR  PURPOSE ARE  DISCLAIMED.  IN NO  EVENT SHALL  THE
  - APACHE SOFTWARE  FOUNDATION  OR ITS CONTRIBUTORS  BE LIABLE FOR  ANY DIRECT,
  - INDIRECT, INCIDENTAL, SPECIAL,  EXEMPLARY, OR CONSEQUENTIAL  DAMAGES (INCLU-
  - DING, BUT NOT LIMITED TO, PROCUREMENT  OF SUBSTITUTE GOODS OR SERVICES; LOSS
  - OF USE, DATA, OR  PROFITS; OR BUSINESS  INTERRUPTION)  HOWEVER CAUSED AND ON
  - ANY  THEORY OF LIABILITY,  WHETHER  IN CONTRACT,  STRICT LIABILITY,  OR TORT
  - (INCLUDING  NEGLIGENCE OR  OTHERWISE) ARISING IN  ANY WAY OUT OF THE  USE OF
  - THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  -
  - This software  consists of voluntary contributions made  by many individuals
  - on  behalf of the Apache Software  Foundation. For more  information on the
  - Apache Software Foundation, please see <http://www.apache.org/>.
  -
  -*/
  -package org.apache.avalon.fortress.impl.handler;
  -
  -import org.apache.avalon.excalibur.logger.LoggerManager;
  -import org.apache.avalon.framework.activity.Disposable;
  -import org.apache.avalon.framework.activity.Initializable;
  -import org.apache.avalon.framework.container.ContainerUtil;
  -import org.apache.avalon.framework.logger.Logger;
  -import org.apache.avalon.framework.service.ServiceException;
  -import org.apache.avalon.framework.service.ServiceManager;
  -import org.apache.avalon.framework.service.Serviceable;
  -import org.apache.excalibur.instrument.AbstractInstrumentable;
  -import org.apache.excalibur.instrument.CounterInstrument;
  -import org.apache.excalibur.instrument.Instrumentable;
  -import org.apache.excalibur.mpool.ObjectFactory;
  -
  -/**
  - * AbstractComponentHandler class, ensures components are initialized
  - * and destroyed correctly.
  - *
  - * @author <a href="mailto:dev@avalon.apache.org">Avalon Development Team</a>
  - * @version CVS $Revision$ $Date$
  - * @since 4.0
  - */
  -public abstract class AbstractComponentHandler
  -    extends AbstractInstrumentable
  -    implements Serviceable, Initializable, Disposable, ComponentHandler
  -{
  -    private CounterInstrument m_request = new CounterInstrument("requests");
  -    private CounterInstrument m_release = new CounterInstrument("releases");
  -
  -    /**
  -     * The instance of the ComponentFactory that creates and disposes of the
  -     * Component
  -     */
  -    protected ObjectFactory m_factory;
  -
  -    /**
  -     * State management boolean stating whether the Handler is initialized or
  -     * not
  -     */
  -    protected boolean m_prepared;
  -
  -    /**
  -     * State management boolean stating whether the Handler is disposed or
  -     * not
  -     */
  -    protected boolean m_disposed;
  -
  -    /** Logger for factory */
  -    protected Logger m_logger;
  -
  -    /** Logger Manager */
  -    protected LoggerManager m_loggerManager;
  -
  -    /**
  -     * @avalon.dependency type="LoggerManager"
  -     */
  -    public void service( ServiceManager manager )
  -        throws ServiceException
  -    {
  -        m_loggerManager =
  -            (LoggerManager)manager.lookup( LoggerManager.ROLE );
  -        m_factory =
  -            (ObjectFactory)manager.lookup( ObjectFactory.ROLE );
  -    }
  -
  -    public void initialize()
  -        throws Exception
  -    {
  -        final String classname = getClass().getName();
  -        final int index = classname.lastIndexOf( '.' );
  -        final String name = classname.substring( index + 1 );
  -
  -        String loggerName = name.toLowerCase();
  -        if( name.endsWith( "ComponentHandler" ) )
  -        {
  -            final int endIndex = loggerName.length() - 16;
  -            loggerName = loggerName.substring( 0, endIndex );
  -        }
  -
  -        final String categoryName = "system.handler." + loggerName;
  -        m_logger =
  -            m_loggerManager.getLoggerForCategory( categoryName );
  -
  -        if( m_factory instanceof Instrumentable )
  -        {
  -            addChildInstrumentable( (Instrumentable)m_factory );
  -        }
  -
  -        addInstrument( m_request );
  -        addInstrument( m_release );
  -
  -        setInstrumentableName( name );
  -    }
  -
  -    /**
  -     * Return the component's class that this handler is trying to create.
  -     * Used for deubug information.
  -     *
  -     * @return the <code>Class</code> object for the component
  -     */
  -    public Class getComponentClass()
  -    {
  -        return m_factory.getCreatedClass();
  -    }
  -
  -    /**
  -     * Actually prepare the handler and make it ready to
  -     * handle component access.
  -     *
  -     * @throws Exception if unable to prepare handler
  -     */
  -    public synchronized void prepareHandler()
  -        throws Exception
  -    {
  -        if( m_prepared )
  -        {
  -            return;
  -        }
  -
  -        if( m_disposed )
  -        {
  -            final String message = "Attempted to prepare disposed ComponentHandler for : " +
  -                m_factory.getCreatedClass().getName();
  -            m_logger.warn( message );
  -
  -            return;
  -        }
  -
  -        doPrepare();
  -
  -        if( m_logger.isDebugEnabled() )
  -        {
  -            final String message = "ComponentHandler initialized for: " +
  -                m_factory.getCreatedClass().getName();
  -            m_logger.debug( message );
  -        }
  -
  -        m_prepared = true;
  -    }
  -
  -    /**
  -     * Initialize the ComponentHandler.
  -     * Subclasses should overide this to do their own initialization.
  -     */
  -    protected void doPrepare()
  -        throws Exception
  -    {
  -    }
  -
  -    /**
  -     * Get a reference of the desired Component
  -     * @return the component
  -     */
  -    public Object get()
  -        throws Exception
  -    {
  -        if( !m_prepared )
  -        {
  -            prepareHandler();
  -        }
  -
  -        if( m_disposed )
  -        {
  -            final String message =
  -                "You cannot get a component from a disposed holder";
  -            throw new IllegalStateException( message );
  -        }
  -
  -        if ( m_request.isActive() )
  -        {
  -            m_request.increment();
  -        }
  -
  -        return doGet();
  -    }
  -
  -    /**
  -     * Subclasses should actually overide this to do the work
  -     * of retrieving a service.
  -     *
  -     * @return the service
  -     * @throws Exception if unable to aquire service
  -     */
  -    protected abstract Object doGet()
  -        throws Exception;
  -
  -    /**
  -     * Return a reference of the desired Component
  -     * @param component the component
  -     */
  -    public void put( final Object component )
  -    {
  -        if( !m_prepared )
  -        {
  -            final String message =
  -                "You cannot put a component in an uninitialized holder";
  -            throw new IllegalStateException( message );
  -        }
  -
  -        if ( m_release.isActive() )
  -        {
  -            m_release.increment();
  -        }
  -
  -        doPut( component );
  -    }
  -
  -    /**
  -     * Subclasses should overide this to return component to handler.
  -     *
  -     * @param component the component
  -     */
  -    protected void doPut( final Object component ) {}
  -
  -    /**
  -     * Create a new component for handler.
  -     *
  -     * @return the new component
  -     * @throws Exception if unable to create new component
  -     */
  -    protected Object newComponent()
  -        throws Exception
  -    {
  -        try
  -        {
  -            return m_factory.newInstance();
  -        }
  -        catch( final Exception e )
  -        {
  -            if( m_logger.isErrorEnabled() )
  -            {
  -                final String message = "Unable to create new instance";
  -                m_logger.error( message, e );
  -            }
  -
  -            throw e;
  -        }
  -    }
  -
  -    /**
  -     * Dispose of the specified component.
  -     *
  -     * @param component the component
  -     */
  -    protected void disposeComponent( final Object component )
  -    {
  -        if( null == component )
  -        {
  -            return;
  -        }
  -        try
  -        {
  -            m_factory.dispose( component );
  -        }
  -        catch( final Exception e )
  -        {
  -            if( m_logger.isWarnEnabled() )
  -            {
  -                m_logger.warn( "Error disposing component", e );
  -            }
  -        }
  -    }
  -
  -    /**
  -     * Dispose of the ComponentHandler and any associated Pools and Factories.
  -     */
  -    public void dispose()
  -    {
  -        doDispose();
  -        try
  -        {
  -            ContainerUtil.dispose( m_factory );
  -        }
  -        catch( RuntimeException e )
  -        {
  -            if( m_logger.isWarnEnabled() )
  -            {
  -                final String message = "Error decommissioning component: " +
  -                    m_factory.getCreatedClass().getName();
  -                m_logger.warn( message, e );
  -            }
  -        }
  -
  -        m_disposed = true;
  -    }
  -
  -    /**
  -     * Dispose handler specific resources.
  -     * Subclasses should overide this to provide their own funcitonality.
  -     */
  -    protected void doDispose()
  -    {
  -    }
  -
  -    /**
  -     * Represents the handler as a string.
  -     * @return the string representation of the handler
  -     */
  -    public String toString()
  -    {
  -        return getClass().getName() + "[for: " + m_factory.getCreatedClass().getName() + "]";
  -    }
  -}
  +/*
  +
  + ============================================================================
  +                   The Apache Software License, Version 1.1
  + ============================================================================
  +
  + Copyright (C) @year@ The Apache Software Foundation. All rights reserved.
  +
  + Redistribution and use in source and binary forms, with or without modifica-
  + tion, are permitted provided that the following conditions are met:
  +
  + 1. Redistributions of  source code must  retain the above copyright  notice,
  +    this list of conditions and the following disclaimer.
  +
  + 2. Redistributions in binary form must reproduce the above copyright notice,
  +    this list of conditions and the following disclaimer in the documentation
  +    and/or other materials provided with the distribution.
  +
  + 3. The end-user documentation included with the redistribution, if any, must
  +    include  the following  acknowledgment:  "This product includes  software
  +    developed  by the  Apache Software Foundation  (http://www.apache.org/)."
  +    Alternately, this  acknowledgment may  appear in the software itself,  if
  +    and wherever such third-party acknowledgments normally appear.
  +
  + 4. The names "Jakarta", "Avalon", "Excalibur" and "Apache Software Foundation"
  +    must not be used to endorse or promote products derived from this  software
  +    without  prior written permission. For written permission, please contact
  +    apache@apache.org.
  +
  + 5. Products  derived from this software may not  be called "Apache", nor may
  +    "Apache" appear  in their name,  without prior written permission  of the
  +    Apache Software Foundation.
  +
  + THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES,
  + INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
  + FITNESS  FOR A PARTICULAR  PURPOSE ARE  DISCLAIMED.  IN NO  EVENT SHALL  THE
  + APACHE SOFTWARE  FOUNDATION  OR ITS CONTRIBUTORS  BE LIABLE FOR  ANY DIRECT,
  + INDIRECT, INCIDENTAL, SPECIAL,  EXEMPLARY, OR CONSEQUENTIAL  DAMAGES (INCLU-
  + DING, BUT NOT LIMITED TO, PROCUREMENT  OF SUBSTITUTE GOODS OR SERVICES; LOSS
  + OF USE, DATA, OR  PROFITS; OR BUSINESS  INTERRUPTION)  HOWEVER CAUSED AND ON
  + ANY  THEORY OF LIABILITY,  WHETHER  IN CONTRACT,  STRICT LIABILITY,  OR TORT
  + (INCLUDING  NEGLIGENCE OR  OTHERWISE) ARISING IN  ANY WAY OUT OF THE  USE OF
  + THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  +
  + This software  consists of voluntary contributions made  by many individuals
  + on  behalf of the Apache Software  Foundation. For more  information on the
  + Apache Software Foundation, please see <http://www.apache.org/>.
  +
  +*/
  +package org.apache.avalon.fortress.impl.handler;
  +
  +import org.apache.avalon.excalibur.logger.LoggerManager;
  +import org.apache.avalon.framework.activity.Disposable;
  +import org.apache.avalon.framework.activity.Initializable;
  +import org.apache.avalon.framework.container.ContainerUtil;
  +import org.apache.avalon.framework.logger.Logger;
  +import org.apache.avalon.framework.service.ServiceException;
  +import org.apache.avalon.framework.service.ServiceManager;
  +import org.apache.avalon.framework.service.Serviceable;
  +import org.apache.excalibur.instrument.AbstractLogEnabledInstrumentable;
  +import org.apache.excalibur.instrument.CounterInstrument;
  +import org.apache.excalibur.instrument.Instrumentable;
  +import org.apache.excalibur.mpool.ObjectFactory;
  +
  +/**
  + * AbstractComponentHandler class, ensures components are initialized
  + * and destroyed correctly.
  + *
  + * @author <a href="mailto:dev@avalon.apache.org">Avalon Development Team</a>
  + * @version CVS $Revision$ $Date$
  + * @since 4.0
  + */
  +public abstract class AbstractComponentHandler
  +    extends AbstractLogEnabledInstrumentable
  +    implements Serviceable, Initializable, Disposable, ComponentHandler
  +{
  +    private CounterInstrument m_request = new CounterInstrument("requests");
  +    private CounterInstrument m_release = new CounterInstrument("releases");
  +
  +    /**
  +     * The instance of the ComponentFactory that creates and disposes of the
  +     * Component
  +     */
  +    protected ObjectFactory m_factory;
  +
  +    /**
  +     * State management boolean stating whether the Handler is initialized or
  +     * not
  +     */
  +    protected boolean m_prepared;
  +
  +    /**
  +     * State management boolean stating whether the Handler is disposed or
  +     * not
  +     */
  +    protected boolean m_disposed;
  +
  +    /** Logger for factory */
  +    protected Logger m_logger;
  +
  +    /** Logger Manager */
  +    protected LoggerManager m_loggerManager;
  +
  +    /**
  +     * @avalon.dependency type="LoggerManager"
  +     */
  +    public void service( ServiceManager manager )
  +        throws ServiceException
  +    {
  +        m_loggerManager =
  +            (LoggerManager)manager.lookup( LoggerManager.ROLE );
  +        m_factory =
  +            (ObjectFactory)manager.lookup( ObjectFactory.ROLE );
  +    }
  +
  +    public void initialize()
  +        throws Exception
  +    {
  +        final String classname = getClass().getName();
  +        final int index = classname.lastIndexOf( '.' );
  +        final String name = classname.substring( index + 1 );
  +
  +        String loggerName = name.toLowerCase();
  +        if( name.endsWith( "ComponentHandler" ) )
  +        {
  +            final int endIndex = loggerName.length() - 16;
  +            loggerName = loggerName.substring( 0, endIndex );
  +        }
  +
  +        final String categoryName = "system.handler." + loggerName;
  +        m_logger =
  +            m_loggerManager.getLoggerForCategory( categoryName );
  +
  +        if( m_factory instanceof Instrumentable )
  +        {
  +            addChildInstrumentable( (Instrumentable)m_factory );
  +        }
  +
  +        addInstrument( m_request );
  +        addInstrument( m_release );
  +
  +        setInstrumentableName( name );
  +    }
  +
  +    /**
  +     * Return the component's class that this handler is trying to create.
  +     * Used for deubug information.
  +     *
  +     * @return the <code>Class</code> object for the component
  +     */
  +    public Class getComponentClass()
  +    {
  +        return m_factory.getCreatedClass();
  +    }
  +
  +    /**
  +     * Actually prepare the handler and make it ready to
  +     * handle component access.
  +     *
  +     * @throws Exception if unable to prepare handler
  +     */
  +    public synchronized void prepareHandler()
  +        throws Exception
  +    {
  +        if( m_prepared )
  +        {
  +            return;
  +        }
  +
  +        if( m_disposed )
  +        {
  +            final String message = "Attempted to prepare disposed ComponentHandler for : " +
  +                m_factory.getCreatedClass().getName();
  +            m_logger.warn( message );
  +
  +            return;
  +        }
  +
  +        doPrepare();
  +
  +        if( m_logger.isDebugEnabled() )
  +        {
  +            final String message = "ComponentHandler initialized for: " +
  +                m_factory.getCreatedClass().getName();
  +            m_logger.debug( message );
  +        }
  +
  +        m_prepared = true;
  +    }
  +
  +    /**
  +     * Initialize the ComponentHandler.
  +     * Subclasses should overide this to do their own initialization.
  +     */
  +    protected void doPrepare()
  +        throws Exception
  +    {
  +    }
  +
  +    /**
  +     * Get a reference of the desired Component
  +     * @return the component
  +     */
  +    public Object get()
  +        throws Exception
  +    {
  +        if( !m_prepared )
  +        {
  +            prepareHandler();
  +        }
  +
  +        if( m_disposed )
  +        {
  +            final String message =
  +                "You cannot get a component from a disposed holder";
  +            throw new IllegalStateException( message );
  +        }
  +
  +        if ( m_request.isActive() )
  +        {
  +            m_request.increment();
  +        }
  +
  +        return doGet();
  +    }
  +
  +    /**
  +     * Subclasses should actually overide this to do the work
  +     * of retrieving a service.
  +     *
  +     * @return the service
  +     * @throws Exception if unable to aquire service
  +     */
  +    protected abstract Object doGet()
  +        throws Exception;
  +
  +    /**
  +     * Return a reference of the desired Component
  +     * @param component the component
  +     */
  +    public void put( final Object component )
  +    {
  +        if( !m_prepared )
  +        {
  +            final String message =
  +                "You cannot put a component in an uninitialized holder";
  +            throw new IllegalStateException( message );
  +        }
  +
  +        if ( m_release.isActive() )
  +        {
  +            m_release.increment();
  +        }
  +
  +        doPut( component );
  +    }
  +
  +    /**
  +     * Subclasses should overide this to return component to handler.
  +     *
  +     * @param component the component
  +     */
  +    protected void doPut( final Object component ) {}
  +
  +    /**
  +     * Create a new component for handler.
  +     *
  +     * @return the new component
  +     * @throws Exception if unable to create new component
  +     */
  +    protected Object newComponent()
  +        throws Exception
  +    {
  +        try
  +        {
  +            return m_factory.newInstance();
  +        }
  +        catch( final Exception e )
  +        {
  +            if( m_logger.isErrorEnabled() )
  +            {
  +                final String message = "Unable to create new instance";
  +                m_logger.error( message, e );
  +            }
  +
  +            throw e;
  +        }
  +    }
  +
  +    /**
  +     * Dispose of the specified component.
  +     *
  +     * @param component the component
  +     */
  +    protected void disposeComponent( final Object component )
  +    {
  +        if( null == component )
  +        {
  +            return;
  +        }
  +        try
  +        {
  +            m_factory.dispose( component );
  +        }
  +        catch( final Exception e )
  +        {
  +            if( m_logger.isWarnEnabled() )
  +            {
  +                m_logger.warn( "Error disposing component", e );
  +            }
  +        }
  +    }
  +
  +    /**
  +     * Dispose of the ComponentHandler and any associated Pools and Factories.
  +     */
  +    public void dispose()
  +    {
  +        doDispose();
  +        try
  +        {
  +            ContainerUtil.dispose( m_factory );
  +        }
  +        catch( RuntimeException e )
  +        {
  +            if( m_logger.isWarnEnabled() )
  +            {
  +                final String message = "Error decommissioning component: " +
  +                    m_factory.getCreatedClass().getName();
  +                m_logger.warn( message, e );
  +            }
  +        }
  +
  +        m_disposed = true;
  +    }
  +
  +    /**
  +     * Dispose handler specific resources.
  +     * Subclasses should overide this to provide their own funcitonality.
  +     */
  +    protected void doDispose()
  +    {
  +    }
  +
  +    /**
  +     * Represents the handler as a string.
  +     * @return the string representation of the handler
  +     */
  +    public String toString()
  +    {
  +        return getClass().getName() + "[for: " + m_factory.getCreatedClass().getName() + "]";
  +    }
  +}
  
  
  
  1.6       +316 -356  avalon-excalibur/fortress/src/java/org/apache/avalon/fortress/impl/handler/ComponentFactory.java
  
  Index: ComponentFactory.java
  ===================================================================
  RCS file: /home/cvs/avalon-excalibur/fortress/src/java/org/apache/avalon/fortress/impl/handler/ComponentFactory.java,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- ComponentFactory.java	25 Feb 2003 16:28:26 -0000	1.5
  +++ ComponentFactory.java	6 Mar 2003 19:42:08 -0000	1.6
  @@ -1,356 +1,316 @@
  -/*
  -
  - ============================================================================
  -                   The Apache Software License, Version 1.1
  - ============================================================================
  -
  - Copyright (C) @year@ The Apache Software Foundation. All rights reserved.
  -
  - Redistribution and use in source and binary forms, with or without modifica-
  - tion, are permitted provided that the following conditions are met:
  -
  - 1. Redistributions of  source code must  retain the above copyright  notice,
  -    this list of conditions and the following disclaimer.
  -
  - 2. Redistributions in binary form must reproduce the above copyright notice,
  -    this list of conditions and the following disclaimer in the documentation
  -    and/or other materials provided with the distribution.
  -
  - 3. The end-user documentation included with the redistribution, if any, must
  -    include  the following  acknowledgment:  "This product includes  software
  -    developed  by the  Apache Software Foundation  (http://www.apache.org/)."
  -    Alternately, this  acknowledgment may  appear in the software itself,  if
  -    and wherever such third-party acknowledgments normally appear.
  -
  - 4. The names "Jakarta", "Avalon", "Excalibur" and "Apache Software Foundation"
  -    must not be used to endorse or promote products derived from this  software
  -    without  prior written permission. For written permission, please contact
  -    apache@apache.org.
  -
  - 5. Products  derived from this software may not  be called "Apache", nor may
  -    "Apache" appear  in their name,  without prior written permission  of the
  -    Apache Software Foundation.
  -
  - THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES,
  - INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
  - FITNESS  FOR A PARTICULAR  PURPOSE ARE  DISCLAIMED.  IN NO  EVENT SHALL  THE
  - APACHE SOFTWARE  FOUNDATION  OR ITS CONTRIBUTORS  BE LIABLE FOR  ANY DIRECT,
  - INDIRECT, INCIDENTAL, SPECIAL,  EXEMPLARY, OR CONSEQUENTIAL  DAMAGES (INCLU-
  - DING, BUT NOT LIMITED TO, PROCUREMENT  OF SUBSTITUTE GOODS OR SERVICES; LOSS
  - OF USE, DATA, OR  PROFITS; OR BUSINESS  INTERRUPTION)  HOWEVER CAUSED AND ON
  - ANY  THEORY OF LIABILITY,  WHETHER  IN CONTRACT,  STRICT LIABILITY,  OR TORT
  - (INCLUDING  NEGLIGENCE OR  OTHERWISE) ARISING IN  ANY WAY OUT OF THE  USE OF
  - THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  -
  - This software  consists of voluntary contributions made  by many individuals
  - on  behalf of the Apache Software  Foundation. For more  information on the
  - Apache Software Foundation, please see <http://www.apache.org/>.
  -
  -*/
  -package org.apache.avalon.fortress.impl.handler;
  -
  -import org.apache.avalon.excalibur.logger.LoggerManager;
  -import org.apache.avalon.fortress.impl.LifecycleExtensionManager;
  -import org.apache.avalon.framework.component.WrapperComponentManager;
  -import org.apache.avalon.framework.configuration.Configuration;
  -import org.apache.avalon.framework.container.ContainerUtil;
  -import org.apache.avalon.framework.context.Context;
  -import org.apache.avalon.framework.logger.AbstractLogEnabled;
  -import org.apache.avalon.framework.logger.LogEnabled;
  -import org.apache.avalon.framework.logger.LogKit2AvalonLoggerAdapter;
  -import org.apache.avalon.framework.logger.Loggable;
  -import org.apache.avalon.framework.logger.Logger;
  -import org.apache.avalon.framework.parameters.Parameterizable;
  -import org.apache.avalon.framework.parameters.Parameters;
  -import org.apache.avalon.framework.service.ServiceManager;
  -import org.apache.avalon.framework.thread.ThreadSafe;
  -import org.apache.excalibur.instrument.CounterInstrument;
  -import org.apache.excalibur.instrument.Instrument;
  -import org.apache.excalibur.instrument.InstrumentManageable;
  -import org.apache.excalibur.instrument.InstrumentManager;
  -import org.apache.excalibur.instrument.Instrumentable;
  -import org.apache.excalibur.mpool.ObjectFactory;
  -
  -/**
  - * Factory for Avalon components.
  - *
  - * @author <a href="mailto:bloritsch@apache.org">Berin Loritsch</a>
  - * @author <a href="mailto:paul@luminas.co.uk">Paul Russell</a>
  - * @version CVS $Revision$ $Date$
  - * @since 4.0
  - */
  -public class ComponentFactory
  -    extends AbstractLogEnabled
  -    implements ObjectFactory, ThreadSafe, Instrumentable
  -{
  -    private CounterInstrument m_newInstance;
  -    private CounterInstrument m_dispose;
  -
  -    /**
  -     * Name of the Instrumentable.  Maps to the id of the component in the
  -     * configuration.
  -     */
  -    private String m_instrumentableName;
  -
  -    /** The class which this <code>ComponentFactory</code>
  -     * should create.
  -     */
  -    private Class m_componentClass;
  -
  -    /** The Context for the component
  -     */
  -    private Context m_context;
  -
  -    /** The component manager for this component.
  -     */
  -    private ServiceManager m_serviceManager;
  -
  -    /** The configuration for this component.
  -     */
  -    private Configuration m_configuration;
  -
  -    /** The LogKitManager for child ComponentSelectors
  -     */
  -    private LoggerManager m_loggerManager;
  -
  -    /** Lifecycle extensions manager
  -     */
  -    private final LifecycleExtensionManager m_extManager;
  -
  -    /** InstrumentManager
  -     */
  -    private final InstrumentManager m_instrumentManager;
  -    private Logger m_componentLogger;
  -
  -    /**
  -     * Construct a new component factory for the specified component.
  -     *
  -     * @param componentClass the class to instantiate (must have a default constructor).
  -     * @param configuration the <code>Configuration</code> object to pass to new instances.
  -     * @param serviceManager the service manager to pass to <code>Serviceable</code>s.
  -     * @param context the <code>Context</code> to pass to <code>Contexutalizable</code>s.
  -     * @param loggerManager the loggerManager manager instance.
  -     */
  -    public ComponentFactory( final Class componentClass,
  -                             final Configuration configuration,
  -                             final ServiceManager serviceManager,
  -                             final Context context,
  -                             final LoggerManager loggerManager,
  -                             final LifecycleExtensionManager extManager,
  -                             final InstrumentManager instrumentManager )
  -    {
  -        m_componentClass = componentClass;
  -        m_configuration = configuration;
  -        m_serviceManager = serviceManager;
  -        m_context = context;
  -        m_loggerManager = loggerManager;
  -        m_extManager = extManager;
  -        enableLogging( m_loggerManager.getLoggerForCategory( "system.factory" ) );
  -        m_instrumentManager = instrumentManager;
  -        m_instrumentableName = configuration.getAttribute( "id", componentClass.getName() );
  -        m_componentLogger = aquireLogger();
  -
  -        m_newInstance = new CounterInstrument( "creates" );
  -        m_dispose = new CounterInstrument( "destroys" );
  -    }
  -
  -   /**
  -    * Returns a new instance of a component and optionally applies a logging channel,
  -    * instrumentation, context, a component or service manager, configuration, parameters,
  -    * lifecycle extensions, initialization, and execution phases based on the interfaces
  -    * implemented by the component class.
  -    *
  -    * @return the new instance
  -    * @exception
  -    */
  -    public Object newInstance()
  -        throws Exception
  -    {
  -        final Object component = m_componentClass.newInstance();
  -
  -        if( getLogger().isDebugEnabled() )
  -        {
  -            final String message =
  -                "ComponentFactory creating new instance of " +
  -                m_componentClass.getName() + ".";
  -            getLogger().debug( message );
  -        }
  -
  -        if( component instanceof LogEnabled ||
  -            component instanceof Loggable )
  -        {
  -
  -            if( component instanceof LogEnabled )
  -            {
  -                ContainerUtil.enableLogging( component, m_componentLogger );
  -            }
  -            else
  -            {
  -                final String message = "WARNING: " + m_componentClass.getName() +
  -                    " implements the Loggable lifecycle stage. This is " +
  -                    " a deprecated feature that will be removed in the future. " +
  -                    " Please upgrade to using LogEnabled.";
  -                getLogger().warn( message );
  -                System.out.println( message );
  -
  -                final org.apache.log.Logger logkitLogger =
  -                    LogKit2AvalonLoggerAdapter.createLogger( m_componentLogger );
  -                ( (Loggable)component ).setLogger( logkitLogger );
  -            }
  -        }
  -
  -        // Set the name of the instrumentable before initialization.
  -        if( component instanceof Instrumentable )
  -        {
  -            final Instrumentable instrumentable = (Instrumentable)component;
  -            instrumentable.setInstrumentableName( m_instrumentableName );
  -        }
  -        
  -        if( component instanceof InstrumentManageable )
  -        {
  -            ( (InstrumentManageable)component ).setInstrumentManager( m_instrumentManager );
  -        }
  -
  -        ContainerUtil.contextualize( component, m_context );
  -        ContainerUtil.compose( component, new WrapperComponentManager( m_serviceManager ) );
  -        ContainerUtil.service( component, m_serviceManager );
  -        ContainerUtil.configure( component, m_configuration );
  -
  -        if( component instanceof Parameterizable )
  -        {
  -            Parameters parameters = Parameters.fromConfiguration( m_configuration );
  -            ContainerUtil.parameterize( component, parameters );
  -        }
  -
  -        m_extManager.executeCreationExtensions( component, m_context );
  -
  -        ContainerUtil.initialize( component );
  -
  -        if( component instanceof Instrumentable )
  -        {
  -            final Instrumentable instrumentable = (Instrumentable)component;
  -            
  -            // Get the name from the instrumentable in case it was changed since being set above.
  -            m_instrumentManager.registerInstrumentable(
  -                instrumentable, instrumentable.getInstrumentableName() );
  -        }
  -
  -        ContainerUtil.start( component );
  -
  -        if( m_newInstance.isActive() )
  -        {
  -            m_newInstance.increment();
  -        }
  -
  -        return component;
  -    }
  -
  -    private Logger aquireLogger()
  -    {
  -        Logger logger;
  -        final String name = ( m_configuration == null ? null : m_configuration.getAttribute( "name", null ) );
  -        if( null == name )
  -        {
  -            if( getLogger().isDebugEnabled() )
  -            {
  -                final String message = "no name attribute available, using standard name";
  -                getLogger().debug( message );
  -            }
  -            logger = m_loggerManager.getDefaultLogger();
  -        }
  -        else
  -        {
  -            if( getLogger().isDebugEnabled() )
  -            {
  -                final String message = "name attribute is " + name;
  -                getLogger().debug( message );
  -            }
  -            logger = m_loggerManager.getLoggerForCategory( name );
  -        }
  -        return logger;
  -    }
  -
  -   /**
  -    * Returns the component class.
  -    * @return the class
  -    */
  -    public final Class getCreatedClass()
  -    {
  -        return m_componentClass;
  -    }
  -
  -   /**
  -    * Disposal of the supplied component instance.
  -    * @param component the component to dispose of
  -    * @exception Exception if a disposal error occurs
  -    */
  -    public final void dispose( final Object component )
  -        throws Exception
  -    {
  -        if( getLogger().isDebugEnabled() )
  -        {
  -            final String message = "ComponentFactory decommissioning instance of " +
  -                getCreatedClass().getName() + ".";
  -            getLogger().debug( message );
  -        }
  -
  -        if( getCreatedClass().equals( component.getClass() ) )
  -        {
  -            ContainerUtil.shutdown( component );
  -
  -            m_extManager.executeDestructionExtensions( component, m_context );
  -
  -            if( m_dispose.isActive() )
  -            {
  -                m_dispose.increment();
  -            }
  -        }
  -        else
  -        {
  -            final String message = "The object given to be disposed does " +
  -                "not come from this ObjectFactory";
  -            throw new IllegalArgumentException( message );
  -        }
  -    }
  -
  -   /**
  -    * Set the instrumentable name
  -    * @param name the name
  -    */
  -    public final void setInstrumentableName( String name )
  -    {
  -        // ignore
  -    }
  -
  -   /**
  -    * Returns the instrumentable name
  -    * @return the name
  -    */
  -    public final String getInstrumentableName()
  -    {
  -        return m_instrumentableName;
  -    }
  -
  -   /**
  -    * Returns the set of instruments assigned to the component factory.
  -    * @return the instruments
  -    */
  -   public final Instrument[] getInstruments()
  -    {
  -        return new Instrument[]
  -        {
  -            m_newInstance,
  -            m_dispose
  -        };
  -    }
  -
  -   /**
  -    * Returns the set of child instrumentables. The default implementation
  -    * simply returns an empty instrumentable array.
  -    * @return the instrumentables
  -    */
  -    public final Instrumentable[] getChildInstrumentables()
  -    {
  -        return Instrumentable.EMPTY_INSTRUMENTABLE_ARRAY;
  -    }
  -}
  +/*
  +
  + ============================================================================
  +                   The Apache Software License, Version 1.1
  + ============================================================================
  +
  + Copyright (C) @year@ The Apache Software Foundation. All rights reserved.
  +
  + Redistribution and use in source and binary forms, with or without modifica-
  + tion, are permitted provided that the following conditions are met:
  +
  + 1. Redistributions of  source code must  retain the above copyright  notice,
  +    this list of conditions and the following disclaimer.
  +
  + 2. Redistributions in binary form must reproduce the above copyright notice,
  +    this list of conditions and the following disclaimer in the documentation
  +    and/or other materials provided with the distribution.
  +
  + 3. The end-user documentation included with the redistribution, if any, must
  +    include  the following  acknowledgment:  "This product includes  software
  +    developed  by the  Apache Software Foundation  (http://www.apache.org/)."
  +    Alternately, this  acknowledgment may  appear in the software itself,  if
  +    and wherever such third-party acknowledgments normally appear.
  +
  + 4. The names "Jakarta", "Avalon", "Excalibur" and "Apache Software Foundation"
  +    must not be used to endorse or promote products derived from this  software
  +    without  prior written permission. For written permission, please contact
  +    apache@apache.org.
  +
  + 5. Products  derived from this software may not  be called "Apache", nor may
  +    "Apache" appear  in their name,  without prior written permission  of the
  +    Apache Software Foundation.
  +
  + THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES,
  + INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
  + FITNESS  FOR A PARTICULAR  PURPOSE ARE  DISCLAIMED.  IN NO  EVENT SHALL  THE
  + APACHE SOFTWARE  FOUNDATION  OR ITS CONTRIBUTORS  BE LIABLE FOR  ANY DIRECT,
  + INDIRECT, INCIDENTAL, SPECIAL,  EXEMPLARY, OR CONSEQUENTIAL  DAMAGES (INCLU-
  + DING, BUT NOT LIMITED TO, PROCUREMENT  OF SUBSTITUTE GOODS OR SERVICES; LOSS
  + OF USE, DATA, OR  PROFITS; OR BUSINESS  INTERRUPTION)  HOWEVER CAUSED AND ON
  + ANY  THEORY OF LIABILITY,  WHETHER  IN CONTRACT,  STRICT LIABILITY,  OR TORT
  + (INCLUDING  NEGLIGENCE OR  OTHERWISE) ARISING IN  ANY WAY OUT OF THE  USE OF
  + THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  +
  + This software  consists of voluntary contributions made  by many individuals
  + on  behalf of the Apache Software  Foundation. For more  information on the
  + Apache Software Foundation, please see <http://www.apache.org/>.
  +
  +*/
  +package org.apache.avalon.fortress.impl.handler;
  +
  +import org.apache.avalon.excalibur.logger.LoggerManager;
  +import org.apache.avalon.fortress.impl.LifecycleExtensionManager;
  +import org.apache.avalon.framework.component.WrapperComponentManager;
  +import org.apache.avalon.framework.configuration.Configuration;
  +import org.apache.avalon.framework.container.ContainerUtil;
  +import org.apache.avalon.framework.context.Context;
  +import org.apache.avalon.framework.logger.LogEnabled;
  +import org.apache.avalon.framework.logger.LogKit2AvalonLoggerAdapter;
  +import org.apache.avalon.framework.logger.Loggable;
  +import org.apache.avalon.framework.logger.Logger;
  +import org.apache.avalon.framework.parameters.Parameterizable;
  +import org.apache.avalon.framework.parameters.Parameters;
  +import org.apache.avalon.framework.service.ServiceManager;
  +import org.apache.excalibur.instrument.AbstractLogEnabledInstrumentable;
  +import org.apache.excalibur.instrument.CounterInstrument;
  +import org.apache.excalibur.instrument.InstrumentManageable;
  +import org.apache.excalibur.instrument.InstrumentManager;
  +import org.apache.excalibur.instrument.Instrumentable;
  +import org.apache.excalibur.mpool.ObjectFactory;
  +
  +/**
  + * Factory for Avalon components.
  + *
  + * @author <a href="mailto:bloritsch@apache.org">Berin Loritsch</a>
  + * @author <a href="mailto:paul@luminas.co.uk">Paul Russell</a>
  + * @version CVS $Revision$ $Date$
  + * @since 4.0
  + */
  +public class ComponentFactory
  +    extends AbstractLogEnabledInstrumentable
  +    implements ObjectFactory
  +{
  +    private CounterInstrument m_newInstance;
  +    private CounterInstrument m_dispose;
  +
  +    /**
  +     * Name of the Instrumentable.  Maps to the id of the component in the
  +     * configuration.
  +     */
  +    private String m_instrumentableName;
  +
  +    /** The class which this <code>ComponentFactory</code>
  +     * should create.
  +     */
  +    private Class m_componentClass;
  +
  +    /** The Context for the component
  +     */
  +    private Context m_context;
  +
  +    /** The component manager for this component.
  +     */
  +    private ServiceManager m_serviceManager;
  +
  +    /** The configuration for this component.
  +     */
  +    private Configuration m_configuration;
  +
  +    /** The LogKitManager for child ComponentSelectors
  +     */
  +    private LoggerManager m_loggerManager;
  +
  +    /** Lifecycle extensions manager
  +     */
  +    private final LifecycleExtensionManager m_extManager;
  +
  +    /** InstrumentManager
  +     */
  +    private final InstrumentManager m_instrumentManager;
  +    private Logger m_componentLogger;
  +
  +    /**
  +     * Construct a new component factory for the specified component.
  +     *
  +     * @param componentClass the class to instantiate (must have a default constructor).
  +     * @param configuration the <code>Configuration</code> object to pass to new instances.
  +     * @param serviceManager the service manager to pass to <code>Serviceable</code>s.
  +     * @param context the <code>Context</code> to pass to <code>Contexutalizable</code>s.
  +     * @param loggerManager the loggerManager manager instance.
  +     */
  +    public ComponentFactory( final Class componentClass,
  +                             final Configuration configuration,
  +                             final ServiceManager serviceManager,
  +                             final Context context,
  +                             final LoggerManager loggerManager,
  +                             final LifecycleExtensionManager extManager,
  +                             final InstrumentManager instrumentManager )
  +    {
  +        m_componentClass = componentClass;
  +        m_configuration = configuration;
  +        m_serviceManager = serviceManager;
  +        m_context = context;
  +        m_loggerManager = loggerManager;
  +        m_extManager = extManager;
  +        enableLogging( m_loggerManager.getLoggerForCategory( "system.factory" ) );
  +        m_instrumentManager = instrumentManager;
  +        m_instrumentableName = configuration.getAttribute( "id", componentClass.getName() );
  +        m_componentLogger = aquireLogger();
  +
  +        m_newInstance = new CounterInstrument( "creates" );
  +        m_dispose = new CounterInstrument( "destroys" );
  +        
  +        addInstrument(m_newInstance);
  +        addInstrument(m_dispose);
  +    }
  +
  +   /**
  +    * Returns a new instance of a component and optionally applies a logging channel,
  +    * instrumentation, context, a component or service manager, configuration, parameters,
  +    * lifecycle extensions, initialization, and execution phases based on the interfaces
  +    * implemented by the component class.
  +    *
  +    * @return the new instance
  +    * @exception
  +    */
  +    public Object newInstance()
  +        throws Exception
  +    {
  +        final Object component = m_componentClass.newInstance();
  +
  +        if( getLogger().isDebugEnabled() )
  +        {
  +            final String message =
  +                "ComponentFactory creating new instance of " +
  +                m_componentClass.getName() + ".";
  +            getLogger().debug( message );
  +        }
  +
  +        if( component instanceof LogEnabled ||
  +            component instanceof Loggable )
  +        {
  +
  +            if( component instanceof LogEnabled )
  +            {
  +                ContainerUtil.enableLogging( component, m_componentLogger );
  +            }
  +            else
  +            {
  +                final String message = "WARNING: " + m_componentClass.getName() +
  +                    " implements the Loggable lifecycle stage. This is " +
  +                    " a deprecated feature that will be removed in the future. " +
  +                    " Please upgrade to using LogEnabled.";
  +                getLogger().warn( message );
  +                System.out.println( message );
  +
  +                final org.apache.log.Logger logkitLogger =
  +                    LogKit2AvalonLoggerAdapter.createLogger( m_componentLogger );
  +                ( (Loggable)component ).setLogger( logkitLogger );
  +            }
  +        }
  +
  +        // Set the name of the instrumentable before initialization.
  +        if( component instanceof Instrumentable )
  +        {
  +            final Instrumentable instrumentable = (Instrumentable)component;
  +            instrumentable.setInstrumentableName( m_instrumentableName );
  +        }
  +        
  +        if( component instanceof InstrumentManageable )
  +        {
  +            ( (InstrumentManageable)component ).setInstrumentManager( m_instrumentManager );
  +        }
  +
  +        ContainerUtil.contextualize( component, m_context );
  +        ContainerUtil.compose( component, new WrapperComponentManager( m_serviceManager ) );
  +        ContainerUtil.service( component, m_serviceManager );
  +        ContainerUtil.configure( component, m_configuration );
  +
  +        if( component instanceof Parameterizable )
  +        {
  +            Parameters parameters = Parameters.fromConfiguration( m_configuration );
  +            ContainerUtil.parameterize( component, parameters );
  +        }
  +
  +        m_extManager.executeCreationExtensions( component, m_context );
  +
  +        ContainerUtil.initialize( component );
  +
  +        if( component instanceof Instrumentable )
  +        {
  +            final Instrumentable instrumentable = (Instrumentable)component;
  +            
  +            // Get the name from the instrumentable in case it was changed since being set above.
  +            m_instrumentManager.registerInstrumentable(
  +                instrumentable, instrumentable.getInstrumentableName() );
  +        }
  +
  +        ContainerUtil.start( component );
  +
  +        if( m_newInstance.isActive() )
  +        {
  +            m_newInstance.increment();
  +        }
  +
  +        return component;
  +    }
  +
  +    private Logger aquireLogger()
  +    {
  +        Logger logger;
  +        final String name = ( m_configuration == null ? null : m_configuration.getAttribute( "name", null ) );
  +        if( null == name )
  +        {
  +            if( getLogger().isDebugEnabled() )
  +            {
  +                final String message = "no name attribute available, using standard name";
  +                getLogger().debug( message );
  +            }
  +            logger = m_loggerManager.getDefaultLogger();
  +        }
  +        else
  +        {
  +            if( getLogger().isDebugEnabled() )
  +            {
  +                final String message = "name attribute is " + name;
  +                getLogger().debug( message );
  +            }
  +            logger = m_loggerManager.getLoggerForCategory( name );
  +        }
  +        return logger;
  +    }
  +
  +   /**
  +    * Returns the component class.
  +    * @return the class
  +    */
  +    public final Class getCreatedClass()
  +    {
  +        return m_componentClass;
  +    }
  +
  +   /**
  +    * Disposal of the supplied component instance.
  +    * @param component the component to dispose of
  +    * @exception Exception if a disposal error occurs
  +    */
  +    public final void dispose( final Object component )
  +        throws Exception
  +    {
  +        if( getLogger().isDebugEnabled() )
  +        {
  +            final String message = "ComponentFactory decommissioning instance of " +
  +                getCreatedClass().getName() + ".";
  +            getLogger().debug( message );
  +        }
  +
  +        if( getCreatedClass().equals( component.getClass() ) )
  +        {
  +            ContainerUtil.shutdown( component );
  +
  +            m_extManager.executeDestructionExtensions( component, m_context );
  +
  +            if( m_dispose.isActive() )
  +            {
  +                m_dispose.increment();
  +            }
  +        }
  +        else
  +        {
  +            final String message = "The object given to be disposed does " +
  +                "not come from this ObjectFactory";
  +            throw new IllegalArgumentException( message );
  +        }
  +    }
  +}
  
  
  
  1.5       +158 -158  avalon-excalibur/fortress/src/java/org/apache/avalon/fortress/impl/handler/LEAwareComponentHandler.java
  
  Index: LEAwareComponentHandler.java
  ===================================================================
  RCS file: /home/cvs/avalon-excalibur/fortress/src/java/org/apache/avalon/fortress/impl/handler/LEAwareComponentHandler.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- LEAwareComponentHandler.java	25 Feb 2003 16:28:26 -0000	1.4
  +++ LEAwareComponentHandler.java	6 Mar 2003 19:42:08 -0000	1.5
  @@ -1,158 +1,158 @@
  -/*
  -
  - ============================================================================
  -                   The Apache Software License, Version 1.1
  - ============================================================================
  -
  - Copyright (C) @year@ The Apache Software Foundation. All rights reserved.
  -
  - Redistribution and use in source and binary forms, with or without modifica-
  - tion, are permitted provided that the following conditions are met:
  -
  - 1. Redistributions of  source code must  retain the above copyright  notice,
  -    this list of conditions and the following disclaimer.
  -
  - 2. Redistributions in binary form must reproduce the above copyright notice,
  -    this list of conditions and the following disclaimer in the documentation
  -    and/or other materials provided with the distribution.
  -
  - 3. The end-user documentation included with the redistribution, if any, must
  -    include  the following  acknowledgment:  "This product includes  software
  -    developed  by the  Apache Software Foundation  (http://www.apache.org/)."
  -    Alternately, this  acknowledgment may  appear in the software itself,  if
  -    and wherever such third-party acknowledgments normally appear.
  -
  - 4. The names "Jakarta", "Avalon", "Excalibur" and "Apache Software Foundation"
  -    must not be used to endorse or promote products derived from this  software
  -    without  prior written permission. For written permission, please contact
  -    apache@apache.org.
  -
  - 5. Products  derived from this software may not  be called "Apache", nor may
  -    "Apache" appear  in their name,  without prior written permission  of the
  -    Apache Software Foundation.
  -
  - THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES,
  - INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
  - FITNESS  FOR A PARTICULAR  PURPOSE ARE  DISCLAIMED.  IN NO  EVENT SHALL  THE
  - APACHE SOFTWARE  FOUNDATION  OR ITS CONTRIBUTORS  BE LIABLE FOR  ANY DIRECT,
  - INDIRECT, INCIDENTAL, SPECIAL,  EXEMPLARY, OR CONSEQUENTIAL  DAMAGES (INCLU-
  - DING, BUT NOT LIMITED TO, PROCUREMENT  OF SUBSTITUTE GOODS OR SERVICES; LOSS
  - OF USE, DATA, OR  PROFITS; OR BUSINESS  INTERRUPTION)  HOWEVER CAUSED AND ON
  - ANY  THEORY OF LIABILITY,  WHETHER  IN CONTRACT,  STRICT LIABILITY,  OR TORT
  - (INCLUDING  NEGLIGENCE OR  OTHERWISE) ARISING IN  ANY WAY OUT OF THE  USE OF
  - THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  -
  - This software  consists of voluntary contributions made  by many individuals
  - on  behalf of the Apache Software  Foundation. For more  information on the
  - Apache Software Foundation, please see <http://www.apache.org/>.
  -
  -*/
  -package org.apache.avalon.fortress.impl.handler;
  -
  -import org.apache.avalon.fortress.impl.LifecycleExtensionManager;
  -import org.apache.avalon.framework.activity.Disposable;
  -import org.apache.avalon.framework.container.ContainerUtil;
  -import org.apache.avalon.framework.context.Context;
  -
  -/**
  - * A ComponentHandler that delegates to underlying handler but also
  - * calls relevent Lifecycle Extension handlers at the right time.
  - *
  - * @author <a href="mailto:peter@apache.org">Peter Donald</a>
  - * @version CVS $Revision$ $Date$
  - */
  -public class LEAwareComponentHandler
  -    implements ComponentHandler, Disposable
  -{
  -    private final ComponentHandler m_componentHandler;
  -    private final LifecycleExtensionManager m_extManager;
  -    private final Context m_context;
  -
  -   /**
  -    * Creation of a new handler.
  -    * @param componentHandler the handler
  -    * @param extManager the extension manager
  -    * @param context the context
  -    */
  -    public LEAwareComponentHandler( final ComponentHandler componentHandler,
  -                                    final LifecycleExtensionManager extManager,
  -                                    final Context context )
  -    {
  -        if( null == componentHandler )
  -        {
  -            throw new NullPointerException( "componentHandler" );
  -        }
  -        if( null == extManager )
  -        {
  -            throw new NullPointerException( "extManager" );
  -        }
  -        if( null == context )
  -        {
  -            throw new NullPointerException( "context" );
  -        }
  -
  -        m_componentHandler = componentHandler;
  -        m_extManager = extManager;
  -        m_context = context;
  -    }
  -
  -    /**
  -     * Return the component's class that this handler is trying to create.
  -     * Used for deubug information.
  -     *
  -     * @return the <code>Class</code> object for the component
  -     */
  -    public Class getComponentClass()
  -    {
  -        return m_componentHandler.getComponentClass();
  -    }
  -
  -   /**
  -    * Prepare the handler.
  -    * @exception Exception if a handler preparation error occurs
  -    */
  -    public void prepareHandler()
  -        throws Exception
  -    {
  -        m_componentHandler.prepareHandler();
  -    }
  -
  -    /**
  -     * Retrieve the object and execute access extensions.
  -     *
  -     * @return the object
  -     * @throws Exception if unable to aquire object
  -     */
  -    public Object get() throws Exception
  -    {
  -        final Object object = m_componentHandler.get();
  -        m_extManager.executeAccessExtensions( object, m_context );
  -        return object;
  -    }
  -
  -    /**
  -     * Return component and execute Release extensions.
  -     *
  -     * @param component the component
  -     */
  -    public void put( final Object component )
  -    {
  -        try
  -        {
  -            m_extManager.executeReleaseExtensions( component, m_context );
  -        }
  -        catch( Exception e )
  -        {
  -            // REVISIT(MC): we need to log this somewhere
  -        }
  -        m_componentHandler.put( component );
  -    }
  -
  -   /**
  -    * Disposal of the handler.
  -    */
  -    public void dispose()
  -    {
  -        ContainerUtil.dispose( m_componentHandler );
  -    }
  -}
  +/*
  +
  + ============================================================================
  +                   The Apache Software License, Version 1.1
  + ============================================================================
  +
  + Copyright (C) @year@ The Apache Software Foundation. All rights reserved.
  +
  + Redistribution and use in source and binary forms, with or without modifica-
  + tion, are permitted provided that the following conditions are met:
  +
  + 1. Redistributions of  source code must  retain the above copyright  notice,
  +    this list of conditions and the following disclaimer.
  +
  + 2. Redistributions in binary form must reproduce the above copyright notice,
  +    this list of conditions and the following disclaimer in the documentation
  +    and/or other materials provided with the distribution.
  +
  + 3. The end-user documentation included with the redistribution, if any, must
  +    include  the following  acknowledgment:  "This product includes  software
  +    developed  by the  Apache Software Foundation  (http://www.apache.org/)."
  +    Alternately, this  acknowledgment may  appear in the software itself,  if
  +    and wherever such third-party acknowledgments normally appear.
  +
  + 4. The names "Jakarta", "Avalon", "Excalibur" and "Apache Software Foundation"
  +    must not be used to endorse or promote products derived from this  software
  +    without  prior written permission. For written permission, please contact
  +    apache@apache.org.
  +
  + 5. Products  derived from this software may not  be called "Apache", nor may
  +    "Apache" appear  in their name,  without prior written permission  of the
  +    Apache Software Foundation.
  +
  + THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES,
  + INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
  + FITNESS  FOR A PARTICULAR  PURPOSE ARE  DISCLAIMED.  IN NO  EVENT SHALL  THE
  + APACHE SOFTWARE  FOUNDATION  OR ITS CONTRIBUTORS  BE LIABLE FOR  ANY DIRECT,
  + INDIRECT, INCIDENTAL, SPECIAL,  EXEMPLARY, OR CONSEQUENTIAL  DAMAGES (INCLU-
  + DING, BUT NOT LIMITED TO, PROCUREMENT  OF SUBSTITUTE GOODS OR SERVICES; LOSS
  + OF USE, DATA, OR  PROFITS; OR BUSINESS  INTERRUPTION)  HOWEVER CAUSED AND ON
  + ANY  THEORY OF LIABILITY,  WHETHER  IN CONTRACT,  STRICT LIABILITY,  OR TORT
  + (INCLUDING  NEGLIGENCE OR  OTHERWISE) ARISING IN  ANY WAY OUT OF THE  USE OF
  + THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  +
  + This software  consists of voluntary contributions made  by many individuals
  + on  behalf of the Apache Software  Foundation. For more  information on the
  + Apache Software Foundation, please see <http://www.apache.org/>.
  +
  +*/
  +package org.apache.avalon.fortress.impl.handler;
  +
  +import org.apache.avalon.fortress.impl.LifecycleExtensionManager;
  +import org.apache.avalon.framework.activity.Disposable;
  +import org.apache.avalon.framework.container.ContainerUtil;
  +import org.apache.avalon.framework.context.Context;
  +
  +/**
  + * A ComponentHandler that delegates to underlying handler but also
  + * calls relevent Lifecycle Extension handlers at the right time.
  + *
  + * @author <a href="mailto:peter@apache.org">Peter Donald</a>
  + * @version CVS $Revision$ $Date$
  + */
  +public class LEAwareComponentHandler
  +    implements ComponentHandler, Disposable
  +{
  +    private final ComponentHandler m_componentHandler;
  +    private final LifecycleExtensionManager m_extManager;
  +    private final Context m_context;
  +
  +   /**
  +    * Creation of a new handler.
  +    * @param componentHandler the handler
  +    * @param extManager the extension manager
  +    * @param context the context
  +    */
  +    public LEAwareComponentHandler( final ComponentHandler componentHandler,
  +                                    final LifecycleExtensionManager extManager,
  +                                    final Context context )
  +    {
  +        if( null == componentHandler )
  +        {
  +            throw new NullPointerException( "componentHandler" );
  +        }
  +        if( null == extManager )
  +        {
  +            throw new NullPointerException( "extManager" );
  +        }
  +        if( null == context )
  +        {
  +            throw new NullPointerException( "context" );
  +        }
  +
  +        m_componentHandler = componentHandler;
  +        m_extManager = extManager;
  +        m_context = context;
  +    }
  +
  +    /**
  +     * Return the component's class that this handler is trying to create.
  +     * Used for deubug information.
  +     *
  +     * @return the <code>Class</code> object for the component
  +     */
  +    public Class getComponentClass()
  +    {
  +        return m_componentHandler.getComponentClass();
  +    }
  +
  +   /**
  +    * Prepare the handler.
  +    * @exception Exception if a handler preparation error occurs
  +    */
  +    public void prepareHandler()
  +        throws Exception
  +    {
  +        m_componentHandler.prepareHandler();
  +    }
  +
  +    /**
  +     * Retrieve the object and execute access extensions.
  +     *
  +     * @return the object
  +     * @throws Exception if unable to aquire object
  +     */
  +    public Object get() throws Exception
  +    {
  +        final Object object = m_componentHandler.get();
  +        m_extManager.executeAccessExtensions( object, m_context );
  +        return object;
  +    }
  +
  +    /**
  +     * Return component and execute Release extensions.
  +     *
  +     * @param component the component
  +     */
  +    public void put( final Object component )
  +    {
  +        try
  +        {
  +            m_extManager.executeReleaseExtensions( component, m_context );
  +        }
  +        catch( Exception e )
  +        {
  +            // REVISIT(MC): we need to log this somewhere
  +        }
  +        m_componentHandler.put( component );
  +    }
  +
  +   /**
  +    * Disposal of the handler.
  +    */
  +    public void dispose()
  +    {
  +        ContainerUtil.dispose( m_componentHandler );
  +    }
  +}
  
  
  
  1.3       +48 -6     avalon-excalibur/fortress/src/java/org/apache/avalon/fortress/impl/handler/PassThroughInvocationHandler.java
  
  Index: PassThroughInvocationHandler.java
  ===================================================================
  RCS file: /home/cvs/avalon-excalibur/fortress/src/java/org/apache/avalon/fortress/impl/handler/PassThroughInvocationHandler.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- PassThroughInvocationHandler.java	7 Feb 2003 16:08:12 -0000	1.2
  +++ PassThroughInvocationHandler.java	6 Mar 2003 19:42:08 -0000	1.3
  @@ -1,10 +1,52 @@
   /*
  - * Copyright (C) The Apache Software Foundation. All rights reserved.
  - *
  - * This software is published under the terms of the Apache Software License
  - * version 1.1, a copy of which has been included with this distribution in
  - * the LICENSE.txt file.
  - */
  +
  + ============================================================================
  +                   The Apache Software License, Version 1.1
  + ============================================================================
  +
  + Copyright (C) @year@ The Apache Software Foundation. All rights reserved.
  +
  + Redistribution and use in source and binary forms, with or without modifica-
  + tion, are permitted provided that the following conditions are met:
  +
  + 1. Redistributions of  source code must  retain the above copyright  notice,
  +    this list of conditions and the following disclaimer.
  +
  + 2. Redistributions in binary form must reproduce the above copyright notice,
  +    this list of conditions and the following disclaimer in the documentation
  +    and/or other materials provided with the distribution.
  +
  + 3. The end-user documentation included with the redistribution, if any, must
  +    include  the following  acknowledgment:  "This product includes  software
  +    developed  by the  Apache Software Foundation  (http://www.apache.org/)."
  +    Alternately, this  acknowledgment may  appear in the software itself,  if
  +    and wherever such third-party acknowledgments normally appear.
  +
  + 4. The names "Jakarta", "Avalon", "Excalibur" and "Apache Software Foundation"
  +    must not be used to endorse or promote products derived from this  software
  +    without  prior written permission. For written permission, please contact
  +    apache@apache.org.
  +
  + 5. Products  derived from this software may not  be called "Apache", nor may
  +    "Apache" appear  in their name,  without prior written permission  of the
  +    Apache Software Foundation.
  +
  + THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES,
  + INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
  + FITNESS  FOR A PARTICULAR  PURPOSE ARE  DISCLAIMED.  IN NO  EVENT SHALL  THE
  + APACHE SOFTWARE  FOUNDATION  OR ITS CONTRIBUTORS  BE LIABLE FOR  ANY DIRECT,
  + INDIRECT, INCIDENTAL, SPECIAL,  EXEMPLARY, OR CONSEQUENTIAL  DAMAGES (INCLU-
  + DING, BUT NOT LIMITED TO, PROCUREMENT  OF SUBSTITUTE GOODS OR SERVICES; LOSS
  + OF USE, DATA, OR  PROFITS; OR BUSINESS  INTERRUPTION)  HOWEVER CAUSED AND ON
  + ANY  THEORY OF LIABILITY,  WHETHER  IN CONTRACT,  STRICT LIABILITY,  OR TORT
  + (INCLUDING  NEGLIGENCE OR  OTHERWISE) ARISING IN  ANY WAY OUT OF THE  USE OF
  + THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  +
  + This software  consists of voluntary contributions made  by many individuals
  + on  behalf of the Apache Software  Foundation. For more  information on the
  + Apache Software Foundation, please see <http://www.apache.org/>.
  +
  +*/
   package org.apache.avalon.fortress.impl.handler;
   
   import java.lang.reflect.InvocationHandler;
  
  
  
  1.5       +48 -54    avalon-excalibur/fortress/src/java/org/apache/avalon/fortress/impl/handler/ProxyHelper.java
  
  Index: ProxyHelper.java
  ===================================================================
  RCS file: /home/cvs/avalon-excalibur/fortress/src/java/org/apache/avalon/fortress/impl/handler/ProxyHelper.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- ProxyHelper.java	28 Feb 2003 23:48:51 -0000	1.4
  +++ ProxyHelper.java	6 Mar 2003 19:42:08 -0000	1.5
  @@ -1,58 +1,52 @@
  -/* ====================================================================
  - * The Apache Software License, Version 1.1
  - *
  - * Copyright (c) 2002 The Apache Software Foundation. All rights
  - * reserved.
  - *
  - * Redistribution and use in source and binary forms, with or without
  - * modification, are permitted provided that the following conditions
  - * are met:
  - *
  - * 1. Redistributions of source code must retain the above copyright
  - *    notice, this list of conditions and the following disclaimer.
  - *
  - * 2. Redistributions in binary form must reproduce the above copyright
  - *    notice, this list of conditions and the following disclaimer in
  - *    the documentation and/or other materials provided with the
  - *    distribution.
  - *
  - * 3. The end-user documentation included with the redistribution,
  - *    if any, must include the following acknowledgment:
  - *    "This product includes software developed by the
  - *    Apache Software Foundation (http://www.apache.org/)."
  - *    Alternately, this acknowledgment may appear in the software
  - *    itself, if and wherever such third-party acknowledgments
  - *    normally appear.
  - *
  - * 4. The names "Jakarta", "Avalon", and "Apache Software Foundation"
  - *    must not be used to endorse or promote products derived from this
  - *    software without prior written permission. For written
  - *    permission, please contact apache@apache.org.
  - *
  - * 5. Products derived from this software may not be called "Apache",
  - *    nor may "Apache" appear in their name, without prior written
  - *    permission of the Apache Software Foundation.
  - *
  - * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
  - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
  - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
  - * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
  - * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
  - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
  - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
  - * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
  - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
  - * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
  - * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  - * SUCH DAMAGE.
  - * ====================================================================
  - *
  - * This software consists of voluntary contributions made by many
  - * individuals on behalf of the Apache Software Foundation. For more
  - * information on the Apache Software Foundation, please see
  - * <http://www.apache.org/>.
  - */
  +/*
   
  + ============================================================================
  +                   The Apache Software License, Version 1.1
  + ============================================================================
  +
  + Copyright (C) @year@ The Apache Software Foundation. All rights reserved.
  +
  + Redistribution and use in source and binary forms, with or without modifica-
  + tion, are permitted provided that the following conditions are met:
  +
  + 1. Redistributions of  source code must  retain the above copyright  notice,
  +    this list of conditions and the following disclaimer.
  +
  + 2. Redistributions in binary form must reproduce the above copyright notice,
  +    this list of conditions and the following disclaimer in the documentation
  +    and/or other materials provided with the distribution.
  +
  + 3. The end-user documentation included with the redistribution, if any, must
  +    include  the following  acknowledgment:  "This product includes  software
  +    developed  by the  Apache Software Foundation  (http://www.apache.org/)."
  +    Alternately, this  acknowledgment may  appear in the software itself,  if
  +    and wherever such third-party acknowledgments normally appear.
  +
  + 4. The names "Jakarta", "Avalon", "Excalibur" and "Apache Software Foundation"
  +    must not be used to endorse or promote products derived from this  software
  +    without  prior written permission. For written permission, please contact
  +    apache@apache.org.
  +
  + 5. Products  derived from this software may not  be called "Apache", nor may
  +    "Apache" appear  in their name,  without prior written permission  of the
  +    Apache Software Foundation.
  +
  + THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES,
  + INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
  + FITNESS  FOR A PARTICULAR  PURPOSE ARE  DISCLAIMED.  IN NO  EVENT SHALL  THE
  + APACHE SOFTWARE  FOUNDATION  OR ITS CONTRIBUTORS  BE LIABLE FOR  ANY DIRECT,
  + INDIRECT, INCIDENTAL, SPECIAL,  EXEMPLARY, OR CONSEQUENTIAL  DAMAGES (INCLU-
  + DING, BUT NOT LIMITED TO, PROCUREMENT  OF SUBSTITUTE GOODS OR SERVICES; LOSS
  + OF USE, DATA, OR  PROFITS; OR BUSINESS  INTERRUPTION)  HOWEVER CAUSED AND ON
  + ANY  THEORY OF LIABILITY,  WHETHER  IN CONTRACT,  STRICT LIABILITY,  OR TORT
  + (INCLUDING  NEGLIGENCE OR  OTHERWISE) ARISING IN  ANY WAY OUT OF THE  USE OF
  + THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  +
  + This software  consists of voluntary contributions made  by many individuals
  + on  behalf of the Apache Software  Foundation. For more  information on the
  + Apache Software Foundation, please see <http://www.apache.org/>.
  +
  +*/
   package org.apache.avalon.fortress.impl.handler;
   
   import java.io.Serializable;
  
  
  
  1.3       +102 -8    avalon-excalibur/fortress/src/java/org/apache/avalon/fortress/impl/handler/ProxyObjectFactory.java
  
  Index: ProxyObjectFactory.java
  ===================================================================
  RCS file: /home/cvs/avalon-excalibur/fortress/src/java/org/apache/avalon/fortress/impl/handler/ProxyObjectFactory.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- ProxyObjectFactory.java	7 Feb 2003 16:08:12 -0000	1.2
  +++ ProxyObjectFactory.java	6 Mar 2003 19:42:08 -0000	1.3
  @@ -1,12 +1,56 @@
   /*
  - * Copyright (C) The Apache Software Foundation. All rights reserved.
  - *
  - * This software is published under the terms of the Apache Software License
  - * version 1.1, a copy of which has been included with this distribution in
  - * the LICENSE.txt file.
  - */
  +
  + ============================================================================
  +                   The Apache Software License, Version 1.1
  + ============================================================================
  +
  + Copyright (C) @year@ The Apache Software Foundation. All rights reserved.
  +
  + Redistribution and use in source and binary forms, with or without modifica-
  + tion, are permitted provided that the following conditions are met:
  +
  + 1. Redistributions of  source code must  retain the above copyright  notice,
  +    this list of conditions and the following disclaimer.
  +
  + 2. Redistributions in binary form must reproduce the above copyright notice,
  +    this list of conditions and the following disclaimer in the documentation
  +    and/or other materials provided with the distribution.
  +
  + 3. The end-user documentation included with the redistribution, if any, must
  +    include  the following  acknowledgment:  "This product includes  software
  +    developed  by the  Apache Software Foundation  (http://www.apache.org/)."
  +    Alternately, this  acknowledgment may  appear in the software itself,  if
  +    and wherever such third-party acknowledgments normally appear.
  +
  + 4. The names "Jakarta", "Avalon", "Excalibur" and "Apache Software Foundation"
  +    must not be used to endorse or promote products derived from this  software
  +    without  prior written permission. For written permission, please contact
  +    apache@apache.org.
  +
  + 5. Products  derived from this software may not  be called "Apache", nor may
  +    "Apache" appear  in their name,  without prior written permission  of the
  +    Apache Software Foundation.
  +
  + THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES,
  + INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
  + FITNESS  FOR A PARTICULAR  PURPOSE ARE  DISCLAIMED.  IN NO  EVENT SHALL  THE
  + APACHE SOFTWARE  FOUNDATION  OR ITS CONTRIBUTORS  BE LIABLE FOR  ANY DIRECT,
  + INDIRECT, INCIDENTAL, SPECIAL,  EXEMPLARY, OR CONSEQUENTIAL  DAMAGES (INCLU-
  + DING, BUT NOT LIMITED TO, PROCUREMENT  OF SUBSTITUTE GOODS OR SERVICES; LOSS
  + OF USE, DATA, OR  PROFITS; OR BUSINESS  INTERRUPTION)  HOWEVER CAUSED AND ON
  + ANY  THEORY OF LIABILITY,  WHETHER  IN CONTRACT,  STRICT LIABILITY,  OR TORT
  + (INCLUDING  NEGLIGENCE OR  OTHERWISE) ARISING IN  ANY WAY OUT OF THE  USE OF
  + THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  +
  + This software  consists of voluntary contributions made  by many individuals
  + on  behalf of the Apache Software  Foundation. For more  information on the
  + Apache Software Foundation, please see <http://www.apache.org/>.
  +
  +*/
   package org.apache.avalon.fortress.impl.handler;
   
  +import org.apache.excalibur.instrument.Instrument;
  +import org.apache.excalibur.instrument.Instrumentable;
   import org.apache.excalibur.mpool.ObjectFactory;
   
   /**
  @@ -17,7 +61,7 @@
    * @version $Revision$ $Date$
    */
   public class ProxyObjectFactory
  -    implements ObjectFactory
  +    implements ObjectFactory, Instrumentable
   {
       /**
        * The underlying object factory that this factory proxies.
  @@ -75,5 +119,55 @@
       {
           final Object target = ProxyHelper.getObject( object );
           m_objectFactory.dispose( target );
  +    }
  +
  +    /* (non-Javadoc)
  +     * @see org.apache.excalibur.instrument.Instrumentable#setInstrumentableName(java.lang.String)
  +     */
  +    public void setInstrumentableName(String name)
  +    {
  +        if ( m_objectFactory instanceof Instrumentable )
  +        {
  +            ((Instrumentable)m_objectFactory).setInstrumentableName(name);
  +        }
  +    }
  +
  +    /* (non-Javadoc)
  +     * @see org.apache.excalibur.instrument.Instrumentable#getInstrumentableName()
  +     */
  +    public String getInstrumentableName()
  +    {
  +        if ( m_objectFactory instanceof Instrumentable )
  +        {
  +            return ((Instrumentable)m_objectFactory).getInstrumentableName();
  +        }
  +        
  +        return "";
  +    }
  +
  +    /* (non-Javadoc)
  +     * @see org.apache.excalibur.instrument.Instrumentable#getInstruments()
  +     */
  +    public Instrument[] getInstruments()
  +    {
  +        if ( m_objectFactory instanceof Instrumentable )
  +        {
  +            return ((Instrumentable)m_objectFactory).getInstruments();
  +        }
  +        
  +        return new Instrument[] {};
  +    }
  +
  +    /* (non-Javadoc)
  +     * @see org.apache.excalibur.instrument.Instrumentable#getChildInstrumentables()
  +     */
  +    public Instrumentable[] getChildInstrumentables()
  +    {
  +        if ( m_objectFactory instanceof Instrumentable )
  +        {
  +            return ((Instrumentable)m_objectFactory).getChildInstrumentables();
  +        }
  +        
  +        return new Instrumentable[] {};
       }
   }
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: cvs-unsubscribe@avalon.apache.org
For additional commands, e-mail: cvs-help@avalon.apache.org


Mime
View raw message