geronimo-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Donald Woods <drw_...@yahoo.com>
Subject Re: svn commit: r290359 - in /geronimo/trunk: applications/console-core/src/java/org/apache/geronimo/console/util/ applications/console-standard/src/java/org/apache/geronimo/console/logmanager/ applications/console-standard/src/java/org/apache/geronimo/con...
Date Tue, 20 Sep 2005 19:54:12 GMT
Is there a reason this fix only went into trunk and not 1.0-M5?

Are we planning on recutting M5 once all the TCKs pass?


-Donald

--- ammulder@apache.org wrote:

> Author: ammulder
> Date: Mon Sep 19 21:55:54 2005
> New Revision: 290359
> 
> URL: http://svn.apache.org/viewcvs?rev=290359&view=rev
> Log:
> Management API for web log (GERONIMO-1015)
>  - Interface & helpers
>  - Jetty Implementation (Tomcat maybe tomorrow)
>  - Make access log search go faster
> Don't blow up on weird Jetty manageable property type
>   (treats the symptom for GERONIMO-1017)
> 
> Added:
>    
>
geronimo/trunk/modules/jetty/src/java/org/apache/geronimo/jetty/requestlog/JettyLogManager.java
>    
>
geronimo/trunk/modules/jetty/src/java/org/apache/geronimo/jetty/requestlog/JettyLogManagerImpl.java
>    
>
geronimo/trunk/modules/jetty/src/java/org/apache/geronimo/jetty/requestlog/JettyRequestLog.java
>    
>
geronimo/trunk/modules/management/src/java/org/apache/geronimo/management/geronimo/WebAccessLog.java
> Modified:
>    
>
geronimo/trunk/applications/console-core/src/java/org/apache/geronimo/console/util/KernelManagementHelper.java
>    
>
geronimo/trunk/applications/console-core/src/java/org/apache/geronimo/console/util/ManagementHelper.java
>    
>
geronimo/trunk/applications/console-standard/src/java/org/apache/geronimo/console/logmanager/WebAccessLogViewerPortlet.java
>    
>
geronimo/trunk/applications/console-standard/src/java/org/apache/geronimo/console/util/PortletManager.java
>    
>
geronimo/trunk/applications/console-standard/src/webapp/WEB-INF/view/webaccesslogmanager/view.jsp
>     geronimo/trunk/modules/assembly/src/plan/j2ee-jetty-plan.xml
>    
>
geronimo/trunk/modules/jetty/src/java/org/apache/geronimo/jetty/JettyContainerImpl.java
>    
>
geronimo/trunk/modules/jetty/src/java/org/apache/geronimo/jetty/JettyManagerImpl.java
>    
>
geronimo/trunk/modules/jetty/src/java/org/apache/geronimo/jetty/requestlog/NCSARequestLog.java
>    
>
geronimo/trunk/modules/management/src/java/org/apache/geronimo/management/geronimo/WebManager.java
>    
>
geronimo/trunk/modules/system/src/java/org/apache/geronimo/system/logging/SystemLog.java
>    
>
geronimo/trunk/modules/tomcat/src/java/org/apache/geronimo/tomcat/TomcatManagerImpl.java
> 
> Modified:
>
geronimo/trunk/applications/console-core/src/java/org/apache/geronimo/console/util/KernelManagementHelper.java
> URL:
>
http://svn.apache.org/viewcvs/geronimo/trunk/applications/console-core/src/java/org/apache/geronimo/console/util/KernelManagementHelper.java?rev=290359&r1=290358&r2=290359&view=diff
>
==============================================================================
> ---
>
geronimo/trunk/applications/console-core/src/java/org/apache/geronimo/console/util/KernelManagementHelper.java
> (original)
> +++
>
geronimo/trunk/applications/console-core/src/java/org/apache/geronimo/console/util/KernelManagementHelper.java
> Mon Sep 19 21:55:54 2005
> @@ -21,17 +21,8 @@
>  import java.util.List;
>  import javax.management.ObjectName;
>  import javax.management.MalformedObjectNameException;
> -import org.apache.geronimo.management.geronimo.JVM;
> -import org.apache.geronimo.management.geronimo.J2EEApplication;
> -import org.apache.geronimo.management.geronimo.WebContainer;
> -import org.apache.geronimo.management.geronimo.J2EEServer;
> -import org.apache.geronimo.management.geronimo.WebConnector;
> -import org.apache.geronimo.management.geronimo.EJBManager;
> -import org.apache.geronimo.management.geronimo.EJBConnector;
> -import org.apache.geronimo.management.geronimo.JMSManager;
> -import org.apache.geronimo.management.geronimo.JMSBroker;
> -import org.apache.geronimo.management.geronimo.JMSConnector;
> -import org.apache.geronimo.management.geronimo.WebManager;
> +
> +import org.apache.geronimo.management.geronimo.*;
>  import org.apache.geronimo.management.J2EEDomain;
>  import org.apache.geronimo.management.J2EEDeployedObject;
>  import org.apache.geronimo.management.AppClientModule;
> @@ -258,6 +249,23 @@
>              Object[] temp = pm.createProxies(names,
> KernelManagementHelper.class.getClassLoader());
>              result = new WebManager[temp.length];
>              System.arraycopy(temp, 0, result, 0, temp.length);
> +        } catch (Exception e) {
> +            log.error("Unable to look up related GBean", e);
> +        }
> +        return result;
> +    }
> +
> +    public WebAccessLog getWebAccessLog(WebManager manager,
> WebContainer container) {
> +        return getWebAccessLog(manager,
> kernel.getObjectNameFor(container).getCanonicalName());
> +    }
> +
> +    public WebAccessLog getWebAccessLog(WebManager manager, String
> container) {
> +        WebAccessLog result = null;
> +        try {
> +log.warn("Checking access log for
> "+kernel.getObjectNameFor(manager)+" / "+container);            
> +            String name = manager.getAccessLog(container);
> +            Object temp =
> pm.createProxy(ObjectName.getInstance(name),
> KernelManagementHelper.class.getClassLoader());
> +            result = (WebAccessLog) temp;
>          } catch (Exception e) {
>              log.error("Unable to look up related GBean", e);
>          }
> 
> Modified:
>
geronimo/trunk/applications/console-core/src/java/org/apache/geronimo/console/util/ManagementHelper.java
> URL:
>
http://svn.apache.org/viewcvs/geronimo/trunk/applications/console-core/src/java/org/apache/geronimo/console/util/ManagementHelper.java?rev=290359&r1=290358&r2=290359&view=diff
>
==============================================================================
> ---
>
geronimo/trunk/applications/console-core/src/java/org/apache/geronimo/console/util/ManagementHelper.java
> (original)
> +++
>
geronimo/trunk/applications/console-core/src/java/org/apache/geronimo/console/util/ManagementHelper.java
> Mon Sep 19 21:55:54 2005
> @@ -34,17 +34,7 @@
>  import org.apache.geronimo.management.EJB;
>  import org.apache.geronimo.management.Servlet;
>  import org.apache.geronimo.management.ResourceAdapter;
> -import org.apache.geronimo.management.geronimo.JVM;
> -import org.apache.geronimo.management.geronimo.J2EEApplication;
> -import org.apache.geronimo.management.geronimo.J2EEServer;
> -import org.apache.geronimo.management.geronimo.WebContainer;
> -import org.apache.geronimo.management.geronimo.WebConnector;
> -import org.apache.geronimo.management.geronimo.EJBConnector;
> -import org.apache.geronimo.management.geronimo.EJBManager;
> -import org.apache.geronimo.management.geronimo.JMSManager;
> -import org.apache.geronimo.management.geronimo.JMSConnector;
> -import org.apache.geronimo.management.geronimo.JMSBroker;
> -import org.apache.geronimo.management.geronimo.WebManager;
> +import org.apache.geronimo.management.geronimo.*;
>  import org.apache.geronimo.system.logging.SystemLog;
>  import org.apache.geronimo.pool.GeronimoExecutor;
>  
> @@ -75,6 +65,8 @@
>      JMSResource[] getJMSResources(J2EEServer server);
>      JVM[] getJavaVMs(J2EEServer server);
>      WebManager[] getWebManagers(J2EEServer server);
> +    WebAccessLog getWebAccessLog(WebManager manager, WebContainer
> container);
> +    WebAccessLog getWebAccessLog(WebManager manager, String
> containerObjectName);
>      WebContainer[] getWebContainers(WebManager manager);
>      WebConnector[] getWebConnectorsForContainer(WebManager
> manager, WebContainer container, String protocol);
>      WebConnector[] getWebConnectorsForContainer(WebManager
> manager, WebContainer container);
> 
> Modified:
>
geronimo/trunk/applications/console-standard/src/java/org/apache/geronimo/console/logmanager/WebAccessLogViewerPortlet.java
> URL:
>
http://svn.apache.org/viewcvs/geronimo/trunk/applications/console-standard/src/java/org/apache/geronimo/console/logmanager/WebAccessLogViewerPortlet.java?rev=290359&r1=290358&r2=290359&view=diff
>
==============================================================================
> ---
>
geronimo/trunk/applications/console-standard/src/java/org/apache/geronimo/console/logmanager/WebAccessLogViewerPortlet.java
> (original)
> +++
>
geronimo/trunk/applications/console-standard/src/java/org/apache/geronimo/console/logmanager/WebAccessLogViewerPortlet.java
> Mon Sep 19 21:55:54 2005
> @@ -25,6 +25,7 @@
>  import org.apache.geronimo.console.BasePortlet;
>  import org.apache.geronimo.console.util.PortletManager;
>  import org.apache.geronimo.management.geronimo.WebContainer;
> +import org.apache.geronimo.management.geronimo.WebAccessLog;
>  import org.apache.commons.logging.Log;
>  import org.apache.commons.logging.LogFactory;
>  
> @@ -46,112 +47,104 @@
>              return;
>          }
>  
> -        String server = getWebServerType(renderRequest);
> -        if(server.equals(WEB_SERVER_JETTY)) {
> +        String[] names =
> PortletManager.getWebManagerNames(renderRequest);  //todo: handle
> multiple
> +        if (names != null) {
> +            String managerName = names[0];  //todo: handle
> multiple
> +            String[] containers =
> PortletManager.getWebContainerNames(renderRequest, managerName); 
> //todo: handle multiple
> +            if (containers != null) {
> +                String containerName = containers[0];  //todo:
> handle multiple
> +                WebAccessLog log =
> PortletManager.getWebAccessLog(renderRequest, managerName,
> containerName);
>  
> -            String action = renderRequest.getParameter("action");
> -            if ("refresh".equals(action)) {
> -                WebAccessLogHelper.refresh();
> -            }
> +                String action =
> renderRequest.getParameter("action");
> +                if ("refresh".equals(action)) {
> +                    //todo: currently refreshes on every request;
> that's pretty slow.
> +                }
>  
> -            String startDate = (String)
> renderRequest.getParameter("startDate");
> -            String startMonth = (String)
> renderRequest.getParameter("startMonth");
> -            String startYear = (String)
> renderRequest.getParameter("startYear");
> -            String endDate = (String)
> renderRequest.getParameter("endDate");
> -            String endMonth = (String)
> renderRequest.getParameter("endMonth");
> -            String endYear = (String)
> renderRequest.getParameter("endYear");
> -
> -            Calendar cal1 = Calendar.getInstance(), cal2 =
> Calendar.getInstance();
> -            // If no dates were passed we assume than no fields
> were passed and just
> -            // filter on the current date.
> -            if (startDate == null || startMonth == null ||
> startYear == null
> -                    || endDate == null || endMonth == null ||
> endYear == null) {
> -                // just keep the month date and year
> -                cal1.clear(Calendar.MILLISECOND);
> -                cal1.clear(Calendar.MINUTE);
> -                cal1.clear(Calendar.SECOND);
> -                // Weird java bug. calling
> calendar.clear(Calendar.HOUR) does not
> -                // clear the hour but this works.
> -                cal1.clear(Calendar.HOUR_OF_DAY);
> -                cal1.clear(Calendar.HOUR);
>  
> -                renderRequest.setAttribute("logs",
> WebAccessLogHelper.getLogsByDate(cal1.getTime()));
> -                renderRequest.setAttribute("toDate",
> cal1.getTime());
> -            } else {
> -                int sdt = Integer.parseInt(startDate), 
> -                    smnth = Integer.parseInt(startMonth), 
> -                    syr = Integer.parseInt(startYear), 
> -                    edt = Integer.parseInt(endDate), 
> -                    emnth = Integer.parseInt(endMonth), 
> -                    eyr = Integer.parseInt(endYear);
> -                boolean ignoreDates =
> renderRequest.getParameter("ignoreDates") == null;
> -                String requestHost = (String)
> renderRequest.getParameter("requestHost");
> -                String authUser = (String)
> renderRequest.getParameter("authUser");
> -                String requestMethod = (String)
> renderRequest.getParameter("requestMethod");
> -                String requestedURI = (String)
> renderRequest.getParameter("requestedURI");
> -                if (ignoreDates) {
> -                    cal1.clear();
> -                    cal2.clear();
> -                    cal1.set(Calendar.DATE, sdt);
> -                    cal1.set(Calendar.MONTH, smnth);
> -                    cal1.set(Calendar.YEAR, syr);
> -                    cal2.set(Calendar.DATE, edt);
> -                    cal2.set(Calendar.MONTH, emnth);
> -                    cal2.set(Calendar.YEAR, eyr);
> -                    renderRequest.setAttribute("logs",
> WebAccessLogHelper
> -                            .searchLogs(requestHost, authUser,
> requestMethod,
> -                                    requestedURI, cal1.getTime(),
> cal2.getTime()));
> +                //todo: completely revamp this argument processing
> +                String startDate = (String)
> renderRequest.getParameter("startDate");
> +                String startMonth = (String)
> renderRequest.getParameter("startMonth");
> +                String startYear = (String)
> renderRequest.getParameter("startYear");
> +                String endDate = (String)
> renderRequest.getParameter("endDate");
> +                String endMonth = (String)
> renderRequest.getParameter("endMonth");
> +                String endYear = (String)
> renderRequest.getParameter("endYear");
> +
> +                Calendar cal1 = Calendar.getInstance(), cal2 =
> Calendar.getInstance();
> +                // If not all dates were passed we assume than no
> fields were passed and just
> +                // filter on the current date.
> +                if (startDate == null || startMonth == null ||
> startYear == null
> +                        || endDate == null || endMonth == null ||
> endYear == null) {
> +                    // just keep the month date and year
> +                    cal1.set(Calendar.MILLISECOND, 0);
> +                    cal1.set(Calendar.MINUTE, 0);
> +                    cal1.set(Calendar.SECOND, 0);
> +                    cal1.clear(Calendar.HOUR_OF_DAY);
> +                    cal2.setTime(cal1.getTime());
> +                    cal2.add(Calendar.DAY_OF_YEAR, 1);
> +
> +                    WebAccessLog.SearchResults matchingItems =
> log.getMatchingItems(log.getLogFileNames()[0], //todo: handle
> multiple
> +                                                null, null, null,
> null, cal1.getTime(), cal2.getTime(), null, null);
> +                    renderRequest.setAttribute("logs",
> matchingItems.getResults());
> +                    renderRequest.setAttribute("logLength", new
> Integer(matchingItems.getLineCount()));
>                  } else {
> -                    renderRequest.setAttribute("logs",
> WebAccessLogHelper
> -                            .searchLogs(requestHost, authUser,
> requestMethod,
> -                                    requestedURI));
> +                    int sdt = Integer.parseInt(startDate),
> +                        smnth = Integer.parseInt(startMonth),
> +                        syr = Integer.parseInt(startYear),
> +                        edt = Integer.parseInt(endDate),
> +                        emnth = Integer.parseInt(endMonth),
> +                        eyr = Integer.parseInt(endYear);
> +                    boolean ignoreDates =
> renderRequest.getParameter("ignoreDates") == null;
> +                    String requestHost = (String)
> renderRequest.getParameter("requestHost");
> +                    String authUser = (String)
> renderRequest.getParameter("authUser");
> +                    String requestMethod = (String)
> renderRequest.getParameter("requestMethod");
> +                    String requestedURI = (String)
> renderRequest.getParameter("requestedURI");
> +                    if (ignoreDates) {
> +                        cal1.clear();
> +                        cal2.clear();
> +                        cal1.set(Calendar.DATE, sdt);
> +                        cal1.set(Calendar.MONTH, smnth);
> +                        cal1.set(Calendar.YEAR, syr);
> +                        cal2.set(Calendar.DATE, edt);
> +                        cal2.set(Calendar.MONTH, emnth);
> +                        cal2.set(Calendar.YEAR, eyr);
> +                        WebAccessLog.SearchResults matchingItems =
> log.getMatchingItems(log.getLogFileNames()[0], //todo: handle
> multiple
> +                                                       
> requestHost, authUser, requestMethod, requestedURI, cal1.getTime(),
> cal2.getTime(), null, null);
> +                        renderRequest.setAttribute("logs",
> matchingItems.getResults());
> +                        renderRequest.setAttribute("logLength",
> new Integer(matchingItems.getLineCount()));
> +                    } else {
> +                        WebAccessLog.SearchResults matchingItems =
> log.getMatchingItems(log.getLogFileNames()[0], //todo: handle
> multiple
> +                                                       
> requestHost, authUser, requestMethod, requestedURI, null, null,
> null, null);
> +                        renderRequest.setAttribute("logs",
> matchingItems.getResults());
> +                        renderRequest.setAttribute("logLength",
> new Integer(matchingItems.getLineCount()));
> +                    }
> +                    renderRequest.setAttribute("ignoreDates", new
> Boolean(ignoreDates));
> +                    renderRequest.setAttribute("requestHost",
> requestHost);
> +                    renderRequest.setAttribute("authUser",
> authUser);
> +                    renderRequest.setAttribute("requestMethod",
> requestMethod);
> +                    renderRequest.setAttribute("requestedURI",
> requestedURI);
> +
>                  }
>                  renderRequest.setAttribute("toDate",
> cal2.getTime());
> -                renderRequest.setAttribute("ignoreDates", new
> Boolean(ignoreDates));
> -                renderRequest.setAttribute("requestHost",
> requestHost);
> -                renderRequest.setAttribute("authUser", authUser);
> -                renderRequest.setAttribute("requestMethod",
> requestMethod);
> -                renderRequest.setAttribute("requestedURI",
> requestedURI);
> -
> -            }
> -            renderRequest.setAttribute("fromDate",
> cal1.getTime());
> -            searchView.include(renderRequest, renderRespose);
> -        } else if(server.equals(WEB_SERVER_TOMCAT)) {
> -            log.warn("Web server logs not handled for Tomcat
> yet"); //todo -  Handle tomcat logs
> -        } else {
> -            log.warn("Web server logs not handled for server type
> "+server);
> -        }
> -    }
> -
> -    protected final static String getWebServerType(PortletRequest
> request) {
> -        String[] names =
> PortletManager.getWebManagerNames(request);  //todo: handle
> multiple
> -        if (names != null) {
> -            String managerName = names[0];  //todo: handle
> multiple
> -            String[] containers =
> PortletManager.getWebContainerNames(request, managerName);  //todo:
> handle multiple
> -            if (containers != null) {
> -                String containerName = containers[0];  //todo:
> handle multiple
> -                WebContainer container =
> PortletManager.getWebContainer(request, containerName);
> -                return getWebServerType(container.getClass());
> +                renderRequest.setAttribute("fromDate",
> cal1.getTime());
> +                searchView.include(renderRequest, renderRespose);
>              } else {
> -                log.error("No web containers for manager
> "+managerName);
> +                log.error("No web containers found");
>              }
>          } else {
> -            log.error("No web managers present in server
> environment");
> +            log.error("No web managers found");
>          }
> -        return WEB_SERVER_GENERIC;
>      }
>  
>      public void init(PortletConfig portletConfig) throws
> PortletException {
>          PortletContext pc = portletConfig.getPortletContext();
> -        searchView = pc
> -               
>
.getRequestDispatcher("/WEB-INF/view/webaccesslogmanager/view.jsp");
> -        helpView = pc
> -               
>
.getRequestDispatcher("/WEB-INF/view/webaccesslogmanager/help.jsp");
> +        searchView =
>
pc.getRequestDispatcher("/WEB-INF/view/webaccesslogmanager/view.jsp");
> +        helpView =
>
pc.getRequestDispatcher("/WEB-INF/view/webaccesslogmanager/help.jsp");
>          super.init(portletConfig);
>      }
>  
>      public void processAction(ActionRequest actionRequest,
>              ActionResponse actionResponse) throws
> PortletException, IOException {
> +        //todo: according to portlet spec, all forms should submit
> to Action not Render
>      }
>  
>  }
> 
> Modified:
>
geronimo/trunk/applications/console-standard/src/java/org/apache/geronimo/console/util/PortletManager.java
> URL:
>
http://svn.apache.org/viewcvs/geronimo/trunk/applications/console-standard/src/java/org/apache/geronimo/console/util/PortletManager.java?rev=290359&r1=290358&r2=290359&view=diff
>
==============================================================================
> ---
>
geronimo/trunk/applications/console-standard/src/java/org/apache/geronimo/console/util/PortletManager.java
> (original)
> +++
>
geronimo/trunk/applications/console-standard/src/java/org/apache/geronimo/console/util/PortletManager.java
> Mon Sep 19 21:55:54 2005
> @@ -25,15 +25,7 @@
>  import org.apache.geronimo.kernel.Kernel;
>  import org.apache.geronimo.kernel.proxy.GeronimoManagedBean;
>  import org.apache.geronimo.management.J2EEDomain;
> -import org.apache.geronimo.management.geronimo.JVM;
> -import org.apache.geronimo.management.geronimo.J2EEServer;
> -import org.apache.geronimo.management.geronimo.WebContainer;
> -import org.apache.geronimo.management.geronimo.WebConnector;
> -import org.apache.geronimo.management.geronimo.EJBManager;
> -import org.apache.geronimo.management.geronimo.JMSManager;
> -import org.apache.geronimo.management.geronimo.JMSConnector;
> -import org.apache.geronimo.management.geronimo.WebManager;
> -import org.apache.geronimo.management.geronimo.JMSBroker;
> +import org.apache.geronimo.management.geronimo.*;
>  import org.apache.geronimo.system.logging.SystemLog;
>  import org.apache.geronimo.pool.GeronimoExecutor;
>  import org.apache.commons.logging.Log;
> @@ -132,6 +124,12 @@
>          ManagementHelper helper = getManagementHelper(request);
>          WebManager manager = (WebManager)
> helper.getObject(managerObjectName);
>          return manager.getContainers();
> +    }
> +
> +    public static WebAccessLog getWebAccessLog(PortletRequest
> request, String managerObjectName, String containerObjectName) {
> +        ManagementHelper helper = getManagementHelper(request);
> +        WebManager manager = (WebManager)
> helper.getObject(managerObjectName);
> +        return helper.getWebAccessLog(manager,
> containerObjectName);
>      }
>  
>      public static WebContainer getWebContainer(PortletRequest
> request, String containerObjectName) {
> 
> Modified:
>
geronimo/trunk/applications/console-standard/src/webapp/WEB-INF/view/webaccesslogmanager/view.jsp
> URL:
>
http://svn.apache.org/viewcvs/geronimo/trunk/applications/console-standard/src/webapp/WEB-INF/view/webaccesslogmanager/view.jsp?rev=290359&r1=290358&r2=290359&view=diff
>
==============================================================================
> ---
>
geronimo/trunk/applications/console-standard/src/webapp/WEB-INF/view/webaccesslogmanager/view.jsp
> (original)
> +++
>
geronimo/trunk/applications/console-standard/src/webapp/WEB-INF/view/webaccesslogmanager/view.jsp
> Mon Sep 19 21:55:54 2005
> @@ -148,15 +148,15 @@
>          </tr>   
>      <c:forEach var="line" items="${logs}">
>          <tr>
> -            <td class="Smaller">                
> -            ${line}
> +            <td class="Smaller">
> +${line.lineNumber}&nbsp;${line.lineContent}
>              </td>
>          </tr>
>      </c:forEach>
>      </table>
>  </c:when>
>  <c:otherwise>
> - No logs found.
> + No log entries found.
>  </c:otherwise>
>  </c:choose>  
>  </td>     
> 
> Modified:
> geronimo/trunk/modules/assembly/src/plan/j2ee-jetty-plan.xml
> URL:
>
http://svn.apache.org/viewcvs/geronimo/trunk/modules/assembly/src/plan/j2ee-jetty-plan.xml?rev=290359&r1=290358&r2=290359&view=diff
>
==============================================================================
> --- geronimo/trunk/modules/assembly/src/plan/j2ee-jetty-plan.xml
> (original)
> +++ geronimo/trunk/modules/assembly/src/plan/j2ee-jetty-plan.xml
> Mon Sep 19 21:55:54 2005
> @@ -31,10 +31,21 @@
>         
> <uri>geronimo/jars/geronimo-jetty-${geronimo_version}.jar</uri>
>      </dependency>
>  
> -    <!-- david jencks is not convinced that this gbean should be
> in this plan and thinks it might
> -    belong in the console plan -->
> -    <gbean name="JettyWebManager"
> class="org.apache.geronimo.jetty.JettyManagerImpl">
> +    <!-- david jencks is not convinced that these 2 gbeans should
> be in this
> +         plan and thinks they might belong in the console plan. 
> Aaron thinks
> +         they definitely don't belong in the console plan, but
> could go into
> +         a management layer plan. -->
> +    <gbean name="JettyWebManager"
> class="org.apache.geronimo.jetty.JettyManagerImpl"/>
> +    
> +    <gbean name="JettyAccessLogManager"
> class="org.apache.geronimo.jetty.requestlog.JettyLogManagerImpl">
> +        <references name="LogGBeans">
> +            <pattern>
> +                <!-- This is lame and should be replaced by an
> interface reference -->
> +               
> <gbean-name>geronimo.server:name=JettyRequestLog,*</gbean-name>
> +            </pattern>
> +        </references>
>      </gbean>
> +    
>  
>      <!-- default WAR container using Jetty -->
>      <gbean name="JettyWebContainer"
> class="org.apache.geronimo.jetty.JettyContainerImpl">
> 
> Modified:
>
geronimo/trunk/modules/jetty/src/java/org/apache/geronimo/jetty/JettyContainerImpl.java
> URL:
>
http://svn.apache.org/viewcvs/geronimo/trunk/modules/jetty/src/java/org/apache/geronimo/jetty/JettyContainerImpl.java?rev=290359&r1=290358&r2=290359&view=diff
>
==============================================================================
> ---
>
geronimo/trunk/modules/jetty/src/java/org/apache/geronimo/jetty/JettyContainerImpl.java
> (original)
> +++
>
geronimo/trunk/modules/jetty/src/java/org/apache/geronimo/jetty/JettyContainerImpl.java
> Mon Sep 19 21:55:54 2005
> @@ -196,7 +196,7 @@
>          infoBuilder.addAttribute("requestsDurationMax", Long.TYPE,
> false);
>          infoBuilder.addOperation("resetStatistics");
>  
> -        infoBuilder.addAttribute("requestLog", RequestLog.class,
> false);
> +        infoBuilder.addAttribute("requestLog", RequestLog.class,
> false, false);
>  
>          infoBuilder.addOperation("addListener", new
> Class[]{HttpListener.class});
>          infoBuilder.addOperation("removeListener", new
> Class[]{HttpListener.class});
> 
> Modified:
>
geronimo/trunk/modules/jetty/src/java/org/apache/geronimo/jetty/JettyManagerImpl.java
> URL:
>
http://svn.apache.org/viewcvs/geronimo/trunk/modules/jetty/src/java/org/apache/geronimo/jetty/JettyManagerImpl.java?rev=290359&r1=290358&r2=290359&view=diff
>
==============================================================================
> ---
>
geronimo/trunk/modules/jetty/src/java/org/apache/geronimo/jetty/JettyManagerImpl.java
> (original)
> +++
>
geronimo/trunk/modules/jetty/src/java/org/apache/geronimo/jetty/JettyManagerImpl.java
> Mon Sep 19 21:55:54 2005
> @@ -34,6 +34,7 @@
>  import org.apache.geronimo.jetty.connector.HTTPSConnector;
>  import org.apache.geronimo.jetty.connector.AJP13Connector;
>  import org.apache.geronimo.jetty.connector.JettyConnector;
> +import org.apache.geronimo.jetty.requestlog.JettyLogManager;
>  import org.apache.geronimo.system.serverinfo.ServerInfo;
>  import org.apache.geronimo.j2ee.management.impl.Util;
>  import org.apache.geronimo.j2ee.j2eeobjectnames.NameFactory;
> @@ -174,6 +175,17 @@
>              }
>          }
>          return (String[]) result.toArray(new
> String[result.size()]);
> +    }
> +
> +    public String getAccessLog(String containerObjectName) {
> +        GBeanQuery query = new GBeanQuery(null,
> JettyLogManager.class.getName());
> +        Set names = kernel.listGBeans(query);
> +        if(names.size() == 0) {
> +            return null;
> +        } else if(names.size() > 1) {
> +            throw new IllegalStateException("Should not be more
> than one Jetty access log manager");
> +        }
> +        return
> ((ObjectName)names.iterator().next()).getCanonicalName();
>      }
>  
>      /**
> 
> Added:
>
geronimo/trunk/modules/jetty/src/java/org/apache/geronimo/jetty/requestlog/JettyLogManager.java
> URL:
>
http://svn.apache.org/viewcvs/geronimo/trunk/modules/jetty/src/java/org/apache/geronimo/jetty/requestlog/JettyLogManager.java?rev=290359&view=auto
>
==============================================================================
> ---
>
geronimo/trunk/modules/jetty/src/java/org/apache/geronimo/jetty/requestlog/JettyLogManager.java
> (added)
> +++
>
geronimo/trunk/modules/jetty/src/java/org/apache/geronimo/jetty/requestlog/JettyLogManager.java
> Mon Sep 19 21:55:54 2005
> @@ -0,0 +1,27 @@
> +/**
> + *
> + * Copyright 2005 The Apache Software Foundation
> + *
> + *  Licensed 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.
> + */
> +package org.apache.geronimo.jetty.requestlog;
> +
> +import org.apache.geronimo.management.geronimo.WebAccessLog;
> +
> +/**
> + * Token interface to distinguish Jetty implementations.
> + *
> + * @version $Rev: 46019 $ $Date: 2004-09-14 05:56:06 -0400 (Tue,
> 14 Sep 2004) $
> + */
> +public interface JettyLogManager extends WebAccessLog {
> +}
> 
> Added:
>
geronimo/trunk/modules/jetty/src/java/org/apache/geronimo/jetty/requestlog/JettyLogManagerImpl.java
> URL:
>
http://svn.apache.org/viewcvs/geronimo/trunk/modules/jetty/src/java/org/apache/geronimo/jetty/requestlog/JettyLogManagerImpl.java?rev=290359&view=auto
>
==============================================================================
> ---
>
geronimo/trunk/modules/jetty/src/java/org/apache/geronimo/jetty/requestlog/JettyLogManagerImpl.java
> (added)
> +++
>
geronimo/trunk/modules/jetty/src/java/org/apache/geronimo/jetty/requestlog/JettyLogManagerImpl.java
> Mon Sep 19 21:55:54 2005
> @@ -0,0 +1,216 @@
> +/**
> + *
> + * Copyright 2005 The Apache Software Foundation
> + *
> + *  Licensed 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.
> + */
> +package org.apache.geronimo.jetty.requestlog;
> +
> +import org.apache.geronimo.gbean.GBeanInfo;
> +import org.apache.geronimo.gbean.GBeanInfoBuilder;
> +import org.apache.commons.logging.Log;
> +import org.apache.commons.logging.LogFactory;
> +
> +import java.util.*;
> +import java.util.regex.Pattern;
> +import java.util.regex.Matcher;
> +import java.io.File;
> +import java.io.RandomAccessFile;
> +import java.nio.channels.FileChannel;
> +import java.nio.MappedByteBuffer;
> +import java.nio.CharBuffer;
> +import java.nio.charset.Charset;
> +import java.text.SimpleDateFormat;
> +import java.text.ParseException;
> +
> +/**
> + * Jetty implementation of the WebAccessLog management interface.
> + *
> + * @version $Rev: 46019 $ $Date: 2004-09-14 05:56:06 -0400 (Tue,
> 14 Sep 2004) $
> + */
> +public class JettyLogManagerImpl implements JettyLogManager {
> +    private final static Log log =
> LogFactory.getLog(JettyLogManagerImpl.class);
> +    // Pattern that matches a single line  (used to calculate line
> numbers)
> +    private final static Pattern FULL_LINE_PATTERN =
> Pattern.compile("^.*", Pattern.MULTILINE);
> +    private final static Pattern ACCESS_LOG_PATTERN =
> Pattern.compile("(\\S*) (\\S*) (\\S*) \\[(.*)\\] \\\"(\\S*)
> (\\S*).*?\\\" (\\S*) (\\S*).*");
> +    private final static int GROUP_HOST = 1;
> +    private final static int GROUP_USER = 3;
> +    private final static int GROUP_DATE = 4;
> +    private final static int GROUP_METHOD = 5;
> +    private final static int GROUP_URI = 6;
> +    private final static int GROUP_RESPONSE_CODE = 7;
> +    private final static int GROUP_RESPONSE_LENGTH = 8;
> +    private final static String ACCESS_LOG_DATE_FORMAT =
> "dd/MMM/yyyy:HH:mm:ss ZZZZ";
> +    private Collection logGbeans;
> +
> +    public JettyLogManagerImpl(Collection logGbeans) {
> +        this.logGbeans = logGbeans;
> +    }
> +
> +    public String[] getLogFileNames() {
> +        List files = new ArrayList();
> +        for (Iterator it = logGbeans.iterator(); it.hasNext();) {
> +            JettyRequestLog log = (JettyRequestLog) it.next();
> +            if(log.getFilename() != null) {
> +                files.add(log.getFilename());
> +            }
> +        }
> +        return (String[]) files.toArray(new String[files.size()]);
> +    }
> +
> +    public SearchResults getMatchingItems(String logFile, String
> host, String user, String method, String uri,
> +                                          Date startDate, Date
> endDate, Integer skipResults, Integer maxResults) {
> +        File log = null;
> +        for (Iterator it = logGbeans.iterator(); it.hasNext();) {
> +            JettyRequestLog logger = (JettyRequestLog) it.next();
> +            if(logger.getFilename() != null &&
> logger.getFilename().equals(logFile)) {
> +                log = new File(logger.getAbsoluteFilePath());
> +                break;
> +            }
> +        }
> +        if(log == null) {
> +            throw new IllegalArgumentException("Unknown log file
> '"+logFile+"'");
> +        }
> +
> +        return search(log, host, user, method, uri, startDate,
> endDate, skipResults, maxResults);
> +    }
> +
> +    private SearchResults search(File file, String host, String
> user, String method, String uri, Date startDate,
> +                                 Date endDate, Integer
> skipResults, Integer maxResults) {
> +        // Clean up the arguments so we know what we've really got
> +        if(host != null && host.equals("")) host = null;
> +        if(user != null && user.equals("")) user = null;
> +        if(method != null && method.equals("")) method = null;
> +        if(uri != null && uri.equals("")) uri = null;
> +        // Do the search
> +        List list = new LinkedList();
> +        boolean capped = false;
> +        int lineCount = 0;
> +        try {
> +            RandomAccessFile raf = new RandomAccessFile(file,
> "r");
> +            FileChannel fc = raf.getChannel();
> +            MappedByteBuffer bb =
> fc.map(FileChannel.MapMode.READ_ONLY, 0, fc.size());
> +            CharBuffer cb =
> Charset.forName("US-ASCII").decode(bb); //todo: does Jetty use a
> different charset on a foreign PC?
> +            Matcher lines = FULL_LINE_PATTERN.matcher(cb);
> +            Matcher target = ACCESS_LOG_PATTERN.matcher("");
> +            long start = startDate == null ? 0 :
> startDate.getTime();
> +            long end = endDate == null ? 0 : endDate.getTime();
> +            SimpleDateFormat format = (start == 0 && end == 0) ?
> null : new SimpleDateFormat(ACCESS_LOG_DATE_FORMAT);
> +            int max = maxResults == null ? MAX_SEARCH_RESULTS :
> Math.min(maxResults.intValue(), MAX_SEARCH_RESULTS);
> +log.warn("CRITERIA: "+file.getAbsolutePath()+" "+host+" "+user+"
> "+method+" "+uri+" "+start+" "+end+" "+skipResults+" "+max);
> +            while(lines.find()) {
> +                ++lineCount;
> +                if(capped) {
> +                    continue;
> +                }
> +                CharSequence line = cb.subSequence(lines.start(),
> lines.end());
> +                target.reset(line);
> +                if(target.find()) {
> +                    if(host != null &&
> !host.equals(target.group(GROUP_HOST))) {
> +                        continue;
> +                    }
> +                    if(user != null &&
> !user.equals(target.group(GROUP_USER))) {
> +                        continue;
> +                    }
> +                    if(method != null &&
> !method.equals(target.group(GROUP_METHOD))) {
> +                        continue;
> +                    }
> +                    if(uri != null &&
> !target.group(GROUP_URI).startsWith(uri)) {
> +                        continue;
> +                    }
> +                    if(format != null) {
> +                        try {
> +                            long entry =
> format.parse(target.group(GROUP_DATE)).getTime();
> +                            if(start > entry) {
> +                                continue;
> +                            }
> +                            if(end > 0 && end < entry) {
> +                                continue;
> +                            }
> +                        } catch (ParseException e) {
> +                            // can't read the date, guess this
> record counts.
> +                        }
> +                    }
> +                    if(skipResults != null &&
> skipResults.intValue() > lineCount) {
> +                        continue;
> +                    }
> +                    if(list.size() > max) {
> +                        capped = true;
> +                        continue;
> +                    }
> +                    list.add(new
> LogMessage(lineCount,line.toString()));
> +                }
> +            }
> +            fc.close();
> +            raf.close();
> +        } catch (Exception e) {
> +            log.error("Unexpected error processing logs", e);
> +        }
> +        return new SearchResults(lineCount, (LogMessage[])
> list.toArray(new LogMessage[list.size()]), capped);
> +    }
> +
> +
> +    public static final GBeanInfo GBEAN_INFO;
> +
> +    static {
> +        GBeanInfoBuilder infoFactory = new GBeanInfoBuilder("Jetty
> Log Manager", JettyLogManagerImpl.class);
> +        infoFactory.addReference("LogGBeans",
> JettyRequestLog.class);
> +        infoFactory.addInterface(JettyLogManager.class);
> +
> +        infoFactory.setConstructor(new String[]{"LogGBeans"});
> +        GBEAN_INFO = infoFactory.getBeanInfo();
> +    }
> +
> +    public static GBeanInfo getGBeanInfo() {
> +        return GBEAN_INFO;
> +    }
> +/*
> +    public static void main(String[] args) {
> +        String jetty = "127.0.0.1 - - [07/Sep/2005:19:54:41 +0000]
> \"GET /console/ HTTP/1.1\" 302 0 \"-\" \"Mozilla/5.0 (X11; U; Linux
> i686; en-US; rv:1.7.10) Gecko/20050715 Firefox/1.0.6
> SUSE/1.0.6-4.1\" -";
> +        String tomcat = "127.0.0.1 - - [07/Sep/2005:15:51:18
> -0500] \"GET /console/portal/server/server_info HTTP/1.1\" 200
> 11708";
> +
> +        SimpleDateFormat format = new
> SimpleDateFormat("dd/MMM/yyyy:HH:mm:ss ZZZZ");
> +        try {
> +            Pattern p = Pattern.compile("(\\S*) (\\S*) (\\S*)
> \\[(.*)\\] \\\"(\\S*) (\\S*).*?\\\" (\\S*) (\\S*).*");
> +            Matcher m = p.matcher(jetty);
> +            if(m.matches()) {
> +                System.out.println("Group 1: "+m.group(1)); //
> client
> +                System.out.println("Group 2: "+m.group(2)); // ??
> server host?
> +                System.out.println("Group 3: "+m.group(3)); //
> username
> +                System.out.println("Group 4:
> "+format.parse(m.group(4))); // date
> +                System.out.println("Group 5: "+m.group(5)); //
> method
> +                System.out.println("Group 5: "+m.group(6)); // URI
> +                System.out.println("Group 6: "+m.group(7)); //
> response code
> +                System.out.println("Group 7: "+m.group(8)); //
> response length
> +            } else {
> +                System.out.println("No match");
> +            }
> +            m = p.matcher(tomcat);
> +            if(m.matches()) {
> +                System.out.println("Group 1: "+m.group(1));
> +                System.out.println("Group 2: "+m.group(2));
> +                System.out.println("Group 3: "+m.group(3));
> +                System.out.println("Group 4:
> "+format.parse(m.group(4)));
> +                System.out.println("Group 5: "+m.group(5)); //
> method
> +                System.out.println("Group 5: "+m.group(6)); // URI
> +                System.out.println("Group 6: "+m.group(7)); //
> response code
> +                System.out.println("Group 7: "+m.group(8)); //
> response length
> +            } else {
> +                System.out.println("No match");
> +            }
> +        } catch (ParseException e) {
> +            e.printStackTrace();
> +        }
> +    }
> +*/
> +}
> 
> Added:
>
geronimo/trunk/modules/jetty/src/java/org/apache/geronimo/jetty/requestlog/JettyRequestLog.java
> URL:
>
http://svn.apache.org/viewcvs/geronimo/trunk/modules/jetty/src/java/org/apache/geronimo/jetty/requestlog/JettyRequestLog.java?rev=290359&view=auto
>
==============================================================================
> ---
>
geronimo/trunk/modules/jetty/src/java/org/apache/geronimo/jetty/requestlog/JettyRequestLog.java
> (added)
> +++
>
geronimo/trunk/modules/jetty/src/java/org/apache/geronimo/jetty/requestlog/JettyRequestLog.java
> Mon Sep 19 21:55:54 2005
> @@ -0,0 +1,58 @@
> +/**
> + *
> + * Copyright 2005 The Apache Software Foundation
> + *
> + *  Licensed 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.
> + */
> +package org.apache.geronimo.jetty.requestlog;
> +
> +/**
> + * Interface for the NCSARequestLog GBean
> + *
> + * @version $Rev: 46019 $ $Date: 2004-09-14 05:56:06 -0400 (Tue,
> 14 Sep 2004) $
> + */
> +public interface JettyRequestLog {
> +    void setFilename(String filename);
> +
> +    String getFilename();
> +
> +    String getAbsoluteFilePath();
> +
> +    void setLogDateFormat(String format);
> +
> +    String getLogDateFormat();
> +
> +    void setLogTimeZone(String tz);
> +
> +    String getLogTimeZone();
> +
> +    int getRetainDays();
> +
> +    void setRetainDays(int retainDays);
> +
> +    boolean isExtended();
> +
> +    void setExtended(boolean e);
> +
> +    boolean isAppend();
> +
> +    void setAppend(boolean a);
> +
> +    void setIgnorePaths(String[] ignorePaths);
> +
> +    String[] getIgnorePaths();
> +
> +    void setPreferProxiedForAddress(boolean value);
> +
> +    boolean isPreferProxiedForAddress();
> +}
> 
> Modified:
>
geronimo/trunk/modules/jetty/src/java/org/apache/geronimo/jetty/requestlog/NCSARequestLog.java
> URL:
>
http://svn.apache.org/viewcvs/geronimo/trunk/modules/jetty/src/java/org/apache/geronimo/jetty/requestlog/NCSARequestLog.java?rev=290359&r1=290358&r2=290359&view=diff
>
==============================================================================
> ---
>
geronimo/trunk/modules/jetty/src/java/org/apache/geronimo/jetty/requestlog/NCSARequestLog.java
> (original)
> +++
>
geronimo/trunk/modules/jetty/src/java/org/apache/geronimo/jetty/requestlog/NCSARequestLog.java
> Mon Sep 19 21:55:54 2005
> @@ -26,7 +26,7 @@
>  /**
>   * @version $Rev$ $Date$
>   */
> -public class NCSARequestLog implements GBeanLifecycle {
> +public class NCSARequestLog implements GBeanLifecycle,
> JettyRequestLog {
>      private final JettyContainer container;
>      private final ServerInfo serverInfo;
>      private final org.mortbay.http.NCSARequestLog requestLog;
> @@ -104,6 +104,10 @@
>          return preferProxiedForAddress;
>      }
>  
> +    public String getAbsoluteFilePath() {
> +        return requestLog == null ? null :
> requestLog.getDatedFilename();
> +    }
> +
>      public void doStart() throws Exception {
>          requestLog.setFilename(serverInfo.resolvePath(filename));
>          container.setRequestLog(requestLog);
> @@ -127,14 +131,8 @@
>          infoFactory.addReference("JettyContainer",
> JettyContainer.class, NameFactory.GERONIMO_SERVICE);
>          infoFactory.addReference("ServerInfo", ServerInfo.class,
> NameFactory.GERONIMO_SERVICE);
>  
> -        infoFactory.addAttribute("filename", String.class, true);
> -        infoFactory.addAttribute("logDateFormat", String.class,
> true);
> -        infoFactory.addAttribute("logTimeZone", String.class,
> true);
> -        infoFactory.addAttribute("retainDays", int.class, true);
> -        infoFactory.addAttribute("extended", boolean.class, true);
> -        infoFactory.addAttribute("append", boolean.class, true);
> -        infoFactory.addAttribute("ignorePaths", String[].class,
> true);
> -        infoFactory.addAttribute("preferProxiedForAddress",
> boolean.class, true);
> +        infoFactory.addInterface(JettyRequestLog.class, new
> String[]{"filename", "logDateFormat", "logTimeZone",
> +                "retainDays", "extended", "append", "ignorePaths",
> "preferProxiedForAddress", });
>  
>          infoFactory.setConstructor(new String[]{"JettyContainer",
> "ServerInfo"});
>          GBEAN_INFO = infoFactory.getBeanInfo();
> 
> Added:
>
geronimo/trunk/modules/management/src/java/org/apache/geronimo/management/geronimo/WebAccessLog.java
> URL:
>
http://svn.apache.org/viewcvs/geronimo/trunk/modules/management/src/java/org/apache/geronimo/management/geronimo/WebAccessLog.java?rev=290359&view=auto
>
==============================================================================
> ---
>
geronimo/trunk/modules/management/src/java/org/apache/geronimo/management/geronimo/WebAccessLog.java
> (added)
> +++
>
geronimo/trunk/modules/management/src/java/org/apache/geronimo/management/geronimo/WebAccessLog.java
> Mon Sep 19 21:55:54 2005
> @@ -0,0 +1,92 @@
> +/**
> + *
> + * Copyright 2005 The Apache Software Foundation
> + *
> + *  Licensed 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.
> + */
> +package org.apache.geronimo.management.geronimo;
> +
> +import java.io.Serializable;
> +import java.util.Date;
> +
> +/**
> + * A web container access log manager.
> + *
> + * @version $Rev: 46019 $ $Date: 2004-09-14 05:56:06 -0400 (Tue,
> 14 Sep 2004) $
> + */
> +public interface WebAccessLog {
> +    /**
> +     * The most search lines that will ever be returned, no matter
> what you
> +     * ask for.  This is to conserve memory and transfer
> bandwidth.
> +     */
> +    public final static int MAX_SEARCH_RESULTS = 1000;
> +
> +    /**
> +     * Gets the name of all log files used by this log system. 
> Typically there
> +     * is only one, but specialized cases may use more.
> +     */
> +    String[] getLogFileNames();
> +
> +    /**
> +     * Searches the log for records matching the specified
> parameters.  The
> +     * maximum results returned will be the lesser of 1000 and the
> +     * provided maxResults argument.
> +     *
> +     * @see #MAX_SEARCH_RESULTS
> +     */
> +    SearchResults getMatchingItems(String logFile, String host,
> String user, String method,
> +                                   String uri, Date startDate,
> Date endDate,
> +                                   Integer skipResults, Integer
> maxResults);
> +
> +    public static class LogMessage implements Serializable {
> +        private final int lineNumber;
> +        private final String lineContent;
> +
> +        public LogMessage(int lineNumber, String lineContent) {
> +            this.lineNumber = lineNumber;
> +            this.lineContent = lineContent;
> +        }
> +
> +        public int getLineNumber() {
> +            return lineNumber;
> +        }
> +
> +        public String getLineContent() {
> +            return lineContent;
> +        }
> +    }
> +
> +    public static class SearchResults implements Serializable {
> +        private final int lineCount; // total lines in log file
> +        private final LogMessage[] results;
> +        private final boolean capped; // whether there were more
> matched than are returned here
> +
> +        public SearchResults(int lineCount, LogMessage[] results,
> boolean capped) {
> +            this.lineCount = lineCount;
> +            this.results = results;
> +            this.capped = capped;
> +        }
> +
> +        public int getLineCount() {
> +            return lineCount;
> +        }
> +
> +        public LogMessage[] getResults() {
> +            return results;
> +        }
> +
> +        public boolean isCapped() {
> +            return capped;
> +        }
> +    }
> +}
> 
> Modified:
>
geronimo/trunk/modules/management/src/java/org/apache/geronimo/management/geronimo/WebManager.java
> URL:
>
http://svn.apache.org/viewcvs/geronimo/trunk/modules/management/src/java/org/apache/geronimo/management/geronimo/WebManager.java?rev=290359&r1=290358&r2=290359&view=diff
>
==============================================================================
> ---
>
geronimo/trunk/modules/management/src/java/org/apache/geronimo/management/geronimo/WebManager.java
> (original)
> +++
>
geronimo/trunk/modules/management/src/java/org/apache/geronimo/management/geronimo/WebManager.java
> Mon Sep 19 21:55:54 2005
> @@ -44,4 +44,14 @@
>       * @return The ObjectName of the new connector.
>       */
>      public String addConnector(String containerObjectName, String
> uniqueName, String protocol, String host, int port);
> +
> +    /**
> +     * Gets the ObjectName of the WebAccessLog implementation for
> a web
> +     * container.  May be null if the access log cannot be
> managed.
> +     *
> +     * @param containerObjectName The ObjectName of the container
> whose access
> +     *                            log you're interested in.
> +     *
> +     */
> +    public String getAccessLog(String containerObjectName);
>  }
> 
> Modified:
>
geronimo/trunk/modules/system/src/java/org/apache/geronimo/system/logging/SystemLog.java
> URL:
>
http://svn.apache.org/viewcvs/geronimo/trunk/modules/system/src/java/org/apache/geronimo/system/logging/SystemLog.java?rev=290359&r1=290358&r2=290359&view=diff
>
==============================================================================
> ---
>
geronimo/trunk/modules/system/src/java/org/apache/geronimo/system/logging/SystemLog.java
> (original)
> +++
>
geronimo/trunk/modules/system/src/java/org/apache/geronimo/system/logging/SystemLog.java
> Mon Sep 19 21:55:54 2005
> @@ -89,7 +89,7 @@
>      }
>  
>      public static class SearchResults implements Serializable {
> -        private final int lineCount;
> +        private final int lineCount; // total lines in file
>          private final LogMessage[] results;
>          private final boolean capped;
>  
> 
> Modified:
>
geronimo/trunk/modules/tomcat/src/java/org/apache/geronimo/tomcat/TomcatManagerImpl.java
> URL:
>
http://svn.apache.org/viewcvs/geronimo/trunk/modules/tomcat/src/java/org/apache/geronimo/tomcat/TomcatManagerImpl.java?rev=290359&r1=290358&r2=290359&view=diff
>
==============================================================================
> ---
>
geronimo/trunk/modules/tomcat/src/java/org/apache/geronimo/tomcat/TomcatManagerImpl.java
> (original)
> +++
>
geronimo/trunk/modules/tomcat/src/java/org/apache/geronimo/tomcat/TomcatManagerImpl.java
> Mon Sep 19 21:55:54 2005
> @@ -177,6 +177,18 @@
>          return (String[]) result.toArray(new
> String[result.size()]);
>      }
>  
> +    public String getAccessLog(String containerObjectName) {
> +//        GBeanQuery query = new GBeanQuery(null,
> TomcatLogManager.class.getName());
> +//        Set names = kernel.listGBeans(query);
> +//        if(names.size() == 0) {
> +//            return null;
> +//        } else if(names.size() > 1) {
> +//            throw new IllegalStateException("Should not be more
> than one Jetty access log manager");
> +//        }
> +//        return
> ((ObjectName)names.iterator().next()).getCanonicalName();
> +        return null;
> +    }
> +
>      /**
>       * Gets the ObjectNames of any existing connectors associated
> with this network technology.
>       */
> 
> 
> 


__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 

Mime
View raw message