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 java.util.HashMap;
21:
22: import javax.xml.validation.Schema;
23: import javax.xml.validation.Validator;
24: import javax.xml.validation.ValidatorHandler;
25:
26: /**
27: * <p>Abstract implementation of Schema for W3C XML Schemas.</p>
28: *
29: * @author Michael Glavassevich, IBM
30: * @version $Id: AbstractXMLSchema.java 447235 2006-09-18 05:01:44Z mrglavas $
31: */
32: abstract class AbstractXMLSchema extends Schema implements
33: XSGrammarPoolContainer {
34:
35: /**
36: * Map containing the initial values of features for
37: * validators created using this grammar pool container.
38: */
39: private final HashMap fFeatures;
40:
41: public AbstractXMLSchema() {
42: fFeatures = new HashMap();
43: }
44:
45: /*
46: * Schema methods
47: */
48:
49: /*
50: * @see javax.xml.validation.Schema#newValidator()
51: */
52: public final Validator newValidator() {
53: return new ValidatorImpl(this );
54: }
55:
56: /*
57: * @see javax.xml.validation.Schema#newValidatorHandler()
58: */
59: public final ValidatorHandler newValidatorHandler() {
60: return new ValidatorHandlerImpl(this );
61: }
62:
63: /*
64: * XSGrammarPoolContainer methods
65: */
66:
67: /**
68: * Returns the initial value of a feature for validators created
69: * using this grammar pool container or null if the validators
70: * should use the default value.
71: */
72: public final Boolean getFeature(String featureId) {
73: return (Boolean) fFeatures.get(featureId);
74: }
75:
76: /*
77: * Other methods
78: */
79:
80: final void setFeature(String featureId, boolean state) {
81: fFeatures.put(featureId, state ? Boolean.TRUE : Boolean.FALSE);
82: }
83:
84: } // AbstractXMLSchema
|