I think in V2 it was read-only at runtime even though there was a
setName().
AMX exposes only the getName() method, so it is not possible to change
the name through AMX.
But if code does call setName() through the config API (or some other
generic way that bypasses AMX), then this is a real problem (I think):
- MBeans won't have the right names
- references will break
- things might not match on-disk
I don't know the solution, since setName() is required to inject the
values into the @Configured object.
JEROME, I wonder if we should modify @Attribute to have a flag that
says "read only", allowing the field to be set only once? EG the
equivalent of 'final'.
Lloyd
On Mar 21, 2008, at 9:31 AM, Hong Zhang wrote:
> Hi, Lloyd
>
>> I see that Application.java has a setName() method:
>>
>> /**
>> * Sets the value of the name property.
>> *
>> * @param value allowed object is
>> * {_at_link String }
>> */
>> public void setName(String value) throws PropertyVetoException;
>>
>>
>> This has some significant ramifications since <application-ref>
>> elements refer to it, MBeans use the name, etc.
>>
>> Is this a mistake, or are we intending to allow dynamic changes to
>> the name of an application (and WebModule, etc)?
>>
> I added this mainly because I noticed the config beans for the other
> similar elements (such as WebModule) all have this method. If the
> set method here means to expose the attribute as an writable
> attribute, we should remove the method. I don't think we intend for
> the user to change the name. BTW: I noticed the setName method exist
> in v2 workspace for WebModule etc also.
>
> Thanks,
>
> - Hong
---
Lloyd L Chambers
lloyd.chambers_at_sun.com
Sun Microsystems, Inc