avalon-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Leo Simons" <m...@leosimons.com>
Subject RE: CascadingConfiguration --> framework ?
Date Thu, 28 Feb 2002 06:37:53 GMT
> The class is basically an implementation of Configuration that 
> takes a primary and default configuration as constructor arguments.  
> Resolution of attribute values and child elements are resolved 
> against the primary configuration - and if that fails, the 
> implementation attempt to resolve the request against the 
> secondary default configuration (which could be another 
> CascadingConfiguration).  Resolution of children for a particular 
> "name" result in the aggregation of the primary and default 
> configuration child elements.
> 
> Thoughts ?

Why not make CascadingConfiguration the "primary" as well?

ie

CascadingConfiguration
{
	CascadingConfiguration( Configuration parent ) {}

	String getAtrribute( String attributeName )
	{
		if( hasAttribute(attributeName) )
			// return local;
		else
		{
			if( parent != null )
				return parent.getAttribute ( String attributeName );
			else
				return null;
		}
	}
}

or something along those lines. This way, you can even just add
the extra constructor to DefaultConfiguration and modify its
behaviour so that it cascades if a parent is provided. Seems
more intuitive to me.

grz,

- LSD

--
To unsubscribe, e-mail:   <mailto:avalon-dev-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:avalon-dev-help@jakarta.apache.org>


Mime
View raw message