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