avalon-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Berin Loritsch <blorit...@apache.org>
Subject Re: makeReadOnly() method
Date Wed, 06 Jun 2001 12:55:42 GMT
Berin Loritsch wrote:
> 
> giacomo wrote:
> >
> > On Mon, 4 Jun 2001, Berin Loritsch wrote:
> >
> > > Actually, for the Excalibur stuff, I wanted to have
> > > the intialize() function take care of that.  It is
> > > IMO messy to have a makeReadOnly() method when
> > > something like that can be hidden.  I will check,
> > > but hopefully you haven't altered the interfaces--
> > > that would suck.  It would break backwards
> > > compatibility for something that is another concern.
> >
> > IMHO a better way to solve it is to wait until JDK 1.3 is available for
> > almost any platform and Avalon can integrate generating proxies to
> > secure the contracts.
> 
> That may be good in the long run--or it may be overkill.
> I am not sure of performance issues on that.  The important
> thing is we need to operate in the JDK 1.2 environment now.


Here is an idea:  what about making the default implementations
writable _only_ once.  IOW, once the name/value is set, it cannot
be changed (value is String or child Configuration[]).

For DefaultContext, it could be initialized with a Map in
the constructor, using Collections to make it readonly:

DefaultContext {
    private final Map m_context;

    public DefaultContext(Map myContext)
    {
        this.m_context = Collections.unmodifiableMap(myContext);
    }
}

For DefaultConfiguration, once setValue() or addChildren() is
called, it automatically becomes read-only.

For DefaultComponentManager, make it Initializable, this is
conceptually good.  Or you can do the DefaultContext approach
and remove the add methods altogether.

That type of thing.  It imposes no extra requirements on the clients,
and guarantees the security we are looking for.

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


Mime
View raw message