bloritsch    2002/09/17 10:39:59

  Modified:    fortress/src/java/org/apache/excalibur/fortress
                        AbstractContainer.java DefaultContainerManager.java
               fortress/src/java/org/apache/excalibur/fortress/handler
                        ComponentFactory.java
               fortress/src/java/org/apache/excalibur/fortress/lookup
                        FortressServiceManager.java
               fortress/src/test/org/apache/excalibur/fortress/test
                        ContainerProfile.java
  Added:       fortress/src/java/org/apache/excalibur/fortress/lookup
                        ComponentServiceSelector.java
  Removed:     fortress/src/java/org/apache/excalibur/fortress/lookup
                        ServiceComponentManager.java
                        ServiceComponentSelector.java
  Log:
  update fortress to use LegacyComponentManager to wrap a ServiceSelector
  
  Revision  Changes    Path
  1.56      +4 -3      
jakarta-avalon-excalibur/fortress/src/java/org/apache/excalibur/fortress/AbstractContainer.java
  
  Index: AbstractContainer.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-avalon-excalibur/fortress/src/java/org/apache/excalibur/fortress/AbstractContainer.java,v
  retrieving revision 1.55
  retrieving revision 1.56
  diff -u -r1.55 -r1.56
  --- AbstractContainer.java    8 Aug 2002 14:21:16 -0000       1.55
  +++ AbstractContainer.java    17 Sep 2002 17:39:59 -0000      1.56
  @@ -78,7 +78,6 @@
   import org.apache.excalibur.fortress.handler.ComponentHandler;
   import org.apache.excalibur.fortress.lifecycle.LifecycleExtensionManager;
   import org.apache.excalibur.fortress.lookup.FortressServiceManager;
  -import org.apache.excalibur.fortress.lookup.ServiceComponentManager;
   import org.apache.excalibur.fortress.lookup.FortressServiceSelector;
   import org.apache.excalibur.fortress.util.ExcaliburRoleManager;
   import org.apache.excalibur.fortress.util.RoleManager;
  @@ -86,6 +85,8 @@
   import org.apache.excalibur.instrument.InstrumentManager;
   import org.apache.excalibur.mpool.PoolManager;
   
  +import org.apache.excalibur.container.legacy.*;
  +
   /**
    * The Container is an interface used to mark the Containers in your system.
    * It exposes a protected getServiceManager() method so that the
  @@ -525,7 +526,7 @@
       protected ComponentManager getComponentManager()
       {
           // if a component manager is really needed
  -        return new ServiceComponentManager( m_serviceManager );
  +        return new LegacyComponentManager( m_serviceManager );
       }
   
       /**
  
  
  
  1.24      +1 -3      
jakarta-avalon-excalibur/fortress/src/java/org/apache/excalibur/fortress/DefaultContainerManager.java
  
  Index: DefaultContainerManager.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-avalon-excalibur/fortress/src/java/org/apache/excalibur/fortress/DefaultContainerManager.java,v
  retrieving revision 1.23
  retrieving revision 1.24
  diff -u -r1.23 -r1.24
  --- DefaultContainerManager.java      13 Aug 2002 07:57:26 -0000      1.23
  +++ DefaultContainerManager.java      17 Sep 2002 17:39:59 -0000      1.24
  @@ -69,8 +69,6 @@
   import org.apache.avalon.framework.service.ServiceManager;
   import org.apache.avalon.framework.service.Serviceable;
   import org.apache.excalibur.fortress.util.ContextManager;
  -import org.apache.excalibur.fortress.lookup.ComponentServiceManager;
  -import org.apache.excalibur.fortress.lookup.ServiceComponentManager;
   import org.apache.excalibur.util.ComponentStateValidator;
   
   /**
  
  
  
  1.24      +3 -3      
jakarta-avalon-excalibur/fortress/src/java/org/apache/excalibur/fortress/handler/ComponentFactory.java
  
  Index: ComponentFactory.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-avalon-excalibur/fortress/src/java/org/apache/excalibur/fortress/handler/ComponentFactory.java,v
  retrieving revision 1.23
  retrieving revision 1.24
  diff -u -r1.23 -r1.24
  --- ComponentFactory.java     13 Aug 2002 07:57:26 -0000      1.23
  +++ ComponentFactory.java     17 Sep 2002 17:39:59 -0000      1.24
  @@ -67,7 +67,7 @@
   import org.apache.avalon.framework.thread.ThreadSafe;
   
   import org.apache.excalibur.fortress.lifecycle.LifecycleExtensionManager;
  -import org.apache.excalibur.fortress.lookup.ServiceComponentManager;
  +import org.apache.excalibur.container.legacy.LegacyComponentManager;
   import org.apache.excalibur.mpool.ObjectFactory;
   
   /**
  @@ -187,7 +187,7 @@
           }
   
           ContainerUtil.contextualize( component, m_context );
  -        ContainerUtil.compose( component, new ServiceComponentManager( 
m_serviceManager ));
  +        ContainerUtil.compose( component, new LegacyComponentManager( 
m_serviceManager ));
           ContainerUtil.service( component, m_serviceManager );
           ContainerUtil.configure( component, m_configuration );
   
  
  
  
  1.12      +7 -2      
jakarta-avalon-excalibur/fortress/src/java/org/apache/excalibur/fortress/lookup/FortressServiceManager.java
  
  Index: FortressServiceManager.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-avalon-excalibur/fortress/src/java/org/apache/excalibur/fortress/lookup/FortressServiceManager.java,v
  retrieving revision 1.11
  retrieving revision 1.12
  diff -u -r1.11 -r1.12
  --- FortressServiceManager.java       11 Sep 2002 19:13:25 -0000      1.11
  +++ FortressServiceManager.java       17 Sep 2002 17:39:59 -0000      1.12
  @@ -132,9 +132,14 @@
       {
           Object temp = m_components.get( role, null );
   
  -        if( temp instanceof ServiceSelector || temp instanceof ComponentSelector )
  +        if( temp instanceof ServiceSelector )
           {
               return temp;
  +        }
  +
  +        if( temp instanceof ComponentSelector )
  +        {
  +            return new ComponentServiceSelector( role, (ComponentSelector) temp );
           }
   
           if( !( temp instanceof ComponentHandler ) )
  
  
  
  1.1                  
jakarta-avalon-excalibur/fortress/src/java/org/apache/excalibur/fortress/lookup/ComponentServiceSelector.java
  
  Index: ComponentServiceSelector.java
  ===================================================================
  /*
  
   ============================================================================
                     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
      [EMAIL PROTECTED]
  
   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.excalibur.fortress.lookup;
  
  import org.apache.avalon.framework.component.Component;
  import org.apache.avalon.framework.component.ComponentException;
  import org.apache.avalon.framework.component.ComponentSelector;
  import org.apache.avalon.framework.service.ServiceException;
  import org.apache.avalon.framework.service.ServiceSelector;
  
  /**
   * This is the Default ComponentManager for the Container.  It provides
   * a very simple abstraction, and makes it easy for the Container to manage
   * the references.
   *
   * @author <a href="mailto:[EMAIL PROTECTED]";>Berin Loritsch</a>
   * @version CVS $Revision: 1.1 $ $Date: 2002/09/17 17:39:59 $
   */
  public class ComponentServiceSelector implements ServiceSelector
  {
      private final ComponentSelector m_selector;
      private final String            m_role;
  
      /**
       * This constructor is a constructor for a ComponentServiceManager
       */
      public ComponentServiceSelector( final String role, final ComponentSelector 
wrapped )
      {
          m_role = role + "/";
          m_selector = wrapped;
      }
  
      public Object select( Object hint )
          throws ServiceException
      {
          Object temp = null;
  
          try
          {
              temp = m_selector.select( hint );
          }
          catch( ComponentException ce )
          {
              throw new ServiceException( m_role + hint,
                      "Could not return a reference to the Component", ce );
          }
  
          return temp;
      }
  
      public boolean isSelectable( Object hint )
      {
          return m_selector.hasComponent( hint );
      }
  
      public void release( Object component )
      {
          m_selector.release((Component) component);
      }
  }
  
  
  
  1.25      +4 -3      
jakarta-avalon-excalibur/fortress/src/test/org/apache/excalibur/fortress/test/ContainerProfile.java
  
  Index: ContainerProfile.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-avalon-excalibur/fortress/src/test/org/apache/excalibur/fortress/test/ContainerProfile.java,v
  retrieving revision 1.24
  retrieving revision 1.25
  diff -u -r1.24 -r1.25
  --- ContainerProfile.java     13 Aug 2002 07:57:27 -0000      1.24
  +++ ContainerProfile.java     17 Sep 2002 17:39:59 -0000      1.25
  @@ -60,6 +60,7 @@
   import org.apache.avalon.excalibur.testcase.LatchedThreadGroup;
   import org.apache.avalon.excalibur.xml.Parser;
   import org.apache.avalon.framework.component.ComponentManager;
  +import org.apache.avalon.framework.component.Component;
   import org.apache.avalon.framework.configuration.Configuration;
   import org.apache.avalon.framework.configuration.DefaultConfigurationBuilder;
   import org.apache.avalon.framework.context.Context;
  @@ -391,7 +392,7 @@
                   {
                       if( null != parser )
                       {
  -                        m_manager.release( parser );
  +                        m_manager.release( (Component) parser );
                       }
                   }
                   /*
  @@ -442,7 +443,7 @@
                   {
                       if( null != monitor )
                       {
  -                        m_manager.release( monitor );
  +                        m_manager.release( (Component) monitor );
                       }
                   }
               }
  
  
  

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

Reply via email to