avalon-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dona...@apache.org
Subject cvs commit: avalon-phoenix/src/test/org/apache/avalon/phoenix/components/application/test MockApplicationContext.java
Date Fri, 11 Apr 2003 01:06:58 GMT
donaldp     2003/04/10 18:06:58

  Modified:    src/java/org/apache/avalon/phoenix/components/application
                        DefaultApplication.java
               src/java/org/apache/avalon/phoenix/components/kernel
                        DefaultApplicationContext.java
               src/java/org/apache/avalon/phoenix/interfaces
                        ApplicationContext.java
               src/test/org/apache/avalon/phoenix/components/application/test
                        MockApplicationContext.java
  Added:       src/java/org/apache/avalon/phoenix/components/creator
                        PhoenixConfig.java
  Removed:     lib/container excalibur-threadcontext-1.0.jar
  Log:
  Decouple from threadcontext
  
  Revision  Changes    Path
  1.49      +6 -5      avalon-phoenix/src/java/org/apache/avalon/phoenix/components/application/DefaultApplication.java
  
  Index: DefaultApplication.java
  ===================================================================
  RCS file: /home/cvs/avalon-phoenix/src/java/org/apache/avalon/phoenix/components/application/DefaultApplication.java,v
  retrieving revision 1.48
  retrieving revision 1.49
  diff -u -r1.48 -r1.49
  --- DefaultApplication.java	11 Apr 2003 01:02:55 -0000	1.48
  +++ DefaultApplication.java	11 Apr 2003 01:06:57 -0000	1.49
  @@ -73,7 +73,6 @@
   import org.apache.avalon.phoenix.interfaces.ApplicationMBean;
   import org.apache.avalon.phoenix.interfaces.ContainerConstants;
   import org.apache.avalon.phoenix.metadata.SarMetaData;
  -import org.apache.excalibur.threadcontext.ThreadContext;
   
   /**
    * This is the basic container of blocks. A server application
  @@ -342,6 +341,7 @@
           throws Exception
       {
           //Setup thread context for calling visitors
  +        final ClassLoader loader = Thread.currentThread().getContextClassLoader();
           Thread.currentThread().setContextClassLoader( m_context.getClassLoader() );
   
           try
  @@ -350,13 +350,13 @@
           }
           finally
           {
  -            ThreadContext.setThreadContext( null );
  +            Thread.currentThread().setContextClassLoader( loader );
           }
       }
   
       /**
        * Actually perform loading of each individual Listener.
  -     * Note that by this stage it is assumed that the ThreadContext
  +     * Note that by this stage it is assumed that the Thread Context
        * has already been setup correctly.
        */
       private void doLoadBlockListeners()
  @@ -401,6 +401,7 @@
           throws Exception
       {
           //Setup thread context for calling visitors
  +        final ClassLoader loader = Thread.currentThread().getContextClassLoader();
           Thread.currentThread().setContextClassLoader( m_context.getClassLoader() );
   
           try
  @@ -409,13 +410,13 @@
           }
           finally
           {
  -            ThreadContext.setThreadContext( null );
  +            Thread.currentThread().setContextClassLoader( loader );
           }
       }
   
       /**
        * Actually run applications phas.
  -     * By this methods calling it is assumed that ThreadContext
  +     * By this methods calling it is assumed that Thread Context
        * has already been setup.
        *
        * @param name the name of phase (for logging purposes)
  
  
  
  1.1                  avalon-phoenix/src/java/org/apache/avalon/phoenix/components/creator/PhoenixConfig.java
  
  Index: PhoenixConfig.java
  ===================================================================
  /*
  
   ============================================================================
                     The Apache Software License, Version 1.1
   ============================================================================
  
   Copyright (C) 1997-2003 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 "Avalon", "Phoenix" 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.phoenix.components.creator;
  
  import java.util.Map;
  import java.util.HashMap;
  
  /**
   *
   * @author <a href="mailto:peter at realityforge.org">Peter Donald</a>
   * @version $Revision: 1.1 $ $Date: 2003/04/11 01:06:57 $
   */
  public class PhoenixConfig
  {
      public static final String HOME_DIR = "phoenix:home.dir";
      public static final String WORK_DIR = "phoenix:work.dir";
      public static final String LOGGER = "phoenix:logger";
      public static final String CLASSLOADERS = "phoenix:classloaders";
      public static final String DEFAULT_CLASSLOADER_NAME = "phoenix:default.classloader";
  
      private final Map m_data = new HashMap();
  
      public Map toMap()
      {
          validate();
          return m_data;
      }
          
      private void validate()
      {
      }
  }
  
  
  
  1.42      +0 -16     avalon-phoenix/src/java/org/apache/avalon/phoenix/components/kernel/DefaultApplicationContext.java
  
  Index: DefaultApplicationContext.java
  ===================================================================
  RCS file: /home/cvs/avalon-phoenix/src/java/org/apache/avalon/phoenix/components/kernel/DefaultApplicationContext.java,v
  retrieving revision 1.41
  retrieving revision 1.42
  diff -u -r1.41 -r1.42
  --- DefaultApplicationContext.java	6 Apr 2003 11:23:22 -0000	1.41
  +++ DefaultApplicationContext.java	11 Apr 2003 01:06:58 -0000	1.42
  @@ -54,7 +54,6 @@
   import java.io.FileInputStream;
   import java.io.FileNotFoundException;
   import java.io.InputStream;
  -import java.util.HashMap;
   import java.util.Map;
   import org.apache.avalon.excalibur.i18n.ResourceManager;
   import org.apache.avalon.excalibur.i18n.Resources;
  @@ -72,8 +71,6 @@
   import org.apache.avalon.phoenix.interfaces.ManagerException;
   import org.apache.avalon.phoenix.interfaces.SystemManager;
   import org.apache.excalibur.instrument.InstrumentManager;
  -import org.apache.excalibur.threadcontext.ThreadContext;
  -import org.apache.excalibur.threadcontext.impl.DefaultThreadContextPolicy;
   
   /**
    * Manage the "frame" in which Applications operate.
  @@ -94,9 +91,6 @@
       ///ClassLoader for application
       private final ClassLoader m_classLoader;
   
  -    ///ThreadContext for application
  -    private final ThreadContext m_threadContext;
  -
       //InstrumentManager to register instruments with
       private InstrumentManager m_instrumentManager;
   
  @@ -152,11 +146,6 @@
           m_workDirectory = workDirectory;
           m_homeDirectory = homeDirectory;
           m_loaders = loaders;
  -
  -        final DefaultThreadContextPolicy policy = new DefaultThreadContextPolicy();
  -        final HashMap map = new HashMap( 1 );
  -        map.put( DefaultThreadContextPolicy.CLASSLOADER, m_classLoader );
  -        m_threadContext = new ThreadContext( policy, map );
       }
   
       public void service( final ServiceManager serviceManager )
  @@ -201,11 +190,6 @@
       public PartitionProfile getPartitionProfile()
       {
           return m_profile;
  -    }
  -
  -    public ThreadContext getThreadContext()
  -    {
  -        return m_threadContext;
       }
   
       public void requestShutdown()
  
  
  
  1.28      +0 -3      avalon-phoenix/src/java/org/apache/avalon/phoenix/interfaces/ApplicationContext.java
  
  Index: ApplicationContext.java
  ===================================================================
  RCS file: /home/cvs/avalon-phoenix/src/java/org/apache/avalon/phoenix/interfaces/ApplicationContext.java,v
  retrieving revision 1.27
  retrieving revision 1.28
  diff -u -r1.27 -r1.28
  --- ApplicationContext.java	6 Apr 2003 11:23:22 -0000	1.27
  +++ ApplicationContext.java	11 Apr 2003 01:06:58 -0000	1.28
  @@ -55,7 +55,6 @@
   import org.apache.avalon.framework.logger.Logger;
   import org.apache.avalon.phoenix.containerkit.profile.PartitionProfile;
   import org.apache.excalibur.instrument.InstrumentManager;
  -import org.apache.excalibur.threadcontext.ThreadContext;
   
   /**
    * Manage the "context" in which Applications operate.
  @@ -69,8 +68,6 @@
       File getHomeDirectory();
   
       PartitionProfile getPartitionProfile();
  -
  -    ThreadContext getThreadContext();
   
       /**
        * A application can request that it be be shutdown. In most cases
  
  
  
  1.12      +1 -10     avalon-phoenix/src/test/org/apache/avalon/phoenix/components/application/test/MockApplicationContext.java
  
  Index: MockApplicationContext.java
  ===================================================================
  RCS file: /home/cvs/avalon-phoenix/src/test/org/apache/avalon/phoenix/components/application/test/MockApplicationContext.java,v
  retrieving revision 1.11
  retrieving revision 1.12
  diff -u -r1.11 -r1.12
  --- MockApplicationContext.java	6 Apr 2003 11:23:22 -0000	1.11
  +++ MockApplicationContext.java	11 Apr 2003 01:06:58 -0000	1.12
  @@ -52,14 +52,11 @@
   
   import java.io.File;
   import java.io.InputStream;
  -import java.util.HashMap;
   import org.apache.avalon.framework.logger.Logger;
   import org.apache.avalon.phoenix.containerkit.profile.PartitionProfile;
   import org.apache.avalon.phoenix.interfaces.ApplicationContext;
   import org.apache.excalibur.instrument.InstrumentManager;
   import org.apache.excalibur.instrument.manager.NoopInstrumentManager;
  -import org.apache.excalibur.threadcontext.ThreadContext;
  -import org.apache.excalibur.threadcontext.impl.DefaultThreadContextPolicy;
   
   /**
    *
  @@ -69,7 +66,6 @@
   class MockApplicationContext
       implements ApplicationContext
   {
  -    private final ThreadContext m_threadContext = new ThreadContext( new DefaultThreadContextPolicy(),
new HashMap() );
       private final PartitionProfile m_sarMetaData;
       private final Logger m_logger;
   
  @@ -83,11 +79,6 @@
       public PartitionProfile getPartitionProfile()
       {
           return m_sarMetaData;
  -    }
  -
  -    public ThreadContext getThreadContext()
  -    {
  -        return m_threadContext;
       }
   
       public void requestShutdown()
  
  
  

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


Mime
View raw message