cvs commit: spice/sandbox/jervlet/jervlet/src/java/org/jcomponent/jervlet Jervlet.java JervletContext.java MultihostJervlet.java package.html JervletException.java

Ryan Hoegg <[email protected]>
Newsgroups gmane.comp.java.spice.cvs
Message-ID <[email protected]>
rhoegg      03/10/27 21:07:35

  Added:       sandbox/jervlet/jervlet/src/java/org/jcomponent/jervlet
                        Jervlet.java JervletContext.java
                        MultihostJervlet.java package.html
                        JervletException.java
  Log:
  Initial commit.
  
  Revision  Changes    Path
  1.1                  spice/sandbox/jervlet/jervlet/src/java/org/jcomponent/jervlet/Jervlet.java
  
  Index: Jervlet.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;
  
  import java.io.File;
  
  /**
   * Jervlet defines an interface that servlet containers can be wrapped behind
   *
   * @author  Vinay Chandrasekharan<vinayc77-/[email protected]>
   * @author Ryan Hoegg
   * @version 1.0
   */
  public interface Jervlet
  {
      /** Role of the Jervlet Service*/
      String ROLE = Jervlet.class.getName();
  
      /**
       * Deploy the given Web Application
       * @param context Context for the the webapp
       * @param pathToWebAppFolder path can be a war-archive or exploded directory
       * @throws JervletException Thrown when context already exists
       */
      void deploy( String context, File pathToWebAppFolder ) throws JervletException;
  
      /**
       * Deploy the given Web Application
       * @param context Context for the the webapp
       * @param pathToWebAppFolder path can be a war-archive or exploded directory
       * @param sevakContext the context that is applied to the servlet on instantiation.
       * @throws JervletException Thrown when context already exists
       */
      void deploy( String context, File pathToWebAppFolder, JervletContext jervletContext )
          throws JervletException;
  
      /**
       * Undeploy the given WebApp
       * @param context Context for the the webapp
       * @throws JervletException Thrown if context does NOT exist
       */
      void undeploy( String context ) throws JervletException;
  }
  
  
  
  1.1                  spice/sandbox/jervlet/jervlet/src/java/org/jcomponent/jervlet/JervletContext.java
  
  Index: JervletContext.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;
  
  import org.apache.avalon.framework.context.Context;
  import org.apache.avalon.framework.logger.Logger;
  import org.apache.avalon.framework.service.ServiceManager;
  
  /**
   * Holder class for objects to be used when creating servlets under Jervlet
   *
   * If a servlet is LogEnabled then the logger is set on the servlet.
   * If a servlet is Servicable then the serviceManager is set on the servlet.
   * If a servlet is Contextualizable then the context is set on the servlet
   * @author Ben Hogan
   */
  public class JervletContext
  {
      private ServiceManager m_serviceManager;
      private Logger m_logger;
      private Context m_context;
  
      public JervletContext( Context context, ServiceManager serviceManager, Logger logger )
      {
          m_context = context;
          m_serviceManager = serviceManager;
          m_logger = logger;
      }
  
      public ServiceManager getServiceManager()
      {
          return m_serviceManager;
      }
  
      public Logger getLogger()
      {
          return m_logger;
      }
  
      public Context getContext()
      {
          return m_context;
      }
  }
  
  
  
  
  1.1                  spice/sandbox/jervlet/jervlet/src/java/org/jcomponent/jervlet/MultihostJervlet.java
  
  Index: MultihostJervlet.java
  ===================================================================
  package org.jcomponent.jervlet;
  
  import java.io.File;
  
  public interface MultihostJervlet
  {
      /** Role of the MultihostJervlet Service*/
      public String ROLE = MultihostJervlet.class.getName();
  
      /**
       * Deploy the given Web Application
       * @param context Context for the the webapp
       * @param pathToWebAppFolder path can be a war-archive or exploded directory
       * @throws JervletException Thrown when context already exists
       */
      void deploy( String host, String context, File pathToWebAppFolder ) throws JervletException;
  
      /**
       * Undeploy the given WebApp
       * @param context Context for the the webapp
       * @throws JervletException Thrown if context does NOT exist
       */
      void undeploy( String host, String context ) throws JervletException;
  }
  
  
  
  1.1                  spice/sandbox/jervlet/jervlet/src/java/org/jcomponent/jervlet/package.html
  
  Index: package.html
  ===================================================================
  <html>
  <body>
      <h1>Introduction</h1>
        <p>
          Jervlet is a wrapper for various servlet engines in a Loom container.
          It launches the supported container under Loom control in embedded mode.
        </p>
  
    <!-- TODO: has this requirement changed?
      <h1>Usage</h1>
        <p>
          To use Jervlet, you will need to have tools.jar placed in the lib directory of
          Phoenix.  This is not unusual as a requirement as applications like the excellent
          OrionServer have the same requirement.  This will enable JSP processing.  You will
          find it in JAVA_HOME/lib/.  We can't include this in the SAR file for two reasons.
          The first is because it is part of the Java runtime environment and we have no
          permission to distribute that given it is copyright of Sun Microsystems.  The
          second reason is that it is tied to the version of Java you are running.  We can't
          provide a different base SAR for each version of the JDK (1.2, 1.2.2, 1,3, 1,3,1 ..)
        </p>
    -->
    <!-- TODO: update block documentation
      <h1>Blocks</h1>
        <p>
          There are two blocks delivered with Jervlet.  The first is the block that provides
          the deployment/undepoyment of web applications to other blocks.  That is
          org.jcontainer.loom.sevak.blocks.CatalinaJervletImpl.  The second is one uses the
          first to mount Catalina's demo apps.  The block class is
          org.jcontainer.loom.sevak.demo.JervletTest.
        </p>
    -->
  </body>
  </html>
  
  
  1.1                  spice/sandbox/jervlet/jervlet/src/java/org/jcomponent/jervlet/JervletException.java
  
  Index: JervletException.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
   * modification, 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 "Avalon", 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 (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.
   * ====================================================================
   *
   * 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;
  
  import org.apache.avalon.framework.CascadingThrowable;
  
  /**
   *  General Exception indicating the state of the Embedded Web Server i.e. Catalina
   *
   * @author <a href="mailto:vinayc77-/[email protected]">Vinay Chandran</a>
   */
  public class JervletException extends Exception implements CascadingThrowable
  {
      /**
       * The Throwable that caused this exception to be thrown.
       */
      private final Throwable m_throwable;
  
      /**
       * Construct a new <code>JervletException</code> instance.
       *
       * @param message The detail message for this exception.
       */
      public JervletException( final String message )
      {
          this( message, null );
      }
  
      /**
       * Construct a new <code>JervletException</code> instance.
       *
       * @param message The detail message for this exception.
       * @param throwable the root cause of the exception
       */
      public JervletException( final String message, final Throwable throwable )
      {
          super( message );
          m_throwable = throwable;
      }
  
      /**
       * Retrieve root cause of the exception.
       *
       * @return the root cause
       */
      public final Throwable getCause()
      {
          return m_throwable;
      }
  }
  
  
  


-------------------------------------------------------
This SF.net email is sponsored by: The SF.net Donation Program.
Do you like what SourceForge.net is doing for the Open
Source Community?  Make a contribution, and help us add new
features and functionality. Click here: http://sourceforge.net/donate/
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.