[CVS spice] Added configuration attributes and children.
mauro-yCVjj/[email protected] 20 Jun 2004 14:03:58 -0000
| Newsgroups | gmane.comp.java.spice.cvs |
|---|---|
| Message-ID | <[email protected]> |
<html>
<head>
<style><!--
body {background-color:#ffffff;}
.file {border:1px solid #eeeeee;margin-top:1em;margin-bottom:1em;}
.pathname {font-family:monospace; float:right;}
.fileheader {margin-bottom:.5em;}
.diff {margin:0;}
.tasklist {padding:4px;border:1px dashed #000000;margin-top:1em;}
.tasklist ul {margin-top:0;margin-bottom:0;}
tr.alt {background-color:#eeeeee}
#added {background-color:#ddffdd;}
#addedchars {background-color:#99ff99;font-weight:bolder;}
tr.alt #added {background-color:#ccf7cc;}
#removed {background-color:#ffdddd;}
#removedchars {background-color:#ff9999;font-weight:bolder;}
tr.alt #removed {background-color:#f7cccc;}
#info {color:#888888;}
#context {background-color:#eeeeee;}
td {padding-left:.3em;padding-right:.3em;}
tr.head {border-bottom-width:1px;border-bottom-style:solid;}
tr.head td {padding:0;padding-top:.2em;}
.task {background-color:#ffff00;}
.comment {padding:4px;border:1px dashed #000000;background-color:#ffffdd}
.error {color:red;}
hr {border-width:0px;height:2px;background:black;}
--></style>
</head>
<body>
<table cellspacing="0" cellpadding="0" border="0" rules="cols">
<tr class="head"><td colspan="4">Commit in <b><tt>spice/components/alchemist/src/java/org/codehaus/spice/alchemist/configuration</tt></b><span id="info"> on MAIN</span></td></tr>
<tr><td><tt><a href="#file1">ConfigurationAlchemist.java</a></tt></td><td align="right" id="added">+45</td><td align="right" id="removed">-4</td><td nowrap="nowrap" align="center">1.5 -> 1.6</td></tr>
</table>
<pre class="comment">
Added configuration attributes and children.
</pre>
<hr /><a name="file1" /><div class="file">
<span class="pathname">spice/components/alchemist/src/java/org/codehaus/spice/alchemist/configuration<br /></span>
<div class="fileheader"><big><b>ConfigurationAlchemist.java</b></big> <small id="info">1.5 -> 1.6</small></div>
<pre class="diff"><small id="info">diff -u -r1.5 -r1.6
--- ConfigurationAlchemist.java 20 Jun 2004 13:37:27 -0000 1.5
+++ ConfigurationAlchemist.java 20 Jun 2004 14:03:58 -0000 1.6
@@ -15,7 +15,8 @@
</small></pre><pre class="diff" id="context"> * Utility class containing methods to transform Configuration objects.
*
* @author Mauro Talevi
</pre><pre class="diff" id="removed">- * @version $Revision: 1.5 $ $Date: 2004/06/20 13:37:27 $
</pre><pre class="diff" id="added">+ * @author Peter Donald
+ * @version $Revision: 1.6 $ $Date: 2004/06/20 14:03:58 $
</pre><pre class="diff" id="context"> */
public class ConfigurationAlchemist
{
</pre><pre class="diff"><small id="info">@@ -30,7 +31,27 @@
</small></pre><pre class="diff" id="context"> if ( null == configuration ) {
throw new NullPointerException( "configuration" );
}
</pre><pre class="diff" id="removed">- return new DefaultConfiguration( configuration.getName(), configuration.getLocation(), "" );
</pre><pre class="diff" id="added">+ final DefaultConfiguration result = new DefaultConfiguration(
+ configuration.getName(), configuration.getLocation(), "");
+ final String[] names = configuration.getAttributeNames();
+ for ( int i = 0; i < names.length; i++ )
+ {
+ final String name = names[i];
+ final String value = configuration.getAttribute( name, null );
+ result.setAttribute( name, value );
+ }
+ final org.apache.avalon.framework.configuration.Configuration[] children = configuration.getChildren();
+ for ( int i = 0; i < children.length; i++ )
+ {
+ final Configuration child = toDNAConfiguration( children[i] );
+ result.addChild( child );
+ }
+ final String value = configuration.getValue( null );
+ if ( null != value )
+ {
+ result.setValue( value );
+ }
+ return result;
</pre><pre class="diff" id="context"> }
/**
</pre><pre class="diff"><small id="info">@@ -44,7 +65,27 @@
</small></pre><pre class="diff" id="context"> if ( null == configuration ) {
throw new NullPointerException( "configuration" );
}
</pre><pre class="diff" id="removed">- return new org.apache.avalon.framework.configuration.DefaultConfiguration( configuration.getName(), configuration.getLocation() );
</pre><pre class="diff" id="added">+ final org.apache.avalon.framework.configuration.DefaultConfiguration result = new org.apache.avalon.framework.configuration.DefaultConfiguration(
+ configuration.getName(), configuration.getLocation() );
+ final String[] names = configuration.getAttributeNames();
+ for ( int i = 0; i < names.length; i++ )
+ {
+ final String name = names[i];
+ final String value = configuration.getAttribute( name, null );
+ result.setAttribute( name, value );
+ }
+ final Configuration[] children = configuration.getChildren();
+ for ( int i = 0; i < children.length; i++ )
+ {
+ final org.apache.avalon.framework.configuration.Configuration child = toAvalonConfiguration( children[i] );
+ result.addChild( child );
+ }
+ final String value = configuration.getValue( null );
+ if ( null != value )
+ {
+ result.setValue( value );
+ }
+ return result;
</pre><pre class="diff" id="context"> }
/**
</pre><pre class="diff"><small id="info">@@ -52,7 +93,7 @@
</small></pre><pre class="diff" id="context"> *
* @param object the Object to check
* @return A boolean <code>true</code> if the object is an instance of
</pre><pre class="diff" id="removed">- * <span id="removedchars"> </span> {@link org.apache.avalon.framework.configuration.Configurable}
</pre><pre class="diff" id="added">+ * <span id="addedchars"> </span> {@link org.apache.avalon.framework.configuration.Configurable}
</pre><pre class="diff" id="context"> */
public static boolean isAvalonConfigurable( final Object object ){
if ( object instanceof org.apache.avalon.framework.configuration.Configurable )
</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>