/** Constructs a component manager suitable for Xerces' schema validator. */
  public XMLSchemaValidatorComponentManager(XSGrammarPoolContainer grammarContainer) {
    // setup components
    fEntityManager = new XMLEntityManager();
    fComponents.put(ENTITY_MANAGER, fEntityManager);

    fErrorReporter = new XMLErrorReporter();
    fComponents.put(ERROR_REPORTER, fErrorReporter);

    fNamespaceContext = new NamespaceSupport();
    fComponents.put(NAMESPACE_CONTEXT, fNamespaceContext);

    fSchemaValidator = new XMLSchemaValidator();
    fComponents.put(SCHEMA_VALIDATOR, fSchemaValidator);

    fValidationManager = new ValidationManager();
    fComponents.put(VALIDATION_MANAGER, fValidationManager);

    // setup other properties
    fComponents.put(ENTITY_RESOLVER, null);
    fComponents.put(ERROR_HANDLER, null);

    fComponents.put(SYMBOL_TABLE, new SymbolTable());

    // setup grammar pool
    fComponents.put(XMLGRAMMAR_POOL, grammarContainer.getGrammarPool());
    fUseGrammarPoolOnly = grammarContainer.isFullyComposed();

    // add schema message formatter to error reporter
    fErrorReporter.putMessageFormatter(XSMessageFormatter.SCHEMA_DOMAIN, new XSMessageFormatter());

    // add all recognized features and properties and apply their defaults
    addRecognizedParamsAndSetDefaults(fEntityManager, grammarContainer);
    addRecognizedParamsAndSetDefaults(fErrorReporter, grammarContainer);
    addRecognizedParamsAndSetDefaults(fSchemaValidator, grammarContainer);

    boolean secureProcessing = grammarContainer.getFeature(XMLConstants.FEATURE_SECURE_PROCESSING);
    if (System.getSecurityManager() != null) {
      _isSecureMode = true;
      secureProcessing = true;
    }

    fInitSecurityManager = (XMLSecurityManager) grammarContainer.getProperty(SECURITY_MANAGER);
    if (fInitSecurityManager != null) {
      fInitSecurityManager.setSecureProcessing(secureProcessing);
    } else {
      fInitSecurityManager = new XMLSecurityManager(secureProcessing);
    }

    setProperty(SECURITY_MANAGER, fInitSecurityManager);

    // pass on properties set on SchemaFactory
    fSecurityPropertyMgr =
        (XMLSecurityPropertyManager)
            grammarContainer.getProperty(Constants.XML_SECURITY_PROPERTY_MANAGER);
    setProperty(XML_SECURITY_PROPERTY_MANAGER, fSecurityPropertyMgr);
  }