You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@avalon.apache.org by do...@apache.org on 2002/11/13 02:03:41 UTC
cvs commit: jakarta-avalon-excalibur/configuration/src/java/org/apache/excalibur/configuration ConfigurationUtil.java
donaldp 2002/11/12 17:03:41
Modified: configuration/src/java/org/apache/excalibur/configuration
ConfigurationUtil.java
Log:
Simplify branch method
Revision Changes Path
1.10 +21 -44 jakarta-avalon-excalibur/configuration/src/java/org/apache/excalibur/configuration/ConfigurationUtil.java
Index: ConfigurationUtil.java
===================================================================
RCS file: /home/cvs/jakarta-avalon-excalibur/configuration/src/java/org/apache/excalibur/configuration/ConfigurationUtil.java,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -r1.9 -r1.10
--- ConfigurationUtil.java 21 Oct 2002 15:43:38 -0000 1.9
+++ ConfigurationUtil.java 13 Nov 2002 01:03:41 -0000 1.10
@@ -1,14 +1,14 @@
-/* ====================================================================
- * The Apache Software License, Version 1.1
- *
- * Copyright (c) 1997-2002 The Apache Software Foundation. All rights
- * reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * 1. Redistributions of source code must retain the above copyright
+/* ====================================================================
+ * The Apache Software License, Version 1.1
+ *
+ * Copyright (c) 1997-2002 The Apache Software Foundation. All rights
+ * reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright
@@ -20,13 +20,13 @@
* if any, must include the following acknowledgment:
* "This product includes software developed by the
* Apache Software Foundation (http://www.apache.org/)."
- * Alternately, this acknowledgment may appear in the software
- * itself, if and wherever such third-party acknowledgments
+ * Alternately, this acknowledgment may appear in the software
+ * itself, if and wherever such third-party acknowledgments
* normally appear.
*
- * 4. The names "Jakarta", "Avalon", and "Apache Software Foundation"
+ * 4. The names "Jakarta", "Avalon", and "Apache Software Foundation"
* must not be used to endorse or promote products derived from this
- * software without prior written permission. For written
+ * software without prior written permission. For written
* permission, please contact apache@apache.org.
*
* 5. Products derived from this software may not be called "Apache",
@@ -49,9 +49,9 @@
*
* This software consists of voluntary contributions made by many
* individuals on behalf of the Apache Software Foundation. For more
- * information on the Apache Software Foundation, please see
+ * information on the Apache Software Foundation, please see
* <http://www.apache.org/>.
- */
+ */
package org.apache.excalibur.configuration;
@@ -234,33 +234,10 @@
*/
public static Configuration branch( final Configuration config, final String name )
{
- final DefaultConfiguration c = createNew( config, name );
- final String[] attributes = config.getAttributeNames();
- final Configuration[] kids = config.getChildren();
-
- c.setValue( config.getValue( null ) );
-
- for( int i = 0; i < attributes.length; i++ )
- {
- try
- {
- c.setAttribute( attributes[ i ], config.getAttribute( attributes[ i ] ) );
- }
- catch( ConfigurationException e )
- {
- throw new CascadingRuntimeException( "Configuration is missing advertised "
- + "attribute", e );
- }
- }
-
- for( int i = 0; i < kids.length; i++ )
- {
- c.addChild( kids[ i ] );
- }
-
- c.makeReadOnly();
-
- return c;
+ final DefaultConfiguration branched = new DefaultConfiguration( name, config.getLocation() );
+ branched.addAll( config );
+ branched.makeReadOnly();
+ return branched;
}
private static DefaultConfiguration createNew( final Configuration config, final String name )
--
To unsubscribe, e-mail: <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>