Class BaseConfig

java.lang.Object
org.apache.struts.config.BaseConfig
All Implemented Interfaces:
Serializable
Direct Known Subclasses:
ActionConfig, ControllerConfig, ExceptionConfig, FormBeanConfig, FormPropertyConfig, ForwardConfig, MessageResourcesConfig, ModuleConfigImpl

public abstract class BaseConfig extends Object implements Serializable

A abstract base class for all config classes. Provide basic support for arbitrary properties

Since:
Struts 1.3
See Also:
  • Field Details

    • configured

      protected boolean configured
      Indicates if configuration of this component been completed. TODO change protected to private and use methods provided by extenders?
  • Constructor Details

    • BaseConfig

      public BaseConfig()
  • Method Details

    • freeze

      public void freeze()
      Freeze the configuration of this action.
    • throwIfConfigured

      public void throwIfConfigured()
      Throw IllegalStateException if configuration is frozen.
      Throws:
      IllegalStateException - if configuration is frozen
    • setProperty

      public void setProperty(String key, String value)

      Set an arbitary key/value pair which can be retrieved by this config class. This facility should eliminate many use cases for subclassing *Config classes by providing a mechanism to pass any amount of arbitrary configuration information into an config class.

      This method must not be called after configuration is complete, or an IllegalStateException will be thrown.

      Example

       <action path="/example" type="com.example.MyAction">
          <set-property key="foo" property="bar" />
       </action>
       

      Parameters:
      key - the key by which this value will be retrieved
      value - the value to store with the supplied key
      Throws:
      IllegalStateException - if this module configuration has been frozen
      Since:
      Struts 1.3
    • getProperty

      public String getProperty(String key)
      Return the property-value for the specified key, if any; otherwise return null.
      Parameters:
      key - a key specified in the struts-config file
      Returns:
      the value stored with the supplied key
      Since:
      Struts 1.3
    • getProperties

      protected Properties getProperties()

      Return the entire set of properties configured for this object. At this time, this only needs to be exposed to support inheritance, so choosing a conservative access modifier ("protected").

      Returns:
      set of properties configured for this object
    • setProperties

      protected void setProperties(Properties properties)
      Set the entire set of properties configured for this object. At this time, this only needs to be exposed to support inheritance, so choosing a conservative access modifier ("protected").
    • inheritProperties

      protected void inheritProperties(BaseConfig baseConfig)

      Compare the properties of this config with that of the given and copy those that are not present. This method is used by subclasses that support configuration inheritance.

      Parameters:
      baseConfig - The config object to copy properties from.
    • copyProperties

      protected Properties copyProperties()

      Return a copy of the properties held by this object.