KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > xerces > impl > validation > ValidationManager


1 /*
2  * Copyright 1999-2002,2004 The Apache Software Foundation.
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */

16
17 package org.apache.xerces.impl.validation;
18
19 import java.util.Vector JavaDoc;
20
21 /**
22  * ValidationManager is a coordinator property for validators in the
23  * pipeline. Each validator must know how to interact with
24  * this property. Validators are not required to know what kind of
25  * other validators present in the pipeline, but should understand
26  * that there are others and that some coordination is required.
27  *
28  * @xerces.internal
29  *
30  * @author Elena Litani, IBM
31  * @version $Id: ValidationManager.java,v 1.10 2004/10/04 22:07:41 mrglavas Exp $
32  */

33 public class ValidationManager {
34
35     protected final Vector JavaDoc fVSs = new Vector JavaDoc();
36     protected boolean fGrammarFound = false;
37
38     // used by the DTD validator to tell other components that it has a
39
// cached DTD in hand so there's no reason to
40
// scan external subset or entity decls.
41
protected boolean fCachedDTD = false;
42     
43     /**
44      * Each validator should call this method to add its ValidationState into
45      * the validation manager.
46      */

47     public final void addValidationState(ValidationState vs) {
48         fVSs.addElement(vs);
49     }
50
51     /**
52      * Set the information required to validate entity values.
53      */

54     public final void setEntityState(EntityState state) {
55         for (int i = fVSs.size()-1; i >= 0; i--) {
56             ((ValidationState)fVSs.elementAt(i)).setEntityState(state);
57         }
58     }
59     
60     public final void setGrammarFound(boolean grammar){
61         fGrammarFound = grammar;
62     }
63         
64     public final boolean isGrammarFound(){
65         return fGrammarFound;
66     }
67
68     public final void setCachedDTD(boolean cachedDTD) {
69         fCachedDTD = cachedDTD;
70     } // setCachedDTD(boolean)
71

72     public final boolean isCachedDTD() {
73         return fCachedDTD;
74     } // isCachedDTD(): boolean
75

76         
77     public final void reset (){
78         fVSs.removeAllElements();
79         fGrammarFound = false;
80         fCachedDTD = false;
81     }
82 }
83
Popular Tags