Return-Path: Delivered-To: apmail-openejb-commits-archive@www.apache.org Received: (qmail 70189 invoked from network); 3 Aug 2007 05:22:35 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 3 Aug 2007 05:22:35 -0000 Received: (qmail 94201 invoked by uid 500); 3 Aug 2007 05:22:34 -0000 Delivered-To: apmail-openejb-commits-archive@openejb.apache.org Received: (qmail 94141 invoked by uid 500); 3 Aug 2007 05:22:34 -0000 Mailing-List: contact commits-help@openejb.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@openejb.apache.org Delivered-To: mailing list commits@openejb.apache.org Received: (qmail 94064 invoked by uid 99); 3 Aug 2007 05:22:33 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 02 Aug 2007 22:22:33 -0700 X-ASF-Spam-Status: No, hits=-100.0 required=10.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.3] (HELO eris.apache.org) (140.211.11.3) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 03 Aug 2007 05:22:23 +0000 Received: by eris.apache.org (Postfix, from userid 65534) id 681BF1A9823; Thu, 2 Aug 2007 22:22:03 -0700 (PDT) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Subject: svn commit: r562334 [4/8] - in /openejb/trunk/openejb3/server: ./ openejb-webadmin/ openejb-webadmin/src/ openejb-webadmin/src/main/ openejb-webadmin/src/main/etc/ openejb-webadmin/src/main/java/ openejb-webadmin/src/main/java/org/ openejb-webadmin/src... Date: Fri, 03 Aug 2007 05:22:00 -0000 To: commits@openejb.apache.org From: dblevins@apache.org X-Mailer: svnmailer-1.1.0 Message-Id: <20070803052203.681BF1A9823@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org Added: openejb/trunk/openejb3/server/openejb-webadmin/src/main/java/org/apache/openejb/webadmin/main/HomeBean.java URL: http://svn.apache.org/viewvc/openejb/trunk/openejb3/server/openejb-webadmin/src/main/java/org/apache/openejb/webadmin/main/HomeBean.java?view=auto&rev=562334 ============================================================================== --- openejb/trunk/openejb3/server/openejb-webadmin/src/main/java/org/apache/openejb/webadmin/main/HomeBean.java (added) +++ openejb/trunk/openejb3/server/openejb-webadmin/src/main/java/org/apache/openejb/webadmin/main/HomeBean.java Thu Aug 2 22:21:56 2007 @@ -0,0 +1,168 @@ +/** + * Redistribution and use of this software and associated documentation + * ("Software"), with or without modification, are permitted provided + * that the following conditions are met: + * + * 1. Redistributions of source code must retain copyright + * statements and notices. Redistributions must also contain a + * copy of this document. + * + * 2. Redistributions in binary form must reproduce the + * above copyright notice, this list of conditions and the + * following disclaimer in the documentation and/or other + * materials provided with the distribution. + * + * 3. The name "OpenEJB" must not be used to endorse or promote + * products derived from this Software without prior written + * permission of The OpenEJB Group. For written permission, + * please contact dev@openejb.org. + * + * 4. Products derived from this Software may not be called "OpenEJB" + * nor may "OpenEJB" appear in their names without prior written + * permission of The OpenEJB Group. OpenEJB is a registered + * trademark of The OpenEJB Group. + * + * 5. Due credit should be given to the OpenEJB Project + * (http://www.openejb.org/). + * + * THIS SOFTWARE IS PROVIDED BY THE OPENEJB GROUP AND CONTRIBUTORS + * ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT + * NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND + * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL + * THE OPENEJB GROUP OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, + * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, + * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED + * OF THE POSSIBILITY OF SUCH DAMAGE. + * + * Copyright 2001 (C) The OpenEJB Group. All Rights Reserved. + * + * $Id: HomeBean.java 445460 2005-06-16 22:29:56Z jlaskowski $ + */ +package org.apache.openejb.webadmin.main; + +import java.io.IOException; +import java.io.PrintWriter; + +import org.apache.openejb.webadmin.HttpRequest; +import org.apache.openejb.webadmin.HttpResponse; +import org.apache.openejb.webadmin.WebAdminBean; +import org.apache.openejb.webadmin.HttpHome; + +import javax.ejb.Stateless; +import javax.ejb.RemoteHome; + +/** This class represents the "Home" page for the webadmin. It contains general + * information, and more content to be added later. + * @author Tim Urberg + */ +@Stateless(name = "Webadmin/Home") +@RemoteHome(HttpHome.class) +public class HomeBean extends WebAdminBean { + + /** Creates a new instance of HomeBean */ + public void ejbCreate() { + this.section = "Home"; + } + + /** after the processing is completed + * @param request the http request + * @param response the http response + * @throws IOException if an exception is thrown + * + */ + public void postProcess(HttpRequest request, HttpResponse response) throws IOException {} + + /** before the process is done + * @param request the http request + * @param response the http response + * @throws IOException if an exception is thrown + * + */ + public void preProcess(HttpRequest request, HttpResponse response) throws IOException {} + + /** Write the main content + * + * @param body the output to write to + * @exception IOException if an exception is thrown + * + */ + public void writeBody(PrintWriter body) throws IOException { + body.println( + "Welcome to the OpenEJB Web Administration website. This website is designed to help automate"); + body.println( + "many of the command line processes in OpenEJB. Please begin by selecting from one of the menu"); + body.println("options.

"); + body.println( + "We encourage our users to participate in giving suggestions and submitting code and documentation"); + body.println( + "for the improvement of OpenEJB. Because it's open source, it's not just our project, it's everyone's"); + body.println( + "project! Your feedback and contributions make OpenEJB a better project for everyone! "); + body.println("Future revisions of the OpenEJB Web Administration will contain:"); + body.println("
    "); + body.println("
  • Better bean deployment
  • "); + body.println("
  • Container Managed Persistance Mapping
  • "); + body.println("
  • EJB Jar Validator
  • "); + body.println("
  • More system information
  • "); + body.println("
  • Better menu orginization
  • "); + body.println("
  • Addition of an extensive help section and documentation
  • "); + body.println("
  • Your suggestions!!
  • "); + body.println("
"); + body.println("
"); + body.println( + "If you have any problems with this website, please don’t hesitate to email the OpenEJB users list: "); + body.println( + "user@openejb.org and we’ll"); + body.println("respond to you as soon as possible."); + } + + /** Write the TITLE of the HTML document. This is the part + * that goes into the <head><title> + * </title></head> tags + * + * @param body the output to write to + * @exception IOException of an exception is thrown + * + */ + public void writeHtmlTitle(PrintWriter body) throws IOException { + body.println(HTML_TITLE); + } + + /** Write the title of the page. This is displayed right + * above the main block of content. + * + * @param body the output to write to + * @exception IOException if an exception is thrown + * + */ + public void writePageTitle(PrintWriter body) throws IOException { + body.println("Web Administration Home"); + } + + /** Write the sub items for this bean in the left navigation bar of + * the page. This should look somthing like the one below: + * + * + * <tr> + * <td valign="top" align="left"> + * <a href="system?show=deployments"><span class="subMenuOff"> + *    Deployments + * </span> + * </a></td> + * </tr> + * + * + * Alternately, the bean can use the method formatSubMenuItem(..) which + * will create HTML like the one above + * + * @param body the output to write to + * @exception IOException if an exception is thrown + * + */ + public void writeSubMenuItems(PrintWriter body) throws IOException {} + +} Propchange: openejb/trunk/openejb3/server/openejb-webadmin/src/main/java/org/apache/openejb/webadmin/main/HomeBean.java ------------------------------------------------------------------------------ svn:executable = * Added: openejb/trunk/openejb3/server/openejb-webadmin/src/main/java/org/apache/openejb/webadmin/main/ListLogsBean.java URL: http://svn.apache.org/viewvc/openejb/trunk/openejb3/server/openejb-webadmin/src/main/java/org/apache/openejb/webadmin/main/ListLogsBean.java?view=auto&rev=562334 ============================================================================== --- openejb/trunk/openejb3/server/openejb-webadmin/src/main/java/org/apache/openejb/webadmin/main/ListLogsBean.java (added) +++ openejb/trunk/openejb3/server/openejb-webadmin/src/main/java/org/apache/openejb/webadmin/main/ListLogsBean.java Thu Aug 2 22:21:56 2007 @@ -0,0 +1,385 @@ +/** + * Redistribution and use of this software and associated documentation + * ("Software"), with or without modification, are permitted provided + * that the following conditions are met: + * + * 1. Redistributions of source code must retain copyright + * statements and notices. Redistributions must also contain a + * copy of this document. + * + * 2. Redistributions in binary form must reproduce the + * above copyright notice, this list of conditions and the + * following disclaimer in the documentation and/or other + * materials provided with the distribution. + * + * 3. The name "OpenEJB" must not be used to endorse or promote + * products derived from this Software without prior written + * permission of The OpenEJB Group. For written permission, + * please contact dev@openejb.org. + * + * 4. Products derived from this Software may not be called "OpenEJB" + * nor may "OpenEJB" appear in their names without prior written + * permission of The OpenEJB Group. OpenEJB is a registered + * trademark of The OpenEJB Group. + * + * 5. Due credit should be given to the OpenEJB Project + * (http://www.openejb.org/). + * + * THIS SOFTWARE IS PROVIDED BY THE OPENEJB GROUP AND CONTRIBUTORS + * ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT + * NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND + * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL + * THE OPENEJB GROUP OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, + * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, + * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED + * OF THE POSSIBILITY OF SUCH DAMAGE. + * + * Copyright 2001 (C) The OpenEJB Group. All Rights Reserved. + * + * $Id: ListLogsBean.java 445536 2005-07-09 08:51:00Z dblevins $ + */ +package org.apache.openejb.webadmin.main; + +import java.io.BufferedReader; +import java.io.File; +import java.io.FileReader; +import java.io.FilenameFilter; +import java.io.IOException; +import java.io.PrintWriter; +import java.text.SimpleDateFormat; +import java.util.Arrays; +import java.util.Date; + +import org.apache.regexp.RE; +import org.apache.regexp.RESyntaxException; +import org.apache.openejb.webadmin.HttpRequest; +import org.apache.openejb.webadmin.HttpResponse; +import org.apache.openejb.webadmin.WebAdminBean; +import org.apache.openejb.webadmin.HttpHome; +import org.apache.openejb.loader.SystemInstance; + +import javax.ejb.Stateless; +import javax.ejb.RemoteHome; + +/** This bean lists the openejb.log and transaction.log files + * + * @author Tim Urberg + */ +@Stateless(name = "Webadmin/ListLogs") +@RemoteHome(HttpHome.class) +public class ListLogsBean extends WebAdminBean { + /** the form field used for a regular expression search */ + private static final String REGULAR_EXPRESSION_SEARCH = "regularExpression"; + private static final String DISPLAY_TYPE_FILTER = "filter"; + private static final String DISPLAY_TYPE_HIGHLIGHT = "highlight"; + private static final String DISPLAY_TYPE = "displayType"; + + /** the type of log we're using */ + private String logType; + /** called with the bean is created */ + public void ejbCreate() { + this.section = "ListLogs"; + } + + /** after the processing is completed + * @param request the http request + * @param response the http response + * @throws IOException if an exception is thrown + */ + public void postProcess(HttpRequest request, HttpResponse response) throws IOException {} + + /** before the processing is done + * @param request the http request + * @param response the http response + * @throws IOException if an exception is thrown + */ + public void preProcess(HttpRequest request, HttpResponse response) throws IOException { + //get the log type + this.logType = request.getQueryParameter("log"); + } + + /** Write the main content + * + * @param body the output to write to + * @exception IOException if an exception is thrown + */ + public void writeBody(PrintWriter body) throws IOException { + //string for re search + String regularExpressionSearch = request.getFormParameter(REGULAR_EXPRESSION_SEARCH); + String displayType = request.getFormParameter(DISPLAY_TYPE); + if (regularExpressionSearch == null) { + regularExpressionSearch = ""; + } + + // Get the logs directory + File logsDir = SystemInstance.get().getBase().getDirectory("logs"); + String path; + + File[] openejbLogs = logsDir.listFiles(new FilenameFilter() { + public boolean accept(File dir, String name) { + return (name.indexOf(".log") != -1); + } + }); + + Arrays.sort(openejbLogs); + int printIndex = 0; + SimpleDateFormat dateFormat = new SimpleDateFormat("MMM dd yyyy HH:mm:ss"); + + for (int i = 0; i < openejbLogs.length; i++) { + if ((this.logType == null && i == 0) + || (this.logType != null && this.logType.equals(openejbLogs[i].getName()))) { + body.print(openejbLogs[i].getName()); + printIndex = i; + } else { + body.print("" + openejbLogs[i].getName() + ""); + } + + if (i < openejbLogs.length - 1) { + body.print(" | "); + } + } + body.println("

"); + + //calculate the size of the file in kb or bytes + String fileLength = "0 bytes"; + long longFileLength = 0; + if (openejbLogs[printIndex].length() > 0) { + if (openejbLogs[printIndex].length() > 1000) { + longFileLength = openejbLogs[printIndex].length() / 1000; + fileLength = String.valueOf(longFileLength) + " kb"; + } else { + fileLength = String.valueOf(openejbLogs[printIndex].length()) + " bytes"; + } + } + + //set the path for the form action + if (request.getURI().getQuery() == null || "".equals(request.getURI().getQuery())) { + path = request.getURI().getPath(); + } else { + path = request.getURI().getPath() + "?" + request.getURI().getQuery(); + } + + body.print("
"); + body.println(""); + body.println("\n\n\n\n
"); + body.println("----------------------------------------------------------
"); + body.println("Last Modified: " + dateFormat.format(new Date(openejbLogs[printIndex].lastModified())) + "
"); + body.println("Size: " + fileLength + "
"); + body.println("----------------------------------------------------------"); + body.println("
"); + //the form for regular expresions goes here + body.println( + "You may do a text search by using regular
expressions. Enter " + + "your regular expression
below. If you are not familiar with regular
" + + "expresions see Apache Regexp for more
information.
"); + body.print("Regular Expression:  "); + body.print("
\nHightlight \nFilter

\n"); + body.println("
\n
\n
"); + + if (!"".equals(regularExpressionSearch)) { + body.println("The results of your search are highlighted below.

"); + } + + this.printLogFile(body, openejbLogs[printIndex], regularExpressionSearch, displayType); + } + + /** gets the openejb.log file + * @param body the output to send the data to + * @param logFile the logfile that we're printing + * @throws IOException if an exception is thrown + */ + private void printLogFile(PrintWriter body, File logFile, String reSearch, String displayType) throws IOException { + BufferedReader fileReader = new BufferedReader(new FileReader(logFile)); + StringBuffer lineOfText; + RE regularExpressionSearch = null; + boolean filterSearch = false; + boolean highlightSearch = false; + boolean matchFound; + + //create a search reg expression + if (!"".equals(reSearch.trim())) { + try { + regularExpressionSearch = new RE(reSearch); + } catch (RESyntaxException e) { + throw new IOException(e.getMessage()); + } + + //set these only if there is a search + if (DISPLAY_TYPE_FILTER.equals(displayType)) { + filterSearch = true; + } else if (DISPLAY_TYPE_HIGHLIGHT.equals(displayType)) { + highlightSearch = true; + } + } + + //create a list of special characters + String[][] specialChars = new String[3][2]; + specialChars[0][0] = "&"; + specialChars[0][1] = "&"; + specialChars[1][0] = "<"; + specialChars[1][1] = "<"; + specialChars[2][0] = ">"; + specialChars[2][1] = ">"; + int lineCounter = 0; + String background; + + try { + //create an array of regular expressions + RE[] expArray = new RE[5]; + expArray[0] = new RE("^INFO :"); + expArray[1] = new RE("^DEBUG:"); + expArray[2] = new RE("^WARN :"); + expArray[3] = new RE("^ERROR:"); + expArray[4] = new RE("^FATAL:"); + + //create an array of colors + String[] colorArray = new String[5]; + colorArray[0] = "log4j-info"; + colorArray[1] = "log4j-debug"; + colorArray[2] = "log4j-warn"; + colorArray[3] = "log4j-error"; + colorArray[4] = "log4j-fatal"; + + //create a table to write the file to + body.println(""); + + //read the file line by line + String expMatch = colorArray[0]; + String temp; + while (true) { + //check for null and break + temp = fileReader.readLine(); + if (temp == null) { + break; + } + + lineCounter++; + lineOfText = new StringBuffer(temp); + + //check for and replace special characters + String charToCheck; + for (int i = 0; i < lineOfText.length(); i++) { + //pick out the current character + charToCheck = String.valueOf(lineOfText.charAt(i)); + for (int j = 0; j < specialChars.length; j++) { + //do the check for equals + if (charToCheck.equals(specialChars[j][0])) { + lineOfText.replace(i, i + 1, specialChars[j][1]); + break; + } + } + } + + temp = lineOfText.toString(); + //loop through the array of expressions to find a match + for (int i = 0; i < expArray.length; i++) { + if (expArray[i].match(temp)) { + expMatch = colorArray[i]; + break; + } + } + + //check for an re search + matchFound = false; + background = ""; + if (regularExpressionSearch != null && regularExpressionSearch.match(temp)) { + matchFound = true; + if (highlightSearch) { + background = " bgcolor=\"#00ffff\""; + } + } + + //print line of text to the page + if ((filterSearch || highlightSearch) && (filterSearch && !matchFound)) { + continue; + } + + body.println( + new StringBuffer(100) + .append("") + .toString()); + } + + body.println("
") + .append(lineCounter) + .append(" ") + .append(temp) + .append("
"); + } catch (RESyntaxException se) { + throw new IOException(se.getMessage()); + } + + //close the file + fileReader.close(); + } + + /** Write the TITLE of the HTML document. This is the part + * that goes into the <head><title> + * </title></head> tags + * + * @param body the output to write to + * @exception IOException of an exception is thrown + * + */ + public void writeHtmlTitle(PrintWriter body) throws IOException { + body.println(HTML_TITLE); + } + + /** Write the title of the page. This is displayed right + * above the main block of content. + * + * @param body the output to write to + * @exception IOException if an exception is thrown + */ + public void writePageTitle(PrintWriter body) throws IOException { + body.println("System Log Files"); + } + + /** Write the sub items for this bean in the left navigation bar of + * the page. This should look somthing like the one below: + * + * + * <tr> + * <td valign="top" align="left"> + * <a href="system?show=deployments"><span class="subMenuOff"> + *    Deployments + * </span> + * </a></td> + * </tr> + * + * + * Alternately, the bean can use the method formatSubMenuItem(..) which + * will create HTML like the one above + * + * @param body the output to write to + * @exception IOException if an exception is thrown + * + */ + public void writeSubMenuItems(PrintWriter body) throws IOException {} + +} Propchange: openejb/trunk/openejb3/server/openejb-webadmin/src/main/java/org/apache/openejb/webadmin/main/ListLogsBean.java ------------------------------------------------------------------------------ svn:executable = * Added: openejb/trunk/openejb3/server/openejb-webadmin/src/main/java/org/apache/openejb/webadmin/main/PropertiesBean.java URL: http://svn.apache.org/viewvc/openejb/trunk/openejb3/server/openejb-webadmin/src/main/java/org/apache/openejb/webadmin/main/PropertiesBean.java?view=auto&rev=562334 ============================================================================== --- openejb/trunk/openejb3/server/openejb-webadmin/src/main/java/org/apache/openejb/webadmin/main/PropertiesBean.java (added) +++ openejb/trunk/openejb3/server/openejb-webadmin/src/main/java/org/apache/openejb/webadmin/main/PropertiesBean.java Thu Aug 2 22:21:56 2007 @@ -0,0 +1,182 @@ +/** + * Redistribution and use of this software and associated documentation + * ("Software"), with or without modification, are permitted provided + * that the following conditions are met: + * + * 1. Redistributions of source code must retain copyright + * statements and notices. Redistributions must also contain a + * copy of this document. + * + * 2. Redistributions in binary form must reproduce the + * above copyright notice, this list of conditions and the + * following disclaimer in the documentation and/or other + * materials provided with the distribution. + * + * 3. The name "OpenEJB" must not be used to endorse or promote + * products derived from this Software without prior written + * permission of The OpenEJB Group. For written permission, + * please contact dev@openejb.org. + * + * 4. Products derived from this Software may not be called "OpenEJB" + * nor may "OpenEJB" appear in their names without prior written + * permission of The OpenEJB Group. OpenEJB is a registered + * trademark of The OpenEJB Group. + * + * 5. Due credit should be given to the OpenEJB Project + * (http://www.openejb.org/). + * + * THIS SOFTWARE IS PROVIDED BY THE OPENEJB GROUP AND CONTRIBUTORS + * ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT + * NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND + * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL + * THE OPENEJB GROUP OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, + * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, + * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED + * OF THE POSSIBILITY OF SUCH DAMAGE. + * + * Copyright 2001 (C) The OpenEJB Group. All Rights Reserved. + * + * $Id: PropertiesBean.java 445460 2005-06-16 22:29:56Z jlaskowski $ + */ +package org.apache.openejb.webadmin.main; + +import java.io.File; +import java.io.IOException; +import java.io.PrintWriter; +import java.util.Arrays; +import java.util.Enumeration; +import java.util.Properties; +import java.util.StringTokenizer; + +import org.apache.openejb.webadmin.HttpRequest; +import org.apache.openejb.webadmin.HttpResponse; +import org.apache.openejb.webadmin.WebAdminBean; +import org.apache.openejb.webadmin.HttpHome; + +import javax.ejb.Stateless; +import javax.ejb.RemoteHome; + +/** Prints out a list of system properties for the server. + * @author Tim Urberg + */ +@Stateless(name = "Webadmin/Properties") +@RemoteHome(HttpHome.class) +public class PropertiesBean extends WebAdminBean { + + /** + * Called after a new instance of PropertiesBean is created + */ + public void ejbCreate() { + // The section variable must match + // the deployment id name + section = "Properties"; + } + + /** called after all content is written to the browser + * @param request the http request + * @param response the http response + * @throws IOException if an exception is thrown + */ + public void postProcess(HttpRequest request, HttpResponse response) throws IOException { + } + + /** called before any content is written to the browser + * @param request the http request + * @param response the http response + * @throws IOException if an exception is thrown + */ + public void preProcess(HttpRequest request, HttpResponse response) throws IOException { + } + + /** writes the main body content to the broswer. This content is inside a <p> block + * + * + * @param body the output to write to + * @exception IOException if an exception is thrown + */ + public void writeBody(PrintWriter body) throws IOException { + Properties p = System.getProperties(); + Enumeration e = p.keys(); + String[] propertyList = new String[p.size()]; + + body.println(""); + String currentProperty = null; + body.println(""); + int j = 0; + while ( e.hasMoreElements() ) { + propertyList[j++] = (String) e.nextElement(); + } + Arrays.sort(propertyList); + + String[] color = new String[]{"c9c5fe", "FFFFFF"}; + for ( int i=0; i"); + body.println(""); + body.println(""); + body.println(""); + } + body.println("
Property NameProperty Value
" + name + ""); + if (propertyList[i].endsWith(".path")) { + StringTokenizer path = new StringTokenizer(value,File.pathSeparator); + while (path.hasMoreTokens()) { + body.print(path.nextToken()); + body.println("
"); + } + } else { + body.println(value); + } + body.println(" 
"); + } + + /** Write the TITLE of the HTML document. This is the part + * that goes into the <head><title> + * </title></head> tags + * + * @param body the output to write to + * @exception IOException of an exception is thrown + * + */ + public void writeHtmlTitle(PrintWriter body) throws IOException { + body.print(HTML_TITLE); + } + + /** Write the title of the page. This is displayed right + * above the main block of content. + * + * @param body the output to write to + * @exception IOException if an exception is thrown + */ + public void writePageTitle(PrintWriter body) throws IOException { + body.print("System Properties"); + } + + /** Write the sub items for this bean in the left navigation bar of + * the page. This should look somthing like the one below: + * + * + * <tr> + * <td valign="top" align="left"> + * <a href="system?show=deployments"><span class="subMenuOff"> + *    Deployments + * </span> + * </a></td> + * </tr> + * + * + * Alternately, the bean can use the method formatSubMenuItem(..) which + * will create HTML like the one above + * + * @param body the output to write to + * @exception IOException if an exception is thrown + * + */ + public void writeSubMenuItems(PrintWriter body) throws IOException { + } +} Propchange: openejb/trunk/openejb3/server/openejb-webadmin/src/main/java/org/apache/openejb/webadmin/main/PropertiesBean.java ------------------------------------------------------------------------------ svn:executable = * Added: openejb/trunk/openejb3/server/openejb-webadmin/src/main/java/org/apache/openejb/webadmin/main/ReferenceData.java URL: http://svn.apache.org/viewvc/openejb/trunk/openejb3/server/openejb-webadmin/src/main/java/org/apache/openejb/webadmin/main/ReferenceData.java?view=auto&rev=562334 ============================================================================== --- openejb/trunk/openejb3/server/openejb-webadmin/src/main/java/org/apache/openejb/webadmin/main/ReferenceData.java (added) +++ openejb/trunk/openejb3/server/openejb-webadmin/src/main/java/org/apache/openejb/webadmin/main/ReferenceData.java Thu Aug 2 22:21:56 2007 @@ -0,0 +1,108 @@ +/** + * Redistribution and use of this software and associated documentation + * ("Software"), with or without modification, are permitted provided + * that the following conditions are met: + * + * 1. Redistributions of source code must retain copyright + * statements and notices. Redistributions must also contain a + * copy of this document. + * + * 2. Redistributions in binary form must reproduce the + * above copyright notice, this list of conditions and the + * following disclaimer in the documentation and/or other + * materials provided with the distribution. + * + * 3. The name "OpenEJB" must not be used to endorse or promote + * products derived from this Software without prior written + * permission of The OpenEJB Group. For written permission, + * please contact dev@openejb.org. + * + * 4. Products derived from this Software may not be called "OpenEJB" + * nor may "OpenEJB" appear in their names without prior written + * permission of The OpenEJB Group. OpenEJB is a registered + * trademark of The OpenEJB Group. + * + * 5. Due credit should be given to the OpenEJB Project + * (http://www.openejb.org/). + * + * THIS SOFTWARE IS PROVIDED BY THE OPENEJB GROUP AND CONTRIBUTORS + * ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT + * NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND + * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL + * THE OPENEJB GROUP OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, + * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, + * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED + * OF THE POSSIBILITY OF SUCH DAMAGE. + * + * Copyright 2001 (C) The OpenEJB Group. All Rights Reserved. + * + * $Id: ReferenceData.java 445460 2005-06-16 22:29:56Z jlaskowski $ + */ +package org.apache.openejb.webadmin.main; + +import java.io.Serializable; + +/** + * A simple data object for ejb and resource reference data + * + * @author Tim Urberg + */ +public class ReferenceData implements Serializable { + public static final String RESOURCE_REFERENCE = "resource_reference"; + public static final String EJB_REFERENCE = "ejb_reference"; + + private String referenceType; + private String referenceIdName; + private String referenceIdValue; + private String referenceName; + private String referenceValue; + + public ReferenceData() { + super(); + } + + public String getReferenceIdName() { + return referenceIdName; + } + + public String getReferenceIdValue() { + return referenceIdValue; + } + + public String getReferenceName() { + return referenceName; + } + + public String getReferenceValue() { + return referenceValue; + } + + public String getReferenceType() { + return referenceType; + } + + public void setReferenceIdName(String string) { + referenceIdName = string; + } + + public void setReferenceIdValue(String string) { + referenceIdValue = string; + } + + public void setReferenceName(String string) { + referenceName = string; + } + + public void setReferenceValue(String string) { + referenceValue = string; + } + + public void setReferenceType(String string) { + referenceType = string; + } + +} Propchange: openejb/trunk/openejb3/server/openejb-webadmin/src/main/java/org/apache/openejb/webadmin/main/ReferenceData.java ------------------------------------------------------------------------------ svn:executable = * Added: openejb/trunk/openejb3/server/openejb-webadmin/src/main/resources/META-INF/ejb-jar.xml URL: http://svn.apache.org/viewvc/openejb/trunk/openejb3/server/openejb-webadmin/src/main/resources/META-INF/ejb-jar.xml?view=auto&rev=562334 ============================================================================== --- openejb/trunk/openejb3/server/openejb-webadmin/src/main/resources/META-INF/ejb-jar.xml (added) +++ openejb/trunk/openejb3/server/openejb-webadmin/src/main/resources/META-INF/ejb-jar.xml Thu Aug 2 22:21:56 2007 @@ -0,0 +1 @@ + \ No newline at end of file Added: openejb/trunk/openejb3/server/openejb-webadmin/src/main/resources/META-INF/org.apache.openejb.server.ServerService/webadmin URL: http://svn.apache.org/viewvc/openejb/trunk/openejb3/server/openejb-webadmin/src/main/resources/META-INF/org.apache.openejb.server.ServerService/webadmin?view=auto&rev=562334 ============================================================================== --- openejb/trunk/openejb3/server/openejb-webadmin/src/main/resources/META-INF/org.apache.openejb.server.ServerService/webadmin (added) +++ openejb/trunk/openejb3/server/openejb-webadmin/src/main/resources/META-INF/org.apache.openejb.server.ServerService/webadmin Thu Aug 2 22:21:56 2007 @@ -0,0 +1,6 @@ + server = org.apache.openejb.webadmin.httpd.HttpServer + bind = 127.0.0.1 + port = 4203 + disabled = false + threads = 50 + Added: openejb/trunk/openejb3/server/openejb-webadmin/src/main/resources/htdocs/default.css URL: http://svn.apache.org/viewvc/openejb/trunk/openejb3/server/openejb-webadmin/src/main/resources/htdocs/default.css?view=auto&rev=562334 ============================================================================== --- openejb/trunk/openejb3/server/openejb-webadmin/src/main/resources/htdocs/default.css (added) +++ openejb/trunk/openejb3/server/openejb-webadmin/src/main/resources/htdocs/default.css Thu Aug 2 22:21:56 2007 @@ -0,0 +1,278 @@ +BODY { + background: #ffffff; + font-family: "Tahoma", "Helvetica", "Arial", "sans-serif"; + font-size: 12px; +} + +A:link, +A:visited, +A:active { + text-decoration: none +} + +.userdata { + behavior: url('#default#userdata'); +} + +.bg { + background-repeat: no-repeat +} + +.pageTitle { + font-size: 18px; + font-family: arial, "Helvetica", "Arial", "sans-serif"; + line-height: 28px; + font-weight: bold; + color: #666666; +} + +.pageSubTitle { + font-size: 15px; + font-family: arial, "Helvetica", "Arial", "sans-serif"; + line-height: 40px; + font-weight: bold; + color: #444444; +} + +.bodyGrey { + font-size: 11px; + font-family: "Tahoma", "Helvetica", "Arial", "sans-serif"; + line-height: 14px; color: #666666; +} + +.bodyBlack { + font-size: 12px; + font-family: arial, helvetica, sans-serif; + line-height: 16px; color: #222222; +} + +.option { + font-size: 12px; + font-family: arial, helvetica, sans-serif; + line-height: 16px; color: #222222; +} + +.option-flag { + font-size: 12px; + font-family: courier new, arial, helvetica, sans-serif; + line-height: 16px; color: #7270c2; + font-weight: bold; +} + +.option-param { + font-size: 12px; + font-family: arial, helvetica, sans-serif; + line-height: 16px; color: #7270c2; +} + +.note { + font-size: 11px; + font-family: "Tahoma", "Helvetica", "Arial", "sans-serif"; + line-height: 14px; color: #666666; +} + +.note-caption { + font-size: 12px; + font-family: arial, helvetica, sans-serif; + line-height: 16px; color: #FFFFFF; + font-weight: bold; +} + +.toc { + font-size: 12px; + font-family: arial, helvetica, sans-serif; + line-height: 16px; color: #222222; +} + +.bodyBlackOLD { + font-size: 11px; + font-family: "Tahoma", "Helvetica", "Arial", "sans-serif"; + line-height: 14px; color: #222222; +} + + +h1 { + font-size: 17px; + font-family: arial, helvetica, sans-serif; + line-height: 20px; color: #000000; +} + +h2 { + font-size: 15px; + font-family: arial, helvetica, sans-serif; + line-height: 20px; color: #000000; +} + +h3 { + font-size: 13px; + font-family: arial, helvetica, sans-serif; + line-height: 17px; color: #000000; +} + +h4 { + font-size: 11px; + font-family: arial, helvetica, sans-serif; + line-height: 15px; color: #000000; +} + +.log4j-info { + font-size: 12px; + font-family: courier new, "Tahoma", "Helvetica", "Arial", "sans-serif"; + line-height: 16px; + color: Black; +} + +.log4j-debug { + font-size: 12px; + font-family: courier new, "Tahoma", "Helvetica", "Arial", "sans-serif"; + line-height: 16px; + color: Green; +} + +.log4j-warn { + font-size: 12px; + font-family: courier new, "Tahoma", "Helvetica", "Arial", "sans-serif"; + line-height: 16px; + color: #B7B700; +} + +.log4j-error { + font-size: 12px; + font-family: courier new, "Tahoma", "Helvetica", "Arial", "sans-serif"; + line-height: 16px; + color: Red; +} + +.log4j-fatal { + font-size: 12px; + font-family: courier new, "Tahoma", "Helvetica", "Arial", "sans-serif"; + font-weight: bold; + line-height: 16px; + color: Red; +} + +.bodyCode { + font-size: 11px; + font-family: "Tahoma", "Helvetica", "Arial", "sans-serif"; + line-height: 14px; color: #757585; +} + +.command { + font-size: 12px; + font-family: courier new, "Tahoma", "Helvetica", "Arial", "sans-serif"; + line-height: 14px; color: #757585; +} + +.code-title { + font-size: 12px; + font-family: arial, "Tahoma", "Helvetica", "Arial", "sans-serif"; + line-height: 12px; color: #666666; +} + +.code-block { + font-size: 12px; + font-family: courier new, "Tahoma", "Helvetica", "Arial", "sans-serif"; + line-height: 16px; color: #757585; +} + +.code-comment { + font-size: 12px; + font-family: courier new, "Tahoma", "Helvetica", "Arial", "sans-serif"; + line-height: 16px; color: #8888CC; +} + +.legalBlack { + font-size: 10px; + font-family: "Tahoma", "Helvetica", "Arial", "sans-serif"; + line-height: 14px; color: #000000; +} + +.legalGrey { + font-size: 9px; + font-family: "Tahoma", "Helvetica", "Arial", "sans-serif"; + line-height: 14px; color: #999999; +} + +.bigGrey { + font-size: 11px; + font-family: "Tahoma", "Helvetica", "Arial", "sans-serif"; + line-height: 14px; color: #666666; +} + +.projectBlack { + font-size: 11px; + font-family: "Tahoma", "Helvetica", "Arial", "sans-serif"; + line-height: 11px; color: #000000; +} + +.header { + font-size: 11px; + font-family: "Tahoma", "Helvetica", "Arial", "sans-serif"; + line-height: 14px; + font-weight: bold; + color: #181818; +} + +.teamMember { + font-size: 11px; + font-family: "Tahoma", "Helvetica", "Arial", "sans-serif"; + line-height: 14px; + font-weight: bold; + color: #181818; +} + +.teamMemberRole { + font-size: 11px; + font-family: "Tahoma", "Helvetica", "Arial", "sans-serif"; + line-height: 14px; + font-weight: bold; + color: #A8A8A8; +} + +.menuTopOn { + font-size: 11px; + font-family: "Tahoma", "Helvetica", "Arial", "sans-serif"; + line-height: 0px; + color: #6763a9; +} + +.menuTopOff { + font-size: 11px; + font-family: "Tahoma", "Helvetica", "Arial", "sans-serif"; + line-height: 0px; + color: #999999; +} + +.menuProjectOn { + font-size: 12px; + font-family: "Helvetica", "Arial", "sans-serif"; + line-height: 20px; + font-weight: bold; + color: #cbcbeb; +} + +.menuProjectOff { + font-size: 12px; + font-family: "Helvetica", "Arial", "sans-serif"; + line-height: 20px; + font-weight: bold; + color: #ffffff; +} + +.subMenuOn { + font-size: 11px; + font-family: "Tahoma", "Helvetica", "Arial", "sans-serif"; + line-height: 20px; + font-weight: bold; + color: #4d4b7e; +} + +.subMenuOff { + font-size: 10px; + font-family: "Tahoma", "Helvetica", "Arial", "sans-serif"; + line-height: 16px; + font-weight: bold; + color: #cbcbeb; +} + + Propchange: openejb/trunk/openejb3/server/openejb-webadmin/src/main/resources/htdocs/default.css ------------------------------------------------------------------------------ svn:executable = * Added: openejb/trunk/openejb3/server/openejb-webadmin/src/main/resources/htdocs/download.html URL: http://svn.apache.org/viewvc/openejb/trunk/openejb3/server/openejb-webadmin/src/main/resources/htdocs/download.html?view=auto&rev=562334 ============================================================================== --- openejb/trunk/openejb3/server/openejb-webadmin/src/main/resources/htdocs/download.html (added) +++ openejb/trunk/openejb3/server/openejb-webadmin/src/main/resources/htdocs/download.html Thu Aug 2 22:21:56 2007 @@ -0,0 +1,2 @@ + +Download
OpenEJB at Codehaus     OpenEJB at Exolab     
 

Main
   Welcome!
   Download
   Mailing Lists
   The Team
Users
   Quickstart
   Hello World!
   Deploy
   Startup
   Support
   Request Feature
Servers
   Local Server
   Remote Server
Adapters
   Tomcat
< /tr>
Integrators
   Why OpenEJB
   Overview
   Design
   Specification
   Presentation
Developers
   Release Plan
   Source Code
   SourceForge


  



Download


Current Release 0.8 beta 3

Download OpenEJB 0.8 beta 3

We are cycling through a series of beta releases based on user-feedback. So, if you've had this release for a while, be sure to check the OpenE JB's download page at SourceForge for new releases. Any problems you have experienced may have been fixed, if not, please let us know.

Fixes in 0.8beta3

Fixes in 0.8beta2

SourceForge bugs fixed:
[ 563891 ] Bad client-side error messages
[ 565604 ] Setting the handler system property
[ 566953 ] openejb.bat on NT fails to display
[ 566956 ] deploy doesn't overwrite
[ 566961 ] typos in HelloWorld example
[ 566966 ] Need a sample client run script
[ 566967 ] sun.tools.javac.Main deprecated
< img src="images/grayDot.gif">[ 566974 ] openejb.bat help screen fails on NT
Scripts now pass OPENEJB_HOME to OpenEJB
Scripts now include OPENEJB_HOME\beans in classpath
If your OpenEJB configuration isn't found, one will be created for you.
ProxyFactory element in the openejb.conf is now optional
Fixed fatal file path bug affecting UNIX/Linux/Mac OS X Users
Fixed bug that prevented the Remote Server from starting unless additional command line options were used.
Improved scripts
Optimized logging
Added '-help' and '-example' options to the 'openejb deploy' command
Added '-help' and '-example' options to the 'openejb start' command
Revised all documentation
Added several new docs, including a complete "Hello World" example, Deploy Tool docs, Remote server starup docs, and a doc explaining the use of Deployment IDs.

New Features in 0.8

Command-line tool for deploying, starting, testing, and getting help
New configuration similar to the Apache httpd.conf style. The openejb.conf contains the information about your container system.
A default configuration is packed in the jar. If we can't find yours, the container system can still start
OpenEJB services are now packaged in jars and deployed in the openejb.conf file.
Deployed EJBs are loaded using the ejb-jar.xml and openejb-jar.xml in the bean's jar file. No need to edit your openejb.conf file
Deployment directories. Specify a dir where your deployed jars will be loaded, then just throw 'em in
Basic ejb-jar.xml validation using XSD with regular expressions
Advanced EJB validation using extendible framework.
The entire configuration is validated, any problems will be reported with very precise error messages and enough detail to fix the problem.
New modular build system
Fixed major bug in IntraVM serialization that severely affected the container-server contract.
Complete rewrite of Transaction Handling, several bugs fixed
Rewrite of Exception Handling, now much more spec compliant
Logging with log4j
Remote server for running OpenEJB stand-alone
CORBA adapter for plugging OpenEJB into OpenORB
 
     
   
   
 


Java, EJB, JDBC, JNDI, JTA, Sun, Sun Microsystems are trademarks or registered trademarks of Sun Microsystems, Inc. in the United States and in other countries. XML, XML Schema, XSLT and related standards are trademarks or registered trademarks of MIT, INRIA, Keio or others, and a product of the World Wide Web Consortium. All other pro duct names mentioned herein are trademarks of their respective owners.
 

 
 
\ No newline at end of file Propchange: openejb/trunk/openejb3/server/openejb-webadmin/src/main/resources/htdocs/download.html ------------------------------------------------------------------------------ svn:executable = *