[CVS spice] work on jervlet to update to Jetty 5 and Pico 1
paul-yCVjj/[email protected] 19 Jun 2004 14:39:02 -0000
| Newsgroups | gmane.comp.java.spice.cvs |
|---|---|
| Message-ID | <[email protected]> |
<html>
<head>
<style><!--
body {background-color:#ffffff;}
.file {border:1px solid #eeeeee;margin-top:1em;margin-bottom:1em;}
.pathname {font-family:monospace; float:right;}
.fileheader {margin-bottom:.5em;}
.diff {margin:0;}
.tasklist {padding:4px;border:1px dashed #000000;margin-top:1em;}
.tasklist ul {margin-top:0;margin-bottom:0;}
tr.alt {background-color:#eeeeee}
#added {background-color:#ddffdd;}
#addedchars {background-color:#99ff99;font-weight:bolder;}
tr.alt #added {background-color:#ccf7cc;}
#removed {background-color:#ffdddd;}
#removedchars {background-color:#ff9999;font-weight:bolder;}
tr.alt #removed {background-color:#f7cccc;}
#info {color:#888888;}
#context {background-color:#eeeeee;}
td {padding-left:.3em;padding-right:.3em;}
tr.head {border-bottom-width:1px;border-bottom-style:solid;}
tr.head td {padding:0;padding-top:.2em;}
.task {background-color:#ffff00;}
.comment {padding:4px;border:1px dashed #000000;background-color:#ffffdd}
.error {color:red;}
hr {border-width:0px;height:2px;background:black;}
--></style>
</head>
<body>
<table cellspacing="0" cellpadding="0" border="0" rules="cols">
<tr class="head"><td colspan="4">Commit in <b><tt>spice/sandbox/jervlet</tt></b><span id="info"> on MAIN</span></td></tr>
<tr><td><tt>jervlet-jetty/src/java/org/jcomponent/jervlet/blocks/jetty/<a href="#file1"><span id="added">PicoStartableException.java</span></a></tt></td><td align="right" id="added">+61</td><td></td><td nowrap="nowrap" align="right">added 1.1</td></tr>
<tr class="alt"><td><tt> /<a href="#file2">AbstractJettyJervlet.java</a></tt></td><td></td><td align="right" id="removed">-32</td><td nowrap="nowrap" align="center">1.1 -> 1.2</td></tr>
<tr><td><tt> /<a href="#file3">AvalonJettyJervlet.java</a></tt></td><td align="right" id="added">+32</td><td align="right" id="removed">-7</td><td nowrap="nowrap" align="center">1.2 -> 1.3</td></tr>
<tr class="alt"><td><tt> /<a href="#file4">BeanJettyJervlet.java</a></tt></td><td align="right" id="added">+32</td><td align="right" id="removed">-10</td><td nowrap="nowrap" align="center">1.2 -> 1.3</td></tr>
<tr><td><tt> /<a href="#file5">PicoJettyJervlet.java</a></tt></td><td align="right" id="added">+35</td><td align="right" id="removed">-16</td><td nowrap="nowrap" align="center">1.3 -> 1.4</td></tr>
<tr class="alt"><td><tt>jervlet/src/java/org/jcomponent/jervlet/<a href="#file6">PicoJervletContext.java</a></tt></td><td align="right" id="added">+1</td><td align="right" id="removed">-2</td><td nowrap="nowrap" align="center">1.1 -> 1.2</td></tr>
<tr><td><tt>jervlet/src/java/org/jcomponent/jervlet/blocks/deployer/<a href="#file7">JervletDeployer.java</a></tt></td><td align="right" id="added">+5</td><td align="right" id="removed">-5</td><td nowrap="nowrap" align="center">1.2 -> 1.3</td></tr>
<tr><td></td><td align="right" id="added">+166</td><td align="right" id="removed">-72</td><td></td></tr>
</table>
<small id="info">1 added + 6 modified, total 7 files</small><br />
<div class="tasklist"><ul>
<li><a href="#task1">TODO");</a></li>
</ul></div>
<pre class="comment">
work on jervlet to update to Jetty 5 and Pico 1
</pre>
<hr /><a name="file1" /><div class="file">
<span class="pathname" id="added">spice/sandbox/jervlet/jervlet-jetty/src/java/org/jcomponent/jervlet/blocks/jetty<br /></span>
<div class="fileheader" id="added"><big><b>PicoStartableException.java</b></big> <small id="info">added at 1.1</small></div>
<pre class="diff"><small id="info">diff -N PicoStartableException.java
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ PicoStartableException.java 19 Jun 2004 14:39:02 -0000 1.1
@@ -0,0 +1,61 @@
</small></pre><pre class="diff" id="added">+/*
+
+============================================================================
+ The Spice Software License, Version 1.1
+ ============================================================================
+
+ Copyright (C) 1999-2003 The Spice Group. 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 Spice Group (http://spice.codehaus.org/)."
+ Alternately, this acknowledgment may appear in the software itself, if
+ and wherever such third-party acknowledgments normally appear.
+
+ 4. The names "Spice" and "Spice Group" 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 "Spice", nor
+ may "Spice" appear in their name, without prior written permission
+ of The Spice Group.
+
+ 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 Spice Group. For more information on The Spice Group,
+ please see <http://spice.codehaus.org/>.
+
+*/
+package org.jcomponent.jervlet.blocks.jetty;
+
+import org.picocontainer.PicoException;
+
+/**
+ * @author Paul Hammant
+ * @version $Revision: 1.1 $
+ */
+public class PicoStartableException extends PicoException {
+ public PicoStartableException(String s, Throwable throwable) {
+ super(s, throwable);
+ }
+}
</pre></div>
<hr /><a name="file2" /><div class="file">
<span class="pathname">spice/sandbox/jervlet/jervlet-jetty/src/java/org/jcomponent/jervlet/blocks/jetty<br /></span>
<div class="fileheader"><big><b>AbstractJettyJervlet.java</b></big> <small id="info">1.1 -> 1.2</small></div>
<pre class="diff"><small id="info">diff -u -r1.1 -r1.2
--- AbstractJettyJervlet.java 6 Nov 2003 20:25:46 -0000 1.1
+++ AbstractJettyJervlet.java 19 Jun 2004 14:39:02 -0000 1.2
@@ -2,10 +2,8 @@
</small></pre><pre class="diff" id="context">
import org.mortbay.jetty.Server;
import org.mortbay.http.SocketListener;
</pre><pre class="diff" id="removed">-import org.mortbay.util.MultiException;
</pre><pre class="diff" id="context"> import org.jcomponent.jervlet.JervletConfig;
import org.jcomponent.jervlet.JervletException;
</pre><pre class="diff" id="removed">-import org.apache.avalon.framework.CascadingRuntimeException;
</pre><pre class="diff" id="context">
import java.net.UnknownHostException;
import java.util.HashMap;
</pre><pre class="diff"><small id="info">@@ -34,36 +32,6 @@
</small></pre><pre class="diff" id="context"> listener.setMinThreads( config.getMinThreads() );
listener.setMaxThreads( config.getMaxThreads() );
return listener;
</pre><pre class="diff" id="removed">- }
-
- /**
- * Start
- */
- public final void start()
- {
- try
- {
- m_server.start();
- }
- catch( MultiException e )
- {
- throw new CascadingRuntimeException( "Some problem starting Jetty", e );
- }
- }
-
- /**
- * Stop
- */
- public final void stop()
- {
- try
- {
- m_server.stop();
- }
- catch( InterruptedException e )
- {
- throw new CascadingRuntimeException( "Some problem stopping Jetty", e );
- }
</pre><pre class="diff" id="context"> }
protected final WebApplicationContextHolder getWebApplicationContextHolder( String context )
</pre></div>
<hr /><a name="file3" /><div class="file">
<span class="pathname">spice/sandbox/jervlet/jervlet-jetty/src/java/org/jcomponent/jervlet/blocks/jetty<br /></span>
<div class="fileheader"><big><b>AvalonJettyJervlet.java</b></big> <small id="info">1.2 -> 1.3</small></div>
<pre class="diff"><small id="info">diff -u -r1.2 -r1.3
--- AvalonJettyJervlet.java 6 Nov 2003 22:06:03 -0000 1.2
+++ AvalonJettyJervlet.java 19 Jun 2004 14:39:02 -0000 1.3
@@ -62,8 +62,9 @@
</small></pre><pre class="diff" id="context"> import org.apache.avalon.framework.service.ServiceException;
import org.apache.avalon.framework.service.ServiceManager;
import org.apache.avalon.framework.service.Serviceable;
</pre><pre class="diff" id="added">+import org.apache.avalon.framework.CascadingRuntimeException;
</pre><pre class="diff" id="context"> import org.jcomponent.jervlet.*;
</pre><pre class="diff" id="removed">-import org.mortbay.util.Log;
</pre><pre class="diff" id="added">+import org.mortbay.util.MultiException;
</pre><pre class="diff" id="context">
import java.io.File;
import java.util.Collections;
</pre><pre class="diff"><small id="info">@@ -155,12 +156,6 @@
</small></pre><pre class="diff" id="context"> m_server = createHttpServer();
m_server.addListener( createSocketListener() );
</pre><pre class="diff" id="removed">- AvalonLogSink logSink = new AvalonLogSink();
- logSink.enableLogging( getLogger() );
-
- // unsatisfactory as is static
- Log.instance().add( logSink );
-
</pre><pre class="diff" id="context"> RequestLogger logger = (RequestLogger)
m_jervletContext.getServiceManager().lookup( RequestLogger.ROLE );
m_server.setRequestLog( new JettyRequestLogAdapter( logger ) );
</pre><pre class="diff"><small id="info">@@ -391,6 +386,36 @@
</small></pre><pre class="diff" id="context"> getLogger().error( msg, e );
throw new JervletException( msg, e );
</pre><pre class="diff" id="added">+ }
+ }
+
+ /**
+ * Start
+ */
+ public final void start()
+ {
+ try
+ {
+ m_server.start();
+ }
+ catch( MultiException e )
+ {
+ throw new CascadingRuntimeException( "Some problem starting Jetty", e );
+ }
+ }
+
+ /**
+ * Stop
+ */
+ public final void stop()
+ {
+ try
+ {
+ m_server.stop();
+ }
+ catch( InterruptedException e )
+ {
+ throw new CascadingRuntimeException( "Some problem stopping Jetty", e );
</pre><pre class="diff" id="context"> }
}
}
</pre></div>
<hr /><a name="file4" /><div class="file">
<span class="pathname">spice/sandbox/jervlet/jervlet-jetty/src/java/org/jcomponent/jervlet/blocks/jetty<br /></span>
<div class="fileheader"><big><b>BeanJettyJervlet.java</b></big> <small id="info">1.2 -> 1.3</small></div>
<pre class="diff"><small id="info">diff -u -r1.2 -r1.3
--- BeanJettyJervlet.java 6 Nov 2003 22:06:03 -0000 1.2
+++ BeanJettyJervlet.java 19 Jun 2004 14:39:02 -0000 1.3
@@ -51,8 +51,8 @@
</small></pre><pre class="diff" id="context">
import org.jcomponent.jervlet.*;
import org.mortbay.jetty.Server;
</pre><pre class="diff" id="removed">-import org.mortbay.util.Log;
-import org.mortbay.util.LogSink;
</pre><pre class="diff" id="added">+import org.mortbay.util.MultiException;
+import org.apache.avalon.framework.CascadingRuntimeException;
</pre><pre class="diff" id="context">
import java.io.File;
import java.net.UnknownHostException;
</pre><pre class="diff"><small id="info">@@ -86,7 +86,6 @@
</small></pre><pre class="diff" id="context">
private HashMap m_webcontexts = new HashMap();
private RequestLogger requestLogger;
</pre><pre class="diff" id="removed">- private LogSink logSink;
</pre><pre class="diff" id="context">
public void setJervletConfig(JervletConfig config) {
super.config = config;
</pre><pre class="diff"><small id="info">@@ -104,10 +103,6 @@
</small></pre><pre class="diff" id="context"> this.monitor = jervletMonitor;
}
</pre><pre class="diff" id="removed">- public void setLogSink(LogSink logSink) {
- this.logSink = logSink;
- }
-
</pre><pre class="diff" id="context">
public void initialize() throws UnknownHostException {
</pre><pre class="diff"><small id="info">@@ -116,9 +111,6 @@
</small></pre><pre class="diff" id="context"> m_server = createHttpServer();
m_server.addListener( createSocketListener() );
</pre><pre class="diff" id="removed">- // unsatisfactory as is static
- Log.instance().add( logSink );
-
</pre><pre class="diff" id="context"> m_server.setRequestLog( new JettyRequestLogAdapter( requestLogger ) );
}
</pre><pre class="diff"><small id="info">@@ -333,6 +325,36 @@
</small></pre><pre class="diff" id="context"> {
monitor.undeployException(this.getClass(), context, e);
</pre><pre class="diff" id="added">+ }
+ }
+
+ /**
+ * Start
+ */
+ public final void start()
+ {
+ try
+ {
+ m_server.start();
+ }
+ catch( MultiException e )
+ {
+ throw new CascadingRuntimeException( "Some problem starting Jetty", e );
+ }
+ }
+
+ /**
+ * Stop
+ */
+ public final void stop()
+ {
+ try
+ {
+ m_server.stop();
+ }
+ catch( InterruptedException e )
+ {
+ throw new CascadingRuntimeException( "Some problem stopping Jetty", e );
</pre><pre class="diff" id="context"> }
}
}
</pre></div>
<hr /><a name="file5" /><div class="file">
<span class="pathname">spice/sandbox/jervlet/jervlet-jetty/src/java/org/jcomponent/jervlet/blocks/jetty<br /></span>
<div class="fileheader"><big><b>PicoJettyJervlet.java</b></big> <small id="info">1.3 -> 1.4</small></div>
<pre class="diff"><small id="info">diff -u -r1.3 -r1.4
--- PicoJettyJervlet.java 6 Nov 2003 22:06:03 -0000 1.3
+++ PicoJettyJervlet.java 19 Jun 2004 14:39:02 -0000 1.4
@@ -51,12 +51,10 @@
</small></pre><pre class="diff" id="context">
import org.jcomponent.jervlet.*;
import org.mortbay.jetty.Server;
</pre><pre class="diff" id="removed">-import org.mortbay.util.LogSink;
-import org.mortbay.util.Log;
</pre><pre class="diff" id="added">+import org.mortbay.util.MultiException;
</pre><pre class="diff" id="context"> import org.picocontainer.MutablePicoContainer;
</pre><pre class="diff" id="removed">-import org.picocontainer.lifecycle.Disposable;
-import org.picocontainer.lifecycle.Startable;
-import org.picocontainer.lifecycle.Stoppable;
</pre><pre class="diff" id="added">+import org.picocontainer.Disposable;
+import org.picocontainer.Startable;
</pre><pre class="diff" id="context">
import java.io.File;
import java.net.UnknownHostException;
</pre><pre class="diff"><small id="info">@@ -79,11 +77,10 @@
</small></pre><pre class="diff" id="context"> * @version 1.0
*/
public class PicoJettyJervlet extends AbstractJettyJervlet
</pre><pre class="diff" id="removed">- implements Jervlet, Startable, Stoppable, Disposable
</pre><pre class="diff" id="added">+ implements Jervlet, Startable
</pre><pre class="diff" id="context"> {
private final JervletMonitor monitor;
private final File appRootDir;
</pre><pre class="diff" id="removed">- private final LogSink logSink;
</pre><pre class="diff" id="context"> private final JervletContext jervletContext;
private Server m_server;
</pre><pre class="diff"><small id="info">@@ -91,26 +88,18 @@
</small></pre><pre class="diff" id="context"> private HashMap m_webcontexts = new HashMap();
public PicoJettyJervlet(JervletConfig config, JervletMonitor monitor, MutablePicoContainer parentContainer,
</pre><pre class="diff" id="removed">- File appRootDir, RequestLogger requestLogger,
- LogSink logSink) throws UnknownHostException {
</pre><pre class="diff" id="added">+ File appRootDir, RequestLogger requestLogger) throws UnknownHostException {
</pre><pre class="diff" id="context"> super.config = config;
this.monitor = monitor;
this.appRootDir = appRootDir;
</pre><pre class="diff" id="removed">- this.logSink = logSink;
</pre><pre class="diff" id="context"> this.jervletContext = new PicoJervletContext(parentContainer);
m_server = createHttpServer();
m_server.addListener( createSocketListener() );
</pre><pre class="diff" id="removed">- // unsatisfactory as is static
- Log.instance().add( logSink );
-
</pre><pre class="diff" id="context"> m_server.setRequestLog( new JettyRequestLogAdapter( requestLogger ) );
}
</pre><pre class="diff" id="removed">- public void dispose() {
-
- }
</pre><pre class="diff" id="context">
/**
* Deploy a webapp
</pre><pre class="diff"><small id="info">@@ -319,6 +308,36 @@
</small></pre><pre class="diff" id="context"> {
monitor.undeployException(this.getClass(), context, e);
</pre><pre class="diff" id="added">+ }
+ }
+
+ /**
+ * Start
+ */
+ public final void start()
+ {
+ try
+ {
+ m_server.start();
+ }
+ catch( MultiException e )
+ {
+ throw new PicoStartableException( "Some problem starting Jetty", e );
+ }
+ }
+
+ /**
+ * Stop
+ */
+ public final void stop()
+ {
+ try
+ {
+ m_server.stop();
+ }
+ catch( InterruptedException e )
+ {
+ throw new PicoStartableException( "Some problem stopping Jetty", e );
</pre><pre class="diff" id="context"> }
}
}
</pre></div>
<hr /><a name="file6" /><div class="file">
<span class="pathname">spice/sandbox/jervlet/jervlet/src/java/org/jcomponent/jervlet<br /></span>
<div class="fileheader"><big><b>PicoJervletContext.java</b></big> <small id="info">1.1 -> 1.2</small></div>
<pre class="diff"><small id="info">diff -u -r1.1 -r1.2
--- PicoJervletContext.java 6 Nov 2003 20:25:46 -0000 1.1
+++ PicoJervletContext.java 19 Jun 2004 14:39:02 -0000 1.2
@@ -67,8 +67,7 @@
</small></pre><pre class="diff" id="context"> }
public Object instantiate(Class servletClass) throws InstantiationException, IllegalAccessException {
</pre><pre class="diff" id="removed">- MutablePicoContainer picoContainer = new DefaultPicoContainer();
- picoContainer.addParent(parentContainer);
</pre><pre class="diff" id="added">+ MutablePicoContainer picoContainer = new DefaultPicoContainer(parentContainer);
</pre><pre class="diff" id="context"> picoContainer.registerComponentImplementation(servletClass);
return picoContainer.getComponentInstance(servletClass);
}
</pre></div>
<hr /><a name="file7" /><div class="file">
<span class="pathname">spice/sandbox/jervlet/jervlet/src/java/org/jcomponent/jervlet/blocks/deployer<br /></span>
<div class="fileheader"><big><b>JervletDeployer.java</b></big> <small id="info">1.2 -> 1.3</small></div>
<pre class="diff"><small id="info">diff -u -r1.2 -r1.3
--- JervletDeployer.java 6 Nov 2003 20:25:47 -0000 1.2
+++ JervletDeployer.java 19 Jun 2004 14:39:02 -0000 1.3
@@ -63,7 +63,6 @@
</small></pre><pre class="diff" id="context"> import org.apache.avalon.framework.service.ServiceException;
import org.apache.avalon.framework.service.ServiceManager;
import org.apache.avalon.framework.service.Serviceable;
</pre><pre class="diff" id="removed">-import org.apache.avalon.phoenix.BlockContext;
</pre><pre class="diff" id="context">
/**
* @phoenix:block
</pre><pre class="diff"><small id="info">@@ -77,14 +76,14 @@
</small></pre><pre class="diff" id="context"> extends AbstractLogEnabled
implements Contextualizable, Serviceable, Configurable, Initializable
{
</pre><pre class="diff" id="removed">- private <span id="removedchars">Block</span>Context m_context;
</pre><pre class="diff" id="added">+ private Context m_context;
</pre><pre class="diff" id="context"> private Configuration m_configuration;
private ServiceManager m_manager;
private Jervlet m_jervlet;
public void contextualize( final Context context )
{
</pre><pre class="diff" id="removed">- m_context = <span id="removedchars">(BlockContext)</span>context;
</pre><pre class="diff" id="added">+ m_context = context;
</pre><pre class="diff" id="context"> }
/**
</pre><pre class="diff"><small id="info">@@ -144,8 +143,9 @@
</small></pre><pre class="diff" id="context"> }
else
{
</pre><pre class="diff" id="removed">- return new File( m_context.getBaseDirectory().getAbsolutePath()
- + File.separatorChar + path );
</pre><pre class="diff" id="added"><a name="task1" />+ return new File( "<span class="task">TODO</span>");
+// m_context.getBaseDirectory().getAbsolutePath()
+ // + File.separatorChar + path );
</pre><pre class="diff" id="context"> }
}
}
</pre></div>
<center><small><a href="http://www.badgers-in-foil.co.uk/projects/cvsspam/" title="commit -> email">CVSspam</a> 0.2.8</small></center>
</body></html>