ValidationManager.java revision 1133:2fdbfbde3bc0
1/* 2 * reserved comment block 3 * DO NOT REMOVE OR ALTER! 4 */ 5/* 6 * Licensed to the Apache Software Foundation (ASF) under one or more 7 * contributor license agreements. See the NOTICE file distributed with 8 * this work for additional information regarding copyright ownership. 9 * The ASF licenses this file to You under the Apache License, Version 2.0 10 * (the "License"); you may not use this file except in compliance with 11 * the License. You may obtain a copy of the License at 12 * 13 * http://www.apache.org/licenses/LICENSE-2.0 14 * 15 * Unless required by applicable law or agreed to in writing, software 16 * distributed under the License is distributed on an "AS IS" BASIS, 17 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 18 * See the License for the specific language governing permissions and 19 * limitations under the License. 20 */ 21 22package com.sun.org.apache.xerces.internal.impl.validation; 23 24import java.util.Vector; 25 26/** 27 * ValidationManager is a coordinator property for validators in the 28 * pipeline. Each validator must know how to interact with 29 * this property. Validators are not required to know what kind of 30 * other validators present in the pipeline, but should understand 31 * that there are others and that some coordination is required. 32 * 33 * @xerces.internal 34 * 35 * @author Elena Litani, IBM 36 */ 37public class ValidationManager { 38 39 protected final Vector fVSs = new Vector(); 40 protected boolean fGrammarFound = false; 41 42 // used by the DTD validator to tell other components that it has a 43 // cached DTD in hand so there's no reason to 44 // scan external subset or entity decls. 45 protected boolean fCachedDTD = false; 46 47 /** 48 * Each validator should call this method to add its ValidationState into 49 * the validation manager. 50 */ 51 public final void addValidationState(ValidationState vs) { 52 fVSs.addElement(vs); 53 } 54 55 /** 56 * Set the information required to validate entity values. 57 */ 58 public final void setEntityState(EntityState state) { 59 for (int i = fVSs.size()-1; i >= 0; i--) { 60 ((ValidationState)fVSs.elementAt(i)).setEntityState(state); 61 } 62 } 63 64 public final void setGrammarFound(boolean grammar){ 65 fGrammarFound = grammar; 66 } 67 68 public final boolean isGrammarFound(){ 69 return fGrammarFound; 70 } 71 72 public final void setCachedDTD(boolean cachedDTD) { 73 fCachedDTD = cachedDTD; 74 } // setCachedDTD(boolean) 75 76 public final boolean isCachedDTD() { 77 return fCachedDTD; 78 } // isCachedDTD(): boolean 79 80 81 public final void reset (){ 82 fVSs.removeAllElements(); 83 fGrammarFound = false; 84 fCachedDTD = false; 85 } 86} 87