FileDocCategorySizeDatePackage
InsulatedValidatorComponent.javaAPI DocJava SE 5 API7486Fri Aug 26 14:55:54 BST 2005com.sun.org.apache.xerces.internal.jaxp.validation

InsulatedValidatorComponent

public abstract class InsulatedValidatorComponent extends Object implements XMLComponentManager, XMLComponent
Wraps a validator {@link XMLComponent} and isolates it from the rest of the components.

For the performance reason, when a validator from Xerces is used for a parser from Xerces, we will do "chating" by building an XNI pipeline. This saves the overhead of conversion between XNI events and SAX events.

However, if we just insert the validator component into the parser pipeline, the {@link XMLComponentManager} that the parser uses could change the way the validator works. On the other hand, certain configuration (such as error handlers) need to be given through a parser configuration.

To avoid this harmful interaction, this class wraps the validator and behaves as an insulation. The class itself will implement {@link XMLComponent}, and it selectively deliver properties to the wrapped validator.

Since the exact set of properties/features that require insulation depends on the actual validator implementation, this class is expected to be derived to add such validator-specific insulation code.

author
Kohsuke Kawaguchi (kohsuke.kawaguchi@sun.com)

Fields Summary
private final XMLDocumentFilter
fValidator
The object being wrapped. We require the validator to be both {@link XMLDocumentFilter} and {@link XMLComponent}.
private final XMLComponent
fValidatorComponent
The same object as {@link #fValidator}.
private final ValidationManager
fValidationManager
We will not use external {@link ValidationManager} to avoid interaction.

The existance of JAXP validator should not change the semantics of the parser processing. IOW it should not interact with the other validators in the parser pipeline.

private XMLComponentManager
fManager
The current component manager.
Constructors Summary
public InsulatedValidatorComponent(XMLDocumentFilter validator)

    
         
        fValidator = validator;
        fValidatorComponent = (XMLComponent)validator;
    
Methods Summary
public booleangetFeature(java.lang.String featureId)
Derived class may override this method to block additional features.

        return fManager.getFeature(featureId);
    
public final java.lang.BooleangetFeatureDefault(java.lang.String featureId)

        return fValidatorComponent.getFeatureDefault(featureId);
    
public java.lang.ObjectgetProperty(java.lang.String propertyId)
Derived class may override this method to block additional properties.

        if( propertyId.equals(XercesConstants.VALIDATION_MANAGER) )
            return fValidationManager;
        return fManager.getProperty(propertyId);
    
public final java.lang.ObjectgetPropertyDefault(java.lang.String propertyId)

        return fValidatorComponent.getPropertyDefault(propertyId);
    
public final java.lang.String[]getRecognizedFeatures()

        return fValidatorComponent.getRecognizedFeatures();
    
public final java.lang.String[]getRecognizedProperties()

        return fValidatorComponent.getRecognizedProperties();
    
public final com.sun.org.apache.xerces.internal.xni.parser.XMLDocumentFiltergetValidator()
Obtains a reference to the validator as a filter.

return
non-null valid object.

        return fValidator;
    
public final voidreset(com.sun.org.apache.xerces.internal.xni.parser.XMLComponentManager componentManager)

        fManager = componentManager;
        fValidatorComponent.reset(this);
        fValidationManager.reset();
    
public final voidsetFeature(java.lang.String featureId, boolean state)

        // don't allow features to be set.
    
public final voidsetProperty(java.lang.String propertyId, java.lang.Object value)

        // don't allow properties to be set.