bloritsch    2002/09/18 13:55:44

  Modified:    fortress/src/java/org/apache/excalibur/fortress/container
                        MetaDataContainer.java
  Log:
  add the Commands
  
  Revision  Changes    Path
  1.3       +78 -2     
jakarta-avalon-excalibur/fortress/src/java/org/apache/excalibur/fortress/container/MetaDataContainer.java
  
  Index: MetaDataContainer.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-avalon-excalibur/fortress/src/java/org/apache/excalibur/fortress/container/MetaDataContainer.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- MetaDataContainer.java    18 Sep 2002 18:02:18 -0000      1.2
  +++ MetaDataContainer.java    18 Sep 2002 20:55:43 -0000      1.3
  @@ -91,7 +91,7 @@
    */
   public class MetaDataContainer
       extends AbstractLogEnabled
  -    implements Configurable, Contextualizable, Initializable, Serviceable
  +    implements Configurable, Contextualizable, Initializable, Disposable, 
Serviceable
   {
       protected final JarEntries m_jarEntries;
       protected Context        m_context;
  @@ -110,6 +110,9 @@
           m_jarEntries = JarScanner.getSystemJarEntries();
       }
   
  +    /**
  +     * Pull all the associated helper classes from the Context.
  +     */
       public void contextualize( Context context ) throws ContextException
       {
           m_context = context;
  @@ -176,5 +179,78 @@
   
       public void initialize() throws Exception
       {
  +    }
  +
  +    public void dispose()
  +    {
  +    }
  +
  +    /**
  +     * This is the command class to initialize a ComponentHandler
  +     */
  +    protected static final class InitComponentHandlerCommand implements Command
  +    {
  +        private final ComponentHandler m_handler;
  +        private final Logger m_logger;
  +
  +        protected InitComponentHandlerCommand( ComponentHandler handler, Logger 
logger )
  +        {
  +            m_handler = handler;
  +            m_logger = logger;
  +        }
  +
  +        public void execute()
  +            throws Exception
  +        {
  +            try
  +            {
  +                if( !m_handler.isInitialized() )
  +                {
  +                    m_handler.initialize();
  +
  +                    if( m_logger.isDebugEnabled() )
  +                    {
  +                        m_logger.debug( "Initialized Handler " + m_handler );
  +                    }
  +                }
  +            }
  +            catch( Exception e )
  +            {
  +                if( m_logger.isErrorEnabled() )
  +                {
  +                    m_logger.error( "Could not initialize ComponentHandler", e );
  +                }
  +
  +                throw e;
  +            }
  +        }
  +    }
  +
  +    /**
  +     * This is the command class to dispose a ComponentHandler
  +     */
  +    protected static final class DisposeComponentHandlerCommand implements Command
  +    {
  +        private final ComponentHandler m_handler;
  +        private final Logger m_logger;
  +
  +        protected DisposeComponentHandlerCommand( ComponentHandler handler, Logger 
logger )
  +        {
  +            m_handler = handler;
  +            m_logger = logger;
  +        }
  +
  +        public void execute()
  +        {
  +            if( m_handler.isInitialized() )
  +            {
  +                m_handler.dispose();
  +
  +                if( m_logger.isDebugEnabled() )
  +                {
  +                    m_logger.debug( "Disposed of Handler " + m_handler );
  +                }
  +            }
  +        }
       }
   }
  
  
  

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

Reply via email to