You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ode.apache.org by mr...@apache.org on 2008/07/01 01:10:15 UTC

svn commit: r672956 - in /ode/branches/APACHE_ODE_1.1: ./ axis2-war/src/main/webapp/axis2-web/ axis2/src/main/java/org/apache/ode/axis2/service/ bpel-store/src/main/java/org/apache/ode/store/ utils/src/main/java/org/apache/ode/utils/fs/

Author: mriou
Date: Mon Jun 30 16:10:14 2008
New Revision: 672956

URL: http://svn.apache.org/viewvc?rev=672956&view=rev
Log:
Few improvements to the deployment browsing interface and better integration with the Axis2 webapp (redirecting for service definitions).

Added:
    ode/branches/APACHE_ODE_1.1/axis2-war/src/main/webapp/axis2-web/
    ode/branches/APACHE_ODE_1.1/axis2-war/src/main/webapp/axis2-web/index.jsp
Modified:
    ode/branches/APACHE_ODE_1.1/Rakefile
    ode/branches/APACHE_ODE_1.1/axis2/src/main/java/org/apache/ode/axis2/service/DeploymentBrowser.java
    ode/branches/APACHE_ODE_1.1/bpel-store/src/main/java/org/apache/ode/store/DeploymentUnitDir.java
    ode/branches/APACHE_ODE_1.1/utils/src/main/java/org/apache/ode/utils/fs/FileUtils.java

Modified: ode/branches/APACHE_ODE_1.1/Rakefile
URL: http://svn.apache.org/viewvc/ode/branches/APACHE_ODE_1.1/Rakefile?rev=672956&r1=672955&r2=672956&view=diff
==============================================================================
--- ode/branches/APACHE_ODE_1.1/Rakefile (original)
+++ ode/branches/APACHE_ODE_1.1/Rakefile Mon Jun 30 16:10:14 2008
@@ -44,7 +44,7 @@
   :dbcp             =>"commons-dbcp:commons-dbcp:jar:1.2.1",
   :fileupload       =>"commons-fileupload:commons-fileupload:jar:1.1.1",
   :httpclient       =>"commons-httpclient:commons-httpclient:jar:3.0",
-  :lang             =>"commons-lang:commons-lang:jar:2.1",
+  :lang             =>"commons-lang:commons-lang:jar:2.3",
   :logging          =>"commons-logging:commons-logging:jar:1.1",
   :pool             =>"commons-pool:commons-pool:jar:1.2",
   :primitives       =>"commons-primitives:commons-primitives:jar:1.0"
@@ -132,9 +132,9 @@
   define "axis2" do
     compile.with projects("bpel-api", "bpel-connector", "bpel-dao", "bpel-epr", "bpel-runtime",
       "scheduler-simple", "bpel-schemas", "bpel-store", "utils"),
-      AXIOM, AXIS2_ALL, COMMONS.lang, COMMONS.logging, COMMONS.collections, COMMONS.httpclient, DERBY, GERONIMO.kernel, GERONIMO.transaction,
-      JAVAX.activation, JAVAX.servlet, JAVAX.stream, JAVAX.transaction, JENCKS, WSDL4J, WS_COMMONS.xml_schema,
-      XMLBEANS
+      AXIOM, AXIS2_ALL, COMMONS.lang, COMMONS.logging, COMMONS.collections, COMMONS.httpclient, COMMONS.lang, 
+      DERBY, GERONIMO.kernel, GERONIMO.transaction, JAVAX.activation, JAVAX.servlet, JAVAX.stream, 
+      JAVAX.transaction, JENCKS, WSDL4J, WS_COMMONS.xml_schema, XMLBEANS
 
     test.with project("tools"), AXIOM, JAVAX.javamail, COMMONS.codec, COMMONS.httpclient, XERCES, WOODSTOX
     test.exclude '*'
@@ -161,7 +161,7 @@
       web_inf.include project("bpel-schemas").path_to("src/main/xsd/pmapi.xsd")
     end
     package(:war).tap do |root|
-      root.merge(artifact(AXIS2_WAR)).exclude("WEB-INF/*").exclude("META-INF/*")
+      root.merge(artifact(AXIS2_WAR)).exclude("WEB-INF/*").exclude("META-INF/*").exclude("axis2-web/index.jsp")
     end
 
     task("start"=>[package(:war), jetty.use]) do |task|

Added: ode/branches/APACHE_ODE_1.1/axis2-war/src/main/webapp/axis2-web/index.jsp
URL: http://svn.apache.org/viewvc/ode/branches/APACHE_ODE_1.1/axis2-war/src/main/webapp/axis2-web/index.jsp?rev=672956&view=auto
==============================================================================
--- ode/branches/APACHE_ODE_1.1/axis2-war/src/main/webapp/axis2-web/index.jsp (added)
+++ ode/branches/APACHE_ODE_1.1/axis2-war/src/main/webapp/axis2-web/index.jsp Mon Jun 30 16:10:14 2008
@@ -0,0 +1,57 @@
+<%@ page contentType="text/html;charset=UTF-8" language="java" %>
+<html>
+<%--
+  ~ Licensed to the Apache Software Foundation (ASF) under one
+  ~ or more contributor license agreements. See the NOTICE file
+  ~ distributed with this work for additional information
+  ~ regarding copyright ownership. The ASF licenses this file
+  ~ to you under the Apache License, Version 2.0 (the
+  ~ "License"); you may not use this file except in compliance
+  ~ with the License. You may obtain a copy of the License at
+  ~
+  ~ http://www.apache.org/licenses/LICENSE-2.0
+  ~
+  ~ Unless required by applicable law or agreed to in writing,
+  ~ software distributed under the License is distributed on an
+  ~ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+  ~ KIND, either express or implied. See the License for the
+  ~ specific language governing permissions and limitations
+  ~ under the License.
+  --%>
+  <head>
+    <jsp:include page="include/httpbase.jsp"/>
+    <title>Axis 2 - Home</title>
+    <link href="axis2-web/css/axis-style.css" rel="stylesheet" type="text/css"/>
+  </head>
+
+  <body>
+    <jsp:include page="include/header.inc" />
+    <br/>
+
+    <h1>Welcome!</h1>
+    Welcome to the new generation of Axis. If you can see this page you have
+    successfully deployed the Axis2 Web Application. However, to ensure that Axis2
+    is properly working, we encourage you to click on the validate link.
+    <br/>
+    <ul>
+      <li><a href="deployment/">Services</a>
+        <br/>
+        View the list of all the available processes and services deployed in this server.
+      </li>
+      <li><a href="axis2-web/HappyAxis.jsp">Validate</a>
+        <br/>
+        Check the system to see whether all the required libraries are in place
+        and view the system information.
+      </li>
+      <%--<li><a href="interop.jsp">Do an interop test</a>
+      <br/>
+      You can run Interoperability tests here
+      </li>--%>
+      <li><a href="axis2-admin/">Administration</a>
+        <br/>
+        Console for administering this Axis2 installation.
+      </li>
+    </ul>
+    <jsp:include page="include/footer.inc"/>
+  </body>
+</html>

Modified: ode/branches/APACHE_ODE_1.1/axis2/src/main/java/org/apache/ode/axis2/service/DeploymentBrowser.java
URL: http://svn.apache.org/viewvc/ode/branches/APACHE_ODE_1.1/axis2/src/main/java/org/apache/ode/axis2/service/DeploymentBrowser.java?rev=672956&r1=672955&r2=672956&view=diff
==============================================================================
--- ode/branches/APACHE_ODE_1.1/axis2/src/main/java/org/apache/ode/axis2/service/DeploymentBrowser.java (original)
+++ ode/branches/APACHE_ODE_1.1/axis2/src/main/java/org/apache/ode/axis2/service/DeploymentBrowser.java Mon Jun 30 16:10:14 2008
@@ -2,8 +2,11 @@
 
 import org.apache.ode.store.ProcessStoreImpl;
 import org.apache.ode.bpel.iapi.ProcessConf;
+import org.apache.ode.utils.fs.FileUtils;
 import org.apache.axis2.engine.AxisConfiguration;
 import org.apache.axis2.description.AxisService;
+import org.apache.axis2.description.AxisOperation;
+import org.apache.commons.lang.StringUtils;
 
 import javax.xml.namespace.QName;
 import javax.servlet.http.HttpServletRequest;
@@ -11,6 +14,8 @@
 import javax.servlet.ServletException;
 import java.io.*;
 import java.util.List;
+import java.util.Iterator;
+import java.util.ArrayList;
 
 /**
  * handles a set of URLs all starting with /deployment to publish all files in
@@ -29,9 +34,10 @@
     }
 
     // A fake filter, directly called from the ODEAxisServlet
-    public boolean doFilter(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
-        String requestURI = request.getRequestURI();
-        int deplUri = requestURI.indexOf("/deployment");
+    public boolean doFilter(final HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
+        final String requestURI = request.getRequestURI();
+        final int deplUri = requestURI.indexOf("/deployment");
+        final String root = request.getScheme() + "://" + request.getServerName() + ":" + request.getServerPort() + requestURI.substring(0, deplUri);
         if (deplUri > 0) {
             int offset = requestURI.length() > (deplUri + 11) ? 1 : 0;
             final String[] segments = requestURI.substring(deplUri + 11 + offset).split("/");
@@ -40,7 +46,7 @@
                     public void render(Writer out) throws IOException {
                         out.write("<p><a href=\"bundles/\">Deployed Bundles</a></p>");
                         out.write("<p><a href=\"services/\">Process Services</a></p>");
-                        out.write("<p><a href=\"processes/\">Deployed Processes</a></p>");
+                        out.write("<p><a href=\"processes/\">Process Definitions</a></p>");
                     }
                 });
             } else if (segments.length > 0) {
@@ -49,8 +55,19 @@
                         renderHtml(response, "Services Implemented by Your Processes", new DocBody() {
                             public void render(Writer out) throws IOException {
                                 for (Object serviceName : _config.getServices().keySet())
-                                    if (!"Version".equals(serviceName))
-                                        out.write("<p><a href=\"" + serviceName + "\">" + serviceName + "</a></p>");
+                                    if (!"Version".equals(serviceName)) {
+                                        AxisService service = _config.getService(serviceName.toString());
+
+                                        String url = service.getName();
+                                        if (service.getFileName() != null) url = root + bundleUrlFor(service.getFileName().getFile());
+                                        out.write("<p><a href=\"" + url + "\">" + serviceName + "</a></p>");
+
+                                        out.write("<ul><li>Endpoint: " + (root + "/processes/" + serviceName) + "</li>");
+                                        Iterator iter = service.getOperations();
+                                        ArrayList<String> ops = new ArrayList<String>();
+                                        while (iter.hasNext()) ops.add(((AxisOperation)iter.next()).getName().getLocalPart());
+                                        out.write("<li>Operations: " + StringUtils.join(ops, ", ") + "</li></ul>");
+                                    }
                             }
                         });
                     } else {
@@ -61,6 +78,8 @@
                                 public void render(Writer out) throws IOException {
                                     if ("InstanceManagement".equals(serviceName) || "ProcessManagement".equals(serviceName))
                                         write(out, new File(_appRoot, "pmapi.wsdl").getPath());
+                                    else if (requestURI.indexOf("pmapi.xsd") > 0)
+                                        write(out, new File(_appRoot, "pmapi.xsd").getPath());
                                     else if ("DeploymentService".equals(serviceName))
                                         write(out, new File(_appRoot, "deploy.wsdl").getPath());
                                     else
@@ -79,27 +98,14 @@
                     if (segments.length == 1) {
                         renderHtml(response, "Deployed Processes", new DocBody() {
                             public void render(Writer out) throws IOException {
-                                for (QName process :_store.getProcesses())
-                                    out.write("<p><a href=\"" + process.getLocalPart() + "?ns=" + process.getNamespaceURI() + "\">" + process + "</a></p>");
+                                for (QName process :_store.getProcesses()) {
+                                    String url = root + bundleUrlFor(_store.getProcessConfiguration(process).getBpelDocument());
+                                    String[] nameVer = process.getLocalPart().split("-");
+                                    out.write("<p><a href=\"" + url + "\">" + nameVer[0] + "</a> (v" + nameVer[1] + ")");
+                                    out.write(" - " + process.getNamespaceURI() + "</p>");
+                                }
                             }
                         });
-                    } else {
-                        final String processName = requestURI.substring(deplUri + 12 + 10);
-                        final String processNs = request.getParameter("ns");
-                        final ProcessConf pconf = _store.getProcessConfiguration(new QName(processNs, processName));
-                        if (pconf != null) {
-                            renderXml(response, new DocBody() {
-                                public void render(Writer out) throws IOException {
-                                    write(out, new File(pconf.getBaseURI().toURL().getFile(), pconf.getBpelDocument()).getPath());
-                                }
-                            });
-                        } else {
-                            renderHtml(response, "Process Not Found", new DocBody() {
-                                public void render(Writer out) throws IOException {
-                                    out.write("<p>Couldn't find process " + new QName(processNs, processName) + "</p>");
-                                }
-                            });
-                        }
                     }
                 } else if ("bundles".equals(segments[0])) {
                     if (segments.length == 1) {
@@ -130,7 +136,7 @@
                             List<File> files = _store.getProcessConfiguration(processes.get(0)).getFiles();
                             for (final File file : files) {
                                 String relativePath = requestURI.substring(deplUri + 12 + 9 + segments[1].length());
-                                if (file.getPath().indexOf(relativePath) >= 0) {
+                                if (file.getPath().endsWith(relativePath)) {
                                     renderXml(response, new DocBody() {
                                         public void render(Writer out) throws IOException {
                                             write(out, file.getPath());
@@ -181,6 +187,15 @@
         wsdlReader.close();
     }
 
+    private String bundleUrlFor(String docFile) {
+        List<File> files = FileUtils.listFilesRecursively(_store.getDeployDir(), null);
+        for (final File bundleFile : files) {
+            if (bundleFile.getPath().endsWith(docFile))
+                return "/deployment/bundles/" + bundleFile.getPath().substring(_store.getDeployDir().getPath().length() + 1);
+        }
+        return null;
+    }
+
     private static final String CSS =
             "body {\n" +
                     "    font: 75% Verdana, Helvetica, Arial, sans-serif;\n" +

Modified: ode/branches/APACHE_ODE_1.1/bpel-store/src/main/java/org/apache/ode/store/DeploymentUnitDir.java
URL: http://svn.apache.org/viewvc/ode/branches/APACHE_ODE_1.1/bpel-store/src/main/java/org/apache/ode/store/DeploymentUnitDir.java?rev=672956&r1=672955&r2=672956&view=diff
==============================================================================
--- ode/branches/APACHE_ODE_1.1/bpel-store/src/main/java/org/apache/ode/store/DeploymentUnitDir.java (original)
+++ ode/branches/APACHE_ODE_1.1/bpel-store/src/main/java/org/apache/ode/store/DeploymentUnitDir.java Mon Jun 30 16:10:14 2008
@@ -31,6 +31,7 @@
 import org.apache.ode.bpel.dd.TDeployment.Process;
 import org.apache.ode.bpel.iapi.ContextException;
 import org.apache.ode.bpel.o.Serializer;
+import org.apache.ode.utils.fs.FileUtils;
 import org.apache.xmlbeans.XmlOptions;
 import org.w3c.dom.Node;
 
@@ -119,7 +120,7 @@
      * starts compilation. 
      */
     void compile() {
-        ArrayList<File> bpels = listFilesRecursively(_duDirectory, DeploymentUnitDir._bpelFilter);
+        ArrayList<File> bpels = FileUtils.listFilesRecursively(_duDirectory, DeploymentUnitDir._bpelFilter);
         if (bpels.size() == 0)
             throw new IllegalArgumentException("Directory " + _duDirectory.getName() + " does not contain any process!");
         for (File bpel : bpels) {
@@ -129,7 +130,7 @@
 
     void scan() {
         HashMap<QName, CBPInfo> processes = new HashMap<QName, CBPInfo>();
-        ArrayList<File> cbps = listFilesRecursively(_duDirectory, DeploymentUnitDir._cbpFilter);
+        ArrayList<File> cbps = FileUtils.listFilesRecursively(_duDirectory, DeploymentUnitDir._cbpFilter);
         for (File file : cbps) {
             CBPInfo cbpinfo = loadCBPInfo(file);
             processes.put(cbpinfo.processName, cbpinfo);
@@ -233,7 +234,7 @@
             WSDLReader r = wsdlFactory.newWSDLReader();
             DefaultResourceFinder rf = new DefaultResourceFinder(_duDirectory, _duDirectory);
             URI basedir = _duDirectory.toURI();
-            ArrayList<File> wsdls = listFilesRecursively(_duDirectory, DeploymentUnitDir._wsdlFilter);
+            ArrayList<File> wsdls = FileUtils.listFilesRecursively(_duDirectory, DeploymentUnitDir._wsdlFilter);
             for (File file : wsdls) {
                 URI uri = basedir.relativize(file.toURI());
                 try {
@@ -295,23 +296,6 @@
         return result;
     }
 
-    private ArrayList<File> listFilesRecursively(File root, FileFilter filter) {
-        ArrayList<File> result = new ArrayList<File>();
-        // Filtering the files we're interested in in the current directory
-        File[] select = root.listFiles(filter);
-        for (File file : select) {
-            result.add(file);
-        }
-        // Then we can check the directories
-        File[] all = root.listFiles();
-        for (File file : all) {
-            if (file.isDirectory())
-                result.addAll(listFilesRecursively(file, filter));
-        }
-        return result;
-    }
-
-
     public final class CBPInfo {
         final QName processName;
         final String guid;

Modified: ode/branches/APACHE_ODE_1.1/utils/src/main/java/org/apache/ode/utils/fs/FileUtils.java
URL: http://svn.apache.org/viewvc/ode/branches/APACHE_ODE_1.1/utils/src/main/java/org/apache/ode/utils/fs/FileUtils.java?rev=672956&r1=672955&r2=672956&view=diff
==============================================================================
--- ode/branches/APACHE_ODE_1.1/utils/src/main/java/org/apache/ode/utils/fs/FileUtils.java (original)
+++ ode/branches/APACHE_ODE_1.1/utils/src/main/java/org/apache/ode/utils/fs/FileUtils.java Mon Jun 30 16:10:14 2008
@@ -22,6 +22,7 @@
 import java.io.FileFilter;
 import java.util.ArrayList;
 import java.util.List;
+import java.util.Arrays;
 
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
@@ -138,4 +139,17 @@
         return path.replaceAll(" ", "%20");
     }
 
+    public static ArrayList<File> listFilesRecursively(File root, FileFilter filter) {
+        ArrayList<File> result = new ArrayList<File>();
+        // Filtering the files we're interested in in the current directory
+        File[] select = root.listFiles(filter);
+        result.addAll(Arrays.asList(select));
+        // Then we can check the directories
+        File[] all = root.listFiles();
+        for (File file : all)
+            if (file.isDirectory())
+                result.addAll(listFilesRecursively(file, filter));
+        return result;
+    }
+
 }