Here is a diff that allows us to do what I was talking about:
Index: Parameters.java
===================================================================
RCS file:
/home/cvs/jakarta-avalon/src/java/org/apache/avalon/framework/parameters/Parameters.java,v
retrieving revision 1.8
diff -w -r1.8 Parameters.java
31a32
> private HashMap m_locks = new HashMap();
40a42
> * @deprecated Use the <code>setParameter</code> method with three options.
43a46,57
> return this.setParameter(name, value, false);
> }
>
> /**
> * Set the <code>String</code> value of a specified parameter.
> * <p />
> * If the specified value is <b>null</b> the parameter is removed.
> *
> * @return The previous value of the parameter or <b>null</b>.
> */
> public String setParameter( final String name, final String value, final boolean
>isLocked )
> {
52a67,74
> if (Boolean.TRUE.equals((Boolean) m_locks.get(name)))
> {
> return null;
> }
>
> synchronized(this)
> {
> m_locks.remove(name);
54a77
> }
55a79,81
> synchronized(this)
> {
> m_locks.put(name, new Boolean(isLocked));
57a84,92
> }
>
> /**
> * Remove a parameter from the parameters object
> */
> public void removeParameter( final String name )
> {
> this.setParameter(name, null, false);
> }
60c95
< * Return an <code>Enumeration</code> view of all parameter names.
---
> * Return an <code>Iterator</code> view of all parameter names.
418c453,456
< * object.
---
> * object. This acts exactly like the following method call:
> * <pre>
> * Parameters.fromConfiguration(configuration, "parameter");
> * </pre>
425a464,477
> return Parameters.fromConfiguration(configuration, "parameter");
> }
>
> /**
> * Create a <code>Parameters</code> object from a <code>Configuration</code>
> * object using the supplied element name.
> *
> * @param configuration the Configuration
> * @param elementName the element name for the parameters
> * @return This <code>Parameters</code> instance.
> */
> public static Parameters fromConfiguration( final Configuration configuration,
>final String elementName )
> throws ConfigurationException
> {
432c484
< final Configuration[] parameters = configuration.getChildren( "parameter" );
---
> final Configuration[] parameters = configuration.getChildren( elementName );
441c493,494
< param.setParameter( name, value );
---
> final boolean isLocked = parameters[ i ].getAttributeAsBoolean(
>"locked", false );
> param.setParameter( name, value, isLocked );
Berin Loritsch wrote:
>
> Axis has a consept for options (equivalent to our parameters)
> that our existing Parameters object does not satisfy. It is
> the concept of "locked" parameters.
>
> The approach is in between the two states our Parameters object
> can handle. Currently we have completely modifiable or read only.
> The change would allow the markup to be changed to:
>
> <parameter name="foo" value="bar" locked="true"/>
> <parameter name="baz" value="vip"/>
>
> The additional parameter (if present) will lock a parameter no
> matter what state the object is in.
>
> That way, a run-time system can have parameters that are modified
> at specific times--but keep certain params from changing during
> the life of the system.
>
> There are two other things I would like to see: A Reparameterizable
> interface (to compliment Reconfigurable), and a "fromConfiguration"
> method that allows you to specify the element name for a parameter.
> The attributes would be the same, but a project would be able to
> use the name "option" instead of "parameter" if it wanted to.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]