KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > xerces > jaxp > validation > ReadOnlyGrammarPool


1 /*
2  * Copyright 2005 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.jaxp.validation;
18
19 import org.apache.xerces.xni.grammars.Grammar;
20 import org.apache.xerces.xni.grammars.XMLGrammarDescription;
21 import org.apache.xerces.xni.grammars.XMLGrammarPool;
22
23 /**
24  * <p>Filter {@link XMLGrammarPool} that exposes a
25  * read-only view of the underlying pool.</p>
26  *
27  * @author Kohsuke Kawaguchi (kohsuke.kawaguchi@sun.com)
28  * @version $Id: ReadOnlyGrammarPool.java,v 1.1 2005/05/14 20:01:26 mrglavas Exp $
29  */

30 final class ReadOnlyGrammarPool implements XMLGrammarPool {
31     
32     private final XMLGrammarPool core;
33     
34     public ReadOnlyGrammarPool( XMLGrammarPool pool ) {
35         this.core = pool;
36     }
37     
38     public void cacheGrammars(String JavaDoc grammarType, Grammar[] grammars) {
39         // noop. don't let caching to happen
40
}
41
42     public void clear() {
43         // noop. cache is read-only.
44
}
45
46     public void lockPool() {
47         // noop. this pool is always read-only
48
}
49
50     public Grammar retrieveGrammar(XMLGrammarDescription desc) {
51         return core.retrieveGrammar(desc);
52     }
53
54     public Grammar[] retrieveInitialGrammarSet(String JavaDoc grammarType) {
55         return core.retrieveInitialGrammarSet(grammarType);
56     }
57
58     public void unlockPool() {
59         // noop. this pool is always read-only.
60
}
61
62 } // ReadOnlyGrammarPool
63
Popular Tags