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