[CVS spice] Making AvalonJettyContainer implement the Container and ListenerHandler interfaces.

sjoberg-yCVjj/[email protected] 10 Aug 2005 22:19:39 -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/avalon</tt></b><span id="info"> on MAIN</span></td></tr>
<tr><td><tt><a href="#file1">AvalonJettyContainer.java</a></tt></td><td align="right" id="added">+84</td><td align="right" id="removed">-1</td><td nowrap="nowrap" align="center">1.1 -&gt; 1.2</td></tr>
</table>
<pre class="comment">
Making AvalonJettyContainer implement the Container and ListenerHandler interfaces.
</pre>
<hr /><a name="file1" /><div class="file">
<span class="pathname">spice/components/jervlet/src/java/org/codehaus/spice/jervlet/containers/jetty/avalon<br /></span>
<div class="fileheader"><big><b>AvalonJettyContainer.java</b></big> <small id="info">1.1 -&gt; 1.2</small></div>
<pre class="diff"><small id="info">diff -u -r1.1 -r1.2
--- AvalonJettyContainer.java	5 Jul 2005 13:32:12 -0000	1.1
+++ AvalonJettyContainer.java	10 Aug 2005 22:19:39 -0000	1.2
@@ -11,6 +11,7 @@
</small></pre><pre class="diff" id="context"> import java.net.MalformedURLException;
 import java.net.URL;
 import java.util.Properties;
</pre><pre class="diff" id="added">+import java.util.List;
</pre><pre class="diff" id="context"> 
 import org.apache.avalon.framework.activity.Initializable;
 import org.apache.avalon.framework.activity.Startable;
</pre><pre class="diff"><small id="info">@@ -24,7 +25,12 @@
</small></pre><pre class="diff" id="context"> import org.apache.avalon.framework.service.ServiceManager;
 import org.apache.avalon.framework.service.Serviceable;
 
</pre><pre class="diff" id="added">+import org.codehaus.spice.jervlet.Container;
+import org.codehaus.spice.jervlet.ContextHandler;
</pre><pre class="diff" id="context"> import org.codehaus.spice.jervlet.ContextMonitor;
</pre><pre class="diff" id="added">+import org.codehaus.spice.jervlet.Listener;
+import org.codehaus.spice.jervlet.ListenerException;
+import org.codehaus.spice.jervlet.ListenerHandler;
</pre><pre class="diff" id="context"> import org.codehaus.spice.jervlet.ListenerMonitor;
 import org.codehaus.spice.jervlet.containers.jetty.DefaultJettyContainer;
 import org.codehaus.spice.jervlet.containers.jetty.JettyContainer;
</pre><pre class="diff"><small id="info">@@ -37,7 +43,8 @@
</small></pre><pre class="diff" id="context">  * @dna.component
  */
 public class AvalonJettyContainer
</pre><pre class="diff" id="removed">-    implements LogEnabled, Configurable, Serviceable, Initializable, Startable
</pre><pre class="diff" id="added">+    implements Container, ListenerHandler, LogEnabled,
+      Configurable, Serviceable, Initializable, Startable
</pre><pre class="diff" id="context"> {
     private Logger m_logger;
     private JettyContainer m_container;
</pre><pre class="diff"><small id="info">@@ -262,5 +269,81 @@
</small></pre><pre class="diff" id="context">             return urlConfiguration;
         }
         return null;
</pre><pre class="diff" id="added">+    }
+
+    /**
+     * Create a new context handler.
+     *
+     * @return A new ContextHandler.
+     */
+    public ContextHandler createContextHandler()
+    {
+        return m_container;
+    }
+
+    /**
+     * Destroy a context handler. If the given context
+     * handler still has contexts, they will be stopped
+     * and removed before destruction.
+     *
+     * @param contextHandler The ContextHandler to destroy
+     */
+    public void destroyContextHandler( ContextHandler contextHandler )
+    {
+        m_container.destroyContextHandler( contextHandler );
+    }
+
+    /**
+     * Add a &lt;code&gt;Listener&lt;/code&gt; the container.
+     */
+    public void addListener( Listener listener ) throws ListenerException
+    {
+        m_container.addListener( listener );
+    }
+
+    /**
+     * Remove a &lt;code&gt;Listener&lt;/code&gt; from the container.
+     */
+    public void removeListener( Listener listener ) throws ListenerException
+    {
+        m_container.removeListener( listener );
+    }
+
+    /**
+     * Start a &lt;code&gt;Listener&lt;/code&gt;.
+     */
+    public void startListener( Listener listener ) throws ListenerException
+    {
+        m_container.startListener( listener );
+    }
+
+    /**
+     * Stop a &lt;code&gt;Listener&lt;/code&gt;.
+     */
+    public void stopListener( Listener listener ) throws ListenerException
+    {
+        m_container.stopListener( listener );
+    }
+
+    /**
+     * Fetch a list of all current &lt;code&gt;Listener&lt;/code&gt;s. If there are
+     * no listener the returned list can be empty.
+     *
+     * @return All new list all current listeners.
+     */
+    public List getListeners()
+    {
+        return m_container.getListeners();
+    }
+
+    /**
+     * Check if a &lt;code&gt;Listener&lt;/code&gt; is started or not.
+     *
+     * @param listener The listener
+     * @return True if the listener is started, else false.
+     */
+    public boolean isStarted( Listener listener )
+    {
+        return m_container.isStarted( listener );
</pre><pre class="diff" id="context">     }
 }
</pre></div>
<center><small><a href="http://www.badgers-in-foil.co.uk/projects/cvsspam/" title="commit -&gt; email">CVSspam</a> 0.2.8</small></center>
</body></html>