[CVS jcontainer] Renamed org.jcontainer.loom -> org.codehaus.loom

mauro-yCVjj/[email protected] Mon, 19 Apr 2004 16:35:55 -0500
Newsgroups gmane.comp.java.jcontainer.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>jcontainer/loom/launcher</tt></b><span id="info"> on MAIN</span></td></tr>
<tr><td><tt>src/java/org/codehaus/loom/launcher/<a href="#file1"><span id="added">Main.java</span></a></tt></td><td align="right" id="added">+237</td><td></td><td nowrap="nowrap" align="right">added <a href="http://xstream.cvs.codehaus.org/jcontainer/loom/launcher/src/java/org/codehaus/loom/launcher/Main.java?rev=1.1&amp;content-type=text/vnd.viewcvs-markup">1.1</a></td></tr>
<tr class="alt"><td><tt>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;/<a href="#file2"><span id="added">package.html</span></a></tt></td><td align="right" id="added">+3</td><td></td><td nowrap="nowrap" align="right">added <a href="http://xstream.cvs.codehaus.org/jcontainer/loom/launcher/src/java/org/codehaus/loom/launcher/package.html?rev=1.1&amp;content-type=text/vnd.viewcvs-markup">1.1</a></td></tr>
<tr><td><tt>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;/<a href="#file3"><span id="added">ShutdownHook.java</span></a></tt></td><td align="right" id="added">+99</td><td></td><td nowrap="nowrap" align="right">added <a href="http://xstream.cvs.codehaus.org/jcontainer/loom/launcher/src/java/org/codehaus/loom/launcher/ShutdownHook.java?rev=1.1&amp;content-type=text/vnd.viewcvs-markup">1.1</a></td></tr>
<tr class="alt"><td><tt>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;/<a href="#file4"><span id="added">LauncherUtils.java</span></a></tt></td><td align="right" id="added">+201</td><td></td><td nowrap="nowrap" align="right">added <a href="http://xstream.cvs.codehaus.org/jcontainer/loom/launcher/src/java/org/codehaus/loom/launcher/LauncherUtils.java?rev=1.1&amp;content-type=text/vnd.viewcvs-markup">1.1</a></td></tr>
<tr><td><tt>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;/<a href="#file5"><span id="added">FreeNEasyPolicy.java</span></a></tt></td><td align="right" id="added">+111</td><td></td><td nowrap="nowrap" align="right">added <a href="http://xstream.cvs.codehaus.org/jcontainer/loom/launcher/src/java/org/codehaus/loom/launcher/FreeNEasyPolicy.java?rev=1.1&amp;content-type=text/vnd.viewcvs-markup">1.1</a></td></tr>
<tr class="alt"><td><tt>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;/<a href="#file6"><span id="added">DaemonLauncher.java</span></a></tt></td><td align="right" id="added">+307</td><td></td><td nowrap="nowrap" align="right">added <a href="http://xstream.cvs.codehaus.org/jcontainer/loom/launcher/src/java/org/codehaus/loom/launcher/DaemonLauncher.java?rev=1.1&amp;content-type=text/vnd.viewcvs-markup">1.1</a></td></tr>
<tr><td><tt>src/java/org/jcontainer/loom/launcher/<a href="#file7"><span id="removed">ShutdownHook.java</span></a></tt></td><td></td><td align="right" id="removed">-99</td><td nowrap="nowrap"><a href="http://xstream.cvs.codehaus.org/jcontainer/loom/launcher/src/java/org/jcontainer/loom/launcher/ShutdownHook.java?rev=1.1&amp;content-type=text/vnd.viewcvs-markup">1.1</a> removed</td></tr>
<tr class="alt"><td><tt>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;/<a href="#file8"><span id="removed">FreeNEasyPolicy.java</span></a></tt></td><td></td><td align="right" id="removed">-111</td><td nowrap="nowrap"><a href="http://xstream.cvs.codehaus.org/jcontainer/loom/launcher/src/java/org/jcontainer/loom/launcher/FreeNEasyPolicy.java?rev=1.3&amp;content-type=text/vnd.viewcvs-markup">1.3</a> removed</td></tr>
<tr><td><tt>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;/<a href="#file9"><span id="removed">Main.java</span></a></tt></td><td></td><td align="right" id="removed">-237</td><td nowrap="nowrap"><a href="http://xstream.cvs.codehaus.org/jcontainer/loom/launcher/src/java/org/jcontainer/loom/launcher/Main.java?rev=1.7&amp;content-type=text/vnd.viewcvs-markup">1.7</a> removed</td></tr>
<tr class="alt"><td><tt>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;/<a href="#file10"><span id="removed">DaemonLauncher.java</span></a></tt></td><td></td><td align="right" id="removed">-307</td><td nowrap="nowrap"><a href="http://xstream.cvs.codehaus.org/jcontainer/loom/launcher/src/java/org/jcontainer/loom/launcher/DaemonLauncher.java?rev=1.4&amp;content-type=text/vnd.viewcvs-markup">1.4</a> removed</td></tr>
<tr><td><tt>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;/<a href="#file11"><span id="removed">package.html</span></a></tt></td><td></td><td align="right" id="removed">-3</td><td nowrap="nowrap"><a href="http://xstream.cvs.codehaus.org/jcontainer/loom/launcher/src/java/org/jcontainer/loom/launcher/package.html?rev=1.2&amp;content-type=text/vnd.viewcvs-markup">1.2</a> removed</td></tr>
<tr class="alt"><td><tt>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;/<a href="#file12"><span id="removed">LauncherUtils.java</span></a></tt></td><td></td><td align="right" id="removed">-201</td><td nowrap="nowrap"><a href="http://xstream.cvs.codehaus.org/jcontainer/loom/launcher/src/java/org/jcontainer/loom/launcher/LauncherUtils.java?rev=1.6&amp;content-type=text/vnd.viewcvs-markup">1.6</a> removed</td></tr>
<tr><td><tt><a href="#file13">project.xml</a></tt></td><td align="right" id="added">+1</td><td align="right" id="removed">-1</td><td nowrap="nowrap" align="center"><a href="http://xstream.cvs.codehaus.org/jcontainer/loom/launcher/project.xml?rev=1.3&amp;content-type=text/vnd.viewcvs-markup">1.3</a> <a href="http://xstream.cvs.codehaus.org/jcontainer/loom/launcher/project.xml.diff?r1=1.3&amp;r2=1.4">-&gt;</a> <a href="http://xstream.cvs.codehaus.org/jcontainer/loom/launcher/project.xml?rev=1.4&amp;content-type=text/vnd.viewcvs-markup">1.4</a></td></tr>
<tr class="alt"><td><tt>src/test/org/codehaus/loom/launcher/<span id="added">.ignoreme</span></tt></td><td colspan="2" align="center"><small id="info">[empty]</small></td><td nowrap="nowrap" align="right">added <a href="http://xstream.cvs.codehaus.org/jcontainer/loom/launcher/src/test/org/codehaus/loom/launcher/.ignoreme?rev=1.1&amp;content-type=text/vnd.viewcvs-markup">1.1</a></td></tr>
<tr><td><tt>src/etc/<a href="#file15">manifest.txt</a></tt></td><td align="right" id="added">+1</td><td align="right" id="removed">-1</td><td nowrap="nowrap" align="center"><a href="http://xstream.cvs.codehaus.org/jcontainer/loom/launcher/src/etc/manifest.txt?rev=1.1&amp;content-type=text/vnd.viewcvs-markup">1.1</a> <a href="http://xstream.cvs.codehaus.org/jcontainer/loom/launcher/src/etc/manifest.txt.diff?r1=1.1&amp;r2=1.2">-&gt;</a> <a href="http://xstream.cvs.codehaus.org/jcontainer/loom/launcher/src/etc/manifest.txt?rev=1.2&amp;content-type=text/vnd.viewcvs-markup">1.2</a></td></tr>
<tr class="alt"><td><tt>src/test/org/jcontainer/loom/launcher/<span id="removed">.ignoreme</span></tt></td><td colspan="2" align="center"><small id="info">[empty]</small></td><td nowrap="nowrap"><a href="http://xstream.cvs.codehaus.org/jcontainer/loom/launcher/src/test/org/jcontainer/loom/launcher/.ignoreme?rev=1.1&amp;content-type=text/vnd.viewcvs-markup">1.1</a> removed</td></tr>
<tr><td></td><td align="right" id="added">+960</td><td align="right" id="removed">-960</td><td></td></tr>
</table>
<small id="info">7 added + 7 removed + 2 modified, total 16 files</small><br />
<pre class="comment">
Renamed org.jcontainer.loom -&gt; org.codehaus.loom
</pre>
<hr /><a name="file1" /><div class="file">
<span class="pathname" id="added"><a href="http://xstream.cvs.codehaus.org/jcontainer">jcontainer</a>/<a href="http://xstream.cvs.codehaus.org/jcontainer/loom">loom</a>/<a href="http://xstream.cvs.codehaus.org/jcontainer/loom/launcher">launcher</a>/<a href="http://xstream.cvs.codehaus.org/jcontainer/loom/launcher/src">src</a>/<a href="http://xstream.cvs.codehaus.org/jcontainer/loom/launcher/src/java">java</a>/<a href="http://xstream.cvs.codehaus.org/jcontainer/loom/launcher/src/java/org">org</a>/<a href="http://xstream.cvs.codehaus.org/jcontainer/loom/launcher/src/java/org/codehaus">codehaus</a>/<a href="http://xstream.cvs.codehaus.org/jcontainer/loom/launcher/src/java/org/codehaus/loom">loom</a>/<a href="http://xstream.cvs.codehaus.org/jcontainer/loom/launcher/src/java/org/codehaus/loom/launcher">launcher</a><br /></span>
<div class="fileheader" id="added"><big><b>Main.java</b></big> <small id="info">added at <a href="http://xstream.cvs.codehaus.org/jcontainer/loom/launcher/src/java/org/codehaus/loom/launcher/Main.java?rev=1.1&amp;content-type=text/vnd.viewcvs-markup">1.1</a></small></div>
<pre class="diff"><small id="info">diff -N Main.java
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ Main.java	19 Apr 2004 21:35:53 -0000	1.1
@@ -0,0 +1,237 @@
</small></pre><pre class="diff" id="added">+/* ====================================================================
+ * JContainer Software License, version 1.1
+ *
+ * Copyright (c) 2003, JContainer Group. 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. Neither the name of the JContainer Group nor the name "Loom" nor
+ *    the names of its contributors may be used to endorse or promote
+ *    products derived from this software without specific prior
+ *    written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS 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
+ * COPYRIGHT OWNER OR 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.
+ *
+ * ====================================================================
+ *
+ * JContainer Loom includes code from the Apache Software Foundation
+ *
+ * ====================================================================
+ * The Apache Software License, Version 1.1
+ *
+ * Copyright (c) 1997-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 "Jakarta", "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.
+ */
+package org.codehaus.loom.launcher;
+
+import java.io.File;
+import java.lang.reflect.Method;
+import java.net.URL;
+import java.net.URLClassLoader;
+import java.security.Policy;
+import java.util.HashMap;
+import java.util.Map;
+
+/**
+ * LoomLoader is the class that bootstraps and sets up engine ClassLoader. It
+ * also sets up a default policy that gives full permissions to engine code.
+ *
+ * @author Peter Donald
+ */
+public final class Main
+{
+    private static Object c_frontend;
+    private static ShutdownHook c_hook;
+
+    /**
+     * Main entry point for Loom.
+     *
+     * @param args the command line arguments
+     * @throws java.lang.Exception if an error occurs
+     */
+    public static final void main( final String[] args )
+        throws Exception
+    {
+        final int exitCode =
+            startup( args, new HashMap(), true );
+        System.exit( exitCode );
+    }
+
+    /**
+     * Method to call to startup Loom from an external (calling) application.
+     * Protected to allow access from DaemonLauncher.
+     *
+     * @param options the command line arg array
+     * @param data a set of extra parameters to pass to embeddor
+     * @param blocking false if the current thread is expected to return.
+     * @return the exit code which should be used to exit the JVM
+     */
+    protected static final int startup( final String[] options,
+                                        final Map data,
+                                        final boolean blocking )
+    {
+        int exitCode;
+        try
+        {
+            //setup new Policy manager
+            Policy.setPolicy( new FreeNEasyPolicy() );
+
+            //Create engine ClassLoader
+            final File homeDir =
+                LauncherUtils.findLoomHome( "loom.home", "loom-launcher.jar" );
+
+            final URL[] urls =
+                LauncherUtils.generateClassPath( homeDir, "container/lib" );
+            final URLClassLoader classLoader = new URLClassLoader( urls );
+
+            data.put( ClassLoader.class.getName() + "/common",
+                      ClassLoader.getSystemClassLoader() );
+            data.put( ClassLoader.class.getName() + "/container",
+                      classLoader );
+            data.put( File.class.getName() + "/home", homeDir );
+
+            //Setup context classloader
+            Thread.currentThread().setContextClassLoader( classLoader );
+
+            //Create main launcher
+            final Class clazz =
+                classLoader.loadClass( "org.codehaus.loom.frontends.CLIMain" );
+            final Class[] paramTypes =
+                new Class[]{options.getClass(), Map.class, Boolean.TYPE};
+            final Method method = clazz.getMethod( "main", paramTypes );
+
+            final Object frontend;
+            synchronized( Main.class )
+            {
+                c_frontend = clazz.newInstance();
+                frontend = c_frontend;
+            }
+
+            //By default add a shutdown hook that will invoke
+            //shutdown on container when JVM shuts down
+            final String enableShutdownHook =
+                System.getProperty( "disable.shutdown.hook" );
+            if( !"false".equals( enableShutdownHook ) )
+            {
+                c_hook = new ShutdownHook();
+                Runtime.getRuntime().addShutdownHook( c_hook );
+            }
+
+            //kick the tires and light the fires....
+            final Object[] args =
+                new Object[]{options, data, new Boolean( blocking )};
+            final Integer integer =
+                (Integer)method.invoke( frontend, args );
+            exitCode = integer.intValue();
+        }
+        catch( final Exception e )
+        {
+            e.printStackTrace();
+            exitCode = 1;
+        }
+        return exitCode;
+    }
+
+    /**
+     * Method to call to shutdown Loom from an external (calling) application.
+     * Protected to allow access from DaemonLauncher.
+     */
+    protected static final void shutdown()
+    {
+        final Object frontend;
+        synchronized( Main.class )
+        {
+            frontend = c_frontend;
+            c_frontend = null;
+        }
+        if( null == frontend )
+        {
+            return;
+        }
+        if( null != c_hook &amp;&amp; c_hook != Thread.currentThread() )
+        {
+            //Null hook so it is not tried to be removed
+            //when we are shutting down. (Attempting to remove
+            //hook during shutdown raises an exception).
+
+            Runtime.getRuntime().removeShutdownHook( c_hook );
+            c_hook = null;
+        }
+
+        try
+        {
+            final Class clazz = frontend.getClass();
+            final Method method = clazz.getMethod( "shutdown",
+                                                   new Class[ 0 ] );
+
+            //Lets put this sucker to sleep
+            method.invoke( frontend, new Object[ 0 ] );
+        }
+        catch( final Exception e )
+        {
+            e.printStackTrace();
+        }
+    }
+}
</pre></div>
<hr /><a name="file2" /><div class="file">
<span class="pathname" id="added"><a href="http://xstream.cvs.codehaus.org/jcontainer">jcontainer</a>/<a href="http://xstream.cvs.codehaus.org/jcontainer/loom">loom</a>/<a href="http://xstream.cvs.codehaus.org/jcontainer/loom/launcher">launcher</a>/<a href="http://xstream.cvs.codehaus.org/jcontainer/loom/launcher/src">src</a>/<a href="http://xstream.cvs.codehaus.org/jcontainer/loom/launcher/src/java">java</a>/<a href="http://xstream.cvs.codehaus.org/jcontainer/loom/launcher/src/java/org">org</a>/<a href="http://xstream.cvs.codehaus.org/jcontainer/loom/launcher/src/java/org/codehaus">codehaus</a>/<a href="http://xstream.cvs.codehaus.org/jcontainer/loom/launcher/src/java/org/codehaus/loom">loom</a>/<a href="http://xstream.cvs.codehaus.org/jcontainer/loom/launcher/src/java/org/codehaus/loom/launcher">launcher</a><br /></span>
<div class="fileheader" id="added"><big><b>package.html</b></big> <small id="info">added at <a href="http://xstream.cvs.codehaus.org/jcontainer/loom/launcher/src/java/org/codehaus/loom/launcher/package.html?rev=1.1&amp;content-type=text/vnd.viewcvs-markup">1.1</a></small></div>
<pre class="diff"><small id="info">diff -N package.html
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ package.html	19 Apr 2004 21:35:53 -0000	1.1
@@ -0,0 +1,3 @@
</small></pre><pre class="diff" id="added">+&lt;html&gt;&lt;body&gt;
+Main entry point to the Loom application startup cycle.
+&lt;/body&gt;&lt;/html&gt;
</pre></div>
<hr /><a name="file3" /><div class="file">
<span class="pathname" id="added"><a href="http://xstream.cvs.codehaus.org/jcontainer">jcontainer</a>/<a href="http://xstream.cvs.codehaus.org/jcontainer/loom">loom</a>/<a href="http://xstream.cvs.codehaus.org/jcontainer/loom/launcher">launcher</a>/<a href="http://xstream.cvs.codehaus.org/jcontainer/loom/launcher/src">src</a>/<a href="http://xstream.cvs.codehaus.org/jcontainer/loom/launcher/src/java">java</a>/<a href="http://xstream.cvs.codehaus.org/jcontainer/loom/launcher/src/java/org">org</a>/<a href="http://xstream.cvs.codehaus.org/jcontainer/loom/launcher/src/java/org/codehaus">codehaus</a>/<a href="http://xstream.cvs.codehaus.org/jcontainer/loom/launcher/src/java/org/codehaus/loom">loom</a>/<a href="http://xstream.cvs.codehaus.org/jcontainer/loom/launcher/src/java/org/codehaus/loom/launcher">launcher</a><br /></span>
<div class="fileheader" id="added"><big><b>ShutdownHook.java</b></big> <small id="info">added at <a href="http://xstream.cvs.codehaus.org/jcontainer/loom/launcher/src/java/org/codehaus/loom/launcher/ShutdownHook.java?rev=1.1&amp;content-type=text/vnd.viewcvs-markup">1.1</a></small></div>
<pre class="diff"><small id="info">diff -N ShutdownHook.java
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ ShutdownHook.java	19 Apr 2004 21:35:53 -0000	1.1
@@ -0,0 +1,99 @@
</small></pre><pre class="diff" id="added">+/* ====================================================================
+ * JContainer Software License, version 1.1
+ *
+ * Copyright (c) 2003, JContainer Group. 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. Neither the name of the JContainer Group nor the name "Loom" nor
+ *    the names of its contributors may be used to endorse or promote
+ *    products derived from this software without specific prior
+ *    written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS 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
+ * COPYRIGHT OWNER OR 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.
+ *
+ * ====================================================================
+ *
+ * JContainer Loom includes code from the Apache Software Foundation
+ *
+ * ====================================================================
+ * The Apache Software License, Version 1.1
+ *
+ * Copyright (c) 1997-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 "Jakarta", "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.
+ */
+package org.codehaus.loom.launcher;
+
+final class ShutdownHook
+    extends Thread
+{
+    /**
+     * Run the shutdown hook.
+     */
+    public void run()
+    {
+        Main.shutdown();
+    }
+}
</pre></div>
<hr /><a name="file4" /><div class="file">
<span class="pathname" id="added"><a href="http://xstream.cvs.codehaus.org/jcontainer">jcontainer</a>/<a href="http://xstream.cvs.codehaus.org/jcontainer/loom">loom</a>/<a href="http://xstream.cvs.codehaus.org/jcontainer/loom/launcher">launcher</a>/<a href="http://xstream.cvs.codehaus.org/jcontainer/loom/launcher/src">src</a>/<a href="http://xstream.cvs.codehaus.org/jcontainer/loom/launcher/src/java">java</a>/<a href="http://xstream.cvs.codehaus.org/jcontainer/loom/launcher/src/java/org">org</a>/<a href="http://xstream.cvs.codehaus.org/jcontainer/loom/launcher/src/java/org/codehaus">codehaus</a>/<a href="http://xstream.cvs.codehaus.org/jcontainer/loom/launcher/src/java/org/codehaus/loom">loom</a>/<a href="http://xstream.cvs.codehaus.org/jcontainer/loom/launcher/src/java/org/codehaus/loom/launcher">launcher</a><br /></span>
<div class="fileheader" id="added"><big><b>LauncherUtils.java</b></big> <small id="info">added at <a href="http://xstream.cvs.codehaus.org/jcontainer/loom/launcher/src/java/org/codehaus/loom/launcher/LauncherUtils.java?rev=1.1&amp;content-type=text/vnd.viewcvs-markup">1.1</a></small></div>
<pre class="diff"><small id="info">diff -N LauncherUtils.java
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ LauncherUtils.java	19 Apr 2004 21:35:53 -0000	1.1
@@ -0,0 +1,201 @@
</small></pre><pre class="diff" id="added">+/* ====================================================================
+ * JContainer Software License, version 1.1
+ *
+ * Copyright (c) 2003, JContainer Group. 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. Neither the name of the JContainer Group nor the name "Loom" nor
+ *    the names of its contributors may be used to endorse or promote
+ *    products derived from this software without specific prior
+ *    written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS 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
+ * COPYRIGHT OWNER OR 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.
+ *
+ * ====================================================================
+ *
+ * JContainer Loom includes code from the Apache Software Foundation
+ *
+ * ====================================================================
+ * The Apache Software License, Version 1.1
+ *
+ * Copyright (c) 1997-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 "Jakarta", "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.
+ */
+package org.codehaus.loom.launcher;
+
+import java.io.File;
+import java.net.URL;
+import java.util.ArrayList;
+import java.util.StringTokenizer;
+
+/**
+ * A set of utilities that help when writing Launchers.
+ *
+ * @author Peter Donald
+ */
+public class LauncherUtils
+{
+    /**
+     * Create a ClassPath for the engine.
+     *
+     * @return the set of URLs that engine uses to load
+     * @throws Exception if unable to aquire classpath
+     */
+    static URL[] generateClassPath( final File homeDir,
+                                    final String libDirectory )
+        throws Exception
+    {
+        final ArrayList urls = new ArrayList();
+
+        final File dir = findLibDir( homeDir, libDirectory );
+        final File[] files = dir.listFiles();
+        for( int i = 0; i &lt; files.length; i++ )
+        {
+            final File file = files[ i ];
+            if( file.getName().endsWith( ".jar" ) )
+            {
+                urls.add( file.toURL() );
+            }
+        }
+
+        return (URL[])urls.toArray( new URL[ urls.size() ] );
+    }
+
+    /**
+     * Find directory to load engine specific libraries from.
+     *
+     * @return the lib dir
+     * @throws Exception if unable to aquire directory
+     */
+    static File findLibDir( final File homeDir,
+                            final String libDirectory )
+        throws Exception
+    {
+        final String engineLibDir = libDirectory.replace( '/',
+                                                          File.separatorChar );
+        final File dir = new File( homeDir, engineLibDir ).getCanonicalFile();
+        if( !dir.exists() )
+        {
+            throw new Exception(
+                "Unable to locate library directory at " + engineLibDir );
+        }
+        return dir;
+    }
+
+    /**
+     * Utility method to find the home directory of Loom and make sure system
+     * property is set to it.
+     *
+     * @return the location of loom directory
+     * @throws Exception if unable to locate directory
+     */
+    static File findLoomHome( final String systemProperty,
+                              final String loaderJar )
+        throws Exception
+    {
+        String loomHome = System.getProperty( systemProperty, null );
+        if( null == loomHome )
+        {
+            final File loaderDir =
+                findLoaderDir( systemProperty, loaderJar );
+            return loaderDir.getCanonicalFile().getParentFile();
+        }
+        else
+        {
+            return new File( loomHome ).getCanonicalFile();
+        }
+    }
+
+    /**
+     * Finds the loaderJar file in the classpath.
+     */
+    private static final File findLoaderDir( final String systemProperty,
+                                             final String loaderJar )
+        throws Exception
+    {
+        final String classpath = System.getProperty( "java.class.path" );
+        final String pathSeparator = System.getProperty( "path.separator" );
+        final StringTokenizer tokenizer = new StringTokenizer( classpath,
+                                                               pathSeparator );
+
+        while( tokenizer.hasMoreTokens() )
+        {
+            final String element = tokenizer.nextToken();
+
+            if( element.endsWith( loaderJar ) )
+            {
+                File file = ( new File( element ) ).getCanonicalFile();
+                file = file.getParentFile();
+                return file;
+            }
+        }
+
+        throw new Exception( "Unable to locate " +
+                             loaderJar +
+                             " in classpath. User must specify " +
+                             systemProperty + " system property." );
+    }
+}
</pre></div>
<hr /><a name="file5" /><div class="file">
<span class="pathname" id="added"><a href="http://xstream.cvs.codehaus.org/jcontainer">jcontainer</a>/<a href="http://xstream.cvs.codehaus.org/jcontainer/loom">loom</a>/<a href="http://xstream.cvs.codehaus.org/jcontainer/loom/launcher">launcher</a>/<a href="http://xstream.cvs.codehaus.org/jcontainer/loom/launcher/src">src</a>/<a href="http://xstream.cvs.codehaus.org/jcontainer/loom/launcher/src/java">java</a>/<a href="http://xstream.cvs.codehaus.org/jcontainer/loom/launcher/src/java/org">org</a>/<a href="http://xstream.cvs.codehaus.org/jcontainer/loom/launcher/src/java/org/codehaus">codehaus</a>/<a href="http://xstream.cvs.codehaus.org/jcontainer/loom/launcher/src/java/org/codehaus/loom">loom</a>/<a href="http://xstream.cvs.codehaus.org/jcontainer/loom/launcher/src/java/org/codehaus/loom/launcher">launcher</a><br /></span>
<div class="fileheader" id="added"><big><b>FreeNEasyPolicy.java</b></big> <small id="info">added at <a href="http://xstream.cvs.codehaus.org/jcontainer/loom/launcher/src/java/org/codehaus/loom/launcher/FreeNEasyPolicy.java?rev=1.1&amp;content-type=text/vnd.viewcvs-markup">1.1</a></small></div>
<pre class="diff"><small id="info">diff -N FreeNEasyPolicy.java
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ FreeNEasyPolicy.java	19 Apr 2004 21:35:53 -0000	1.1
@@ -0,0 +1,111 @@
</small></pre><pre class="diff" id="added">+/* ====================================================================
+ * JContainer Software License, version 1.1
+ *
+ * Copyright (c) 2003, JContainer Group. 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. Neither the name of the JContainer Group nor the name "Loom" nor
+ *    the names of its contributors may be used to endorse or promote
+ *    products derived from this software without specific prior
+ *    written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS 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
+ * COPYRIGHT OWNER OR 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.
+ *
+ * ====================================================================
+ *
+ * JContainer Loom includes code from the Apache Software Foundation
+ *
+ * ====================================================================
+ * The Apache Software License, Version 1.1
+ *
+ * Copyright (c) 1997-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 "Jakarta", "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.
+ */
+package org.codehaus.loom.launcher;
+
+import java.security.CodeSource;
+import java.security.PermissionCollection;
+import java.security.Permissions;
+import java.security.Policy;
+
+/**
+ * Default polic class to give every code base all permssions. Will be replaced
+ * once the kernel loads.
+ */
+class FreeNEasyPolicy
+    extends Policy
+{
+    public PermissionCollection getPermissions( final CodeSource codeSource )
+    {
+        final Permissions permissions = new Permissions();
+        permissions.add( new java.security.AllPermission() );
+        return permissions;
+    }
+
+    public void refresh()
+    {
+    }
+}
</pre></div>
<hr /><a name="file6" /><div class="file">
<span class="pathname" id="added"><a href="http://xstream.cvs.codehaus.org/jcontainer">jcontainer</a>/<a href="http://xstream.cvs.codehaus.org/jcontainer/loom">loom</a>/<a href="http://xstream.cvs.codehaus.org/jcontainer/loom/launcher">launcher</a>/<a href="http://xstream.cvs.codehaus.org/jcontainer/loom/launcher/src">src</a>/<a href="http://xstream.cvs.codehaus.org/jcontainer/loom/launcher/src/java">java</a>/<a href="http://xstream.cvs.codehaus.org/jcontainer/loom/launcher/src/java/org">org</a>/<a href="http://xstream.cvs.codehaus.org/jcontainer/loom/launcher/src/java/org/codehaus">codehaus</a>/<a href="http://xstream.cvs.codehaus.org/jcontainer/loom/launcher/src/java/org/codehaus/loom">loom</a>/<a href="http://xstream.cvs.codehaus.org/jcontainer/loom/launcher/src/java/org/codehaus/loom/launcher">launcher</a><br /></span>
<div class="fileheader" id="added"><big><b>DaemonLauncher.java</b></big> <small id="info">added at <a href="http://xstream.cvs.codehaus.org/jcontainer/loom/launcher/src/java/org/codehaus/loom/launcher/DaemonLauncher.java?rev=1.1&amp;content-type=text/vnd.viewcvs-markup">1.1</a></small></div>
<pre class="diff"><small id="info">diff -N DaemonLauncher.java
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ DaemonLauncher.java	19 Apr 2004 21:35:53 -0000	1.1
@@ -0,0 +1,307 @@
</small></pre><pre class="diff" id="added">+/* ====================================================================
+ * JContainer Software License, version 1.1
+ *
+ * Copyright (c) 2003, JContainer Group. 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. Neither the name of the JContainer Group nor the name "Loom" nor
+ *    the names of its contributors may be used to endorse or promote
+ *    products derived from this software without specific prior
+ *    written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS 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
+ * COPYRIGHT OWNER OR 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.
+ *
+ * ====================================================================
+ *
+ * JContainer Loom includes code from the Apache Software Foundation
+ *
+ * ====================================================================
+ * The Apache Software License, Version 1.1
+ *
+ * Copyright (c) 1997-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 "Jakarta", "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.
+ */
+package org.codehaus.loom.launcher;
+
+import java.util.Hashtable;
+import java.util.Observable;
+import java.util.Observer;
+import org.tanukisoftware.wrapper.WrapperListener;
+import org.tanukisoftware.wrapper.WrapperManager;
+
+/**
+ * A frontend for Phoenix that starts it as a native service using the Java
+ * Service Wrapper at http://wrapper.tanukisoftware.org
+ *
+ * @author Peter Donald
+ * @author &lt;a href="mailto:[email protected]"&gt;Leif Mortenson&lt;/a&gt;
+ */
+public class DaemonLauncher
+    implements WrapperListener, Observer
+{
+    /**
+     * In order to avoid calling the Wrapper stop method recursively, we need to
+     * keep track of whether or not the Wrapper already knows we are stopping.
+     * Necessary because of the way the shutdown process in Phoenix works.
+     * Ideally, we would unregister this Observer with CLIMain but we can't do
+     * that for security reasons.
+     */
+    private boolean m_ignoreUpdates = false;
+
+    /*---------------------------------------------------------------
+     * WrapperListener Methods
+     *-------------------------------------------------------------*/
+    /**
+     * The start method is called when the WrapperManager is signaled by the
+     * native wrapper code that it can start its application.  This method call
+     * is expected to return, so a new thread should be launched if necessary.
+     *
+     * @param args List of arguments used to initialize the application.
+     * @return Any error code if the application should exit on completion of
+     *         the start method.  If there were no problems then this method
+     *         should return null.
+     */
+    public Integer start( final String[] args )
+    {
+        Integer exitCodeInteger = null;
+
+        // This startup could take a while, so tell the wrapper to be patient.
+        WrapperManager.signalStarting( 45000 );
+
+        final Hashtable data = new Hashtable();
+        data.put( Observer.class.getName(), this );
+
+        if( WrapperManager.isDebugEnabled() )
+        {
+            System.out.println( "DaemonLauncher: starting up." );
+        }
+
+        try
+        {
+            int exitCode = Main.startup( args, data, false );
+            if( exitCode != 0 )
+            {
+                exitCodeInteger = new Integer( exitCode );
+            }
+
+            if( WrapperManager.isDebugEnabled() )
+            {
+                System.out.println( "DaemonLauncher: startup completed." );
+            }
+        }
+        catch( final Exception e )
+        {
+            e.printStackTrace();
+            exitCodeInteger = new Integer( 1 );
+        }
+
+        // We are almost up now, so reset the wait time
+        WrapperManager.signalStarting( 2000 );
+
+        return exitCodeInteger;
+    }
+
+    /**
+     * Called when the application is shutting down.  The Wrapper assumes that
+     * this method will return fairly quickly.  If the shutdown code code could
+     * potentially take a long time, then WrapperManager.stopping() should be
+     * called to extend the timeout period.  If for some reason, the stop method
+     * can not return, then it must call WrapperManager.stopped() to avoid
+     * warning messages from the Wrapper.
+     *
+     * @param exitCode The suggested exit code that will be returned to the OS
+     * when the JVM exits.
+     * @return The exit code to actually return to the OS.  In most cases, this
+     *         should just be the value of exitCode, however the user code has
+     *         the option of changing the exit code if there are any problems
+     *         during shutdown.
+     */
+    public int stop( final int exitCode )
+    {
+        // To avoid recursive calls, start ignoring updates.
+        m_ignoreUpdates = true;
+
+        Main.shutdown();
+        return exitCode;
+    }
+
+    /**
+     * Called whenever the native wrapper code traps a system control signal
+     * against the Java process.  It is up to the callback to take any actions
+     * necessary.  Possible values are: WrapperManager.WRAPPER_CTRL_C_EVENT,
+     * WRAPPER_CTRL_CLOSE_EVENT, WRAPPER_CTRL_LOGOFF_EVENT, or
+     * WRAPPER_CTRL_SHUTDOWN_EVENT
+     *
+     * @param event The system control signal.
+     */
+    public void controlEvent( final int event )
+    {
+        if( WrapperManager.isControlledByNativeWrapper() )
+        {
+            if( WrapperManager.isDebugEnabled() )
+            {
+                System.out.println(
+                    "DaemonLauncher: controlEvent(" + event + ") - Ignored." );
+            }
+
+            // This application ignores all incoming control events.
+            //  It relies on the wrapper code to handle them.
+        }
+        else
+        {
+            if( WrapperManager.isDebugEnabled() )
+            {
+                System.out.println(
+                    "DaemonLauncher: controlEvent(" + event + ") - Stopping." );
+            }
+
+            // Not being run under a wrapper, so this isn't an NT service and should always exit.
+            //  Handle the event here.
+            WrapperManager.stop( 0 );
+            // Will not get here.
+        }
+    }
+
+    /*---------------------------------------------------------------
+     * Methods
+     *-------------------------------------------------------------*/
+    /**
+     * We use an Observer rather than operating on some more meaningful event
+     * system as Observer and friends can be loaded from system ClassLoader and
+     * thus the Embeddor does not have to share a common classloader ancestor
+     * with invoker
+     */
+    public void update( final Observable observable, final Object arg )
+    {
+        if( m_ignoreUpdates )
+        {
+            // Ignore this update
+            if( WrapperManager.isDebugEnabled() )
+            {
+                System.out.println(
+                    "DaemonLauncher: " +
+                    arg
+                    + " request ignored because stop already called." );
+                System.out.flush();
+            }
+        }
+        else
+        {
+            final String command = ( null != arg ) ? arg.toString() : "";
+            if( command.equals( "restart" ) )
+            {
+                if( WrapperManager.isDebugEnabled() )
+                {
+                    System.out.println( "DaemonLauncher: restart requested." );
+                    System.out.flush();
+                }
+
+                WrapperManager.restart();
+
+                if( WrapperManager.isDebugEnabled() )
+                {
+                    //Should never get here???
+                    System.out.println( "DaemonLauncher: restart completed." );
+                    System.out.flush();
+                }
+            }
+            else if( command.equals( "shutdown" ) )
+            {
+                if( WrapperManager.isDebugEnabled() )
+                {
+                    System.out.println( "DaemonLauncher: shutdown requested." );
+                    System.out.flush();
+                }
+
+                WrapperManager.stop( 0 );
+
+                if( WrapperManager.isDebugEnabled() )
+                {
+                    //Should never get here???
+                    System.out.println( "DaemonLauncher: shutdown completed." );
+                    System.out.flush();
+                }
+            }
+            else
+            {
+                throw new IllegalArgumentException(
+                    "Unknown action " + command );
+            }
+        }
+    }
+
+    /*---------------------------------------------------------------
+     * Main Method
+     *-------------------------------------------------------------*/
+    public static void main( final String[] args )
+    {
+        // Start the application.  If the JVM was launched from the native
+        //  Wrapper then the application will wait for the native Wrapper to
+        //  call the application's start method.  Otherwise the start method
+        //  will be called immediately.
+        WrapperManager.start( new DaemonLauncher(), args );
+    }
+}
</pre></div>
<hr /><a name="file7" /><div class="file">
<span class="pathname" id="removed"><a href="http://xstream.cvs.codehaus.org/jcontainer">jcontainer</a>/<a href="http://xstream.cvs.codehaus.org/jcontainer/loom">loom</a>/<a href="http://xstream.cvs.codehaus.org/jcontainer/loom/launcher">launcher</a>/<a href="http://xstream.cvs.codehaus.org/jcontainer/loom/launcher/src">src</a>/<a href="http://xstream.cvs.codehaus.org/jcontainer/loom/launcher/src/java">java</a>/<a href="http://xstream.cvs.codehaus.org/jcontainer/loom/launcher/src/java/org">org</a>/<a href="http://xstream.cvs.codehaus.org/jcontainer/loom/launcher/src/java/org/jcontainer">jcontainer</a>/<a href="http://xstream.cvs.codehaus.org/jcontainer/loom/launcher/src/java/org/jcontainer/loom">loom</a>/<a href="http://xstream.cvs.codehaus.org/jcontainer/loom/launcher/src/java/org/jcontainer/loom/launcher">launcher</a><br /></span>
<div class="fileheader" id="removed"><big><b>ShutdownHook.java</b></big> <small id="info">removed after <a href="http://xstream.cvs.codehaus.org/jcontainer/loom/launcher/src/java/org/jcontainer/loom/launcher/ShutdownHook.java?rev=1.1&amp;content-type=text/vnd.viewcvs-markup">1.1</a></small></div>
<pre class="diff"><small id="info">diff -N ShutdownHook.java
--- ShutdownHook.java	3 Nov 2003 05:52:13 -0000	1.1
+++ /dev/null	1 Jan 1970 00:00:00 -0000
@@ -1,99 +0,0 @@
</small></pre><pre class="diff" id="removed">-/* ====================================================================
- * JContainer Software License, version 1.1
- *
- * Copyright (c) 2003, JContainer Group. 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. Neither the name of the JContainer Group nor the name "Loom" nor
- *    the names of its contributors may be used to endorse or promote
- *    products derived from this software without specific prior
- *    written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS 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
- * COPYRIGHT OWNER OR 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.
- *
- * ====================================================================
- *
- * JContainer Loom includes code from the Apache Software Foundation
- *
- * ====================================================================
- * The Apache Software License, Version 1.1
- *
- * Copyright (c) 1997-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 "Jakarta", "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.
- */
-package org.jcontainer.loom.launcher;
-
-final class ShutdownHook
-    extends Thread
-{
-    /**
-     * Run the shutdown hook.
-     */
-    public void run()
-    {
-        Main.shutdown();
-    }
-}
</pre></div>
<hr /><a name="file8" /><div class="file">
<span class="pathname" id="removed"><a href="http://xstream.cvs.codehaus.org/jcontainer">jcontainer</a>/<a href="http://xstream.cvs.codehaus.org/jcontainer/loom">loom</a>/<a href="http://xstream.cvs.codehaus.org/jcontainer/loom/launcher">launcher</a>/<a href="http://xstream.cvs.codehaus.org/jcontainer/loom/launcher/src">src</a>/<a href="http://xstream.cvs.codehaus.org/jcontainer/loom/launcher/src/java">java</a>/<a href="http://xstream.cvs.codehaus.org/jcontainer/loom/launcher/src/java/org">org</a>/<a href="http://xstream.cvs.codehaus.org/jcontainer/loom/launcher/src/java/org/jcontainer">jcontainer</a>/<a href="http://xstream.cvs.codehaus.org/jcontainer/loom/launcher/src/java/org/jcontainer/loom">loom</a>/<a href="http://xstream.cvs.codehaus.org/jcontainer/loom/launcher/src/java/org/jcontainer/loom/launcher">launcher</a><br /></span>
<div class="fileheader" id="removed"><big><b>FreeNEasyPolicy.java</b></big> <small id="info">removed after <a href="http://xstream.cvs.codehaus.org/jcontainer/loom/launcher/src/java/org/jcontainer/loom/launcher/FreeNEasyPolicy.java?rev=1.3&amp;content-type=text/vnd.viewcvs-markup">1.3</a></small></div>
<pre class="diff"><small id="info">diff -N FreeNEasyPolicy.java
--- FreeNEasyPolicy.java	3 Dec 2003 10:44:47 -0000	1.3
+++ /dev/null	1 Jan 1970 00:00:00 -0000
@@ -1,111 +0,0 @@
</small></pre><pre class="diff" id="removed">-/* ====================================================================
- * JContainer Software License, version 1.1
- *
- * Copyright (c) 2003, JContainer Group. 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. Neither the name of the JContainer Group nor the name "Loom" nor
- *    the names of its contributors may be used to endorse or promote
- *    products derived from this software without specific prior
- *    written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS 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
- * COPYRIGHT OWNER OR 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.
- *
- * ====================================================================
- *
- * JContainer Loom includes code from the Apache Software Foundation
- *
- * ====================================================================
- * The Apache Software License, Version 1.1
- *
- * Copyright (c) 1997-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 "Jakarta", "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.
- */
-package org.jcontainer.loom.launcher;
-
-import java.security.CodeSource;
-import java.security.PermissionCollection;
-import java.security.Permissions;
-import java.security.Policy;
-
-/**
- * Default polic class to give every code base all permssions. Will be replaced
- * once the kernel loads.
- */
-class FreeNEasyPolicy
-    extends Policy
-{
-    public PermissionCollection getPermissions( final CodeSource codeSource )
-    {
-        final Permissions permissions = new Permissions();
-        permissions.add( new java.security.AllPermission() );
-        return permissions;
-    }
-
-    public void refresh()
-    {
-    }
-}
</pre></div>
<hr /><a name="file9" /><div class="file">
<span class="pathname" id="removed"><a href="http://xstream.cvs.codehaus.org/jcontainer">jcontainer</a>/<a href="http://xstream.cvs.codehaus.org/jcontainer/loom">loom</a>/<a href="http://xstream.cvs.codehaus.org/jcontainer/loom/launcher">launcher</a>/<a href="http://xstream.cvs.codehaus.org/jcontainer/loom/launcher/src">src</a>/<a href="http://xstream.cvs.codehaus.org/jcontainer/loom/launcher/src/java">java</a>/<a href="http://xstream.cvs.codehaus.org/jcontainer/loom/launcher/src/java/org">org</a>/<a href="http://xstream.cvs.codehaus.org/jcontainer/loom/launcher/src/java/org/jcontainer">jcontainer</a>/<a href="http://xstream.cvs.codehaus.org/jcontainer/loom/launcher/src/java/org/jcontainer/loom">loom</a>/<a href="http://xstream.cvs.codehaus.org/jcontainer/loom/launcher/src/java/org/jcontainer/loom/launcher">launcher</a><br /></span>
<div class="fileheader" id="removed"><big><b>Main.java</b></big> <small id="info">removed after <a href="http://xstream.cvs.codehaus.org/jcontainer/loom/launcher/src/java/org/jcontainer/loom/launcher/Main.java?rev=1.7&amp;content-type=text/vnd.viewcvs-markup">1.7</a></small></div>
<pre class="diff"><small id="info">diff -N Main.java
--- Main.java	29 Nov 2003 13:50:50 -0000	1.7
+++ /dev/null	1 Jan 1970 00:00:00 -0000
@@ -1,237 +0,0 @@
</small></pre><pre class="diff" id="removed">-/* ====================================================================
- * JContainer Software License, version 1.1
- *
- * Copyright (c) 2003, JContainer Group. 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. Neither the name of the JContainer Group nor the name "Loom" nor
- *    the names of its contributors may be used to endorse or promote
- *    products derived from this software without specific prior
- *    written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS 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
- * COPYRIGHT OWNER OR 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.
- *
- * ====================================================================
- *
- * JContainer Loom includes code from the Apache Software Foundation
- *
- * ====================================================================
- * The Apache Software License, Version 1.1
- *
- * Copyright (c) 1997-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 "Jakarta", "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.
- */
-package org.jcontainer.loom.launcher;
-
-import java.io.File;
-import java.lang.reflect.Method;
-import java.net.URL;
-import java.net.URLClassLoader;
-import java.security.Policy;
-import java.util.HashMap;
-import java.util.Map;
-
-/**
- * LoomLoader is the class that bootstraps and sets up engine ClassLoader. It
- * also sets up a default policy that gives full permissions to engine code.
- *
- * @author Peter Donald
- */
-public final class Main
-{
-    private static Object c_frontend;
-    private static ShutdownHook c_hook;
-
-    /**
-     * Main entry point for Loom.
-     *
-     * @param args the command line arguments
-     * @throws java.lang.Exception if an error occurs
-     */
-    public static final void main( final String[] args )
-        throws Exception
-    {
-        final int exitCode =
-            startup( args, new HashMap(), true );
-        System.exit( exitCode );
-    }
-
-    /**
-     * Method to call to startup Loom from an external (calling) application.
-     * Protected to allow access from DaemonLauncher.
-     *
-     * @param options the command line arg array
-     * @param data a set of extra parameters to pass to embeddor
-     * @param blocking false if the current thread is expected to return.
-     * @return the exit code which should be used to exit the JVM
-     */
-    protected static final int startup( final String[] options,
-                                        final Map data,
-                                        final boolean blocking )
-    {
-        int exitCode;
-        try
-        {
-            //setup new Policy manager
-            Policy.setPolicy( new FreeNEasyPolicy() );
-
-            //Create engine ClassLoader
-            final File homeDir =
-                LauncherUtils.findLoomHome( "loom.home", "loom-launcher.jar" );
-
-            final URL[] urls =
-                LauncherUtils.generateClassPath( homeDir, "container/lib" );
-            final URLClassLoader classLoader = new URLClassLoader( urls );
-
-            data.put( ClassLoader.class.getName() + "/common",
-                      ClassLoader.getSystemClassLoader() );
-            data.put( ClassLoader.class.getName() + "/container",
-                      classLoader );
-            data.put( File.class.getName() + "/home", homeDir );
-
-            //Setup context classloader
-            Thread.currentThread().setContextClassLoader( classLoader );
-
-            //Create main launcher
-            final Class clazz =
-                classLoader.loadClass( "org.jcontainer.loom.frontends.CLIMain" );
-            final Class[] paramTypes =
-                new Class[]{options.getClass(), Map.class, Boolean.TYPE};
-            final Method method = clazz.getMethod( "main", paramTypes );
-
-            final Object frontend;
-            synchronized( Main.class )
-            {
-                c_frontend = clazz.newInstance();
-                frontend = c_frontend;
-            }
-
-            //By default add a shutdown hook that will invoke
-            //shutdown on container when JVM shuts down
-            final String enableShutdownHook =
-                System.getProperty( "disable.shutdown.hook" );
-            if( !"false".equals( enableShutdownHook ) )
-            {
-                c_hook = new ShutdownHook();
-                Runtime.getRuntime().addShutdownHook( c_hook );
-            }
-
-            //kick the tires and light the fires....
-            final Object[] args =
-                new Object[]{options, data, new Boolean( blocking )};
-            final Integer integer =
-                (Integer)method.invoke( frontend, args );
-            exitCode = integer.intValue();
-        }
-        catch( final Exception e )
-        {
-            e.printStackTrace();
-            exitCode = 1;
-        }
-        return exitCode;
-    }
-
-    /**
-     * Method to call to shutdown Loom from an external (calling) application.
-     * Protected to allow access from DaemonLauncher.
-     */
-    protected static final void shutdown()
-    {
-        final Object frontend;
-        synchronized( Main.class )
-        {
-            frontend = c_frontend;
-            c_frontend = null;
-        }
-        if( null == frontend )
-        {
-            return;
-        }
-        if( null != c_hook &amp;&amp; c_hook != Thread.currentThread() )
-        {
-            //Null hook so it is not tried to be removed
-            //when we are shutting down. (Attempting to remove
-            //hook during shutdown raises an exception).
-
-            Runtime.getRuntime().removeShutdownHook( c_hook );
-            c_hook = null;
-        }
-
-        try
-        {
-            final Class clazz = frontend.getClass();
-            final Method method = clazz.getMethod( "shutdown",
-                                                   new Class[ 0 ] );
-
-            //Lets put this sucker to sleep
-            method.invoke( frontend, new Object[ 0 ] );
-        }
-        catch( final Exception e )
-        {
-            e.printStackTrace();
-        }
-    }
-}
</pre></div>
<hr /><a name="file10" /><div class="file">
<span class="pathname" id="removed"><a href="http://xstream.cvs.codehaus.org/jcontainer">jcontainer</a>/<a href="http://xstream.cvs.codehaus.org/jcontainer/loom">loom</a>/<a href="http://xstream.cvs.codehaus.org/jcontainer/loom/launcher">launcher</a>/<a href="http://xstream.cvs.codehaus.org/jcontainer/loom/launcher/src">src</a>/<a href="http://xstream.cvs.codehaus.org/jcontainer/loom/launcher/src/java">java</a>/<a href="http://xstream.cvs.codehaus.org/jcontainer/loom/launcher/src/java/org">org</a>/<a href="http://xstream.cvs.codehaus.org/jcontainer/loom/launcher/src/java/org/jcontainer">jcontainer</a>/<a href="http://xstream.cvs.codehaus.org/jcontainer/loom/launcher/src/java/org/jcontainer/loom">loom</a>/<a href="http://xstream.cvs.codehaus.org/jcontainer/loom/launcher/src/java/org/jcontainer/loom/launcher">launcher</a><br /></span>
<div class="fileheader" id="removed"><big><b>DaemonLauncher.java</b></big> <small id="info">removed after <a href="http://xstream.cvs.codehaus.org/jcontainer/loom/launcher/src/java/org/jcontainer/loom/launcher/DaemonLauncher.java?rev=1.4&amp;content-type=text/vnd.viewcvs-markup">1.4</a></small></div>
<pre class="diff"><small id="info">diff -N DaemonLauncher.java
--- DaemonLauncher.java	29 Nov 2003 13:50:50 -0000	1.4
+++ /dev/null	1 Jan 1970 00:00:00 -0000
@@ -1,307 +0,0 @@
</small></pre><pre class="diff" id="removed">-/* ====================================================================
- * JContainer Software License, version 1.1
- *
- * Copyright (c) 2003, JContainer Group. 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. Neither the name of the JContainer Group nor the name "Loom" nor
- *    the names of its contributors may be used to endorse or promote
- *    products derived from this software without specific prior
- *    written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS 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
- * COPYRIGHT OWNER OR 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.
- *
- * ====================================================================
- *
- * JContainer Loom includes code from the Apache Software Foundation
- *
- * ====================================================================
- * The Apache Software License, Version 1.1
- *
- * Copyright (c) 1997-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 "Jakarta", "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.
- */
-package org.jcontainer.loom.launcher;
-
-import java.util.Hashtable;
-import java.util.Observable;
-import java.util.Observer;
-import org.tanukisoftware.wrapper.WrapperListener;
-import org.tanukisoftware.wrapper.WrapperManager;
-
-/**
- * A frontend for Phoenix that starts it as a native service using the Java
- * Service Wrapper at http://wrapper.tanukisoftware.org
- *
- * @author Peter Donald
- * @author &lt;a href="mailto:[email protected]"&gt;Leif Mortenson&lt;/a&gt;
- */
-public class DaemonLauncher
-    implements WrapperListener, Observer
-{
-    /**
-     * In order to avoid calling the Wrapper stop method recursively, we need to
-     * keep track of whether or not the Wrapper already knows we are stopping.
-     * Necessary because of the way the shutdown process in Phoenix works.
-     * Ideally, we would unregister this Observer with CLIMain but we can't do
-     * that for security reasons.
-     */
-    private boolean m_ignoreUpdates = false;
-
-    /*---------------------------------------------------------------
-     * WrapperListener Methods
-     *-------------------------------------------------------------*/
-    /**
-     * The start method is called when the WrapperManager is signaled by the
-     * native wrapper code that it can start its application.  This method call
-     * is expected to return, so a new thread should be launched if necessary.
-     *
-     * @param args List of arguments used to initialize the application.
-     * @return Any error code if the application should exit on completion of
-     *         the start method.  If there were no problems then this method
-     *         should return null.
-     */
-    public Integer start( final String[] args )
-    {
-        Integer exitCodeInteger = null;
-
-        // This startup could take a while, so tell the wrapper to be patient.
-        WrapperManager.signalStarting( 45000 );
-
-        final Hashtable data = new Hashtable();
-        data.put( Observer.class.getName(), this );
-
-        if( WrapperManager.isDebugEnabled() )
-        {
-            System.out.println( "DaemonLauncher: starting up." );
-        }
-
-        try
-        {
-            int exitCode = Main.startup( args, data, false );
-            if( exitCode != 0 )
-            {
-                exitCodeInteger = new Integer( exitCode );
-            }
-
-            if( WrapperManager.isDebugEnabled() )
-            {
-                System.out.println( "DaemonLauncher: startup completed." );
-            }
-        }
-        catch( final Exception e )
-        {
-            e.printStackTrace();
-            exitCodeInteger = new Integer( 1 );
-        }
-
-        // We are almost up now, so reset the wait time
-        WrapperManager.signalStarting( 2000 );
-
-        return exitCodeInteger;
-    }
-
-    /**
-     * Called when the application is shutting down.  The Wrapper assumes that
-     * this method will return fairly quickly.  If the shutdown code code could
-     * potentially take a long time, then WrapperManager.stopping() should be
-     * called to extend the timeout period.  If for some reason, the stop method
-     * can not return, then it must call WrapperManager.stopped() to avoid
-     * warning messages from the Wrapper.
-     *
-     * @param exitCode The suggested exit code that will be returned to the OS
-     * when the JVM exits.
-     * @return The exit code to actually return to the OS.  In most cases, this
-     *         should just be the value of exitCode, however the user code has
-     *         the option of changing the exit code if there are any problems
-     *         during shutdown.
-     */
-    public int stop( final int exitCode )
-    {
-        // To avoid recursive calls, start ignoring updates.
-        m_ignoreUpdates = true;
-
-        Main.shutdown();
-        return exitCode;
-    }
-
-    /**
-     * Called whenever the native wrapper code traps a system control signal
-     * against the Java process.  It is up to the callback to take any actions
-     * necessary.  Possible values are: WrapperManager.WRAPPER_CTRL_C_EVENT,
-     * WRAPPER_CTRL_CLOSE_EVENT, WRAPPER_CTRL_LOGOFF_EVENT, or
-     * WRAPPER_CTRL_SHUTDOWN_EVENT
-     *
-     * @param event The system control signal.
-     */
-    public void controlEvent( final int event )
-    {
-        if( WrapperManager.isControlledByNativeWrapper() )
-        {
-            if( WrapperManager.isDebugEnabled() )
-            {
-                System.out.println(
-                    "DaemonLauncher: controlEvent(" + event + ") - Ignored." );
-            }
-
-            // This application ignores all incoming control events.
-            //  It relies on the wrapper code to handle them.
-        }
-        else
-        {
-            if( WrapperManager.isDebugEnabled() )
-            {
-                System.out.println(
-                    "DaemonLauncher: controlEvent(" + event + ") - Stopping." );
-            }
-
-            // Not being run under a wrapper, so this isn't an NT service and should always exit.
-            //  Handle the event here.
-            WrapperManager.stop( 0 );
-            // Will not get here.
-        }
-    }
-
-    /*---------------------------------------------------------------
-     * Methods
-     *-------------------------------------------------------------*/
-    /**
-     * We use an Observer rather than operating on some more meaningful event
-     * system as Observer and friends can be loaded from system ClassLoader and
-     * thus the Embeddor does not have to share a common classloader ancestor
-     * with invoker
-     */
-    public void update( final Observable observable, final Object arg )
-    {
-        if( m_ignoreUpdates )
-        {
-            // Ignore this update
-            if( WrapperManager.isDebugEnabled() )
-            {
-                System.out.println(
-                    "DaemonLauncher: " +
-                    arg
-                    + " request ignored because stop already called." );
-                System.out.flush();
-            }
-        }
-        else
-        {
-            final String command = ( null != arg ) ? arg.toString() : "";
-            if( command.equals( "restart" ) )
-            {
-                if( WrapperManager.isDebugEnabled() )
-                {
-                    System.out.println( "DaemonLauncher: restart requested." );
-                    System.out.flush();
-                }
-
-                WrapperManager.restart();
-
-                if( WrapperManager.isDebugEnabled() )
-                {
-                    //Should never get here???
-                    System.out.println( "DaemonLauncher: restart completed." );
-                    System.out.flush();
-                }
-            }
-            else if( command.equals( "shutdown" ) )
-            {
-                if( WrapperManager.isDebugEnabled() )
-                {
-                    System.out.println( "DaemonLauncher: shutdown requested." );
-                    System.out.flush();
-                }
-
-                WrapperManager.stop( 0 );
-
-                if( WrapperManager.isDebugEnabled() )
-                {
-                    //Should never get here???
-                    System.out.println( "DaemonLauncher: shutdown completed." );
-                    System.out.flush();
-                }
-            }
-            else
-            {
-                throw new IllegalArgumentException(
-                    "Unknown action " + command );
-            }
-        }
-    }
-
-    /*---------------------------------------------------------------
-     * Main Method
-     *-------------------------------------------------------------*/
-    public static void main( final String[] args )
-    {
-        // Start the application.  If the JVM was launched from the native
-        //  Wrapper then the application will wait for the native Wrapper to
-        //  call the application's start method.  Otherwise the start method
-        //  will be called immediately.
-        WrapperManager.start( new DaemonLauncher(), args );
-    }
-}
</pre></div>
<hr /><a name="file11" /><div class="file">
<span class="pathname" id="removed"><a href="http://xstream.cvs.codehaus.org/jcontainer">jcontainer</a>/<a href="http://xstream.cvs.codehaus.org/jcontainer/loom">loom</a>/<a href="http://xstream.cvs.codehaus.org/jcontainer/loom/launcher">launcher</a>/<a href="http://xstream.cvs.codehaus.org/jcontainer/loom/launcher/src">src</a>/<a href="http://xstream.cvs.codehaus.org/jcontainer/loom/launcher/src/java">java</a>/<a href="http://xstream.cvs.codehaus.org/jcontainer/loom/launcher/src/java/org">org</a>/<a href="http://xstream.cvs.codehaus.org/jcontainer/loom/launcher/src/java/org/jcontainer">jcontainer</a>/<a href="http://xstream.cvs.codehaus.org/jcontainer/loom/launcher/src/java/org/jcontainer/loom">loom</a>/<a href="http://xstream.cvs.codehaus.org/jcontainer/loom/launcher/src/java/org/jcontainer/loom/launcher">launcher</a><br /></span>
<div class="fileheader" id="removed"><big><b>package.html</b></big> <small id="info">removed after <a href="http://xstream.cvs.codehaus.org/jcontainer/loom/launcher/src/java/org/jcontainer/loom/launcher/package.html?rev=1.2&amp;content-type=text/vnd.viewcvs-markup">1.2</a></small></div>
<pre class="diff"><small id="info">diff -N package.html
--- package.html	5 Aug 2003 07:55:39 -0000	1.2
+++ /dev/null	1 Jan 1970 00:00:00 -0000
@@ -1,3 +0,0 @@
</small></pre><pre class="diff" id="removed">-&lt;html&gt;&lt;body&gt;
-Main entry point to the Loom application startup cycle.
-&lt;/body&gt;&lt;/html&gt;
</pre></div>
<hr /><a name="file12" /><div class="file">
<span class="pathname" id="removed"><a href="http://xstream.cvs.codehaus.org/jcontainer">jcontainer</a>/<a href="http://xstream.cvs.codehaus.org/jcontainer/loom">loom</a>/<a href="http://xstream.cvs.codehaus.org/jcontainer/loom/launcher">launcher</a>/<a href="http://xstream.cvs.codehaus.org/jcontainer/loom/launcher/src">src</a>/<a href="http://xstream.cvs.codehaus.org/jcontainer/loom/launcher/src/java">java</a>/<a href="http://xstream.cvs.codehaus.org/jcontainer/loom/launcher/src/java/org">org</a>/<a href="http://xstream.cvs.codehaus.org/jcontainer/loom/launcher/src/java/org/jcontainer">jcontainer</a>/<a href="http://xstream.cvs.codehaus.org/jcontainer/loom/launcher/src/java/org/jcontainer/loom">loom</a>/<a href="http://xstream.cvs.codehaus.org/jcontainer/loom/launcher/src/java/org/jcontainer/loom/launcher">launcher</a><br /></span>
<div class="fileheader" id="removed"><big><b>LauncherUtils.java</b></big> <small id="info">removed after <a href="http://xstream.cvs.codehaus.org/jcontainer/loom/launcher/src/java/org/jcontainer/loom/launcher/LauncherUtils.java?rev=1.6&amp;content-type=text/vnd.viewcvs-markup">1.6</a></small></div>
<pre class="diff"><small id="info">diff -N LauncherUtils.java
--- LauncherUtils.java	29 Nov 2003 13:50:50 -0000	1.6
+++ /dev/null	1 Jan 1970 00:00:00 -0000
@@ -1,201 +0,0 @@
</small></pre><pre class="diff" id="removed">-/* ====================================================================
- * JContainer Software License, version 1.1
- *
- * Copyright (c) 2003, JContainer Group. 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. Neither the name of the JContainer Group nor the name "Loom" nor
- *    the names of its contributors may be used to endorse or promote
- *    products derived from this software without specific prior
- *    written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS 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
- * COPYRIGHT OWNER OR 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.
- *
- * ====================================================================
- *
- * JContainer Loom includes code from the Apache Software Foundation
- *
- * ====================================================================
- * The Apache Software License, Version 1.1
- *
- * Copyright (c) 1997-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 "Jakarta", "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.
- */
-package org.jcontainer.loom.launcher;
-
-import java.io.File;
-import java.net.URL;
-import java.util.ArrayList;
-import java.util.StringTokenizer;
-
-/**
- * A set of utilities that help when writing Launchers.
- *
- * @author Peter Donald
- */
-public class LauncherUtils
-{
-    /**
-     * Create a ClassPath for the engine.
-     *
-     * @return the set of URLs that engine uses to load
-     * @throws Exception if unable to aquire classpath
-     */
-    static URL[] generateClassPath( final File homeDir,
-                                    final String libDirectory )
-        throws Exception
-    {
-        final ArrayList urls = new ArrayList();
-
-        final File dir = findLibDir( homeDir, libDirectory );
-        final File[] files = dir.listFiles();
-        for( int i = 0; i &lt; files.length; i++ )
-        {
-            final File file = files[ i ];
-            if( file.getName().endsWith( ".jar" ) )
-            {
-                urls.add( file.toURL() );
-            }
-        }
-
-        return (URL[])urls.toArray( new URL[ urls.size() ] );
-    }
-
-    /**
-     * Find directory to load engine specific libraries from.
-     *
-     * @return the lib dir
-     * @throws Exception if unable to aquire directory
-     */
-    static File findLibDir( final File homeDir,
-                            final String libDirectory )
-        throws Exception
-    {
-        final String engineLibDir = libDirectory.replace( '/',
-                                                          File.separatorChar );
-        final File dir = new File( homeDir, engineLibDir ).getCanonicalFile();
-        if( !dir.exists() )
-        {
-            throw new Exception(
-                "Unable to locate library directory at " + engineLibDir );
-        }
-        return dir;
-    }
-
-    /**
-     * Utility method to find the home directory of Loom and make sure system
-     * property is set to it.
-     *
-     * @return the location of loom directory
-     * @throws Exception if unable to locate directory
-     */
-    static File findLoomHome( final String systemProperty,
-                              final String loaderJar )
-        throws Exception
-    {
-        String loomHome = System.getProperty( systemProperty, null );
-        if( null == loomHome )
-        {
-            final File loaderDir =
-                findLoaderDir( systemProperty, loaderJar );
-            return loaderDir.getCanonicalFile().getParentFile();
-        }
-        else
-        {
-            return new File( loomHome ).getCanonicalFile();
-        }
-    }
-
-    /**
-     * Finds the loaderJar file in the classpath.
-     */
-    private static final File findLoaderDir( final String systemProperty,
-                                             final String loaderJar )
-        throws Exception
-    {
-        final String classpath = System.getProperty( "java.class.path" );
-        final String pathSeparator = System.getProperty( "path.separator" );
-        final StringTokenizer tokenizer = new StringTokenizer( classpath,
-                                                               pathSeparator );
-
-        while( tokenizer.hasMoreTokens() )
-        {
-            final String element = tokenizer.nextToken();
-
-            if( element.endsWith( loaderJar ) )
-            {
-                File file = ( new File( element ) ).getCanonicalFile();
-                file = file.getParentFile();
-                return file;
-            }
-        }
-
-        throw new Exception( "Unable to locate " +
-                             loaderJar +
-                             " in classpath. User must specify " +
-                             systemProperty + " system property." );
-    }
-}
</pre></div>
<hr /><a name="file13" /><div class="file">
<span class="pathname"><a href="http://xstream.cvs.codehaus.org/jcontainer">jcontainer</a>/<a href="http://xstream.cvs.codehaus.org/jcontainer/loom">loom</a>/<a href="http://xstream.cvs.codehaus.org/jcontainer/loom/launcher">launcher</a><br /></span>
<div class="fileheader"><big><b>project.xml</b></big> <small id="info"><a href="http://xstream.cvs.codehaus.org/jcontainer/loom/launcher/project.xml?rev=1.3&amp;content-type=text/vnd.viewcvs-markup">1.3</a> <a href="http://xstream.cvs.codehaus.org/jcontainer/loom/launcher/project.xml.diff?r1=1.3&amp;r2=1.4">-&gt;</a> <a href="http://xstream.cvs.codehaus.org/jcontainer/loom/launcher/project.xml?rev=1.4&amp;content-type=text/vnd.viewcvs-markup">1.4</a></small></div>
<pre class="diff"><small id="info">diff -u -r1.3 -r1.4
--- project.xml	20 Sep 2003 18:39:23 -0000	1.3
+++ project.xml	19 Apr 2004 21:35:54 -0000	1.4
@@ -3,7 +3,7 @@
</small></pre><pre class="diff" id="context">     &lt;extend&gt;${basedir}/../project.xml&lt;/extend&gt;
     &lt;name&gt;Loom Launcher&lt;/name&gt;
     &lt;id&gt;loom-launcher&lt;/id&gt;
</pre><pre class="diff" id="removed">-    &lt;package&gt;org.<span id="removedchars">jcontainer</span>.loom.launcher&lt;/package&gt;
</pre><pre class="diff" id="added">+    &lt;package&gt;org.<span id="addedchars">codehaus</span>.loom.launcher&lt;/package&gt;
</pre><pre class="diff" id="context">     &lt;shortDescription&gt;Tools to launch Loom.&lt;/shortDescription&gt;
     &lt;description&gt;
         This toolkit is the launcher for Loom Application Server.
</pre></div>
<hr /><a name="file15" /><div class="file">
<span class="pathname"><a href="http://xstream.cvs.codehaus.org/jcontainer">jcontainer</a>/<a href="http://xstream.cvs.codehaus.org/jcontainer/loom">loom</a>/<a href="http://xstream.cvs.codehaus.org/jcontainer/loom/launcher">launcher</a>/<a href="http://xstream.cvs.codehaus.org/jcontainer/loom/launcher/src">src</a>/<a href="http://xstream.cvs.codehaus.org/jcontainer/loom/launcher/src/etc">etc</a><br /></span>
<div class="fileheader"><big><b>manifest.txt</b></big> <small id="info"><a href="http://xstream.cvs.codehaus.org/jcontainer/loom/launcher/src/etc/manifest.txt?rev=1.1&amp;content-type=text/vnd.viewcvs-markup">1.1</a> <a href="http://xstream.cvs.codehaus.org/jcontainer/loom/launcher/src/etc/manifest.txt.diff?r1=1.1&amp;r2=1.2">-&gt;</a> <a href="http://xstream.cvs.codehaus.org/jcontainer/loom/launcher/src/etc/manifest.txt?rev=1.2&amp;content-type=text/vnd.viewcvs-markup">1.2</a></small></div>
<pre class="diff"><small id="info">diff -u -r1.1 -r1.2
--- manifest.txt	24 Jul 2003 07:57:38 -0000	1.1
+++ manifest.txt	19 Apr 2004 21:35:54 -0000	1.2
@@ -1,3 +1,3 @@
</small></pre><pre class="diff" id="context"> Manifest-Version: 1.0
 Created-By: JContainer/Loom
</pre><pre class="diff" id="removed">-Main-Class: org.jcontainer.loom.launcher.Main
</pre><pre class="diff"><small id="info">\ No newline at end of file
</small></pre><pre class="diff" id="added">+Main-Class: org.codehaus.loom.launcher.Main
</pre><pre class="diff"><small id="info">\ No newline at end of file
</small></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>