/*
* reserved comment block
* DO NOT REMOVE OR ALTER!
*/
/*
* Copyright 2005 The Apache Software Foundation.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/**
* {@link SchemaFactory} for XML Schema.
*
* @author Kohsuke Kawaguchi (kohsuke.kawaguchi@sun.com)
* @version $Id: XMLSchemaFactory.java,v 1.11 2010-11-01 04:40:08 joehw Exp $
*/
// property identifiers
/** Feature identifier: schema full checking. */
/** Property identifier: grammar pool. */
/** Property identifier: SecurityManager. */
/** property identifier: access external dtd. */
/** Property identifier: access to external schema */
//
// Data
//
/** The XMLSchemaLoader */
/** User-specified ErrorHandler; can be null. */
/** The LSResrouceResolver */
/** The DOMEntityResolverWrapper */
/** The ErrorHandlerWrapper */
/** The SecurityManager. */
/** The container for the real grammar pool. */
/**
* Indicates whether implementation parts should use
* service loader (or similar).
* Note the default value (false) is the safe option..
*/
private final boolean fUseServicesMechanism;
public XMLSchemaFactory() {
this(true);
}
return new XMLSchemaFactory(false);
}
// Enable secure processing feature by default
fSecurityManager = new SecurityManager();
//by default, the secure feature is set to true, otherwise the default would have been 'file'
}
/**
* <p>Is specified schema supported by this <code>SchemaFactory</code>?</p>
*
* @param schemaLanguage Specifies the schema language which the returned <code>SchemaFactory</code> will understand.
* <code>schemaLanguage</code> must specify a <a href="#schemaLanguage">valid</a> schema language.
*
* @return <code>true</code> if <code>SchemaFactory</code> supports <code>schemaLanguage</code>, else <code>false</code>.
*
* @throws NullPointerException If <code>schemaLanguage</code> is <code>null</code>.
* @throws IllegalArgumentException If <code>schemaLanguage.length() == 0</code>
* or <code>schemaLanguage</code> does not specify a <a href="#schemaLanguage">valid</a> schema language.
*/
if (schemaLanguage == null) {
throw new NullPointerException(JAXPValidationMessageFormatter.formatMessage(fXMLSchemaLoader.getLocale(),
"SchemaLanguageNull", null));
}
throw new IllegalArgumentException(JAXPValidationMessageFormatter.formatMessage(fXMLSchemaLoader.getLocale(),
"SchemaLanguageLengthZero", null));
}
// only W3C XML Schema 1.0 is supported
}
return fLSResourceResolver;
}
}
return fErrorHandler;
}
fErrorHandlerWrapper.setErrorHandler(errorHandler != null ? errorHandler : DraconianErrorHandler.getInstance());
}
// this will let the loader store parsed Grammars into the pool.
if (source instanceof StreamSource) {
}
if (inputSource == null) {
"SAXSourceNullInputSource", null));
}
}
}
else if (source instanceof StAXSource) {
if (eventReader != null) {
}
else {
}
}
throw new NullPointerException(JAXPValidationMessageFormatter.formatMessage(fXMLSchemaLoader.getLocale(),
"SchemaSourceArrayMemberNull", null));
}
else {
throw new IllegalArgumentException(JAXPValidationMessageFormatter.formatMessage(fXMLSchemaLoader.getLocale(),
"SchemaFactorySourceUnrecognized",
}
}
try {
}
catch (XNIException e) {
// this should have been reported to users already.
throw Util.toSAXException(e);
}
catch (IOException e) {
// this hasn't been reported, so do so now.
throw se; // and we must throw it.
}
// Clear reference to grammar pool.
// Select Schema implementation based on grammar count.
if (grammarCount > 1) {
}
else if (grammarCount == 1) {
}
else {
schema = new EmptyXMLSchema();
}
return schema;
}
// Use a Schema that uses the system id as the equality source.
return schema;
}
throw new NullPointerException(JAXPValidationMessageFormatter.formatMessage(fXMLSchemaLoader.getLocale(),
"FeatureNameNull", null));
}
return (fSecurityManager != null);
}
try {
}
catch (XMLConfigurationException e) {
throw new SAXNotRecognizedException(
}
else {
throw new SAXNotSupportedException(
}
}
}
throw new NullPointerException(JAXPValidationMessageFormatter.formatMessage(fXMLSchemaLoader.getLocale(),
"ProperyNameNull", null));
}
return fSecurityManager;
}
throw new SAXNotSupportedException(
}
try {
}
catch (XMLConfigurationException e) {
throw new SAXNotRecognizedException(
}
else {
throw new SAXNotSupportedException(
}
}
}
throw new NullPointerException(JAXPValidationMessageFormatter.formatMessage(fXMLSchemaLoader.getLocale(),
"FeatureNameNull", null));
}
throw new SAXNotSupportedException(
"jaxp-secureprocessing-feature", null));
}
return;
//in secure mode, let _useServicesMechanism be determined by the constructor
return;
}
try {
}
catch (XMLConfigurationException e) {
throw new SAXNotRecognizedException(
}
else {
throw new SAXNotSupportedException(
}
}
}
throw new NullPointerException(JAXPValidationMessageFormatter.formatMessage(fXMLSchemaLoader.getLocale(),
"ProperyNameNull", null));
}
return;
}
throw new SAXNotSupportedException(
}
try {
}
catch (XMLConfigurationException e) {
throw new SAXNotRecognizedException(
}
else {
throw new SAXNotSupportedException(
}
}
}
}
}
}
}
/**
* Extension of XMLGrammarPoolImpl which exposes the number of
* grammars stored in the grammar pool.
*/
/** Constructs a grammar pool with a default number of buckets. */
public XMLGrammarPoolImplExtension() {
super();
}
/** Constructs a grammar pool with a specified number of buckets. */
super(initialCapacity);
}
/** Returns the number of grammars contained in this pool. */
int getGrammarCount() {
return fGrammarCount;
}
} // XMLSchemaFactory.XMLGrammarPoolImplExtension
/**
* A grammar pool which wraps another.
*/
/*
* XMLGrammarPool methods
*/
}
}
}
public void lockPool() {
}
public void unlockPool() {
}
public void clear() {
}
/*
* Other methods
*/
}
return fGrammarPool;
}
} // XMLSchemaFactory.XMLGrammarPoolWrapper
} // XMLSchemaFactory