You are viewing a plain text version of this content. The canonical link for it is here.
Posted to axis-cvs@ws.apache.org by de...@apache.org on 2005/05/31 10:50:57 UTC

svn commit: r179194 - in /webservices/axis/trunk/java/modules/core: conf/ html/ src/org/apache/axis/ src/org/apache/axis/description/ src/org/apache/axis/phaseresolver/ src/org/apache/axis/transport/http/

Author: deepal
Date: Tue May 31 01:50:55 2005
New Revision: 179194

URL: http://svn.apache.org/viewcvs?rev=179194&view=rev
Log:
module angagment through admin jsps

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/admin.jsp
    webservices/axis/trunk/java/modules/core/html/engagingtoaservice.jsp
    webservices/axis/trunk/java/modules/core/html/listService.jsp
    webservices/axis/trunk/java/modules/core/src/org/apache/axis/Constants.java
    webservices/axis/trunk/java/modules/core/src/org/apache/axis/description/OperationDescription.java
    webservices/axis/trunk/java/modules/core/src/org/apache/axis/description/ServiceDescription.java
    webservices/axis/trunk/java/modules/core/src/org/apache/axis/phaseresolver/PhaseResolver.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=179194&r1=179193&r2=179194&view=diff
==============================================================================
--- webservices/axis/trunk/java/modules/core/conf/web.xml (original)
+++ webservices/axis/trunk/java/modules/core/conf/web.xml Tue May 31 01:50:55 2005
@@ -50,6 +50,10 @@
         <servlet-name>AxisServlet</servlet-name>
         <url-pattern>/engagingglobally</url-pattern>
     </servlet-mapping>
+     <servlet-mapping>
+        <servlet-name>AxisServlet</servlet-name>
+        <url-pattern>/engageToService</url-pattern>
+    </servlet-mapping>
     <servlet-mapping>
         <servlet-name>AxisServlet</servlet-name>
         <url-pattern>/services/*</url-pattern>

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=179194&r1=179193&r2=179194&view=diff
==============================================================================
--- webservices/axis/trunk/java/modules/core/html/LeftFrame.jsp (original)
+++ webservices/axis/trunk/java/modules/core/html/LeftFrame.jsp Tue May 31 01:50:55 2005
@@ -34,7 +34,7 @@
 <p>Enage Module</p>
 <blockquote>
   <p><a href="engagingglobally" target="mainFrame">Gloabally</a></p>
-  <p><a href="engagingtoaservice.jsp" target="mainFrame">To A service</a></p>
+  <p><a href="engageToService" target="mainFrame">To A service</a></p>
   <p><a href="enaggingtoanopeartion.jsp" target="mainFrame">To an Operation</a></p>
   <p>&nbsp;</p>
 </blockquote>

Modified: webservices/axis/trunk/java/modules/core/html/admin.jsp
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/modules/core/html/admin.jsp?rev=179194&r1=179193&r2=179194&view=diff
==============================================================================
--- webservices/axis/trunk/java/modules/core/html/admin.jsp (original)
+++ webservices/axis/trunk/java/modules/core/html/admin.jsp Tue May 31 01:50:55 2005
@@ -18,7 +18,7 @@
             */
         %>
         <head>
-<title>Axis2cAdministrations Page</title>
+<title>Axis2 :: Administrations Page</title>
 </head>
 
 <frameset rows="80,*" cols="*" frameborder="NO" border="0" framespacing="0">

Modified: webservices/axis/trunk/java/modules/core/html/engagingtoaservice.jsp
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/modules/core/html/engagingtoaservice.jsp?rev=179194&r1=179193&r2=179194&view=diff
==============================================================================
--- webservices/axis/trunk/java/modules/core/html/engagingtoaservice.jsp (original)
+++ webservices/axis/trunk/java/modules/core/html/engagingtoaservice.jsp Tue May 31 01:50:55 2005
@@ -1,9 +1,15 @@
-<%@ 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.*,
+                                                                             java.util.HashMap,
+                                                                             org.apache.axis.Constants,
+                                                                             java.util.Collection,
+                                                                             java.util.Iterator,
+                                                                             org.apache.axis.description.ModuleDescription,
+                                                                             org.apache.axis.description.ServiceDescription" errorPage="" %>
 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
 <html>
 <head>
 <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
-<title>Untitled Document</title>
+<title>Engaging Module to a Service</title>
 <style type="text/css">
 <!--
 body {
@@ -13,6 +19,96 @@
 </style></head>
 
 <body>
-Engaging to a service 
+<%
+    String status = (String)request.getSession().getAttribute(Constants.ENGAGE_STATUS);
+%>
+<form method="get" name="engaginModule" action="engageToService">
+<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="service">
+            <%
+                HashMap services = (HashMap)request.getSession().getAttribute(Constants.SERVICE_MAP);
+                Collection serviceCol =  services.values();
+                for (Iterator iterator = serviceCol.iterator(); iterator.hasNext();) {
+                    ServiceDescription axisService = (ServiceDescription)iterator.next();
+                    String servicName = axisService.getName().getLocalPart();
+            %> <option  align="left" value="<%=servicName%>"><%=servicName%></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/html/listService.jsp
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/modules/core/html/listService.jsp?rev=179194&r1=179193&r2=179194&view=diff
==============================================================================
--- webservices/axis/trunk/java/modules/core/html/listService.jsp (original)
+++ webservices/axis/trunk/java/modules/core/html/listService.jsp Tue May 31 01:50:55 2005
@@ -48,16 +48,18 @@
                  String moduleName = "";
                  if(engagdeModules.size() >0){
            %>
-           <i>Engaged Modules</i>
+           <i>Engaged Modules for the service</i>
                 <%
-                     for (Iterator iterator1 = engagdeModules.iterator(); iterator1.hasNext();) {
-                         ModuleDescription description = (ModuleDescription) iterator1.next();
+                     for (Iterator iteratorm = engagdeModules.iterator(); iteratorm.hasNext();) {
+                         ModuleDescription description = (ModuleDescription) iteratorm.next();
                          moduleName = description.getName().getLocalPart();
-                %><li><%=moduleName%></li><%
+                %><li><%=moduleName%></li>
+                         <br>
+                         <%
                      }
                  }
                  if (operationsList.size() > 0) {
-                %><i>Available operations</i><%
+                %><br><i>Available operations</i><%
                  } else {
                 %><i> There are no any opeartions specified</i><%
                  }
@@ -65,17 +67,19 @@
                  for (Iterator iterator1 = operationsList.iterator(); iterator1.hasNext();) {
                      OperationDescription axisOperation = (OperationDescription) iterator1.next();
                 %><li><%=axisOperation.getName().getLocalPart()%></li><%
-                     engagdeModules = axisService.getEngagedModules();
+                     engagdeModules = null;
+                     engagdeModules = axisOperation.getModules();
                      moduleName = "";
                      if(engagdeModules.size() >0){
                 %>
-                <i>Engaged Modules</i>
+                <br><i>Engaged Modules for the opeartion</i><ul>
                 <%
-                         for (Iterator iterator2 = engagdeModules.iterator(); iterator1.hasNext();) {
+                         for (Iterator iterator2 = engagdeModules.iterator(); iterator2.hasNext();) {
                              ModuleDescription description = (ModuleDescription) iterator2.next();
                              moduleName = description.getName().getLocalPart();
-                %><li><%=moduleName%></li><%
+                %><li><%=moduleName%></li><br><%
                          }
+                         %></ul><%
                      }
 
                  }

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=179194&r1=179193&r2=179194&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 Tue May 31 01:50:55 2005
@@ -103,6 +103,7 @@
     public static final String LIST_PHASES = "listPhases";
 
     public static final String ENGAGE_GLOBAL_MODULE = "engagingglobally";
+    public static final String ENGAGE_MODULE_TO_SERVICE = "engageToService";
 
     /**
      * Field SERVICE_MAP

Modified: webservices/axis/trunk/java/modules/core/src/org/apache/axis/description/OperationDescription.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/modules/core/src/org/apache/axis/description/OperationDescription.java?rev=179194&r1=179193&r2=179194&view=diff
==============================================================================
--- webservices/axis/trunk/java/modules/core/src/org/apache/axis/description/OperationDescription.java (original)
+++ webservices/axis/trunk/java/modules/core/src/org/apache/axis/description/OperationDescription.java Tue May 31 01:50:55 2005
@@ -82,7 +82,7 @@
         collectionModule.add(moduleref);
     }
 
-    public void addToEngageModuleList(QName moduleName){
+    public void addToEngageModuleList(ModuleDescription moduleName){
         Collection collectionModule = (Collection) this.getComponentProperty(MODULEREF_KEY);
         collectionModule.add(moduleName);
     }

Modified: webservices/axis/trunk/java/modules/core/src/org/apache/axis/description/ServiceDescription.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/modules/core/src/org/apache/axis/description/ServiceDescription.java?rev=179194&r1=179193&r2=179194&view=diff
==============================================================================
--- webservices/axis/trunk/java/modules/core/src/org/apache/axis/description/ServiceDescription.java (original)
+++ webservices/axis/trunk/java/modules/core/src/org/apache/axis/description/ServiceDescription.java Tue May 31 01:50:55 2005
@@ -92,7 +92,7 @@
         collectionModule.add(moduleref);
     }
 
-    public void addToEngagModuleList(QName moduleName){
+    public void addToEngagModuleList(ModuleDescription moduleName){
         Collection collectionModule = (Collection) this.getComponentProperty(MODULEREF_KEY);
         collectionModule.add(moduleName);
     }

Modified: webservices/axis/trunk/java/modules/core/src/org/apache/axis/phaseresolver/PhaseResolver.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/modules/core/src/org/apache/axis/phaseresolver/PhaseResolver.java?rev=179194&r1=179193&r2=179194&view=diff
==============================================================================
--- webservices/axis/trunk/java/modules/core/src/org/apache/axis/phaseresolver/PhaseResolver.java (original)
+++ webservices/axis/trunk/java/modules/core/src/org/apache/axis/phaseresolver/PhaseResolver.java Tue May 31 01:50:55 2005
@@ -135,7 +135,7 @@
                             break;
                         }
                 }
-                axisService.addToEngagModuleList(modulename);
+                axisService.addToEngagModuleList(module);
             } else {
                 throw new PhaseException("referance to invalid module " + modulename.getLocalPart() + " by server.xml");
             }
@@ -329,7 +329,7 @@
         for (Iterator iterator = serviceCol.iterator(); iterator.hasNext();) {
             ServiceDescription serviceDescription = (ServiceDescription) iterator.next();
             engageModuleToServiceFromGlobal(serviceDescription, module);
-            serviceDescription.addToEngagModuleList(module.getName());
+            serviceDescription.addToEngagModuleList(module);
         }
     }
 
@@ -343,8 +343,20 @@
     public void engageModuleToServiceFromGlobal(ServiceDescription service, ModuleDescription module) throws PhaseException {
         HashMap opeartions = service.getOperations();
         Collection opCol = opeartions.values();
+        boolean engaged = false;
         for (Iterator iterator = opCol.iterator(); iterator.hasNext();) {
             OperationDescription opDesc = (OperationDescription) iterator.next();
+            Collection modules =  opDesc.getModules();
+            for (Iterator iterator1 = modules.iterator(); iterator1.hasNext();) {
+                ModuleDescription description = (ModuleDescription) iterator1.next();
+                if(description.getName().equals(module.getName())){
+                    engaged = true;
+                    break;
+                }
+            }
+            if (engaged) {
+               continue;
+            }
             Flow flow = null;
             for (int type = 1; type < 5; type++) {
                 switch (type) {
@@ -405,7 +417,7 @@
                     }
                 }
             }
-            opDesc.addToEngageModuleList(module.getName());
+            opDesc.addToEngageModuleList(module);
         }
     }
 
@@ -483,10 +495,21 @@
     public void engageModuleToService(ServiceDescription service, ModuleDescription module) throws PhaseException {
         HashMap opeartions = service.getOperations();
         Collection opCol = opeartions.values();
+        boolean engaged = false;
         for (Iterator iterator = opCol.iterator(); iterator.hasNext();) {
             OperationDescription opDesc = (OperationDescription) iterator.next();
-            engageModuleToOperation(opDesc,module);
-            opDesc.addToEngageModuleList(module.getName());
+           Collection modules =  opDesc.getModules();
+            for (Iterator iterator1 = modules.iterator(); iterator1.hasNext();) {
+                ModuleDescription description = (ModuleDescription) iterator1.next();
+                if(description.getName().equals(module.getName())){
+                    engaged = true;
+                    break;
+                }
+            }
+            if (!engaged) {
+                engageModuleToOperation(opDesc,module);
+                opDesc.addToEngageModuleList(module);
+            }
         }
     }
 

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=179194&r1=179193&r2=179194&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 Tue May 31 01:50:55 2005
@@ -87,12 +87,16 @@
     private static final String ENGAGING_MODULE_GLOBALLY_JSP_NAME =
             "engagingglobally.jsp";
 
+    private static final String ENGAGING_MODULE_TO_SERVICE_JSP_NAME =
+            "engagingtoaservice.jsp";
+
     /**
      * Field LIST_SINGLE_SERVICE_JSP_NAME
      */
     private static final String LIST_SINGLE_SERVICE_JSP_NAME =
             "listSingleService.jsp";
 
+
     /**
      * Field allowListServices
      */
@@ -155,6 +159,11 @@
             engageModulesGlobally(httpServletRequest, httpServletResponse);
             return;
         }
+        else if ((filePart != null)
+                && filePart.endsWith(Constants.ENGAGE_MODULE_TO_SERVICE)){
+            engageModulesToService(httpServletRequest, httpServletResponse);
+            return;
+        }
 
         if (allowListServices
                 && (filePart != null)
@@ -304,6 +313,32 @@
         }
         req.getSession().setAttribute("modules",null);
         res.sendRedirect(ENGAGING_MODULE_GLOBALLY_JSP_NAME);
+    }
+
+    private void engageModulesToService(HttpServletRequest req, HttpServletResponse res)
+            throws IOException {
+        HashMap modules =((AxisConfigurationImpl) engineContext.getAxisConfiguration()).getModules();
+        req.getSession().setAttribute(Constants.MODULE_MAP, modules);
+         HashMap services = engineContext.getAxisConfiguration().getServices();
+        req.getSession().setAttribute(Constants.SERVICE_MAP, services);
+        String moduleName =(String)req.getParameter("modules");
+        req.getSession().setAttribute(Constants.ENGAGE_STATUS, null);
+        req.getSession().setAttribute("modules",null);
+        String serviceName =(String)req.getParameter("service");
+        req.getSession().setAttribute(Constants.ENGAGE_STATUS, null);
+        if(serviceName !=null && moduleName !=null){
+            try {
+
+                engineContext.getAxisConfiguration().getService(new QName(serviceName)).engageModule(
+                        engineContext.getAxisConfiguration().getModule(new QName(moduleName)));
+                req.getSession().setAttribute(Constants.ENGAGE_STATUS, moduleName +
+                        " module engaged to the service Successfully");
+            } catch (AxisFault axisFault) {
+                req.getSession().setAttribute(Constants.ENGAGE_STATUS, axisFault.getMessage());
+            }
+        }
+        req.getSession().setAttribute("service",null);
+        res.sendRedirect(ENGAGING_MODULE_TO_SERVICE_JSP_NAME);
     }
 
     private void listGloballyModules(HttpServletRequest req, HttpServletResponse res)