KickJava   Java API By Example, From Geeks To Geeks.

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


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>Implementation of Schema for W3C XML Schemas
25  * which contains no schema components.</p>
26  *
27  * @author Michael Glavassevich, IBM
28  * @version $Id: EmptyXMLSchema.java,v 1.1 2005/05/14 20:37:18 mrglavas Exp $
29  */

30 final class EmptyXMLSchema extends AbstractXMLSchema implements XMLGrammarPool {
31     
32     private static EmptyXMLSchema EMPTY_XML_SCHEMA_INSTANCE = new EmptyXMLSchema();
33     
34     /** Zero length grammar array. */
35     private static final Grammar [] ZERO_LENGTH_GRAMMAR_ARRAY = new Grammar [0];
36
37     /** Returns the one and only instance of this class. */
38     public static EmptyXMLSchema getInstance() {
39         return EMPTY_XML_SCHEMA_INSTANCE;
40     }
41     
42     private EmptyXMLSchema() {}
43     
44     /*
45      * XMLGrammarPool methods
46      */

47
48     public Grammar[] retrieveInitialGrammarSet(String JavaDoc grammarType) {
49         return ZERO_LENGTH_GRAMMAR_ARRAY;
50     }
51
52     public void cacheGrammars(String JavaDoc grammarType, Grammar[] grammars) {}
53
54     public Grammar retrieveGrammar(XMLGrammarDescription desc) {
55         return null;
56     }
57
58     public void lockPool() {}
59
60     public void unlockPool() {}
61
62     public void clear() {}
63     
64     /*
65      * XSGrammarPoolContainer methods
66      */

67
68     public XMLGrammarPool getGrammarPool() {
69         return this;
70     }
71
72     public boolean isFullyComposed() {
73         return true;
74     }
75
76 } // EmptyXMLSchema
77
Popular Tags