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.jaxp.validation;
19:
20: import org.apache.xerces.xni.grammars.Grammar;
21: import org.apache.xerces.xni.grammars.XMLGrammarDescription;
22: import org.apache.xerces.xni.grammars.XMLGrammarPool;
23:
24: /**
25: * <p>Filter {@link XMLGrammarPool} that exposes a
26: * read-only view of the underlying pool.</p>
27: *
28: * @author Kohsuke Kawaguchi (kohsuke.kawaguchi@sun.com)
29: * @version $Id: ReadOnlyGrammarPool.java 447235 2006-09-18 05:01:44Z mrglavas $
30: */
31: final class ReadOnlyGrammarPool implements XMLGrammarPool {
32:
33: private final XMLGrammarPool core;
34:
35: public ReadOnlyGrammarPool(XMLGrammarPool pool) {
36: this .core = pool;
37: }
38:
39: public void cacheGrammars(String grammarType, Grammar[] grammars) {
40: // noop. don't let caching to happen
41: }
42:
43: public void clear() {
44: // noop. cache is read-only.
45: }
46:
47: public void lockPool() {
48: // noop. this pool is always read-only
49: }
50:
51: public Grammar retrieveGrammar(XMLGrammarDescription desc) {
52: return core.retrieveGrammar(desc);
53: }
54:
55: public Grammar[] retrieveInitialGrammarSet(String grammarType) {
56: return core.retrieveInitialGrammarSet(grammarType);
57: }
58:
59: public void unlockPool() {
60: // noop. this pool is always read-only.
61: }
62:
63: } // ReadOnlyGrammarPool
|