gdaniels    02/03/28 16:01:26

  Modified:    java/src/org/apache/axis EngineConfiguration.java
               java/src/org/apache/axis/configuration FileProvider.java
                        NullProvider.java SimpleProvider.java
               java/src/org/apache/axis/deployment/wsdd WSDDDeployment.java
                        WSDDService.java
               java/src/org/apache/axis/description ServiceDesc.java
               java/src/org/apache/axis/transport/http AxisServlet.java
  Log:
  Introduce getDeployedServices() method on EngineConfiguration interface.
  This returns an Iterator which steps through ServiceDescs for each
  deployed service in the engine configuration.  This is mostly to enable tools
  and administration aids to access this information, and eventually to do
  stuff like invoking methods via HTML pages.
  
  NOTE: This still needs some work, in particular to make sure that the
  ServiceDescs for services for which we need to introspect are set up
  correctly (with the right TypeMapping and dealing with classloader issues
  etc)
  
  Alan Gordie is working on HTML administration tools, and this should ungate
  him.  Alan, note that I modifed AxisServlet to show what a (cheesy) version
  of the service list might look like.
  
  Revision  Changes    Path
  1.6       +7 -0      xml-axis/java/src/org/apache/axis/EngineConfiguration.java
  
  Index: EngineConfiguration.java
  ===================================================================
  RCS file: /home/cvs/xml-axis/java/src/org/apache/axis/EngineConfiguration.java,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- EngineConfiguration.java  20 Feb 2002 18:59:20 -0000      1.5
  +++ EngineConfiguration.java  29 Mar 2002 00:01:26 -0000      1.6
  @@ -61,6 +61,8 @@
   import org.apache.axis.handlers.soap.SOAPService;
   
   import java.util.Hashtable;
  +import java.util.Enumeration;
  +import java.util.Iterator;
   
   /**
    * EngineConfiguration is an interface that the Message Flow subsystem
  @@ -152,4 +154,9 @@
        * Returns the global configuration options.
        */
       public Hashtable getGlobalOptions() throws ConfigurationException;
  +
  +    /**
  +     * Get an enumeration of the services deployed to this engine
  +     */
  +    public Iterator getDeployedServices() throws ConfigurationException;
   }
  
  
  
  1.26      +16 -0     
xml-axis/java/src/org/apache/axis/configuration/FileProvider.java
  
  Index: FileProvider.java
  ===================================================================
  RCS file: 
/home/cvs/xml-axis/java/src/org/apache/axis/configuration/FileProvider.java,v
  retrieving revision 1.25
  retrieving revision 1.26
  diff -u -r1.25 -r1.26
  --- FileProvider.java 15 Mar 2002 01:14:10 -0000      1.25
  +++ FileProvider.java 29 Mar 2002 00:01:26 -0000      1.26
  @@ -63,6 +63,7 @@
   import org.apache.axis.deployment.wsdd.WSDDDeployment;
   import org.apache.axis.deployment.wsdd.WSDDDocument;
   import org.apache.axis.deployment.wsdd.WSDDGlobalConfiguration;
  +import org.apache.axis.deployment.wsdd.WSDDService;
   import org.apache.axis.encoding.TypeMappingRegistry;
   import org.apache.axis.utils.Admin;
   import org.apache.axis.utils.XMLUtils;
  @@ -79,6 +80,9 @@
   import java.io.InputStream;
   import java.io.StringWriter;
   import java.util.Hashtable;
  +import java.util.Enumeration;
  +import java.util.ArrayList;
  +import java.util.Iterator;
   
   /**
    * A simple ConfigurationProvider that uses the Admin class to read +
  @@ -309,4 +313,16 @@
           return null;
       }
   
  +    /**
  +     * Get an enumeration of the services deployed to this engine
  +     */
  +    public Iterator getDeployedServices() throws ConfigurationException {
  +        ArrayList serviceDescs = new ArrayList();
  +        WSDDService [] services = this.deployment.getServices();
  +        for (int i = 0; i < services.length; i++) {
  +            WSDDService service = services[i];
  +            serviceDescs.add(service.getServiceDesc());
  +        }
  +        return serviceDescs.iterator();
  +    }
   }
  
  
  
  1.5       +8 -0      
xml-axis/java/src/org/apache/axis/configuration/NullProvider.java
  
  Index: NullProvider.java
  ===================================================================
  RCS file: 
/home/cvs/xml-axis/java/src/org/apache/axis/configuration/NullProvider.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- NullProvider.java 20 Feb 2002 18:59:20 -0000      1.4
  +++ NullProvider.java 29 Mar 2002 00:01:26 -0000      1.5
  @@ -65,6 +65,7 @@
   
   import javax.xml.rpc.namespace.QName;
   import java.util.Hashtable;
  +import java.util.Iterator;
   
   /**
    * A do-nothing ConfigurationProvider
  @@ -115,6 +116,13 @@
       }
   
       public Handler getHandler(QName qname) throws ConfigurationException {
  +        return null;
  +    }
  +
  +    /**
  +     * Get an enumeration of the services deployed to this engine
  +     */
  +    public Iterator getDeployedServices() throws ConfigurationException {
           return null;
       }
   }
  
  
  
  1.5       +14 -0     
xml-axis/java/src/org/apache/axis/configuration/SimpleProvider.java
  
  Index: SimpleProvider.java
  ===================================================================
  RCS file: 
/home/cvs/xml-axis/java/src/org/apache/axis/configuration/SimpleProvider.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- SimpleProvider.java       20 Feb 2002 18:59:20 -0000      1.4
  +++ SimpleProvider.java       29 Mar 2002 00:01:26 -0000      1.5
  @@ -67,6 +67,8 @@
   import javax.xml.rpc.namespace.QName;
   import java.util.Hashtable;
   import java.util.HashMap;
  +import java.util.Iterator;
  +import java.util.ArrayList;
   
   /**
    * A SimpleProvider is an EngineConfiguration which contains a simple
  @@ -249,4 +251,16 @@
           deployTransport(new QName(null, name), transport);
       }
   
  +    /**
  +     * Get an enumeration of the services deployed to this engine
  +     */
  +    public Iterator getDeployedServices() throws ConfigurationException {
  +        ArrayList serviceDescs = new ArrayList();
  +        Iterator i = services.values().iterator();
  +        while (i.hasNext()) {
  +            SOAPService service = (SOAPService)i.next();
  +            serviceDescs.add(service.getServiceDescription());
  +        }
  +        return serviceDescs.iterator();
  +    }
   }
  
  
  
  1.30      +15 -6     
xml-axis/java/src/org/apache/axis/deployment/wsdd/WSDDDeployment.java
  
  Index: WSDDDeployment.java
  ===================================================================
  RCS file: 
/home/cvs/xml-axis/java/src/org/apache/axis/deployment/wsdd/WSDDDeployment.java,v
  retrieving revision 1.29
  retrieving revision 1.30
  diff -u -r1.29 -r1.30
  --- WSDDDeployment.java       11 Mar 2002 13:45:42 -0000      1.29
  +++ WSDDDeployment.java       29 Mar 2002 00:01:26 -0000      1.30
  @@ -73,6 +73,7 @@
   import java.util.Iterator;
   import java.util.Hashtable;
   import java.util.Vector;
  +import java.util.ArrayList;
   import java.io.IOException;
   
   
  @@ -168,11 +169,7 @@
       {
           WSDDService service = (WSDDService)services.get(qname);
           if (service != null) {
  -            Vector namespaces = service.getNamespaces();
  -            for (Iterator i = namespaces.iterator(); i.hasNext();) {
  -                String namespace = (String) i.next();
  -                namespaceToServices.remove(namespace);
  -            }
  +            service.removeNamespaceMappings(this);
               services.remove(qname);
           }
       }
  @@ -531,7 +528,19 @@
       public Hashtable getGlobalOptions() throws ConfigurationException {
           return globalConfig.getParametersTable();
       }
  -    
  +
  +    /**
  +     * Get an enumeration of the services deployed to this engine
  +     */
  +    public Iterator getDeployedServices() throws ConfigurationException {
  +        ArrayList serviceDescs = new ArrayList();
  +        for (Iterator i = services.values().iterator(); i.hasNext();) {
  +            WSDDService service = (WSDDService) i.next();
  +            serviceDescs.add(service.getServiceDesc());
  +        }
  +        return serviceDescs.iterator();
  +    }
  +
       /**
        * Register a particular namepsace which maps to a given WSDDService.
        * This will be used for namespace-based dispatching.
  
  
  
  1.47      +26 -7     
xml-axis/java/src/org/apache/axis/deployment/wsdd/WSDDService.java
  
  Index: WSDDService.java
  ===================================================================
  RCS file: 
/home/cvs/xml-axis/java/src/org/apache/axis/deployment/wsdd/WSDDService.java,v
  retrieving revision 1.46
  retrieving revision 1.47
  diff -u -r1.46 -r1.47
  --- WSDDService.java  27 Mar 2002 19:27:47 -0000      1.46
  +++ WSDDService.java  29 Mar 2002 00:01:26 -0000      1.47
  @@ -130,6 +130,8 @@
       {
           super(e);
   
  +        desc.setName(getQName().getLocalPart());
  +
           String modeStr = e.getAttribute("style");
           if (modeStr != null && !modeStr.equals("")) {
               style = MessageContext.getStyleFromString(modeStr);
  @@ -174,6 +176,18 @@
           if (typeStr != null && !typeStr.equals(""))
               providerQName = XMLUtils.getQNameFromString(typeStr, e);
   
  +        String className = this.getParameter("className");
  +        if (className != null) {
  +            try {
  +                Class cls = Class.forName(className);
  +                desc.setImplClass(cls);
  +                initTMR();
  +                String encStyle = Constants.URI_SOAP_ENC;
  +                desc.setTypeMapping((TypeMapping)tmr.getTypeMapping(encStyle));
  +            } catch (Exception ex) {
  +            }
  +        }
  +
       }
   
       /**
  @@ -332,13 +346,7 @@
               service.setOption(AxisEngine.PROP_SEND_XSI, Boolean.FALSE);
           }
   
  -        if (tmr == null) {
  -            tmr = new TypeMappingRegistryImpl();
  -        }
  -        for (int i = 0; i < typeMappings.size(); i++) {
  -            deployTypeMapping((WSDDTypeMapping)typeMappings.get(i));
  -        }
  -
  +        initTMR();
           service.setTypeMappingRegistry(tmr);
           tmr.delegate(registry.getTypeMappingRegistry());
   
  @@ -499,6 +507,17 @@
           for (int i = 0; i < namespaces.size(); i++) {
               String namespace = (String) namespaces.elementAt(i);
               registry.removeNamespaceMapping(namespace);
  +        }
  +        registry.removeNamespaceMapping(getQName().getLocalPart());
  +    }
  +
  +    public void initTMR() throws WSDDException
  +    {
  +        if (tmr == null) {
  +            tmr = new TypeMappingRegistryImpl();
  +            for (int i = 0; i < typeMappings.size(); i++) {
  +                deployTypeMapping((WSDDTypeMapping)typeMappings.get(i));
  +            }
           }
       }
   }
  
  
  
  1.7       +20 -0     xml-axis/java/src/org/apache/axis/description/ServiceDesc.java
  
  Index: ServiceDesc.java
  ===================================================================
  RCS file: /home/cvs/xml-axis/java/src/org/apache/axis/description/ServiceDesc.java,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -u -r1.6 -r1.7
  --- ServiceDesc.java  27 Mar 2002 17:53:06 -0000      1.6
  +++ ServiceDesc.java  29 Mar 2002 00:01:26 -0000      1.7
  @@ -82,6 +82,9 @@
       /** This becomes true once we've added some operations */
       private boolean hasOperationData = false;
   
  +    /** The name of this service */
  +    private String name = null;
  +
       /** List of allowed methods */
       /** null allows everything, an empty ArrayList allows nothing */
       private ArrayList allowedMethods = null;
  @@ -180,6 +183,14 @@
           this.tm = tm;
       }
   
  +    public String getName() {
  +        return name;
  +    }
  +
  +    public void setName(String name) {
  +        this.name = name;
  +    }
  +
       public void addOperationDesc(OperationDesc operation)
       {
           operations.add(operation);
  @@ -199,6 +210,12 @@
           overloads.add(operation);
       }
   
  +    public ArrayList getOperations()
  +    {
  +        loadServiceDescByIntrospection();  // Just in case...
  +        return operations;
  +    }
  +
       public OperationDesc [] getOperationsByName(String methodName)
       {
           getSyncedOperationsForName(methodName);
  @@ -338,6 +355,9 @@
        */
       public void loadServiceDescByIntrospection()
       {
  +        if (implClass == null)
  +            return;
  +
           Method [] methods = implClass.getDeclaredMethods();
   
           for (int i = 0; i < methods.length; i++) {
  
  
  
  1.91      +27 -0     
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.90
  retrieving revision 1.91
  diff -u -r1.90 -r1.91
  --- AxisServlet.java  21 Mar 2002 16:19:09 -0000      1.90
  +++ AxisServlet.java  29 Mar 2002 00:01:26 -0000      1.91
  @@ -61,6 +61,8 @@
   import org.apache.axis.Message;
   import org.apache.axis.MessageContext;
   import org.apache.axis.EngineConfiguration;
  +import org.apache.axis.description.ServiceDesc;
  +import org.apache.axis.description.OperationDesc;
   import org.apache.axis.configuration.ServletEngineConfigurationFactory;
   import org.apache.axis.message.SOAPEnvelope;
   import org.apache.axis.message.SOAPFaultElement;
  @@ -89,6 +91,8 @@
   import java.util.Enumeration;
   import java.util.Map;
   import java.util.HashMap;
  +import java.util.Iterator;
  +import java.util.ArrayList;
   
   /**
    *
  @@ -227,6 +231,29 @@
           msgContext.setProperty(Constants.MC_JWS_CLASSDIR,
                                  jwsClassDir);
           msgContext.setProperty(Constants.MC_HOME_DIR, homeDir);
  +
  +        String pathInfo = req.getPathInfo();
  +        if (pathInfo == null || pathInfo.equals("")) {
  +            res.setContentType("text/html");
  +            writer.println("<h2>And now... Some Services</h2>");
  +            Iterator i = engine.getConfig().getDeployedServices();
  +            writer.println("<ul>");
  +            while (i.hasNext()) {
  +                ServiceDesc sd = (ServiceDesc)i.next();
  +                writer.println("<li>" + sd.getName());
  +                ArrayList operations = sd.getOperations();
  +                if (!operations.isEmpty()) {
  +                    writer.println("<ul>");
  +                    for (Iterator it = operations.iterator(); it.hasNext();) {
  +                        OperationDesc desc = (OperationDesc) it.next();
  +                        writer.println("<li>" + desc.getName());
  +                    }
  +                    writer.println("</ul>");
  +                }
  +            }
  +            writer.println("</ul>");
  +            return;
  +        }
   
           String realpath = context.getRealPath(req.getServletPath());
           String configPath = webInfPath;
  
  
  


Reply via email to