/*
* reserved comment block
* DO NOT REMOVE OR ALTER!
*/
/*
* Copyright 2001, 2002,2004 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.
*/
/**
* This class implements the basic operations for managing parser
* configuration features and properties. This utility class can
* be used as a base class for parser configurations or separately
* to encapsulate a number of parser settings as a component
* manager.
* <p>
* This class can be constructed with a "parent" settings object
* (in the form of an <code>XMLComponentManager</code>) that allows
* parser configuration settings to be "chained" together.
*
* @author Andy Clark, IBM
*
* @version $Id: ParserConfigurationSettings.java,v 1.6 2010-11-01 04:40:14 joehw Exp $
*/
public class ParserConfigurationSettings
implements XMLComponentManager {
//
// Data
//
// data
/** Recognized properties. */
/** Properties. */
/** Recognized features. */
/** Features. */
/** Parent parser configuration settings. */
//
// Constructors
//
/** Default Constructor. */
public ParserConfigurationSettings() {
this(null);
} // <init>()
/**
* Constructs a parser configuration settings object with a
* parent settings object.
*/
// create storage for recognized features and properties
// create table for features and properties
// save parent
} // <init>(XMLComponentManager)
//
// XMLParserConfiguration methods
//
/**
* Allows a parser to add parser specific features to be recognized
* and managed by the parser configuration.
*
* @param featureIds An array of the additional feature identifiers
* to be recognized.
*/
// add recognized features
for (int i = 0; i < featureIdsCount; i++) {
}
}
} // addRecognizedFeatures(String[])
/**
* Set the state of a feature.
*
* Set the state of any feature in a SAX2 parser. The parser
* might not recognize the feature, and if it does recognize
* it, it might not be able to fulfill the request.
*
* @param featureId The unique identifier (URI) of the feature.
* @param state The requested state of the feature (true or false).
*
* @exception com.sun.org.apache.xerces.internal.xni.parser.XMLConfigurationException If the
* requested feature is not known.
*/
throws XMLConfigurationException {
// check and store
if (checkState.isExceptional()) {
}
} // setFeature(String,boolean)
/**
* Allows a parser to add parser specific properties to be recognized
* and managed by the parser configuration.
*
* @param propertyIds An array of the additional property identifiers
* to be recognized.
*/
} // addRecognizedProperties(String[])
/**
* setProperty
*
* @param propertyId
* @param value
* @exception com.sun.org.apache.xerces.internal.xni.parser.XMLConfigurationException If the
* requested feature is not known.
*/
throws XMLConfigurationException {
// check and store
if (checkState.isExceptional()) {
}
} // setProperty(String,Object)
//
// XMLComponentManager methods
//
/**
* Returns the state of a feature.
*
* @param featureId The feature identifier.
* @return true if the feature is supported
*
* @throws XMLConfigurationException Thrown for configuration error.
* In general, components should
* only throw this exception if
* it is <strong>really</strong>
* a critical error.
*/
throws XMLConfigurationException {
if (state.isExceptional()) {
}
} // getFeature(String):boolean
if (state.isExceptional()) {
return defaultValue;
}
}
if (checkState.isExceptional()) {
return checkState;
}
return FeatureState.is(false);
}
}
/**
* Returns the value of a property.
*
* @param propertyId The property identifier.
* @return the value of the property
*
* @throws XMLConfigurationException Thrown for configuration error.
* In general, components should
* only throw this exception if
* it is <strong>really</strong>
* a critical error.
*/
throws XMLConfigurationException {
if (state.isExceptional()) {
}
} // getProperty(String):Object
if (state.isExceptional()) {
return defaultValue;
}
}
if (propertyValue == null) {
if (state.isExceptional()) {
return state;
}
}
}
//
// Protected methods
//
/**
* Check a feature. If feature is known and supported, this method simply
* returns. Otherwise, the appropriate exception is thrown.
*
* @param featureId The unique identifier (URI) of the feature.
*
* @exception com.sun.org.apache.xerces.internal.xni.parser.XMLConfigurationException If the
* requested feature is not known.
*/
throws XMLConfigurationException {
// check feature
if (fParentSettings != null) {
}
else {
return FeatureState.NOT_RECOGNIZED;
}
}
// TODO: reasonable default?
return FeatureState.RECOGNIZED;
} // checkFeature(String)
/**
* Check a property. If the property is known and supported, this method
* simply returns. Otherwise, the appropriate exception is thrown.
*
* @param propertyId The unique identifier (URI) of the property
* being set.
* @exception com.sun.org.apache.xerces.internal.xni.parser.XMLConfigurationException If the
* requested feature is not known.
*/
throws XMLConfigurationException {
// check property
if (fParentSettings != null) {
if (state.isExceptional()) {
return state;
}
}
else {
return PropertyState.NOT_RECOGNIZED;
}
}
return PropertyState.RECOGNIZED;
} // checkProperty(String)
} // class ParserConfigurationSettings