1 /*
2  * reserved comment block
3  * DO NOT REMOVE OR ALTER!
4  */
5 /*
6  * Licensed to the Apache Software Foundation (ASF) under one or more
7  * contributor license agreements.  See the NOTICE file distributed with
8  * this work for additional information regarding copyright ownership.
9  * The ASF licenses this file to You under the Apache License, Version 2.0
10  * (the "License"); you may not use this file except in compliance with
11  * the License.  You may obtain a copy of the License at
12  *
13  *      http://www.apache.org/licenses/LICENSE-2.0
14  *
15  * Unless required by applicable law or agreed to in writing, software
16  * distributed under the License is distributed on an "AS IS" BASIS,
17  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
18  * See the License for the specific language governing permissions and
19  * limitations under the License.
20  */
21 
22 package com.sun.org.apache.xerces.internal.xni.parser;
23 
24 /**
25  * The component interface defines methods that must be implemented
26  * by components in a parser configuration. The component methods allow
27  * the component manager to initialize the component state and notify
28  * the component when feature and property values change.
29  *
30  * @see XMLComponentManager
31  *
32  * @author Andy Clark, IBM
33  *
34  */
35 public interface XMLComponent {
36 
37     //
38     // XMLComponent methods
39     //
40 
41     /**
42      * Resets the component. The component can query the component manager
43      * about any features and properties that affect the operation of the
44      * component.
45      *
46      * @param componentManager The component manager.
47      *
48      * @throws XNIException Thrown by component on initialization error.
49      */
reset(XMLComponentManager componentManager)50     public void reset(XMLComponentManager componentManager)
51         throws XMLConfigurationException;
52 
53     /**
54      * Returns a list of feature identifiers that are recognized by
55      * this component. This method may return null if no features
56      * are recognized by this component.
57      */
getRecognizedFeatures()58     public String[] getRecognizedFeatures();
59 
60     /**
61      * Sets the state of a feature. This method is called by the component
62      * manager any time after reset when a feature changes state.
63      * <p>
64      * <strong>Note:</strong> Components should silently ignore features
65      * that do not affect the operation of the component.
66      *
67      * @param featureId The feature identifier.
68      * @param state     The state of the feature.
69      *
70      * @throws XMLConfigurationException Thrown for configuration error.
71      *                                   In general, components should
72      *                                   only throw this exception if
73      *                                   it is <strong>really</strong>
74      *                                   a critical error.
75      */
setFeature(String featureId, boolean state)76     public void setFeature(String featureId, boolean state)
77         throws XMLConfigurationException;
78 
79     /**
80      * Returns a list of property identifiers that are recognized by
81      * this component. This method may return null if no properties
82      * are recognized by this component.
83      */
getRecognizedProperties()84     public String[] getRecognizedProperties();
85 
86     /**
87      * Sets the value of a property. This method is called by the component
88      * manager any time after reset when a property changes value.
89      * <p>
90      * <strong>Note:</strong> Components should silently ignore properties
91      * that do not affect the operation of the component.
92      *
93      * @param propertyId The property identifier.
94      * @param value      The value of the property.
95      *
96      * @throws XMLConfigurationException Thrown for configuration error.
97      *                                   In general, components should
98      *                                   only throw this exception if
99      *                                   it is <strong>really</strong>
100      *                                   a critical error.
101      */
setProperty(String propertyId, Object value)102     public void setProperty(String propertyId, Object value)
103        throws XMLConfigurationException;
104 
105     /**
106      * Returns the default state for a feature, or null if this
107      * component does not want to report a default value for this
108      * feature.
109      *
110      * @param featureId The feature identifier.
111      *
112      * @since Xerces 2.2.0
113      */
getFeatureDefault(String featureId)114     public Boolean getFeatureDefault(String featureId);
115 
116     /**
117      * Returns the default state for a property, or null if this
118      * component does not want to report a default value for this
119      * property.
120      *
121      * @param propertyId The property identifier.
122      *
123      * @since Xerces 2.2.0
124      */
getPropertyDefault(String propertyId)125     public Object getPropertyDefault(String propertyId);
126 
127 } // interface XMLComponent
128