package org.apache.struts.config;

import org.apache.commons.digester.AbstractObjectCreationFactory;
import org.apache.struts.util.RequestUtils;
import org.xml.sax.Attributes;

final class ActionMappingFactory extends AbstractObjectCreationFactory {
  public Object createObject(Attributes attributes) {
    String className = attributes.getValue("className");
    if (className == null) {
      ModuleConfig mc = (ModuleConfig)this.digester.peek();
      className = mc.getActionMappingClass();
    } 
    Object actionMapping = null;
    try {
      actionMapping = RequestUtils.applicationInstance(className);
    } catch (Exception e) {
      this.digester.getLogger().error("ActionMappingFactory.createObject: ", e);
    } 
    return actionMapping;
  }
}
