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 gd...@apache.org on 2001/08/15 23:30:17 UTC

cvs commit: xml-axis/java/src/org/apache/axis/utils Admin.java

gdaniels    01/08/15 14:30:17

  Modified:    java/src/org/apache/axis AxisEngine.java
               java/src/org/apache/axis/client AxisClient.java
                        ServiceClient.java
               java/src/org/apache/axis/server AxisServer.java
               java/src/org/apache/axis/transport/http AdminServlet.java
                        AxisServlet.java SimpleAxisServer.java
               java/src/org/apache/axis/transport/local LocalSender.java
               java/src/org/apache/axis/utils Admin.java
  Added:       java/src/org/apache/axis ConfigurationProvider.java
               java/src/org/apache/axis/configuration FileProvider.java
                        XMLStringProvider.java
  Log:
  1st cut ConfigurationProvider API.
  
  The specifics of configuring the engine, dealing with persistent storage
  or XML parsing, etc., are now abstracted away behind the
  ConfigurationProvider interface, which provides for bidirectional
  configuration persistence.
  
  I've provided two concrete ConfigurationProviders:
  
  * FileProvider - works just like the old code did, reading/writing
    [client/server]-config.xml.  This is the default behavior for now.
  
  * XMLStringProvider - you can pass a string containing an
    engine configuration to this supplier, and it will configure
    things from that.  The writeEngineConfig() method on this
    provider is a no-op, as there's nowhere to persist to.
  
  Other providers can easily be written to access databases,
  to spawn threads and auto-restart the engine on changes,
  etc...
  
  TODO : Enable the user/developer to change the default
  behavior by setting a system property, in much the same
  way log4j works.
  
  Revision  Changes    Path
  1.29      +47 -108   xml-axis/java/src/org/apache/axis/AxisEngine.java
  
  Index: AxisEngine.java
  ===================================================================
  RCS file: /home/cvs/xml-axis/java/src/org/apache/axis/AxisEngine.java,v
  retrieving revision 1.28
  retrieving revision 1.29
  diff -u -r1.28 -r1.29
  --- AxisEngine.java	2001/08/08 18:48:59	1.28
  +++ AxisEngine.java	2001/08/15 21:30:16	1.29
  @@ -86,117 +86,69 @@
       public static final String PROP_DOMULTIREFS = "sendMultiRefs";
       public static final String PROP_PASSWORD = "adminPassword";
   
  -    protected String sep = System.getProperty("file.separator");
  -    
  -    protected String engineConfigFilename = "engine-config.xml";
  -    protected String engineBasePath;
  -    
  +    /** Our go-to guy for configuration... */
  +    protected ConfigurationProvider configProvider;
  +
       /** The handler registry this Engine uses. */
       protected HandlerRegistry _handlerRegistry = new SupplierRegistry();
  -    
  +
       /** The service registry this Engine uses. */
       protected HandlerRegistry _serviceRegistry = new SupplierRegistry();
  -    
  +
       /** A map of protocol names to "client" (sender) transports  */
       protected SupplierRegistry transportRegistry = new SupplierRegistry();
  -    
  +
       /** This Engine's global type mappings     */
       protected TypeMappingRegistry _typeMappingRegistry =
                                                    new TypeMappingRegistry();
  -    
  -    protected Properties props = new Properties();
  -    
  +
       /** Has the user changed the password yet? */
       protected boolean _hasSafePassword = false;
  -    
  +
       //protected SupplierRegistry listenerRegistry = new SupplierRegistry();
  -    
  +
       /**
        * This engine's Session.  This Session supports "application scope"
        * in the Apache SOAP sense... if you have a service with "application
        * scope", have it store things in this Session.
        */
       private Session session = new SimpleSession();
  -    
  +
       /**
        * No-arg constructor.
        *
        */
       public AxisEngine()
       {
  +        // !!! Set up default configuration?
           init();
  -        
  +
           Debug.Print( 1, "Exit: AxisEngine no-arg constructor");
       }
  -    
  -    public AxisEngine(String basePath, String fileName)
  +
  +    public AxisEngine(ConfigurationProvider configProvider)
       {
  -        if ((basePath == null) || (basePath.equals("")))
  -            basePath = ".";
  -        
  -        engineBasePath = basePath;
  -        engineConfigFilename = fileName;
  +        this.configProvider = configProvider;
           init();
       }
  -    
  +
       /**
        * (re)initialize - What should really go in here???
        */
       public void init() {
  -        /** Load properties 1st, so that debug level gets
  -        * set ASAP.
  -        */
  +        Debug.Print( 1, "Enter: AxisEngine::init" );
  +
  +        _typeMappingRegistry.setParent(SOAPTypeMappingRegistry.getSingleton());
  +
           try {
  -            File propFile = new File(engineBasePath + sep +
  -                                     "axis.properties");
  -            if (propFile.exists()) {
  -                FileInputStream propFileInputStream =
  -                                               new FileInputStream(propFile);
  -                props.load(propFileInputStream);
  -            }
  +            configProvider.configureEngine(this);
           } catch (Exception e) {
  -            e.printStackTrace();
  -        }
  -        
  -        String propVal;
  -        
  -        if (!Debug.isLevelSet()) {
  -            propVal = props.getProperty(PROP_DEBUG_LEVEL, "0");
  -            Debug.setDebugLevel(Integer.parseInt(propVal));
  -        }
  -        
  -        propVal = props.getProperty(PROP_DEBUG_FILE);
  -        Debug.setToFile(propVal != null);
  -        
  -        // Should we send XML declarations in our messages?
  -        // default is true, and currently the only accepted true value is
  -        // "true".
  -        propVal = props.getProperty(PROP_XML_DECL, "true");
  -        addOption(PROP_XML_DECL, new Boolean(propVal.equals("true")));
  -        
  -        // Should we send multi-ref serializations in our messages?
  -        propVal = props.getProperty(PROP_DOMULTIREFS, "true");
  -        addOption(PROP_DOMULTIREFS, new Boolean(propVal.equals("true")));
  -        
  -        // The admin password (if it hasn't been set, we're "unsafe", and
  -        // we shouldn't do anything in the admin but change it)
  -        propVal = props.getProperty(PROP_PASSWORD);
  -        if (propVal != null) {
  -            addOption(PROP_PASSWORD, propVal);
  -            _hasSafePassword = true;
  -        } else {
  -            addOption(PROP_PASSWORD, "admin");
  +            // !!! throw new EngineConfigException();
           }
  -        
  -        _typeMappingRegistry.setParent(SOAPTypeMappingRegistry.getSingleton());
  -        
  -        Debug.Print( 1, "Enter: AxisEngine::init" );
  -        
  -        readConfiguration();
  -        
  +
           Debug.Print( 1, "Exit: AxisEngine::init" );
       }
  -    
  +
       /**
        * Load up our engine's configuration of Handlers, Chains,
        * Services, etc.
  @@ -211,6 +163,7 @@
        * We need to complete discussions about the packaging and deployment
        * patterns for Axis before this code solidifies.
        */
  +    /*
       private void readConfiguration()
       {
           InputStream is;
  @@ -220,7 +173,7 @@
           } catch (Exception e) {
               is = getResourceStream(engineConfigFilename);
           }
  -        
  +
           if (is == null) {
               // TODO: Deal with this in a nicer way...
               System.err.println("No engine configuration in " +
  @@ -228,7 +181,7 @@
                                  " - aborting!");
               return;
           }
  -        
  +
           Document doc = XMLUtils.newDocument(is);
           try {
               // ??? Clear registries first?
  @@ -239,42 +192,28 @@
               return;
           }
       }
  +    */
   
       /** Write out our engine configuration.
        */
       public void saveConfiguration()
       {
           try {
  -            Document doc = Admin.listConfig(this);
  -            FileOutputStream fos = new FileOutputStream(
  -                                            engineBasePath + sep +
  -                                            engineConfigFilename);
  -            XMLUtils.DocumentToStream(doc, fos);
  -            fos.close();
  -            
  -            props.store(new FileOutputStream(engineBasePath + sep +
  -                                             "axis.properties"),
  -                        "Axis engine properties");
  +            configProvider.writeEngineConfig(this);
           } catch (Exception e) {
               System.err.println("Coudn't write engine config!");
               e.printStackTrace();
           }
  -    }
  -    
  -    private InputStream getResourceStream(String name)
  -    {
  -        return this.getClass().getResourceAsStream(name);
       }
  -    
  +
       public boolean hasSafePassword()
       {
           return _hasSafePassword;
       }
  -    
  +
       public void setAdminPassword(String pw)
       {
           addOption(PROP_PASSWORD, pw);
  -        props.put(PROP_PASSWORD, pw);
           _hasSafePassword = true;
           saveConfiguration();
       }
  @@ -283,37 +222,37 @@
       {
           return _handlerRegistry;
       }
  -    
  +
       public void setHandlerRegistry(HandlerRegistry registry)
       {
           _handlerRegistry = registry;
       }
  -    
  +
       public HandlerRegistry getServiceRegistry()
       {
           return _serviceRegistry;
       }
  -    
  +
       public void setServiceRegistry(HandlerRegistry registry)
       {
           _serviceRegistry = registry;
       }
  -    
  +
       public SupplierRegistry getTransportRegistry()
       {
           return transportRegistry;
       }
  -    
  +
       public void setTransportRegistry(SupplierRegistry registry)
       {
           transportRegistry = registry;
       }
  -    
  +
       public TypeMappingRegistry getTypeMappingRegistry()
       {
           return _typeMappingRegistry;
       }
  -    
  +
       /*********************************************************************
        * Client engine access
        *
  @@ -324,7 +263,7 @@
        * can access the AxisClient's deployed handlers and transports.
        *********************************************************************
        */
  -    
  +
       public abstract AxisEngine getClientEngine ();
   
       /*********************************************************************
  @@ -335,7 +274,7 @@
       *
       *********************************************************************
       */
  -    
  +
       /**
        * Register a new global type mapping
        */
  @@ -353,7 +292,7 @@
           if (serializer != null)
               _typeMappingRegistry.addSerializer(cls, qName, serializer);
       }
  -    
  +
       /**
        * Unregister a global type mapping
        */
  @@ -362,7 +301,7 @@
           _typeMappingRegistry.removeDeserializer(qName);
           _typeMappingRegistry.removeSerializer(cls);
       }
  -    
  +
       /**
        * Deploy a Handler into our handler registry
        */
  @@ -371,7 +310,7 @@
           handler.setName(key);
           getHandlerRegistry().add(key, handler);
       }
  -    
  +
       /**
        * Undeploy (remove) a Handler from the handler registry
        */
  @@ -388,10 +327,10 @@
           Debug.Print(2, "Deploying service '" + key + "' into " + this);
           service.setName(key);
           service.setEngine(this);
  -        
  +
           getServiceRegistry().add(key, service);
       }
  -    
  +
       /**
        * Undeploy (remove) a Service from the handler registry
        */
  @@ -408,7 +347,7 @@
           transport.setName(key);
           transportRegistry.add(key, transport);
       }
  -    
  +
       /**
        * Deploy a (client) Transport
        */
  @@ -416,7 +355,7 @@
       {
           transportRegistry.add(key, supplier);
       }
  -    
  +
       /**
        * Undeploy (remove) a client Transport
        */
  
  
  
  1.1                  xml-axis/java/src/org/apache/axis/ConfigurationProvider.java
  
  Index: ConfigurationProvider.java
  ===================================================================
  /*
   * The Apache Software License, Version 1.1
   *
   *
   * Copyright (c) 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 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 "Axis" 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 (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/>.
   */
  package org.apache.axis;
  
  /**
   * ConfigurationProvider is an interface which represents a source of
   * configuration information for an AxisEngine.  Concrete implementations
   * of this interface will obtain configuration information from some source
   * (examples might be files, Strings, or databases) and are responsible for
   * writing it into an AxisEngine, and writing an AxisEngine's state back out
   * to whatever storage medium is in use.
   *
   * @author Glen Daniels (gdaniels@macromedia.com)
   */
  public interface ConfigurationProvider
  {
      /**
       * Configure this AxisEngine using whatever data source we have.
       *
       * @param engine the AxisEngine we'll deploy state to
       * @throws Exeption if there was a problem
       */
      public void configureEngine(AxisEngine engine) throws Exception;
  
      /**
       * Read the configuration from an engine, and store it somehow.
       *
       * @param engine the AxisEngine from which to read state.
       * @throws Exception if there was a problem
       */
      public void writeEngineConfig(AxisEngine engine) throws Exception;
  }
  
  
  
  1.22      +3 -7      xml-axis/java/src/org/apache/axis/client/AxisClient.java
  
  Index: AxisClient.java
  ===================================================================
  RCS file: /home/cvs/xml-axis/java/src/org/apache/axis/client/AxisClient.java,v
  retrieving revision 1.21
  retrieving revision 1.22
  diff -u -r1.21 -r1.22
  --- AxisClient.java	2001/08/03 19:12:59	1.21
  +++ AxisClient.java	2001/08/15 21:30:17	1.22
  @@ -57,6 +57,7 @@
   
   import java.util.* ;
   import org.apache.axis.* ;
  +import org.apache.axis.configuration.*;
   import org.apache.axis.utils.Debug ;
   import org.apache.axis.handlers.* ;
   import org.apache.axis.registries.* ;
  @@ -74,14 +75,9 @@
    */
   public class AxisClient extends AxisEngine
   {
  -    public AxisClient()
  +    public AxisClient(ConfigurationProvider provider)
       {
  -        super(null, Constants.CLIENT_CONFIG_FILE);
  -    }
  -    
  -    public AxisClient(String basePath)
  -    {
  -        super(basePath, Constants.CLIENT_CONFIG_FILE);
  +        super(provider);
       }
       
       /**
  
  
  
  1.42      +13 -10    xml-axis/java/src/org/apache/axis/client/ServiceClient.java
  
  Index: ServiceClient.java
  ===================================================================
  RCS file: /home/cvs/xml-axis/java/src/org/apache/axis/client/ServiceClient.java,v
  retrieving revision 1.41
  retrieving revision 1.42
  diff -u -r1.41 -r1.42
  --- ServiceClient.java	2001/08/13 17:53:23	1.41
  +++ ServiceClient.java	2001/08/15 21:30:17	1.42
  @@ -57,18 +57,19 @@
   
   import java.util.* ;
   import java.net.*;
  -import org.apache.axis.encoding.ServiceDescription;
  -import org.apache.axis.message.*;
  -import org.apache.axis.handlers.* ;
  -import org.apache.axis.utils.* ;
   import org.apache.axis.* ;
  -import org.apache.axis.transport.http.HTTPConstants;
  -import org.apache.axis.transport.http.HTTPSender;
  +import org.apache.axis.configuration.FileProvider;
  +import org.apache.axis.encoding.DeserializerFactory;
   import org.apache.axis.encoding.Serializer;
  +import org.apache.axis.encoding.ServiceDescription;
   import org.apache.axis.encoding.TypeMappingRegistry;
  -import org.apache.axis.encoding.DeserializerFactory;
  +import org.apache.axis.handlers.* ;
  +import org.apache.axis.message.*;
   import org.apache.axis.registries.HandlerRegistry;
  +import org.apache.axis.transport.http.HTTPConstants;
  +import org.apache.axis.transport.http.HTTPSender;
   import org.apache.axis.transport.http.HTTPTransport;
  +import org.apache.axis.utils.* ;
   
   import org.w3c.dom.* ;
   
  @@ -175,12 +176,14 @@
       // Our Transport, if any
       private Transport transport;
       private String    transportName;
  +    
  +    private static FileProvider configProvider = new FileProvider("client-config.xml");
   
       /**
        * Basic, no-argument constructor.
        */
       public ServiceClient () {
  -        this(new AxisClient());
  +        this(new AxisClient(configProvider));
       }
       
       /**
  @@ -202,7 +205,7 @@
        */
       public ServiceClient(String endpointURL)
       {
  -        this(endpointURL, new AxisClient());
  +        this(endpointURL, new AxisClient(configProvider));
       }
       
       /**
  @@ -222,7 +225,7 @@
        *                  request
        */
       public ServiceClient (Transport transport) {
  -        this(transport, new AxisClient());
  +        this(transport, new AxisClient(configProvider));
       }
       
       /**
  
  
  
  1.1                  xml-axis/java/src/org/apache/axis/configuration/FileProvider.java
  
  Index: FileProvider.java
  ===================================================================
  /*
   * The Apache Software License, Version 1.1
   *
   *
   * Copyright (c) 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 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 "Axis" 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 (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/>.
   */
  
   package org.apache.axis.configuration;
  
  import java.io.*;
  import java.util.*;
  import org.apache.axis.ConfigurationProvider;
  import org.apache.axis.AxisEngine;
  import org.apache.axis.utils.Admin;
  import org.apache.axis.utils.Debug;
  import org.apache.axis.utils.XMLUtils;
  import org.w3c.dom.Document;
  
  /**
   * A simple ConfigurationProvider that uses the Admin class to read +
   * write XML files.
   *
   * @author Glen Daniels (gdaniels@macromedia.com)
   */
  public class FileProvider implements ConfigurationProvider
  {
      protected String sep = System.getProperty("file.separator");
  
      String basepath = ".";
      String filename;
      protected Properties props = new Properties();
  
      /**
       * Constructor which accesses a file in the current directory of the
       * engine.
       */
      public FileProvider(String filename)
      {
          this.filename = filename;
      }
  
      /**
       * Constructor which accesses a file relative to a specific base
       * path.
       */
      public FileProvider(String basepath, String filename)
      {
          this.basepath = basepath;
          this.filename = filename;
      }
  
      public void configureEngine(AxisEngine engine) throws Exception
      {
          InputStream is;
  
          try {
              is = new FileInputStream(basepath + sep + filename);
          } catch (Exception e) {
              is = engine.getClass().getResourceAsStream(filename);
          }
  
          if (is == null) {
              throw new Exception("No engine configuration file - aborting!");
          }
  
          Document doc = XMLUtils.newDocument(is);
  
          Admin.processEngineConfig(doc, engine);
  
          loadProperties(engine);
      }
  
      public void writeEngineConfig(AxisEngine engine) throws Exception
      {
          Document doc = Admin.listConfig(engine);
          FileOutputStream fos = new FileOutputStream(basepath + sep + filename);
          XMLUtils.DocumentToStream(doc, fos);
          fos.close();
      }
  
      protected void loadProperties(AxisEngine engine)
      {
          /** Load properties 1st, so that debug level gets
          * set ASAP.
          */
          try {
              File propFile = new File("axis.properties");
              if (propFile.exists()) {
                  FileInputStream propFileInputStream =
                                                 new FileInputStream(propFile);
                  props.load(propFileInputStream);
              }
          } catch (Exception e) {
              e.printStackTrace();
          }
  
          String propVal;
  
          if (!Debug.isLevelSet()) {
              propVal = props.getProperty(AxisEngine.PROP_DEBUG_LEVEL, "0");
              Debug.setDebugLevel(Integer.parseInt(propVal));
          }
  
          propVal = props.getProperty(AxisEngine.PROP_DEBUG_FILE);
          Debug.setToFile(propVal != null);
  
          // Should we send XML declarations in our messages?
          // default is true, and currently the only accepted true value is
          // "true".
          propVal = props.getProperty(AxisEngine.PROP_XML_DECL, "true");
          engine.addOption(AxisEngine.PROP_XML_DECL, new Boolean(propVal.equals("true")));
  
          // Should we send multi-ref serializations in our messages?
          propVal = props.getProperty(AxisEngine.PROP_DOMULTIREFS, "true");
          engine.addOption(AxisEngine.PROP_DOMULTIREFS, new Boolean(propVal.equals("true")));
  
          // The admin password (if it hasn't been set, we're "unsafe", and
          // we shouldn't do anything in the admin but change it)
          propVal = props.getProperty(AxisEngine.PROP_PASSWORD);
          if (propVal != null) {
              engine.setAdminPassword(propVal);
          } else {
              engine.addOption(AxisEngine.PROP_PASSWORD, "admin");
          }
      }
  }
  
  
  
  1.1                  xml-axis/java/src/org/apache/axis/configuration/XMLStringProvider.java
  
  Index: XMLStringProvider.java
  ===================================================================
  /*
   * The Apache Software License, Version 1.1
   *
   *
   * Copyright (c) 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 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 "Axis" 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 (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/>.
   */
  
   package org.apache.axis.configuration;
  
  import java.io.*;
  import java.util.*;
  import org.apache.axis.ConfigurationProvider;
  import org.apache.axis.AxisEngine;
  import org.apache.axis.utils.Admin;
  import org.apache.axis.utils.XMLUtils;
  import org.xml.sax.InputSource;
  import org.w3c.dom.Document;
  
  /**
   * A simple ConfigurationProvider that uses the Admin class to
   * configure the engine from a String containing XML.
   *
   * This provider does not write configuration to persistent storage.
   *
   * @author Glen Daniels (gdaniels@macromedia.com)
   */
  public class XMLStringProvider implements ConfigurationProvider
  {
      String xmlConfiguration;
  
      /**
       * Constructor
       *
       * @param xmlConfiguration a String containing an engine configuration
       *        in XML.
       */
      public XMLStringProvider(String xmlConfiguration)
      {
          this.xmlConfiguration = xmlConfiguration;
      }
  
      public void configureEngine(AxisEngine engine) throws Exception
      {
          InputSource is = new InputSource(new StringReader(xmlConfiguration));
  
          Document doc = XMLUtils.newDocument(is);
  
          Admin.processEngineConfig(doc, engine);
      }
  
      public void writeEngineConfig(AxisEngine engine) throws Exception
      {
          // NOOP
      }
  }
  
  
  
  1.34      +5 -24     xml-axis/java/src/org/apache/axis/server/AxisServer.java
  
  Index: AxisServer.java
  ===================================================================
  RCS file: /home/cvs/xml-axis/java/src/org/apache/axis/server/AxisServer.java,v
  retrieving revision 1.33
  retrieving revision 1.34
  diff -u -r1.33 -r1.34
  --- AxisServer.java	2001/08/07 20:05:19	1.33
  +++ AxisServer.java	2001/08/15 21:30:17	1.34
  @@ -57,6 +57,7 @@
   
   import java.util.* ;
   import org.apache.axis.* ;
  +import org.apache.axis.configuration.FileProvider ;
   import org.apache.axis.utils.* ;
   import org.apache.axis.handlers.* ;
   import org.apache.axis.handlers.http.*;
  @@ -85,34 +86,14 @@
       
       public AxisServer()
       {
  -        super(null, Constants.SERVER_CONFIG_FILE);
  +        this(new FileProvider(Constants.SERVER_CONFIG_FILE));
       }
       
  -    public AxisServer(String basePath)
  +    public AxisServer(ConfigurationProvider provider)
       {
  -        super(basePath, Constants.SERVER_CONFIG_FILE);
  +        super(provider);
       }
       
  -    /** Lifecycle routines for managing a static AxisServer
  -     */
  -    private static AxisServer singleton = null;
  -    private static String basePath = null;
  -    
  -    public static void setBasePath(String path)
  -    {
  -        basePath = path;
  -    }
  -    public static String getBasePath()
  -    { return basePath; };
  -    
  -    public static synchronized AxisServer getSingleton()
  -    {
  -        if (singleton == null) {
  -            singleton = new AxisServer(basePath);
  -        }
  -        return singleton;
  -    }
  -    
       /** Is this server active?  If this is false, any requests will
        * cause a SOAP Server fault to be generated.
        */
  @@ -142,7 +123,7 @@
        */
       public synchronized AxisEngine getClientEngine () {
           if (clientEngine == null) {
  -            clientEngine = new AxisClient(basePath);
  +            clientEngine = new AxisClient(new FileProvider("client-config.xml")); // !!!!
           }
           return clientEngine;
       }
  
  
  
  1.5       +7 -2      xml-axis/java/src/org/apache/axis/transport/http/AdminServlet.java
  
  Index: AdminServlet.java
  ===================================================================
  RCS file: /home/cvs/xml-axis/java/src/org/apache/axis/transport/http/AdminServlet.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- AdminServlet.java	2001/08/09 18:35:23	1.4
  +++ AdminServlet.java	2001/08/15 21:30:17	1.5
  @@ -59,6 +59,7 @@
   import javax.servlet.* ;
   import javax.servlet.http.* ;
   import org.apache.axis.* ;
  +import org.apache.axis.configuration.*;
   import org.apache.axis.server.* ;
   import org.apache.axis.utils.* ;
   
  @@ -77,8 +78,12 @@
       public void init() {
           // Set the base path for the AxisServer to our WEB-INF directory
           // (so the config files can't get snooped by a browser)
  -        AxisServer.setBasePath(getServletContext().getRealPath("WEB-INF"));
  -        server = AxisServer.getSingleton();
  +        FileProvider provider =
  +               new FileProvider(getServletContext().getRealPath("/WEB-INF"),
  +                                "server-config.xml");
  +        
  +        server = new AxisServer(provider);
  +        getServletContext().setAttribute("AxisEngine", server);
       }
   
       public void doGet(HttpServletRequest req, HttpServletResponse res)
  
  
  
  1.34      +11 -2     xml-axis/java/src/org/apache/axis/transport/http/AxisServlet.java
  
  Index: AxisServlet.java
  ===================================================================
  RCS file: /home/cvs/xml-axis/java/src/org/apache/axis/transport/http/AxisServlet.java,v
  retrieving revision 1.33
  retrieving revision 1.34
  diff -u -r1.33 -r1.34
  --- AxisServlet.java	2001/08/02 14:20:06	1.33
  +++ AxisServlet.java	2001/08/15 21:30:17	1.34
  @@ -70,6 +70,7 @@
   public class AxisServlet extends HttpServlet {
       // These have default values.
       private String transportName = "http";
  +    private AxisEngine engine = null;
   
       private static final String AXIS_ENGINE = "AxisEngine" ;
   
  @@ -80,7 +81,9 @@
           if (param == null)
               param = context.getInitParameter("transport.name");
           if (param != null)
  -            transportName = param;      
  +            transportName = param;
  +        
  +        engine = (AxisEngine)context.getAttribute(AXIS_ENGINE);
       }
   
       public void doGet(HttpServletRequest req, HttpServletResponse res)
  @@ -96,7 +99,13 @@
           ServletContext context = config.getServletContext();
           HttpSession    session = req.getSession();
   
  -        AxisEngine  engine = AxisServer.getSingleton();
  +        if (engine == null)
  +            engine = (AxisEngine)context.getAttribute(AXIS_ENGINE);
  +        
  +        if (engine == null) {
  +            // !!! should return a SOAP fault...
  +            throw new ServletException("Couldn't find AxisEngine!");
  +        }
           
           /* Place the Request message in the MessagContext object - notice */
           /* that we just leave it as a 'ServletRequest' object and let the  */
  
  
  
  1.22      +9 -2      xml-axis/java/src/org/apache/axis/transport/http/SimpleAxisServer.java
  
  Index: SimpleAxisServer.java
  ===================================================================
  RCS file: /home/cvs/xml-axis/java/src/org/apache/axis/transport/http/SimpleAxisServer.java,v
  retrieving revision 1.21
  retrieving revision 1.22
  diff -u -r1.21 -r1.22
  --- SimpleAxisServer.java	2001/07/31 16:28:57	1.21
  +++ SimpleAxisServer.java	2001/08/15 21:30:17	1.22
  @@ -60,6 +60,7 @@
   import java.util.*;
   
   import org.apache.axis.* ;
  +import org.apache.axis.configuration.*;
   import org.apache.axis.server.* ;
   import org.apache.axis.utils.* ;
   
  @@ -97,11 +98,17 @@
       // (thread safety not considered crucial here)
       public static int sessionIndex = 0;
   
  +    // Configuration provider
  +    private static FileProvider provider = new FileProvider("server-config.xml");
  +    
  +    // Another example of configuration (AdminService only) might look like this...
  +    //private static XMLStringProvider provider = new XMLStringProvider("<engineConfig><handlers><handler name=\"MsgDispatcher\" class=\"org.apache.axis.providers.java.MsgProvider\"/></handlers><services><service name=\"AdminService\" pivot=\"MsgDispatcher\"><option name=\"className\" value=\"org.apache.axis.utils.Admin\"/><option name=\"methodName\" value=\"AdminService\"/><option name=\"enableRemoteAdmin\" value=\"false\"/></service></services></engineConfig>");
  +    
       // Axis server (shared between instances)
       private static AxisServer myAxisServer = null;
       private static synchronized AxisServer getAxisServer() {
           if (myAxisServer == null) {
  -            myAxisServer = new AxisServer();
  +            myAxisServer = new AxisServer(provider);
           }
           return myAxisServer;
       }
  @@ -141,7 +148,7 @@
       public void run() {
   
           // create an Axis server
  -        AxisServer engine = new AxisServer();
  +        AxisServer engine = getAxisServer();
           engine.init();
           
           // create and initialize a message context
  
  
  
  1.8       +2 -1      xml-axis/java/src/org/apache/axis/transport/local/LocalSender.java
  
  Index: LocalSender.java
  ===================================================================
  RCS file: /home/cvs/xml-axis/java/src/org/apache/axis/transport/local/LocalSender.java,v
  retrieving revision 1.7
  retrieving revision 1.8
  diff -u -r1.7 -r1.8
  --- LocalSender.java	2001/07/12 15:04:46	1.7
  +++ LocalSender.java	2001/08/15 21:30:17	1.8
  @@ -56,6 +56,7 @@
   package org.apache.axis.transport.local;
   
   import org.apache.axis.*;
  +import org.apache.axis.configuration.FileProvider;
   import org.apache.axis.handlers.*;
   import org.apache.axis.server.*;
   import org.apache.axis.transport.http.*;
  @@ -78,7 +79,7 @@
        * Allocate an embedded Axis server to process requests and initialize it.
        */
       public synchronized void init() {
  -        AxisServer server = new AxisServer();
  +        AxisServer server = new AxisServer(new FileProvider("server-config.xml"));
           server.init();
           this.server=server;
       }
  
  
  
  1.58      +3 -2      xml-axis/java/src/org/apache/axis/utils/Admin.java
  
  Index: Admin.java
  ===================================================================
  RCS file: /home/cvs/xml-axis/java/src/org/apache/axis/utils/Admin.java,v
  retrieving revision 1.57
  retrieving revision 1.58
  diff -u -r1.57 -r1.58
  --- Admin.java	2001/07/31 12:11:35	1.57
  +++ Admin.java	2001/08/15 21:30:17	1.58
  @@ -59,6 +59,7 @@
   import java.net.*;
   import java.util.* ;
   import org.apache.axis.* ;
  +import org.apache.axis.configuration.*;
   import org.apache.axis.registries.* ;
   import org.apache.axis.handlers.* ;
   import org.apache.axis.handlers.soap.SOAPService;
  @@ -853,9 +854,9 @@
   
           AxisEngine engine;
           if ( args[0].equals("client") )
  -            engine = new AxisClient();
  +            engine = new AxisClient(new FileProvider("client-config.xml"));
           else
  -            engine = new AxisServer();
  +            engine = new AxisServer(new FileProvider("server-config.xml"));
           engine.init();
           MessageContext msgContext = new MessageContext(engine);