axis-java-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From gdani...@apache.org
Subject cvs commit: xml-axis/java/src/org/apache/axis/utils Admin.java
Date Fri, 29 Jun 2001 04:51:39 GMT
gdaniels    01/06/28 21:51:38

  Modified:    java/src/org/apache/axis AxisEngine.java SimpleChain.java
               java/src/org/apache/axis/client AdminClient.java
                        AxisClient.java
               java/src/org/apache/axis/server AxisServer.java
               java/src/org/apache/axis/utils Admin.java
  Added:       java/src/org/apache/axis/client engine-config.xml
               java/src/org/apache/axis/server engine-config.xml
  Log:
  Deployment changes.  Remove all default configuration from the
  code, and check in two default "engine-config.xml" files which get
  included in the axis.jar.
  
  When the engine starts up, it now checks for an appropriate config
  file.  First it looks in the working directory, and if it doesn't find a
  file there, it looks for one on the classpath.  For the server, this is:
  
    org/apache/axis/server/engine-config.xml
  
  I combined the whole server configuration (right now Handlers, Services,
  and Transports) into this single file, which is in the same format returned
  by the AdminClient's "list" command.
  
  I removed the engine's ability to save its registries to persistent storage
  itself.  So to save an active configuration, you should do something like:
  
    java org.apache.client.AdminClient list > engine-config.xml
  
  (I changed the printing of "Doing a list" to go to stderr so this works)
  
  This is open for debate, and certainly not the final form of this stuff.
  We need to have some conversations about how this is really going
  to work.  For now this is a solution which removes a lot of complexity
  from the client/server classes, and pulls all the initial configuration
  metadata out of the code.
  
  I think this is a good step, and it gets us that much closer to a place
  where we could plug in WSDD.
  
  Revision  Changes    Path
  1.19      +69 -264   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.18
  retrieving revision 1.19
  diff -u -r1.18 -r1.19
  --- AxisEngine.java	2001/06/27 16:18:15	1.18
  +++ AxisEngine.java	2001/06/29 04:51:31	1.19
  @@ -79,18 +79,16 @@
    */
   public abstract class AxisEngine extends BasicHandler
   {
  +    protected String engineConfigFilename = "engine-config.xml";
  +    
       /** The handler registry this Engine uses. */
  -    protected HandlerRegistry _handlerRegistry;
  -    protected String _handlerRegFilename;
  +    protected HandlerRegistry _handlerRegistry = new SupplierRegistry();
       
       /** The service registry this Engine uses. */
  -    protected HandlerRegistry _serviceRegistry;
  -    protected String _serviceRegFilename;
  -    
  -    protected String _transportRegFilename;
  +    protected HandlerRegistry _serviceRegistry = new SupplierRegistry();
       
  -    private boolean readRegistryFiles = true;
  -    private boolean dontSaveYet = false;
  +    /** A map of protocol names to "client" (sender) transports  */
  +    protected SupplierRegistry transportRegistry = new SupplierRegistry();
       
       /** This Engine's global type mappings     */
       protected TypeMappingRegistry _typeMappingRegistry =
  @@ -98,10 +96,6 @@
       
       protected Properties props = new Properties();
       
  -    /** A map of protocol names to "client" (sender) transports
  -     */
  -    protected SupplierRegistry transportRegistry = new SupplierRegistry();
  -                                                        
       //protected SupplierRegistry listenerRegistry = new SupplierRegistry();
       
       /**
  @@ -112,234 +106,106 @@
       private Session session = new SimpleSession();
       
       /**
  -     * No-arg constructor.  Loads properties from the "axis.properties"
  -     * file if it exists.
  +     * No-arg constructor.
        *
        */
       public AxisEngine()
       {
  -        Debug.Print( 1, "Enter: AxisEngine no-arg constructor");
  -        try {
  -            File propFile = new File("axis.properties");
  -            if (propFile.exists()) {
  -                FileInputStream propFileInputStream =
  -                         new FileInputStream(propFile);
  -                props.load(propFileInputStream);
  -            }
  -        } catch (Exception e) {
  -            e.printStackTrace();
  -        }
  +        init();
           
           Debug.Print( 1, "Exit: AxisEngine no-arg constructor");
       }
       
  -    /**
  -     * Allows the Listener to specify which handler/service registry
  -     * implementation they want to use.
  -     *
  -     * @param handlers the Handler registry.
  -     * @param services the Service registry.
  -     */
  -    public AxisEngine(HandlerRegistry handlers, HandlerRegistry services)
  +    public AxisEngine(String fileName)
       {
  -        this();
  -        setHandlerRegistry(handlers);
  -        setServiceRegistry(services);
  -        
  -        readRegistryFiles = false;
  -        
  +        engineConfigFilename = fileName;
           init();
       }
  -
  -    /**
  -     * Constructor specifying registry filenames.
  -     *
  -     * @param handlerRegFilename the name of the Handler registry file.
  -     * @param serviceRegFilename the name of the Service registry file.
  -     */
  -    public AxisEngine(String handlerRegFilename,
  -                      String serviceRegFilename,
  -                      String transportRegFilename)
  -    {
  -        this();
  -        setHandlerRegistry(new SupplierRegistry());
  -        setServiceRegistry(new SupplierRegistry());
  -        
  -        _handlerRegFilename = handlerRegFilename;
  -        _serviceRegFilename = serviceRegFilename;
  -        _transportRegFilename = transportRegFilename;
  -        
  -        init();
  -    }
  -
  -
  -    /**
  -     * Subclasses (client and server) must define the defaults.
  -     */
  -    abstract protected void deployDefaultHandlers();
  -    abstract protected void deployDefaultServices();
  -    abstract protected void deployDefaultTransports();
  -
  +    
       /**
        * (re)initialize - What should really go in here???
        */
       public void init() {
  -        // Load the simple handler registry and init it
  -        Debug.Print( 1, "Enter: AxisEngine::init" );
  +        /** 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 = props.getProperty("debugLevel", "0");
           Debug.setDebugLevel(Integer.parseInt(propVal));
           
           propVal = props.getProperty("debugFile");
           Debug.setToFile(propVal != null);
  -
  -        initializeHandlers();
  -        initializeServices();
  -        initializeTransports();
  -
  -        // Later...
  -        //initializeTypeMappings();
  -
  -        // Load the registry of deployed types
  -        TypeMappingRegistry tmr = new TypeMappingRegistry("typemap-supp.reg");
  -        tmr.setParent(new SOAPTypeMappingRegistry());
  -        _typeMappingRegistry = tmr;
           
  -        tmr.init();
  +        Debug.Print( 1, "Enter: AxisEngine::init" );
  +        
  +        readConfiguration();
           
           Debug.Print( 1, "Exit: AxisEngine::init" );
       }
       
       /**
  -     * Set up our handler registry, either by reading from the designated
  -     * XML file or setting up the defaults if that doesn't work.
  +     * Load up our engine's configuration of Handlers, Chains,
  +     * Services, etc.
  +     * 
  +     * NOTE: Right now this can only read an "engine-config.xml" in an
  +     * appropriate place on the classpath (org/apache/axis/client or
  +     * org/apache/axis/server).  This should be modified to do something like
  +     * look in the server startup directory first, or perhaps check a
  +     * system property for the repository location.  (OK, now it checks the
  +     * local directory first.)
  +     * 
  +     * We need to complete discussions about the packaging and deployment
  +     * patterns for Axis before this code solidifies.
        */
  -    private void initializeHandlers()
  +    private void readConfiguration()
       {
  -      if (!readRegistryFiles)
  -        return;
  -      
  -      dontSaveYet = true;
  -
  -      try {
  -        FileInputStream    fis = new FileInputStream(_handlerRegFilename);
  -        
  -        Document doc = XMLUtils.newDocument(fis);
  -        
  -        Element root = doc.getDocumentElement();
  -        Element elem;
  -        
  -        NodeList list = root.getElementsByTagName("handler");
  -        for (int i = 0; i < list.getLength(); i++) {
  -          elem = (Element)list.item(i);
  -          Admin.registerHandler(elem, this);
  +        InputStream is;
  +        try {
  +          is = new FileInputStream(engineConfigFilename);
  +        } catch (Exception e) {
  +          is = getResourceStream("engine-config.xml");
           }
           
  -        list = root.getElementsByTagName("chain");
  -        for (int i = 0; i < list.getLength(); i++) {
  -          elem = (Element)list.item(i);
  -          Admin.registerChain(elem, this);
  +        if (is == null) {
  +          // TODO: Deal with this in a nicer way...
  +          System.err.println("No engine configuration in " + 
  +                             this.getClass().getPackage().getName() +
  +                             " - aborting!");
  +          return;
           }
           
  -        fis.close();
  -        return;
  -      }
  -      catch( Exception e ) {
  -        if ( !(e instanceof FileNotFoundException) ) {
  -          e.printStackTrace( System.err );
  +        Document doc = XMLUtils.newDocument(is);
  +        try {
  +          // ??? Clear registries first?
  +          Admin.processEngineConfig(doc, this);
  +        } catch (Exception e) {
  +          e.printStackTrace();
  +          System.exit(-1);
           }
  -      } finally {
  -        dontSaveYet = false;
  -      }
  -      
  -      Debug.Print(2, "Deploying default handlers...");
  -      deployDefaultHandlers();
  -      dontSaveYet = false;
  -      
  -      // We don't actually need to save right now, since by definition
  -      // nothing has changed from the persistent version (or the defaults)
  +
  +        // Load the registry of deployed types
  +        TypeMappingRegistry tmr = new TypeMappingRegistry("typemap-supp.reg");
  +        tmr.setParent(new SOAPTypeMappingRegistry());
  +        _typeMappingRegistry = tmr;
  +        
  +        tmr.init();
       }
       
  -    /**
  -     * Set up our service registry, either by reading from the designated
  -     * XML file or setting up the defaults if that doesn't work.
  -     */
  -    private void initializeServices()
  -    {
  -      if (!readRegistryFiles)
  -        return;
  -      
  -      dontSaveYet = true;
  -      try {
  -        FileInputStream    fis = new FileInputStream(_serviceRegFilename);
  -        
  -        Document doc = XMLUtils.newDocument(fis);
  -        
  -        Element root = doc.getDocumentElement();
  -        
  -        NodeList list = root.getChildNodes();
  -        for (int i = 0; i < list.getLength(); i++) {
  -          if (!(list.item(i) instanceof Element))
  -            continue;
  -          Element elem = (Element)list.item(i);
  -          if (!elem.getTagName().equals("service")) {
  -            System.err.println("Found element '" + elem.getTagName() +
  -                  " in service reg file, wanted <service>");
  -          }
  -          Admin.registerService(elem, this);
  -        }
  -        
  -        fis.close();
  -        return;
  -      }
  -      catch( Exception e ) {
  -        if ( !(e instanceof FileNotFoundException) ) {
  -          e.printStackTrace( System.err );
  -        }
  -      } finally {
  -        dontSaveYet = false;
  -      }
  -      
  -      Debug.Print(2, "Deploying default services...");
  -      deployDefaultServices();
  -      dontSaveYet = false;
  -    }
  -    
  -    public void initializeTransports()
  -    {
  -      if (!readRegistryFiles)
  -        return;
  -      
  -      dontSaveYet = true;
  -      try {
  -        FileInputStream    fis = new FileInputStream(_transportRegFilename);
  -        
  -        Document doc = XMLUtils.newDocument(fis);
  -        
  -        Element root = doc.getDocumentElement();
  -        
  -        NodeList list = root.getChildNodes();
  -        for (int i = 0; i < list.getLength(); i++) {
  -          if (!(list.item(i) instanceof Element))
  -            continue;
  -          Element elem = (Element)list.item(i);
  -          Admin.registerTransport(elem, this);
  -        }
  -        
  -        fis.close();
  -        return;
  -      }
  -      catch( Exception e ) {
  -        if ( !(e instanceof FileNotFoundException) ) {
  -          e.printStackTrace( System.err );
  -        }
  -      } finally {
  -        dontSaveYet = false;
  -      }
  -
  -      Debug.Print(2, "Deploying default transports...");
  -      deployDefaultTransports();
  +    private InputStream getResourceStream(String name)
  +    {
  +        return this.getClass().getResourceAsStream(name);
       }
  +    
   
       public HandlerRegistry getHandlerRegistry()
       {
  @@ -376,60 +242,6 @@
           return _typeMappingRegistry;
       }
       
  -    public void saveHandlerRegistry()
  -    {
  -      if (dontSaveYet || (_handlerRegFilename == null))
  -        return;
  -      
  -      try {
  -        FileOutputStream fos = new FileOutputStream(_handlerRegFilename);
  -        Document doc = XMLUtils.newDocument();
  -        Element el = doc.createElement("handlers");
  -        Admin.list(el, getHandlerRegistry());
  -        doc.appendChild(el);
  -        XMLUtils.DocumentToStream(doc, fos);
  -        fos.close();
  -      } catch (Exception e) {
  -        e.printStackTrace();
  -      }
  -    }
  -    
  -    public void saveServiceRegistry()
  -    {
  -      if (dontSaveYet || (_serviceRegFilename == null))
  -        return;
  -      
  -      try {
  -        FileOutputStream fos = new FileOutputStream(_serviceRegFilename);
  -        Document doc = XMLUtils.newDocument();
  -        Element el = doc.createElement("services");
  -        Admin.list(el, getServiceRegistry());
  -        doc.appendChild(el);
  -        XMLUtils.DocumentToStream(doc, fos);
  -        fos.close();
  -      } catch (Exception e) {
  -        e.printStackTrace();
  -      }
  -    }
  -    
  -    public void saveTransportRegistry()
  -    {
  -      if (dontSaveYet || (_transportRegFilename == null))
  -        return;
  -      
  -      try {
  -        FileOutputStream fos = new FileOutputStream(_transportRegFilename);
  -        Document doc = XMLUtils.newDocument();
  -        Element el = doc.createElement("transports"); 
  -        Admin.list(el, getTransportRegistry());
  -        doc.appendChild(el);
  -        XMLUtils.DocumentToStream(doc, fos);
  -        fos.close();
  -      } catch (Exception e) {
  -        e.printStackTrace();
  -      }
  -    }
  -    
       /*********************************************************************
        * Administration and management APIs
        *
  @@ -469,7 +281,6 @@
       {
           handler.setName(key);
           getHandlerRegistry().add(key, handler);
  -        saveHandlerRegistry();
       }
       
       /**
  @@ -478,7 +289,6 @@
       public void undeployHandler(String key)
       {
           getHandlerRegistry().remove(key);
  -        saveHandlerRegistry();
       }
   
       /**
  @@ -490,7 +300,6 @@
           service.setEngine(this);
           
           getServiceRegistry().add(key, service);
  -        saveServiceRegistry();
       }
       
       /**
  @@ -499,7 +308,6 @@
       public void undeployService(String key)
       {
           getServiceRegistry().remove(key);
  -        saveServiceRegistry();
       }
   
       /**
  @@ -509,7 +317,6 @@
       {
           transport.setName(key);
           transportRegistry.add(key, transport);
  -        saveTransportRegistry();
       }
       
       /**
  @@ -518,7 +325,6 @@
       public void deployTransport(String key, Supplier supplier)
       {
           transportRegistry.add(key, supplier);
  -        saveTransportRegistry();
       }
       
       /**
  @@ -527,7 +333,6 @@
       public void undeployTransport(String key)
       {
           transportRegistry.remove(key);
  -        saveTransportRegistry();
       }
   
       /**
  
  
  
  1.17      +3 -0      xml-axis/java/src/org/apache/axis/SimpleChain.java
  
  Index: SimpleChain.java
  ===================================================================
  RCS file: /home/cvs/xml-axis/java/src/org/apache/axis/SimpleChain.java,v
  retrieving revision 1.16
  retrieving revision 1.17
  diff -u -r1.16 -r1.17
  --- SimpleChain.java	2001/06/27 16:18:17	1.16
  +++ SimpleChain.java	2001/06/29 04:51:32	1.17
  @@ -123,6 +123,9 @@
     }
   
     public void addHandler(Handler handler) {
  +    if (handler == null)
  +      throw new NullPointerException("SimpleChain.addHandler: Null handler!");
  +    
       if ( handlers == null ) handlers = new Vector();
       handlers.add( handler );
     }
  
  
  
  1.24      +1 -1      xml-axis/java/src/org/apache/axis/client/AdminClient.java
  
  Index: AdminClient.java
  ===================================================================
  RCS file: /home/cvs/xml-axis/java/src/org/apache/axis/client/AdminClient.java,v
  retrieving revision 1.23
  retrieving revision 1.24
  diff -u -r1.23 -r1.24
  --- AdminClient.java	2001/06/27 16:18:22	1.23
  +++ AdminClient.java	2001/06/29 04:51:33	1.24
  @@ -99,7 +99,7 @@
               InputStream input = null ;
               
               if ( args[i].equals("list") ) {
  -                System.out.println( "Doing a list" );
  +                System.err.println( "Doing a list" );
                   String str = "<m:list xmlns:m=\"AdminService\"/>" ;
                   input = new ByteArrayInputStream( str.getBytes() );
               } else if (args[i].equals("quit")) {
  
  
  
  1.17      +1 -37     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.16
  retrieving revision 1.17
  diff -u -r1.16 -r1.17
  --- AxisClient.java	2001/06/27 16:18:26	1.16
  +++ AxisClient.java	2001/06/29 04:51:34	1.17
  @@ -76,45 +76,9 @@
   {
       public AxisClient()
       {
  -        super(Constants.CLIENT_HANDLER_REGISTRY,
  -              Constants.CLIENT_SERVICE_REGISTRY,
  -              Constants.CLIENT_TRANSPORT_REGISTRY);
  +        super();
       }
  -
  -    /**
  -     * Deploy our default handlers
  -     */
  -    protected void deployDefaultHandlers()
  -    {
  -      deployHandler( "HTTPSender",  new HTTPSender() );
  -      deployHandler( "LocalSender", new LocalSender() );
  -    }
  -
  -    /**
  -     * Deploy our default services
  -     */
  -    protected void deployDefaultServices()
  -    {
  -      // No default client services
  -    }
       
  -    /**
  -     * Deploy the default transports.
  -     */
  -    protected void deployDefaultTransports()
  -    {
  -      /** If a transport has no req/resp chains, can we just deploy
  -       * the sender directly???
  -       */
  -      SimpleTargetedChain transport = new SimpleTargetedChain();
  -      transport.setPivotHandler(_handlerRegistry.find("HTTPSender"));
  -      deployTransport("http", transport);
  -      
  -      transport = new SimpleTargetedChain();
  -      transport.setPivotHandler(_handlerRegistry.find("LocalSender"));
  -      deployTransport("local", transport);
  -    }
  -
       /**
        * Main routine of the AXIS engine.  In short we locate the appropriate
        * handler for the desired service and invoke() it.
  
  
  
  1.1                  xml-axis/java/src/org/apache/axis/client/engine-config.xml
  
  Index: engine-config.xml
  ===================================================================
  <engineConfig>
  
   <handlers>
    <handler name="HTTPSender" class="org.apache.axis.transport.http.HTTPSender"/>
    <handler name="LocalSender" class="org.apache.axis.transport.local.LocalSender"/>
   </handlers>
  
   <transports>
    <transport name="http" pivot="HTTPSender"/>
    <transport name="local" pivot="LocalSender"/>
   </transports>
  
   <services>
   </services>
  
  </engineConfig>
  
  
  
  1.28      +0 -80     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.27
  retrieving revision 1.28
  diff -u -r1.27 -r1.28
  --- AxisServer.java	2001/06/27 16:18:34	1.27
  +++ AxisServer.java	2001/06/29 04:51:36	1.28
  @@ -109,86 +109,6 @@
       }
       
       /**
  -     * Constructor.
  -     */
  -    public AxisServer() {
  -      super(Constants.SERVER_HANDLER_REGISTRY,
  -            Constants.SERVER_SERVICE_REGISTRY,
  -            Constants.SERVER_TRANSPORT_REGISTRY);
  -    }
  -
  -    /**
  -     * Allows the Listener to specify which handler/service registry
  -     * implementation they want to use.
  -     */
  -    public AxisServer(HandlerRegistry handlers, HandlerRegistry services)
  -    {
  -        super(handlers, services);
  -    }
  -
  -    /**
  -     * Deploy our default handlers
  -     */
  -    protected void deployDefaultHandlers()
  -    {
  -      Chain c;
  -      
  -      deployHandler( "debug"        , new DebugHandler() );
  -      deployHandler( "MsgDispatcher", new MsgProvider() );
  -      deployHandler( "RPCDispatcher", new RPCProvider() );
  -      deployHandler( "HTTPSender"   , new HTTPSender() );
  -      deployHandler( "HTTPAction"   , new HTTPActionHandler() );
  -      deployHandler( "HTTPAuth"     , new HTTPAuthHandler() );
  -      deployHandler( "JWSHandler"   , new JWSHandler() );
  -      deployHandler( "JWSProcessor" , new JWSProcessor() );
  -      
  -      // Want this around by default for testing?
  -      deployHandler( "EchoHandler"  , new EchoHandler() );
  -
  -      c = new SimpleChain();
  -      c.addHandler( _handlerRegistry.find( "JWSHandler" ) );
  -      c.addHandler( _handlerRegistry.find( "debug" ) );
  -      deployHandler( "global.request", c );
  -      
  -    }
  -
  -    protected void deployDefaultServices()
  -    {
  -      Handler h = _handlerRegistry.find( "JWSProcessor" );
  -      if (h != null)
  -        deployService( "JWSProcessor",  new SOAPService(h, "JWSProcessor"));
  -
  -      SOAPService service = new SOAPService();
  -      service.setPivotHandler( _handlerRegistry.find( "MsgDispatcher" ) );
  -      service.addOption(SOAPService.OPTION_PIVOT, "MsgDispatcher");
  -      service.addOption( "className", "org.apache.axis.utils.Admin" );
  -      service.addOption( "methodName", "AdminService" );
  -      deployService( "AdminService", service );
  -      
  -      h = _handlerRegistry.find( "EchoHandler" );
  -      if (h != null)
  -        deployService( "EchoService",  new SOAPService(h, "EchoHandler"));
  -    }
  -
  -    protected void deployDefaultTransports()
  -    {
  -      Chain c = new SimpleChain();
  -      Handler actionHandler = _handlerRegistry.find( "HTTPAction" );
  -      c.addHandler( _handlerRegistry.find( "HTTPAuth" ) );
  -      c.addHandler( actionHandler );
  -      
  -      // HTTP transport w/authorization
  -      SimpleTargetedChain transport = new SimpleTargetedChain();
  -      transport.setRequestHandler(c);
  -      deployTransport("http", transport);
  -      
  -      // HTTP transport (for SimpleAxisServer) without auth.
  -      transport = new SimpleTargetedChain();
  -      transport.setRequestHandler(actionHandler);
  -      deployTransport("SimpleHTTP", transport);
  -    }
  -    
  -    /**
        * Main routine of the AXIS server.  In short we locate the appropriate
        * handler for the desired service and invoke() it.
        */
  
  
  
  1.1                  xml-axis/java/src/org/apache/axis/server/engine-config.xml
  
  Index: engine-config.xml
  ===================================================================
  <engineConfig>
  
   <handlers>
    <handler name="debug" class="org.apache.axis.handlers.DebugHandler"/>
    <handler name="MsgDispatcher" class="org.apache.axis.providers.java.MsgProvider"/>
    <handler name="RPCDispatcher" class="org.apache.axis.providers.java.RPCProvider"/>
    <handler name="HTTPSender" class="org.apache.axis.transport.http.HTTPSender"/>
    <handler name="EchoHandler" class="org.apache.axis.handlers.EchoHandler"/>
    <handler name="JWSProcessor" class="org.apache.axis.handlers.JWSProcessor"/>
    <handler name="JWSHandler" class="org.apache.axis.handlers.JWSHandler"/>
  
    <chain name="global.request" flow="JWSHandler,debug"/>
   </handlers>
  
   <transports>
    <transport name="http" pivot="HTTPSender"/>
    <transport name="local" pivot="LocalSender"/>
   </transports>
  
   <services>
    <!-- JWS Processor -->
    <service name="JWSProcessor" pivot="JWSProcessor"/>
  
    <!-- The admin service -->
    <service name="AdminService" pivot="MsgDispatcher">
     <option name="pivot" value="MsgDispatcher"/>
     <option name="className" value="org.apache.axis.utils.Admin"/>
     <option name="methodName" value="AdminService"/>
    </service>
  
    <!-- An echo service for testing -->
    <service name="EchoService" pivot="EchoHandler"/>
  
   </services>
  
  </engineConfig>
  
  
  1.47      +46 -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.46
  retrieving revision 1.47
  diff -u -r1.46 -r1.47
  --- Admin.java	2001/06/27 16:18:47	1.46
  +++ Admin.java	2001/06/29 04:51:37	1.47
  @@ -141,6 +141,52 @@
     public Document process(MessageContext msgContext, Document doc) throws AxisFault {
       return( process( msgContext, doc.getDocumentElement() ) );
     }
  +  
  +  public static void processEngineConfig(Document doc, AxisEngine engine)
  +    throws Exception
  +  {
  +    Element el = doc.getDocumentElement();
  +    if (!el.getTagName().equals("engineConfig"))
  +      throw new Exception("Wanted 'engineConfig' element, got '" + el.getTagName() + "'");
  +    
  +    NodeList nl = el.getElementsByTagName("handlers");
  +    deploy(nl, engine);
  +    
  +    nl = el.getElementsByTagName("services");
  +    deploy(nl, engine);
  +    
  +    nl = el.getElementsByTagName("transports");
  +    deploy(nl, engine);
  +      
  +  }
  +  
  +  static void deploy(NodeList nl, AxisEngine engine) throws Exception
  +  {
  +    for (int i = 0; i < nl.getLength(); i++) {
  +      Element el = (Element)nl.item(i);
  +      
  +      NodeList children = el.getChildNodes();
  +      for (int j = 0; j < children.getLength(); j++) {
  +        if (!(children.item(j) instanceof Element)) continue;
  +        
  +        Element item = (Element)children.item(j);
  +        String type = item.getTagName();
  +      
  +        if ( type.equals( "handler" ) ) {
  +          registerHandler(item, engine);
  +        }
  +        else if ( type.equals( "chain" ) ) {
  +          registerChain(item, engine);
  +        }
  +        else if ( type.equals( "service" ) ) {
  +          registerService(item, engine);
  +        }
  +        else if (type.equals("transport")) {
  +          registerTransport(item, engine);
  +        }
  +      }
  +    }
  +  }
   
     /**
      * The meat of the Admin service.  Process an xML document rooted with
  @@ -371,8 +417,6 @@
                                                                hr);
         hr.add(name,supp);
       }
  -    
  -    engine.saveHandlerRegistry();
     }
     
     /**
  
  
  

Mime
View raw message