Commits

Anonymous committed f25eeb0

Issue number:
Obtained from:
Submitted by:
Reviewed by:
CVS: ----------------------------------------------------------------------
CVS: Issue number:
CVS: If this change addresses one or more issues,
CVS: then enter the issue number(s) here.
CVS: Obtained from:
CVS: If this change has been taken from another system,
CVS: then name the system in this line, otherwise delete it.
CVS: Submitted by:
CVS: If this code has been contributed to the project by someone else; i.e.,
CVS: they sent us a patch or a set of diffs, then include their name/email
CVS: address here. If this is your work then delete this line.
CVS: Reviewed by:
CVS: If we are doing pre-commit code reviews and someone else has
CVS: reviewed your changes, include their name(s) here.
CVS: If you have not had it reviewed then delete this line.

git-svn-id: http://svn.opensymphony.com/svn/xwork/trunk@20e221344d-f017-0410-9bd5-d282ab1896d7

  • Participants
  • Parent commits 1893ff9

Comments (0)

Files changed (27)

src/java/com/opensymphony/xwork/config/providers/dsx/ActionConfigHandler.java

-/*
- * Copyright (c) 2002-2003 by OpenSymphony
- * All rights reserved.
- */
-package com.opensymphony.xwork.config.providers.dsx;
-
-import com.opensymphony.xwork.config.entities.ActionConfig;
-import com.opensymphony.xwork.config.entities.PackageConfig;
-import com.opensymphony.xwork.util.OgnlValueStack;
-import com.opensymphony.xwork.xml.Path;
-import com.opensymphony.xwork.xml.handlers.ObjectCreateHandler;
-
-import java.util.Map;
-
-
-/**
- * ActionConfigHandler
- * @author Jason Carreira
- * Created Jun 3, 2003 11:34:13 PM
- */
-public class ActionConfigHandler extends ObjectCreateHandler {
-    //~ Instance fields ////////////////////////////////////////////////////////
-
-    private String name;
-
-    //~ Constructors ///////////////////////////////////////////////////////////
-
-    public ActionConfigHandler(Path path) {
-        super(path, ActionConfig.class);
-        registerHandlers();
-    }
-
-    public ActionConfigHandler(String pathString) {
-        super(pathString, ActionConfig.class);
-        registerHandlers();
-    }
-
-    //~ Methods ////////////////////////////////////////////////////////////////
-
-    /**
-    * Subclasses should override this method if they want to receive an event at the ending point of the path
-    */
-    public void endingPath(Path path) {
-        super.endingPath(path);
-
-        OgnlValueStack valueStack = getValueStack();
-        ActionConfig actionConfig = (ActionConfig) valueStack.pop();
-        PackageConfig packageConfig = (PackageConfig) valueStack.peek();
-        packageConfig.addActionConfig(name, actionConfig);
-    }
-
-    /**
-    * Subclasses should override this method if they want to receive an event at the starting point of the path
-    */
-    public void startingPath(Path path, Map attributeMap) {
-        this.name = (String) attributeMap.get("name");
-        super.startingPath(path, attributeMap);
-    }
-
-    protected void registerHandlers() {
-        this.addAttributeMapping("class", "clazz");
-        new ParamHandler("").registerWith(this);
-        new ResultHandler("result").registerWith(this);
-        new InterceptorRefHandler("interceptor-ref").registerWith(this);
-    }
-}

src/java/com/opensymphony/xwork/config/providers/dsx/ArgumentHandler.java

-/*
- * Copyright (c) 2002-2003 by OpenSymphony
- * All rights reserved.
- */
-package com.opensymphony.xwork.config.providers.dsx;
-
-import com.opensymphony.xwork.xml.Path;
-import com.opensymphony.xwork.xml.handlers.ElementValueHandler;
-
-import java.util.List;
-
-
-/**
- * ArgumentHandler
- * @author Jason Carreira
- * Created May 24, 2003 10:59:53 PM
- */
-public class ArgumentHandler extends ElementValueHandler {
-    //~ Instance fields ////////////////////////////////////////////////////////
-
-    private int index;
-
-    //~ Constructors ///////////////////////////////////////////////////////////
-
-    public ArgumentHandler(Path path, int index) {
-        super(path);
-        this.index = index;
-    }
-
-    public ArgumentHandler(String pathString, int index) {
-        super(pathString);
-        this.index = index;
-    }
-
-    //~ Methods ////////////////////////////////////////////////////////////////
-
-    public void handleContent(String content) {
-        List argList = (List) getRootHandler().getValueStack().peek();
-        argList.add(index, content);
-    }
-}

src/java/com/opensymphony/xwork/config/providers/dsx/DefaultInterceptorRefHandler.java

-/*
- * Copyright (c) 2002-2003 by OpenSymphony
- * All rights reserved.
- */
-package com.opensymphony.xwork.config.providers.dsx;
-
-import com.opensymphony.xwork.config.entities.PackageConfig;
-import com.opensymphony.xwork.util.OgnlValueStack;
-import com.opensymphony.xwork.xml.DefaultDelegatingHandler;
-import com.opensymphony.xwork.xml.Path;
-
-import java.util.HashMap;
-import java.util.Map;
-
-
-/**
- * DefaultInterceptorRefHandler
- * @author Jason Carreira
- * Created Jun 4, 2003 1:36:45 PM
- */
-public class DefaultInterceptorRefHandler extends DefaultDelegatingHandler {
-    //~ Instance fields ////////////////////////////////////////////////////////
-
-    Map params = new HashMap();
-    String name;
-
-    //~ Constructors ///////////////////////////////////////////////////////////
-
-    public DefaultInterceptorRefHandler(Path path) {
-        super(path);
-        registerHandlers();
-    }
-
-    public DefaultInterceptorRefHandler(String pathString) {
-        super(pathString);
-        registerHandlers();
-    }
-
-    //~ Methods ////////////////////////////////////////////////////////////////
-
-    public void setParams(Map params) {
-        this.params = params;
-    }
-
-    public Map getParams() {
-        return params;
-    }
-
-    public void addParam(String name, Object value) {
-        params.put(name, value);
-    }
-
-    /**
-    * Subclasses should override this method if they want to receive an event at the ending point of the path
-    */
-    public void endingPath(Path path) {
-        super.endingPath(path);
-
-        final OgnlValueStack valueStack = getValueStack();
-
-        //pop this
-        valueStack.pop();
-
-        PackageConfig config = (PackageConfig) valueStack.peek();
-        config.setDefaultInterceptorRef(name);
-    }
-
-    /**
-    * Subclasses should override this method if they want to receive an event at the starting point of the path
-    */
-    public void startingPath(Path path, Map attributeMap) {
-        // add this to the stack to get the params
-        getValueStack().push(this);
-        super.startingPath(path, attributeMap);
-        name = (String) attributeMap.get("name");
-    }
-
-    private void registerHandlers() {
-        new ParamHandler("").registerWith(this);
-    }
-}

src/java/com/opensymphony/xwork/config/providers/dsx/DelegatingSaxXmlProvider.java

-/*
- * Copyright (c) 2002-2003 by OpenSymphony
- * All rights reserved.
- */
-package com.opensymphony.xwork.config.providers.dsx;
-
-import com.opensymphony.util.ClassLoaderUtil;
-import com.opensymphony.util.FileManager;
-
-import com.opensymphony.xwork.config.Configuration;
-import com.opensymphony.xwork.config.ConfigurationException;
-import com.opensymphony.xwork.config.ConfigurationProvider;
-import com.opensymphony.xwork.config.providers.XmlConfigurationProvider;
-import com.opensymphony.xwork.xml.DefaultDelegatingHandler;
-
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-
-import org.xml.sax.EntityResolver;
-import org.xml.sax.InputSource;
-import org.xml.sax.SAXException;
-import org.xml.sax.XMLReader;
-
-import java.io.IOException;
-import java.io.InputStream;
-
-import java.util.Iterator;
-
-import javax.xml.parsers.SAXParser;
-import javax.xml.parsers.SAXParserFactory;
-
-
-/**
- * DelegatingSaxXmlProvider
- * @author Jason Carreira
- * Created May 19, 2003 7:54:41 AM
- */
-public class DelegatingSaxXmlProvider implements ConfigurationProvider {
-    //~ Static fields/initializers /////////////////////////////////////////////
-
-    private static final Log LOG = LogFactory.getLog(DelegatingSaxXmlProvider.class);
-
-    //~ Instance fields ////////////////////////////////////////////////////////
-
-    private String configFileName = "xwork.xml";
-
-    //~ Constructors ///////////////////////////////////////////////////////////
-
-    //    private Configuration configuration;
-    public DelegatingSaxXmlProvider() {
-    }
-
-    public DelegatingSaxXmlProvider(String configFileName) {
-        this.configFileName = configFileName;
-    }
-
-    //~ Methods ////////////////////////////////////////////////////////////////
-
-    public void setConfigFileName(String configFileName) {
-        this.configFileName = configFileName;
-    }
-
-    public String getConfigFileName() {
-        return configFileName;
-    }
-
-    public void destroy() {
-    }
-
-    /**
-    * Initializes the configuration object.
-    */
-    public void init(Configuration configuration) throws ConfigurationException {
-        //        this.configuration = configuration;
-        SAXParser saxParser;
-
-        DefaultDelegatingHandler handler;
-        InputStream is = null;
-
-        try {
-            saxParser = SAXParserFactory.newInstance().newSAXParser();
-
-            XMLReader xmlReader = saxParser.getXMLReader();
-            xmlReader.setEntityResolver(new EntityResolver() {
-                    public InputSource resolveEntity(String publicId, String systemId) throws SAXException, IOException {
-                        if ("-//OpenSymphony Group//XWork 1.0//EN".equals(publicId)) {
-                            return new InputSource(ClassLoaderUtil.getResourceAsStream("xwork-1.0.dtd", XmlConfigurationProvider.class));
-                        }
-
-                        return null;
-                    }
-                });
-
-            is = getInputStream(configFileName);
-
-            if (is == null) {
-                throw new Exception("Could not open file " + configFileName);
-            }
-
-            handler = new DefaultDelegatingHandler();
-            new PackageHandler("/xwork/package", configuration).registerWith(handler);
-            xmlReader.setContentHandler(handler);
-            xmlReader.setErrorHandler(handler);
-            xmlReader.parse(new InputSource(is));
-        } catch (Exception e) {
-            LOG.fatal("Could not load XWork configuration file, failing", e);
-
-            return;
-        } finally {
-            if (is != null) {
-                try {
-                    is.close();
-                } catch (IOException e) {
-                    LOG.error("Unable to close input stream", e);
-                }
-            }
-        }
-
-        if ((handler != null) && (handler.getException() != null) && (handler.getException().hasErrors())) {
-            Iterator exceptionIter = handler.getException().exceptions();
-
-            while (exceptionIter.hasNext()) {
-                LOG.error("Caught exception while parsing file " + configFileName, (Throwable) exceptionIter.next());
-            }
-        }
-    }
-
-    /**
-    * 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() {
-        return FileManager.fileNeedsReloading(configFileName);
-    }
-
-    protected InputStream getInputStream(String fileName) {
-        InputStream is = FileManager.loadFile(fileName, this.getClass());
-
-        return is;
-    }
-}

src/java/com/opensymphony/xwork/config/providers/dsx/InterceptorRefHandler.java

-/*
- * Copyright (c) 2002-2003 by OpenSymphony
- * All rights reserved.
- */
-package com.opensymphony.xwork.config.providers.dsx;
-
-import com.opensymphony.xwork.config.ConfigurationException;
-import com.opensymphony.xwork.config.entities.InterceptorListHolder;
-import com.opensymphony.xwork.config.entities.PackageConfig;
-import com.opensymphony.xwork.config.entities.Parameterizable;
-import com.opensymphony.xwork.config.providers.InterceptorBuilder;
-import com.opensymphony.xwork.util.OgnlValueStack;
-import com.opensymphony.xwork.xml.DefaultDelegatingHandler;
-import com.opensymphony.xwork.xml.Path;
-
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-
-/**
- * InterceptorRefHandler
- * @author Jason Carreira
- * Created May 31, 2003 11:28:51 PM
- */
-public class InterceptorRefHandler extends DefaultDelegatingHandler implements Parameterizable {
-    //~ Instance fields ////////////////////////////////////////////////////////
-
-    Map params = new HashMap();
-    String name;
-
-    //~ Constructors ///////////////////////////////////////////////////////////
-
-    public InterceptorRefHandler(Path path) {
-        super(path);
-        registerHandlers();
-    }
-
-    public InterceptorRefHandler(String pathString) {
-        super(pathString);
-        registerHandlers();
-    }
-
-    //~ Methods ////////////////////////////////////////////////////////////////
-
-    public void setParams(Map params) {
-        this.params = params;
-    }
-
-    public Map getParams() {
-        return params;
-    }
-
-    public void addParam(String name, Object value) {
-        params.put(name, value);
-    }
-
-    /**
-    * Subclasses should override this method if they want to receive an event at the ending point of the path
-    */
-    public void endingPath(Path path) {
-        super.endingPath(path);
-
-        final OgnlValueStack valueStack = getValueStack();
-
-        //pop this
-        valueStack.pop();
-
-        InterceptorListHolder interceptorListHolder = (InterceptorListHolder) valueStack.pop();
-        PackageConfig config = (PackageConfig) valueStack.peek();
-        valueStack.push(interceptorListHolder);
-
-        try {
-            List interceptors = InterceptorBuilder.constructInterceptorReference(config, name, params);
-            interceptorListHolder.addInterceptors(interceptors);
-        } catch (ConfigurationException e) {
-            addError(e);
-        }
-    }
-
-    /**
-    * Subclasses should override this method if they want to receive an event at the starting point of the path
-    */
-    public void startingPath(Path path, Map attributeMap) {
-        // add this to the stack to get the params
-        getValueStack().push(this);
-        super.startingPath(path, attributeMap);
-        name = (String) attributeMap.get("name");
-    }
-
-    private void registerHandlers() {
-        new ParamHandler("").registerWith(this);
-    }
-}

src/java/com/opensymphony/xwork/config/providers/dsx/PackageHandler.java

-/*
- * Copyright (c) 2002-2003 by OpenSymphony
- * All rights reserved.
- */
-package com.opensymphony.xwork.config.providers.dsx;
-
-import com.opensymphony.xwork.config.Configuration;
-import com.opensymphony.xwork.config.ConfigurationUtil;
-import com.opensymphony.xwork.config.entities.InterceptorConfig;
-import com.opensymphony.xwork.config.entities.InterceptorStackConfig;
-import com.opensymphony.xwork.config.entities.PackageConfig;
-import com.opensymphony.xwork.config.entities.ResultTypeConfig;
-import com.opensymphony.xwork.xml.Path;
-import com.opensymphony.xwork.xml.handlers.AddPartHandler;
-import com.opensymphony.xwork.xml.handlers.ExpressionSetPropertyHandler;
-import com.opensymphony.xwork.xml.handlers.ObjectCreateHandler;
-import com.opensymphony.xwork.xml.handlers.PathLocationEnum;
-
-import java.util.List;
-import java.util.Map;
-
-
-/**
- * PackageHandler
- * @author Jason Carreira
- * Created May 19, 2003 8:00:30 AM
- */
-public class PackageHandler extends ObjectCreateHandler {
-    //~ Instance fields ////////////////////////////////////////////////////////
-
-    Configuration configuration;
-
-    //~ Constructors ///////////////////////////////////////////////////////////
-
-    public PackageHandler(Path path, Configuration configuration) {
-        super(path, PackageConfig.class);
-        this.configuration = configuration;
-        registerHandles();
-    }
-
-    public PackageHandler(String s, Configuration configuration) {
-        super(s, PackageConfig.class);
-        this.configuration = configuration;
-        registerHandles();
-    }
-
-    //~ Methods ////////////////////////////////////////////////////////////////
-
-    public void endingPath(Path path) {
-        PackageConfig config = (PackageConfig) getValueStack().pop();
-        configuration.addPackageConfig(config.getName(), config);
-    }
-
-    public void startingPath(Path path, Map map) {
-        super.startingPath(path, map);
-
-        String extendString = (String) map.get("extends");
-        List parents = ConfigurationUtil.buildParentsFromString(configuration, extendString);
-        getPackageConfig().addAllParents(parents);
-    }
-
-    PackageConfig getPackageConfig() {
-        return ((PackageConfig) getValueStack().peek());
-    }
-
-    private void addInterceptorHandlers(String interceptorPathString) {
-        final String interceptorConfigPathString = interceptorPathString + "/interceptor";
-        ObjectCreateHandler interceptorConfigHandler = new ObjectCreateHandler(interceptorConfigPathString, InterceptorConfig.class);
-        interceptorConfigHandler.addAttributeMapping("class", "clazz");
-        interceptorConfigHandler.registerWith(this);
-        new ParamHandler(interceptorConfigPathString).registerWith(this);
-        new AddPartHandler(interceptorConfigPathString, "addInterceptorConfig").registerWith(this);
-
-        final String interceptorStackConfigPathString = interceptorPathString + "/interceptor-stack";
-        new ObjectCreateHandler(interceptorStackConfigPathString, InterceptorStackConfig.class).registerWith(this);
-
-        final String interceptorRefPathString = interceptorStackConfigPathString + "/interceptor-ref";
-        new InterceptorRefHandler(interceptorRefPathString).registerWith(this);
-        new AddPartHandler(interceptorStackConfigPathString, "addInterceptorStackConfig").registerWith(this);
-    }
-
-    private void addResultTypeHandlers(final String resultTypePathString) {
-        ObjectCreateHandler resultTypeCreateHandler = new ObjectCreateHandler(resultTypePathString, ResultTypeConfig.class);
-        resultTypeCreateHandler.addAttributeMapping("class", "clazz");
-        resultTypeCreateHandler.registerWith(this);
-
-        ExpressionSetPropertyHandler exSetPropertyHandler = new ExpressionSetPropertyHandler(resultTypePathString, "[1].defaultResultType", "name", PathLocationEnum.END);
-        exSetPropertyHandler.setAttributeFlag("default");
-        exSetPropertyHandler.registerWith(this);
-        new AddPartHandler(resultTypePathString, "addResultTypeConfig").registerWith(this);
-    }
-
-    private void registerHandles() {
-        final String resultTypePathString = "result-types/result-type";
-        addResultTypeHandlers(resultTypePathString);
-
-        final String interceptorPathString = "interceptors";
-        addInterceptorHandlers(interceptorPathString);
-
-        new DefaultInterceptorRefHandler("default-interceptor-ref").registerWith(this);
-
-        final String globalResultPathString = "global-results/result";
-        new ResultHandler(globalResultPathString, "addGlobalResultConfig").registerWith(this);
-
-        final String actionConfigPathString = "action";
-        new ActionConfigHandler(actionConfigPathString).registerWith(this);
-    }
-}

src/java/com/opensymphony/xwork/config/providers/dsx/ParamHandler.java

-/*
- * Copyright (c) 2002-2003 by OpenSymphony
- * All rights reserved.
- */
-package com.opensymphony.xwork.config.providers.dsx;
-
-import com.opensymphony.xwork.config.entities.Parameterizable;
-import com.opensymphony.xwork.xml.Path;
-import com.opensymphony.xwork.xml.handlers.ElementValueHandler;
-
-import java.util.Map;
-
-
-/**
- * ParamHandler
- * @author Jason Carreira
- * Created May 24, 2003 12:56:20 AM
- */
-public class ParamHandler extends ElementValueHandler {
-    //~ Instance fields ////////////////////////////////////////////////////////
-
-    String name;
-
-    //~ Constructors ///////////////////////////////////////////////////////////
-
-    public ParamHandler(Path path) {
-        super(path);
-        this.path.add("param");
-    }
-
-    public ParamHandler(String pathString) {
-        super(pathString);
-        this.path.add("param");
-    }
-
-    //~ Methods ////////////////////////////////////////////////////////////////
-
-    public void handleContent(String content) {
-        Parameterizable parameterizable = (Parameterizable) getRootHandler().getValueStack().peek();
-        parameterizable.addParam(name, content);
-    }
-
-    /**
-    * Subclasses should override this method if they want to receive an event at the starting point of the path
-    */
-    public void startingPath(Path path, Map attributeMap) {
-        super.startingPath(path, attributeMap);
-        name = (String) attributeMap.get("name");
-    }
-}

src/java/com/opensymphony/xwork/config/providers/dsx/ResultHandler.java

-/*
- * Copyright (c) 2002-2003 by OpenSymphony
- * All rights reserved.
- */
-package com.opensymphony.xwork.config.providers.dsx;
-
-import com.opensymphony.xwork.config.ConfigurationException;
-import com.opensymphony.xwork.config.entities.ResultConfig;
-import com.opensymphony.xwork.config.entities.ResultTypeConfig;
-import com.opensymphony.xwork.util.OgnlValueStack;
-import com.opensymphony.xwork.xml.DefaultDelegatingHandler;
-import com.opensymphony.xwork.xml.Path;
-import com.opensymphony.xwork.xml.handlers.ElementValueHandler;
-
-import java.lang.reflect.Method;
-
-import java.util.Map;
-
-
-/**
- * ResultHandler
- * @author Jason Carreira
- * Created Jun 3, 2003 12:13:58 AM
- */
-public class ResultHandler extends DefaultDelegatingHandler {
-    //~ Instance fields ////////////////////////////////////////////////////////
-
-    private String bodyText = null;
-    private String methodName = "addResultConfig";
-
-    //~ Constructors ///////////////////////////////////////////////////////////
-
-    public ResultHandler(Path path) {
-        super(path);
-        registerHandlers();
-    }
-
-    public ResultHandler(String pathString) {
-        super(pathString);
-        registerHandlers();
-    }
-
-    public ResultHandler(Path path, String methodName) {
-        super(path);
-        this.methodName = methodName;
-    }
-
-    public ResultHandler(String pathString, String methodName) {
-        super(pathString);
-        this.methodName = methodName;
-    }
-
-    //~ Methods ////////////////////////////////////////////////////////////////
-
-    /**
-    * Subclasses should override this method if they want to receive an event at the ending point of the path
-    */
-    public void endingPath(Path path) {
-        super.endingPath(path);
-
-        OgnlValueStack valueStack = getValueStack();
-        Object top = valueStack.peek();
-
-        if (top instanceof ResultConfig) {
-            ResultConfig config = (ResultConfig) valueStack.pop();
-            handleParams(config);
-
-            Object parent = valueStack.peek();
-
-            try {
-                Method method = parent.getClass().getMethod(methodName, new Class[] {
-                        ResultConfig.class
-                    });
-                method.invoke(parent, new Object[] {config});
-            } catch (Exception e) {
-                getRootHandler().addFatal(e);
-            }
-        }
-    }
-
-    /**
-    * Subclasses should override this method if they want to receive an event at the starting point of the path
-    */
-    public void startingPath(Path path, Map attributeMap) {
-        OgnlValueStack valueStack = getValueStack();
-        String name = (String) attributeMap.get("name");
-        String type = (String) attributeMap.get("type");
-
-        if (type == null) {
-            type = (String) valueStack.findValue("defaultResultType");
-        }
-
-        Map resultTypes = (Map) valueStack.findValue("allResultTypeConfigs");
-        ResultTypeConfig resultTypeConfig = (ResultTypeConfig) resultTypes.get(type);
-
-        if (resultTypeConfig == null) {
-            addError(new ConfigurationException("There is no result type " + type + " for the reference " + name));
-
-            return;
-        }
-
-        ResultConfig resultConfig = new ResultConfig(name, resultTypeConfig.getClazz());
-        valueStack.push(resultConfig);
-        super.startingPath(path, attributeMap);
-    }
-
-    private void handleParams(ResultConfig config) {
-        if ((config.getParams().size() <= 0) && (bodyText != null)) {
-            String locationValue = bodyText.trim();
-
-            if (!locationValue.equals("")) {
-                config.addParam("location", locationValue);
-            }
-        }
-    }
-
-    private void registerHandlers() {
-        new ParamHandler("").registerWith(this);
-        new ElementValueHandler("") {
-                public void handleContent(String content) {
-                    bodyText = content;
-                }
-            }.registerWith(this);
-    }
-}

src/java/com/opensymphony/xwork/xml/DefaultDelegatingHandler.java

-/*
- * Copyright (c) 2002-2003 by OpenSymphony
- * All rights reserved.
- */
-package com.opensymphony.xwork.xml;
-
-import com.opensymphony.xwork.util.OgnlValueStack;
-
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-
-import org.xml.sax.*;
-
-import java.util.*;
-
-
-/**
- * DefaultDelegatingHandler enables SubHandlers to register themselves to receive SAX messages for a certain path in the XML
- * file. When that path is reached, the startingPath() method will be called on the registered SubHandler, followed by
- * the startElement() event. All SAX events will be forwarded to the registered SubHandler from the time the path is
- * reached to the time the closing tag for the path is reached, at which time the endingPath() event will be sent to the
- * registered SubHandler (immediately after the endElement() event) and no further SAX messages will be sent. SubHandlers
- * which wish to receive all SAX events, including startDocument and endDocument should register using
- * Path.getRootInstance(). Current SAX events which are delegated include startDocument, endDocument, startElement,
- * endElement, and characters.
- *
- * Created Oct 21, 2002 3:27:13 PM
- * @author Jason Carreira
- * @version 1.0
- */
-public class DefaultDelegatingHandler extends DefaultSubHandler implements DelegatingHandler {
-    //~ Static fields/initializers /////////////////////////////////////////////
-
-    protected static final Log LOG = LogFactory.getLog(DefaultDelegatingHandler.class);
-
-    //~ Instance fields ////////////////////////////////////////////////////////
-
-    protected boolean startingPath = false;
-
-    // one large exception to accumulate multiple exceptions, only thrown
-    // if errors have occurred; only the root handler will have one
-    private DelegatingHandlerException exception = null;
-
-    /** The map of properties set into the DefaultDelegatingHandler to be accessed by SubHandlers at runtime */
-    private Map properties;
-
-    /**
-    * The collection of registrations between Paths and SubHandlers. Multiple SubHandlers may be registered with the
-    * same Path
-    */
-    private Map registry = new HashMap(1);
-
-    /** The current path in the parsed XML document. This is updated by start and end element events */
-    private Path path = Path.getRootInstance();
-
-    /**
-    * The set of SubHandlers whose path's have been reached but not closed yet. These SubHandlers will receive all SAX
-    * events received by the DefaultDelegatingHandler
-    */
-    private Set activeHandlers = new HashSet(1);
-
-    //~ Constructors ///////////////////////////////////////////////////////////
-
-    public DefaultDelegatingHandler() {
-        this(Path.getRootInstance());
-    }
-
-    public DefaultDelegatingHandler(Path path) {
-        super(path);
-        init();
-    }
-
-    public DefaultDelegatingHandler(String pathString) {
-        super(pathString);
-        init();
-    }
-
-    //~ Methods ////////////////////////////////////////////////////////////////
-
-    // returns the root handler's exception, used by the above 3 methods
-    public DelegatingHandlerException getException() {
-        if (exception == null) {
-            if ((rootHandler != null) && (rootHandler != this)) {
-                exception = rootHandler.getException();
-            } else {
-                exception = new DelegatingHandlerException();
-            }
-        }
-
-        return exception;
-    }
-
-    /**
-    * Get the current working path
-    * @return the current working path
-    */
-    public Path getPath() {
-        return path;
-    }
-
-    public Map getProperties() {
-        return properties;
-    }
-
-    /**
-    * Gets a property from the property map with the associated key
-    */
-    public Object getProperty(Object key) {
-        return properties.get(key);
-    }
-
-    public OgnlValueStack getValueStack() {
-        if (rootHandler == null) {
-            return (OgnlValueStack) properties.get(OgnlValueStack.VALUE_STACK);
-        } else {
-            return rootHandler.getValueStack();
-        }
-    }
-
-    /**
-    * Add all of the properties in this map to the DefaultDelegatingHandler properties
-    * @param props Map of properties to add
-    */
-    public void addAllProperties(Map props) {
-        properties.putAll(props);
-    }
-
-    /**
-    * Add a validation error to the validation error collection.
-    * @param error The encountered error.
-    */
-    public void addError(Exception error) {
-        getException().addError(error);
-    }
-
-    /**
-    * Add a validation error to the validation error collection.
-    * @param fatal The encountered error.
-    */
-    public void addFatal(Exception fatal) {
-        // clear out everything in the delgating handler to short-circuit the parse
-        registry.clear();
-        activeHandlers.clear();
-        getException().addFatal(fatal);
-    }
-
-    /**
-    * Registers a handler with the given path to receive delegated SAX events received under that path
-    *
-    * @param path The Path to register as the root path to delegate messages to the SubHandler
-    * @param handler The SubHandler to receive delegated SAX events
-    */
-    public void addHandler(Path path, SubHandler handler) {
-        if (LOG.isDebugEnabled()) {
-            LOG.debug("Adding handler " + handler + " with path " + path);
-        }
-
-        List handlers = getHandlersForPath(path);
-
-        // make sure we only have this handler for this path once
-        handlers.remove(handler);
-        handlers.add(handler);
-    }
-
-    /**
-    * Adds a property to the property map for use by SubHandlers while processing
-    *
-    * @param key
-    * @param value
-    */
-    public void addProperty(Object key, Object value) {
-        if (LOG.isDebugEnabled()) {
-            LOG.debug("Adding property " + key + " with value " + value);
-        }
-
-        properties.put(key, value);
-    }
-
-    /**
-    * Add a validation warning to the validation warning collection.
-    * @param warning The encountered warning.
-    */
-    public void addWarning(Exception warning) {
-        getException().addWarning(warning);
-    }
-
-    /**
-    * Delegates character event calls to the active SubHandlers
-    *
-    * @param chars
-    * @param start
-    * @param end
-    * @throws org.xml.sax.SAXException
-    */
-    public void characters(char[] chars, int start, int end) throws SAXException {
-        try {
-            for (Iterator iterator = activeHandlers.iterator();
-                    iterator.hasNext();) {
-                ContentHandler handler = (ContentHandler) iterator.next();
-                handler.characters(chars, start, end);
-            }
-        } catch (SAXException e) {
-            addError(e);
-            throw e;
-        }
-    }
-
-    /**
-    * Delegates the endDocument event to SubHandlers registered with the root path and deactivates them
-    *
-    * @throws org.xml.sax.SAXException
-    */
-    public void endDocument() throws SAXException {
-        if (LOG.isDebugEnabled()) {
-            LOG.debug("Ending Document.");
-        }
-
-        try {
-            for (Iterator iterator = activeHandlers.iterator();
-                    iterator.hasNext();) {
-                ContentHandler handler = (ContentHandler) iterator.next();
-                handler.endDocument();
-            }
-        } catch (SAXException e) {
-            addError(e);
-            throw e;
-        }
-
-        Collection c = (Collection) registry.get(path);
-
-        if (c != null) {
-            notifyEndingHandlers(c);
-            activeHandlers.removeAll(c);
-        }
-    }
-
-    /**
-    * Updates the current Path, delegates to the active SubHandlers, and deactivates the SubHandlers registered with this path
-    *
-    * @param uri
-    * @param localName
-    * @param qName
-    * @throws org.xml.sax.SAXException
-    */
-    public void endElement(String uri, String localName, String qName) throws SAXException {
-        try {
-            for (Iterator iterator = activeHandlers.iterator();
-                    iterator.hasNext();) {
-                ContentHandler handler = (ContentHandler) iterator.next();
-                handler.endElement(uri, localName, qName);
-            }
-        } catch (SAXException e) {
-            addError(e);
-            throw e;
-        }
-
-        Collection c = (Collection) registry.get(path);
-
-        if (c != null) {
-            notifyEndingHandlers(c);
-            activeHandlers.removeAll(c);
-        }
-
-        path.remove();
-    }
-
-    /**
-    * required handler for SAX errors; logs the error, adds it to a list,
-    * and continues processing. once processing completes, an exception
-    * containing all accumulated warnings and errors will be thrown
-    */
-    public void error(SAXParseException e) throws SAXException {
-        LOG.warn("Caught Error while parsing XML.", e);
-        this.addError(e);
-    }
-
-    /**
-    * required handler for fatal SAX errors; logs the error, adds it to a list,
-    * and throws the exception with all accumulated warnings and errors
-    * (including this one)
-    */
-    public void fatalError(SAXParseException e) throws SAXException {
-        LOG.error("Caught FATAL Error while parsing XML.", e);
-        this.addFatal(e);
-    }
-
-    public Object findValue(String expression) {
-        OgnlValueStack stack = getValueStack();
-
-        if (stack != null) {
-            return stack.findValue(expression);
-        }
-
-        return null;
-    }
-
-    /**
-    * Unregisters the given handler from the DefaultDelegatingHandler with the given path. <p>
-    * NOTE: The handler will also stop receiving SAX events, EVEN IF IT IS RECEIVING MESSAGES BASED ON A DIFFERENT PATH
-    * REGISTRATION, therefore, it is not recommended that RemoveHandler be called at runtime if a handler is registered
-    * with multiple paths.
-    *
-    * @param path The Path to remove the handler from
-    * @param handler The Handler to register to receive SAX events
-    */
-    public void removeHandler(Path path, SubHandler handler) {
-        if (LOG.isDebugEnabled()) {
-            LOG.debug("Removing handler " + handler + " with path " + path);
-        }
-
-        List handlers = getHandlersForPath(path);
-        handlers.remove(handler);
-        activeHandlers.remove(handler);
-    }
-
-    /**
-    * Activates SubHandlers registered with the Root Path and delegates the startDocument event to them
-    *
-    * @throws org.xml.sax.SAXException
-    */
-    public void startDocument() throws SAXException {
-        if (LOG.isDebugEnabled()) {
-            LOG.debug("Starting document.");
-        }
-
-        Collection c = (Collection) registry.get(path);
-
-        if (c != null) {
-            activeHandlers.addAll(c);
-            notifyStartingHandlers(c, null);
-        }
-
-        try {
-            for (Iterator iterator = activeHandlers.iterator();
-                    iterator.hasNext();) {
-                ContentHandler handler = (ContentHandler) iterator.next();
-                handler.startDocument();
-            }
-        } catch (SAXException e) {
-            addError(e);
-            throw e;
-        }
-    }
-
-    /**
-    * Updates the current Path, activates the SubHandlers registered with this path, and delegates to the
-    * active SubHandlers.
-    *
-    * @param uri
-    * @param localName
-    * @param qName
-    * @param attributes
-    * @throws org.xml.sax.SAXException
-    */
-    public void startElement(String uri, String localName, String qName, Attributes attributes) throws SAXException {
-        // only add this to the path if this is not the path we are registered to listen under.
-        if (startingPath) {
-            startingPath = false;
-        } else {
-            path.add(qName);
-        }
-
-        Collection c = (Collection) registry.get(path);
-
-        if (c != null) {
-            activeHandlers.addAll(c);
-            notifyStartingHandlers(c, attributes);
-        }
-
-        try {
-            for (Iterator iterator = activeHandlers.iterator();
-                    iterator.hasNext();) {
-                ContentHandler handler = (ContentHandler) iterator.next();
-                handler.startElement(uri, localName, qName, attributes);
-            }
-        } catch (SAXException e) {
-            addError(e);
-            throw e;
-        }
-    }
-
-    /**
-    * Subclasses should override this method if they want to receive an event at the starting point of the path
-    */
-    public void startingPath(Path path, Map attributeMap) {
-        super.startingPath(path, attributeMap);
-
-        // set the starting path flag
-        startingPath = true;
-    }
-
-    /**
-    * required handler for SAX warnings; logs the warning, adds it to a list,
-    * and continues processing
-    */
-    public void warning(SAXParseException e) throws SAXException {
-        LOG.warn("Caught Warning while parsing XML.", e);
-        this.addWarning(e);
-    }
-
-    protected List getHandlersForPath(Path path) {
-        List handlers = (List) registry.get(path);
-
-        if (handlers == null) {
-            handlers = new ArrayList();
-            registry.put(path, handlers);
-        }
-
-        return handlers;
-    }
-
-    protected void init() {
-        OgnlValueStack valueStack = new OgnlValueStack();
-        properties = valueStack.getContext();
-    }
-
-    Map buildAttributeMap(Attributes attributes) {
-        Map returnMap = new HashMap();
-
-        if (attributes != null) {
-            for (int i = 0, c = attributes.getLength(); i < c; i++) {
-                returnMap.put(attributes.getQName(i), attributes.getValue(i));
-            }
-        }
-
-        return returnMap;
-    }
-
-    /**
-    * Calls endingPath() on each of the SubHandlers in the Collection
-    *
-    * @param c Collection of SubHandler objects
-    */
-    private void notifyEndingHandlers(Collection c) {
-        for (Iterator iterator = c.iterator(); iterator.hasNext();) {
-            SubHandler handler = (SubHandler) iterator.next();
-            handler.endingPath(path);
-        }
-    }
-
-    /**
-    * Calls startingPath() on each of the SubHandlers in the Collection
-    *
-    * @param c Collection of SubHandler objects
-    */
-    private void notifyStartingHandlers(Collection c, Attributes attributes) {
-        for (Iterator iterator = c.iterator(); iterator.hasNext();) {
-            SubHandler handler = (SubHandler) iterator.next();
-            handler.startingPath(path, buildAttributeMap(attributes));
-        }
-    }
-}

src/java/com/opensymphony/xwork/xml/DefaultSubHandler.java

-/*
- * Copyright (c) 2002-2003 by OpenSymphony
- * All rights reserved.
- */
-package com.opensymphony.xwork.xml;
-
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-
-import org.xml.sax.helpers.DefaultHandler;
-
-import java.util.Map;
-
-
-/**
- * DefaultSubHandler is the base class for SubHandler classes.
- *
- * Created Oct 21, 2002 6:42:28 PM
- * @author Jason Carreira
- * @version 1.0
- */
-public abstract class DefaultSubHandler extends DefaultHandler implements SubHandler {
-    //~ Static fields/initializers /////////////////////////////////////////////
-
-    public static final String ESCAPE_LESS_THAN = "&lt;";
-    public static final String ESCAPE_GREATER_THAN = "&gt;";
-    public static final String ESCAPE_AMPERSAND = "&amp;";
-    public static final String ESCAPE_QUOTE = "&quot;";
-
-    //~ Instance fields ////////////////////////////////////////////////////////
-
-    protected DelegatingHandler rootHandler;
-    protected final Log LOG = LogFactory.getLog(this.getClass());
-    protected Path path;
-
-    //~ Constructors ///////////////////////////////////////////////////////////
-
-    public DefaultSubHandler(Path path) {
-        super();
-        this.path = path;
-    }
-
-    public DefaultSubHandler(String pathString) {
-        this(Path.getInstance(pathString));
-    }
-
-    //~ Methods ////////////////////////////////////////////////////////////////
-
-    public Path getPath() {
-        return path;
-    }
-
-    public DelegatingHandler getRootHandler() {
-        return rootHandler;
-    }
-
-    /**
-    * Subclasses should override this method if they want to receive an event at the ending point of the path
-    */
-    public void endingPath(Path path) {
-        // do nothing
-    }
-
-    public void registerWith(DelegatingHandler rootHandler) {
-        setRootHandler(rootHandler);
-        rootHandler.addHandler(path, this);
-    }
-
-    /**
-    * Subclasses should override this method if they want to receive an event at the starting point of the path
-    */
-    public void startingPath(Path path, Map attributeMap) {
-        // do nothing
-    }
-
-    public void unregisterWith(DelegatingHandler rootHandler) {
-        rootHandler.removeHandler(path, this);
-        this.rootHandler = null;
-    }
-
-    protected void setRootHandler(DelegatingHandler newHandler) {
-        if ((rootHandler != null) && (newHandler != null)) {
-            String s = "Attempting to register with a DefaultDelegatingHandler when there is a current DefaultDelegatingHandler.";
-            LOG.error(s);
-            throw new IllegalStateException(s);
-        }
-
-        rootHandler = newHandler;
-    }
-
-    /**
-    * Encode any special characters found in <i>value</i> into XML entities.
-    *
-    * @param value The string to encode.
-    *
-    * @return The encoded string.
-    */
-    protected StringBuffer xmlEncode(String value) {
-        return xmlEncode(value.toCharArray());
-    }
-
-    /**
-    * Encode <i>ch</i>, if it's a special character, into an XML entities, and add it to the StringBuffer supplied.
-    * If the character does not need to be encoded, it is added as is to the StringBuffer.
-    *
-    * @param ch The character to encode.
-    */
-    private void addEncoded(char ch, StringBuffer buffer) {
-        switch (ch) {
-        case '<':
-            buffer.append(ESCAPE_LESS_THAN);
-
-            break;
-
-        case '>':
-            buffer.append(ESCAPE_GREATER_THAN);
-
-            break;
-
-        case '&':
-            buffer.append(ESCAPE_AMPERSAND);
-
-            break;
-
-        case '"':
-            buffer.append(ESCAPE_QUOTE);
-
-            break;
-
-        default:
-            buffer.append(ch);
-
-            break;
-        }
-    }
-
-    /**
-    * Encode any special characters found in <i>ch</i> into XML entities.
-    *
-    * @param ch The character array to encode.
-    *
-    * @return The encoded string.
-    */
-    private StringBuffer xmlEncode(char[] ch) {
-        return xmlEncode(ch, 0, ch.length);
-    }
-
-    /**
-    * Encode any special characters found in <i>ch</i> into XML entities.  This
-    * method encodes the characters <i>ch[start]</i> through
-    * <i>ch[start + length - 1]</i>.
-    *
-    * @param ch The character array to encode.
-    * @param start The starting index of <i>ch</i>.
-    * @return The encoded string.
-    */
-    private StringBuffer xmlEncode(char[] ch, int start, int length) {
-        StringBuffer ret = new StringBuffer(length * 2);
-
-        if (length > 0) {
-            int i;
-            int j;
-
-            for (i = 0, j = start; i < length; ++i, ++j) {
-                addEncoded(ch[j], ret);
-            }
-        }
-
-        return ret;
-    }
-}

src/java/com/opensymphony/xwork/xml/DelegatingHandler.java

-/*
- * Copyright (c) 2002-2003 by OpenSymphony
- * All rights reserved.
- */
-package com.opensymphony.xwork.xml;
-
-import com.opensymphony.xwork.util.OgnlValueStack;
-
-import java.util.Map;
-
-
-/**
- * DelegatingHandler
- * @author Jason Carreira
- * Created May 15, 2003 10:30:57 PM
- */
-public interface DelegatingHandler extends SubHandler {
-    //~ Methods ////////////////////////////////////////////////////////////////
-
-    // returns the root handler's exception, used by the above 3 methods
-    DelegatingHandlerException getException();
-
-    /**
-    * Gets a property from the property map with the associated key
-    */
-    Object getProperty(Object key);
-
-    OgnlValueStack getValueStack();
-
-    /**
-    * Add all of the properties in this map to the DefaultDelegatingHandler properties
-    * @param props Map of properties to add
-    */
-    void addAllProperties(Map props);
-
-    /**
-    * Add a validation error to the validation error collection.
-    * @param error The encountered error.
-    */
-    void addError(Exception error);
-
-    /**
-    * Add a validation error to the validation error collection.
-    * @param fatal The encountered error.
-    */
-    void addFatal(Exception fatal);
-
-    /**
-    * Registers a handler with the given path to receive delegated SAX events received under that path
-    *
-    * @param path The Path to register as the root path to delegate messages to the SubHandler
-    * @param handler The SubHandler to receive delegated SAX events
-    */
-    void addHandler(Path path, SubHandler handler);
-
-    /**
-    * Adds a property to the property map for use by SubHandlers while processing
-    *
-    * @param key
-    * @param value
-    */
-    void addProperty(Object key, Object value);
-
-    /**
-    * Add a validation warning to the validation warning collection.
-    * @param warning The encountered warning.
-    */
-    void addWarning(Exception warning);
-
-    Object findValue(String expression);
-
-    /**
-    * Unregisters the given handler from the DefaultDelegatingHandler with the given path. <p>
-    * NOTE: The handler will also stop receiving SAX events, EVEN IF IT IS RECEIVING MESSAGES BASED ON A DIFFERENT PATH
-    * REGISTRATION, therefore, it is not recommended that RemoveHandler be called at runtime if a handler is registered
-    * with multiple paths.
-    *
-    * @param path The Path to remove the handler from
-    * @param handler The Handler to register to receive SAX events
-    */
-    void removeHandler(Path path, SubHandler handler);
-}

src/java/com/opensymphony/xwork/xml/DelegatingHandlerException.java

-/*
- * Copyright (c) 2002-2003 by OpenSymphony
- * All rights reserved.
- */
-package com.opensymphony.xwork.xml;
-
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.Iterator;
-
-
-/**
- * Allows accumulation of multiple exceptions within a single job exception.
- * @author Tim Dawson
- */
-public class DelegatingHandlerException extends Exception {
-    //~ Instance fields ////////////////////////////////////////////////////////
-
-    final ArrayList exceptions = new ArrayList();
-    final String message;
-    boolean error = false;
-    boolean fatal = false;
-
-    //~ Constructors ///////////////////////////////////////////////////////////
-
-    /**
-    * constructor, string message is used for logging
-    */
-    public DelegatingHandlerException(String message) {
-        this.message = message;
-    }
-
-    /**
-    * empty constructor
-    */
-    public DelegatingHandlerException() {
-        this.message = "";
-    }
-
-    //~ Methods ////////////////////////////////////////////////////////////////
-
-    /**
-    * returns true if addFatal() has been called
-    */
-    public boolean isFatal() {
-        return fatal;
-    }
-
-    /**
-    * adds an error (i.e. non-fatal) exception to the list
-    */
-    public void addError(Exception e) {
-        exceptions.add(e);
-        error = true;
-    }
-
-    /**
-    * adds a fatal exception to the list; if a fatal exception is added, it is
-    * always the last exception but there's not much point in enforcing that
-    * as a restriction, we just mark a flag that a fatal exception was added
-    */
-    public void addFatal(Exception e) {
-        exceptions.add(e);
-        fatal = true;
-    }
-
-    /**
-    * adds a warning exception to the list (doesn't mark the exception as an error)
-    */
-    public void addWarning(Exception e) {
-        exceptions.add(e);
-    }
-
-    /**
-    * provides access to the exceptions
-    */
-    public Iterator exceptions() {
-        Iterator it = Collections.unmodifiableList(exceptions).iterator();
-
-        return it;
-    }
-
-    /**
-    * returns true if addError() or addFatal() has been called
-    */
-    public boolean hasErrors() {
-        return error || fatal;
-    }
-}

src/java/com/opensymphony/xwork/xml/Path.java

-/*
- * Copyright (c) 2002-2003 by OpenSymphony
- * All rights reserved.
- */
-package com.opensymphony.xwork.xml;
-
-import java.util.ArrayList;
-import java.util.Iterator;
-import java.util.List;
-import java.util.StringTokenizer;
-
-
-/**
- * Simple element path container.  Mostly used for path equallity checks.
- *
- * @author Jason Carreira
- */
-public class Path {
-    //~ Instance fields ////////////////////////////////////////////////////////
-
-    /** The path elements. */
-    private List path;
-
-    /** The path's hash code.  It recalculated whenever the path changes. */
-    private int hashCode;
-
-    //~ Constructors ///////////////////////////////////////////////////////////
-
-    /**
-    * Default constructor.
-    */
-    private Path() {
-        super();
-        setPath(new ArrayList(1));
-        setHashCode(0x0);
-    }
-
-    //~ Methods ////////////////////////////////////////////////////////////////
-
-    /**
-    * Create a copy of this path.
-    *
-    * @return A path copy.
-    */
-    public Path getCopy() {
-        return Path.getInstance(toString());
-    }
-
-    /**
-    * Create a path from the given string representation.  The path elements
-    * are created by tokenizing the string representation on
-    * &quot;<tt>/</tt>&quot;.  Each token found in the string becomes an
-    * element in the path.
-    *
-    * @param path The string representation.
-    *
-    * @return The new path.
-    */
-    public static Path getInstance(String path) {
-        Path ret = new Path();
-        StringTokenizer st = new StringTokenizer(path, "/");
-
-        while (st.hasMoreTokens()) {
-            String s = st.nextToken();
-
-            if (s != null) {
-                s = s.trim();
-
-                if ((s != null) && (s.length() > 0)) {
-                    ret.add(s);
-                }
-            }
-        }
-
-        return ret;
-    }
-
-    public static Path getInstance(Path path) {
-        Path retPath = getInstance(path.toString());
-
-        return retPath;
-    }
-
-    /**
-    * Create an empty path.
-    *
-    * @return The root instance.
-    */
-    public static Path getRootInstance() {
-        return new Path();
-    }
-
-    /**
-    * Add an element to the end of this path.
-    *
-    * @param element The element to add.
-    */
-    public void add(String element) {
-        if (element != null) {
-            element = element.trim();
-
-            if (!element.equals("")) {
-                getPath().add(element);
-                updateHashCode(element);
-            }
-        }
-    }
-
-    /**
-    * Compare this object with <i>other</i> object for equallity.
-    *
-    * @param other The comparison object.
-    * @return boolean <tt>true</tt> if this object and <i>other</i> are equal.
-    *                 <tt>false</tt> otherwise.
-    */
-    public boolean equals(Object other) {
-        boolean ret;
-
-        if (other != null) {
-            try {
-                ret = equals((Path) other);
-            } catch (ClassCastException ex) {
-                ret = false;
-            }
-        } else {
-            ret = false;
-        }
-
-        return ret;
-    }
-
-    /**
-    * Compare this path with <i>other</i> path for equallity.
-    *
-    * @param other The comparison path.
-    * @return boolean <tt>true</tt> if this path and <i>other</i> are equal.
-    *                 <tt>false</tt> otherwise.
-    */
-    public boolean equals(Path other) {
-        return (getPath().size() == other.getPath().size()) && (getPath().equals(other.getPath()));
-    }
-
-    public int hashCode() {
-        return getHashCode();
-    }
-
-    /**
-    * Remove the last element of this path.
-    */
-    public void remove() {
-        if (!getPath().isEmpty()) {
-            Object element = getPath().remove(getPath().size() - 1);
-            updateHashCode(element);
-        }
-    }
-
-    /**
-    * Create a string representation for this path.
-    *
-    * @return String The string representation.
-    */
-    public String toString() {
-        StringBuffer buff = new StringBuffer(32);
-        Iterator iter = getPath().iterator();
-
-        while (iter.hasNext()) {
-            buff.append("/").append(iter.next());
-        }
-
-        return buff.toString();
-    }
-
-    private void setHashCode(int hashCode) {
-        this.hashCode = hashCode;
-    }
-
-    private int getHashCode() {
-        return hashCode;
-    }
-
-    /**
-    * Change the path list.
-    */
-    private void setPath(List path) {
-        this.path = path;
-    }
-
-    /**
-    * Access the path list.
-    */
-    private List getPath() {
-        return path;
-    }
-
-    private void updateHashCode(Object element) {
-        setHashCode(getHashCode() ^ element.hashCode());
-    }
-}

src/java/com/opensymphony/xwork/xml/SubHandler.java

-/*
- * Copyright (c) 2002-2003 by OpenSymphony
- * All rights reserved.
- */
-package com.opensymphony.xwork.xml;
-
-import com.opensymphony.xwork.xml.DelegatingHandler;
-import com.opensymphony.xwork.xml.Path;
-
-import org.xml.sax.ContentHandler;
-
-import java.util.Map;
-
-
-/**
- * SubHandler
- *
- * Created Oct 21, 2002 3:30:41 PM
- * @author Jason Carreira
- * @version 1.0
- */
-public interface SubHandler extends ContentHandler {
-    //~ Methods ////////////////////////////////////////////////////////////////
-
-    void endingPath(Path path);
-
-    void registerWith(DelegatingHandler rootHandler);
-
-    void startingPath(Path path, Map attributeMap);
-
-    void unregisterWith(DelegatingHandler rootHandler);
-}

src/java/com/opensymphony/xwork/xml/handlers/AddPartHandler.java

-/*
- * Copyright (c) 2002-2003 by OpenSymphony
- * All rights reserved.
- */
-package com.opensymphony.xwork.xml.handlers;
-
-import com.opensymphony.xwork.util.OgnlUtil;
-import com.opensymphony.xwork.util.OgnlValueStack;
-import com.opensymphony.xwork.xml.DefaultSubHandler;
-import com.opensymphony.xwork.xml.Path;
-
-import java.beans.Introspector;
-
-import java.lang.reflect.Method;