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 de...@apache.org on 2005/06/02 11:23:59 UTC

svn commit: r179567 - in /webservices/axis/trunk/java/modules/core: conf/web.xml html/LeftFrame.jsp html/SelectService.jsp html/enaggingtoanopeartion.jsp src/org/apache/axis/Constants.java src/org/apache/axis/transport/http/AxisServlet.java

Author: deepal
Date: Thu Jun  2 02:23:57 2005
New Revision: 179567

URL: http://svn.apache.org/viewcvs?rev=179567&view=rev
Log:
Completed Axis2 web admin module :)

Modified:
    webservices/axis/trunk/java/modules/core/conf/web.xml
    webservices/axis/trunk/java/modules/core/html/LeftFrame.jsp
    webservices/axis/trunk/java/modules/core/html/SelectService.jsp
    webservices/axis/trunk/java/modules/core/html/enaggingtoanopeartion.jsp
    webservices/axis/trunk/java/modules/core/src/org/apache/axis/Constants.java
    webservices/axis/trunk/java/modules/core/src/org/apache/axis/transport/http/AxisServlet.java

Modified: webservices/axis/trunk/java/modules/core/conf/web.xml
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/modules/core/conf/web.xml?rev=179567&r1=179566&r2=179567&view=diff
==============================================================================
--- webservices/axis/trunk/java/modules/core/conf/web.xml (original)
+++ webservices/axis/trunk/java/modules/core/conf/web.xml Thu Jun  2 02:23:57 2005
@@ -72,6 +72,14 @@
     </servlet-mapping>
     <servlet-mapping>
         <servlet-name>AxisServlet</servlet-name>
+        <url-pattern>/listoperation</url-pattern>
+    </servlet-mapping>
+    <servlet-mapping>
+        <servlet-name>AxisServlet</servlet-name>
+        <url-pattern>/listOperations</url-pattern>
+    </servlet-mapping>
+    <servlet-mapping>
+        <servlet-name>AxisServlet</servlet-name>
         <url-pattern>/services/*</url-pattern>
     </servlet-mapping>
 </web-app>

Modified: webservices/axis/trunk/java/modules/core/html/LeftFrame.jsp
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/modules/core/html/LeftFrame.jsp?rev=179567&r1=179566&r2=179567&view=diff
==============================================================================
--- webservices/axis/trunk/java/modules/core/html/LeftFrame.jsp (original)
+++ webservices/axis/trunk/java/modules/core/html/LeftFrame.jsp Thu Jun  2 02:23:57 2005
@@ -128,7 +128,7 @@
        &nbsp;&nbsp;&nbsp;&nbsp;
        </td>
        <td>
-         <a href="enaggingtoanopeartion.jsp" target="mainFrame">To an Operation</a>
+         <a href="listoperation" target="mainFrame">To an Operation</a>
        </td>
     </tr>
 </table>

Modified: webservices/axis/trunk/java/modules/core/html/SelectService.jsp
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/modules/core/html/SelectService.jsp?rev=179567&r1=179566&r2=179567&view=diff
==============================================================================
--- webservices/axis/trunk/java/modules/core/html/SelectService.jsp (original)
+++ webservices/axis/trunk/java/modules/core/html/SelectService.jsp Thu Jun  2 02:23:57 2005
@@ -33,7 +33,19 @@
 <html>
   <head><title>Simple jsp page</title></head>
   <body>
-<form method="get" name="engaginModule" action="viewServiceHandlers">
+  <%
+      String action ="";
+      String buttonName="" ;
+      String status = (String)request.getSession().getAttribute(Constants.MODULE_ENGAMENT);
+      if(status != null && status.equals("Yes")) {
+          action = "listOperations";
+          buttonName = " View Operations";
+      } else {
+          buttonName = " View ";
+          action = "viewServiceHandlers";
+      }
+  %>
+<form method="get" name="engaginModule" action="<%=action%>">
 <table border="0" width="100%" cellspacing="1" cellpadding="1">
     <tr>
         <td>
@@ -73,7 +85,7 @@
          </tr>
          <tr>
              <td>
-                <input name="submit" type="submit" value=" View " >
+                <input name="submit" type="submit" value="<%=buttonName%>" >
              </td>
          </tr>
          <tr>

Modified: webservices/axis/trunk/java/modules/core/html/enaggingtoanopeartion.jsp
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/modules/core/html/enaggingtoanopeartion.jsp?rev=179567&r1=179566&r2=179567&view=diff
==============================================================================
--- webservices/axis/trunk/java/modules/core/html/enaggingtoanopeartion.jsp (original)
+++ webservices/axis/trunk/java/modules/core/html/enaggingtoanopeartion.jsp Thu Jun  2 02:23:57 2005
@@ -1,4 +1,11 @@
-<%@ page contentType="text/html; charset=iso-8859-1" language="java" import="java.sql.*" errorPage="" %>
+<%@ page contentType="text/html; charset=iso-8859-1" language="java" import="java.sql.*,
+                                                                             org.apache.axis.Constants,
+                                                                             java.util.HashMap,
+                                                                             java.util.Collection,
+                                                                             java.util.Iterator,
+                                                                             org.apache.axis.description.ModuleDescription,
+                                                                             org.apache.axis.description.ServiceDescription,
+                                                                             org.apache.axis.description.OperationDescription" errorPage="" %>
 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
 <html>
 <head>
@@ -8,6 +15,97 @@
 </style></head>
 
 <body>
-Engaging to an operation
+<body>
+<%
+    String status = (String)request.getSession().getAttribute(Constants.ENGAGE_STATUS);
+%>
+<form method="get" name="engaginModule" action="listOperations">
+<table border="0" width="100%" cellspacing="1" cellpadding="1">
+    <tr>
+        <td>
+            &nbsp;
+            &nbsp;
+        </td>
+    </tr>
+    <tr>
+        <td>Select a Module :</td>
+    </tr>
+    <tr>
+        <td>
+            <select name="modules">
+            <%
+                HashMap moduels = (HashMap)request.getSession().getAttribute(Constants.MODULE_MAP);
+                Collection moduleCol =  moduels.values();
+                for (Iterator iterator = moduleCol.iterator(); iterator.hasNext();) {
+                    ModuleDescription description = (ModuleDescription) iterator.next();
+                    String modulename = description.getName().getLocalPart();
+            %> <option  align="left" value="<%=modulename%>"><%=modulename%></option>
+             <%
+                }
+             %>
+           </td>
+        </tr>
+        <tr>
+           <td>
+             &nbsp;
+             &nbsp;
+           </td>
+         </tr>
+         <tr>
+        <td>Select a Service :</td>
+    </tr>
+    <tr>
+        <td>
+            <select name="operation">
+            <%
+                HashMap operations = (HashMap)request.getSession().getAttribute(Constants.OPEARTION_MAP);
+                Collection serviceCol =  operations.values();
+                for (Iterator iterator = serviceCol.iterator(); iterator.hasNext();) {
+                    OperationDescription operation = (OperationDescription)iterator.next();
+                    String opname = operation.getName().getLocalPart();
+            %> <option  align="left" value="<%=opname%>"><%=opname%></option>
+             <%
+                }
+             %>
+           </td>
+        </tr>
+        <tr>
+           <td>
+             &nbsp;
+             &nbsp;
+           </td>
+         </tr>
+         <tr>
+             <td>
+                <input name="submit" type="submit" value=" Engage " >
+             </td>
+         </tr>
+         <tr>
+             <td>
+             &nbsp;
+             &nbsp;
+             </td>
+         </tr>
+         <tr>
+             <td>
+             &nbsp;
+             &nbsp;
+             </td>
+         </tr>
+         <tr>
+             <td>
+                <textarea cols="50"  <%
+                        if(status == null){
+                           %>
+                            style="display:none"
+                            <%
+                        } %>
+                    ><%=status%></textarea>
+              </td>
+           </tr>
+      </table>
+   </form>
 </body>
 </html>
+
+

Modified: webservices/axis/trunk/java/modules/core/src/org/apache/axis/Constants.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/modules/core/src/org/apache/axis/Constants.java?rev=179567&r1=179566&r2=179567&view=diff
==============================================================================
--- webservices/axis/trunk/java/modules/core/src/org/apache/axis/Constants.java (original)
+++ webservices/axis/trunk/java/modules/core/src/org/apache/axis/Constants.java Thu Jun  2 02:23:57 2005
@@ -91,6 +91,8 @@
      */
     public static final String LISTSERVICES = "listServices";
 
+    public static final String LIST_SERVICE_FOR_MODULE_ENGAMNET = "listoperation";
+
     /**
      * List service for adminpagse
      */
@@ -115,15 +117,21 @@
      * Field SERVICE_MAP
      */
     public static final String SERVICE_MAP = "servicemap";
+
+    public static final String OPEARTION_MAP = "operationmap";
     /**
      * Field Available modules
      */
     public static final String MODULE_MAP = "modulemap";
 
+    public static final String MODULE_ENGAMENT = "module_engaging";
+
     public static final String GLOBAL_HANDLERS = "axisconfig";
     public static final String SERVICE_HANDLERS = "serviceHandlers";
 
     public static final String PHASE_LIST = "phaseList";
+
+    public static final String LIST_OPERATIONS_FOR_THE_SERVICE = "listOperations";
 
     public static final String ENGAGE_STATUS = "engagestatus";
 

Modified: webservices/axis/trunk/java/modules/core/src/org/apache/axis/transport/http/AxisServlet.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/modules/core/src/org/apache/axis/transport/http/AxisServlet.java?rev=179567&r1=179566&r2=179567&view=diff
==============================================================================
--- webservices/axis/trunk/java/modules/core/src/org/apache/axis/transport/http/AxisServlet.java (original)
+++ webservices/axis/trunk/java/modules/core/src/org/apache/axis/transport/http/AxisServlet.java Thu Jun  2 02:23:57 2005
@@ -36,6 +36,7 @@
 import javax.xml.stream.XMLStreamReader;
 
 import org.apache.axis.Constants;
+import org.apache.axis.description.OperationDescription;
 import org.apache.axis.addressing.AddressingConstants;
 import org.apache.axis.addressing.EndpointReference;
 import org.apache.axis.context.ConfigurationContext;
@@ -73,7 +74,7 @@
     private static final String LIST_SRVICES_JSP_NAME =
             "listService.jsp";
 
-     private static final String SELECT_SERVICE_JSP_NAME =
+    private static final String SELECT_SERVICE_JSP_NAME =
             "SelectService.jsp";
 
     private static final String ADMIN_JSP_NAME =
@@ -103,9 +104,12 @@
             "listSingleService.jsp";
     private static final String VIEW_GLOBAL_HANDLERS_JSP_NAME =
             "ViewGlobalHandlers.jsp";
-     private static final String VIEW_SERVICE_HANDLERS_JSP_NAME =
+    private static final String VIEW_SERVICE_HANDLERS_JSP_NAME =
             "ViewServiceHandlers.jsp";
 
+    private static final String ENGAGE_TO_OPERATION_JSP_NAME =
+            "enaggingtoanopeartion.jsp";
+
     /**
      * Field allowListServices
      */
@@ -189,9 +193,16 @@
                 && filePart.endsWith(Constants.VIEW_SERVICE_HANDLERS)){
             viewServiceHandlers(httpServletRequest, httpServletResponse);
             return;
+        } else if ((filePart != null)
+                && filePart.endsWith(Constants.LIST_SERVICE_FOR_MODULE_ENGAMNET)){
+            lsitServiceformodules(httpServletRequest, httpServletResponse);
+            return;
+        } else if ((filePart != null)
+                && filePart.endsWith(Constants.LIST_OPERATIONS_FOR_THE_SERVICE)){
+            engageModulesToOpeartion(httpServletRequest, httpServletResponse);
+            return;
         }
 
-
         if (allowListServices
                 && (filePart != null)
                 && filePart.endsWith(Constants.LISTSERVICES)) {
@@ -241,7 +252,7 @@
                                     new QName(Constants.TRANSPORT_HTTP)));
             msgContext.setServerSide(true);
 
-            
+
             String filePart = req.getRequestURL().toString();
             msgContext.setTo(
                     new EndpointReference(AddressingConstants.WSA_TO, filePart));
@@ -254,7 +265,7 @@
                     XMLInputFactory.newInstance().createXMLStreamReader(
                             new BufferedReader(
                                     new InputStreamReader(req.getInputStream())));
-            Utils.configureMessageContextForHTTP(req.getContentType(),soapActionString,msgContext);                                  
+            Utils.configureMessageContextForHTTP(req.getContentType(),soapActionString,msgContext);
 
             //Check for the REST behaviour, if you desire rest beahaviour
             //put a <parameter name="doREST" value="true"/> at the server.xml/client.xml file
@@ -320,10 +331,11 @@
         res.sendRedirect(LIST_SRVICES_JSP_NAME);
     }
 
-     private void selectService(HttpServletRequest req, HttpServletResponse res)
+    private void selectService(HttpServletRequest req, HttpServletResponse res)
             throws IOException {
         HashMap services = engineContext.getAxisConfiguration().getServices();
         req.getSession().setAttribute(Constants.SERVICE_MAP, services);
+        req.getSession().setAttribute(Constants.MODULE_ENGAMENT, null);
         res.sendRedirect(SELECT_SERVICE_JSP_NAME);
     }
     private void adminLogging(HttpServletRequest req, HttpServletResponse res)
@@ -371,6 +383,39 @@
         res.sendRedirect(ENGAGING_MODULE_GLOBALLY_JSP_NAME);
     }
 
+    private void engageModulesToOpeartion(HttpServletRequest req, HttpServletResponse res)
+            throws IOException {
+        HashMap modules =((AxisConfigurationImpl) engineContext.getAxisConfiguration()).getModules();
+        req.getSession().setAttribute(Constants.MODULE_MAP, modules);
+        String moduleName =(String)req.getParameter("modules");
+
+        req.getSession().setAttribute(Constants.ENGAGE_STATUS, null);
+        req.getSession().setAttribute("modules",null);
+
+        String serviceName =(String)req.getParameter("service");
+        if(serviceName != null){
+           req.getSession().setAttribute("service",serviceName);
+        }  else {
+            serviceName = (String)req.getSession().getAttribute("service"); 
+        }
+        req.getSession().setAttribute(Constants.OPEARTION_MAP,engineContext.getAxisConfiguration().
+                getService(new QName(serviceName)).getOperations());
+        req.getSession().setAttribute(Constants.ENGAGE_STATUS, null);
+        String operationName =(String)req.getParameter("operation");
+        if(serviceName !=null && moduleName !=null && operationName != null){
+            try {
+                OperationDescription od = engineContext.getAxisConfiguration().getService(
+                        new QName(serviceName)).getOperation(new QName(operationName));
+                od.engageModule(engineContext.getAxisConfiguration().getModule(new QName(moduleName)));
+                req.getSession().setAttribute(Constants.ENGAGE_STATUS, moduleName +
+                        " module engaged to the operation Successfully");
+            } catch (AxisFault axisFault) {
+                req.getSession().setAttribute(Constants.ENGAGE_STATUS, axisFault.getMessage());
+            }
+        }
+        req.getSession().setAttribute("operation",null);
+        res.sendRedirect(ENGAGE_TO_OPERATION_JSP_NAME);
+    }
     private void engageModulesToService(HttpServletRequest req, HttpServletResponse res)
             throws IOException {
         HashMap modules =((AxisConfigurationImpl) engineContext.getAxisConfiguration()).getModules();
@@ -404,6 +449,14 @@
         res.sendRedirect(LIST_GLOABLLY_ENGAGED_MODULES_JSP_NAME);
     }
 
+    private void lsitServiceformodules(HttpServletRequest req, HttpServletResponse res)
+            throws IOException {
+        HashMap services = engineContext.getAxisConfiguration().getServices();
+        req.getSession().setAttribute(Constants.SERVICE_MAP, services);
+        req.getSession().setAttribute(Constants.MODULE_ENGAMENT, "Yes");
+        res.sendRedirect(SELECT_SERVICE_JSP_NAME);
+    }
+
 
     private void viewGlobalHandlers(HttpServletRequest req, HttpServletResponse res)
             throws IOException {
@@ -412,14 +465,14 @@
     }
 
     private void viewServiceHandlers(HttpServletRequest req, HttpServletResponse res)
-               throws IOException {
-           String service = (String)req.getParameter("service");
+            throws IOException {
+        String service = (String)req.getParameter("service");
         if (service!= null) {
             req.getSession().setAttribute(Constants.SERVICE_HANDLERS,
                     engineContext.getAxisConfiguration().getService(new QName(service)) );
         }
         res.sendRedirect(VIEW_SERVICE_HANDLERS_JSP_NAME);
-       }
+    }