[CVS jcontainer] Add support for legacy xinfo files back to Loom
Peter Royal <proyal-yCVjj/[email protected]> Thu, 19 Feb 2004 21:49:50 -0600
| 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/engine</tt></b><span id="info"> on MAIN</span></td></tr>
<tr><td><tt>src/java/META-INF/spice/<a href="#file1">catalog.xml</a></tt></td><td align="right" id="added">+3</td><td></td><td nowrap="nowrap" align="center"><a href="http://xstream.cvs.codehaus.org/jcontainer/loom/engine/src/java/META-INF/spice/catalog.xml?rev=1.2&content-type=text/vnd.viewcvs-markup">1.2</a> <a href="http://xstream.cvs.codehaus.org/jcontainer/loom/engine/src/java/META-INF/spice/catalog.xml.diff?r1=1.2&r2=1.3">-></a> <a href="http://xstream.cvs.codehaus.org/jcontainer/loom/engine/src/java/META-INF/spice/catalog.xml?rev=1.3&content-type=text/vnd.viewcvs-markup">1.3</a></td></tr>
<tr class="alt"><td><tt>src/java/org/jcontainer/loom/components/application/<a href="#file2">DefaultApplication.java</a></tt></td><td align="right" id="added">+51</td><td align="right" id="removed">-58</td><td nowrap="nowrap" align="center"><a href="http://xstream.cvs.codehaus.org/jcontainer/loom/engine/src/java/org/jcontainer/loom/components/application/DefaultApplication.java?rev=1.18&content-type=text/vnd.viewcvs-markup">1.18</a> <a href="http://xstream.cvs.codehaus.org/jcontainer/loom/engine/src/java/org/jcontainer/loom/components/application/DefaultApplication.java.diff?r1=1.18&r2=1.19">-></a> <a href="http://xstream.cvs.codehaus.org/jcontainer/loom/engine/src/java/org/jcontainer/loom/components/application/DefaultApplication.java?rev=1.19&content-type=text/vnd.viewcvs-markup">1.19</a></td></tr>
<tr><td><tt>src/java/org/jcontainer/loom/components/deployer/<a href="#file3">DefaultDeployer.java</a></tt></td><td align="right" id="added">+27</td><td align="right" id="removed">-23</td><td nowrap="nowrap" align="center"><a href="http://xstream.cvs.codehaus.org/jcontainer/loom/engine/src/java/org/jcontainer/loom/components/deployer/DefaultDeployer.java?rev=1.29&content-type=text/vnd.viewcvs-markup">1.29</a> <a href="http://xstream.cvs.codehaus.org/jcontainer/loom/engine/src/java/org/jcontainer/loom/components/deployer/DefaultDeployer.java.diff?r1=1.29&r2=1.30">-></a> <a href="http://xstream.cvs.codehaus.org/jcontainer/loom/engine/src/java/org/jcontainer/loom/components/deployer/DefaultDeployer.java?rev=1.30&content-type=text/vnd.viewcvs-markup">1.30</a></td></tr>
<tr class="alt"><td><tt> /<a href="#file4">PhoenixProfileBuilder.java</a></tt></td><td align="right" id="added">+23</td><td align="right" id="removed">-28</td><td nowrap="nowrap" align="center"><a href="http://xstream.cvs.codehaus.org/jcontainer/loom/engine/src/java/org/jcontainer/loom/components/deployer/PhoenixProfileBuilder.java?rev=1.18&content-type=text/vnd.viewcvs-markup">1.18</a> <a href="http://xstream.cvs.codehaus.org/jcontainer/loom/engine/src/java/org/jcontainer/loom/components/deployer/PhoenixProfileBuilder.java.diff?r1=1.18&r2=1.19">-></a> <a href="http://xstream.cvs.codehaus.org/jc
ontainer/loom/engine/src/java/org/jcontainer/loom/components/deployer/PhoenixProfileBuild!
er.java?rev=1.19&content-type=text/vnd.viewcvs-markup">1.19</a></td></tr>
<tr><td><tt>src/java/org/jcontainer/loom/components/util/factory/<a href="#file5">DefaultComponentFactory.java</a></tt></td><td align="right" id="added">+27</td><td align="right" id="removed">-16</td><td nowrap="nowrap" align="center"><a href="http://xstream.cvs.codehaus.org/jcontainer/loom/engine/src/java/org/jcontainer/loom/components/util/factory/DefaultComponentFactory.java?rev=1.4&content-type=text/vnd.viewcvs-markup">1.4</a> <a href="http://xstream.cvs.codehaus.org/jcontainer/loom/engine/src/java/org/jcontainer/loom/components/util/factory/DefaultComponentFactory.java.diff?r1=1.4&r2=1.5">-></a> <a href="http://xstream.cvs.codehaus.org/jcontainer/loom/engine/src/java/org/jcontainer/loom/components/util/factory/DefaultComponentFactory.java?rev=1.5&content-type=text/vnd.viewcvs-markup">1.5</a></td></tr>
<tr class="alt"><td><tt>src/java/org/jcontainer/loom/components/util/infobuilder/<a href="#file6"><span id="added">CascadingBlockInfoReader.java</span></a></tt></td><td align="right" id="added">+48</td><td></td><td nowrap="nowrap" align="right">added <a href="http://xstream.cvs.codehaus.org/jcontainer/loom/engine/src/java/org/jcontainer/loom/components/util/infobuilder/CascadingBlockInfoReader.java?rev=1.1&content-type=text/vnd.viewcvs-markup">1.1</a></td></tr>
<tr><td><tt> /<a href="#file7"><span id="added">LegacyBlockInfoReader.java</span></a></tt></td><td align="right" id="added">+278</td><td></td><td nowrap="nowrap" align="right">added <a href="http://xstream.cvs.codehaus.org/jcontainer/loom/engine/src/java/org/jcontainer/loom/components/util/infobuilder/LegacyBlockInfoReader.java?rev=1.1&content-type=text/vnd.viewcvs-markup">1.1</a></td></tr>
<tr class="alt"><td><tt> /<a href="#file8"><span id="added">LegacyUtil.java</span></a></tt></td><td align="right" id="added">+36</td><td></td><td nowrap="nowrap" align="right">added <a href="http://xstream.cvs.codehaus.org/jcontainer/loom/engine/src/java/org/jcontainer/loom/components/util/infobuilder/LegacyUtil.java?rev=1.1&content-type=text/vnd.viewcvs-markup">1.1</a></td></tr>
<tr><td><tt> /<a href="#file9"><span id="added">MetaClassBlockInfoReader.java</span></a></tt></td><td align="right" id="added">+172</td><td></td><td nowrap="nowrap" align="right">added <a href="http://xstream.cvs.codehaus.org/jcontainer/loom/engine/src/java/org/jcontainer/loom/components/util/infobuilder/MetaClassBlockInfoReader.java?rev=1.1&content-type=text/vnd.viewcvs-markup">1.1</a></td></tr>
<tr class="alt"><td><tt> /<a href="#file10"><span id="added">Resources.properties</span></a></tt></td><td align="right" id="added">+10</td><td></td><td nowrap="nowrap" align="right">added <a href="http://xstream.cvs.codehaus.org/jcontainer/loom/engine/src/java/org/jcontainer/loom/components/util/infobuilder/Resources.properties?rev=1.1&content-type=text/vnd.viewcvs-markup">1.1</a></td></tr>
<tr><td><tt> /<a href="#file11">BlockInfoReader.java</a></tt></td><td align="right" id="added">+7</td><td align="right" id="removed">-167</td><td nowrap="nowrap" align="center"><a href="http://xstream.cvs.codehaus.org/jcontainer/loom/engine/src/java/org/jcontainer/loom/components/util/infobuilder/BlockInfoReader.java?rev=1.3&content-type=text/vnd.viewcvs-markup">1.3</a> <a href="http://xstream.cvs.codehaus.org/jcontainer/loom/engine/src/java/org/jcontainer/loom/components/util/infobuilder/BlockInfoReader.java.diff?r1=1.3&r2=1.4">-></a> <a href="htt
p://xstream.cvs.codehaus.org/jcontainer/loom/engine/src/java/org/jcontainer/loom/componen!
ts/util/infobuilder/BlockInfoReader.java?rev=1.4&content-type=text/vnd.viewcvs-markup">1.4</a></td></tr>
<tr class="alt"><td><tt>src/java/org/jcontainer/loom/components/util/verifier/<a href="#file12">ComponentVerifier.java</a></tt></td><td align="right" id="added">+90</td><td align="right" id="removed">-85</td><td nowrap="nowrap" align="center"><a href="http://xstream.cvs.codehaus.org/jcontainer/loom/engine/src/java/org/jcontainer/loom/components/util/verifier/ComponentVerifier.java?rev=1.4&content-type=text/vnd.viewcvs-markup">1.4</a> <a href="http://xstream.cvs.codehaus.org/jcontainer/loom/engine/src/java/org/jcontainer/loom/components/util/verifier/ComponentVerifier.java.diff?r1=1.4&r2=1.5">-></a> <a href="http://xstream.cvs.codehaus.org/jcontainer/loom/engine/src/java/org/jcontainer/loom/components/util/verifier/ComponentVerifier.java?rev=1.5&content-type=text/vnd.viewcvs-markup">1.5</a></td></tr>
<tr><td><tt> /<a href="#file13">SarVerifier.java</a></tt></td><td align="right" id="added">+70</td><td align="right" id="removed">-56</td><td nowrap="nowrap" align="center"><a href="http://xstream.cvs.codehaus.org/jcontainer/loom/engine/src/java/org/jcontainer/loom/components/util/verifier/SarVerifier.java?rev=1.6&content-type=text/vnd.viewcvs-markup">1.6</a> <a href="http://xstream.cvs.codehaus.org/jcontainer/loom/engine/src/java/org/jcontainer/loom/components/util/verifier/SarVerifier.java.diff?r1=1.6&r2=1.7">-></a> <a href="http://xstream.cvs.codehaus.org/jcontai
ner/loom/engine/src/java/org/jcontainer/loom/components/util/verifier/SarVerifier.java?re!
v=1.7&content-type=text/vnd.viewcvs-markup">1.7</a></td></tr>
<tr class="alt"><td><tt>src/java/org/jcontainer/loom/components/util/<a href="#file14"><span id="added">blockinfo_1_0.dtd</span></a></tt></td><td align="right" id="added">+95</td><td></td><td nowrap="nowrap" align="right">added <a href="http://xstream.cvs.codehaus.org/jcontainer/loom/engine/src/java/org/jcontainer/loom/components/util/blockinfo_1_0.dtd?rev=1.1&content-type=text/vnd.viewcvs-markup">1.1</a></td></tr>
<tr><td><tt>src/test/org/jcontainer/loom/components/assembler/<a href="#file15">AssemblerTestCase.java</a></tt></td><td align="right" id="added">+39</td><td align="right" id="removed">-42</td><td nowrap="nowrap" align="center"><a href="http://xstream.cvs.codehaus.org/jcontainer/loom/engine/src/test/org/jcontainer/loom/components/assembler/AssemblerTestCase.java?rev=1.15&content-type=text/vnd.viewcvs-markup">1.15</a> <a href="http://xstream.cvs.codehaus.org/jcontainer/loom/engine/src/test/org/jcontainer/loom/components/assembler/AssemblerTestCase.java.diff?r1=1.15&r2=1.16">-></a> <a href="http://xstream.cvs.codehaus.org/jcontainer/loom/engine/src/test/org/jcontainer/loom/components/assembler/AssemblerTestCase.java?rev=1.16&content-type=text/vnd.viewcvs-markup">1.16</a></td></tr>
<tr class="alt"><td><tt><a href="#file16">project.xml</a></tt></td><td align="right" id="added">+8</td><td align="right" id="removed">-4</td><td nowrap="nowrap" align="center"><a href="http://xstream.cvs.codehaus.org/jcontainer/loom/engine/project.xml?rev=1.38&content-type=text/vnd.viewcvs-markup">1.38</a> <a href="http://xstream.cvs.codehaus.org/jcontainer/loom/engine/project.xml.diff?r1=1.38&r2=1.39">-></a> <a href="http://xstream.cvs.codehaus.org/jcontainer/loom/engine/project.xml?rev=1.39&content-type=text/vnd.viewcvs-markup">1.39</a></td></tr>
<tr><td></td><td align="right" id="added">+984</td><td align="right" id="removed">-479</td><td></td></tr>
</table>
<small id="info">6 added + 10 modified, total 16 files</small><br />
<div class="tasklist"><ul>
<li><a href="#task1">TODO need to do something if its a management service. Ideally this is what gets looked at later on</a></li>
</ul></div>
<pre class="comment">
Add support for legacy xinfo files back to Loom
* Upgrade deps to Avalon Framework 4.1.5
* Had to pass a logger and stuff around some more
* Yes, its not unit tested, but it runs my Phoenix 4.1 app dammit.
</pre>
<hr /><a name="file1" /><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/engine">engine</a>/<a href="http://xstream.cvs.codehaus.org/jcontainer/loom/engine/src">src</a>/<a href="http://xstream.cvs.codehaus.org/jcontainer/loom/engine/src/java">java</a>/<a href="http://xstream.cvs.codehaus.org/jcontainer/loom/engine/src/java/META-INF">META-INF</a>/<a href="http://xstream.cvs.codehaus.org/jcontainer/loom/engine/src/java/META-INF/spice">spice</a><br /></span>
<div class="fileheader"><big><b>catalog.xml</b></big> <small id="info"><a href="http://xstream.cvs.codehaus.org/jcontainer/loom/engine/src/java/META-INF/spice/catalog.xml?rev=1.2&content-type=text/vnd.viewcvs-markup">1.2</a> <a href="http://xstream.cvs.codehaus.org/jcontainer/loom/engine/src/java/META-INF/spice/catalog.xml.diff?r1=1.2&r2=1.3">-></a> <a href="http://xstream.cvs.codehaus.org/jcontainer/loom/engine/src/java/META-INF/spice/catalog.xml?rev=1.3&content-type=text/vnd.viewcvs-markup">1.3</a></small></div>
<pre class="diff"><small id="info">diff -u -r1.2 -r1.3
--- catalog.xml 16 Oct 2003 14:45:43 -0000 1.2
+++ catalog.xml 20 Feb 2004 03:49:48 -0000 1.3
@@ -11,4 +11,7 @@
</small></pre><pre class="diff" id="context"> <entity
publicId="-//LOOM/Assembly DTD Version 1.1//EN"
resource="org/jcontainer/loom/components/util/assembly_1_0.dtd"/>
</pre><pre class="diff" id="added">+ <entity
+ publicId="-//PHOENIX/Block Info DTD Version 1.0//EN"
+ resource="org/jcontainer/loom/components/util/blockinfo_1_0.dtd"/>
</pre><pre class="diff" id="context"> </catalog>
</pre></div>
<hr /><a name="file2" /><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/engine">engine</a>/<a href="http://xstream.cvs.codehaus.org/jcontainer/loom/engine/src">src</a>/<a href="http://xstream.cvs.codehaus.org/jcontainer/loom/engine/src/java">java</a>/<a href="http://xstream.cvs.codehaus.org/jcontainer/loom/engine/src/java/org">org</a>/<a href="http://xstream.cvs.codehaus.org/jcontainer/loom/engine/src/java/org/jcontainer">jcontainer</a>/<a href="http://xstream.cvs.codehaus.org/jcontainer/loom/engine/src/java/org/jcontainer/loom">loom</a>/<a href="http://xstream.cvs.codehaus.org/jcontainer/loom/engine/src/java/org/jcontainer/loom/components">components</a>/<a href="http://xstream.cvs.codehaus.org/jcontainer/loom/engine/src/java/org/jcontainer/loom/
components/application">application</a><br /></span>
<div class="fileheader"><big><b>DefaultApplication.java</b></big> <small id="info"><a href="http://xstream.cvs.codehaus.org/jcontainer/loom/engine/src/java/org/jcontainer/loom/components/application/DefaultApplication.java?rev=1.18&content-type=text/vnd.viewcvs-markup">1.18</a> <a href="http://xstream.cvs.codehaus.org/jcontainer/loom/engine/src/java/org/jcontainer/loom/components/application/DefaultApplication.java.diff?r1=1.18&r2=1.19">-></a> <a href="http://xstream.cvs.codehaus.org/jcontainer/loom/engine/src/java/org/jcontainer/loom/components/application/DefaultApplication.java?rev=1.19&content-type=text/vnd.viewcvs-markup">1.19</a></small></div>
<pre class="diff"><small id="info">diff -u -r1.18 -r1.19
--- DefaultApplication.java 3 Dec 2003 10:44:34 -0000 1.18
+++ DefaultApplication.java 20 Feb 2004 03:49:49 -0000 1.19
@@ -90,9 +90,11 @@
</small></pre><pre class="diff" id="context"> import java.util.Arrays;
import java.util.HashMap;
import java.util.List;
</pre><pre class="diff" id="added">+
</pre><pre class="diff" id="context"> import org.apache.avalon.phoenix.ApplicationListener;
import org.apache.avalon.phoenix.BlockListener;
import org.apache.avalon.phoenix.metadata.SarMetaData;
</pre><pre class="diff" id="added">+
</pre><pre class="diff" id="context"> import org.codehaus.spice.salt.i18n.ResourceManager;
import org.codehaus.spice.salt.i18n.Resources;
import org.jcontainer.dna.AbstractLogEnabled;
</pre><pre class="diff"><small id="info">@@ -108,8 +110,8 @@
</small></pre><pre class="diff" id="context"> import org.jcontainer.loom.interfaces.LoomException;
/**
</pre><pre class="diff" id="removed">- * This is the basic container of blocks. A server application represents an
- * aggregation of blocks that act together to form an application.
</pre><pre class="diff" id="added">+ * This is the basic container of blocks. A server application represents an aggregation of blocks that act together to
+ * form an application.
</pre><pre class="diff" id="context"> *
* @author Peter Donald
* @author Leo Simons
</pre><pre class="diff"><small id="info">@@ -133,13 +135,19 @@
</small></pre><pre class="diff" id="context">
private final HashMap m_entries = new HashMap();
</pre><pre class="diff" id="removed">- /** ResourceProvider for blocks. */
</pre><pre class="diff" id="added">+ /**
+ * ResourceProvider for blocks.
+ */
</pre><pre class="diff" id="context"> private BlockResourceProvider m_blockAccessor;
</pre><pre class="diff" id="removed">- /** Object to support notification of ApplicationListeners. */
</pre><pre class="diff" id="added">+ /**
+ * Object to support notification of ApplicationListeners.
+ */
</pre><pre class="diff" id="context"> private final ListenerSupport m_listenerSupport = new ListenerSupport();
</pre><pre class="diff" id="removed">- /** Object to support running objects through lifecycle phases. */
</pre><pre class="diff" id="added">+ /**
+ * Object to support running objects through lifecycle phases.
+ */
</pre><pre class="diff" id="context"> private final LifecycleHelper m_lifecycleHelper = new LifecycleHelper();
///////////////////////
</pre><pre class="diff"><small id="info">@@ -161,20 +169,18 @@
</small></pre><pre class="diff" id="context"> }
catch( final Throwable t )
{
</pre><pre class="diff" id="removed">- getLogger().info(
- "Exception loading listeners:" + t.getMessage() + "\n", t );
</pre><pre class="diff" id="added">+ getLogger().info( "Exception loading listeners:" + t.getMessage() + "\n", t );
</pre><pre class="diff" id="context"> throw new LoomException( t.getMessage(), t );
}
try
{
final PartitionProfile partition =
</pre><pre class="diff" id="removed">- m_context.getPartitionProfile().getPartition(
- ContainerConstants.BLOCK_PARTITION );
</pre><pre class="diff" id="added">+ m_context.getPartitionProfile().getPartition( ContainerConstants.BLOCK_PARTITION );
</pre><pre class="diff" id="context"> final ComponentProfile[] blocks = partition.getComponents();
for( int i = 0; i < blocks.length; i++ )
{
</pre><pre class="diff" id="removed">- final String blockName = blocks[ i ].getTemplate().getName();
- final BlockEntry blockEntry = new BlockEntry( blocks[ i ] );
</pre><pre class="diff" id="added">+ final String blockName = blocks[i].getTemplate().getName();
+ final BlockEntry blockEntry = new BlockEntry( blocks[i] );
</pre><pre class="diff" id="context"> m_entries.put( blockName, blockEntry );
}
</pre><pre class="diff"><small id="info">@@ -183,8 +189,7 @@
</small></pre><pre class="diff" id="context"> }
catch( final Throwable t )
{
</pre><pre class="diff" id="removed">- getLogger().info(
- "exception while starting:" + t.getMessage() + "\n" );
</pre><pre class="diff" id="added">+ getLogger().info( "exception while starting:" + t.getMessage() + "\n" );
</pre><pre class="diff" id="context"> t.printStackTrace();
throw new LoomException( t.getMessage(), t );
}
</pre><pre class="diff"><small id="info">@@ -219,12 +224,11 @@
</small></pre><pre class="diff" id="context"> }
/**
</pre><pre class="diff" id="removed">- * @mx.attribute description="the names of the blocks that compose this
- * Application"
</pre><pre class="diff" id="added">+ * @mx.attribute description="the names of the blocks that compose this Application"
</pre><pre class="diff" id="context"> */
public String[] getBlockNames()
{
</pre><pre class="diff" id="removed">- return (String[])m_entries.keySet().toArray( new String[<span id="removedchars"> 0 </span>] );
</pre><pre class="diff" id="added">+ return (String[])m_entries.keySet().toArray( new String[<span id="addedchars">0</span>] );
</pre><pre class="diff" id="context"> }
public Object getBlock( final String name )
</pre><pre class="diff"><small id="info">@@ -257,8 +261,7 @@
</small></pre><pre class="diff" id="context"> }
/**
</pre><pre class="diff" id="removed">- * @mx.attribute description="the string used to describe the application in
- * the UI."
</pre><pre class="diff" id="added">+ * @mx.attribute description="the string used to describe the application in the UI."
</pre><pre class="diff" id="context"> */
public String getDescription()
{
</pre><pre class="diff"><small id="info">@@ -274,8 +277,7 @@
</small></pre><pre class="diff" id="context"> }
/**
</pre><pre class="diff" id="removed">- * @mx.attribute description="True if the application is running or false
- * otherwise."
</pre><pre class="diff" id="added">+ * @mx.attribute description="True if the application is running or false otherwise."
</pre><pre class="diff" id="context"> */
public boolean isRunning()
{
</pre><pre class="diff"><small id="info">@@ -292,8 +294,7 @@
</small></pre><pre class="diff" id="context"> //Setup thread context for calling visitors
final ClassLoader loader = Thread.currentThread()
.getContextClassLoader();
</pre><pre class="diff" id="removed">- Thread.currentThread().setContextClassLoader(
- m_context.getClassLoader() );
</pre><pre class="diff" id="added">+ Thread.currentThread().setContextClassLoader( m_context.getClassLoader() );
</pre><pre class="diff" id="context">
try
{
</pre><pre class="diff"><small id="info">@@ -306,9 +307,8 @@
</small></pre><pre class="diff" id="context"> }
/**
</pre><pre class="diff" id="removed">- * Actually perform loading of each individual Listener. Note that by this
- * stage it is assumed that the Thread Context has already been setup
- * correctly.
</pre><pre class="diff" id="added">+ * Actually perform loading of each individual Listener. Note that by this stage it is assumed that the Thread
+ * Context has already been setup correctly.
</pre><pre class="diff" id="context"> */
private void doLoadBlockListeners()
throws Exception
</pre><pre class="diff"><small id="info">@@ -319,11 +319,11 @@
</small></pre><pre class="diff" id="context"> {
try
{
</pre><pre class="diff" id="removed">- startupListener( listeners[<span id="removedchars"> i </span>] );
</pre><pre class="diff" id="added">+ startupListener( listeners[<span id="addedchars">i</span>] );
</pre><pre class="diff" id="context"> }
catch( final Exception e )
{
</pre><pre class="diff" id="removed">- final String name = listeners[<span id="removedchars"> i </span>].getTemplate().getName();
</pre><pre class="diff" id="added">+ final String name = listeners[<span id="addedchars">i</span>].getTemplate().getName();
</pre><pre class="diff" id="context"> final String message =
REZ.format( "bad-listener",
"startup",
</pre><pre class="diff"><small id="info">@@ -343,11 +343,11 @@
</small></pre><pre class="diff" id="context"> }
/**
</pre><pre class="diff" id="removed">- * Run a phase for application. Each phase transitions application into new
- * state and processes all the blocks to make sure they are in that state
- * aswell. Exceptions leave the blocks in an indeterminate state.
</pre><pre class="diff" id="added">+ * Run a phase for application. Each phase transitions application into new state and processes all the blocks to
+ * make sure they are in that state aswell. Exceptions leave the blocks in an indeterminate state.
</pre><pre class="diff" id="context"> *
* @param name the name of phase (for logging purposes)
</pre><pre class="diff" id="added">+ *
</pre><pre class="diff" id="context"> * @throws Exception if an error occurs
*/
private final void runPhase( final String name )
</pre><pre class="diff"><small id="info">@@ -356,8 +356,7 @@
</small></pre><pre class="diff" id="context"> //Setup thread context for calling visitors
final ClassLoader loader = Thread.currentThread()
.getContextClassLoader();
</pre><pre class="diff" id="removed">- Thread.currentThread().setContextClassLoader(
- m_context.getClassLoader() );
</pre><pre class="diff" id="added">+ Thread.currentThread().setContextClassLoader( m_context.getClassLoader() );
</pre><pre class="diff" id="context">
try
{
</pre><pre class="diff"><small id="info">@@ -370,10 +369,11 @@
</small></pre><pre class="diff" id="context"> }
/**
</pre><pre class="diff" id="removed">- * Actually run applications phas. By this methods calling it is assumed
- * that Thread Context has already been setup.
</pre><pre class="diff" id="added">+ * Actually run applications phas. By this methods calling it is assumed that Thread Context has already been
+ * setup.
</pre><pre class="diff" id="context"> *
* @param name the name of phase (for logging purposes)
</pre><pre class="diff" id="added">+ *
</pre><pre class="diff" id="context"> * @throws Exception if an error occurs
*/
private final void doRunPhase( final String name )
</pre><pre class="diff"><small id="info">@@ -381,8 +381,7 @@
</small></pre><pre class="diff" id="context"> {
final ComponentProfile[] blocks =
getComponentsInPartition( ContainerConstants.BLOCK_PARTITION );
</pre><pre class="diff" id="removed">- final String[] order = DependencyGraph.walkGraph(
- PHASE_STARTUP == name, blocks );
</pre><pre class="diff" id="added">+ final String[] order = DependencyGraph.walkGraph( PHASE_STARTUP == name, blocks );
</pre><pre class="diff" id="context">
//Log message describing the number of blocks
//the phase in and the order in which they will be
</pre><pre class="diff"><small id="info">@@ -417,7 +416,7 @@
</small></pre><pre class="diff" id="context">
for( int i = 0; i < order.length; i++ )
{
</pre><pre class="diff" id="removed">- final String block = order[<span id="removedchars"> i </span>];
</pre><pre class="diff" id="added">+ final String block = order[<span id="addedchars">i</span>];
</pre><pre class="diff" id="context">
//Log message saying we are processing block
if( getLogger().isDebugEnabled() )
</pre><pre class="diff"><small id="info">@@ -476,16 +475,14 @@
</small></pre><pre class="diff" id="context"> }
/**
</pre><pre class="diff" id="removed">- * Method to run a Block through it's startup phase. This will involve
- * notification of {@link ApplicationListener} objects, creation of the
- * Block/Block Proxy object, calling the startup Avalon Lifecycle methods
- * and updating State property of BlockEntry. Errors that occur during
- * shutdown will be logged appropriately and cause exceptions with useful
- * messages to be raised.
</pre><pre class="diff" id="added">+ * Method to run a Block through it's startup phase. This will involve notification of {@link ApplicationListener}
+ * objects, creation of the Block/Block Proxy object, calling the startup Avalon Lifecycle methods and updating
+ * State property of BlockEntry. Errors that occur during shutdown will be logged appropriately and cause exceptions
+ * with useful messages to be raised.
</pre><pre class="diff" id="context"> *
* @param entry the entry containing Block
</pre><pre class="diff" id="removed">- * @throws Exception if an error occurs when block passes through a specific
- * lifecycle stage
</pre><pre class="diff" id="added">+ *
+ * @throws Exception if an error occurs when block passes through a specific lifecycle stage
</pre><pre class="diff" id="context"> */
private void startup( final BlockEntry entry )
throws Exception
</pre><pre class="diff"><small id="info">@@ -502,11 +499,9 @@
</small></pre><pre class="diff" id="context"> }
/**
</pre><pre class="diff" id="removed">- * Method to run a Block through it's shutdown phase. This will involve
- * notification of {@link ApplicationListener} objects, invalidating the
- * proxy object, calling the shutdown Avalon Lifecycle methods and updating
- * State property of BlockEntry. Errors that occur during shutdown will be
- * logged appropraitely.
</pre><pre class="diff" id="added">+ * Method to run a Block through it's shutdown phase. This will involve notification of {@link ApplicationListener}
+ * objects, invalidating the proxy object, calling the shutdown Avalon Lifecycle methods and updating State property
+ * of BlockEntry. Errors that occur during shutdown will be logged appropraitely.
</pre><pre class="diff" id="context"> *
* @param entry the entry containing Block
*/
</pre><pre class="diff"><small id="info">@@ -537,13 +532,12 @@
</small></pre><pre class="diff" id="context"> }
/**
</pre><pre class="diff" id="removed">- * Method to run a {@link ApplicationListener} through it's startup phase.
- * This will involve creation of BlockListener object and configuration of
- * object if appropriate.
</pre><pre class="diff" id="added">+ * Method to run a {@link ApplicationListener} through it's startup phase. This will involve creation of
+ * BlockListener object and configuration of object if appropriate.
</pre><pre class="diff" id="context"> *
* @param profile the BlockListenerMetaData
</pre><pre class="diff" id="removed">- * @throws Exception if an error occurs when listener passes through a
- * specific lifecycle stage
</pre><pre class="diff" id="added">+ *
+ * @throws Exception if an error occurs when listener passes through a specific lifecycle stage
</pre><pre class="diff" id="context"> */
private void startupListener( final ComponentProfile profile )
throws Exception
</pre><pre class="diff"><small id="info">@@ -551,14 +545,13 @@
</small></pre><pre class="diff" id="context"> final String name = profile.getTemplate().getName();
final Object listener =
m_lifecycleHelper.startup( name,
</pre><pre class="diff" id="removed">- profile,
</pre><pre class="diff" id="added">+ new BlockEntry( profile ),
</pre><pre class="diff" id="context"> m_blockAccessor );
// However onky ApplicationListners can avail of block events.
if( listener instanceof ApplicationListener )
{
</pre><pre class="diff" id="removed">- m_listenerSupport.addApplicationListener(
- (ApplicationListener)listener );
</pre><pre class="diff" id="added">+ m_listenerSupport.addApplicationListener( (ApplicationListener)listener );
</pre><pre class="diff" id="context"> }
else
{
</pre></div>
<hr /><a name="file3" /><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/engine">engine</a>/<a href="http://xstream.cvs.codehaus.org/jcontainer/loom/engine/src">src</a>/<a href="http://xstream.cvs.codehaus.org/jcontainer/loom/engine/src/java">java</a>/<a href="http://xstream.cvs.codehaus.org/jcontainer/loom/engine/src/java/org">org</a>/<a href="http://xstream.cvs.codehaus.org/jcontainer/loom/engine/src/java/org/jcontainer">jcontainer</a>/<a href="http://xstream.cvs.codehaus.org/jcontainer/loom/engine/src/java/org/jcontainer/loom">loom</a>/<a href="http://xstream.cvs.codehaus.org/jcontainer/loom/engine/src/java/org/jcontainer/loom/components">components</a>/<a href="http://xstream.cvs.codehaus.org/jcontainer/loom/engine/src/java/org/jcontainer/loom/
components/deployer">deployer</a><br /></span>
<div class="fileheader"><big><b>DefaultDeployer.java</b></big> <small id="info"><a href="http://xstream.cvs.codehaus.org/jcontainer/loom/engine/src/java/org/jcontainer/loom/components/deployer/DefaultDeployer.java?rev=1.29&content-type=text/vnd.viewcvs-markup">1.29</a> <a href="http://xstream.cvs.codehaus.org/jcontainer/loom/engine/src/java/org/jcontainer/loom/components/deployer/DefaultDeployer.java.diff?r1=1.29&r2=1.30">-></a> <a href="http://xstream.cvs.codehaus.org/jcontainer/loom/engine/src/java/org/jcontainer/loom/components/deployer/DefaultDeployer.java?rev=1.30&content-type=text/vnd.viewcvs-markup">1.30</a></small></div>
<pre class="diff"><small id="info">diff -u -r1.29 -r1.30
--- DefaultDeployer.java 19 Feb 2004 03:21:03 -0000 1.29
+++ DefaultDeployer.java 20 Feb 2004 03:49:49 -0000 1.30
@@ -93,7 +93,9 @@
</small></pre><pre class="diff" id="context"> import java.util.Hashtable;
import java.util.Map;
import java.util.Set;
</pre><pre class="diff" id="added">+
</pre><pre class="diff" id="context"> import org.apache.avalon.phoenix.BlockContext;
</pre><pre class="diff" id="added">+
</pre><pre class="diff" id="context"> import org.codehaus.spice.loggerstore.LoggerStore;
import org.codehaus.spice.salt.i18n.ResourceManager;
import org.codehaus.spice.salt.i18n.Resources;
</pre><pre class="diff"><small id="info">@@ -163,10 +165,9 @@
</small></pre><pre class="diff" id="context"> m_classLoaderManager = (ClassLoaderManager)locator.
lookup( ClassLoaderManager.class.getName() );
m_logManager =
</pre><pre class="diff" id="removed">- (LogManager)locator.lookup( LogManager.class.getName() );
</pre><pre class="diff" id="added">+ <span id="addedchars"> </span>(LogManager)locator.lookup( LogManager.class.getName() );
</pre><pre class="diff" id="context"> m_validator =
</pre><pre class="diff" id="removed">- (ConfigurationValidator)locator.lookup(
- ConfigurationValidator.class.getName() );
</pre><pre class="diff" id="added">+ (ConfigurationValidator)locator.lookup( ConfigurationValidator.class.getName() );
</pre><pre class="diff" id="context"> m_installer = (Installer)locator.lookup( Installer.class.getName() );
}
</pre><pre class="diff"><small id="info">@@ -174,20 +175,20 @@
</small></pre><pre class="diff" id="context"> throws Exception
{
setupLogger( m_verifier );
</pre><pre class="diff" id="added">+ setupLogger( m_builder );
</pre><pre class="diff" id="context"> }
/**
</pre><pre class="diff" id="removed">- * Dispose the deployer which effectively means undeploying all the
- * currently deployed apps.
</pre><pre class="diff" id="added">+ * Dispose the deployer which effectively means undeploying all the currently deployed apps.
</pre><pre class="diff" id="context"> */
public void dispose()
{
final Set set = m_installations.keySet();
final String[] applications =
</pre><pre class="diff" id="removed">- (String[])set.toArray( new String[<span id="removedchars"> set.size() </span>] );
</pre><pre class="diff" id="added">+ (String[])set.toArray( new String[<span id="addedchars">set.size()</span>] );
</pre><pre class="diff" id="context"> for( int i = 0; i < applications.length; i++ )
{
</pre><pre class="diff" id="removed">- final String name = applications[<span id="removedchars"> i </span>];
</pre><pre class="diff" id="added">+ final String name = applications[<span id="addedchars">i</span>];
</pre><pre class="diff" id="context"> try
{
undeploy( name );
</pre><pre class="diff"><small id="info">@@ -238,8 +239,9 @@
</small></pre><pre class="diff" id="context"> /**
* Undeploy and deploy an installation.
*
</pre><pre class="diff" id="removed">- * @param name the name of deployment
</pre><pre class="diff" id="added">+ * @param name <span id="addedchars"> </span>the name of deployment
</pre><pre class="diff" id="context"> * @param location the installation to redeploy
</pre><pre class="diff" id="added">+ *
</pre><pre class="diff" id="context"> * @throws LoomException if an error occurs
*/
public void redeploy( String name, URL location )
</pre><pre class="diff"><small id="info">@@ -408,8 +410,7 @@
</small></pre><pre class="diff" id="context"> homeDirectory,
workDirectory,
classLoader,
</pre><pre class="diff" id="removed">- store
- );
</pre><pre class="diff" id="added">+ store );
</pre><pre class="diff" id="context">
m_installations.put( name, installation );
</pre><pre class="diff"><small id="info">@@ -448,8 +449,10 @@
</small></pre><pre class="diff" id="context"> * Helper method to load configuration data.
*
* @param install the install data
</pre><pre class="diff" id="removed">- * @param key the key under which config data is stored in install data
</pre><pre class="diff" id="added">+ * @param key <span id="addedchars"> </span>the key under which config data is stored in install data
+ *
</pre><pre class="diff" id="context"> * @return the Configuration
</pre><pre class="diff" id="added">+ *
</pre><pre class="diff" id="context"> * @throws LoomException if an error occurs
*/
private Configuration getConfigurationFor( final Map install,
</pre><pre class="diff"><small id="info">@@ -474,10 +477,11 @@
</small></pre><pre class="diff" id="context"> }
/**
</pre><pre class="diff" id="removed">- * Pass the configuration to the configurationManager and give it a chance
- * to process the configuration in one form or another.
</pre><pre class="diff" id="added">+ * Pass the configuration to the configurationManager and give it a chance to process the configuration in one form
+ * or another.
</pre><pre class="diff" id="context"> *
* @param configuration the block configurations.
</pre><pre class="diff" id="added">+ *
</pre><pre class="diff" id="context"> * @throws LoomException if an error occurs
*/
private Configuration processConfiguration( final String application,
</pre><pre class="diff"><small id="info">@@ -491,7 +495,7 @@
</small></pre><pre class="diff" id="context"> final Configuration[] configurations = configuration.getChildren();
for( int i = 0; i < configurations.length; i++ )
{
</pre><pre class="diff" id="removed">- final Configuration config = configurations[<span id="removedchars"> i </span>];
</pre><pre class="diff" id="added">+ final Configuration config = configurations[<span id="addedchars">i</span>];
</pre><pre class="diff" id="context"> try
{
final Configuration newConfig =
</pre><pre class="diff"><small id="info">@@ -509,11 +513,11 @@
</small></pre><pre class="diff" id="context"> }
/**
</pre><pre class="diff" id="removed">- * Verify that configuration present in config file is valid for this
- * assembly.
</pre><pre class="diff" id="added">+ * Verify that configuration present in config file is valid for this assembly.
</pre><pre class="diff" id="context"> *
* @param profile the PartitionProfile
</pre><pre class="diff" id="removed">- * @param config the block configurations.
</pre><pre class="diff" id="added">+ * @param config <span id="addedchars"> </span>the block configurations.
+ *
</pre><pre class="diff" id="context"> * @throws LoomException if an error occurs
*/
private void verifyConfiguration( final PartitionProfile profile,
</pre><pre class="diff"><small id="info">@@ -527,7 +531,7 @@
</small></pre><pre class="diff" id="context"> profile.getPartition( ContainerConstants.BLOCK_PARTITION );
for( int i = 0; i < configurations.length; i++ )
{
</pre><pre class="diff" id="removed">- final Configuration configuration = configurations[<span id="removedchars"> i </span>];
</pre><pre class="diff" id="added">+ final Configuration configuration = configurations[<span id="addedchars">i</span>];
</pre><pre class="diff" id="context"> final String name = configuration.getName();
ComponentProfile component = listenerPartition.getComponent( name );
if( null == component )
</pre><pre class="diff"><small id="info">@@ -545,11 +549,11 @@
</small></pre><pre class="diff" id="context"> }
/**
</pre><pre class="diff" id="removed">- * Verify that configuration conforms to schema for all components in this
- * assembly.
</pre><pre class="diff" id="added">+ * Verify that configuration conforms to schema for all components in this assembly.
</pre><pre class="diff" id="context"> *
</pre><pre class="diff" id="removed">- * @param profile the PartitionProfile
</pre><pre class="diff" id="added">+ * @param profile <span id="addedchars"> </span>the PartitionProfile
</pre><pre class="diff" id="context"> * @param classLoader the classloader application is loaded in
</pre><pre class="diff" id="added">+ *
</pre><pre class="diff" id="context"> * @throws LoomException if an error occurs
*/
private void validateConfiguration( final PartitionProfile profile,
</pre><pre class="diff"><small id="info">@@ -559,12 +563,12 @@
</small></pre><pre class="diff" id="context"> final PartitionProfile[] partitions = profile.getPartitions();
for( int i = 0; i < partitions.length; i++ )
{
</pre><pre class="diff" id="removed">- validateConfiguration( partitions[<span id="removedchars"> i </span>], classLoader );
</pre><pre class="diff" id="added">+ validateConfiguration( partitions[<span id="addedchars">i</span>], classLoader );
</pre><pre class="diff" id="context"> }
final ComponentProfile[] components = profile.getComponents();
for( int i = 0; i < components.length; i++ )
{
</pre><pre class="diff" id="removed">- final ComponentProfile component = components[<span id="removedchars"> i </span>];
</pre><pre class="diff" id="added">+ final ComponentProfile component = components[<span id="addedchars">i</span>];
</pre><pre class="diff" id="context"> boolean isValid = false;
try
{
</pre></div>
<hr /><a name="file4" /><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/engine">engine</a>/<a href="http://xstream.cvs.codehaus.org/jcontainer/loom/engine/src">src</a>/<a href="http://xstream.cvs.codehaus.org/jcontainer/loom/engine/src/java">java</a>/<a href="http://xstream.cvs.codehaus.org/jcontainer/loom/engine/src/java/org">org</a>/<a href="http://xstream.cvs.codehaus.org/jcontainer/loom/engine/src/java/org/jcontainer">jcontainer</a>/<a href="http://xstream.cvs.codehaus.org/jcontainer/loom/engine/src/java/org/jcontainer/loom">loom</a>/<a href="http://xstream.cvs.codehaus.org/jcontainer/loom/engine/src/java/org/jcontainer/loom/components">components</a>/<a href="http://xstream.cvs.codehaus.org/jcontainer/loom/engine/src/java/org/jcontainer/loom/
components/deployer">deployer</a><br /></span>
<div class="fileheader"><big><b>PhoenixProfileBuilder.java</b></big> <small id="info"><a href="http://xstream.cvs.codehaus.org/jcontainer/loom/engine/src/java/org/jcontainer/loom/components/deployer/PhoenixProfileBuilder.java?rev=1.18&content-type=text/vnd.viewcvs-markup">1.18</a> <a href="http://xstream.cvs.codehaus.org/jcontainer/loom/engine/src/java/org/jcontainer/loom/components/deployer/PhoenixProfileBuilder.java.diff?r1=1.18&r2=1.19">-></a> <a href="http://xstream.cvs.codehaus.org/jcontainer/loom/engine/src/java/org/jcontainer/loom/components/deployer/PhoenixProfileBuilder.java?rev=1.19&content-type=text/vnd.viewcvs-markup">1.19</a></small></div>
<pre class="diff"><small id="info">diff -u -r1.18 -r1.19
--- PhoenixProfileBuilder.java 29 Nov 2003 13:44:16 -0000 1.18
+++ PhoenixProfileBuilder.java 20 Feb 2004 03:49:49 -0000 1.19
@@ -9,6 +9,9 @@
</small></pre><pre class="diff" id="context">
import java.util.ArrayList;
import java.util.Map;
</pre><pre class="diff" id="added">+
+import org.jcontainer.dna.AbstractLogEnabled;
+import org.jcontainer.dna.Logger;
</pre><pre class="diff" id="context"> import org.jcontainer.loom.components.assembler.Assembler;
import org.jcontainer.loom.components.util.factory.ComponentFactory;
import org.jcontainer.loom.components.util.factory.DefaultComponentFactory;
</pre><pre class="diff"><small id="info">@@ -24,31 +27,28 @@
</small></pre><pre class="diff" id="context">
/**
* @author Peter Donald
</pre><pre class="diff" id="removed">- * @version $Revision: 1.18 $ $Date: 2003/11/29 13:44:16 $
</pre><pre class="diff" id="added">+ * @version $Revision: 1.19 $ $Date: 2004/02/20 03:49:49 $
</pre><pre class="diff" id="context"> */
</pre><pre class="diff" id="removed">-public class PhoenixProfileBuilder
</pre><pre class="diff" id="added">+public class PhoenixProfileBuilder extends AbstractLogEnabled
</pre><pre class="diff" id="context"> implements ProfileBuilder
{
private final Assembler m_assembler = new Assembler();
</pre><pre class="diff" id="added">+ private Logger m_logger;
</pre><pre class="diff" id="context">
public PartitionProfile buildProfile( final Map parameters )
throws Exception
{
</pre><pre class="diff" id="removed">- final PartitionTemplate metaData = m_assembler.buildAssembly(
- parameters );
</pre><pre class="diff" id="added">+ final PartitionTemplate metaData = m_assembler.buildAssembly( parameters );
</pre><pre class="diff" id="context"> final ClassLoader classLoader =
</pre><pre class="diff" id="removed">- (ClassLoader)parameters.get(
- ContainerConstants.ASSEMBLY_CLASSLOADER );
- final ComponentFactory factory = new DefaultComponentFactory(
- classLoader );
</pre><pre class="diff" id="added">+ (ClassLoader)parameters.get( ContainerConstants.ASSEMBLY_CLASSLOADER );
+ final ComponentFactory factory = new DefaultComponentFactory( classLoader, getLogger() );
</pre><pre class="diff" id="context">
return assembleSarProfile( metaData, factory, classLoader );
}
</pre><pre class="diff" id="removed">- private PartitionProfile assembleSarProfile(
- final PartitionTemplate metaData,
- final ComponentFactory factory,
- final ClassLoader classLoader )
</pre><pre class="diff" id="added">+ private PartitionProfile assembleSarProfile( final PartitionTemplate metaData,
+ final ComponentFactory factory,
+ final ClassLoader classLoader )
</pre><pre class="diff" id="context"> throws Exception
{
final PartitionTemplate blockPartition =
</pre><pre class="diff"><small id="info">@@ -68,18 +68,16 @@
</small></pre><pre class="diff" id="context"> ComponentProfile.EMPTY_SET );
}
</pre><pre class="diff" id="removed">- private PartitionProfile assembleListenerProfile(
- final PartitionTemplate metaData,
- final ClassLoader classLoader )
</pre><pre class="diff" id="added">+ private PartitionProfile assembleListenerProfile( final PartitionTemplate metaData,
+ final ClassLoader classLoader )
</pre><pre class="diff" id="context"> throws Exception
{
final ArrayList componentSet = new ArrayList();
final ComponentTemplate[] components = metaData.getComponents();
for( int i = 0; i < components.length; i++ )
{
</pre><pre class="diff" id="removed">- final ComponentTemplate component = components[ i ];
- final Class type = classLoader.loadClass(
- component.getImplementationKey() );
</pre><pre class="diff" id="added">+ final ComponentTemplate component = components[i];
+ final Class type = classLoader.loadClass( component.getImplementationKey() );
</pre><pre class="diff" id="context"> final ComponentInfo info = createListenerInfo( type );
final ComponentProfile profile = new ComponentProfile( info,
component );
</pre><pre class="diff"><small id="info">@@ -87,8 +85,7 @@
</small></pre><pre class="diff" id="context"> }
final ComponentProfile[] profiles =
</pre><pre class="diff" id="removed">- (ComponentProfile[])componentSet.toArray(
- new ComponentProfile[ componentSet.size() ] );
</pre><pre class="diff" id="added">+ (ComponentProfile[])componentSet.toArray( new ComponentProfile[componentSet.size()] );
</pre><pre class="diff" id="context"> return new PartitionProfile( metaData,
PartitionProfile.EMPTY_SET,
profiles );
</pre><pre class="diff"><small id="info">@@ -102,7 +99,7 @@
</small></pre><pre class="diff" id="context"> final PartitionTemplate[] partitions = metaData.getPartitions();
for( int i = 0; i < partitions.length; i++ )
{
</pre><pre class="diff" id="removed">- final PartitionTemplate partition = partitions[<span id="removedchars"> i </span>];
</pre><pre class="diff" id="added">+ final PartitionTemplate partition = partitions[<span id="addedchars">i</span>];
</pre><pre class="diff" id="context"> final PartitionProfile profile = assembleProfile( partition,
factory );
partitionSet.add( profile );
</pre><pre class="diff"><small id="info">@@ -112,7 +109,7 @@
</small></pre><pre class="diff" id="context"> final ComponentTemplate[] components = metaData.getComponents();
for( int i = 0; i < components.length; i++ )
{
</pre><pre class="diff" id="removed">- final ComponentTemplate component = components[<span id="removedchars"> i </span>];
</pre><pre class="diff" id="added">+ final ComponentTemplate component = components[<span id="addedchars">i</span>];
</pre><pre class="diff" id="context"> final ComponentInfo info =
factory.createInfo( component.getImplementationKey() );
final ComponentProfile profile = new ComponentProfile( info,
</pre><pre class="diff"><small id="info">@@ -121,21 +118,19 @@
</small></pre><pre class="diff" id="context"> }
final PartitionProfile[] partitionProfiles =
</pre><pre class="diff" id="removed">- (PartitionProfile[])partitionSet.toArray(
- new PartitionProfile[ partitionSet.size() ] );
</pre><pre class="diff" id="added">+ (PartitionProfile[])partitionSet.toArray( new PartitionProfile[partitionSet.size()] );
</pre><pre class="diff" id="context"> final ComponentProfile[] componentProfiles =
</pre><pre class="diff" id="removed">- (ComponentProfile[])componentSet.toArray(
- new ComponentProfile[ componentSet.size() ] );
</pre><pre class="diff" id="added">+ (ComponentProfile[])componentSet.toArray( new ComponentProfile[componentSet.size()] );
</pre><pre class="diff" id="context"> return new PartitionProfile( metaData,
partitionProfiles,
componentProfiles );
}
/**
</pre><pre class="diff" id="removed">- * Create a {@link org.jcontainer.loom.components.util.info.ComponentInfo}
- * for a Listener with specified classname.
</pre><pre class="diff" id="added">+ * Create a {@link org.jcontainer.loom.components.util.info.ComponentInfo} for a Listener with specified classname.
</pre><pre class="diff" id="context"> *
* @param type the listener type
</pre><pre class="diff" id="added">+ *
</pre><pre class="diff" id="context"> * @return the ComponentInfo for listener
*/
private static ComponentInfo createListenerInfo( final Class type )
</pre></div>
<hr /><a name="file5" /><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/engine">engine</a>/<a href="http://xstream.cvs.codehaus.org/jcontainer/loom/engine/src">src</a>/<a href="http://xstream.cvs.codehaus.org/jcontainer/loom/engine/src/java">java</a>/<a href="http://xstream.cvs.codehaus.org/jcontainer/loom/engine/src/java/org">org</a>/<a href="http://xstream.cvs.codehaus.org/jcontainer/loom/engine/src/java/org/jcontainer">jcontainer</a>/<a href="http://xstream.cvs.codehaus.org/jcontainer/loom/engine/src/java/org/jcontainer/loom">loom</a>/<a href="http://xstream.cvs.codehaus.org/jcontainer/loom/engine/src/java/org/jcontainer/loom/components">components</a>/<a href="http://xstream.cvs.codehaus.org/jcontainer/loom/engine/src/java/org/jcontainer/loom/
components/util">util</a>/<a href="http://xstream.cvs.codehaus.org/jcontainer/loom/engine!
/src/java/org/jcontainer/loom/components/util/factory">factory</a><br /></span>
<div class="fileheader"><big><b>DefaultComponentFactory.java</b></big> <small id="info"><a href="http://xstream.cvs.codehaus.org/jcontainer/loom/engine/src/java/org/jcontainer/loom/components/util/factory/DefaultComponentFactory.java?rev=1.4&content-type=text/vnd.viewcvs-markup">1.4</a> <a href="http://xstream.cvs.codehaus.org/jcontainer/loom/engine/src/java/org/jcontainer/loom/components/util/factory/DefaultComponentFactory.java.diff?r1=1.4&r2=1.5">-></a> <a href="http://xstream.cvs.codehaus.org/jcontainer/loom/engine/src/java/org/jcontainer/loom/components/util/factory/DefaultComponentFactory.java?rev=1.5&content-type=text/vnd.viewcvs-markup">1.5</a></small></div>
<pre class="diff"><small id="info">diff -u -r1.4 -r1.5
--- DefaultComponentFactory.java 29 Nov 2003 13:44:21 -0000 1.4
+++ DefaultComponentFactory.java 20 Feb 2004 03:49:49 -0000 1.5
@@ -9,48 +9,59 @@
</small></pre><pre class="diff" id="context">
import java.util.Map;
import java.util.WeakHashMap;
</pre><pre class="diff" id="added">+
+import org.jcontainer.dna.Logger;
</pre><pre class="diff" id="context"> import org.jcontainer.loom.components.util.info.ComponentInfo;
import org.jcontainer.loom.components.util.infobuilder.BlockInfoReader;
</pre><pre class="diff" id="added">+import org.jcontainer.loom.components.util.infobuilder.CascadingBlockInfoReader;
</pre><pre class="diff" id="context">
/**
</pre><pre class="diff" id="removed">- * The default implementation of ComponentFactory that simply creates components
- * from a ClassLoader.
</pre><pre class="diff" id="added">+ * The default implementation of ComponentFactory that simply creates components from a ClassLoader.
</pre><pre class="diff" id="context"> *
* @author Peter Donald
</pre><pre class="diff" id="removed">- * @version $Revision: 1.4 $ $Date: 2003/11/29 13:44:21 $
</pre><pre class="diff" id="added">+ * @version $Revision: 1.5 $ $Date: 2004/02/20 03:49:49 $
</pre><pre class="diff" id="context"> */
public class DefaultComponentFactory
implements ComponentFactory
{
</pre><pre class="diff" id="removed">- /** Cache of ComponentInfo objects. */
</pre><pre class="diff" id="added">+ /**
+ * Cache of ComponentInfo objects.
+ */
</pre><pre class="diff" id="context"> private final Map m_infos = new WeakHashMap();
/**
</pre><pre class="diff" id="removed">- * The utility class that is used when building info objects for
- * Components.
</pre><pre class="diff" id="added">+ * The utility class that is used when building info objects for Components.
</pre><pre class="diff" id="context"> */
</pre><pre class="diff" id="removed">- private final BlockInfoReader m_infoBuilder = new BlockInfoReader();
</pre><pre class="diff" id="added">+ private final BlockInfoReader m_blockInfoReader;
</pre><pre class="diff" id="context">
</pre><pre class="diff" id="removed">- /** The classloader from which all resources are loaded. */
</pre><pre class="diff" id="added">+ /**
+ * The classloader from which all resources are loaded.
+ */
</pre><pre class="diff" id="context"> private final ClassLoader m_classLoader;
/**
* Create a Factory that loads from specified ClassLoader.
*
* @param classLoader the classLoader to use in factory, must not be null
</pre><pre class="diff" id="added">+ * @param logger the logger to use for the BlockInfoReader
</pre><pre class="diff" id="context"> */
</pre><pre class="diff" id="removed">- public DefaultComponentFactory( final ClassLoader classLoader )
</pre><pre class="diff" id="added">+ public DefaultComponentFactory( final ClassLoader classLoader<span id="addedchars">, final Logger logger</span> )
</pre><pre class="diff" id="context"> {
if( null == classLoader )
{
throw new NullPointerException( "classLoader" );
}
</pre><pre class="diff" id="added">+ else if( null == logger )
+ {
+ throw new NullPointerException( "logger" );
+ }
+
</pre><pre class="diff" id="context"> m_classLoader = classLoader;
</pre><pre class="diff" id="added">+ m_blockInfoReader = new CascadingBlockInfoReader( classLoader, logger );
</pre><pre class="diff" id="context"> }
/**
</pre><pre class="diff" id="removed">- * Create a component by creating info for class with specified name and
- * loaded from factorys ClassLoader.
</pre><pre class="diff" id="added">+ * Create a component by creating info for class with specified name and loaded from factorys ClassLoader.
</pre><pre class="diff" id="context"> *
* @see ComponentFactory#createInfo
*/
</pre><pre class="diff"><small id="info">@@ -68,8 +79,7 @@
</small></pre><pre class="diff" id="context"> }
/**
</pre><pre class="diff" id="removed">- * Create a component by creating instance of class with specified name and
- * loaded from factorys ClassLoader.
</pre><pre class="diff" id="added">+ * Create a component by creating instance of class with specified name and loaded from factorys ClassLoader.
</pre><pre class="diff" id="context"> *
* @see ComponentFactory#createComponent
*/
</pre><pre class="diff"><small id="info">@@ -84,15 +94,16 @@
</small></pre><pre class="diff" id="context"> * Create a ComponentInfo for component with specified implementationKey.
*
* @param implementationKey the implementationKey
</pre><pre class="diff" id="added">+ *
</pre><pre class="diff" id="context"> * @return the created ComponentInfo
</pre><pre class="diff" id="added">+ *
</pre><pre class="diff" id="context"> * @throws Exception if unabel to create componentInfo
*/
</pre><pre class="diff" id="removed">- protected ComponentInfo createComponentInfo(
- final String implementationKey )
</pre><pre class="diff" id="added">+ protected ComponentInfo createComponentInfo( final String implementationKey )
</pre><pre class="diff" id="context"> throws Exception
{
final Class type = getClassLoader().loadClass( implementationKey );
</pre><pre class="diff" id="removed">- return m_<span id="removedchars">infoBuil</span>der.buildComponentInfo( type );
</pre><pre class="diff" id="added">+ return m_<span id="addedchars">blockInfoRea</span>der.buildComponentInfo( type );
</pre><pre class="diff" id="context"> }
/**
</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/engine">engine</a>/<a href="http://xstream.cvs.codehaus.org/jcontainer/loom/engine/src">src</a>/<a href="http://xstream.cvs.codehaus.org/jcontainer/loom/engine/src/java">java</a>/<a href="http://xstream.cvs.codehaus.org/jcontainer/loom/engine/src/java/org">org</a>/<a href="http://xstream.cvs.codehaus.org/jcontainer/loom/engine/src/java/org/jcontainer">jcontainer</a>/<a href="http://xstream.cvs.codehaus.org/jcontainer/loom/engine/src/java/org/jcontainer/loom">loom</a>/<a href="http://xstream.cvs.codehaus.org/jcontainer/loom/engine/src/java/org/jcontainer/loom/components">components</a>/<a href="http://xstream.cvs.codehaus.org/jcontainer/loom/engine/src/java/org/jcont
ainer/loom/components/util">util</a>/<a href="http://xstream.cvs.codehaus.org/jcontainer/!
loom/engine/src/java/org/jcontainer/loom/components/util/infobuilder">infobuilder</a><br /></span>
<div class="fileheader" id="added"><big><b>CascadingBlockInfoReader.java</b></big> <small id="info">added at <a href="http://xstream.cvs.codehaus.org/jcontainer/loom/engine/src/java/org/jcontainer/loom/components/util/infobuilder/CascadingBlockInfoReader.java?rev=1.1&content-type=text/vnd.viewcvs-markup">1.1</a></small></div>
<pre class="diff"><small id="info">diff -N CascadingBlockInfoReader.java
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ CascadingBlockInfoReader.java 20 Feb 2004 03:49:49 -0000 1.1
@@ -0,0 +1,48 @@
</small></pre><pre class="diff" id="added">+/*
+ * Copyright (C) The JContainer Group. All rights reserved.
+ *
+ * This software is published under the terms of the JContainer
+ * Software License version 1.1, a copy of which has been included
+ * with this distribution in the LICENSE.txt file.
+ */
+package org.jcontainer.loom.components.util.infobuilder;
+
+import org.jcontainer.dna.Logger;
+import org.jcontainer.loom.components.util.info.ComponentInfo;
+
+/**
+ * @author <a href="mailto:[email protected]">peter royal</a>
+ */
+public class CascadingBlockInfoReader implements BlockInfoReader
+{
+ private final LegacyBlockInfoReader m_legacyBlockInfoReader;
+ private final MetaClassBlockInfoReader m_metaClassBlockInfoReader = new MetaClassBlockInfoReader();
+
+ public CascadingBlockInfoReader( final ClassLoader classLoader, final Logger logger )
+ {
+ if( null == classLoader )
+ {
+ throw new NullPointerException( "classLoader" );
+ }
+ else if( null == logger )
+ {
+ throw new NullPointerException( "logger" );
+ }
+
+ m_legacyBlockInfoReader = new LegacyBlockInfoReader( classLoader, logger );
+ }
+
+ public ComponentInfo buildComponentInfo( final Class type ) throws Exception
+ {
+ final ComponentInfo legacyComponentInfo = m_legacyBlockInfoReader.buildComponentInfo( type );
+
+ if( null == legacyComponentInfo )
+ {
+ return m_metaClassBlockInfoReader.buildComponentInfo( type );
+ }
+ else
+ {
+ return legacyComponentInfo;
+ }
+ }
+}
</pre><pre class="diff"><small id="info">\ No newline at end of file
</small></pre></div>
<hr /><a name="file7" /><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/engine">engine</a>/<a href="http://xstream.cvs.codehaus.org/jcontainer/loom/engine/src">src</a>/<a href="http://xstream.cvs.codehaus.org/jcontainer/loom/engine/src/java">java</a>/<a href="http://xstream.cvs.codehaus.org/jcontainer/loom/engine/src/java/org">org</a>/<a href="http://xstream.cvs.codehaus.org/jcontainer/loom/engine/src/java/org/jcontainer">jcontainer</a>/<a href="http://xstream.cvs.codehaus.org/jcontainer/loom/engine/src/java/org/jcontainer/loom">loom</a>/<a href="http://xstream.cvs.codehaus.org/jcontainer/loom/engine/src/java/org/jcontainer/loom/components">components</a>/<a href="http://xstream.cvs.codehaus.org/jcontainer/loom/engine/src/java/org/jcont
ainer/loom/components/util">util</a>/<a href="http://xstream.cvs.codehaus.org/jcontainer/!
loom/engine/src/java/org/jcontainer/loom/components/util/infobuilder">infobuilder</a><br /></span>
<div class="fileheader" id="added"><big><b>LegacyBlockInfoReader.java</b></big> <small id="info">added at <a href="http://xstream.cvs.codehaus.org/jcontainer/loom/engine/src/java/org/jcontainer/loom/components/util/infobuilder/LegacyBlockInfoReader.java?rev=1.1&content-type=text/vnd.viewcvs-markup">1.1</a></small></div>
<pre class="diff"><small id="info">diff -N LegacyBlockInfoReader.java
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ LegacyBlockInfoReader.java 20 Feb 2004 03:49:49 -0000 1.1
@@ -0,0 +1,278 @@
</small></pre><pre class="diff" id="added">+/*
+ * Copyright (C) The JContainer Group. All rights reserved.
+ *
+ * This software is published under the terms of the JContainer
+ * Software License version 1.1, a copy of which has been included
+ * with this distribution in the LICENSE.txt file.
+ */
+package org.jcontainer.loom.components.util.infobuilder;
+
+import java.io.InputStream;
+import java.util.ArrayList;
+
+import org.codehaus.spice.salt.i18n.ResourceManager;
+import org.codehaus.spice.salt.i18n.Resources;
+import org.jcontainer.dna.AbstractLogEnabled;
+import org.jcontainer.dna.Configuration;
+import org.jcontainer.dna.ConfigurationException;
+import org.jcontainer.dna.Logger;
+import org.jcontainer.loom.components.util.ConfigurationBuilder;
+import org.jcontainer.loom.components.util.info.ComponentInfo;
+import org.jcontainer.loom.components.util.info.DependencyDescriptor;
+import org.jcontainer.loom.components.util.info.SchemaDescriptor;
+import org.jcontainer.loom.components.util.info.ServiceDescriptor;
+import org.xml.sax.InputSource;
+
+/**
+ * A LegacyBlockInfoReader is responsible for building {@link org.jcontainer.loom.components.util.info.ComponentInfo}
+ * objects from <a href="http://jakarta.apache.org/avalon/phoenix">Phoenixs</a> BlockInfo descriptors. The format for
+ * descriptor is specified in the <a href="package-summary.html#external">package summary</a>.
+ *
+ * @author <a href="mailto:peter at realityforge.org">Peter Donald</a>
+ * @version $Revision: 1.1 $ $Date: 2004/02/20 03:49:49 $
+ */
+public final class LegacyBlockInfoReader extends AbstractLogEnabled implements BlockInfoReader
+{
+ /**
+ * I18n resources.
+ */
+ private static final Resources REZ =
+ ResourceManager.getPackageResources( LegacyBlockInfoReader.class );
+ private static final String BLOCKINFO_SCHEMA = "-//PHOENIX/Block Info DTD Version 1.0//EN";
+ private final ClassLoader m_classLoader;
+
+ public LegacyBlockInfoReader( final ClassLoader classLoader, final Logger logger )
+ {
+ if( null == classLoader )
+ {
+ throw new NullPointerException( "classLoader" );
+ }
+ else if( null == logger )
+ {
+ throw new NullPointerException( "logger" );
+ }
+
+ enableLogging( logger );
+
+ m_classLoader = classLoader;
+ }
+
+ public ComponentInfo buildComponentInfo( final Class type ) throws Exception
+ {
+ final String xinfo = type.getName().replace( '.', '/' ) + ".xinfo";
+ final InputStream inputStream = m_classLoader.getResourceAsStream( xinfo );
+
+ if( null == inputStream )
+ {
+ return null;
+ }
+ else
+ {
+ final InputSource input = new InputSource( inputStream );
+ final Configuration configuration = ConfigurationBuilder.build( input, BLOCKINFO_SCHEMA, getLogger() );
+
+ return build( type, configuration );
+ }
+ }
+
+ /**
+ * Create a {@link org.jcontainer.loom.components.util.info.ComponentInfo} object for specified classname from
+ * specified configuration data.
+ *
+ * @param type The Components type
+ * @param info the ComponentInfo configuration
+ *
+ * @return the created ComponentInfo
+ *
+ * @throws org.apache.avalon.framework.configuration.ConfigurationException
+ * if an error occurs
+ */
+ private ComponentInfo build( final Class type,
+ final Configuration info )
+ throws Exception
+ {
+ if( getLogger().isDebugEnabled() )
+ {
+ final String message =
+ REZ.format( "legacy.builder.creating-info.notice",
+ type.getName() );
+ getLogger().debug( message );
+ }
+
+ final String topLevelName = info.getName();
+ if( !topLevelName.equals( "blockinfo" ) )
+ {
+ final String message =
+ REZ.format( "legacy.bad-toplevel-element.error",
+ type.getName(),
+ topLevelName );
+ throw new ConfigurationException( message, info.getPath(), info.getLocation() );
+ }
+
+ Configuration configuration;
+
+ final ServiceDescriptor[] services = buildServices( info );
+
+ configuration = info.getChild( "dependencies" );
+ final DependencyDescriptor[] dependencies =
+ buildDependencies( type.getName(), configuration );
+
+ if( getLogger().isDebugEnabled() )
+ {
+ final String message =
+ REZ.format( "legacy.created-info.notice",
+ type.getName(),
+ new Integer( services.length ),
+ new Integer( dependencies.length ) );
+ getLogger().debug( message );
+ }
+
+ configuration = info.getChild( "block" );
+ final SchemaDescriptor schema = buildConfigurationSchema( type.getName(), configuration );
+
+ return new ComponentInfo( type,
+ services,
+ dependencies,
+ schema );
+ }
+
+ /**
+ * A utility method to build a descriptor for SchemaDescriptor,
+ *
+ * @return the a descriptor for the SchemaDescriptor,
+ */
+ private SchemaDescriptor buildConfigurationSchema( final String classname,
+ final Configuration configuration )
+ {
+ final String schemaType =
+ configuration.getChild( "schema-type" ).getValue( "" );
+ if( "".equals( schemaType ) )
+ {
+ return null;
+ }
+ else
+ {
+ final String location = LegacyUtil.getSchemaLocationFor( classname );
+ return new SchemaDescriptor( location, schemaType );
+ }
+
+ }
+
+ /**
+ * A utility method to build an array of {@link DependencyDescriptor} objects from specified configuration and
+ * classname.
+ *
+ * @param classname The classname of Component (used for logging purposes)
+ * @param configuration the dependencies configuration
+ *
+ * @return the created DependencyDescriptor
+ *
+ * @throws ConfigurationException if an error occurs
+ */
+ private DependencyDescriptor[] buildDependencies( final String classname,
+ final Configuration configuration )
+ throws ConfigurationException
+ {
+ final Configuration[] elements = configuration.getChildren( "dependency" );
+ final ArrayList dependencies = new ArrayList();
+
+ for( int i = 0; i < elements.length; i++ )
+ {
+ final DependencyDescriptor dependency =
+ buildDependency( classname, elements[i] );
+ dependencies.add( dependency );
+ }
+
+ return (DependencyDescriptor[])dependencies.toArray( DependencyDescriptor.EMPTY_SET );
+ }
+
+ /**
+ * A utility method to build a {@link DependencyDescriptor} object from specified configuraiton.
+ *
+ * @param classname The classname of Component (used for logging purposes)
+ * @param dependency the dependency configuration
+ *
+ * @return the created DependencyDescriptor
+ *
+ * @throws ConfigurationException if an error occurs
+ */
+ private DependencyDescriptor buildDependency( final String classname,
+ final Configuration dependency )
+ throws ConfigurationException
+ {
+ final String implementationKey =
+ dependency.getChild( "service" ).getAttribute( "name" );
+ String key = dependency.getChild( "role" ).getValue( null );
+
+ //default to name of service if key unspecified
+ if( null == key )
+ {
+ key = implementationKey;
+ }
+ else
+ {
+ //If key is specified and it is the same as
+ //service name then warn that it is redundent.
+ if( key.equals( implementationKey ) )
+ {
+ final String message =
+ REZ.format( "legacy.builder.redundent-key.notice",
+ classname,
+ key );
+ getLogger().warn( message );
+ }
+ }
+
+ return new DependencyDescriptor( key,
+ implementationKey,
+ false );
+ }
+
+ /**
+ * A utility method to build an array of {@link ServiceDescriptor} objects from specified configuraiton.
+ *
+ * @param info the services configuration
+ *
+ * @return the created ServiceDescriptor
+ *
+ * @throws ConfigurationException if an error occurs
+ */
+ private ServiceDescriptor[] buildServices( final Configuration info )
+ throws ConfigurationException
+ {
+ final ArrayList services = new ArrayList();
+
+ Configuration[] elements = info.getChild( "services" ).getChildren( "service" );
+ for( int i = 0; i < elements.length; i++ )
+ {
+ final ServiceDescriptor service = buildService( elements[i], false );
+ services.add( service );
+ }
+ elements = info.getChild( "management-access-points" ).getChildren( "service" );
+ for( int i = 0; i < elements.length; i++ )
+ {
+ final ServiceDescriptor service = buildService( elements[i], true );
+ services.add( service );
+ }
+
+ return (ServiceDescriptor[])services.toArray( ServiceDescriptor.EMPTY_SET );
+ }
+
+ /**
+ * A utility method to build a {@link ServiceDescriptor} object from specified configuraiton data.
+ *
+ * @param service the service Configuration
+ *
+ * @return the created ServiceDescriptor
+ *
+ * @throws ConfigurationException if an error occurs
+ */
+ private ServiceDescriptor buildService( final Configuration service,
+ final boolean isManagement )
+ throws ConfigurationException
+ {
<a name="task1" />+ //<span class="task">TODO</span> need to do something if its a management service. Ideally this is what gets looked at later on
+ //when plugging everything back in
+ return new ServiceDescriptor( service.getAttribute( "name" ) );
+ }
+}
</pre></div>
<hr /><a name="file8" /><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/engine">engine</a>/<a href="http://xstream.cvs.codehaus.org/jcontainer/loom/engine/src">src</a>/<a href="http://xstream.cvs.codehaus.org/jcontainer/loom/engine/src/java">java</a>/<a href="http://xstream.cvs.codehaus.org/jcontainer/loom/engine/src/java/org">org</a>/<a href="http://xstream.cvs.codehaus.org/jcontainer/loom/engine/src/java/org/jcontainer">jcontainer</a>/<a href="http://xstream.cvs.codehaus.org/jcontainer/loom/engine/src/java/org/jcontainer/loom">loom</a>/<a href="http://xstream.cvs.codehaus.org/jcontainer/loom/engine/src/java/org/jcontainer/loom/components">components</a>/<a href="http://xstream.cvs.codehaus.org/jcontainer/loom/engine/src/java/org/jcont
ainer/loom/components/util">util</a>/<a href="http://xstream.cvs.codehaus.org/jcontainer/!
loom/engine/src/java/org/jcontainer/loom/components/util/infobuilder">infobuilder</a><br /></span>
<div class="fileheader" id="added"><big><b>LegacyUtil.java</b></big> <small id="info">added at <a href="http://xstream.cvs.codehaus.org/jcontainer/loom/engine/src/java/org/jcontainer/loom/components/util/infobuilder/LegacyUtil.java?rev=1.1&content-type=text/vnd.viewcvs-markup">1.1</a></small></div>
<pre class="diff"><small id="info">diff -N LegacyUtil.java
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ LegacyUtil.java 20 Feb 2004 03:49:49 -0000 1.1
@@ -0,0 +1,36 @@
</small></pre><pre class="diff" id="added">+/*
+ * Copyright (C) The JContainer Group. All rights reserved.
+ *
+ * This software is published under the terms of the JContainer
+ * Software License version 1.1, a copy of which has been included
+ * with this distribution in the LICENSE.txt file.
+ */
+package org.jcontainer.loom.components.util.infobuilder;
+
+/**
+ * This is a set of constants and utility methods to enablesupport of Legacy BlockInfo files.
+ *
+ * @author Peter Donald
+ * @version $Revision: 1.1 $ $Date: 2004/02/20 03:49:49 $
+ */
+class LegacyUtil
+{
+ /**
+ * Get the location of the schema. By default it is "Foo-schema.xml" for the com.biz.Foo component.
+ *
+ * @param classname the classname of component
+ *
+ * @return the location of the schema
+ */
+ public static String getSchemaLocationFor( final String classname )
+ {
+ final int index = classname.lastIndexOf( "." );
+ String location = classname;
+ if( -1 != index )
+ {
+ location = classname.substring( index + 1 );
+ }
+ location += "-schema.xml";
+ return location;
+ }
+}
</pre><pre class="diff"><small id="info">\ No newline at end of file
</small></pre></div>
<hr /><a name="file9" /><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/engine">engine</a>/<a href="http://xstream.cvs.codehaus.org/jcontainer/loom/engine/src">src</a>/<a href="http://xstream.cvs.codehaus.org/jcontainer/loom/engine/src/java">java</a>/<a href="http://xstream.cvs.codehaus.org/jcontainer/loom/engine/src/java/org">org</a>/<a href="http://xstream.cvs.codehaus.org/jcontainer/loom/engine/src/java/org/jcontainer">jcontainer</a>/<a href="http://xstream.cvs.codehaus.org/jcontainer/loom/engine/src/java/org/jcontainer/loom">loom</a>/<a href="http://xstream.cvs.codehaus.org/jcontainer/loom/engine/src/java/org/jcontainer/loom/components">components</a>/<a href="http://xstream.cvs.codehaus.org/jcontainer/loom/engine/src/java/org/jcont
ainer/loom/components/util">util</a>/<a href="http://xstream.cvs.codehaus.org/jcontainer/!
loom/engine/src/java/org/jcontainer/loom/components/util/infobuilder">infobuilder</a><br /></span>
<div class="fileheader" id="added"><big><b>MetaClassBlockInfoReader.java</b></big> <small id="info">added at <a href="http://xstream.cvs.codehaus.org/jcontainer/loom/engine/src/java/org/jcontainer/loom/components/util/infobuilder/MetaClassBlockInfoReader.java?rev=1.1&content-type=text/vnd.viewcvs-markup">1.1</a></small></div>
<pre class="diff"><small id="info">diff -N MetaClassBlockInfoReader.java
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ MetaClassBlockInfoReader.java 20 Feb 2004 03:49:49 -0000 1.1
@@ -0,0 +1,172 @@
</small></pre><pre class="diff" id="added">+/*
+ * Copyright (C) The JContainer Group. All rights reserved.
+ *
+ * This software is published under the terms of the JContainer
+ * Software License version 1.1, a copy of which has been included
+ * with this distribution in the LICENSE.txt file.
+ */
+package org.jcontainer.loom.components.util.infobuilder;
+
+import java.lang.reflect.Method;
+import java.util.ArrayList;
+import java.util.List;
+
+import org.jcontainer.loom.components.util.info.ComponentInfo;
+import org.jcontainer.loom.components.util.info.DependencyDescriptor;
+import org.jcontainer.loom.components.util.info.SchemaDescriptor;
+import org.jcontainer.loom.components.util.info.ServiceDescriptor;
+import org.realityforge.metaclass.Attributes;
+import org.realityforge.metaclass.model.Attribute;
+
+/**
+ * A BlockInfoReader is responsible for building ComponentInfo objects from DNA MetaClass descriptors.
+ *
+ * @author Peter Donald
+ * @version $Revision: 1.1 $ $Date: 2004/02/20 03:49:49 $
+ */
+public final class MetaClassBlockInfoReader implements BlockInfoReader
+{
+ public ComponentInfo buildComponentInfo( final Class type )
+ throws Exception
+ {
+ final Attribute attribute =
+ Attributes.getAttribute( type, "dna.component" );
+ if( null == attribute )
+ {
+ final String message =
+ "Type " +
+ type.getName() +
+ " does not specify the " +
+ "required MetaClass attributes to be a Component";
+ throw new Exception( message );
+ }
+ final ServiceDescriptor[] services = buildServices( type );
+
+ final DependencyDescriptor[] dependencies =
+ buildDependencies( type );
+
+ final SchemaDescriptor schema = buildConfigurationSchema( type );
+
+ return new ComponentInfo( type,
+ services,
+ dependencies,
+ schema );
+ }
+
+ /**
+ * A utility method to build a descriptor for SchemaDescriptor,
+ *
+ * @param type the component type
+ *
+ * @return the a descriptor for the SchemaDescriptor,
+ */
+ private SchemaDescriptor buildConfigurationSchema( final Class type )
+ {
+ final Class[] types =
+ new Class[]{
+ org.apache.avalon.framework.configuration.Configuration.class};
+ try
+ {
+ final Method method = type.getMethod( "configure", types );
+ final Attribute attribute =
+ Attributes.getAttribute( method, "dna.configuration" );
+ if( null == attribute )
+ {
+ return null;
+ }
+ final String location = attribute.getParameter( "location" );
+ final String schemaType = attribute.getParameter( "type" );
+ return new SchemaDescriptor( location, schemaType );
+ }
+ catch( NoSuchMethodException e )
+ {
+ return null;
+ }
+ }
+
+ /**
+ * A utility method to build an array of DependencyDescriptor objects from specified configuration and classname.
+ *
+ * @param type the component type
+ *
+ * @return the created DependencyDescriptor
+ */
+ private DependencyDescriptor[] buildDependencies( final Class type )
+ {
+ final Method method = getDependencyMethod( type );
+ if( null == method )
+ {
+ return DependencyDescriptor.EMPTY_SET;
+ }
+ final List deps = new ArrayList();
+
+ final Attribute[] attributes =
+ Attributes.getAttributes( method, "dna.dependency" );
+ for( int i = 0; i < attributes.length; i++ )
+ {
+ final Attribute attribute = attributes[i];
+ final String key = attribute.getParameter( "key" );
+ final String depType = attribute.getParameter( "type" );
+ final boolean optional =
+ attribute.getParameter( "optional" ).equals( "true" );
+ deps.add( new DependencyDescriptor( key, depType, optional ) );
+ }
+
+ return (DependencyDescriptor[])deps.toArray( DependencyDescriptor.EMPTY_SET );
+ }
+
+ /**
+ * Return the method that dependency information attached to.
+ *
+ * @param type the component type
+ *
+ * @return the method that dependency information attached to.
+ */
+ private Method getDependencyMethod( final Class type )
+ {
+ try
+ {
+ final Class[] types1 =
+ new Class[]{
+ org.apache.avalon.framework.component.ComponentManager.class};
+ return type.getMethod( "compose", types1 );
+ }
+ catch( final NoSuchMethodException nsme )
+ {
+ }
+ try
+ {
+ final Class[] types2 =
+ new Class[]{
+ org.apache.avalon.framework.service.ServiceManager.class};
+ return type.getMethod( "service", types2 );
+ }
+ catch( NoSuchMethodException e )
+ {
+ }
+ return null;
+ }
+
+ /**
+ * A utility method to build an array of ServiceDescriptor objects from specified configuraiton.
+ *
+ * @param type the type
+ *
+ * @return the created ServiceDescriptor
+ */
+ private ServiceDescriptor[] buildServices( final Class type )
+ {
+ final List services = new ArrayList();
+
+ final Attribute[] attributes = Attributes.getAttributes( type,
+ "dna.service" );
+ for( int i = 0; i < attributes.length; i++ )
+ {
+ final Attribute attribute = attributes[i];
+ final String serviceType = attribute.getParameter( "type" );
+ services.add( new ServiceDescriptor( serviceType ) );
+ }
+
+ return (ServiceDescriptor[])services.toArray( ServiceDescriptor.EMPTY_SET );
+ }
+}
</pre></div>
<hr /><a name="file10" /><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/engine">engine</a>/<a href="http://xstream.cvs.codehaus.org/jcontainer/loom/engine/src">src</a>/<a href="http://xstream.cvs.codehaus.org/jcontainer/loom/engine/src/java">java</a>/<a href="http://xstream.cvs.codehaus.org/jcontainer/loom/engine/src/java/org">org</a>/<a href="http://xstream.cvs.codehaus.org/jcontainer/loom/engine/src/java/org/jcontainer">jcontainer</a>/<a href="http://xstream.cvs.codehaus.org/jcontainer/loom/engine/src/java/org/jcontainer/loom">loom</a>/<a href="http://xstream.cvs.codehaus.org/jcontainer/loom/engine/src/java/org/jcontainer/loom/components">components</a>/<a href="http://xstream.cvs.codehaus.org/jcontainer/loom/engine/src/java/org/jcont
ainer/loom/components/util">util</a>/<a href="http://xstream.cvs.codehaus.org/jcontainer/!
loom/engine/src/java/org/jcontainer/loom/components/util/infobuilder">infobuilder</a><br /></span>
<div class="fileheader" id="added"><big><b>Resources.properties</b></big> <small id="info">added at <a href="http://xstream.cvs.codehaus.org/jcontainer/loom/engine/src/java/org/jcontainer/loom/components/util/infobuilder/Resources.properties?rev=1.1&content-type=text/vnd.viewcvs-markup">1.1</a></small></div>
<pre class="diff"><small id="info">diff -N Resources.properties
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ Resources.properties 20 Feb 2004 03:49:49 -0000 1.1
@@ -0,0 +1,10 @@
</small></pre><pre class="diff" id="added">+legacy.builder.redundent-key.notice=Warning: ComponentInfo for class {0} redundently specifies key name "{1}" in dependency when it is identical to the name of service. It is recomended that the <key/> section be elided.
+legacy.builder.creating-info.notice=Creating a ComponentInfo for class "{0}".
+builder.creating-service-info.notice=Creating a ServiceInfo for class "{0}".
+builder.created-info.notice=Constructed ComponentInfo object for class {0}. ComponentInfo contains {1} services, {2} dependencies and {3} context entrys.
+builder.bad-toplevel-element.error=Error the component implemented by "{0}" has an invalid element at top level of component info descriptor. Expected: "component-info". Actual: "{1}"
+builder.missing-info.error=Unable to locate resource from which to load info for component implemented by class "{0}".
+builder.missing-xml-creator.error=Unable to create XMLInfoCreator, usually due to not having XML classes on Classpath. Thus unable to lookup XML descriptor for component type "{0}".
+
+legacy.bad-toplevel-element.error=Error the block info descriptor has an invalid top level element. Expected: "blockinfo". Actual: "{1}"
+legacy.created-info.notice=Created ComponentInfo object from BlockInfo descriptor, for class {0}. ComponentInfo contains {1} services and {2} dependencies.
</pre></div>
<hr /><a name="file11" /><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/engine">engine</a>/<a href="http://xstream.cvs.codehaus.org/jcontainer/loom/engine/src">src</a>/<a href="http://xstream.cvs.codehaus.org/jcontainer/loom/engine/src/java">java</a>/<a href="http://xstream.cvs.codehaus.org/jcontainer/loom/engine/src/java/org">org</a>/<a href="http://xstream.cvs.codehaus.org/jcontainer/loom/engine/src/java/org/jcontainer">jcontainer</a>/<a href="http://xstream.cvs.codehaus.org/jcontainer/loom/engine/src/java/org/jcontainer/loom">loom</a>/<a href="http://xstream.cvs.codehaus.org/jcontainer/loom/engine/src/java/org/jcontainer/loom/components">components</a>/<a href="http://xstream.cvs.codehaus.org/jcontainer/loom/engine/src/java/org/jcontainer/loom/
components/util">util</a>/<a href="http://xstream.cvs.codehaus.org/jcontainer/loom/engine!
/src/java/org/jcontainer/loom/components/util/infobuilder">infobuilder</a><br /></span>
<div class="fileheader"><big><b>BlockInfoReader.java</b></big> <small id="info"><a href="http://xstream.cvs.codehaus.org/jcontainer/loom/engine/src/java/org/jcontainer/loom/components/util/infobuilder/BlockInfoReader.java?rev=1.3&content-type=text/vnd.viewcvs-markup">1.3</a> <a href="http://xstream.cvs.codehaus.org/jcontainer/loom/engine/src/java/org/jcontainer/loom/components/util/infobuilder/BlockInfoReader.java.diff?r1=1.3&r2=1.4">-></a> <a href="http://xstream.cvs.codehaus.org/jcontainer/loom/engine/src/java/org/jcontainer/loom/components/util/infobuilder/BlockInfoReader.java?rev=1.4&content-type=text/vnd.viewcvs-markup">1.4</a></small></div>
<pre class="diff"><small id="info">diff -u -r1.3 -r1.4
--- BlockInfoReader.java 29 Nov 2003 13:44:26 -0000 1.3
+++ BlockInfoReader.java 20 Feb 2004 03:49:49 -0000 1.4
@@ -1,179 +1,19 @@
</small></pre><pre class="diff" id="removed">-/*
- * Copyright (C) The JContainer Group. All rights reserved.
- *
- * This software is published under the terms of the JContainer
- * Software License version 1.1, a copy of which has been included
- * with this distribution in the LICENSE.txt file.
- */
</pre><pre class="diff" id="context"> package org.jcontainer.loom.components.util.infobuilder;
</pre><pre class="diff" id="removed">-import java.lang.reflect.Method;
-import java.util.ArrayList;
-import java.util.List;
</pre><pre class="diff" id="context"> import org.jcontainer.loom.components.util.info.ComponentInfo;
</pre><pre class="diff" id="removed">-import org.jcontainer.loom.components.util.info.DependencyDescriptor;
-import org.jcontainer.loom.components.util.info.SchemaDescriptor;
-import org.jcontainer.loom.components.util.info.ServiceDescriptor;
-import org.realityforge.metaclass.Attributes;
-import org.realityforge.metaclass.model.Attribute;
</pre><pre class="diff" id="context">
/**
</pre><pre class="diff" id="removed">- * A BlockInfoReader is responsible for building ComponentInfo objects from DNA
- * MetaClass descriptors.
- *
- * @author Peter Donald
- * @version $Revision: 1.3 $ $Date: 2003/11/29 13:44:26 $
</pre><pre class="diff" id="added">+ * @author <a href="mailto:proyal-ysQLU0v/mp1Wk0Htik3J/[email protected]">peter royal</a>
</pre><pre class="diff" id="context"> */
</pre><pre class="diff" id="removed">-public <span id="removedchars">final class</span> BlockInfoReader
</pre><pre class="diff" id="added">+public <span id="addedchars">interface</span> BlockInfoReader
</pre><pre class="diff" id="context"> {
/**
</pre><pre class="diff" id="removed">- * Create a ComponentInfo object for specified classname, in specified
- * ClassLoader.
</pre><pre class="diff" id="added">+ * Create a ComponentInfo object for specified classname, in specified ClassLoader.
</pre><pre class="diff" id="context"> *
* @param type The Components type
</pre><pre class="diff" id="removed">- * @return the created ComponentInfo
- */
- public ComponentInfo buildComponentInfo( final Class type )
- throws Exception
- {
- final Attribute attribute =
- Attributes.getAttribute( type, "dna.component" );
- if( null == attribute )
- {
- final String message =
- "Type " +
- type.getName() +
- " does not specify the " +
- "required MetaClass attributes to be a Component";
- throw new Exception( message );
- }
- final ServiceDescriptor[] services = buildServices( type );
-
- final DependencyDescriptor[] dependencies =
- buildDependencies( type );
-
- final SchemaDescriptor schema = buildConfigurationSchema( type );
-
- return new ComponentInfo( type,
- services,
- dependencies,
- schema );
- }
-
- /**
- * A utility method to build a descriptor for SchemaDescriptor,
- *
- * @param type the component type
- * @return the a descriptor for the SchemaDescriptor,
- */
- private SchemaDescriptor buildConfigurationSchema( final Class type )
- {
- final Class[] types =
- new Class[]{
- org.apache.avalon.framework.configuration.Configuration.class};
- try
- {
- final Method method = type.getMethod( "configure", types );
- final Attribute attribute =
- Attributes.getAttribute( method, "dna.configuration" );
- if( null == attribute )
- {
- return null;
- }
- final String location = attribute.getParameter( "location" );
- final String schemaType = attribute.getParameter( "type" );
- return new SchemaDescriptor( location, schemaType );
- }
- catch( NoSuchMethodException e )
- {
- return null;
- }
- }
-
- /**
- * A utility method to build an array of DependencyDescriptor objects from
- * specified configuration and classname.
</pre><pre class="diff" id="context"> *
</pre><pre class="diff" id="removed">- * @param type the component type
- * @return the created DependencyDescriptor
- */
- private DependencyDescriptor[] buildDependencies( final Class type )
- {
- final Method method = getDependencyMethod( type );
- if( null == method )
- {
- return DependencyDescriptor.EMPTY_SET;
- }
- final List deps = new ArrayList();
-
- final Attribute[] attributes =
- Attributes.getAttributes( method, "dna.dependency" );
- for( int i = 0; i < attributes.length; i++ )
- {
- final Attribute attribute = attributes[ i ];
- final String key = attribute.getParameter( "key" );
- final String depType = attribute.getParameter( "type" );
- final boolean optional =
- attribute.getParameter( "optional" ).equals( "true" );
- deps.add( new DependencyDescriptor( key, depType, optional ) );
- }
-
- return (DependencyDescriptor[])deps.toArray(
- DependencyDescriptor.EMPTY_SET );
- }
-
- /**
- * Return the method that dependency information attached to.
- *
- * @param type the component type
- * @return the method that dependency information attached to.
- */
- private Method getDependencyMethod( final Class type )
- {
- try
- {
- final Class[] types1 =
- new Class[]{
- org.apache.avalon.framework.component.ComponentManager.class};
- return type.getMethod( "compose", types1 );
- }
- catch( final NoSuchMethodException nsme )
- {
- }
- try
- {
- final Class[] types2 =
- new Class[]{
- org.apache.avalon.framework.service.ServiceManager.class};
- return type.getMethod( "service", types2 );
- }
- catch( NoSuchMethodException e )
- {
- }
- return null;
- }
-
- /**
- * A utility method to build an array of ServiceDescriptor objects from
- * specified configuraiton.
- *
- * @param type the type
- * @return the created ServiceDescriptor
</pre><pre class="diff" id="added">+ * @return the created ComponentInfo
</pre><pre class="diff" id="context"> */
</pre><pre class="diff" id="removed">- private ServiceDescriptor[] buildServices( final Class type )
- {
- final List services = new ArrayList();
-
- final Attribute[] attributes = Attributes.getAttributes( type,
- "dna.service" );
- for( int i = 0; i < attributes.length; i++ )
- {
- final Attribute attribute = attributes[ i ];
- final String serviceType = attribute.getParameter( "type" );
- services.add( new ServiceDescriptor( serviceType ) );
- }
-
- return (ServiceDescriptor[])services.toArray(
- ServiceDescriptor.EMPTY_SET );
- }
-}
</pre><pre class="diff" id="added">+ ComponentInfo buildComponentInfo( Class type )
+ throws Exception;
+}
</pre><pre class="diff"><small id="info">\ No newline at end of file
</small></pre></div>
<hr /><a name="file12" /><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/engine">engine</a>/<a href="http://xstream.cvs.codehaus.org/jcontainer/loom/engine/src">src</a>/<a href="http://xstream.cvs.codehaus.org/jcontainer/loom/engine/src/java">java</a>/<a href="http://xstream.cvs.codehaus.org/jcontainer/loom/engine/src/java/org">org</a>/<a href="http://xstream.cvs.codehaus.org/jcontainer/loom/engine/src/java/org/jcontainer">jcontainer</a>/<a href="http://xstream.cvs.codehaus.org/jcontainer/loom/engine/src/java/org/jcontainer/loom">loom</a>/<a href="http://xstream.cvs.codehaus.org/jcontainer/loom/engine/src/java/org/jcontainer/loom/components">components</a>/<a href="http://xstream.cvs.codehaus.org/jcontainer/loom/engine/src/java/org/jcontainer/loom/
components/util">util</a>/<a href="http://xstream.cvs.codehaus.org/jcontainer/loom/engine!
/src/java/org/jcontainer/loom/components/util/verifier">verifier</a><br /></span>
<div class="fileheader"><big><b>ComponentVerifier.java</b></big> <small id="info"><a href="http://xstream.cvs.codehaus.org/jcontainer/loom/engine/src/java/org/jcontainer/loom/components/util/verifier/ComponentVerifier.java?rev=1.4&content-type=text/vnd.viewcvs-markup">1.4</a> <a href="http://xstream.cvs.codehaus.org/jcontainer/loom/engine/src/java/org/jcontainer/loom/components/util/verifier/ComponentVerifier.java.diff?r1=1.4&r2=1.5">-></a> <a href="http://xstream.cvs.codehaus.org/jcontainer/loom/engine/src/java/org/jcontainer/loom/components/util/verifier/ComponentVerifier.java?rev=1.5&content-type=text/vnd.viewcvs-markup">1.5</a></small></div>
<pre class="diff"><small id="info">diff -u -r1.4 -r1.5
--- ComponentVerifier.java 3 Dec 2003 10:44:43 -0000 1.4
+++ ComponentVerifier.java 20 Feb 2004 03:49:49 -0000 1.5
@@ -9,6 +9,7 @@
</small></pre><pre class="diff" id="context">
import java.lang.reflect.Constructor;
import java.lang.reflect.Modifier;
</pre><pre class="diff" id="added">+
</pre><pre class="diff" id="context"> import org.apache.avalon.framework.activity.Disposable;
import org.apache.avalon.framework.activity.Initializable;
import org.apache.avalon.framework.activity.Startable;
</pre><pre class="diff"><small id="info">@@ -23,31 +24,35 @@
</small></pre><pre class="diff" id="context"> import org.apache.avalon.framework.parameters.Parameterizable;
import org.apache.avalon.framework.parameters.Reparameterizable;
import org.apache.avalon.framework.service.Serviceable;
</pre><pre class="diff" id="added">+
</pre><pre class="diff" id="context"> import org.codehaus.spice.salt.i18n.ResourceManager;
import org.codehaus.spice.salt.i18n.Resources;
</pre><pre class="diff" id="added">+import org.jcontainer.dna.AbstractLogEnabled;
</pre><pre class="diff" id="context"> import org.realityforge.metaclass.Attributes;
import org.realityforge.metaclass.model.Attribute;
/**
</pre><pre class="diff" id="removed">- * Utility class to help verify that component respects the rules of an Avalon
- * component.
</pre><pre class="diff" id="added">+ * Utility class to help verify that component respects the rules of an Avalon component.
</pre><pre class="diff" id="context"> *
* @author Peter Donald
</pre><pre class="diff" id="removed">- * @version $Revision: 1.4 $ $Date: 2003/12/03 10:44:43 $
</pre><pre class="diff" id="added">+ * @version $Revision: 1.5 $ $Date: 2004/02/20 03:49:49 $
</pre><pre class="diff" id="context"> */
</pre><pre class="diff" id="removed">-public class ComponentVerifier
</pre><pre class="diff" id="added">+public class ComponentVerifier extends AbstractLogEnabled
</pre><pre class="diff" id="context"> {
</pre><pre class="diff" id="removed">- /** I18n utils. */
</pre><pre class="diff" id="added">+ /**
+ * I18n utils.
+ */
</pre><pre class="diff" id="context"> private static final Resources REZ =
ResourceManager.getPackageResources( ComponentVerifier.class );
/**
</pre><pre class="diff" id="removed">- * Constant for array of 0 classes. Saves recreating array everytime look up
- * constructor with no args.
</pre><pre class="diff" id="added">+ * Constant for array of 0 classes. Saves recreating array everytime look up constructor with no args.
</pre><pre class="diff" id="context"> */
</pre><pre class="diff" id="removed">- private static final Class[] EMPTY_TYPES = new Class[<span id="removedchars"> 0 </span>];
</pre><pre class="diff" id="added">+ private static final Class[] EMPTY_TYPES = new Class[<span id="addedchars">0</span>];
</pre><pre class="diff" id="context">
</pre><pre class="diff" id="removed">- /** The interfaces representing lifecycle stages. */
</pre><pre class="diff" id="added">+ /**
+ * The interfaces representing lifecycle stages.
+ */
</pre><pre class="diff" id="context"> private static final Class[] FRAMEWORK_CLASSES = new Class[]
{
LogEnabled.class,
</pre><pre class="diff"><small id="info">@@ -67,11 +72,11 @@
</small></pre><pre class="diff" id="context"> };
/**
</pre><pre class="diff" id="removed">- * Verfiy that specified components designate classes that implement the
- * advertised interfaces.
</pre><pre class="diff" id="added">+ * Verfiy that specified components designate classes that implement the advertised interfaces.
</pre><pre class="diff" id="context"> *
* @param name the name of component
* @param type the component type
</pre><pre class="diff" id="added">+ *
</pre><pre class="diff" id="context"> * @throws java.lang.Exception if an error occurs
*/
public void verifyType( final String name, final Class type )
</pre><pre class="diff"><small id="info">@@ -81,26 +86,29 @@
</small></pre><pre class="diff" id="context"> Attributes.getAttribute( type, "dna.component" );
if( null == attribute )
{
</pre><pre class="diff" id="removed">- final String message =
- "Component " + name + " does not specify correct metadata";
- throw new Exception( message );
</pre><pre class="diff" id="added">+ final String msg = "Legacy? component " + name
+ + " does not specify correct metadata. Skipping type verification";
+
+ getLogger().warn( msg );
+
+// final String message =
+// "Component " + name + " does not specify correct metadata";
+// throw new Exception( message );
</pre><pre class="diff" id="context"> }
final Class[] interfaces = getServiceClasses( name, type );
verifyComponent( name, type, interfaces, false );
}
/**
</pre><pre class="diff" id="removed">- * Verify that the supplied implementation class and service classes are
- * valid for a component.
</pre><pre class="diff" id="added">+ * Verify that the supplied implementation class and service classes are valid for a component.
</pre><pre class="diff" id="context"> *
</pre><pre class="diff" id="removed">- * @param name the name of component
</pre><pre class="diff" id="added">+ * @param name <span id="addedchars"> </span>the name of component
</pre><pre class="diff" id="context"> * @param implementation the implementation class of component
</pre><pre class="diff" id="removed">- * @param services the classes representing services
- * @param buildable if true will verify that it is instantiateable via
- * class.newInstance(). May not be required for some components that are
- * created via a factory.
- * @throws java.lang.Exception if error thrown on failure and component
- * fails check
</pre><pre class="diff" id="added">+ * @param services the classes representing services
+ * @param buildable if true will verify that it is instantiateable via class.newInstance(). May not be required
+ * for some components that are created via a factory.
+ *
+ * @throws java.lang.Exception if error thrown on failure and component fails check
</pre><pre class="diff" id="context"> */
public void verifyComponent( final String name,
final Class implementation,
</pre><pre class="diff"><small id="info">@@ -118,14 +126,13 @@
</small></pre><pre class="diff" id="context"> }
/**
</pre><pre class="diff" id="removed">- * Verify that the supplied implementation implements the specified
- * services.
</pre><pre class="diff" id="added">+ * Verify that the supplied implementation implements the specified services.
</pre><pre class="diff" id="context"> *
</pre><pre class="diff" id="removed">- * @param name the name of component
</pre><pre class="diff" id="added">+ * @param name <span id="addedchars"> </span>the name of component
</pre><pre class="diff" id="context"> * @param implementation the class representign component
</pre><pre class="diff" id="removed">- * @param services the services that the implementation must provide
- * @throws java.lang.Exception if error thrown on failure and component
- * fails check
</pre><pre class="diff" id="added">+ * @param services the services that the implementation must provide
+ *
+ * @throws java.lang.Exception if error thrown on failure and component fails check
</pre><pre class="diff" id="context"> */
public void verifyImplementsServices( final String name,
final Class implementation,
</pre><pre class="diff"><small id="info">@@ -134,13 +141,13 @@
</small></pre><pre class="diff" id="context"> {
for( int i = 0; i < services.length; i++ )
{
</pre><pre class="diff" id="removed">- if( !services[<span id="removedchars"> i </span>].isAssignableFrom( implementation ) )
</pre><pre class="diff" id="added">+ if( !services[<span id="addedchars">i</span>].isAssignableFrom( implementation ) )
</pre><pre class="diff" id="context"> {
final String message =
REZ.format( "verifier.noimpl-service.error",
name,
implementation.getName(),
</pre><pre class="diff" id="removed">- services[<span id="removedchars"> i </span>].getName() );
</pre><pre class="diff" id="added">+ services[<span id="addedchars">i</span>].getName() );
</pre><pre class="diff" id="context"> throw new Exception( message );
}
}
</pre><pre class="diff"><small id="info">@@ -149,10 +156,10 @@
</small></pre><pre class="diff" id="context"> /**
* Verify that the supplied class is a valid class for a Component.
*
</pre><pre class="diff" id="removed">- * @param name the name of component
</pre><pre class="diff" id="added">+ * @param name <span id="addedchars"> </span>the name of component
</pre><pre class="diff" id="context"> * @param clazz the class representing component
</pre><pre class="diff" id="removed">- * @throws java.lang.Exception if error thrown on failure and component
- * fails check
</pre><pre class="diff" id="added">+ *
+ * @throws java.lang.Exception if error thrown on failure and component fails check
</pre><pre class="diff" id="context"> */
public void verifyClass( final String name,
final Class clazz )
</pre><pre class="diff"><small id="info">@@ -169,10 +176,10 @@
</small></pre><pre class="diff" id="context"> /**
* Verify that the supplied classes are valid classes for a service.
*
</pre><pre class="diff" id="removed">- * @param name the name of component
</pre><pre class="diff" id="added">+ * @param name <span id="addedchars"> </span>the name of component
</pre><pre class="diff" id="context"> * @param classes the classes representign services
</pre><pre class="diff" id="removed">- * @throws java.lang.Exception if error thrown on failure and component
- * fails check
</pre><pre class="diff" id="added">+ *
+ * @throws java.lang.Exception if error thrown on failure and component fails check
</pre><pre class="diff" id="context"> */
public void verifyServices( final String name,
final Class[] classes )
</pre><pre class="diff"><small id="info">@@ -180,17 +187,17 @@
</small></pre><pre class="diff" id="context"> {
for( int i = 0; i < classes.length; i++ )
{
</pre><pre class="diff" id="removed">- verifyService( name, classes[<span id="removedchars"> i </span>] );
</pre><pre class="diff" id="added">+ verifyService( name, classes[<span id="addedchars">i</span>] );
</pre><pre class="diff" id="context"> }
}
/**
* Verify that the supplied class is a valid class for a service.
*
</pre><pre class="diff" id="removed">- * @param name the name of component
</pre><pre class="diff" id="added">+ * @param name <span id="addedchars"> </span>the name of component
</pre><pre class="diff" id="context"> * @param clazz the class representign service
</pre><pre class="diff" id="removed">- * @throws java.lang.Exception if error thrown on failure and component
- * fails check
</pre><pre class="diff" id="added">+ *
+ * @throws java.lang.Exception if error thrown on failure and component fails check
</pre><pre class="diff" id="context"> */
public void verifyService( final String name,
final Class clazz )
</pre><pre class="diff"><small id="info">@@ -202,13 +209,12 @@
</small></pre><pre class="diff" id="context"> }
/**
</pre><pre class="diff" id="removed">- * Verify that the implementation class does not implement incompatible
- * lifecycle interfaces.
</pre><pre class="diff" id="added">+ * Verify that the implementation class does not implement incompatible lifecycle interfaces.
</pre><pre class="diff" id="context"> *
</pre><pre class="diff" id="removed">- * @param name the name of component
</pre><pre class="diff" id="added">+ * @param name <span id="addedchars"> </span>the name of component
</pre><pre class="diff" id="context"> * @param implementation the implementation class
</pre><pre class="diff" id="removed">- * @throws java.lang.Exception if error thrown on failure and component
- * fails check
</pre><pre class="diff" id="added">+ *
+ * @throws java.lang.Exception if error thrown on failure and component fails check
</pre><pre class="diff" id="context"> */
public void verifyLifecycles( final String name,
final Class implementation )
</pre><pre class="diff"><small id="info">@@ -217,8 +223,7 @@
</small></pre><pre class="diff" id="context"> final boolean composable =
Composable.class.isAssignableFrom( implementation ) ||
Recomposable.class.isAssignableFrom( implementation );
</pre><pre class="diff" id="removed">- final boolean serviceable = Serviceable.class.isAssignableFrom(
- implementation );
</pre><pre class="diff" id="added">+ final boolean serviceable = Serviceable.class.isAssignableFrom( implementation );
</pre><pre class="diff" id="context"> if( serviceable && composable )
{
final String message =
</pre><pre class="diff"><small id="info">@@ -245,13 +250,12 @@
</small></pre><pre class="diff" id="context"> }
/**
</pre><pre class="diff" id="removed">- * Verify that the service implemented by specified component is an
- * interface.
</pre><pre class="diff" id="added">+ * Verify that the service implemented by specified component is an interface.
</pre><pre class="diff" id="context"> *
</pre><pre class="diff" id="removed">- * @param name the name of component
</pre><pre class="diff" id="added">+ * @param name <span id="addedchars"> </span>the name of component
</pre><pre class="diff" id="context"> * @param clazz the class representign service
</pre><pre class="diff" id="removed">- * @throws java.lang.Exception if error thrown on failure and component
- * fails check
</pre><pre class="diff" id="added">+ *
+ * @throws java.lang.Exception if error thrown on failure and component fails check
</pre><pre class="diff" id="context"> */
public void verifyServiceIsaInterface( final String name,
final Class clazz )
</pre><pre class="diff"><small id="info">@@ -270,10 +274,10 @@
</small></pre><pre class="diff" id="context"> /**
* Verify that the service implemented by specified component is public.
*
</pre><pre class="diff" id="removed">- * @param name the name of component
</pre><pre class="diff" id="added">+ * @param name <span id="addedchars"> </span>the name of component
</pre><pre class="diff" id="context"> * @param clazz the class representign service
</pre><pre class="diff" id="removed">- * @throws java.lang.Exception if error thrown on failure and component
- * fails check
</pre><pre class="diff" id="added">+ *
+ * @throws java.lang.Exception if error thrown on failure and component fails check
</pre><pre class="diff" id="context"> */
public void verifyServiceIsPublic( final String name,
final Class clazz )
</pre><pre class="diff"><small id="info">@@ -292,13 +296,12 @@
</small></pre><pre class="diff" id="context"> }
/**
</pre><pre class="diff" id="removed">- * Verify that the service implemented by specified component does not
- * extend any lifecycle interfaces.
</pre><pre class="diff" id="added">+ * Verify that the service implemented by specified component does not extend any lifecycle interfaces.
</pre><pre class="diff" id="context"> *
</pre><pre class="diff" id="removed">- * @param name the name of component
</pre><pre class="diff" id="added">+ * @param name <span id="addedchars"> </span>the name of component
</pre><pre class="diff" id="context"> * @param clazz the class representign service
</pre><pre class="diff" id="removed">- * @throws java.lang.Exception if error thrown on failure and component
- * fails check
</pre><pre class="diff" id="added">+ *
+ * @throws java.lang.Exception if error thrown on failure and component fails check
</pre><pre class="diff" id="context"> */
public void verifyServiceNotALifecycle( final String name,
final Class clazz )
</pre><pre class="diff"><small id="info">@@ -306,7 +309,7 @@
</small></pre><pre class="diff" id="context"> {
for( int i = 0; i < FRAMEWORK_CLASSES.length; i++ )
{
</pre><pre class="diff" id="removed">- final Class lifecycle = FRAMEWORK_CLASSES[<span id="removedchars"> i </span>];
</pre><pre class="diff" id="added">+ final Class lifecycle = FRAMEWORK_CLASSES[<span id="addedchars">i</span>];
</pre><pre class="diff" id="context"> if( lifecycle.isAssignableFrom( clazz ) )
{
final String message =
</pre><pre class="diff"><small id="info">@@ -322,10 +325,10 @@
</small></pre><pre class="diff" id="context"> /**
* Verify that the component has a no-arg aka default constructor.
*
</pre><pre class="diff" id="removed">- * @param name the name of component
</pre><pre class="diff" id="added">+ * @param name <span id="addedchars"> </span>the name of component
</pre><pre class="diff" id="context"> * @param clazz the class representign component
</pre><pre class="diff" id="removed">- * @throws java.lang.Exception if error thrown on failure and component
- * fails check
</pre><pre class="diff" id="added">+ *
+ * @throws java.lang.Exception if error thrown on failure and component fails check
</pre><pre class="diff" id="context"> */
public void verifyNoArgConstructor( final String name,
final Class clazz )
</pre><pre class="diff"><small id="info">@@ -356,10 +359,10 @@
</small></pre><pre class="diff" id="context"> /**
* Verify that the component is not represented by abstract class.
*
</pre><pre class="diff" id="removed">- * @param name the name of component
</pre><pre class="diff" id="added">+ * @param name <span id="addedchars"> </span>the name of component
</pre><pre class="diff" id="context"> * @param clazz the class representign component
</pre><pre class="diff" id="removed">- * @throws java.lang.Exception if error thrown on failure and component
- * fails check
</pre><pre class="diff" id="added">+ *
+ * @throws java.lang.Exception if error thrown on failure and component fails check
</pre><pre class="diff" id="context"> */
public void verifyNonAbstract( final String name,
final Class clazz )
</pre><pre class="diff"><small id="info">@@ -380,10 +383,10 @@
</small></pre><pre class="diff" id="context"> /**
* Verify that the component is not represented by abstract class.
*
</pre><pre class="diff" id="removed">- * @param name the name of component
</pre><pre class="diff" id="added">+ * @param name <span id="addedchars"> </span>the name of component
</pre><pre class="diff" id="context"> * @param clazz the class representign component
</pre><pre class="diff" id="removed">- * @throws java.lang.Exception if error thrown on failure and component
- * fails check
</pre><pre class="diff" id="added">+ *
+ * @throws java.lang.Exception if error thrown on failure and component fails check
</pre><pre class="diff" id="context"> */
public void verifyPublic( final String name,
final Class clazz )
</pre><pre class="diff"><small id="info">@@ -404,10 +407,10 @@
</small></pre><pre class="diff" id="context"> /**
* Verify that the component is not represented by primitive class.
*
</pre><pre class="diff" id="removed">- * @param name the name of component
</pre><pre class="diff" id="added">+ * @param name <span id="addedchars"> </span>the name of component
</pre><pre class="diff" id="context"> * @param clazz the class representign component
</pre><pre class="diff" id="removed">- * @throws java.lang.Exception if error thrown on failure and component
- * fails check
</pre><pre class="diff" id="added">+ *
+ * @throws java.lang.Exception if error thrown on failure and component fails check
</pre><pre class="diff" id="context"> */
public void verifyNonPrimitive( final String name,
final Class clazz )
</pre><pre class="diff"><small id="info">@@ -426,10 +429,10 @@
</small></pre><pre class="diff" id="context"> /**
* Verify that the component is not represented by interface class.
*
</pre><pre class="diff" id="removed">- * @param name the name of component
</pre><pre class="diff" id="added">+ * @param name <span id="addedchars"> </span>the name of component
</pre><pre class="diff" id="context"> * @param clazz the class representign component
</pre><pre class="diff" id="removed">- * @throws java.lang.Exception if error thrown on failure and component
- * fails check
</pre><pre class="diff" id="added">+ *
+ * @throws java.lang.Exception if error thrown on failure and component fails check
</pre><pre class="diff" id="context"> */
public void verifyNonInterface( final String name,
final Class clazz )
</pre><pre class="diff"><small id="info">@@ -448,10 +451,10 @@
</small></pre><pre class="diff" id="context"> /**
* Verify that the component is not represented by an array class.
*
</pre><pre class="diff" id="removed">- * @param name the name of component
</pre><pre class="diff" id="added">+ * @param name <span id="addedchars"> </span>the name of component
</pre><pre class="diff" id="context"> * @param clazz the class representign component
</pre><pre class="diff" id="removed">- * @throws java.lang.Exception if error thrown on failure and component
- * fails check
</pre><pre class="diff" id="added">+ *
+ * @throws java.lang.Exception if error thrown on failure and component fails check
</pre><pre class="diff" id="context"> */
public void verifyNonArray( final String name,
final Class clazz )
</pre><pre class="diff"><small id="info">@@ -468,12 +471,14 @@
</small></pre><pre class="diff" id="context"> }
/**
</pre><pre class="diff" id="removed">- * Retrieve an array of Classes for all the services that a Component
- * offers. This method also makes sure all services offered are interfaces.
</pre><pre class="diff" id="added">+ * Retrieve an array of Classes for all the services that a Component offers. This method also makes sure all
+ * services offered are interfaces.
</pre><pre class="diff" id="context"> *
* @param name the name of component
* @param type the component type
</pre><pre class="diff" id="added">+ *
</pre><pre class="diff" id="context"> * @return an array of Classes for all the services
</pre><pre class="diff" id="added">+ *
</pre><pre class="diff" id="context"> * @throws java.lang.Exception if an error occurs
*/
protected Class[] getServiceClasses( final String name,
</pre><pre class="diff"><small id="info">@@ -483,13 +488,13 @@
</small></pre><pre class="diff" id="context"> final ClassLoader classLoader = type.getClassLoader();
final Attribute[] attributes =
Attributes.getAttributes( type, "dna.service" );
</pre><pre class="diff" id="removed">- final Class[] classes = new Class[<span id="removedchars"> attributes.length </span>];
</pre><pre class="diff" id="added">+ final Class[] classes = new Class[<span id="addedchars">attributes.length</span>];
</pre><pre class="diff" id="context"> for( int i = 0; i < attributes.length; i++ )
{
</pre><pre class="diff" id="removed">- final String classname = attributes[<span id="removedchars"> i </span>].getParameter( "type" );
</pre><pre class="diff" id="added">+ final String classname = attributes[<span id="addedchars">i</span>].getParameter( "type" );
</pre><pre class="diff" id="context"> try
{
</pre><pre class="diff" id="removed">- classes[<span id="removedchars"> i </span>] = classLoader.loadClass( classname );
</pre><pre class="diff" id="added">+ classes[<span id="addedchars">i</span>] = classLoader.loadClass( classname );
</pre><pre class="diff" id="context"> }
catch( final Throwable t )
{
</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/engine">engine</a>/<a href="http://xstream.cvs.codehaus.org/jcontainer/loom/engine/src">src</a>/<a href="http://xstream.cvs.codehaus.org/jcontainer/loom/engine/src/java">java</a>/<a href="http://xstream.cvs.codehaus.org/jcontainer/loom/engine/src/java/org">org</a>/<a href="http://xstream.cvs.codehaus.org/jcontainer/loom/engine/src/java/org/jcontainer">jcontainer</a>/<a href="http://xstream.cvs.codehaus.org/jcontainer/loom/engine/src/java/org/jcontainer/loom">loom</a>/<a href="http://xstream.cvs.codehaus.org/jcontainer/loom/engine/src/java/org/jcontainer/loom/components">components</a>/<a href="http://xstream.cvs.codehaus.org/jcontainer/loom/engine/src/java/org/jcontainer/loom/
components/util">util</a>/<a href="http://xstream.cvs.codehaus.org/jcontainer/loom/engine!
/src/java/org/jcontainer/loom/components/util/verifier">verifier</a><br /></span>
<div class="fileheader"><big><b>SarVerifier.java</b></big> <small id="info"><a href="http://xstream.cvs.codehaus.org/jcontainer/loom/engine/src/java/org/jcontainer/loom/components/util/verifier/SarVerifier.java?rev=1.6&content-type=text/vnd.viewcvs-markup">1.6</a> <a href="http://xstream.cvs.codehaus.org/jcontainer/loom/engine/src/java/org/jcontainer/loom/components/util/verifier/SarVerifier.java.diff?r1=1.6&r2=1.7">-></a> <a href="http://xstream.cvs.codehaus.org/jcontainer/loom/engine/src/java/org/jcontainer/loom/components/util/verifier/SarVerifier.java?rev=1.7&content-type=text/vnd.viewcvs-markup">1.7</a></small></div>
<pre class="diff"><small id="info">diff -u -r1.6 -r1.7
--- SarVerifier.java 3 Dec 2003 10:44:43 -0000 1.6
+++ SarVerifier.java 20 Feb 2004 03:49:49 -0000 1.7
@@ -88,56 +88,69 @@
</small></pre><pre class="diff" id="context">
import org.codehaus.spice.salt.i18n.ResourceManager;
import org.codehaus.spice.salt.i18n.Resources;
</pre><pre class="diff" id="added">+import org.jcontainer.dna.Logger;
</pre><pre class="diff" id="context"> import org.jcontainer.loom.components.util.metadata.ComponentTemplate;
import org.jcontainer.loom.components.util.profile.ComponentProfile;
import org.jcontainer.loom.components.util.profile.PartitionProfile;
import org.jcontainer.loom.interfaces.ContainerConstants;
/**
</pre><pre class="diff" id="removed">- * This Class verifies that Sars are valid. It performs a number of checks to
- * make sure that the Sar represents a valid application and excluding runtime
- * errors will start up validly. Some of the checks it performs include;
</pre><pre class="diff" id="added">+ * This Class verifies that Sars are valid. It performs a number of checks to make sure that the Sar represents a valid
+ * application and excluding runtime errors will start up validly. Some of the checks it performs include;
</pre><pre class="diff" id="context"> *
</pre><pre class="diff" id="removed">- * <ul> <li>Verify names of Sar, Blocks and BlockListeners contain only letters,
- * digits or the '_' character.</li> <li>Verify that the names of the Blocks and
- * BlockListeners are unique to Sar.</li> <li>Verify that the dependendencies
- * specified in assembly.xml correspond to dependencies specified in BlockInfo
- * files.</li> <li>Verify that the inter-block dependendencies specified in
- * assembly.xml are valid. This essentially means that if Block A requires
- * Service S from Block B then Block B must provide Service S.</li> <li>Verify
- * that there are no circular dependendencies between blocks.</li> <li>Verify
- * that the Class objects for Blocks support the Block interface and any
- * specified Services.</li> <li>Verify that the Class objects for BlockListeners
- * support the BlockListener interface.</li> </ul>
</pre><pre class="diff" id="added">+ * <ul> <li>Verify names of Sar, Blocks and BlockListeners contain only letters, digits or the '_' character.</li>
+ * <li>Verify that the names of the Blocks and BlockListeners are unique to Sar.</li> <li>Verify that the
+ * dependendencies specified in assembly.xml correspond to dependencies specified in BlockInfo files.</li> <li>Verify
+ * that the inter-block dependendencies specified in assembly.xml are valid. This essentially means that if Block A
+ * requires Service S from Block B then Block B must provide Service S.</li> <li>Verify that there are no circular
+ * dependendencies between blocks.</li> <li>Verify that the Class objects for Blocks support the Block interface and any
+ * specified Services.</li> <li>Verify that the Class objects for BlockListeners support the BlockListener
+ * interface.</li> </ul>
</pre><pre class="diff" id="context"> *
* @author Peter Donald
</pre><pre class="diff" id="removed">- * @version $Revision: 1.6 $ $Date: 2003/12/03 10:44:43 $
</pre><pre class="diff" id="added">+ * @version $Revision: 1.7 $ $Date: 2004/02/20 03:49:49 $
</pre><pre class="diff" id="context"> */
public class SarVerifier
extends AssemblyVerifier
{
</pre><pre class="diff" id="removed">- /** I18n utils. */
</pre><pre class="diff" id="added">+ /**
+ * I18n utils.
+ */
</pre><pre class="diff" id="context"> private static final Resources REZ =
ResourceManager.getPackageResources( SarVerifier.class );
</pre><pre class="diff" id="removed">- /** The Block class used to warn about deprecation. */
</pre><pre class="diff" id="added">+ /**
+ * The Block class used to warn about deprecation.
+ */
</pre><pre class="diff" id="context"> private static final Class BLOCK_CLASS =
getClass( "org.apache.avalon.phoenix.Block" );
</pre><pre class="diff" id="removed">- /** The BlockListener class used to warn about deprecation. */
</pre><pre class="diff" id="added">+ /**
+ * The BlockListener class used to warn about deprecation.
+ */
</pre><pre class="diff" id="context"> private static final Class BLOCKLISTENER_CLASS =
getClass( "org.apache.avalon.phoenix.BlockListener" );
</pre><pre class="diff" id="removed">- /** The Verifier for Info instances. */
</pre><pre class="diff" id="added">+ /**
+ * The Verifier for Info instances.
+ */
</pre><pre class="diff" id="context"> private final ComponentVerifier m_infoVerifier = new ComponentVerifier();
</pre><pre class="diff" id="added">+ public void enableLogging( final Logger logger )
+ {
+ super.enableLogging( logger );
+
+ setupLogger( m_infoVerifier );
+ }
+
</pre><pre class="diff" id="context"> /**
</pre><pre class="diff" id="removed">- * Verify the specified {@link org.jcontainer.loom.components.util.profile.PartitionProfile}
- * object. The rules used to verify {@link org.jcontainer.loom.components.util.profile.PartitionProfile}
- * are specified in the Class javadocs.
</pre><pre class="diff" id="added">+ * Verify the specified {@link org.jcontainer.loom.components.util.profile.PartitionProfile} object. The rules used
+ * to verify {@link org.jcontainer.loom.components.util.profile.PartitionProfile} are specified in the Class
+ * javadocs.
</pre><pre class="diff" id="context"> *
</pre><pre class="diff" id="removed">- * @param profile the Sar profile
</pre><pre class="diff" id="added">+ * @param profile <span id="addedchars"> </span>the Sar profile
</pre><pre class="diff" id="context"> * @param classLoader the classloader to load types from
</pre><pre class="diff" id="added">+ *
</pre><pre class="diff" id="context"> * @throws Exception if an error occurs
*/
public void verifySar( final PartitionProfile profile,
</pre><pre class="diff"><small id="info">@@ -174,11 +187,11 @@
</small></pre><pre class="diff" id="context"> }
/**
</pre><pre class="diff" id="removed">- * Verfiy that all Blocks specify classes that implement the advertised
- * interfaces.
</pre><pre class="diff" id="added">+ * Verfiy that all Blocks specify classes that implement the advertised interfaces.
</pre><pre class="diff" id="context"> *
</pre><pre class="diff" id="removed">- * @param blocks the ComponentProfile objects for the blocks
</pre><pre class="diff" id="added">+ * @param blocks <span id="addedchars"> </span>the ComponentProfile objects for the blocks
</pre><pre class="diff" id="context"> * @param classLoader the Classloader to load type from
</pre><pre class="diff" id="added">+ *
</pre><pre class="diff" id="context"> * @throws Exception if an error occurs
*/
private void verifyBlocksType( final ComponentProfile[] blocks,
</pre><pre class="diff"><small id="info">@@ -187,16 +200,16 @@
</small></pre><pre class="diff" id="context"> {
for( int i = 0; i < blocks.length; i++ )
{
</pre><pre class="diff" id="removed">- verifyBlockType( blocks[<span id="removedchars"> i </span>], classLoader );
</pre><pre class="diff" id="added">+ verifyBlockType( blocks[<span id="addedchars">i</span>], classLoader );
</pre><pre class="diff" id="context"> }
}
/**
</pre><pre class="diff" id="removed">- * Verfiy that specified Block designate classes that implement the
- * advertised interfaces.
</pre><pre class="diff" id="added">+ * Verfiy that specified Block designate classes that implement the advertised interfaces.
</pre><pre class="diff" id="context"> *
</pre><pre class="diff" id="removed">- * @param block the BlockMetaData object for the blocks
</pre><pre class="diff" id="added">+ * @param block <span id="addedchars"> </span>the BlockMetaData object for the blocks
</pre><pre class="diff" id="context"> * @param classLoader the classloader to load type from
</pre><pre class="diff" id="added">+ *
</pre><pre class="diff" id="context"> * @throws Exception if an error occurs
*/
private void verifyBlockType( final ComponentProfile block,
</pre><pre class="diff"><small id="info">@@ -243,8 +256,9 @@
</small></pre><pre class="diff" id="context"> /**
* Verfiy that all listeners implement BlockListener.
*
</pre><pre class="diff" id="removed">- * @param listeners the BlockListenerMetaData objects for the listeners
</pre><pre class="diff" id="added">+ * @param listeners <span id="addedchars"> </span>the BlockListenerMetaData objects for the listeners
</pre><pre class="diff" id="context"> * @param classLoader the classloader to load type from
</pre><pre class="diff" id="added">+ *
</pre><pre class="diff" id="context"> * @throws Exception if an error occurs
*/
private void verifyListenersType( final ComponentProfile[] listeners,
</pre><pre class="diff"><small id="info">@@ -253,16 +267,16 @@
</small></pre><pre class="diff" id="context"> {
for( int i = 0; i < listeners.length; i++ )
{
</pre><pre class="diff" id="removed">- verifyListenerType( listeners[<span id="removedchars"> i </span>], classLoader );
</pre><pre class="diff" id="added">+ verifyListenerType( listeners[<span id="addedchars">i</span>], classLoader );
</pre><pre class="diff" id="context"> }
}
/**
</pre><pre class="diff" id="removed">- * Verfiy that specified Listener class implements the BlockListener
- * interface.
</pre><pre class="diff" id="added">+ * Verfiy that specified Listener class implements the BlockListener interface.
</pre><pre class="diff" id="context"> *
</pre><pre class="diff" id="removed">- * @param listener the BlockListenerMetaData object for the listener
</pre><pre class="diff" id="added">+ * @param listener <span id="addedchars"> </span>the BlockListenerMetaData object for the listener
</pre><pre class="diff" id="context"> * @param classLoader the classloader to laod type from
</pre><pre class="diff" id="added">+ *
</pre><pre class="diff" id="context"> * @throws Exception if an error occurs
*/
private void verifyListenerType( final ComponentProfile listener,
</pre><pre class="diff"><small id="info">@@ -285,6 +299,7 @@
</small></pre><pre class="diff" id="context"> * Verify that the Sat name specified is valid.
*
* @param name the sar name
</pre><pre class="diff" id="added">+ *
</pre><pre class="diff" id="context"> * @throws Exception if an error occurs
*/
private void verifySarName( final String name )
</pre><pre class="diff"><small id="info">@@ -298,10 +313,10 @@
</small></pre><pre class="diff" id="context"> }
/**
</pre><pre class="diff" id="removed">- * Return true if specified name is valid. Valid names consist of letters,
- * digits or the '-' & '.' characters.
</pre><pre class="diff" id="added">+ * Return true if specified name is valid. Valid names consist of letters, digits or the '-' & '.' characters.
</pre><pre class="diff" id="context"> *
* @param name the name to check
</pre><pre class="diff" id="added">+ *
</pre><pre class="diff" id="context"> * @return true if valid, false otherwise
*/
public boolean isValidName( final String name )
</pre><pre class="diff"><small id="info">@@ -321,12 +336,12 @@
</small></pre><pre class="diff" id="context"> }
/**
</pre><pre class="diff" id="removed">- * Verify that the names of the specified blocks and listeners are unique.
- * It is not valid for the same name to be used in multiple Blocks and or
- * BlockListeners.
</pre><pre class="diff" id="added">+ * Verify that the names of the specified blocks and listeners are unique. It is not valid for the same name to be
+ * used in multiple Blocks and or BlockListeners.
</pre><pre class="diff" id="context"> *
</pre><pre class="diff" id="removed">- * @param blocks the Blocks
</pre><pre class="diff" id="added">+ * @param blocks <span id="addedchars"> </span>the Blocks
</pre><pre class="diff" id="context"> * @param listeners the listeners
</pre><pre class="diff" id="added">+ *
</pre><pre class="diff" id="context"> * @throws Exception if an error occurs
*/
private void checkNamesUnique( final ComponentProfile[] blocks,
</pre><pre class="diff"><small id="info">@@ -335,28 +350,27 @@
</small></pre><pre class="diff" id="context"> {
for( int i = 0; i < blocks.length; i++ )
{
</pre><pre class="diff" id="removed">- final String name = blocks[<span id="removedchars"> i </span>].getTemplate().getName();
</pre><pre class="diff" id="added">+ final String name = blocks[<span id="addedchars">i</span>].getTemplate().getName();
</pre><pre class="diff" id="context"> checkNameUnique( name, blocks, listeners, i, -1 );
}
for( int i = 0; i < listeners.length; i++ )
{
</pre><pre class="diff" id="removed">- final String name = listeners[<span id="removedchars"> i </span>].getTemplate().getName();
</pre><pre class="diff" id="added">+ final String name = listeners[<span id="addedchars">i</span>].getTemplate().getName();
</pre><pre class="diff" id="context"> checkNameUnique( name, blocks, listeners, -1, i );
}
}
/**
</pre><pre class="diff" id="removed">- * Verify that the specified name is unique among specified blocks and
- * listeners except for those indexes specified.
</pre><pre class="diff" id="added">+ * Verify that the specified name is unique among specified blocks and listeners except for those indexes
+ * specified.
+ *
+ * @param name the name to check for
+ * @param blocks the Blocks
+ * @param listeners the listeners
+ * @param blockIndex the index of block that is allowed to match in name (or -1 if name designates a listener)
+ * @param listenerIndex the index of listener that is allowed to match in name (or -1 if name designates a block)
</pre><pre class="diff" id="context"> *
</pre><pre class="diff" id="removed">- * @param name the name to check for
- * @param blocks the Blocks
- * @param listeners the listeners
- * @param blockIndex the index of block that is allowed to match in name (or
- * -1 if name designates a listener)
- * @param listenerIndex the index of listener that is allowed to match in
- * name (or -1 if name designates a block)
</pre><pre class="diff" id="context"> * @throws Exception if an error occurs
*/
private void checkNameUnique( final String name,
</pre><pre class="diff"><small id="info">@@ -369,7 +383,7 @@
</small></pre><pre class="diff" id="context"> //Verify no blocks have the same name
for( int i = 0; i < blocks.length; i++ )
{
</pre><pre class="diff" id="removed">- final String other = blocks[<span id="removedchars"> i </span>].getTemplate().getName();
</pre><pre class="diff" id="added">+ final String other = blocks[<span id="addedchars">i</span>].getTemplate().getName();
</pre><pre class="diff" id="context"> if( blockIndex != i && name.equals( other ) )
{
final String message = REZ.format( "duplicate-name", name );
</pre><pre class="diff"><small id="info">@@ -380,7 +394,7 @@
</small></pre><pre class="diff" id="context"> //Verify no listeners have the same name
for( int i = 0; i < listeners.length; i++ )
{
</pre><pre class="diff" id="removed">- final String other = listeners[<span id="removedchars"> i </span>].getTemplate().getName();
</pre><pre class="diff" id="added">+ final String other = listeners[<span id="addedchars">i</span>].getTemplate().getName();
</pre><pre class="diff" id="context"> if( listenerIndex != i && name.equals( other ) )
{
final String message = REZ.format( "duplicate-name", name );
</pre><pre class="diff"><small id="info">@@ -390,10 +404,10 @@
</small></pre><pre class="diff" id="context"> }
/**
</pre><pre class="diff" id="removed">- * Load class with specified name and throw a IllegalStateException if
- * unable to load class.
</pre><pre class="diff" id="added">+ * Load class with specified name and throw a IllegalStateException if unable to load class.
</pre><pre class="diff" id="context"> *
* @param classname the name of class to load
</pre><pre class="diff" id="added">+ *
</pre><pre class="diff" id="context"> * @return the Class object
*/
private static Class getClass( final String classname )
</pre></div>
<hr /><a name="file14" /><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/engine">engine</a>/<a href="http://xstream.cvs.codehaus.org/jcontainer/loom/engine/src">src</a>/<a href="http://xstream.cvs.codehaus.org/jcontainer/loom/engine/src/java">java</a>/<a href="http://xstream.cvs.codehaus.org/jcontainer/loom/engine/src/java/org">org</a>/<a href="http://xstream.cvs.codehaus.org/jcontainer/loom/engine/src/java/org/jcontainer">jcontainer</a>/<a href="http://xstream.cvs.codehaus.org/jcontainer/loom/engine/src/java/org/jcontainer/loom">loom</a>/<a href="http://xstream.cvs.codehaus.org/jcontainer/loom/engine/src/java/org/jcontainer/loom/components">components</a>/<a href="http://xstream.cvs.codehaus.org/jcontainer/loom/engine/src/java/org/jcont
ainer/loom/components/util">util</a><br /></span>
<div class="fileheader" id="added"><big><b>blockinfo_1_0.dtd</b></big> <small id="info">added at <a href="http://xstream.cvs.codehaus.org/jcontainer/loom/engine/src/java/org/jcontainer/loom/components/util/blockinfo_1_0.dtd?rev=1.1&content-type=text/vnd.viewcvs-markup">1.1</a></small></div>
<pre class="diff"><small id="info">diff -N blockinfo_1_0.dtd
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ blockinfo_1_0.dtd 20 Feb 2004 03:49:49 -0000 1.1
@@ -0,0 +1,95 @@
</small></pre><pre class="diff" id="added">+<!--
+
+ This is the DTD defining the BlockInfo 1.0
+ descriptor (XML) file format/syntax.
+
+ Author: Peter Donald <peter at apache.org>
+
+ A BlockInfo is an XML file used to describe Blocks and located side-by-side with
+ the Block .class file. It describes the services the Block requires to operate,
+ the services the Block is capable of offerring other Blocks and other support
+ meta data.
+
+ Copyright (C) The JContainer Group. All rights reserved.
+
+ This software is published under the terms of the JContainer
+ Software License version 1.1, a copy of which has been included
+ with this distribution in the LICENSE.txt file.
+
+ This product includes software developed by the
+ Apache Software Foundation (http://www.apache.org/).
+
+ -->
+
+<!--
+The blockinfo is the document root, it defines:
+
+block the specifc details about this block
+services the services offered by this block
+dependencies the services that this block require to operate
+-->
+<!ELEMENT blockinfo (block?, services?, management-access-points?, dependencies?)>
+<!ATTLIST blockinfo id ID #IMPLIED>
+
+<!--
+The block element describes the block, it defines:
+
+name the human readable name of block type. Must be a string
+ containing alphanumeric characters, '.', '_' and starting
+ with a letter.
+version the version of the block in (in the format #.#.#, #.# or # where
+ # is a integer
+schema-type string representing the type of schema information available
+ to validate block configuration
+-->
+<!ELEMENT block (name?,version?,schema-type?)>
+<!ELEMENT name (#PCDATA) >
+<!ELEMENT version (#PCDATA) >
+<!ELEMENT schema-type (#PCDATA) >
+
+<!--
+The service element describes a service that the block
+can provide to other blocks, or this block depends upon.
+It defines:
+
+name the name of the service. This must be equal to the class name of the
+ interface that defines the service.
+version the version of the block in (in the format #.#.#, #.# or # where
+ # is a integer
+-->
+<!ELEMENT service EMPTY >
+<!ATTLIST service
+name CDATA #REQUIRED
+version CDATA #IMPLIED
+>
+
+<!--
+The service dependency describes a service that the block
+requires. It defines:
+
+role the role of the service. This is the value that is used to lookup the
+ service in the ComponentManager. If not provided it defaults to the
+ value specified in the name attribute of service element
+service the service that is required
+-->
+<!ELEMENT dependency (role?,service) >
+<!ELEMENT role (#PCDATA) >
+
+<!--
+The services element contains a list of services that this Block supports.
+It contains service elements.
+-->
+<!ELEMENT services (service*)>
+
+<!--
+The services element contains a list of services that this
+Block exports to the Management system. It contains service
+elements.
+-->
+<!ELEMENT management-access-points (service*)>
+
+<!--
+The dependencies element contains a list of services that this Block requires.
+It contains dependency elements.
+-->
+<!ELEMENT dependencies (dependency*)>
</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/engine">engine</a>/<a href="http://xstream.cvs.codehaus.org/jcontainer/loom/engine/src">src</a>/<a href="http://xstream.cvs.codehaus.org/jcontainer/loom/engine/src/test">test</a>/<a href="http://xstream.cvs.codehaus.org/jcontainer/loom/engine/src/test/org">org</a>/<a href="http://xstream.cvs.codehaus.org/jcontainer/loom/engine/src/test/org/jcontainer">jcontainer</a>/<a href="http://xstream.cvs.codehaus.org/jcontainer/loom/engine/src/test/org/jcontainer/loom">loom</a>/<a href="http://xstream.cvs.codehaus.org/jcontainer/loom/engine/src/test/org/jcontainer/loom/components">components</a>/<a href="http://xstream.cvs.codehaus.org/jcontainer/loom/engine/src/test/org/jcontainer/loom/
components/assembler">assembler</a><br /></span>
<div class="fileheader"><big><b>AssemblerTestCase.java</b></big> <small id="info"><a href="http://xstream.cvs.codehaus.org/jcontainer/loom/engine/src/test/org/jcontainer/loom/components/assembler/AssemblerTestCase.java?rev=1.15&content-type=text/vnd.viewcvs-markup">1.15</a> <a href="http://xstream.cvs.codehaus.org/jcontainer/loom/engine/src/test/org/jcontainer/loom/components/assembler/AssemblerTestCase.java.diff?r1=1.15&r2=1.16">-></a> <a href="http://xstream.cvs.codehaus.org/jcontainer/loom/engine/src/test/org/jcontainer/loom/components/assembler/AssemblerTestCase.java?rev=1.16&content-type=text/vnd.viewcvs-markup">1.16</a></small></div>
<pre class="diff"><small id="info">diff -u -r1.15 -r1.16
--- AssemblerTestCase.java 29 Nov 2003 13:44:30 -0000 1.15
+++ AssemblerTestCase.java 20 Feb 2004 03:49:49 -0000 1.16
@@ -10,6 +10,7 @@
</small></pre><pre class="diff" id="context"> import java.net.URL;
import java.util.HashMap;
import java.util.Map;
</pre><pre class="diff" id="added">+
</pre><pre class="diff" id="context"> import junit.framework.TestCase;
import org.jcontainer.dna.Configuration;
import org.jcontainer.dna.ConfigurationException;
</pre><pre class="diff"><small id="info">@@ -34,7 +35,7 @@
</small></pre><pre class="diff" id="context"> *
* @author Peter Donald
* @author <a href="mailto:[email protected]">Peter Royal</a>
</pre><pre class="diff" id="removed">- * @version $Revision: 1.15 $ $Date: 2003/11/29 13:44:30 $
</pre><pre class="diff" id="added">+ * @version $Revision: 1.16 $ $Date: 2004/02/20 03:49:49 $
</pre><pre class="diff" id="context"> */
public class AssemblerTestCase
extends TestCase
</pre><pre class="diff"><small id="info">@@ -48,8 +49,8 @@
</small></pre><pre class="diff" id="context"> getComponents();
assertEquals( "Block Count", 2, blocks.length );
</pre><pre class="diff" id="removed">- final ComponentProfile block1 = blocks[ 0 ];
- final ComponentProfile block2 = blocks[ 1 ];
</pre><pre class="diff" id="added">+ final ComponentProfile block1 = blocks[0];
+ final ComponentProfile block2 = blocks[1];
</pre><pre class="diff" id="context"> final DependencyDirective[] dependencies1 = block1.getTemplate()
.getDependencies();
final DependencyDirective[] dependencies2 = block2.getTemplate()
</pre><pre class="diff"><small id="info">@@ -63,9 +64,9 @@
</small></pre><pre class="diff" id="context"> 1, dependencies1.length );
assertEquals( "Block1 dep1 name",
"c2",
</pre><pre class="diff" id="removed">- dependencies1[<span id="removedchars"> 0 </span>].getProviderName() );
</pre><pre class="diff" id="added">+ dependencies1[<span id="addedchars">0</span>].getProviderName() );
</pre><pre class="diff" id="context"> assertEquals( "Block1 dep1 role",
</pre><pre class="diff" id="removed">- Service1.class.getName(), dependencies1[<span id="removedchars"> 0 </span>].getKey() );
</pre><pre class="diff" id="added">+ Service1.class.getName(), dependencies1[<span id="addedchars">0</span>].getKey() );
</pre><pre class="diff" id="context"> assertTrue( "Block1 getBlockInfo non null",
null != block1.getInfo() );
assertEquals( "Block1 isDisableProxy",
</pre><pre class="diff"><small id="info">@@ -85,10 +86,9 @@
</small></pre><pre class="diff" id="context"> isProxyDisabled( block2 ) );
final ComponentProfile[] listeners =
</pre><pre class="diff" id="removed">- partitionProfile.getPartition(
- ContainerConstants.LISTENER_PARTITION ).
</pre><pre class="diff" id="added">+ partitionProfile.getPartition( ContainerConstants.LISTENER_PARTITION ).
</pre><pre class="diff" id="context"> getComponents();
</pre><pre class="diff" id="removed">- final ComponentProfile listener = listeners[<span id="removedchars"> 0 </span>];
</pre><pre class="diff" id="added">+ final ComponentProfile listener = listeners[<span id="addedchars">0</span>];
</pre><pre class="diff" id="context">
assertEquals( "Listener Count", 1, listeners.length );
assertEquals( "Listener1 getImplementationKey",
</pre><pre class="diff"><small id="info">@@ -113,10 +113,10 @@
</small></pre><pre class="diff" id="context"> .getComponents();
assertEquals( "Block Count", 4, blocks.length );
</pre><pre class="diff" id="removed">- final ComponentProfile block1 = blocks[ 0 ];
- final ComponentProfile block2 = blocks[ 1 ];
- final ComponentProfile block3 = blocks[ 2 ];
- final ComponentProfile block4 = blocks[ 3 ];
</pre><pre class="diff" id="added">+ final ComponentProfile block1 = blocks[0];
+ final ComponentProfile block2 = blocks[1];
+ final ComponentProfile block3 = blocks[2];
+ final ComponentProfile block4 = blocks[3];
</pre><pre class="diff" id="context"> final DependencyDirective[] dependencies1 = block1.getTemplate()
.getDependencies();
final DependencyDirective[] dependencies2 = block2.getTemplate()
</pre><pre class="diff"><small id="info">@@ -174,9 +174,9 @@
</small></pre><pre class="diff" id="context"> assertEquals( "Block4 getName", "c3", block4.getTemplate().getName() );
assertEquals( "Block4 getDependencies count",
3, dependencies4.length );
</pre><pre class="diff" id="removed">- final DependencyDirective dependency1 = dependencies4[ 0 ];
- final DependencyDirective dependency2 = dependencies4[ 1 ];
- final DependencyDirective dependency3 = dependencies4[ 2 ];
</pre><pre class="diff" id="added">+ final DependencyDirective dependency1 = dependencies4[0];
+ final DependencyDirective dependency2 = dependencies4[1];
+ final DependencyDirective dependency3 = dependencies4[2];
</pre><pre class="diff" id="context"> assertEquals( "Block4 dep1 name",
"c2a",
dependency1.getProviderName() );
</pre><pre class="diff"><small id="info">@@ -202,28 +202,27 @@
</small></pre><pre class="diff" id="context"> public void testBuildDependencies()
throws Exception
{
</pre><pre class="diff" id="removed">- final DefaultConfiguration[] provides = new DefaultConfiguration[<span id="removedchars"> 2 </span>];
</pre><pre class="diff" id="added">+ final DefaultConfiguration[] provides = new DefaultConfiguration[<span id="addedchars">2</span>];
</pre><pre class="diff" id="context"> final String name0 = "Cheese";
final String role0 = "market.Cheddar";
final String name1 = "Bleu";
final String role1 = "market.blue";
</pre><pre class="diff" id="removed">- provides[ 0 ] = new DefaultConfiguration( "provide", "", "" );
- provides[ 0 ].setAttribute( "name", name0 );
- provides[ 0 ].setAttribute( "role", role0 );
- provides[ 1 ] = new DefaultConfiguration( "provide", "", "" );
- provides[ 1 ].setAttribute( "name", name1 );
- provides[ 1 ].setAttribute( "role", role1 );
</pre><pre class="diff" id="added">+ provides[0] = new DefaultConfiguration( "provide", "", "" );
+ provides[0].setAttribute( "name", name0 );
+ provides[0].setAttribute( "role", role0 );
+ provides[1] = new DefaultConfiguration( "provide", "", "" );
+ provides[1].setAttribute( "name", name1 );
+ provides[1].setAttribute( "role", role1 );
</pre><pre class="diff" id="context">
final Assembler assembler = new Assembler();
</pre><pre class="diff" id="removed">- final DependencyDirective[] directives = assembler.buildDependencies(
- provides );
</pre><pre class="diff" id="added">+ final DependencyDirective[] directives = assembler.buildDependencies( provides );
</pre><pre class="diff" id="context">
assertEquals( provides.length, directives.length );
</pre><pre class="diff" id="removed">- assertEquals( name0, directives[ 0 ].getProviderName() );
- assertEquals( name1, directives[ 1 ].getProviderName() );
- assertEquals( role0, directives[ 0 ].getKey() );
- assertEquals( role1, directives[ 1 ].getKey() );
</pre><pre class="diff" id="added">+ assertEquals( name0, directives[0].getProviderName() );
+ assertEquals( name1, directives[1].getProviderName() );
+ assertEquals( role0, directives[0].getKey() );
+ assertEquals( role1, directives[1].getKey() );
</pre><pre class="diff" id="context"> }
public void testBuildDependency()
</pre><pre class="diff"><small id="info">@@ -233,8 +232,7 @@
</small></pre><pre class="diff" id="context"> final String alias = name;
final String role = "com.biz.Service";
final Assembler assembler = new Assembler();
</pre><pre class="diff" id="removed">- final DefaultConfiguration provide = new DefaultConfiguration(
- "provide", "", "" );
</pre><pre class="diff" id="added">+ final DefaultConfiguration provide = new DefaultConfiguration( "provide", "", "" );
</pre><pre class="diff" id="context"> provide.setAttribute( "name", name );
provide.setAttribute( "role", role );
final DependencyDirective directive =
</pre><pre class="diff"><small id="info">@@ -251,8 +249,7 @@
</small></pre><pre class="diff" id="context"> final String alias = "Blee";
final String role = "com.biz.Service";
final Assembler assembler = new Assembler();
</pre><pre class="diff" id="removed">- final DefaultConfiguration provide = new DefaultConfiguration(
- "provide", "", "" );
</pre><pre class="diff" id="added">+ final DefaultConfiguration provide = new DefaultConfiguration( "provide", "", "" );
</pre><pre class="diff" id="context"> provide.setAttribute( "name", name );
provide.setAttribute( "role", role );
provide.setAttribute( "alias", alias );
</pre><pre class="diff"><small id="info">@@ -267,8 +264,7 @@
</small></pre><pre class="diff" id="context"> throws Exception
{
final Assembler assembler = new Assembler();
</pre><pre class="diff" id="removed">- final DefaultConfiguration provide = new DefaultConfiguration(
- "provide", "", "" );
</pre><pre class="diff" id="added">+ final DefaultConfiguration provide = new DefaultConfiguration( "provide", "", "" );
</pre><pre class="diff" id="context"> provide.setAttribute( "role", "com.biz.Service" );
try
{
</pre><pre class="diff"><small id="info">@@ -285,8 +281,7 @@
</small></pre><pre class="diff" id="context"> throws Exception
{
final Assembler assembler = new Assembler();
</pre><pre class="diff" id="removed">- final DefaultConfiguration provide = new DefaultConfiguration(
- "provide", "", "" );
</pre><pre class="diff" id="added">+ final DefaultConfiguration provide = new DefaultConfiguration( "provide", "", "" );
</pre><pre class="diff" id="context"> provide.setAttribute( "name", "MyService" );
try
{
</pre><pre class="diff"><small id="info">@@ -305,11 +300,11 @@
</small></pre><pre class="diff" id="context"> final PhoenixProfileBuilder assembler = new PhoenixProfileBuilder();
final URL resource = getClass().getResource( config );
assertNotNull( "Config resource: " + config, resource );
</pre><pre class="diff" id="added">+ final ConsoleLogger logger = new ConsoleLogger();
</pre><pre class="diff" id="context"> final Configuration assembly =
</pre><pre class="diff" id="removed">- ConfigurationBuilder.build(
- new InputSource( resource.toExternalForm() ),
- ConfigurationBuilder.ASSEMBLY_SCHEMA,
- new ConsoleLogger() );
</pre><pre class="diff" id="added">+ ConfigurationBuilder.build( new InputSource( resource.toExternalForm() ),
+ ConfigurationBuilder.ASSEMBLY_SCHEMA,
+ logger );
</pre><pre class="diff" id="context"> final Map parameters = new HashMap();
parameters.put( ContainerConstants.ASSEMBLY_NAME, "test" );
parameters.put( ContainerConstants.ASSEMBLY_DESCRIPTOR, assembly );
</pre><pre class="diff"><small id="info">@@ -317,14 +312,16 @@
</small></pre><pre class="diff" id="context"> new DefaultConfiguration( "config", "", "" ) );
parameters.put( ContainerConstants.ASSEMBLY_CLASSLOADER,
getClass().getClassLoader() );
</pre><pre class="diff" id="added">+
+ assembler.enableLogging( logger );
+
</pre><pre class="diff" id="context"> return assembler.buildProfile( parameters );
}
public void testMalformedBlockListener()
throws Exception
{
</pre><pre class="diff" id="removed">- final DefaultConfiguration listener = new DefaultConfiguration(
- "listner", "", "" );
</pre><pre class="diff" id="added">+ final DefaultConfiguration listener = new DefaultConfiguration( "listner", "", "" );
</pre><pre class="diff" id="context"> final DefaultConfiguration config = new DefaultConfiguration( "config",
"",
"" );
</pre></div>
<hr /><a name="file16" /><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/engine">engine</a><br /></span>
<div class="fileheader"><big><b>project.xml</b></big> <small id="info"><a href="http://xstream.cvs.codehaus.org/jcontainer/loom/engine/project.xml?rev=1.38&content-type=text/vnd.viewcvs-markup">1.38</a> <a href="http://xstream.cvs.codehaus.org/jcontainer/loom/engine/project.xml.diff?r1=1.38&r2=1.39">-></a> <a href="http://xstream.cvs.codehaus.org/jcontainer/loom/engine/project.xml?rev=1.39&content-type=text/vnd.viewcvs-markup">1.39</a></small></div>
<pre class="diff"><small id="info">diff -u -r1.38 -r1.39
--- project.xml 15 Feb 2004 22:01:10 -0000 1.38
+++ project.xml 20 Feb 2004 03:49:49 -0000 1.39
@@ -18,7 +18,7 @@
</small></pre><pre class="diff" id="context"> <dependency>
<groupId>spice</groupId>
<artifactId>spice-metaclass</artifactId>
</pre><pre class="diff" id="removed">- <version>1.0-rc<span id="removedchars">2</span></version>
</pre><pre class="diff" id="added">+ <version>1.0-rc<span id="addedchars">3-dev</span></version>
</pre><pre class="diff" id="context"> </dependency>
<dependency>
<groupId>spice</groupId>
</pre><pre class="diff"><small id="info">@@ -46,9 +46,8 @@
</small></pre><pre class="diff" id="context"> <version>1.2.2</version>
</dependency>
<dependency>
</pre><pre class="diff" id="removed">- <groupId>avalon</groupId>
- <artifactId>avalon-framework</artifactId>
- <version>4.1.4</version>
</pre><pre class="diff" id="added">+ <id>avalon-framework</id>
+ <version>4.1.5</version>
</pre><pre class="diff" id="context"> </dependency>
<dependency>
<groupId>phoenix</groupId>
</pre><pre class="diff"><small id="info">@@ -128,6 +127,11 @@
</small></pre><pre class="diff" id="context"> <dependency>
<id>oro</id>
<version>2.0.7</version>
</pre><pre class="diff" id="added">+ </dependency>
+ <dependency><!-- for spice-metaclass -->
+ <groupId>asm</groupId>
+ <artifactId>asm</artifactId>
+ <version>1.4</version>
</pre><pre class="diff" id="context"> </dependency>
<dependency><!-- for spice-configkit -->
<id>isorelax</id>
</pre></div>
<center><small><a href="http://www.badgers-in-foil.co.uk/projects/cvsspam/" title="commit -> email">CVSspam</a> 0.2.8</small></center>
</body></html>