juddi-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From alexo...@apache.org
Subject svn commit: r1542441 [2/2] - in /juddi/trunk: ./ juddi-client.net/juddi-client.net/ juddi-client/src/main/java/org/apache/juddi/v3/client/cryptor/ juddi-client/src/main/java/org/apache/juddi/v3/client/transport/ juddi-gui/src/main/java/org/apache/juddi...
Date Sat, 16 Nov 2013 01:22:44 GMT
Modified: juddi/trunk/juddiv3-war/src/main/webapp/admin/stats.jsp
URL: http://svn.apache.org/viewvc/juddi/trunk/juddiv3-war/src/main/webapp/admin/stats.jsp?rev=1542441&r1=1542440&r2=1542441&view=diff
==============================================================================
--- juddi/trunk/juddiv3-war/src/main/webapp/admin/stats.jsp (original)
+++ juddi/trunk/juddiv3-war/src/main/webapp/admin/stats.jsp Sat Nov 16 01:22:44 2013
@@ -30,7 +30,6 @@
 <%@include file="header-top.jsp"%>
 
 <%!
-
     /**
      * Look for the named class in the classpath
      *
@@ -38,37 +37,67 @@
      * @return the location of the named class
      * @throws IOException
      */
-    String lookupClass(String className) 
-      throws IOException 
-    {
-      // load the class (if it exists)
-      Class clazz = null;      
-      try {
-        clazz = Class.forName(className);
-        if (clazz == null)
-          return null;
-      }
-      catch (ClassNotFoundException e) {
-        return null;
-      }
+    String lookupClass(String className)
+            throws IOException {
+        // load the class (if it exists)
+        Class clazz = null;
+        try {
+            clazz = Class.forName(className);
+            if (clazz == null) {
+                return null;
+            }
+        } catch (ClassNotFoundException e) {
+            return null;
+        }
+
+        // class was found, now get it's URL
+        URL url = null;
+        try {
+            url = clazz.getProtectionDomain().getCodeSource().getLocation();
+            if (url == null) {
+                return "";
+            }
+        } catch (Throwable t) {
+            return "";
+        }
+
+        // got the classes URL, now determine it's location
+        String location = getLocation(url);
+        if (location == null) {
+            return "";
+        } else {
+            return location;
+        }
+    }
 
-      // class was found, now get it's URL
-      URL url = null;
-      try {
-        url = clazz.getProtectionDomain().getCodeSource().getLocation();
-        if (url == null)
-          return "";
-      }
-      catch(Throwable t) {
-        return "";
-      }
-      
-      // got the classes URL, now determine it's location
-      String location = getLocation(url);
-      if (location == null) 
-        return "";
-      else
-        return location;   
+    String lookupResourceWrapper(String resourceName) {
+
+        String x = lookupResource(resourceName);
+        if (x == null) {
+            x = lookupResource("META-INF/" + resourceName);
+        }
+        if (x == null) {
+            x = lookupResource("/META-INF/" + resourceName);
+        }
+        if (x == null) {
+            x = lookupResource("WEB-INF/" + resourceName);
+        }
+        if (x == null) {
+            x = lookupResource("/WEB-INF/" + resourceName);
+        }
+        if (x == null) {
+            x = lookupResource("/WEB-INF/classes/" + resourceName);
+        }
+        if (x == null) {
+            x = lookupResource("WEB-INF/classes/" + resourceName);
+        }
+        if (x == null) {
+            x = lookupResource("/WEB-INF/classes/META-INF" + resourceName);
+        }
+        if (x == null) {
+            x = lookupResource("WEB-INF/classes/META-INF" + resourceName);
+        }
+        return x;
     }
 
     /**
@@ -77,73 +106,59 @@
      * @param resourceName
      * @return true if the file was found
      */
-    String lookupResource(String resourceName) 
-    {
-      URL url = null;
-      ClassLoader classLoader = null;
-
-      classLoader = this.getClass().getClassLoader();
-      if (classLoader != null) 
-      {
-        url = classLoader.getResource(resourceName);
-        if (url != null) {
-          return getLocation(url);
-        }
-      }
-      else      
-      {
-        classLoader = System.class.getClassLoader(); 
-        if (classLoader != null) 
-        {
-          url = classLoader.getResource(resourceName);
-          if (url != null) {
-            return getLocation(url);
-          }
-        }
-        else
-                       {
-            //try to the thread context loader
+    String lookupResource(String resourceName) {
+        URL url = null;
+        ClassLoader classLoader = null;
+
+        classLoader = this.getClass().getClassLoader();
+        if (classLoader != null) {
+            url = classLoader.getResource(resourceName);
+            if (url != null) {
+                return getLocation(url);
+            }
+        } else {
+            classLoader = System.class.getClassLoader();
+            if (classLoader != null) {
+                url = classLoader.getResource(resourceName);
+                if (url != null) {
+                    return getLocation(url);
+                }
+            } else {
+                //try to the thread context loader
+            }
         }
-      }
-
-      return null;
+        try {
+            return this.getServletContext().getResource(resourceName).toExternalForm();
+        } catch (Exception ex) {
+        }
+        return null;
     }
 
     /**
      * Determine the location of the Java class.
      *
      * @param clazz
-     * @return the file path to the jar file or class 
-     *  file where the class was located.
+     * @return the file path to the jar file or class file where the class was
+     * located.
      */
-    String getLocation(URL url)
-    {
-      try
-      {
-        String location = url.toString();
-        if (location.startsWith("jar:file:/"))
-        {
-          File file = new File(url.getFile());
-          return file.getPath().substring(6);
-        }
-        else if (location.startsWith("jar")) 
-        {
-          url = ((JarURLConnection)url.openConnection()).getJarFileURL();
-          return url.toString();
-        }
-        else if (location.startsWith("file")) 
-        {
-          File file = new File(url.getFile());
-          return file.getAbsolutePath();
-        }
-        else
-        {
-          return url.toString();
+    String getLocation(URL url) {
+        try {
+            String location = url.toString();
+            if (location.startsWith("jar:file:/")) {
+                File file = new File(url.getFile());
+                return file.getPath().substring(6);
+            } else if (location.startsWith("jar")) {
+                url = ((JarURLConnection) url.openConnection()).getJarFileURL();
+                return url.toString();
+            } else if (location.startsWith("file")) {
+                File file = new File(url.getFile());
+                return file.getAbsolutePath();
+            } else {
+                return url.toString();
+            }
+        } catch (Throwable t) {
+            return null;
         }
-      } 
-      catch (Throwable t) { 
-        return null;
-      }
     }
 %>
 
@@ -161,10 +176,10 @@
 
         <div class="span12">
             <script type="text/javascript">
-            jQuery(document).ready(function ($) {
-                $('#myTab').tab();
-            });
-                 
+                jQuery(document).ready(function($) {
+                    $('#myTab').tab();
+                });
+
             </script>
 
 
@@ -182,218 +197,184 @@
 
                     <h4>jUDDI Version Information</h4>
 
-                    <b>jUDDI Version:</b> <%= org.apache.juddi.config.Release.getRegistryVersion()
%><br>
-                    <b>UDDI Version:</b>  <%= org.apache.juddi.config.Release.getUDDIVersion()
%><br>
+                    <b>jUDDI Version:</b> <%= org.apache.juddi.config.Release.getRegistryVersion()%><br>
+                    <b>UDDI Version:</b>  <%= org.apache.juddi.config.Release.getUDDIVersion()%><br>
 
 
                     <h4>jUDDI Dependencies: Class Files &amp; Libraries</h4>
                     <pre><%
-                                                    //creates the schema if not there
-                                                 //  RegistryEngine registry = RegistryServlet.getRegistry();
-                                                  //  registry.init();
-    
-                                                    String[] classArray = {
-                                                      "org.apache.juddi.servlets.RegistryServlet",
-                                                      "org.apache.juddi.servlets.NotifyServlet",
-                                                      "org.apache.axis.transport.http.AxisServlet",
-                                                      "org.springframework.web.context.ContextLoaderListener",
-                                                      "org.apache.cxf.transport.servlet.CXFServlet",
-                                                      "org.apache.commons.discovery.Resource",
-                                                      "org.apache.commons.logging.Log",
-                                                      "org.apache.log4j.Layout",
-                                                      "javax.xml.soap.SOAPMessage",
-                                                    //not used anymore  "javax.xml.rpc.Service",
-                                                      "com.ibm.wsdl.factory.WSDLFactoryImpl",
-                                                      "javax.xml.parsers.SAXParserFactory"
-                                                    };
-    
-                                                    for (int i=0; i<classArray.length;
i++)
-                                                    {
-                                                      out.write("<b>Looking for</b>:
"+classArray[i]+"<br>");
-      
-                                                      String result = lookupClass(classArray[i]);
-                                                      if (result == null)
-                                                      {
-                                                        out.write("<font color=\"red\">-Not
Found</font><br>");
-                                                      }
-                                                      else if (result.length() == 0)
-                                                      {        
-                                                        out.write("<font color=\"blue\">+Found
in an unknown location</font><br>");
-                                                      }
-                                                      else
-                                                      {        
-                                                        out.write("<font color=\"green\">+Found
in: "+ result +"</font><br>");
-                                                      }
-                                                    }   
+                        //creates the schema if not there
+                        //  RegistryEngine registry = RegistryServlet.getRegistry();
+                        //  registry.init();
+
+                        String[] classArray = {
+                            "org.apache.juddi.servlets.RegistryServlet",
+                            "org.apache.juddi.servlets.NotifyServlet",
+                            "org.apache.axis.transport.http.AxisServlet",
+                            "org.springframework.web.context.ContextLoaderListener",
+                            "org.apache.cxf.transport.servlet.CXFServlet",
+                            "org.apache.commons.discovery.Resource",
+                            "org.apache.commons.logging.Log",
+                            "org.apache.log4j.Layout",
+                            "javax.xml.soap.SOAPMessage",
+                            //not used anymore  "javax.xml.rpc.Service",
+                            "com.ibm.wsdl.factory.WSDLFactoryImpl",
+                            "javax.xml.parsers.SAXParserFactory"
+                        };
+
+                        for (int i = 0; i < classArray.length; i++) {
+                            out.write("<b>Looking for</b>: " + classArray[i]
+ "<br>");
+
+                            String result = lookupClass(classArray[i]);
+                            if (result == null) {
+                                out.write("<font color=\"red\">-Not Found</font><br>");
+                            } else if (result.length() == 0) {
+                                out.write("<font color=\"blue\">+Found in an unknown
location</font><br>");
+                            } else {
+                                out.write("<font color=\"green\">+Found in: " + result
+ "</font><br>");
+                            }
+                        }
                         %></pre>
 
                     <h4>jUDDI Dependencies: Resource &amp; Properties Files</h4>
                     <pre><%
-                                                    String[] resourceArray = {
-                                                      "log4j.xml",
-                                                      "juddiv3.properties",
-                                                      "context.xml",
-                                                      "beans.xml",
-                                                      "persistence.xml"
-                                                    };
-    
-                                                    for (int i=0; i<resourceArray.length;
i++)
-                                                    {
-                                                      out.write("<b>Looking for</b>:
"+resourceArray[i]+"<br>");
-      
-                                                      String result = lookupResource(resourceArray[i]);
-                                                      if (result == null)
-                                                      {
-                                                        out.write("<font color=\"red\">-Not
Found</font><br>");
-                                                      }
-                                                      else if (result.length() == 0)
-                                                      {        
-                                                        out.write("<font color=\"blue\">+Found
in an unknown location</font><br>");
-                                                      }
-                                                      else
-                                                      {        
-                                                        out.write("<font color=\"green\">+Found
in: "+ result +"</font><br>");
-                                                      }
-                                                    }   
+                        String[] resourceArray = {
+                            "log4j.properties",
+                            "juddiv3.xml",
+                            "uddi.xml",
+                            "commons-logging.properties",
+                            "config.properties",
+                            "context.xml",
+                            "beans.xml",
+                            "persistence.xml"
+                        };
+
+                        for (int i = 0; i < resourceArray.length; i++) {
+                            out.write("<b>Looking for</b>: " + resourceArray[i]
+ "<br>");
+
+                            String result = lookupResourceWrapper(resourceArray[i]);
+                            if (result == null) {
+                                out.write("<font color=\"red\">-Not Found</font><br>");
+                            } else if (result.length() == 0) {
+                                out.write("<font color=\"blue\">+Found in an unknown
location</font><br>");
+                            } else {
+                                out.write("<font color=\"green\">+Found in: " + result
+ "</font><br>");
+                            }
+                        }
                         %></pre>
 
                     <h4>jUDDI DataSource Validation</h4>
                     <pre><%
-                                                  String dsname = null;
-                                                  Context ctx = null;
-                                                  DataSource ds = null;
-                                                  Connection conn = null;
-                                                  String sql = "SELECT COUNT(*) FROM PUBLISHER";
-  
-                                                  try
-                                                  {
-                                                    dsname = request.getParameter("dsname");
-                                                    if ((dsname == null) || (dsname.trim().length()
== 0)) {
-                                                      dsname = "java:comp/env/jdbc/juddiDB";
-                                                    } else {
-                                                      dsname = StringEscapeUtils.escapeXml(dsname);

-                                                    }
-    
-                                                    ctx = new InitialContext();
-                                                    if (ctx == null )
-                                                      throw new Exception("No Context");
-  
-                                                    out.print("<font color=\"green\">");
-                                                    out.print("+ Got a JNDI Context!");
-                                                    out.println("</font>");
-                                                  }
-                                                  catch(Exception ex)
-                                                  {
-                                                    out.print("<font color=\"red\">");
-                                                    out.print("- No JNDI Context ("+ex.getMessage()+")");
-                                                    out.println("</font>");
-                                                  }
-
-                                                  try
-                                                  {
-                                                    ds = (DataSource)ctx.lookup(dsname);
-                                                    if (ds == null)
-                                                      throw new Exception("No Context");
-
-                                                    out.print("<font color=\"green\">");
-                                                    out.print("+ Got a JDBC DataSource (dsname="+dsname+")");
-                                                    out.println("</font>");
-                                                  }
-                                                  catch(Exception ex)
-                                                  {
-                                                    out.print("<font color=\"red\">");
-                                                    out.print("- No '"+dsname+"' DataSource
Located("+ex.getMessage()+")");
-                                                    out.println("</font>");
-                                                  }
-  
-                                                  try
-                                                  {
-                                                    conn = ds.getConnection();
-                                                    if (conn == null)
-                                                    throw new Exception("No Connection (conn=null)");
 
-
-                                                    out.print("<font color=\"green\">");
-                                                    out.print("+ Got a JDBC Connection!");
-                                                    out.println("</font>");
-                                                  }
-                                                  catch(Exception ex)
-                                                  {
-                                                    out.print("<font color=\"red\">");
-                                                    out.print("- DB connection was not acquired.
("+ex.getMessage()+")");
-                                                    out.println("</font>");
-                                                  }
-  
-                                                  try
-                                                  {
-                                                    Statement stmt = conn.createStatement();
-                                                    ResultSet rs = stmt.executeQuery(sql);
-
-                                                    out.print("<font color=\"green\">");
-                                                    out.print("+ "+sql+" = ");
-                                                    if (rs.next())
-                                                      out.print(rs.getString(1));
-                                                    out.println("</font>");
-
-                                                    conn.close();
-                                                  }
-                                                  catch (Exception ex)
-                                                  {
-                                                    out.print("<font color=\"red\">");
-                                                    out.print("- "+sql+" failed ("+ex.getMessage()+")");
-                                                    out.println("</font>");
-                                                  }
+                        String dsname = null;
+                        Context ctx = null;
+                        DataSource ds = null;
+                        Connection conn = null;
+                        String sql = "SELECT COUNT(*) FROM PUBLISHER";
+
+                        try {
+                            dsname = request.getParameter("dsname");
+                            
+                            if ((dsname == null) || (dsname.trim().length() == 0)) {
+                                dsname = "java:comp/env/jdbc/juddiDB";
+                            } else {
+                                dsname = StringEscapeUtils.escapeXml(dsname);
+                            }
+
+                            ctx = new InitialContext();
+                            if (ctx == null) {
+                                throw new Exception("No Context");
+                            }
+
+                            out.print("<font color=\"green\">");
+                            out.print("+ Got a JNDI Context!");
+                            out.println("</font>");
+                        } catch (Exception ex) {
+                            out.print("<font color=\"red\">");
+                            out.print("- No JNDI Context (" + ex.getMessage() + ")");
+                            out.println("</font>");
+                        }
+
+                        try {
+                            Context envContext  = (Context)ctx.lookup("java:/comp/env");
+                            ds = (DataSource)envContext.lookup("jdbc/juddiDB");
+                            
+                            if (ds == null) {
+                                throw new Exception("No Context");
+                            }
+
+                            out.print("<font color=\"green\">");
+                            out.print("+ Got a JDBC DataSource (dsname=" + dsname + ")");
+                            out.println("</font>");
+                        } catch (Exception ex) {
+                            out.print("<font color=\"red\">");
+                            out.print("- No '" + dsname + "' DataSource Located(" + ex.getMessage()
+ ")");
+                            out.println("</font>");
+                        }
+
+                        try {
+                            conn = ds.getConnection();
+                            if (conn == null) {
+                                throw new Exception("No Connection (conn=null)");
+                            }
+
+                            out.print("<font color=\"green\">");
+                            out.print("+ Got a JDBC Connection!");
+                            out.println("</font>");
+                        } catch (Exception ex) {
+                            out.print("<font color=\"red\">");
+                            out.print("- DB connection was not acquired. (" + ex.getMessage()
+ ")");
+                            out.println("</font>");
+                        }
+
+                        try {
+                            Statement stmt = conn.createStatement();
+                            ResultSet rs = stmt.executeQuery(sql);
+
+                            out.print("<font color=\"green\">");
+                            out.print("+ " + sql + " = ");
+                            if (rs.next()) {
+                                out.print(rs.getString(1));
+                            }
+                            out.println("</font>");
+
+                            conn.close();
+                        } catch (Exception ex) {
+                            out.print("<font color=\"red\">");
+                            out.print("- " + sql + " failed (" + ex.getMessage() + ")");
+                            out.println("</font>");
+                        }
                         %></pre>
 
 
                     <h4>System Properties</h4>
                     <pre><%
-                                                  try
-                                                  {
-                                                    Properties sysProps = System.getProperties();
-                                                    SortedSet sortedProperties = new TreeSet(sysProps.keySet());

-                                                    for (Iterator keys = sortedProperties.iterator();
keys.hasNext();)
-                                                    {
-                                                      String key = (String)keys.next();
-                                                      out.println("<b>"+key + "</b>:
" + sysProps.getProperty(key));
-                                                    }
-                                                  }
-                                                  catch(Exception e)
-                                                  {
-                                                    e.printStackTrace();
-                                                  }
+                        try {
+                            Properties sysProps = System.getProperties();
+                            SortedSet sortedProperties = new TreeSet(sysProps.keySet());
+                            for (Iterator keys = sortedProperties.iterator(); keys.hasNext();)
{
+                                String key = (String) keys.next();
+                                out.println("<b>" + key + "</b>: " + sysProps.getProperty(key));
+                            }
+                        } catch (Exception e) {
+                            e.printStackTrace();
+                        }
                         %></pre>
 
                     <h4>
                         Platform</h4>
-                    <pre><%= getServletConfig().getServletContext().getServerInfo()
%></pre>
+                    <pre><%= getServletConfig().getServletContext().getServerInfo()%></pre>
 
                 </div>
                 <div class="tab-pane" id="stats"><img src="img/bigrollergreen.gif"></div>
 
             </div>
 
-
-
-
-
-
-
-
-
             <script type="text/javascript">
                 $.getJSON('mbeans.jsp', function(data) {
                     var items = [];
-
- 
- 
                     items.push("<table class=\"table table-hover\">");
                     $.each(data, function(key, val) {
-                        
-                        
-                        
-                        items.push('<tr><td>' +key +"</td><td>"+
val+ '</</td></tr>');    
-                        
-                        
+                        items.push('<tr><td>' + key + "</td><td>"
+ val + '</</td></tr>');
                     });
                     items.push("</table>");
                     $("#stats").html(items.join(' '));

Modified: juddi/trunk/pom.xml
URL: http://svn.apache.org/viewvc/juddi/trunk/pom.xml?rev=1542441&r1=1542440&r2=1542441&view=diff
==============================================================================
--- juddi/trunk/pom.xml (original)
+++ juddi/trunk/pom.xml Sat Nov 16 01:22:44 2013
@@ -39,7 +39,7 @@
         <sourceReleaseAssemblyDescriptor>source-release</sourceReleaseAssemblyDescriptor>
 	    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
 	    <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
-	    <cxf.version>2.7.5</cxf.version>
+	    <cxf.version>2.7.7</cxf.version>
 	    <springframework.version>3.2.2.RELEASE</springframework.version>
     </properties>
 	



---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@juddi.apache.org
For additional commands, e-mail: commits-help@juddi.apache.org


Mime
View raw message