Should this be per ConfigurationBuilder rather than per JVM ? ie move it to instance variable of the Builder/Handler?
On Tue, 30 Oct 2001 03:32, [EMAIL PROTECTED] wrote: > bloritsch 01/10/29 08:32:50 > > Modified: src/java/org/apache/avalon/framework/configuration > Namespace.java > Log: > Globally set validation policy used for new Namespace objects. > > Revision Changes Path > 1.3 +30 -6 > jakarta-avalon/src/java/org/apache/avalon/framework/configuration/Namespace >.java > > Index: Namespace.java > =================================================================== > RCS file: > /home/cvs/jakarta-avalon/src/java/org/apache/avalon/framework/configuration >/Namespace.java,v retrieving revision 1.2 > retrieving revision 1.3 > diff -u -r1.2 -r1.3 > --- Namespace.java 2001/10/29 14:58:48 1.2 > +++ Namespace.java 2001/10/29 16:32:50 1.3 > @@ -18,24 +18,30 @@ > */ > public final class Namespace implements Serializable > { > + private static final boolean VALIDATE_PREFIX = true; > + private static final boolean IGNORE_PREFIX = false; > + private static volatile boolean m_policy = VALIDATE_PREFIX; > + > private final String m_prefix; > private final String m_uri; > + private final boolean m_validate_prefix; > > /** > * Hide constructor so that the default factory methods must be used > */ > private Namespace() > { > - this("", ""); > + this("", "", true); > } > > /** > * Create a Namespace object with a prefix and uri. > */ > - private Namespace( final String prefix, final String uri ) > + private Namespace( final String prefix, final String uri, final > boolean validatePrefix ) { > this.m_prefix = prefix; > this.m_uri = uri; > + this.m_validate_prefix = validatePrefix; > } > > /** > @@ -71,11 +77,19 @@ > if ( check instanceof Namespace ) > { > Namespace other = (Namespace) check; > - isEqual = this.getPrefix().equals( other.getPrefix() ); > + > + if ( m_validate_prefix ) > + { > + isEqual = this.getPrefix().equals( other.getPrefix() ); > > - if (isEqual) > + if (isEqual) > + { > + isEqual = this.getURI().equals( other.getURI() ); > + } > + } > + else > { > - isEqual = this.getURI().equals( other.getURI() ); > + isEqual = this.getURI().equals( other.getURI() ); > } > } > else if ( check instanceof String ) > @@ -185,6 +199,16 @@ > loc = ""; > } > > - return new Namespace( pre, loc ); > + return new Namespace( pre, loc, true ); > + } > + > + public static final synchronized void setPolicy( final boolean > prefixValidating ) + { > + Namespace.m_policy = prefixValidating; > + } > + > + public static final synchronized boolean getPolicy() > + { > + return Namespace.m_policy; > } > } -- Cheers, Pete "abandon all hope , ye who enter here" - dante, inferno -- To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>