> -----Original Message-----
> From: Joe Germuska [mailto:[EMAIL PROTECTED]
> Sent: Wednesday, March 23, 2005 12:41 PM
> To: Hubert Rabago; Struts Developers List
> Subject: Re: Adventures with configuration inheritance
>
> I disagree with this interpretation. For what it's worth, my
> assumption would be that any named ForwardConfig in an extended
> ActionConfig would override, not extend an identically named
> ForwardConfig in the parent ActionConfig.
<snip/>
>
> By my interpretation, the /someOtherPath forward named "subForward"
> would have no relationship to "/somePath"'s forward named
> "subForward".
I'm thinking of applying the same logic for form properties. This
would make it more approachable, and reduce the areas where the user
can't use default values because a base config has specified a value
for them. Going back to the earliest example I used:
<!-- the form I extend -->
<form-bean name="baseForm"
type="o.a.s.a.DynaActionForm">
<form-property name="firstName" type="java.lang.String"/>
<form-property name="lastName" type="java.lang.String"/>
<form-property name="score" type="java.lang.String"/>
</form-bean>
<form-bean name="subForm"
extends="baseForm">
<form-property name="score" type="java.lang.String" initial="100"/>
<!-- "score" used to look like this: [form-property name="score"
initial="100"/] -->
<form-property name="attempts" type="java.lang.String"/>
</form-bean>
subForm will end up with:
<form-bean name="subForm"
type="o.a.s.a.DynaActionForm">
<form-property name="firstName" type="java.lang.String"/>
<form-property name="lastName" type="java.lang.String"/>
<form-property name="score" type="java.lang.String" initial="100"/>
<form-property name="attempts" type="java.lang.String"/>
</form-bean>
"subForm" can no longer just provide the minimum required when
overriding/extending properties. It either specifies the form
property fully, or accepts what the base config provides it. This
would make it consistent with how <action>s deal with <forward>s and
<exception>s.
Comments appreciated.
Hubert
On Tue, 29 Mar 2005 21:16:20 -0600, Hubert Rabago <[EMAIL PROTECTED]> wrote:
> Updated diffs, if anyone is interested, are in
> http://www.rabago.net/struts/configinheritance/ .
> If anybody gets a chance, please take a look, ask questions, make
> suggestions or comments. If I don't hear from anybody in a couple of
> days, I will go ahead and commit these changes.
>
> Known limitation:
>
> A "sub" config cannot override a "base" config's property in order to
> revert to a default value.
>
> In the code that inherits configuration, I check if a property has
> been set or not. If it hasn't been set, I inherit the value from the
> base config. The way I check is by comparing the value against the
> known default:
>
> if (getType() == null) {
> setType(config.getType());
> }
>
> This means that as long as the base config provides a value for a
> property different from the default, the sub config cannot use the
> default value for it. For another example, if a forward named
> "success" is extending another forward named "home", and "home" has
> redirect="true", "success" cannot be defined such that
> redirect="false", due to code like this:
>
> if (!getRedirect()) {
> setRedirect(baseConfig.getRedirect());
> }
>
> Of course if you can help overcome this limitation, I would appreciate it.
>
>
> Hubert
>
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]