You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-dev@axis.apache.org by rs...@apache.org on 2002/08/09 21:14:36 UTC

cvs commit: xml-axis/java/xmls targets.xml properties.xml

rsitze      2002/08/09 12:14:36

  Modified:    java/lib commons-logging.jar
               java     build.xml
               java/src/org/apache/axis/components/logger LogFactory.java
               java/src/org/apache/axis AxisProperties.java
               java/xmls targets.xml properties.xml
  Added:       java/lib commons-discovery.jar commons-discovery.LICENSE
  Log:
  Support for managed environs, via groupContext property.
  
  Revision  Changes    Path
  1.7       +81 -91    xml-axis/java/lib/commons-logging.jar
  
  	<<Binary file>>
  
  
  1.1                  xml-axis/java/lib/commons-discovery.jar
  
  	<<Binary file>>
  
  
  1.1                  xml-axis/java/lib/commons-discovery.LICENSE
  
  Index: commons-discovery.LICENSE
  ===================================================================
  /*
   * $Header: /home/cvs/jakarta-commons/LICENSE,v 1.4 2002/04/11 13:24:02 dion Exp $
   * $Revision: 1.4 $
   * $Date: 2002/04/11 13:24:02 $
   *
   * ====================================================================
   *
   * The Apache Software License, Version 1.1
   *
   * Copyright (c) 1999-2001 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 acknowlegement:
   *       "This product includes software developed by the
   *        Apache Software Foundation (http://www.apache.org/)."
   *    Alternately, this acknowlegement may appear in the software itself,
   *    if and wherever such third-party acknowlegements normally appear.
   *
   * 4. The names "The Jakarta Project", "Commons", 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 names without prior written
   *    permission of the Apache Group.
   *
   * 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/>.
   *
   */
  
  
  1.168     +1 -0      xml-axis/java/build.xml
  
  Index: build.xml
  ===================================================================
  RCS file: /home/cvs/xml-axis/java/build.xml,v
  retrieving revision 1.167
  retrieving revision 1.168
  diff -u -r1.167 -r1.168
  --- build.xml	7 Aug 2002 19:43:41 -0000	1.167
  +++ build.xml	9 Aug 2002 19:14:36 -0000	1.168
  @@ -140,6 +140,7 @@
       </jar>
       <copy file="${wsdl4j.jar}" toDir="${build.lib}"/>
       <copy file="${commons-logging.jar}" toDir="${build.lib}"/>
  +    <copy file="${commons-discovery.jar}" toDir="${build.lib}"/>
       <copy file="${log4j-core.jar}" toDir="${build.lib}"/>
       <copy file="${tt-bytecode.jar}" toDir="${build.lib}"/>
   
  
  
  
  1.2       +10 -1     xml-axis/java/src/org/apache/axis/components/logger/LogFactory.java
  
  Index: LogFactory.java
  ===================================================================
  RCS file: /home/cvs/xml-axis/java/src/org/apache/axis/components/logger/LogFactory.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- LogFactory.java	3 Jul 2002 17:50:21 -0000	1.1
  +++ LogFactory.java	9 Aug 2002 19:14:36 -0000	1.2
  @@ -55,6 +55,8 @@
   
   package org.apache.axis.components.logger;
   
  +import org.apache.axis.AxisProperties;
  +import org.apache.commons.discovery.DiscoverSingleton;
   import org.apache.commons.logging.Log;
   
   
  @@ -62,8 +64,15 @@
    * @author Richard A. Sitze
    */
   public class LogFactory {
  +    /**
  +     * Override group context..
  +     */
       private static final org.apache.commons.logging.LogFactory logFactory =
  -        org.apache.commons.logging.LogFactory.getFactory();
  +        (org.apache.commons.logging.LogFactory)
  +            DiscoverSingleton.find(AxisProperties.getCommonsGroupContext(),
  +                                   org.apache.commons.logging.LogFactory.class,
  +                                   org.apache.commons.logging.LogFactory.FACTORY_PROPERTIES,
  +                                   org.apache.commons.logging.LogFactory.FACTORY_DEFAULT);
   
       public static Log getLog(String name) {
           return logFactory.getLog(name);
  
  
  
  1.6       +20 -135   xml-axis/java/src/org/apache/axis/AxisProperties.java
  
  Index: AxisProperties.java
  ===================================================================
  RCS file: /home/cvs/xml-axis/java/src/org/apache/axis/AxisProperties.java,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- AxisProperties.java	5 Aug 2002 21:00:07 -0000	1.5
  +++ AxisProperties.java	9 Aug 2002 19:14:36 -0000	1.6
  @@ -60,6 +60,7 @@
   import java.util.HashMap;
   import java.util.Hashtable;
   import java.util.Properties;
  +import org.apache.commons.discovery.ManagedProperties;
   
   
   /**
  @@ -101,16 +102,18 @@
        * The prefered line separator
        */
       public static final String LS = System.getProperty("line.separator",
  -                                                        (new Character(NL)).toString());
  -
  -    /**
  -     * Cache of AXIS Properties, keyed by (thread-context) class loaders.
  -     * Use <code>HashMap</code> because it allows 'null' keys, which
  -     * allows us to account for the (null) bootstrap classloader.
  -     */
  -    private static final HashMap axisPropertiesCache = new HashMap();
  -
  +                                                       (new Character(NL)).toString());
   
  +    private static String commonsGroupContext = null;
  +    
  +    public static void setCommonsGroupContext(String groupContext) {
  +        commonsGroupContext  = groupContext;
  +    }
  +    
  +    public static String getCommonsGroupContext() {
  +        return commonsGroupContext ;
  +    }
  +        
       /**
        * Get value for property bound to the current thread context class loader.
        *
  @@ -118,14 +121,7 @@
        * @return property value if found, otherwise default.
        */
       public static String getProperty(String propertyName) {
  -        String value = System.getProperty(propertyName);
  -        if (value == null) {
  -            Value val = getValueProperty(getThreadContextClassLoader(), propertyName);
  -            if (val != null) {
  -                value = val.value;
  -            }
  -        }
  -        return value;
  +        return ManagedProperties.getProperty(propertyName);
       }
   
       /**
  @@ -137,8 +133,7 @@
        * @return property value if found, otherwise default.
        */
       public static String getProperty(String propertyName, String dephault) {
  -        String value = getProperty(propertyName);
  -        return (value == null) ? dephault : value;
  +        return ManagedProperties.getProperty(propertyName, dephault);
       }
   
       /**
  @@ -147,7 +142,7 @@
        * @param value property value (non-default)  If null, remove the property.
        */
       public static void setProperty(String propertyName, String value) {
  -        setProperty(propertyName, value, false);
  +        ManagedProperties.setProperty(propertyName, value);
       }
   
       /**
  @@ -161,23 +156,7 @@
        *        a decendent class loader.
        */
       public static void setProperty(String propertyName, String value, boolean isDefault) {
  -        if (propertyName != null) {
  -            synchronized (axisPropertiesCache) {
  -                ClassLoader classLoader = getThreadContextClassLoader();
  -                HashMap properties = (HashMap)axisPropertiesCache.get(classLoader);
  -
  -                if (value == null) {
  -                    properties.remove(propertyName);
  -                } else {
  -                    if (properties == null) {
  -                        properties = new HashMap();
  -                        axisPropertiesCache.put(classLoader, properties);
  -                    }
  -
  -                    properties.put(propertyName, new Value(value, isDefault));
  -                }
  -            }
  -        }
  +        ManagedProperties.setProperty(propertyName, value, isDefault);
       }
   
       /**
  @@ -187,7 +166,7 @@
        * @param newProperties name/value pairs to be bound
        */
       public static void setProperties(Map newProperties) {
  -        setProperties(newProperties, false);
  +        ManagedProperties.setProperties(newProperties);
       }
   
   
  @@ -203,46 +182,12 @@
        *        a decendent class loader.
        */
       public static void setProperties(Map newProperties, boolean isDefault) {
  -        java.util.Iterator it = newProperties.entrySet().iterator();
  -
  -        /**
  -         * Each entry must be mapped to a Property.
  -         * 'setProperty' does this for us.
  -         */
  -        while (it.hasNext()) {
  -            Map.Entry entry = (Map.Entry)it.next();
  -            setProperty( String.valueOf(entry.getKey()),
  -                         String.valueOf(entry.getValue()),
  -                         isDefault);
  -        }
  +        ManagedProperties.setProperties(newProperties, isDefault);
       }
   
       
       public static Enumeration propertyNames() {
  -        Hashtable allProps = new Hashtable();
  -
  -        ClassLoader classLoader = getThreadContextClassLoader();
  -
  -        /**
  -         * Order doesn't matter, we are only going to use
  -         * the set of all keys...
  -         */
  -        while (true) {
  -            HashMap properties = null;
  -
  -            synchronized (axisPropertiesCache) {
  -                properties = (HashMap)axisPropertiesCache.get(classLoader);
  -            }
  -
  -            if (properties != null) {
  -                allProps.putAll(properties);
  -            }
  -
  -            if (classLoader == null) break;
  -            classLoader = classLoader.getParent();
  -        }
  -        
  -        return allProps.keys();
  +        return ManagedProperties.propertyNames();
       }
       
       /**
  @@ -255,66 +200,6 @@
        * returned value will not effect the scoped properties.
        */
       public static Properties getProperties() {
  -        Properties p = new Properties();
  -        
  -        Enumeration names = propertyNames();
  -        while (names.hasMoreElements()) {
  -            String name = (String)names.nextElement();
  -            p.put(name, getProperty(name));
  -        }
  -        
  -        return p;
  -    }
  -
  -    /***************** INTERNAL IMPLEMENTATION *****************/
  -
  -    private static class Value {
  -        final String value;
  -        final boolean isDefault;
  -
  -        Value(String value, boolean isDefault) {
  -            this.value = value;
  -            this.isDefault = isDefault;
  -        }
  -    }
  -
  -    /**
  -     * Get value for properties bound to the class loader.
  -     * Explore up the tree first, as higher-level class
  -     * loaders take precedence over lower-level class loaders.
  -     */
  -    private static Value getValueProperty(ClassLoader classLoader, String propertyName) {
  -        Value value = null;
  -
  -        if (propertyName != null) {
  -            /**
  -             * If classLoader isn't bootstrap loader (==null),
  -             * then get up-tree value.
  -             */
  -            if (classLoader != null) {
  -                value = getValueProperty(classLoader.getParent(), propertyName);
  -            }
  -
  -            if (value == null  ||  value.isDefault) {
  -                synchronized (axisPropertiesCache) {
  -                    HashMap properties = (HashMap)axisPropertiesCache.get(classLoader);
  -
  -                    if (properties != null) {
  -                        Value altValue = (Value)properties.get(propertyName);
  -
  -                        // set value only if override exists..
  -                        // otherwise pass default (or null) on..
  -                        if (altValue != null)
  -                            value = altValue;
  -                    }
  -                }
  -            }
  -        }
  -
  -        return value;
  -    }
  -
  -    private static final ClassLoader getThreadContextClassLoader() {
  -        return Thread.currentThread().getContextClassLoader();
  +        return ManagedProperties.getProperties();
       }
   }
  
  
  
  1.9       +5 -0      xml-axis/java/xmls/targets.xml
  
  Index: targets.xml
  ===================================================================
  RCS file: /home/cvs/xml-axis/java/xmls/targets.xml,v
  retrieving revision 1.8
  retrieving revision 1.9
  diff -u -r1.8 -r1.9
  --- targets.xml	9 Aug 2002 14:51:57 -0000	1.8
  +++ targets.xml	9 Aug 2002 19:14:36 -0000	1.9
  @@ -51,6 +51,10 @@
         classname="org.apache.commons.logging.Log"
         classpathref="classpath"/>
   
  +    <available property="commons-discovery.present"
  +      classname="org.apache.commons.discovery.DiscoverSingleton"
  +      classpathref="classpath"/>
  +
       <available property="commons-httpclient.present"
         classname="org.apache.commons.httpclient.HttpConnection"
         classpathref="classpath"/>
  @@ -128,6 +132,7 @@
       <echo message="=== Required Libraries ===" />
       <echo message="wsdl4j.present=${wsdl4j.present}" />
       <echo message="commons-logging.present=${commons-logging.present}" />
  +    <echo message="commons-discovery.present=${commons-discovery.present}" />
       <echo message="log4j.present=${log4j.present}" />
       <echo message="tt-bytecode.present=${tt-bytecode.present}" />
       <echo message="activation.present=${activation.present}" />
  
  
  
  1.17      +1 -0      xml-axis/java/xmls/properties.xml
  
  Index: properties.xml
  ===================================================================
  RCS file: /home/cvs/xml-axis/java/xmls/properties.xml,v
  retrieving revision 1.16
  retrieving revision 1.17
  diff -u -r1.16 -r1.17
  --- properties.xml	8 Aug 2002 20:24:49 -0000	1.16
  +++ properties.xml	9 Aug 2002 19:14:36 -0000	1.17
  @@ -39,6 +39,7 @@
   <property name="wsdl4j.jar" location="${lib.dir}/wsdl4j.jar"/>
   <property name="jsse.jar" location="${lib.dir}/jsse.jar"/>
   <property name="commons-logging.jar" location="${lib.dir}/commons-logging.jar"/>
  +<property name="commons-discovery.jar" location="${lib.dir}/commons-discovery.jar"/>
   <property name="log4j-core.jar" location="${lib.dir}/log4j-1.2.4.jar"/>
   <property name="tt-bytecode.jar" location="${lib.dir}/tt-bytecode.jar"/>
   <property name="junit.jar" location="${lib.dir}/junit.jar"/>