cvs commit: spice/sandbox/jervlet/jervlet/src/java/org/jcomponent/jervlet CommonsLoggingJervletMonitor.java SimpleJervletContext.java DefaultJervletMonitor.java JervletMonitor.java

Paul Hammant <[email protected]> Thu, 06 Nov 2003 13:13:56 -0800
Newsgroups gmane.comp.java.spice.cvs
Message-ID <[email protected]>
paul-h      03/11/06 13:13:56

  Modified:    sandbox/jervlet/jervlet/src/java/org/jcomponent/jervlet
                        DefaultJervletMonitor.java JervletMonitor.java
  Added:       sandbox/jervlet/jervlet/src/java/org/jcomponent/jervlet
                        CommonsLoggingJervletMonitor.java
                        SimpleJervletContext.java
  Log:
  Comons Logging Monitor
  
  Revision  Changes    Path
  1.3       +1 -2      spice/sandbox/jervlet/jervlet/src/java/org/jcomponent/jervlet/DefaultJervletMonitor.java
  
  Index: DefaultJervletMonitor.java
  ===================================================================
  RCS file: /cvsroot/spice/spice/sandbox/jervlet/jervlet/src/java/org/jcomponent/jervlet/DefaultJervletMonitor.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- DefaultJervletMonitor.java	6 Nov 2003 20:32:44 -0000	1.2
  +++ DefaultJervletMonitor.java	6 Nov 2003 21:13:56 -0000	1.3
  @@ -21,7 +21,6 @@
       }
   
       public void redeployException(Class reportingClass, String context, JervletException e) throws JervletException {
  -        //getLogger().error( "Exception restarting: " + context, e );
           throw e;
       }
   
  @@ -38,7 +37,7 @@
           throw new JervletException(msg, e);
       }
   
  -    public void deployingContextException(Class reportingClass, String context, String webappUrl, String hostName, Exception e) throws JervletException {
  +    public void deployingException(Class reportingClass, String context, String webappUrl, String hostName, Exception e) throws JervletException {
           final String msg = "Unable to deploy '" + context + "' : " + e.getMessage();
           throw new JervletException(msg, e);
       }
  
  
  
  1.3       +1 -1      spice/sandbox/jervlet/jervlet/src/java/org/jcomponent/jervlet/JervletMonitor.java
  
  Index: JervletMonitor.java
  ===================================================================
  RCS file: /cvsroot/spice/spice/sandbox/jervlet/jervlet/src/java/org/jcomponent/jervlet/JervletMonitor.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- JervletMonitor.java	6 Nov 2003 20:32:44 -0000	1.2
  +++ JervletMonitor.java	6 Nov 2003 21:13:56 -0000	1.3
  @@ -20,7 +20,7 @@
   
       void undeployException(Class reportingClass, String context, Exception e) throws JervletException;
   
  -    void deployingContextException(Class reportingClass, String context, String webappUrl, String hostName, Exception e) throws JervletException;
  +    void deployingException(Class reportingClass, String context, String webappUrl, String hostName, Exception e) throws JervletException;
   
       void undeployWarning(Class reportingClass, String context, String msg);
   
  
  
  
  1.1                  spice/sandbox/jervlet/jervlet/src/java/org/jcomponent/jervlet/CommonsLoggingJervletMonitor.java
  
  Index: CommonsLoggingJervletMonitor.java
  ===================================================================
  /*
   * Copyright (C) The Spice Group. All rights reserved.
   *
   * This software is published under the terms of the Spice
   * Software License version 1.1, a copy of which has been included
   * with this distribution in the LICENSE.txt file.
   */
  
  package org.jcomponent.jervlet;
  
  import org.apache.commons.logging.LogFactory;
  
  public class CommonsLoggingJervletMonitor extends DefaultJervletMonitor {
  
      public void startException(Class reportingClass, String context, Exception e) throws JervletException {
          LogFactory.getFactory().getInstance(reportingClass).error("Exception starting Context '"+ context+"' :" + e.getMessage(),e);
          super.startException(reportingClass, context, e);
      }
  
      public void stopException(Class reportingClass, String context, Exception e) throws JervletException {
          LogFactory.getFactory().getInstance(reportingClass).error("Exception stopping Context '"+ context+"' :" + e.getMessage(),e);
          super.stopException(reportingClass,context,e );
      }
  
      public void redeployException(Class reportingClass, String context, JervletException e) throws JervletException {
          LogFactory.getFactory().getInstance(reportingClass).error("Exception redeploying Context '"+ context+"' :" + e.getMessage(),e);
          super.redeployException(reportingClass, context, e);
      }
  
      public void deployingContext(Class reportingClass, String context, String webappUrl, String hostName) {
          LogFactory.getFactory().getInstance(reportingClass).info("Deploying Context '"+ context
                  +"', WebAppUrl '"+webappUrl
                  +"', HostName '"+ hostName(hostName) +"'");
          super.deployingContext(reportingClass, context, webappUrl, hostName);
      }
      private String hostName(String hostName) {
          return (hostName == null ? "(All Hosts)" : hostName);
      }
  
      public void undeployException(Class reportingClass, String context, Exception e) throws JervletException {
          LogFactory.getFactory().getInstance(reportingClass).error("Exception undeploying Context '"+ context+"' :" + e.getMessage(),e);
          super.undeployException(reportingClass, context, e);
      }
  
      public void deployingException(Class reportingClass, String context, String webappUrl, String hostName, Exception e) throws JervletException {
          LogFactory.getFactory().getInstance(reportingClass).error("Exception deploying Context '"+ context
                  +"', WebAppUrl '"+webappUrl
                  +"', HostName '"+ hostName(hostName) +"'");
          super.deployingException(reportingClass, context, webappUrl, hostName, e);
      }
  
      public void undeployWarning(Class reportingClass, String context, String msg) {
          LogFactory.getFactory().getInstance(reportingClass).warn("Warning undeploying Context '"+ context
                  +"' Message: '" + msg +"'");
          super.undeployWarning(reportingClass, context, msg);
      }
  }
  
  
  
  1.1                  spice/sandbox/jervlet/jervlet/src/java/org/jcomponent/jervlet/SimpleJervletContext.java
  
  Index: SimpleJervletContext.java
  ===================================================================
  /*
  
   ============================================================================
                     The Apache Software License, Version 1.1
   ============================================================================
  
   Copyright (C) 2002,2003 The Apache Software Foundation. All rights reserved.
  
   Redistribution and use in source and binary forms, with or without modifica-
   tion, are permitted provided that the following conditions are met:
  
   1. Redistributions of  source code must  retain the above copyright  notice,
      this list of conditions and the following disclaimer.
  
   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 end-user documentation included with the redistribution, if any, must
      include  the following  acknowledgment:  "This product includes  software
      developed  by the  Apache Software Foundation  (http://www.apache.org/)."
      Alternately, this  acknowledgment may  appear in the software itself,  if
      and wherever such third-party acknowledgments normally appear.
  
   4. The names "Jakarta", "Avalon", "Excalibur" and "Apache Software Foundation"
      must not be used to endorse or promote products derived from this  software
      without  prior written permission. For written permission, please contact
      [email protected]
  
   5. Products  derived from this software may not  be called "Apache", nor may
      "Apache" appear  in their name,  without prior written permission  of the
      Apache Software Foundation.
  
   THIS SOFTWARE IS PROVIDED ``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
   APACHE SOFTWARE  FOUNDATION  OR ITS CONTRIBUTORS  BE LIABLE FOR  ANY DIRECT,
   INDIRECT, INCIDENTAL, SPECIAL,  EXEMPLARY, OR CONSEQUENTIAL  DAMAGES (INCLU-
   DING, 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.
  
   This software  consists of voluntary contributions made  by many individuals
   on  behalf of the Apache Software  Foundation. For more  information on the
   Apache Software Foundation, please see <http://www.apache.org/>.
  
  */
  package org.jcomponent.jervlet;
  
  /**
   * Holder class for objects to be used when creating servlets under Jervlet
   *
   * @author Paul Hammant
   */
  public class SimpleJervletContext implements JervletContext
  {
  
      public Object instantiate(Class servletClass) throws InstantiationException, IllegalAccessException {
          return servletClass.newInstance();
      }
  
  }
  
  
  
  


-------------------------------------------------------
This SF.net email is sponsored by: SF.net Giveback Program.
Does SourceForge.net help you be more productive?  Does it
help you create better code?   SHARE THE LOVE, and help us help
YOU!  Click Here: http://sourceforge.net/donate/