Leandro,

The Configuration interface is explicitly read-only.  This is for a very
good reason.  Making Configuration mutable would violate Inversion of
Control and Separation of Concerns, as changes made by one component in
the Configuration object would potentially be visible to other
components. This would be sensitive to the container implementation
details and the order in which the configure methods of different
components were called.  Very, very bad.

To accomplish what you want I would suggest that you write a
MutableConfiguration class that takes a Configuration object in its
constructor (copying the Configuration data) and implements the behavior
you need.

--Peter


> -----Original Message-----
> From: Leandro Rodrigo Saad Cruz [mailto:[EMAIL PROTECTED]]
> Sent: Wednesday, November 20, 2002 6:14 AM
> To: Avalon framework users
> Cc: [EMAIL PROTECTED]
> Subject: [PROPOSAL] Changing Configuration
> 
> Hi all.
> 
> I'd like to propose another impl of Configuration and another
> SAXConfigurationHandler. He is my motivation.
> 
> I have a simple configuration like this
> 
> <some_service name="FileUpload">
>       <component name="a">
>               <>
>               </>
>               ...
>               ...
>       </component>
>       <component name="b">
>               <>
>               </>
>               ...
>               ...
>       </component>
> </some_service>
> <some_service name="AnotherOne">
>       ...
>       ...
>       ...
> </some_service>
> 
> Suppose I want to modify just the configuration for component named
'a',
> or the configuration for service named 'AnotherOne'. I'd have to
rebuild
> all my configuration object just to change a single line, I think that
> *if* DefaultConfiguration established a parent-child relationship and
> offered ,methods like addChild(int position,Configuration child) we
> would be able to replace just the line we wanted. Example
> 
> <code>
> Configuration willBeChanged = getConfigurationUsingSomeCriteria();
> int position = willBeChanged.getPositionAccordingToFather();
> Configuration parent = willBeChanged.getParent();
> willBeChanged = new DefaultConfiguration();
> parent.addChild(position,willBeChanged);
> //serialize
> </code>
> 
> I'm not aware of the consequences of a change like this and I am
> proposing this because this is a functionality that I need. Do you
need
> this too ? Any comments ?
> 
> 
> --
> Leandro Rodrigo Saad Cruz
> IT - Inter Business Tecnologia e Servicos (IB)
> http://www.ibnetwork.com.br
> http://jakarta.apache.org/ojb
> 
> 
> --
> To unsubscribe, e-mail:   <mailto:avalon-dev-
> [EMAIL PROTECTED]>
> For additional commands, e-mail: <mailto:avalon-dev-
> [EMAIL PROTECTED]>



--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

Reply via email to