[CVS spice] Reworked to work better with Groovy builders
sjoberg-yCVjj/[email protected] 19 Oct 2005 14:56:28 -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/components/jervlet/src/java/org/codehaus/spice/jervlet/containers/jetty/pico</tt></b><span id="info"> on MAIN</span></td></tr>
<tr><td><tt><a href="#file1">PicoJettyContainer.java</a></tt></td><td align="right" id="added">+70</td><td align="right" id="removed">-11</td><td nowrap="nowrap" align="center">1.6 -> 1.7</td></tr>
</table>
<div class="tasklist"><ul>
<li><a href="#task1">TODO: Note by Peter R; Can these monitors be hooked into pico's {@link org.picocontainer.ComponentMonitor} support?</a></li>
</ul></div>
<pre class="comment">
Reworked to work better with Groovy builders
</pre>
<hr /><a name="file1" /><div class="file">
<span class="pathname">spice/components/jervlet/src/java/org/codehaus/spice/jervlet/containers/jetty/pico<br /></span>
<div class="fileheader"><big><b>PicoJettyContainer.java</b></big> <small id="info">1.6 -> 1.7</small></div>
<pre class="diff"><small id="info">diff -u -r1.6 -r1.7
--- PicoJettyContainer.java 22 Aug 2005 00:38:55 -0000 1.6
+++ PicoJettyContainer.java 19 Oct 2005 14:56:28 -0000 1.7
@@ -7,10 +7,17 @@
</small></pre><pre class="diff" id="context"> */
package org.codehaus.spice.jervlet.containers.jetty.pico;
</pre><pre class="diff" id="removed">-import org.codehaus.spice.jervlet.<span id="removedchars">*</span>;
</pre><pre class="diff" id="added">+import org.codehaus.spice.jervlet.<span id="addedchars">Container</span>;
+import org.codehaus.spice.jervlet.ContextHandler;
+import org.codehaus.spice.jervlet.ContextMonitor;
+import org.codehaus.spice.jervlet.Listener;
+import org.codehaus.spice.jervlet.ListenerException;
+import org.codehaus.spice.jervlet.ListenerHandler;
+import org.codehaus.spice.jervlet.ListenerMonitor;
</pre><pre class="diff" id="context"> import org.codehaus.spice.jervlet.containers.jetty.DefaultJettyContainer;
import org.codehaus.spice.jervlet.containers.jetty.JettyContainer;
import org.codehaus.spice.jervlet.containers.jetty.ShieldingJettyContainer;
</pre><pre class="diff" id="added">+
</pre><pre class="diff" id="context"> import org.picocontainer.Startable;
import java.io.File;
</pre><pre class="diff"><small id="info">@@ -33,10 +40,22 @@
</small></pre><pre class="diff" id="context"> /** Wrapped Jetty container */
private JettyContainer m_container;
</pre><pre class="diff" id="added">+ /** Optional configuration for the (wrapped) Jetty container */
+ private JettyContainerConfiguration m_configuration;
+
+ /** Optional Context Monitor */
+ private ContextMonitor m_contextMonitor;
+
+ /** Optional Listener Monitor */
+ private ListenerMonitor m_listenerMonitor;
+
+ /** Flag indicating if <code>m_container</code> has been initialized */
+ private boolean m_isInitialized = false;
+
</pre><pre class="diff" id="context"> /**
* Create a new Pico style JettyContainer will NOOP monitors
*
</pre><pre class="diff" id="removed">- * <span id="removedchars">todo c</span>an these monitors be hooked into pico's {@link org.picocontainer.ComponentMonitor} support?
</pre><pre class="diff" id="added"><a name="task1" />+ * <span id="addedchars"><span class="task">TODO</span>: Note by Peter R; C</span>an these monitors be hooked into pico's {@link org.picocontainer.ComponentMonitor} support?
</pre><pre class="diff" id="context"> */
public PicoJettyContainer()
{
</pre><pre class="diff"><small id="info">@@ -72,33 +91,73 @@
</small></pre><pre class="diff" id="context"> ListenerMonitor listenerMonitor )
{
</pre><pre class="diff" id="removed">- if( null != configuration && configuration.shieldJetty() )
</pre><pre class="diff" id="added">+ m_configuration = configuration;
+ m_contextMonitor = contextMonitor;
+ m_listenerMonitor = listenerMonitor;
+ }
+
+ /**
+ * Set the configuration. This has no effect if
+ * the container has been started or initialized.
+ *
+ * @param configuration the configuratin or null to clear
+ */
+ public void setConfiguration( JettyContainerConfiguration configuration )
+ {
+ if( !m_isInitialized )
+ {
+ m_configuration = configuration;
+ }
+ }
+
+ /**
+ * Create and initialize the underlaying Jetty container
+ *
+ * @throws RuntimeException on all errors
+ */
+ public void initialize()
+ {
+ if( m_isInitialized )
+ {
+ return;
+ }
+ if( null != m_configuration && m_configuration.shieldJetty() )
</pre><pre class="diff" id="context"> {
ShieldingJettyContainer shieldingJettyContainer =
new ShieldingJettyContainer();
shieldingJettyContainer.addJettyProperties(
</pre><pre class="diff" id="removed">- configuration.getProperties() );
</pre><pre class="diff" id="added">+ <span id="addedchars">m_</span>configuration.getProperties() );
</pre><pre class="diff" id="context"> m_container = shieldingJettyContainer;
}
else
{
m_container = new DefaultJettyContainer();
}
</pre><pre class="diff" id="removed">- Object jettyConfiguration = getJettyConfiguration( configuration );
</pre><pre class="diff" id="added">+
+ Object jettyConfiguration = getJettyConfiguration( m_configuration );
</pre><pre class="diff" id="context"> if( null != jettyConfiguration )
{
m_container.setJettyConfiguration( jettyConfiguration );
}
</pre><pre class="diff" id="removed">- if( null != contextMonitor )
</pre><pre class="diff" id="added">+ if( null != <span id="addedchars">m_</span>contextMonitor )
</pre><pre class="diff" id="context"> {
</pre><pre class="diff" id="removed">- m_container.setContextMonitor( contextMonitor );
</pre><pre class="diff" id="added">+ m_container.setContextMonitor( <span id="addedchars">m_</span>contextMonitor );
</pre><pre class="diff" id="context"> }
</pre><pre class="diff" id="removed">- if( null != listenerMonitor )
</pre><pre class="diff" id="added">+ if( null != <span id="addedchars">m_</span>listenerMonitor )
</pre><pre class="diff" id="context"> {
</pre><pre class="diff" id="removed">- m_container.setListenerMonitor( listenerMonitor );
</pre><pre class="diff" id="added">+ m_container.setListenerMonitor( <span id="addedchars">m_</span>listenerMonitor );
</pre><pre class="diff" id="context"> }
</pre><pre class="diff" id="removed">- }
</pre><pre class="diff" id="context">
</pre><pre class="diff" id="added">+ try
+ {
+ m_container.initialize();
+ }
+ catch( Exception e )
+ {
+ throw new RuntimeException( e );
+ }
+ m_isInitialized = true;
+ }
</pre><pre class="diff" id="context">
/**
* Start the Jetty container
</pre><pre class="diff"><small id="info">@@ -111,9 +170,9 @@
</small></pre><pre class="diff" id="context"> */
public void start()
{
</pre><pre class="diff" id="added">+ initialize();
</pre><pre class="diff" id="context"> try
{
</pre><pre class="diff" id="removed">- m_container.initialize();
</pre><pre class="diff" id="context"> m_container.start();
}
catch( Exception e )
</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>