View Javadoc
1   package org.exolab.castor.xml.schema;
2   
3   import org.castor.core.util.AbstractProperties;
4   import org.castor.xml.XMLProperties;
5   import org.exolab.castor.xml.Serializer;
6   import org.exolab.castor.xml.util.XMLParserUtils;
7   import org.xml.sax.Parser;
8   
9   /**
10   * Represents an execution context for schema reading/writing activities.
11   * 
12   * @author <a href="mailto:wguttmn AT codehaus DOT org">Werner Guttmann</a>
13   * @version $Revision: 7273 $ $Date: 2004-10-05 14:27:10 -0600 (Tue, 05 Oct 2004) $
14   *
15   * @since 1.2
16   */
17  public class SchemaContextImpl implements SchemaContext {
18  
19    /**
20     * {@link Resolver} instance used for resolving XML Schema definitions.
21     */
22    private Resolver _schemaResolver;
23  
24    /**
25     * {@link AbstractProperties} instance for retrieving property values related to XML parsers
26     */
27    private AbstractProperties _properties;
28  
29    /**
30     * Creates an instance of {@link SchemaContextImpl}.
31     */
32    public SchemaContextImpl() {
33      super();
34      _properties = XMLProperties.newInstance();
35    }
36  
37    /**
38     * {@inheritDoc}
39     * 
40     * @see org.exolab.castor.xml.schema.SchemaContext#getSchemaResolver()
41     */
42    public Resolver getSchemaResolver() {
43      return _schemaResolver;
44    }
45  
46    /**
47     * {@inheritDoc}
48     * 
49     * @see org.castor.xml.InternalContext#getParser(java.lang.String)
50     */
51    public Parser getParser(final String features) {
52      return XMLParserUtils.getParser(_properties, features);
53    }
54  
55    /**
56     * {@inheritDoc}
57     * 
58     * @see org.exolab.castor.xml.schema.SchemaContext#setSchemaResolver(org.exolab.castor.xml.schema.Resolver)
59     */
60    public void setSchemaResolver(Resolver resolver) {
61      _schemaResolver = resolver;
62    }
63  
64    /**
65     * {@inheritDoc}
66     * 
67     * @see org.exolab.castor.xml.schema.SchemaContext#getParser()
68     */
69    public Parser getParser() {
70      return getParser(null);
71    }
72  
73    /**
74     * {@inheritDoc}
75     * 
76     * @see org.castor.xml.InternalContext#getSerializer()
77     */
78    public Serializer getSerializer() {
79      return XMLParserUtils.getSerializer(_properties);
80    }
81  
82  }