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