public void configureGlobal( final Configuration config, final String prefix ) { final Iterator propertyKeys = config.findPropertyKeys( prefix ); while ( propertyKeys.hasNext() ) { final String key = (String) propertyKeys.next(); final String value = config.getConfigProperty( key ); if ( value != null ) { configure( config, value ); } } }
/** * Checks, whether the given handler classname can be instantiated and is in fact an object of the required * target-type. * * @param className the classname that should be checked. * @return true, if the handler is valid, false otherwise. */ private boolean isValidHandler( final String className ) { if ( className == null ) { return false; } final XmlReadHandler o = ObjectUtilities.loadAndInstantiate( className, getClass(), getTargetClass() ); return o != null; }
/** * Adds a configuration default for the given namespace to the tag-descriptions. If the namespace URI given here is * null, this defines the global default for all namespaces. * * @param namespaceUri the namespace URI for which a default should be configured. * @param hasCData the default value. */ public void setNamespaceHandler( final String namespaceUri, final Class<? extends T> hasCData ) { final TagDefinitionKey key = new TagDefinitionKey( namespaceUri, null ); setValueIfNotDefinedAsLegacy( key, hasCData ); }
warnedLegacyConfig = true; setDefaultNamespace( legacyDefaultNamespace ); if ( isValidHandler( globalValue ) ) { this.tagData.put( new TagDefinitionKey( null, null ), new TagDefinitionValue( globalValue, true ) ); if ( warnedLegacyConfig == false ) { continue; if ( isValidHandler( tagData ) ) { if ( warnedLegacyConfig == false ) { legacyWarningLog.warn( "Configured configuration-properties based override for global read-hander. " + continue; if ( isValidHandler( tagData ) == false ) { continue;
/** * Adds a configuration entry for the given namespace and tag-name to the tag-descriptions. * * @param tagName the tagname for which the entry should be added. * @param hasCData the default value. */ public void setElementHandler( final String tagName, final Class<? extends T> hasCData ) { if ( tagName == null ) { throw new NullPointerException(); } final TagDefinitionKey key = new TagDefinitionKey( defaultNamespace, tagName ); setValueIfNotDefinedAsLegacy( key, hasCData ); }
final TagDefinitionValue tagVal = tagData.get( key ); if ( tagVal != null ) { return ObjectUtilities.loadAndInstantiate( tagVal.getClassName(), getClass(), getTargetClass() ); final TagDefinitionValue className = tagData.get( defaultKey ); if ( className != null ) { return ObjectUtilities.loadAndInstantiate( className.getClassName(), getClass(), getTargetClass() ); ObjectUtilities.loadAndInstantiate( fallbackName.getClassName(), getClass(), getTargetClass() ); if ( fallbackValue != null ) { return fallbackValue;
/** * Adds a configuration entry for the given namespace and tag-name to the tag-descriptions. * * @param namespaceUri the namespace URI for which a default should be configured. * @param tagName the tagname for which the entry should be added. * @param hasCData the default value. */ public void setElementHandler( final String namespaceUri, final String tagName, final Class<? extends T> hasCData ) { if ( namespaceUri == null ) { throw new NullPointerException(); } if ( tagName == null ) { throw new NullPointerException(); } final TagDefinitionKey key = new TagDefinitionKey( namespaceUri, tagName ); setValueIfNotDefinedAsLegacy( key, hasCData ); }