You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@avalon.apache.org by bl...@apache.org on 2003/05/28 21:03:48 UTC

cvs commit: avalon-excalibur/fortress/src/java/org/apache/avalon/fortress/impl AbstractContainer.java

bloritsch    2003/05/28 12:03:48

  Modified:    fortress/src/test/org/apache/avalon/fortress/util/test
                        FortressConfigTestCase.java
               event/src/java/org/apache/excalibur/event Sink.java
               fortress/src/java/org/apache/avalon/fortress/util
                        FortressConfig.java ContextManager.java
               fortress/src/java/org/apache/avalon/fortress/impl
                        AbstractContainer.java
  Log:
  Use Sink.ROLE as opposed to Queue.ROLE for the CommandSink--which is the real contract
  
  Revision  Changes    Path
  1.3       +1 -1      avalon-excalibur/fortress/src/test/org/apache/avalon/fortress/util/test/FortressConfigTestCase.java
  
  Index: FortressConfigTestCase.java
  ===================================================================
  RCS file: /home/cvs/avalon-excalibur/fortress/src/test/org/apache/avalon/fortress/util/test/FortressConfigTestCase.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- FortressConfigTestCase.java	14 May 2003 15:54:47 -0000	1.2
  +++ FortressConfigTestCase.java	28 May 2003 19:03:47 -0000	1.3
  @@ -90,7 +90,7 @@
       public void setUp() throws Exception
       {
           m_config = new FortressConfig( FortressConfig.createDefaultConfig() );
  -        m_config.setCommandQueue( new DefaultQueue() );
  +        m_config.setCommandSink( new DefaultQueue() );
           m_config.setContextClassLoader( FortressConfigTestCase.class.getClassLoader() );
           m_config.setInstrumentManager( new TestInstrumentManager() );
           m_config.setLifecycleExtensionManager( new LifecycleExtensionManager() );
  
  
  
  1.20      +2 -0      avalon-excalibur/event/src/java/org/apache/excalibur/event/Sink.java
  
  Index: Sink.java
  ===================================================================
  RCS file: /home/cvs/avalon-excalibur/event/src/java/org/apache/excalibur/event/Sink.java,v
  retrieving revision 1.19
  retrieving revision 1.20
  diff -u -r1.19 -r1.20
  --- Sink.java	22 Mar 2003 12:46:27 -0000	1.19
  +++ Sink.java	28 May 2003 19:03:47 -0000	1.20
  @@ -66,6 +66,8 @@
    */
   public interface Sink
   {
  +    String ROLE = Sink.class.getName();
  +
       /**
        * Enqueues the given element onto the Sink.
        *
  
  
  
  1.16      +4 -4      avalon-excalibur/fortress/src/java/org/apache/avalon/fortress/util/FortressConfig.java
  
  Index: FortressConfig.java
  ===================================================================
  RCS file: /home/cvs/avalon-excalibur/fortress/src/java/org/apache/avalon/fortress/util/FortressConfig.java,v
  retrieving revision 1.15
  retrieving revision 1.16
  diff -u -r1.15 -r1.16
  --- FortressConfig.java	22 Apr 2003 12:37:09 -0000	1.15
  +++ FortressConfig.java	28 May 2003 19:03:48 -0000	1.16
  @@ -56,7 +56,7 @@
   import org.apache.avalon.framework.context.ContextException;
   import org.apache.avalon.framework.context.DefaultContext;
   import org.apache.avalon.framework.service.ServiceManager;
  -import org.apache.excalibur.event.Queue;
  +import org.apache.excalibur.event.Sink;
   import org.apache.excalibur.instrument.InstrumentManager;
   import org.apache.excalibur.mpool.PoolManager;
   
  @@ -150,9 +150,9 @@
           return m_context;
       }
   
  -    public void setCommandQueue( final Queue commandQueue )
  +    public void setCommandSink( final Sink commandSink )
       {
  -        m_context.put( Queue.ROLE, commandQueue );
  +        m_context.put( Sink.ROLE, commandSink );
       }
   
       public void setServiceManager( final ServiceManager componentManager )
  
  
  
  1.33      +14 -15    avalon-excalibur/fortress/src/java/org/apache/avalon/fortress/util/ContextManager.java
  
  Index: ContextManager.java
  ===================================================================
  RCS file: /home/cvs/avalon-excalibur/fortress/src/java/org/apache/avalon/fortress/util/ContextManager.java,v
  retrieving revision 1.32
  retrieving revision 1.33
  diff -u -r1.32 -r1.33
  --- ContextManager.java	28 May 2003 16:18:50 -0000	1.32
  +++ ContextManager.java	28 May 2003 19:03:48 -0000	1.33
  @@ -73,7 +73,6 @@
   import org.apache.avalon.framework.service.DefaultServiceManager;
   import org.apache.avalon.framework.service.DefaultServiceSelector;
   import org.apache.avalon.framework.service.ServiceManager;
  -import org.apache.excalibur.event.Queue;
   import org.apache.excalibur.event.Sink;
   import org.apache.excalibur.event.command.CommandManager;
   import org.apache.excalibur.event.command.TPCThreadManager;
  @@ -174,7 +173,7 @@
        * The Sink in use.
        * Either supplied via rootContext or created locally.
        */
  -    protected Sink m_queue;
  +    protected Sink m_sink;
   
       /**
        * The MetaInfoManager to be used by the container.
  @@ -339,7 +338,7 @@
           m_childContext.put( InstrumentManager.ROLE, null );
           m_childContext.put( INSTRUMENT_MANAGER_CONFIGURATION, null );
           m_childContext.put( INSTRUMENT_MANAGER_CONFIGURATION_URI, null );
  -        m_childContext.put( Queue.ROLE, null );
  +        m_childContext.put( Sink.ROLE, null );
           m_childContext.put( MetaInfoManager.ROLE, null );
           m_childContext.put( PoolManager.ROLE, null );
       }
  @@ -430,28 +429,28 @@
       }
   
       /**
  -     * Set up the CommandQueue to enable asynchronous management.
  +     * Set up the CommandSink to enable asynchronous management.
        *
  -     * @throws Exception if the <code>CommandQueue</code> could not be
  +     * @throws Exception if the <code>CommandSink</code> could not be
        *         created.
        */
       protected void initializeCommandSink() throws Exception
       {
           try
           {
  -            m_queue = (Queue) m_rootContext.get( Queue.ROLE );
  +            m_sink = (Sink) m_rootContext.get( Sink.ROLE );
           }
           catch ( ContextException ce )
           {
  -            // No CommandQueue specified, create a default one
  -            m_queue = createCommandSink();
  +            // No CommandSink specified, create a default one
  +            m_sink = createCommandSink();
           }
       }
   
       /**
  -     * Helper method for creating a default CommandQueue
  +     * Helper method for creating a default CommandSink
        *
  -     * @return a default <code>CommandQueue</code>
  +     * @return a default <code>CommandSink</code>
        * @throws Exception if an error occurs
        */
       private Sink createCommandSink() throws Exception
  @@ -466,7 +465,7 @@
           final Logger tmLogger = m_loggerManager.getLoggerForCategory( "system.threadmgr" );
   
           ContainerUtil.enableLogging( tm, tmLogger );
  -        ContainerUtil.parameterize( tm, buildCommandQueueConfig() );
  +        ContainerUtil.parameterize( tm, buildCommandSinkConfig() );
           ContainerUtil.initialize( tm );
   
           tm.register( cm );
  @@ -480,7 +479,7 @@
        * @return ThreadManager configuration as a <code>Parameters</code>
        *         instance
        */
  -    private Parameters buildCommandQueueConfig()
  +    private Parameters buildCommandSinkConfig()
       {
           final Parameters p = new Parameters();
           Integer threadsPerProcessor;
  @@ -533,7 +532,7 @@
           }
           catch ( ContextException ce )
           {
  -            final PoolManager pm = new DefaultPoolManager( m_queue );
  +            final PoolManager pm = new DefaultPoolManager( m_sink );
               assumeOwnership( pm );
               m_poolManager = pm;
           }
  @@ -696,7 +695,7 @@
           }
   
           manager.put( LoggerManager.ROLE, m_loggerManager );
  -        manager.put( Queue.ROLE, m_queue );
  +        manager.put( Sink.ROLE, m_sink );
           manager.put( MetaInfoManager.ROLE, m_metaInfoManager );
           manager.put( PoolManager.ROLE, m_poolManager );
           manager.put( InstrumentManager.ROLE, m_instrumentManager );
  
  
  
  1.31      +12 -12    avalon-excalibur/fortress/src/java/org/apache/avalon/fortress/impl/AbstractContainer.java
  
  Index: AbstractContainer.java
  ===================================================================
  RCS file: /home/cvs/avalon-excalibur/fortress/src/java/org/apache/avalon/fortress/impl/AbstractContainer.java,v
  retrieving revision 1.30
  retrieving revision 1.31
  diff -u -r1.30 -r1.31
  --- AbstractContainer.java	28 May 2003 17:50:20 -0000	1.30
  +++ AbstractContainer.java	28 May 2003 19:03:48 -0000	1.31
  @@ -81,7 +81,7 @@
   import org.apache.avalon.framework.service.Serviceable;
   import org.apache.commons.collections.BoundedFifoBuffer;
   import org.apache.commons.collections.StaticBucketMap;
  -import org.apache.excalibur.event.Queue;
  +import org.apache.excalibur.event.Sink;
   import org.apache.excalibur.instrument.InstrumentManager;
   import org.apache.excalibur.instrument.Instrumentable;
   import org.apache.excalibur.mpool.ObjectFactory;
  @@ -115,8 +115,8 @@
       protected LoggerManager m_loggerManager;
       /** contains the impl's PoolManager, which is extracted from m_serviceManager. */
       protected PoolManager m_poolManager;
  -    /** contains the impl's Queue, which is extracted from m_serviceManager. */
  -    protected Queue m_commandQueue;
  +    /** contains the impl's Sink, which is extracted from m_serviceManager. */
  +    protected Sink m_commandSink;
       /** contains the impl's root ClassLoader, which is extracted from m_serviceManager. */
       protected ClassLoader m_classLoader;
       /** contains the impl's RoleManager, which is extracted from m_serviceManager. */
  @@ -173,7 +173,7 @@
        * @avalon.dependency type="InstrumentManager"
        * @avalon.dependency type="LifecycleExtensionManager" optional="true"
        * @avalon.dependency type="RoleManager" optional="true"
  -     * @avalon.dependency type="Queue" optional="true"
  +     * @avalon.dependency type="Sink" optional="true"
        */
       public void service( final ServiceManager serviceManager )
           throws ServiceException
  @@ -188,14 +188,14 @@
   
           setupExtensionManager( serviceManager );
   
  -        if ( serviceManager.hasService( Queue.ROLE ) )
  +        if ( serviceManager.hasService( Sink.ROLE ) )
           {
  -            m_commandQueue = (Queue) serviceManager.lookup( Queue.ROLE );
  +            m_commandSink = (Sink) serviceManager.lookup( Sink.ROLE );
           }
           else
           {
               final String message =
  -                "No " + Queue.ROLE + " is given, all " +
  +                "No " + Sink.ROLE + " is given, all " +
                   "management will be performed synchronously";
               getLogger().warn( message );
           }
  @@ -585,8 +585,8 @@
                   int activation = entry.getMetaData().getActivation();
                   if ( activation == ComponentHandlerMetaData.ACTIVATION_BACKGROUND )
                   {
  -                    // If a queue is not set then we must change to inline.
  -                    if ( null == m_commandQueue )
  +                    // If a sink is not set then we must change to inline.
  +                    if ( null == m_commandSink )
                       {
                           activation = ComponentHandlerMetaData.ACTIVATION_INLINE;
                       }
  @@ -597,11 +597,11 @@
                   {
                   case ComponentHandlerMetaData.ACTIVATION_BACKGROUND:
                       // Add a command to initialize the component to the command
  -                    //  queue so it will be initialized asynchronously in the
  +                    //  sink so it will be initialized asynchronously in the
                       //  background.
                       final PrepareHandlerCommand element =
                           new PrepareHandlerCommand( handler, getLogger() );
  -                    m_commandQueue.enqueue( element );
  +                    m_commandSink.enqueue( element );
                       break;
   
                   case ComponentHandlerMetaData.ACTIVATION_INLINE:
  
  
  

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