package org.apache.struts.config;

import org.apache.commons.digester.Digester;
import org.apache.commons.digester.ObjectCreationFactory;
import org.apache.commons.digester.RuleSetBase;

public class ConfigRuleSet extends RuleSetBase {
  public void addRuleInstances(Digester digester) {
    digester.addObjectCreate("struts-config/data-sources/data-source", "org.apache.struts.config.DataSourceConfig", "className");
    digester.addSetProperties("struts-config/data-sources/data-source");
    digester.addSetNext("struts-config/data-sources/data-source", "addDataSourceConfig", "org.apache.struts.config.DataSourceConfig");
    digester.addRule("struts-config/data-sources/data-source/set-property", new AddDataSourcePropertyRule());
    digester.addRule("struts-config/action-mappings", new SetActionMappingClassRule());
    digester.addFactoryCreate("struts-config/action-mappings/action", (ObjectCreationFactory)new ActionMappingFactory());
    digester.addSetProperties("struts-config/action-mappings/action");
    digester.addSetNext("struts-config/action-mappings/action", "addActionConfig", "org.apache.struts.config.ActionConfig");
    digester.addSetProperty("struts-config/action-mappings/action/set-property", "property", "value");
    digester.addObjectCreate("struts-config/action-mappings/action/exception", "org.apache.struts.config.ExceptionConfig", "className");
    digester.addSetProperties("struts-config/action-mappings/action/exception");
    digester.addSetNext("struts-config/action-mappings/action/exception", "addExceptionConfig", "org.apache.struts.config.ExceptionConfig");
    digester.addSetProperty("struts-config/action-mappings/action/exception/set-property", "property", "value");
    digester.addObjectCreate("struts-config/action-mappings/action/forward", "org.apache.struts.action.ActionForward", "className");
    digester.addSetProperties("struts-config/action-mappings/action/forward");
    digester.addSetNext("struts-config/action-mappings/action/forward", "addForwardConfig", "org.apache.struts.config.ForwardConfig");
    digester.addSetProperty("struts-config/action-mappings/action/forward/set-property", "property", "value");
    digester.addObjectCreate("struts-config/controller", "org.apache.struts.config.ControllerConfig", "className");
    digester.addSetProperties("struts-config/controller");
    digester.addSetNext("struts-config/controller", "setControllerConfig", "org.apache.struts.config.ControllerConfig");
    digester.addSetProperty("struts-config/controller/set-property", "property", "value");
    digester.addObjectCreate("struts-config/form-beans/form-bean", "org.apache.struts.action.ActionFormBean", "className");
    digester.addSetProperties("struts-config/form-beans/form-bean");
    digester.addSetNext("struts-config/form-beans/form-bean", "addFormBeanConfig", "org.apache.struts.config.FormBeanConfig");
    digester.addObjectCreate("struts-config/form-beans/form-bean/form-property", "org.apache.struts.config.FormPropertyConfig", "className");
    digester.addSetProperties("struts-config/form-beans/form-bean/form-property");
    digester.addSetNext("struts-config/form-beans/form-bean/form-property", "addFormPropertyConfig", "org.apache.struts.config.FormPropertyConfig");
    digester.addSetProperty("struts-config/form-beans/form-bean/form-property/set-property", "property", "value");
    digester.addSetProperty("struts-config/form-beans/form-bean/set-property", "property", "value");
    digester.addObjectCreate("struts-config/global-exceptions/exception", "org.apache.struts.config.ExceptionConfig", "className");
    digester.addSetProperties("struts-config/global-exceptions/exception");
    digester.addSetNext("struts-config/global-exceptions/exception", "addExceptionConfig", "org.apache.struts.config.ExceptionConfig");
    digester.addSetProperty("struts-config/global-exceptions/exception/set-property", "property", "value");
    digester.addObjectCreate("struts-config/global-forwards/forward", "org.apache.struts.action.ActionForward", "className");
    digester.addSetProperties("struts-config/global-forwards/forward");
    digester.addSetNext("struts-config/global-forwards/forward", "addForwardConfig", "org.apache.struts.config.ForwardConfig");
    digester.addSetProperty("struts-config/global-forwards/forward/set-property", "property", "value");
    digester.addObjectCreate("struts-config/message-resources", "org.apache.struts.config.MessageResourcesConfig", "className");
    digester.addSetProperties("struts-config/message-resources");
    digester.addSetNext("struts-config/message-resources", "addMessageResourcesConfig", "org.apache.struts.config.MessageResourcesConfig");
    digester.addSetProperty("struts-config/message-resources/set-property", "property", "value");
    digester.addObjectCreate("struts-config/plug-in", "org.apache.struts.config.PlugInConfig");
    digester.addSetProperties("struts-config/plug-in");
    digester.addSetNext("struts-config/plug-in", "addPlugInConfig", "org.apache.struts.config.PlugInConfig");
    digester.addRule("struts-config/plug-in/set-property", new PlugInSetPropertyRule());
  }
}
