<%-- Document : index Created on : Feb 23, 2013, 2:05:35 PM Author : Alex O'Ree --%> <%@page import="javax.persistence.EntityTransaction"%> <%@page import="org.uddi.api_v3.BusinessEntity"%> <%@page import="org.apache.juddi.config.Property"%> <%@page import="org.apache.juddi.config.AppConfig"%> <%@page import="javax.persistence.EntityManager"%> <%@page import="org.apache.juddi.config.PersistenceManager"%> <%@page import="org.apache.commons.lang.StringEscapeUtils"%> <%@page import="org.apache.juddi.servlets.RegistryServlet"%> <%@page import="java.util.SortedSet"%> <%@page import="java.util.Properties"%> <%@ page import="java.io.File, java.io.IOException, java.net.URL, java.net.JarURLConnection, java.sql.Connection, java.sql.ResultSet, java.sql.Statement, java.util.Properties, java.util.Iterator, java.util.SortedSet, java.util.TreeSet, javax.naming.Context, javax.naming.InitialContext, javax.sql.DataSource" %> <%@page contentType="text/html" pageEncoding="UTF-8"%> <%@include file="header-top.jsp"%> <%! /** * Look for the named class in the classpath * * @param name of the class to lookup * @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; } // 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; } /** * Look for the named resource or properties file. * * @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 } } 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. */ 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; } } %>

<%=ResourceLoader.GetResource(session, "pages.home.stats")%>

<%=ResourceLoader.GetResource(session, "items.happyjuddi")%>

jUDDI Version Information

jUDDI Version: <%= org.apache.juddi.config.Release.getRegistryVersion()%>
UDDI Version: <%= org.apache.juddi.config.Release.getUDDIVersion()%>

jUDDI Dependencies: Class Files & Libraries

<%
                        //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("Looking for: " + classArray[i] + "
"); String result = lookupClass(classArray[i]); if (result == null) { out.write("-Not Found
"); } else if (result.length() == 0) { out.write("+Found in an unknown location
"); } else { out.write("+Found in: " + result + "
"); } } %>

jUDDI Dependencies: Resource & Properties Files

<%
                        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("Looking for: " + resourceArray[i] + "
"); String result = lookupResourceWrapper(resourceArray[i]); if (result == null) { out.write("-Not Found
"); } else if (result.length() == 0) { out.write("+Found in an unknown location
"); } else { out.write("+Found in: " + result + "
"); } } %>

jUDDI DataSource Validation

<%
                        boolean success=false;
                        EntityManager em=  PersistenceManager.getEntityManager();
                        EntityTransaction tx= em.getTransaction();
                        try {
                               tx.begin();
                                String rootBusiness = AppConfig.getConfiguration().getString(Property.JUDDI_NODE_ROOT_BUSINESS);
                               org.apache.juddi.model.BusinessEntity biz= em.find(org.apache.juddi.model.BusinessEntity.class, rootBusiness);
                               if (biz!=null)
                                       success=true;
                               tx.commit();
                        } catch (Exception ex) {
                            out.print("");
                            out.print("- Root business lookup failed  (" + ex.getMessage() + ") ");
                            out.println("");
                        }
                        finally{
                                if (tx.isActive())
                                        tx.rollback();
                                em.close();
                        }

                        if (success){
                                out.write("Data source is valid and online! 
"); } %>

System Properties

<%
                        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("" + key + ": " + sysProps.getProperty(key));
                            }
                        } catch (Exception e) {
                            e.printStackTrace();
                        }
                        %>

Platform

<%= getServletConfig().getServletContext().getServerInfo()%>
<%@include file="header-bottom.jsp"%>