You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@struts.apache.org by ma...@apache.org on 2009/12/27 19:01:09 UTC

svn commit: r894087 [7/46] - in /struts/xwork/trunk: ./ assembly/ assembly/src/ assembly/src/main/ assembly/src/main/assembly/ assembly/src/main/resources/ core/ core/src/ core/src/main/ core/src/main/java/ core/src/main/java/com/ core/src/main/java/co...

Added: struts/xwork/trunk/core/src/main/java/com/opensymphony/xwork2/config/providers/XmlConfigurationProvider.java
URL: http://svn.apache.org/viewvc/struts/xwork/trunk/core/src/main/java/com/opensymphony/xwork2/config/providers/XmlConfigurationProvider.java?rev=894087&view=auto
==============================================================================
--- struts/xwork/trunk/core/src/main/java/com/opensymphony/xwork2/config/providers/XmlConfigurationProvider.java (added)
+++ struts/xwork/trunk/core/src/main/java/com/opensymphony/xwork2/config/providers/XmlConfigurationProvider.java Sun Dec 27 18:00:13 2009
@@ -0,0 +1,993 @@
+/*
+ * Copyright (c) 2002-2006 by OpenSymphony
+ * All rights reserved.
+ */
+package com.opensymphony.xwork2.config.providers;
+
+import com.opensymphony.xwork2.Action;
+import com.opensymphony.xwork2.ObjectFactory;
+import com.opensymphony.xwork2.XWorkException;
+import com.opensymphony.xwork2.config.Configuration;
+import com.opensymphony.xwork2.config.ConfigurationException;
+import com.opensymphony.xwork2.config.ConfigurationProvider;
+import com.opensymphony.xwork2.config.ConfigurationUtil;
+import com.opensymphony.xwork2.config.entities.*;
+import com.opensymphony.xwork2.config.entities.UnknownHandlerConfig;
+import com.opensymphony.xwork2.config.impl.LocatableFactory;
+import com.opensymphony.xwork2.inject.Container;
+import com.opensymphony.xwork2.inject.ContainerBuilder;
+import com.opensymphony.xwork2.inject.Inject;
+import com.opensymphony.xwork2.inject.Scope;
+import com.opensymphony.xwork2.util.*;
+import com.opensymphony.xwork2.util.location.LocatableProperties;
+import com.opensymphony.xwork2.util.location.Location;
+import com.opensymphony.xwork2.util.location.LocationUtils;
+import com.opensymphony.xwork2.util.logging.Logger;
+import com.opensymphony.xwork2.util.logging.LoggerFactory;
+import org.w3c.dom.Document;
+import org.w3c.dom.Element;
+import org.w3c.dom.Node;
+import org.w3c.dom.NodeList;
+import org.xml.sax.InputSource;
+import org.apache.commons.lang.StringUtils;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.lang.reflect.Modifier;
+import java.net.URL;
+import java.util.*;
+
+
+/**
+ * Looks in the classpath for an XML file, "xwork.xml" by default,
+ * and uses it for the XWork configuration.
+ *
+ * @author tmjee
+ * @author Rainer Hermanns
+ * @author Neo
+ * @version $Revision$
+ */
+public class XmlConfigurationProvider implements ConfigurationProvider {
+
+    private static final Logger LOG = LoggerFactory.getLogger(XmlConfigurationProvider.class);
+
+    private List<Document> documents;
+    private Set<String> includedFileNames;
+    private String configFileName;
+    private ObjectFactory objectFactory;
+
+    private Set<String> loadedFileUrls = new HashSet<String>();
+    private boolean errorIfMissing;
+    private Map<String, String> dtdMappings;
+    private Configuration configuration;
+    private boolean throwExceptionOnDuplicateBeans = true;
+
+    public XmlConfigurationProvider() {
+        this("xwork.xml", true);
+    }
+
+    public XmlConfigurationProvider(String filename) {
+        this(filename, true);
+    }
+
+    public XmlConfigurationProvider(String filename, boolean errorIfMissing) {
+        this.configFileName = filename;
+        this.errorIfMissing = errorIfMissing;
+
+        Map<String, String> mappings = new HashMap<String, String>();
+        mappings.put("-//OpenSymphony Group//XWork 2.1.3//EN", "xwork-2.1.3.dtd");
+        mappings.put("-//OpenSymphony Group//XWork 2.1//EN", "xwork-2.1.dtd");
+        mappings.put("-//OpenSymphony Group//XWork 2.0//EN", "xwork-2.0.dtd");
+        mappings.put("-//OpenSymphony Group//XWork 1.1.1//EN", "xwork-1.1.1.dtd");
+        mappings.put("-//OpenSymphony Group//XWork 1.1//EN", "xwork-1.1.dtd");
+        mappings.put("-//OpenSymphony Group//XWork 1.0//EN", "xwork-1.0.dtd");
+        setDtdMappings(mappings);
+    }
+
+    public void setThrowExceptionOnDuplicateBeans(boolean val) {
+        this.throwExceptionOnDuplicateBeans = val;
+    }
+
+    public void setDtdMappings(Map<String, String> mappings) {
+        this.dtdMappings = Collections.unmodifiableMap(mappings);
+    }
+
+    @Inject
+    public void setObjectFactory(ObjectFactory objectFactory) {
+        this.objectFactory = objectFactory;
+    }
+
+    /**
+     * Returns an unmodifiable map of DTD mappings
+     */
+    public Map<String, String> getDtdMappings() {
+        return dtdMappings;
+    }
+
+    public void init(Configuration configuration) {
+        this.configuration = configuration;
+        this.includedFileNames = configuration.getLoadedFileNames();
+        loadDocuments(configFileName);
+    }
+
+    public void destroy() {
+    }
+
+    @Override
+    public boolean equals(Object o) {
+        if (this == o) {
+            return true;
+        }
+
+        if (!(o instanceof XmlConfigurationProvider)) {
+            return false;
+        }
+
+        final XmlConfigurationProvider xmlConfigurationProvider = (XmlConfigurationProvider) o;
+
+        if ((configFileName != null) ? (!configFileName.equals(xmlConfigurationProvider.configFileName)) : (xmlConfigurationProvider.configFileName != null)) {
+            return false;
+        }
+
+        return true;
+    }
+
+    @Override
+    public int hashCode() {
+        return ((configFileName != null) ? configFileName.hashCode() : 0);
+    }
+
+    private void loadDocuments(String configFileName) {
+        try {
+            loadedFileUrls.clear();
+            documents = loadConfigurationFiles(configFileName, null);
+        } catch (ConfigurationException e) {
+            throw e;
+        } catch (Exception e) {
+            throw new ConfigurationException("Error loading configuration file " + configFileName, e);
+        }
+    }
+
+    public void register(ContainerBuilder containerBuilder, LocatableProperties props) throws ConfigurationException {
+        LOG.info("Parsing configuration file [" + configFileName + "]");
+        Map<String, Node> loadedBeans = new HashMap<String, Node>();
+        for (Document doc : documents) {
+            Element rootElement = doc.getDocumentElement();
+            NodeList children = rootElement.getChildNodes();
+            int childSize = children.getLength();
+
+            for (int i = 0; i < childSize; i++) {
+                Node childNode = children.item(i);
+
+                if (childNode instanceof Element) {
+                    Element child = (Element) childNode;
+
+                    final String nodeName = child.getNodeName();
+
+                    if ("bean".equals(nodeName)) {
+                        String type = child.getAttribute("type");
+                        String name = child.getAttribute("name");
+                        String impl = child.getAttribute("class");
+                        String onlyStatic = child.getAttribute("static");
+                        String scopeStr = child.getAttribute("scope");
+                        boolean optional = "true".equals(child.getAttribute("optional"));
+                        Scope scope = Scope.SINGLETON;
+                        if ("default".equals(scopeStr)) {
+                            scope = Scope.DEFAULT;
+                        } else if ("request".equals(scopeStr)) {
+                            scope = Scope.REQUEST;
+                        } else if ("session".equals(scopeStr)) {
+                            scope = Scope.SESSION;
+                        } else if ("singleton".equals(scopeStr)) {
+                            scope = Scope.SINGLETON;
+                        } else if ("thread".equals(scopeStr)) {
+                            scope = Scope.THREAD;
+                        }
+
+                        if (StringUtils.isEmpty(name)) {
+                            name = Container.DEFAULT_NAME;
+                        }
+
+                        try {
+                            Class cimpl = ClassLoaderUtil.loadClass(impl, getClass());
+                            Class ctype = cimpl;
+                            if (StringUtils.isNotEmpty(type)) {
+                                ctype = ClassLoaderUtil.loadClass(type, getClass());
+                            }
+                            if ("true".equals(onlyStatic)) {
+                                // Force loading of class to detect no class def found exceptions
+                                cimpl.getDeclaredClasses();
+                                containerBuilder.injectStatics(cimpl);
+                            } else {
+                                if (containerBuilder.contains(ctype, name)) {
+                                    Location loc = LocationUtils.getLocation(loadedBeans.get(ctype.getName() + name));
+                                    if (throwExceptionOnDuplicateBeans) {
+                                        throw new ConfigurationException("Bean type " + ctype + " with the name " +
+                                                name + " has already been loaded by " + loc, child);
+                                    }
+                                }
+
+                                // Force loading of class to detect no class def found exceptions
+                                cimpl.getDeclaredConstructors();
+
+                                if (LOG.isDebugEnabled()) {
+                                    LOG.debug("Loaded type:" + type + " name:" + name + " impl:" + impl);
+                                }
+                                containerBuilder.factory(ctype, name, new LocatableFactory(name, ctype, cimpl, scope, childNode), scope);
+                            }
+                            loadedBeans.put(ctype.getName() + name, child);
+                        } catch (Throwable ex) {
+                            if (!optional) {
+                                throw new ConfigurationException("Unable to load bean: type:" + type + " class:" + impl, ex, childNode);
+                            } else {
+                                LOG.debug("Unable to load optional class: " + ex);
+                            }
+                        }
+                    } else if ("constant".equals(nodeName)) {
+                        String name = child.getAttribute("name");
+                        String value = child.getAttribute("value");
+                        props.setProperty(name, value, childNode);
+                    } else if (nodeName.equals("unknown-handler-stack")) {
+                        List<UnknownHandlerConfig> unknownHandlerStack = new ArrayList<UnknownHandlerConfig>();
+                        NodeList unknownHandlers = child.getElementsByTagName("unknown-handler-ref");
+                        int unknownHandlersSize = unknownHandlers.getLength();
+
+                        for (int k = 0; k < unknownHandlersSize; k++) {
+                            Element unknownHandler = (Element) unknownHandlers.item(k);
+                            unknownHandlerStack.add(new UnknownHandlerConfig(unknownHandler.getAttribute("name")));
+                        }
+
+                        if (!unknownHandlerStack.isEmpty())
+                            configuration.setUnknownHandlerStack(unknownHandlerStack);
+                    }
+                }
+            }
+        }
+    }
+
+    public void loadPackages() throws ConfigurationException {
+        List<Element> reloads = new ArrayList<Element>();
+        for (Document doc : documents) {
+            Element rootElement = doc.getDocumentElement();
+            NodeList children = rootElement.getChildNodes();
+            int childSize = children.getLength();
+
+            for (int i = 0; i < childSize; i++) {
+                Node childNode = children.item(i);
+
+                if (childNode instanceof Element) {
+                    Element child = (Element) childNode;
+
+                    final String nodeName = child.getNodeName();
+
+                    if ("package".equals(nodeName)) {
+                        PackageConfig cfg = addPackage(child);
+                        if (cfg.isNeedsRefresh()) {
+                            reloads.add(child);
+                        }
+                    }
+                }
+            }
+            loadExtraConfiguration(doc);
+        }
+
+        if (reloads.size() > 0) {
+            reloadRequiredPackages(reloads);
+        }
+
+        for (Document doc : documents) {
+            loadExtraConfiguration(doc);
+        }
+
+        documents.clear();
+        configuration = null;
+    }
+
+    private void reloadRequiredPackages(List<Element> reloads) {
+        if (reloads.size() > 0) {
+            List<Element> result = new ArrayList<Element>();
+            for (Element pkg : reloads) {
+                PackageConfig cfg = addPackage(pkg);
+                if (cfg.isNeedsRefresh()) {
+                    result.add(pkg);
+                }
+            }
+            if ((result.size() > 0) && (result.size() != reloads.size())) {
+                reloadRequiredPackages(result);
+                return;
+            }
+
+            // Print out error messages for all misconfigured inheritence packages
+            if (result.size() > 0) {
+                for (Element rp : result) {
+                    String parent = rp.getAttribute("extends");
+                    if (parent != null) {
+                        List<PackageConfig> parents = ConfigurationUtil.buildParentsFromString(configuration, parent);
+                        if (parents != null && parents.size() <= 0) {
+                            LOG.error("Unable to find parent packages " + parent);
+                        }
+                    }
+                }
+            }
+        }
+    }
+
+    /**
+     * Tells whether the ConfigurationProvider should reload its configuration. This method should only be called
+     * if ConfigurationManager.isReloadingConfigs() is true.
+     *
+     * @return true if the file has been changed since the last time we read it
+     */
+    public boolean needsReload() {
+
+        for (String url : loadedFileUrls) {
+            if (FileManager.fileNeedsReloading(url)) {
+                return true;
+            }
+        }
+        return false;
+    }
+
+    protected void addAction(Element actionElement, PackageConfig.Builder packageContext) throws ConfigurationException {
+        String name = actionElement.getAttribute("name");
+        String className = actionElement.getAttribute("class");
+        String methodName = actionElement.getAttribute("method");
+        Location location = DomHelper.getLocationObject(actionElement);
+
+        if (location == null) {
+            LOG.warn("location null for " + className);
+        }
+        //methodName should be null if it's not set
+        methodName = (methodName.trim().length() > 0) ? methodName.trim() : null;
+
+        // if there isnt a class name specified for an <action/> then try to
+        // use the default-class-ref from the <package/>
+        if (StringUtils.isEmpty(className)) {
+            // if there is a package default-class-ref use that, otherwise use action support
+           /* if (StringUtils.isNotEmpty(packageContext.getDefaultClassRef())) {
+                className = packageContext.getDefaultClassRef();
+            } else {
+                className = ActionSupport.class.getName();
+            }*/
+
+        } else {
+            if (!verifyAction(className, name, location)) {
+                if (LOG.isErrorEnabled())
+                    LOG.error("Unable to verify action [#0] with class [#1], from [#2]", name, className, location.toString());
+                return;
+            }
+        }
+
+
+
+        Map<String, ResultConfig> results;
+        try {
+            results = buildResults(actionElement, packageContext);
+        } catch (ConfigurationException e) {
+            throw new ConfigurationException("Error building results for action " + name + " in namespace " + packageContext.getNamespace(), e, actionElement);
+        }
+
+        List<InterceptorMapping> interceptorList = buildInterceptorList(actionElement, packageContext);
+
+        List<ExceptionMappingConfig> exceptionMappings = buildExceptionMappings(actionElement, packageContext);
+
+        ActionConfig actionConfig = new ActionConfig.Builder(packageContext.getName(), name, className)
+                .methodName(methodName)
+                .addResultConfigs(results)
+                .addInterceptors(interceptorList)
+                .addExceptionMappings(exceptionMappings)
+                .addParams(XmlHelper.getParams(actionElement))
+                .location(location)
+                .build();
+        packageContext.addActionConfig(name, actionConfig);
+
+        if (LOG.isDebugEnabled()) {
+            LOG.debug("Loaded " + (StringUtils.isNotEmpty(packageContext.getNamespace()) ? (packageContext.getNamespace() + "/") : "") + name + " in '" + packageContext.getName() + "' package:" + actionConfig);
+        }
+    }
+
+    protected boolean verifyAction(String className, String name, Location loc) {
+        if (className.indexOf('{') > -1) {
+            if (LOG.isDebugEnabled()) {
+                LOG.debug("Action class [" + className + "] contains a wildcard " +
+                        "replacement value, so it can't be verified");
+            }
+            return true;
+        }
+        try {
+            if (objectFactory.isNoArgConstructorRequired()) {
+                Class clazz = objectFactory.getClassInstance(className);
+                if (!Modifier.isPublic(clazz.getModifiers())) {
+                    throw new ConfigurationException("Action class [" + className + "] is not public", loc);
+                }
+                clazz.getConstructor(new Class[]{});
+            }
+        } catch (ClassNotFoundException e) {
+            if (LOG.isDebugEnabled()) {
+                LOG.debug("Class not found for action [" + className + "]", e);
+            }
+            throw new ConfigurationException("Action class [" + className + "] not found", loc);
+        } catch (NoSuchMethodException e) {
+            if (LOG.isDebugEnabled()) {
+                LOG.debug("No constructor found for action [" + className + "]", e);
+            }
+            throw new ConfigurationException("Action class [" + className + "] does not have a public no-arg constructor", e, loc);
+        } catch (RuntimeException ex) {
+            // Probably not a big deal, like request or session-scoped Spring 2 beans that need a real request
+            LOG.info("Unable to verify action class [" + className + "] exists at initialization");
+            if (LOG.isDebugEnabled()) {
+                LOG.debug("Action verification cause", ex);
+            }
+        } catch (Exception ex) {
+            // Default to failing fast
+            if (LOG.isDebugEnabled()) {
+                LOG.debug("Unable to verify action class [" + className + "]", ex);
+            }
+            throw new ConfigurationException(ex, loc);
+        }
+        return true;
+    }
+
+    /**
+     * Create a PackageConfig from an XML element representing it.
+     */
+    protected PackageConfig addPackage(Element packageElement) throws ConfigurationException {
+        PackageConfig.Builder newPackage = buildPackageContext(packageElement);
+
+        if (newPackage.isNeedsRefresh()) {
+            return newPackage.build();
+        }
+
+        if (LOG.isDebugEnabled()) {
+            LOG.debug("Loaded " + newPackage);
+        }
+
+        // add result types (and default result) to this package
+        addResultTypes(newPackage, packageElement);
+
+        // load the interceptors and interceptor stacks for this package
+        loadInterceptors(newPackage, packageElement);
+
+        // load the default interceptor reference for this package
+        loadDefaultInterceptorRef(newPackage, packageElement);
+
+        // load the default class ref for this package
+        loadDefaultClassRef(newPackage, packageElement);
+
+        // load the global result list for this package
+        loadGlobalResults(newPackage, packageElement);
+
+        // load the global exception handler list for this package
+        loadGobalExceptionMappings(newPackage, packageElement);
+
+        // get actions
+        NodeList actionList = packageElement.getElementsByTagName("action");
+
+        for (int i = 0; i < actionList.getLength(); i++) {
+            Element actionElement = (Element) actionList.item(i);
+            addAction(actionElement, newPackage);
+        }
+
+        // load the default action reference for this package
+        loadDefaultActionRef(newPackage, packageElement);
+
+        PackageConfig cfg = newPackage.build();
+        configuration.addPackageConfig(cfg.getName(), cfg);
+        return cfg;
+    }
+
+    protected void addResultTypes(PackageConfig.Builder packageContext, Element element) {
+        NodeList resultTypeList = element.getElementsByTagName("result-type");
+
+        for (int i = 0; i < resultTypeList.getLength(); i++) {
+            Element resultTypeElement = (Element) resultTypeList.item(i);
+            String name = resultTypeElement.getAttribute("name");
+            String className = resultTypeElement.getAttribute("class");
+            String def = resultTypeElement.getAttribute("default");
+
+            Location loc = DomHelper.getLocationObject(resultTypeElement);
+
+            Class clazz = verifyResultType(className, loc);
+            if (clazz != null) {
+                String paramName = null;
+                try {
+                    paramName = (String) clazz.getField("DEFAULT_PARAM").get(null);
+                }
+                catch (Throwable t) {
+                    // if we get here, the result type doesn't have a default param defined.
+                }
+                ResultTypeConfig.Builder resultType = new ResultTypeConfig.Builder(name, className).defaultResultParam(paramName)
+                        .location(DomHelper.getLocationObject(resultTypeElement));
+
+                Map<String, String> params = XmlHelper.getParams(resultTypeElement);
+
+                if (!params.isEmpty()) {
+                    resultType.addParams(params);
+                }
+                packageContext.addResultTypeConfig(resultType.build());
+
+                // set the default result type
+                if ("true".equals(def)) {
+                    packageContext.defaultResultType(name);
+                }
+            }
+        }
+    }
+
+    protected Class verifyResultType(String className, Location loc) {
+        try {
+            return objectFactory.getClassInstance(className);
+        } catch (ClassNotFoundException e) {
+            LOG.warn("Result class [" + className + "] doesn't exist (ClassNotFoundException) at " +
+                    loc.toString() + ", ignoring", e);
+        } catch (NoClassDefFoundError e) {
+            LOG.warn("Result class [" + className + "] doesn't exist (NoClassDefFoundError) at " +
+                    loc.toString() + ", ignoring", e);
+        }
+
+        return null;
+    }
+
+    protected List<InterceptorMapping> buildInterceptorList(Element element, PackageConfig.Builder context) throws ConfigurationException {
+        List<InterceptorMapping> interceptorList = new ArrayList<InterceptorMapping>();
+        NodeList interceptorRefList = element.getElementsByTagName("interceptor-ref");
+
+        for (int i = 0; i < interceptorRefList.getLength(); i++) {
+            Element interceptorRefElement = (Element) interceptorRefList.item(i);
+
+            if (interceptorRefElement.getParentNode().equals(element) || interceptorRefElement.getParentNode().getNodeName().equals(element.getNodeName())) {
+                List<InterceptorMapping> interceptors = lookupInterceptorReference(context, interceptorRefElement);
+                interceptorList.addAll(interceptors);
+            }
+        }
+
+        return interceptorList;
+    }
+
+    /**
+     * This method builds a package context by looking for the parents of this new package.
+     * <p/>
+     * If no parents are found, it will return a root package.
+     */
+    protected PackageConfig.Builder buildPackageContext(Element packageElement) {
+        String parent = packageElement.getAttribute("extends");
+        String abstractVal = packageElement.getAttribute("abstract");
+        boolean isAbstract = Boolean.valueOf(abstractVal).booleanValue();
+        String name = StringUtils.defaultString(packageElement.getAttribute("name"));
+        String namespace = StringUtils.defaultString(packageElement.getAttribute("namespace"));
+
+
+        if (StringUtils.isNotEmpty(packageElement.getAttribute("externalReferenceResolver"))) {
+            throw new ConfigurationException("The 'externalReferenceResolver' attribute has been removed.  Please use " +
+                    "a custom ObjectFactory or Interceptor.", packageElement);
+        }
+
+        PackageConfig.Builder cfg = new PackageConfig.Builder(name)
+                .namespace(namespace)
+                .isAbstract(isAbstract)
+                .location(DomHelper.getLocationObject(packageElement));
+
+
+        if (StringUtils.isNotEmpty(StringUtils.defaultString(parent))) { // has parents, let's look it up
+
+            List<PackageConfig> parents = ConfigurationUtil.buildParentsFromString(configuration, parent);
+
+            if (parents.size() <= 0) {
+                cfg.needsRefresh(true);
+            } else {
+                cfg.addParents(parents);
+            }
+        }
+
+        return cfg;
+    }
+
+    /**
+     * Build a map of ResultConfig objects from below a given XML element.
+     */
+    protected Map<String, ResultConfig> buildResults(Element element, PackageConfig.Builder packageContext) {
+        NodeList resultEls = element.getElementsByTagName("result");
+
+        Map<String, ResultConfig> results = new LinkedHashMap<String, ResultConfig>();
+
+        for (int i = 0; i < resultEls.getLength(); i++) {
+            Element resultElement = (Element) resultEls.item(i);
+
+            if (resultElement.getParentNode().equals(element) || resultElement.getParentNode().getNodeName().equals(element.getNodeName())) {
+                String resultName = resultElement.getAttribute("name");
+                String resultType = resultElement.getAttribute("type");
+
+                // if you don't specify a name on <result/>, it defaults to "success"
+                if (StringUtils.isEmpty(resultName)) {
+                    resultName = Action.SUCCESS;
+                }
+
+                // there is no result type, so let's inherit from the parent package
+                if (StringUtils.isEmpty(resultType)) {
+                    resultType = packageContext.getFullDefaultResultType();
+
+                    // now check if there is a result type now
+                    if (StringUtils.isEmpty(resultType)) {
+                        // uh-oh, we have a problem
+                        throw new ConfigurationException("No result type specified for result named '"
+                                + resultName + "', perhaps the parent package does not specify the result type?", resultElement);
+                    }
+                }
+
+
+                ResultTypeConfig config = packageContext.getResultType(resultType);
+
+                if (config == null) {
+                    throw new ConfigurationException("There is no result type defined for type '" + resultType
+                            + "' mapped with name '" + resultName + "'."
+                            + "  Did you mean '" + guessResultType(resultType) + "'?", resultElement);
+                }
+
+                String resultClass = config.getClazz();
+
+                // invalid result type specified in result definition
+                if (resultClass == null) {
+                    throw new ConfigurationException("Result type '" + resultType + "' is invalid");
+                }
+
+                Map<String, String> resultParams = XmlHelper.getParams(resultElement);
+
+                if (resultParams.size() == 0) // maybe we just have a body - therefore a default parameter
+                {
+                    // if <result ...>something</result> then we add a parameter of 'something' as this is the most used result param
+                    if (resultElement.getChildNodes().getLength() >= 1) {
+                        resultParams = new LinkedHashMap<String, String>();
+
+                        String paramName = config.getDefaultResultParam();
+                        if (paramName != null) {
+                            StringBuilder paramValue = new StringBuilder();
+                            for (int j = 0; j < resultElement.getChildNodes().getLength(); j++) {
+                                if (resultElement.getChildNodes().item(j).getNodeType() == Node.TEXT_NODE) {
+                                    String val = resultElement.getChildNodes().item(j).getNodeValue();
+                                    if (val != null) {
+                                        paramValue.append(val);
+                                    }
+                                }
+                            }
+                            String val = paramValue.toString().trim();
+                            if (val.length() > 0) {
+                                resultParams.put(paramName, val);
+                            }
+                        } else {
+                            LOG.warn("no default parameter defined for result of type " + config.getName());
+                        }
+                    }
+                }
+
+                // create new param map, so that the result param can override the config param
+                Map<String, String> params = new LinkedHashMap<String, String>();
+                Map<String, String> configParams = config.getParams();
+                if (configParams != null) {
+                    params.putAll(configParams);
+                }
+                params.putAll(resultParams);
+
+                ResultConfig resultConfig = new ResultConfig.Builder(resultName, resultClass)
+                        .addParams(params)
+                        .location(DomHelper.getLocationObject(element))
+                        .build();
+                results.put(resultConfig.getName(), resultConfig);
+            }
+        }
+
+        return results;
+    }
+
+    protected String guessResultType(String type) {
+        StringBuilder sb = null;
+        if (type != null) {
+            sb = new StringBuilder();
+            boolean capNext = false;
+            for (int x=0; x<type.length(); x++) {
+                char c = type.charAt(x);
+                if (c == '-') {
+                    capNext = true;
+                    continue;
+                } else if (Character.isLowerCase(c) && capNext) {
+                    c = Character.toUpperCase(c);
+                    capNext = false;
+                }
+                sb.append(c);
+            }
+        }
+        return (sb != null ? sb.toString() : null);
+    }
+
+    /**
+     * Build a map of ResultConfig objects from below a given XML element.
+     */
+    protected List<ExceptionMappingConfig> buildExceptionMappings(Element element, PackageConfig.Builder packageContext) {
+        NodeList exceptionMappingEls = element.getElementsByTagName("exception-mapping");
+
+        List<ExceptionMappingConfig> exceptionMappings = new ArrayList<ExceptionMappingConfig>();
+
+        for (int i = 0; i < exceptionMappingEls.getLength(); i++) {
+            Element ehElement = (Element) exceptionMappingEls.item(i);
+
+            if (ehElement.getParentNode().equals(element) || ehElement.getParentNode().getNodeName().equals(element.getNodeName())) {
+                String emName = ehElement.getAttribute("name");
+                String exceptionClassName = ehElement.getAttribute("exception");
+                String exceptionResult = ehElement.getAttribute("result");
+
+                Map<String, String> params = XmlHelper.getParams(ehElement);
+
+                if (StringUtils.isEmpty(emName)) {
+                    emName = exceptionResult;
+                }
+
+                ExceptionMappingConfig ehConfig = new ExceptionMappingConfig.Builder(emName, exceptionClassName, exceptionResult)
+                        .addParams(params)
+                        .location(DomHelper.getLocationObject(ehElement))
+                        .build();
+                exceptionMappings.add(ehConfig);
+            }
+        }
+
+        return exceptionMappings;
+    }
+
+
+    protected void loadDefaultInterceptorRef(PackageConfig.Builder packageContext, Element element) {
+        NodeList resultTypeList = element.getElementsByTagName("default-interceptor-ref");
+
+        if (resultTypeList.getLength() > 0) {
+            Element defaultRefElement = (Element) resultTypeList.item(0);
+            packageContext.defaultInterceptorRef(defaultRefElement.getAttribute("name"));
+        }
+    }
+
+    protected void loadDefaultActionRef(PackageConfig.Builder packageContext, Element element) {
+        NodeList resultTypeList = element.getElementsByTagName("default-action-ref");
+
+        if (resultTypeList.getLength() > 0) {
+            Element defaultRefElement = (Element) resultTypeList.item(0);
+            packageContext.defaultActionRef(defaultRefElement.getAttribute("name"));
+        }
+    }
+
+    /**
+     * Load all of the global results for this package from the XML element.
+     */
+    protected void loadGlobalResults(PackageConfig.Builder packageContext, Element packageElement) {
+        NodeList globalResultList = packageElement.getElementsByTagName("global-results");
+
+        if (globalResultList.getLength() > 0) {
+            Element globalResultElement = (Element) globalResultList.item(0);
+            Map<String, ResultConfig> results = buildResults(globalResultElement, packageContext);
+            packageContext.addGlobalResultConfigs(results);
+        }
+    }
+
+    protected void loadDefaultClassRef(PackageConfig.Builder packageContext, Element element) {
+        NodeList defaultClassRefList = element.getElementsByTagName("default-class-ref");
+        if (defaultClassRefList.getLength() > 0) {
+            Element defaultClassRefElement = (Element) defaultClassRefList.item(0);
+            packageContext.defaultClassRef(defaultClassRefElement.getAttribute("class"));
+        }
+    }
+
+    /**
+     * Load all of the global results for this package from the XML element.
+     */
+    protected void loadGobalExceptionMappings(PackageConfig.Builder packageContext, Element packageElement) {
+        NodeList globalExceptionMappingList = packageElement.getElementsByTagName("global-exception-mappings");
+
+        if (globalExceptionMappingList.getLength() > 0) {
+            Element globalExceptionMappingElement = (Element) globalExceptionMappingList.item(0);
+            List<ExceptionMappingConfig> exceptionMappings = buildExceptionMappings(globalExceptionMappingElement, packageContext);
+            packageContext.addGlobalExceptionMappingConfigs(exceptionMappings);
+        }
+    }
+
+    //    protected void loadIncludes(Element rootElement, DocumentBuilder db) throws Exception {
+    //        NodeList includeList = rootElement.getElementsByTagName("include");
+    //
+    //        for (int i = 0; i < includeList.getLength(); i++) {
+    //            Element includeElement = (Element) includeList.item(i);
+    //            String fileName = includeElement.getAttribute("file");
+    //            includedFileNames.add(fileName);
+    //            loadConfigurationFile(fileName, db);
+    //        }
+    //    }
+    protected InterceptorStackConfig loadInterceptorStack(Element element, PackageConfig.Builder context) throws ConfigurationException {
+        String name = element.getAttribute("name");
+
+        InterceptorStackConfig.Builder config = new InterceptorStackConfig.Builder(name)
+                .location(DomHelper.getLocationObject(element));
+        NodeList interceptorRefList = element.getElementsByTagName("interceptor-ref");
+
+        for (int j = 0; j < interceptorRefList.getLength(); j++) {
+            Element interceptorRefElement = (Element) interceptorRefList.item(j);
+            List<InterceptorMapping> interceptors = lookupInterceptorReference(context, interceptorRefElement);
+            config.addInterceptors(interceptors);
+        }
+
+        return config.build();
+    }
+
+    protected void loadInterceptorStacks(Element element, PackageConfig.Builder context) throws ConfigurationException {
+        NodeList interceptorStackList = element.getElementsByTagName("interceptor-stack");
+
+        for (int i = 0; i < interceptorStackList.getLength(); i++) {
+            Element interceptorStackElement = (Element) interceptorStackList.item(i);
+
+            InterceptorStackConfig config = loadInterceptorStack(interceptorStackElement, context);
+
+            context.addInterceptorStackConfig(config);
+        }
+    }
+
+    protected void loadInterceptors(PackageConfig.Builder context, Element element) throws ConfigurationException {
+        NodeList interceptorList = element.getElementsByTagName("interceptor");
+
+        for (int i = 0; i < interceptorList.getLength(); i++) {
+            Element interceptorElement = (Element) interceptorList.item(i);
+            String name = interceptorElement.getAttribute("name");
+            String className = interceptorElement.getAttribute("class");
+
+            Map<String, String> params = XmlHelper.getParams(interceptorElement);
+            InterceptorConfig config = new InterceptorConfig.Builder(name, className)
+                    .addParams(params)
+                    .location(DomHelper.getLocationObject(interceptorElement))
+                    .build();
+
+            context.addInterceptorConfig(config);
+        }
+
+        loadInterceptorStacks(element, context);
+    }
+
+    //    protected void loadPackages(Element rootElement) throws ConfigurationException {
+    //        NodeList packageList = rootElement.getElementsByTagName("package");
+    //
+    //        for (int i = 0; i < packageList.getLength(); i++) {
+    //            Element packageElement = (Element) packageList.item(i);
+    //            addPackage(packageElement);
+    //        }
+    //    }
+    private List<Document> loadConfigurationFiles(String fileName, Element includeElement) {
+        List<Document> docs = new ArrayList<Document>();
+        List<Document> finalDocs = new ArrayList<Document>();
+        if (!includedFileNames.contains(fileName)) {
+            if (LOG.isDebugEnabled()) {
+                LOG.debug("Loading action configurations from: " + fileName);
+            }
+
+            includedFileNames.add(fileName);
+
+            Iterator<URL> urls = null;
+            InputStream is = null;
+
+            IOException ioException = null;
+            try {
+                urls = getConfigurationUrls(fileName);
+            } catch (IOException ex) {
+                ioException = ex;
+            }
+
+            if (urls == null || !urls.hasNext()) {
+                if (errorIfMissing) {
+                    throw new ConfigurationException("Could not open files of the name " + fileName, ioException);
+                } else {
+                    LOG.info("Unable to locate configuration files of the name "
+                            + fileName + ", skipping");
+                    return docs;
+                }
+            }
+
+            URL url = null;
+            while (urls.hasNext()) {
+                try {
+                    url = urls.next();
+                    is = FileManager.loadFile(url);
+
+                    InputSource in = new InputSource(is);
+
+                    in.setSystemId(url.toString());
+
+                    docs.add(DomHelper.parse(in, dtdMappings));
+                } catch (XWorkException e) {
+                    if (includeElement != null) {
+                        throw new ConfigurationException("Unable to load " + url, e, includeElement);
+                    } else {
+                        throw new ConfigurationException("Unable to load " + url, e);
+                    }
+                } catch (Exception e) {
+                    final String s = "Caught exception while loading file " + fileName;
+                    throw new ConfigurationException(s, e, includeElement);
+                } finally {
+                    if (is != null) {
+                        try {
+                            is.close();
+                        } catch (IOException e) {
+                            LOG.error("Unable to close input stream", e);
+                        }
+                    }
+                }
+            }
+
+            //sort the documents, according to the "order" attribute
+            Collections.sort(docs, new Comparator<Document>() {
+                public int compare(Document doc1, Document doc2) {
+                    return XmlHelper.getLoadOrder(doc1).compareTo(XmlHelper.getLoadOrder(doc2));
+                }
+            });
+
+            for (Document doc : docs) {
+                Element rootElement = doc.getDocumentElement();
+                NodeList children = rootElement.getChildNodes();
+                int childSize = children.getLength();
+
+                for (int i = 0; i < childSize; i++) {
+                    Node childNode = children.item(i);
+
+                    if (childNode instanceof Element) {
+                        Element child = (Element) childNode;
+
+                        final String nodeName = child.getNodeName();
+
+                        if ("include".equals(nodeName)) {
+                            String includeFileName = child.getAttribute("file");
+                            if (includeFileName.indexOf('*') != -1) {
+                                // handleWildCardIncludes(includeFileName, docs, child);
+                                ClassPathFinder wildcardFinder = new ClassPathFinder();
+                                wildcardFinder.setPattern(includeFileName);
+                                Vector<String> wildcardMatches = wildcardFinder.findMatches();
+                                for (String match : wildcardMatches) {
+                                    finalDocs.addAll(loadConfigurationFiles(match, child));
+                                }
+                            } else {
+                                finalDocs.addAll(loadConfigurationFiles(includeFileName, child));
+                            }
+                        }
+                    }
+                }
+                finalDocs.add(doc);
+                loadedFileUrls.add(url.toString());
+            }
+
+            if (LOG.isDebugEnabled()) {
+                LOG.debug("Loaded action configuration from: " + fileName);
+            }
+        }
+        return finalDocs;
+    }
+
+    protected Iterator<URL> getConfigurationUrls(String fileName) throws IOException {
+        return ClassLoaderUtil.getResources(fileName, XmlConfigurationProvider.class, false);
+    }
+
+    /**
+     * Allows subclasses to load extra information from the document
+     *
+     * @param doc The configuration document
+     */
+    protected void loadExtraConfiguration(Document doc) {
+        // no op
+    }
+
+    /**
+     * Looks up the Interceptor Class from the interceptor-ref name and creates an instance, which is added to the
+     * provided List, or, if this is a ref to a stack, it adds the Interceptor instances from the List to this stack.
+     *
+     * @param interceptorRefElement Element to pull interceptor ref data from
+     * @param context               The PackageConfig to lookup the interceptor from
+     * @return A list of Interceptor objects
+     */
+    private List<InterceptorMapping> lookupInterceptorReference(PackageConfig.Builder context, Element interceptorRefElement) throws ConfigurationException {
+        String refName = interceptorRefElement.getAttribute("name");
+        Map<String, String> refParams = XmlHelper.getParams(interceptorRefElement);
+
+        Location loc = LocationUtils.getLocation(interceptorRefElement);
+        return InterceptorBuilder.constructInterceptorReference(context, refName, refParams, loc, objectFactory);
+    }
+
+    List<Document> getDocuments() {
+        return documents;
+    }
+}

Propchange: struts/xwork/trunk/core/src/main/java/com/opensymphony/xwork2/config/providers/XmlConfigurationProvider.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: struts/xwork/trunk/core/src/main/java/com/opensymphony/xwork2/config/providers/XmlConfigurationProvider.java
------------------------------------------------------------------------------
    svn:keywords = Date Author Id Revision HeadURL

Added: struts/xwork/trunk/core/src/main/java/com/opensymphony/xwork2/config/providers/XmlHelper.java
URL: http://svn.apache.org/viewvc/struts/xwork/trunk/core/src/main/java/com/opensymphony/xwork2/config/providers/XmlHelper.java?rev=894087&view=auto
==============================================================================
--- struts/xwork/trunk/core/src/main/java/com/opensymphony/xwork2/config/providers/XmlHelper.java (added)
+++ struts/xwork/trunk/core/src/main/java/com/opensymphony/xwork2/config/providers/XmlHelper.java Sun Dec 27 18:00:13 2009
@@ -0,0 +1,117 @@
+/*
+ * Copyright (c) 2002-2006 by OpenSymphony
+ * All rights reserved.
+ */
+package com.opensymphony.xwork2.config.providers;
+
+import org.w3c.dom.Element;
+import org.w3c.dom.Node;
+import org.w3c.dom.NodeList;
+import org.w3c.dom.Document;
+import org.apache.commons.lang.StringUtils;
+
+import java.util.LinkedHashMap;
+import java.util.Map;
+
+
+/**
+ * XML utilities.
+ *
+ * @author Mike
+ */
+public class XmlHelper {
+
+
+    /**
+     * This method will find all the parameters under this <code>paramsElement</code> and return them as
+     * Map<String, String>. For example,
+     * <pre>
+     *   <result ... >
+     *      <param name="param1">value1</param>
+     *      <param name="param2">value2</param>
+     *      <param name="param3">value3</param>
+     *   </result>
+     * </pre>
+     * will returns a Map<String, String> with the following key, value pairs :-
+     * <ul>
+     * <li>param1 - value1</li>
+     * <li>param2 - value2</li>
+     * <li>param3 - value3</li>
+     * </ul>
+     *
+     * @param paramsElement
+     * @return
+     */
+    public static Map<String, String> getParams(Element paramsElement) {
+        LinkedHashMap<String, String> params = new LinkedHashMap<String, String>();
+
+        if (paramsElement == null) {
+            return params;
+        }
+
+        NodeList childNodes = paramsElement.getChildNodes();
+
+        for (int i = 0; i < childNodes.getLength(); i++) {
+            Node childNode = childNodes.item(i);
+
+            if ((childNode.getNodeType() == Node.ELEMENT_NODE) && "param".equals(childNode.getNodeName())) {
+                Element paramElement = (Element) childNode;
+                String paramName = paramElement.getAttribute("name");
+
+                String val = getContent(paramElement);
+                if (val.length() > 0) {
+                    params.put(paramName, val);
+                }
+            }
+        }
+
+        return params;
+    }
+
+    /**
+     * This method will return the content of this particular <code>element</code>.
+     * For example,
+     * <p/>
+     * <pre>
+     *    <result>something_1</result>
+     * </pre>
+     * When the {@link org.w3c.dom.Element} <code>&lt;result&gt;</code> is passed in as
+     * argument (<code>element</code> to this method, it returns the content of it,
+     * namely, <code>something_1</code> in the example above.
+     *
+     * @return
+     */
+    public static String getContent(Element element) {
+        StringBuilder paramValue = new StringBuilder();
+        NodeList childNodes = element.getChildNodes();
+        for (int j = 0; j < childNodes.getLength(); j++) {
+            Node currentNode = childNodes.item(j);
+            if (currentNode != null &&
+                    currentNode.getNodeType() == Node.TEXT_NODE) {
+                String val = currentNode.getNodeValue();
+                if (val != null) {
+                    paramValue.append(val.trim());
+                }
+            }
+        }
+        return paramValue.toString().trim();
+    }
+
+    /**
+     * Return the value of the "order" attribute from the root element
+     */
+     public static Integer getLoadOrder(Document doc) {
+        Element rootElement = doc.getDocumentElement();
+        String number = rootElement.getAttribute("order");
+        if (StringUtils.isNotBlank(number)) {
+            try {
+                return Integer.parseInt(number);
+            } catch (NumberFormatException e) {
+                return Integer.MAX_VALUE;
+            }
+        } else {
+            //no order specified
+            return Integer.MAX_VALUE;
+        }
+    }
+}

Propchange: struts/xwork/trunk/core/src/main/java/com/opensymphony/xwork2/config/providers/XmlHelper.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: struts/xwork/trunk/core/src/main/java/com/opensymphony/xwork2/config/providers/XmlHelper.java
------------------------------------------------------------------------------
    svn:keywords = Date Author Id Revision HeadURL

Added: struts/xwork/trunk/core/src/main/java/com/opensymphony/xwork2/config/providers/package.html
URL: http://svn.apache.org/viewvc/struts/xwork/trunk/core/src/main/java/com/opensymphony/xwork2/config/providers/package.html?rev=894087&view=auto
==============================================================================
--- struts/xwork/trunk/core/src/main/java/com/opensymphony/xwork2/config/providers/package.html (added)
+++ struts/xwork/trunk/core/src/main/java/com/opensymphony/xwork2/config/providers/package.html Sun Dec 27 18:00:13 2009
@@ -0,0 +1 @@
+<body>Configuration provider classes.</body>

Propchange: struts/xwork/trunk/core/src/main/java/com/opensymphony/xwork2/config/providers/package.html
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: struts/xwork/trunk/core/src/main/java/com/opensymphony/xwork2/config/providers/package.html
------------------------------------------------------------------------------
    svn:keywords = Date Author Id Revision HeadURL

Added: struts/xwork/trunk/core/src/main/java/com/opensymphony/xwork2/conversion/NullHandler.java
URL: http://svn.apache.org/viewvc/struts/xwork/trunk/core/src/main/java/com/opensymphony/xwork2/conversion/NullHandler.java?rev=894087&view=auto
==============================================================================
--- struts/xwork/trunk/core/src/main/java/com/opensymphony/xwork2/conversion/NullHandler.java (added)
+++ struts/xwork/trunk/core/src/main/java/com/opensymphony/xwork2/conversion/NullHandler.java Sun Dec 27 18:00:13 2009
@@ -0,0 +1,54 @@
+//--------------------------------------------------------------------------
+//Copyright (c) 1998-2004, Drew Davidson and Luke Blanshard
+//All rights reserved.
+//
+//Redistribution and use in source and binary forms, with or without
+//modification, are permitted provided that the following conditions are
+//met:
+//
+//Redistributions of source code must retain the above copyright notice,
+//this list of conditions and the following disclaimer.
+//Redistributions in binary form must reproduce the above copyright
+//notice, this list of conditions and the following disclaimer in the
+//documentation and/or other materials provided with the distribution.
+//Neither the name of the Drew Davidson nor the names of its contributors
+//may be used to endorse or promote products derived from this software
+//without specific prior written permission.
+//
+//THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+//"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+//LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+//FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+//COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+//INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+//BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+//OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+//AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+//OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF
+//THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
+//DAMAGE.
+//--------------------------------------------------------------------------
+package com.opensymphony.xwork2.conversion;
+
+import java.util.Map;
+
+/**
+* Interface for handling null results from Chains.
+* Object has the opportunity to substitute an object for the
+* null and continue.
+* @author Luke Blanshard (blanshlu@netscape.net)
+* @author Drew Davidson (drew@ognl.org)
+*/
+public interface NullHandler
+{
+    /**
+        Method called on target returned null.
+     */
+    public Object nullMethodResult(Map<String, Object> context, Object target, String methodName, Object[] args);
+    
+    /**
+        Property in target evaluated to null.  Property can be a constant
+        String property name or a DynamicSubscript.
+     */
+    public Object nullPropertyValue(Map<String, Object> context, Object target, Object property);
+}
\ No newline at end of file

Propchange: struts/xwork/trunk/core/src/main/java/com/opensymphony/xwork2/conversion/NullHandler.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: struts/xwork/trunk/core/src/main/java/com/opensymphony/xwork2/conversion/NullHandler.java
------------------------------------------------------------------------------
    svn:keywords = Date Author Id Revision HeadURL

Added: struts/xwork/trunk/core/src/main/java/com/opensymphony/xwork2/conversion/ObjectTypeDeterminer.java
URL: http://svn.apache.org/viewvc/struts/xwork/trunk/core/src/main/java/com/opensymphony/xwork2/conversion/ObjectTypeDeterminer.java?rev=894087&view=auto
==============================================================================
--- struts/xwork/trunk/core/src/main/java/com/opensymphony/xwork2/conversion/ObjectTypeDeterminer.java (added)
+++ struts/xwork/trunk/core/src/main/java/com/opensymphony/xwork2/conversion/ObjectTypeDeterminer.java Sun Dec 27 18:00:13 2009
@@ -0,0 +1,25 @@
+/*
+ * Copyright (c) 2002-2007 by OpenSymphony
+ * All rights reserved.
+ */
+package com.opensymphony.xwork2.conversion;
+
+/**
+ * Determines what the key and and element class of a Map or Collection should be. For Maps, the elements are the
+ * values. For Collections, the elements are the elements of the collection.
+ * <p/>
+ * See the implementations for javadoc description for the methods as they are dependent on the concrete implementation.
+ *
+ * @author Gabriel Zimmerman
+ */
+public interface ObjectTypeDeterminer {
+
+    public Class getKeyClass(Class parentClass, String property);
+
+    public Class getElementClass(Class parentClass, String property, Object key);
+
+    public String getKeyProperty(Class parentClass, String property);
+    
+    public boolean shouldCreateIfNew(Class parentClass,  String property,  Object target, String keyProperty, boolean isIndexAccessed);
+
+}

Propchange: struts/xwork/trunk/core/src/main/java/com/opensymphony/xwork2/conversion/ObjectTypeDeterminer.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: struts/xwork/trunk/core/src/main/java/com/opensymphony/xwork2/conversion/ObjectTypeDeterminer.java
------------------------------------------------------------------------------
    svn:keywords = Date Author Id Revision HeadURL

Added: struts/xwork/trunk/core/src/main/java/com/opensymphony/xwork2/conversion/TypeConversionException.java
URL: http://svn.apache.org/viewvc/struts/xwork/trunk/core/src/main/java/com/opensymphony/xwork2/conversion/TypeConversionException.java?rev=894087&view=auto
==============================================================================
--- struts/xwork/trunk/core/src/main/java/com/opensymphony/xwork2/conversion/TypeConversionException.java (added)
+++ struts/xwork/trunk/core/src/main/java/com/opensymphony/xwork2/conversion/TypeConversionException.java Sun Dec 27 18:00:13 2009
@@ -0,0 +1,50 @@
+/*
+ * Copyright (c) 2002-2006 by OpenSymphony
+ * All rights reserved.
+ */
+package com.opensymphony.xwork2.conversion;
+
+import com.opensymphony.xwork2.XWorkException;
+
+
+/**
+ * TypeConversionException should be thrown by any TypeConverters which fail to convert values
+ *
+ * @author Jason Carreira
+ *         Created Oct 3, 2003 12:18:33 AM
+ */
+public class TypeConversionException extends XWorkException {
+
+    /**
+     * Constructs a <code>XWorkException</code> with no detail  message.
+     */
+    public TypeConversionException() {
+    }
+
+    /**
+     * Constructs a <code>XWorkException</code> with the specified
+     * detail message.
+     *
+     * @param s the detail message.
+     */
+    public TypeConversionException(String s) {
+        super(s);
+    }
+
+    /**
+     * Constructs a <code>XWorkException</code> with no detail  message.
+     */
+    public TypeConversionException(Throwable cause) {
+        super(cause);
+    }
+
+    /**
+     * Constructs a <code>XWorkException</code> with the specified
+     * detail message.
+     *
+     * @param s the detail message.
+     */
+    public TypeConversionException(String s, Throwable cause) {
+        super(s, cause);
+    }
+}

Propchange: struts/xwork/trunk/core/src/main/java/com/opensymphony/xwork2/conversion/TypeConversionException.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: struts/xwork/trunk/core/src/main/java/com/opensymphony/xwork2/conversion/TypeConversionException.java
------------------------------------------------------------------------------
    svn:keywords = Date Author Id Revision HeadURL

Added: struts/xwork/trunk/core/src/main/java/com/opensymphony/xwork2/conversion/TypeConverter.java
URL: http://svn.apache.org/viewvc/struts/xwork/trunk/core/src/main/java/com/opensymphony/xwork2/conversion/TypeConverter.java?rev=894087&view=auto
==============================================================================
--- struts/xwork/trunk/core/src/main/java/com/opensymphony/xwork2/conversion/TypeConverter.java (added)
+++ struts/xwork/trunk/core/src/main/java/com/opensymphony/xwork2/conversion/TypeConverter.java Sun Dec 27 18:00:13 2009
@@ -0,0 +1,64 @@
+//--------------------------------------------------------------------------
+//  Copyright (c) 1998-2004, Drew Davidson and Luke Blanshard
+//  All rights reserved.
+//
+//  Redistribution and use in source and binary forms, with or without
+//  modification, are permitted provided that the following conditions are
+//  met:
+//
+//  Redistributions of source code must retain the above copyright notice,
+//  this list of conditions and the following disclaimer.
+//  Redistributions in binary form must reproduce the above copyright
+//  notice, this list of conditions and the following disclaimer in the
+//  documentation and/or other materials provided with the distribution.
+//  Neither the name of the Drew Davidson nor the names of its contributors
+//  may be used to endorse or promote products derived from this software
+//  without specific prior written permission.
+//
+//  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+//  "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+//  LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+//  FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+//  COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+//  INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+//  BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+//  OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+//  AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+//  OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF
+//  THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
+//  DAMAGE.
+//--------------------------------------------------------------------------
+package com.opensymphony.xwork2.conversion;
+
+import java.lang.reflect.Member;
+import java.util.Map;
+
+/**
+ * Interface for accessing the type conversion facilities within a context.
+ * 
+ * This interface was copied from OGNL's TypeConverter
+ * 
+ * @author Luke Blanshard (blanshlu@netscape.net)
+ * @author Drew Davidson (drew@ognl.org)
+ */
+public interface TypeConverter
+{
+    /**
+       * Converts the given value to a given type.  The OGNL context, target, member and
+       * name of property being set are given.  This method should be able to handle
+       * conversion in general without any context, target, member or property name specified.
+       * @param context context under which the conversion is being done
+       * @param target target object in which the property is being set
+       * @param member member (Constructor, Method or Field) being set
+       * @param propertyName property name being set
+       * @param value value to be converted
+       * @param toType type to which value is converted
+       * @return Converted value of type toType or TypeConverter.NoConversionPossible to indicate that the
+                 conversion was not possible.
+     */
+    public Object convertValue(Map<String, Object> context, Object target, Member member, String propertyName, Object value, Class toType);
+    
+    public static final Object NO_CONVERSION_POSSIBLE = "ognl.NoConversionPossible";
+    
+    public static final String TYPE_CONVERTER_CONTEXT_KEY = "_typeConverter";
+}
\ No newline at end of file

Propchange: struts/xwork/trunk/core/src/main/java/com/opensymphony/xwork2/conversion/TypeConverter.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: struts/xwork/trunk/core/src/main/java/com/opensymphony/xwork2/conversion/TypeConverter.java
------------------------------------------------------------------------------
    svn:keywords = Date Author Id Revision HeadURL

Added: struts/xwork/trunk/core/src/main/java/com/opensymphony/xwork2/conversion/annotations/Conversion.java
URL: http://svn.apache.org/viewvc/struts/xwork/trunk/core/src/main/java/com/opensymphony/xwork2/conversion/annotations/Conversion.java?rev=894087&view=auto
==============================================================================
--- struts/xwork/trunk/core/src/main/java/com/opensymphony/xwork2/conversion/annotations/Conversion.java (added)
+++ struts/xwork/trunk/core/src/main/java/com/opensymphony/xwork2/conversion/annotations/Conversion.java Sun Dec 27 18:00:13 2009
@@ -0,0 +1,68 @@
+/*
+ * Copyright (c) 2002-2006 by OpenSymphony
+ * All rights reserved.
+ */
+package com.opensymphony.xwork2.conversion.annotations;
+
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+/**
+ * <!-- START SNIPPET: description -->
+ * <p/>A marker annotation for type conversions at Type level.
+ * <!-- END SNIPPET: description -->
+ *
+ * <p/> <u>Annotation usage:</u>
+ *
+ * <!-- START SNIPPET: usage -->
+ * <p/>The Conversion annotation must be applied at Type level.
+ * <!-- END SNIPPET: usage -->
+ *
+ * <p/> <u>Annotation parameters:</u>
+ *
+ * <!-- START SNIPPET: parameters -->
+ * <table>
+ * <thead>
+ * <tr>
+ * <th>Parameter</th>
+ * <th>Required</th>
+ * <th>Default</th>
+ * <th>Description</th>
+ * </tr>
+ * </thead>
+ * <tbody>
+ * <tr>
+ * <td>conversion</td>
+ * <td>no</td>
+ * <td>&nbsp;</td>
+ * <td>used for Type Conversions applied at Type level.</td>
+ * </tr>
+ * </tbody>
+ * </table>
+ * <!-- END SNIPPET: parameters -->
+ *
+ * <p/> <u>Example code:</u>
+ *
+ * <pre>
+ * <!-- START SNIPPET: example -->
+ * &#64;Conversion()
+ * public class ConversionAction implements Action {
+ * }
+ *
+ * <!-- END SNIPPET: example -->
+ * </pre>
+ *
+ * @author Rainer Hermanns
+ * @version $Id$
+ */
+@Target({ElementType.TYPE})
+@Retention(RetentionPolicy.RUNTIME)
+public @interface Conversion {
+
+    /**
+     * Allow Type Conversions being applied at Type level.
+     */
+    TypeConversion[] conversions() default {};
+}

Propchange: struts/xwork/trunk/core/src/main/java/com/opensymphony/xwork2/conversion/annotations/Conversion.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: struts/xwork/trunk/core/src/main/java/com/opensymphony/xwork2/conversion/annotations/Conversion.java
------------------------------------------------------------------------------
    svn:keywords = Date Author Id Revision HeadURL

Added: struts/xwork/trunk/core/src/main/java/com/opensymphony/xwork2/conversion/annotations/ConversionRule.java
URL: http://svn.apache.org/viewvc/struts/xwork/trunk/core/src/main/java/com/opensymphony/xwork2/conversion/annotations/ConversionRule.java?rev=894087&view=auto
==============================================================================
--- struts/xwork/trunk/core/src/main/java/com/opensymphony/xwork2/conversion/annotations/ConversionRule.java (added)
+++ struts/xwork/trunk/core/src/main/java/com/opensymphony/xwork2/conversion/annotations/ConversionRule.java Sun Dec 27 18:00:13 2009
@@ -0,0 +1,22 @@
+/*
+ * Copyright (c) 2002-2006 by OpenSymphony
+ * All rights reserved.
+ */
+package com.opensymphony.xwork2.conversion.annotations;
+
+/**
+ * <code>ConversionRule</code>
+ *
+ * @author Rainer Hermanns
+ * @version $Id$
+ */
+public enum ConversionRule {
+
+    PROPERTY, COLLECTION, MAP, KEY, KEY_PROPERTY, ELEMENT, CREATE_IF_NULL;
+
+    @Override
+    public String toString() {
+        return super.toString().toUpperCase();
+    }
+}
+

Propchange: struts/xwork/trunk/core/src/main/java/com/opensymphony/xwork2/conversion/annotations/ConversionRule.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: struts/xwork/trunk/core/src/main/java/com/opensymphony/xwork2/conversion/annotations/ConversionRule.java
------------------------------------------------------------------------------
    svn:keywords = Date Author Id Revision HeadURL

Added: struts/xwork/trunk/core/src/main/java/com/opensymphony/xwork2/conversion/annotations/ConversionType.java
URL: http://svn.apache.org/viewvc/struts/xwork/trunk/core/src/main/java/com/opensymphony/xwork2/conversion/annotations/ConversionType.java?rev=894087&view=auto
==============================================================================
--- struts/xwork/trunk/core/src/main/java/com/opensymphony/xwork2/conversion/annotations/ConversionType.java (added)
+++ struts/xwork/trunk/core/src/main/java/com/opensymphony/xwork2/conversion/annotations/ConversionType.java Sun Dec 27 18:00:13 2009
@@ -0,0 +1,23 @@
+/*
+ * Copyright (c) 2002-2006 by OpenSymphony
+ * All rights reserved.
+ */
+package com.opensymphony.xwork2.conversion.annotations;
+
+/**
+ * <code>ConversionType</code>
+ *
+ * @author <a href="mailto:hermanns@aixcept.de">Rainer Hermanns</a>
+ * @version $Id$
+ */
+public enum ConversionType {
+
+
+    APPLICATION, CLASS;
+
+    @Override
+    public String toString() {
+        return super.toString().toUpperCase();
+    }
+
+}

Propchange: struts/xwork/trunk/core/src/main/java/com/opensymphony/xwork2/conversion/annotations/ConversionType.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: struts/xwork/trunk/core/src/main/java/com/opensymphony/xwork2/conversion/annotations/ConversionType.java
------------------------------------------------------------------------------
    svn:keywords = Date Author Id Revision HeadURL

Added: struts/xwork/trunk/core/src/main/java/com/opensymphony/xwork2/conversion/annotations/TypeConversion.java
URL: http://svn.apache.org/viewvc/struts/xwork/trunk/core/src/main/java/com/opensymphony/xwork2/conversion/annotations/TypeConversion.java?rev=894087&view=auto
==============================================================================
--- struts/xwork/trunk/core/src/main/java/com/opensymphony/xwork2/conversion/annotations/TypeConversion.java (added)
+++ struts/xwork/trunk/core/src/main/java/com/opensymphony/xwork2/conversion/annotations/TypeConversion.java Sun Dec 27 18:00:13 2009
@@ -0,0 +1,167 @@
+/*
+ * Copyright (c) 2002-2006 by OpenSymphony
+ * All rights reserved.
+ */
+package com.opensymphony.xwork2.conversion.annotations;
+
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+/**
+ * <!-- START SNIPPET: description -->
+ * <p/>This annotation is used for class and application wide conversion rules.
+ * <p>
+ * Class wide conversion:<br/>
+ * The conversion rules will be assembled in a file called <code>XXXAction-conversion.properties</code>
+ * within the same package as the related action class.
+ * Set type to: <code>type = ConversionType.CLASS</code>
+ * </p>
+ * <p>
+ * Allication wide conversion:<br/>
+ * The conversion rules will be assembled within the <code>xwork-conversion.properties</code> file within the classpath root.
+ * Set type to: <code>type = ConversionType.APPLICATION</code>
+ * <p/>
+ * <!-- END SNIPPET: description -->
+ *
+ * <p/> <u>Annotation usage:</u>
+ *
+ * <!-- START SNIPPET: usage -->
+ * The TypeConversion annotation can be applied at property and method level.
+ * <!-- END SNIPPET: usage -->
+ *
+ * <p/> <u>Annotation parameters:</u>
+ *
+ * <!-- START SNIPPET: parameters -->
+ * <table>
+ * <thead>
+ * <tr>
+ * <th>Parameter</th>
+ * <th>Required</th>
+ * <th>Default</th>
+ * <th>Description</th>
+ * </tr>
+ * </thead>
+ * <tbody>
+ * <tr>
+ * <td>key</td>
+ * <td>no</td>
+ * <td>The annotated property/key name</td>
+ * <td>The optional property name mostly used within TYPE level annotations.</td>
+ * </tr>
+ * <tr>
+ * <td>type</td>
+ * <td>no</td>
+ * <td>ConversionType.CLASS</td>
+ * <td>Enum value of ConversionType.  Determines whether the conversion should be applied at application or class level.</td>
+ * </tr>
+ * <tr>
+ * <td>rule</td>
+ * <td>no</td>
+ * <td>ConversionRule.PROPERTY</td>
+ * <td>Enum value of ConversionRule. The ConversionRule can be a property, a Collection or a Map.</td>
+ * </tr>
+ * <tr>
+ * <td>converter</td>
+ * <td>either this or value</td>
+ * <td>&nbsp;</td>
+ * <td>The class name of the TypeConverter to be used as converter.</td>
+ * </tr>
+ * <tr>
+ * <td>value</td>
+ * <td>either converter or this</td>
+ * <td>&nbsp;</td>
+ * <td>The value to set for ConversionRule.KEY_PROPERTY.</td>
+ * </tr>
+ * </tbody>
+ * </table>
+ *
+ * <!-- END SNIPPET: parameters -->
+ *
+ * <p/> <u>Example code:</u>
+ *
+ * <pre>
+ * <!-- START SNIPPET: example -->
+ * &#64;Conversion()
+ * public class ConversionAction implements Action {
+ *
+ *   private String convertInt;
+ *
+ *   private String convertDouble;
+ *   private List users = null;
+ *
+ *   private HashMap keyValues = null;
+ *
+ *   &#64;TypeConversion(type = ConversionType.APPLICATION, converter = "com.opensymphony.xwork2.util.XWorkBasicConverter")
+ *   public void setConvertInt( String convertInt ) {
+ *       this.convertInt = convertInt;
+ *   }
+ *
+ *   &#64;TypeConversion(converter = "com.opensymphony.xwork2.util.XWorkBasicConverter")
+ *   public void setConvertDouble( String convertDouble ) {
+ *       this.convertDouble = convertDouble;
+ *   }
+ *
+ *   &#64;TypeConversion(rule = ConversionRule.COLLECTION, converter = "java.util.String")
+ *   public void setUsers( List users ) {
+ *       this.users = users;
+ *   }
+ *
+ *   &#64;TypeConversion(rule = ConversionRule.MAP, converter = "java.math.BigInteger")
+ *   public void setKeyValues( HashMap keyValues ) {
+ *       this.keyValues = keyValues;
+ *   }
+ *
+ *   &#64;TypeConversion(type = ConversionType.APPLICATION, property = "java.util.Date", converter = "com.opensymphony.xwork2.util.XWorkBasicConverter")
+ *   public String execute() throws Exception {
+ *       return SUCCESS;
+ *   }
+ * }
+ * <!-- END SNIPPET: example -->
+ * </pre>
+ *
+ * @author Rainer Hermanns
+ * @version $Id$
+ */
+@Target({ ElementType.METHOD})
+@Retention(RetentionPolicy.RUNTIME)
+public @interface TypeConversion {
+
+    /**
+     * The optional key name used within TYPE level annotations.
+     * Defaults to the property name.
+     */
+    String key() default "";
+
+    /**
+     * The ConversionType can be either APPLICATION or CLASS.
+     * Defaults to CLASS.
+     *
+     * Note: If you use ConversionType.APPLICATION, you can not set a value!
+     */
+    ConversionType type() default ConversionType.CLASS;
+
+    /**
+     * The ConversionRule can be a PROPERTY, KEY, KEY_PROPERTY, ELEMENT, COLLECTION (deprecated) or a MAP.
+     * Note: Collection and Map vonversion rules can be determined via com.opensymphony.xwork2.util.DefaultObjectTypeDeterminer.
+     *
+     * @see com.opensymphony.xwork2.conversion.impl.DefaultObjectTypeDeterminer
+     */
+    ConversionRule rule() default ConversionRule.PROPERTY;
+
+    /**
+     * The class of the TypeConverter to be used as converter.
+     *
+     * Note: This can not be used with ConversionRule.KEY_PROPERTY! 
+     */
+    String converter() default "";
+
+    /**
+     * If used with ConversionRule.KEY_PROPERTY specify a value here!
+     *
+     * Note: If you use ConversionType.APPLICATION, you can not set a value!
+     */
+    String value() default "";
+
+}

Propchange: struts/xwork/trunk/core/src/main/java/com/opensymphony/xwork2/conversion/annotations/TypeConversion.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: struts/xwork/trunk/core/src/main/java/com/opensymphony/xwork2/conversion/annotations/TypeConversion.java
------------------------------------------------------------------------------
    svn:keywords = Date Author Id Revision HeadURL

Added: struts/xwork/trunk/core/src/main/java/com/opensymphony/xwork2/conversion/annotations/package.html
URL: http://svn.apache.org/viewvc/struts/xwork/trunk/core/src/main/java/com/opensymphony/xwork2/conversion/annotations/package.html?rev=894087&view=auto
==============================================================================
--- struts/xwork/trunk/core/src/main/java/com/opensymphony/xwork2/conversion/annotations/package.html (added)
+++ struts/xwork/trunk/core/src/main/java/com/opensymphony/xwork2/conversion/annotations/package.html Sun Dec 27 18:00:13 2009
@@ -0,0 +1 @@
+<body>Type conversion annotations.</body>

Propchange: struts/xwork/trunk/core/src/main/java/com/opensymphony/xwork2/conversion/annotations/package.html
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: struts/xwork/trunk/core/src/main/java/com/opensymphony/xwork2/conversion/annotations/package.html
------------------------------------------------------------------------------
    svn:keywords = Date Author Id Revision HeadURL

Added: struts/xwork/trunk/core/src/main/java/com/opensymphony/xwork2/conversion/impl/AnnotationXWorkConverter.java
URL: http://svn.apache.org/viewvc/struts/xwork/trunk/core/src/main/java/com/opensymphony/xwork2/conversion/impl/AnnotationXWorkConverter.java?rev=894087&view=auto
==============================================================================
--- struts/xwork/trunk/core/src/main/java/com/opensymphony/xwork2/conversion/impl/AnnotationXWorkConverter.java (added)
+++ struts/xwork/trunk/core/src/main/java/com/opensymphony/xwork2/conversion/impl/AnnotationXWorkConverter.java Sun Dec 27 18:00:13 2009
@@ -0,0 +1,80 @@
+/*
+ * Copyright (c) 2002-2006 by OpenSymphony
+ * All rights reserved.
+ */
+package com.opensymphony.xwork2.conversion.impl;
+
+/**
+ * <!-- START SNIPPET: javadoc -->
+ * <p/>
+ * Type conversion is great for situations where you need to turn a String in to a more complex object. Because the web
+ * is type-agnostic (everything is a string in HTTP), XWork's type conversion features are very useful. For instance,
+ * if you were prompting a user to enter in coordinates in the form of a string (such as "3, 22"), you could have
+ * XWork do the conversion both from String to Point and from Point to String.
+ * <p/>
+ * <p/> Using this "point" example, if your action (or another compound object in which you are setting properties on)
+ * has a corresponding ClassName-conversion.properties file, XWork will use the configured type converters for
+ * conversion to and from strings. So turning "3, 22" in to new Point(3, 22) is done by merely adding the following
+ * entry to <b>ClassName-conversion.properties</b> (Note that the PointConverter should impl the TypeConverter
+ * interface):
+ * <p/>
+ * <p/><b>point = com.acme.PointConverter</b>
+ * <p/>
+ * <p/> Your type converter should be sure to check what class type it is being requested to convert. Because it is used
+ * for both to and from strings, you will need to split the conversion method in to two parts: one that turns Strings in
+ * to Points, and one that turns Points in to Strings.
+ * <p/>
+ * <p/> After this is done, you can now reference your point (using &lt;ww:property value="post"/&gt; in JSP or ${point}
+ * in FreeMarker) and it will be printed as "3, 22" again. As such, if you submit this back to an action, it will be
+ * converted back to a Point once again.
+ * <p/>
+ * <p/> In some situations you may wish to apply a type converter globally. This can be done by editing the file
+ * <b>xwork-conversion.properties</b> in the root of your class path (typically WEB-INF/classes) and providing a
+ * property in the form of the class name of the object you wish to convert on the left hand side and the class name of
+ * the type converter on the right hand side. For example, providing a type converter for all Point objects would mean
+ * adding the following entry:
+ * <p/>
+ * <p/><b>com.acme.Point = com.acme.PointConverter</b>
+ * <p/>
+ * <!-- END SNIPPET: javadoc -->
+ * <p/>
+ * <p/>
+ * <p/>
+ * <!-- START SNIPPET: i18n-note -->
+ * <p/>
+ * Type conversion should not be used as a substitute for i18n. It is not recommended to use this feature to print out
+ * properly formatted dates. Rather, you should use the i18n features of XWork (and consult the JavaDocs for JDK's
+ * MessageFormat object) to see how a properly formatted date should be displayed.
+ * <p/>
+ * <!-- END SNIPPET: i18n-note -->
+ * <p/>
+ * <p/>
+ * <p/>
+ * <!-- START SNIPPET: error-reporting -->
+ * <p/>
+ * Any error that occurs during type conversion may or may not wish to be reported. For example, reporting that the
+ * input "abc" could not be converted to a number might be important. On the other hand, reporting that an empty string,
+ * "", cannot be converted to a number might not be important - especially in a web environment where it is hard to
+ * distinguish between a user not entering a value vs. entering a blank value.
+ * <p/>
+ * <p/> By default, all conversion errors are reported using the generic i18n key <b>xwork.default.invalid.fieldvalue</b>,
+ * which you can override (the default text is <i>Invalid field value for field "xxx"</i>, where xxx is the field name)
+ * in your global i18n resource bundle.
+ * <p/>
+ * <p/>However, sometimes you may wish to override this message on a per-field basis. You can do this by adding an i18n
+ * key associated with just your action (Action.properties) using the pattern <b>invalid.fieldvalue.xxx</b>, where xxx
+ * is the field name.
+ * <p/>
+ * <p/>It is important to know that none of these errors are actually reported directly. Rather, they are added to a map
+ * called <i>conversionErrors</i> in the ActionContext. There are several ways this map can then be accessed and the
+ * errors can be reported accordingly.
+ * <p/>
+ * <!-- END SNIPPET: error-reporting -->
+ *
+ * @author <a href="mailto:plightbo@gmail.com">Pat Lightbody</a>
+ * @author Rainer Hermanns
+ * @see com.opensymphony.xwork2.conversion.impl.XWorkConverter
+ * @deprecated Since XWork 2.0.4, the implementation of XWorkConverter handles the processing of annotations.
+ */
+@Deprecated public class AnnotationXWorkConverter extends XWorkConverter {
+}

Propchange: struts/xwork/trunk/core/src/main/java/com/opensymphony/xwork2/conversion/impl/AnnotationXWorkConverter.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: struts/xwork/trunk/core/src/main/java/com/opensymphony/xwork2/conversion/impl/AnnotationXWorkConverter.java
------------------------------------------------------------------------------
    svn:keywords = Date Author Id Revision HeadURL