You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@struts.apache.org by ma...@apache.org on 2005/08/05 06:13:54 UTC

svn commit: r230394 [1/2] - in /struts/sandbox/trunk/ti/src: example/WEB-INF/src/java/ example/WEB-INF/src/java/ttt/ java/org/apache/ti/config/ java/org/apache/ti/config/mapper/ java/org/apache/ti/processor/ java/org/apache/ti/processor/chain/ java/org...

Author: martinc
Date: Thu Aug  4 21:13:44 2005
New Revision: 230394

URL: http://svn.apache.org/viewcvs?rev=230394&view=rev
Log:
Set eol-style and keyword properties.

Modified:
    struts/sandbox/trunk/ti/src/example/WEB-INF/src/java/Controller.java   (props changed)
    struts/sandbox/trunk/ti/src/example/WEB-INF/src/java/ttt/Game.java   (props changed)
    struts/sandbox/trunk/ti/src/java/org/apache/ti/config/ProcessTags.java   (contents, props changed)
    struts/sandbox/trunk/ti/src/java/org/apache/ti/config/ProcessTagsTask.java   (contents, props changed)
    struts/sandbox/trunk/ti/src/java/org/apache/ti/config/XDocletParser.java   (contents, props changed)
    struts/sandbox/trunk/ti/src/java/org/apache/ti/config/mapper/ActionMapper.java   (contents, props changed)
    struts/sandbox/trunk/ti/src/java/org/apache/ti/config/mapper/ActionMapping.java   (contents, props changed)
    struts/sandbox/trunk/ti/src/java/org/apache/ti/config/mapper/ServletActionMapper.java   (contents, props changed)
    struts/sandbox/trunk/ti/src/java/org/apache/ti/processor/BaseResult.java   (contents, props changed)
    struts/sandbox/trunk/ti/src/java/org/apache/ti/processor/ControllerAction.java   (contents, props changed)
    struts/sandbox/trunk/ti/src/java/org/apache/ti/processor/ControllerActionInvocation.java   (contents, props changed)
    struts/sandbox/trunk/ti/src/java/org/apache/ti/processor/ControllerContext.java   (contents, props changed)
    struts/sandbox/trunk/ti/src/java/org/apache/ti/processor/ProcessorException.java   (contents, props changed)
    struts/sandbox/trunk/ti/src/java/org/apache/ti/processor/RequestProcessor.java   (contents, props changed)
    struts/sandbox/trunk/ti/src/java/org/apache/ti/processor/SpringActionProxyFactory.java   (contents, props changed)
    struts/sandbox/trunk/ti/src/java/org/apache/ti/processor/SpringObjectFactory.java   (contents, props changed)
    struts/sandbox/trunk/ti/src/java/org/apache/ti/processor/chain/ChainRequestProcessor.java   (contents, props changed)
    struts/sandbox/trunk/ti/src/java/org/apache/ti/processor/chain/CreateActionMapping.java   (contents, props changed)
    struts/sandbox/trunk/ti/src/java/org/apache/ti/processor/chain/CreateActionProxy.java   (contents, props changed)
    struts/sandbox/trunk/ti/src/java/org/apache/ti/processor/chain/ExecuteAction.java   (contents, props changed)
    struts/sandbox/trunk/ti/src/java/org/apache/ti/processor/chain/InitControllerContext.java   (contents, props changed)
    struts/sandbox/trunk/ti/src/java/org/apache/ti/processor/chain/InitXWork.java   (contents, props changed)
    struts/sandbox/trunk/ti/src/java/org/apache/ti/processor/chain/ProcessActionChain.java   (contents, props changed)
    struts/sandbox/trunk/ti/src/java/org/apache/ti/processor/chain/SpringConfigRuleSet.java   (contents, props changed)
    struts/sandbox/trunk/ti/src/java/org/apache/ti/servlet/ServletDispatcherResult.java   (contents, props changed)
    struts/sandbox/trunk/ti/src/java/org/apache/ti/servlet/StrutsTiServlet.java   (contents, props changed)
    struts/sandbox/trunk/ti/src/java/org/apache/ti/util/ServletSourceResolver.java   (contents, props changed)
    struts/sandbox/trunk/ti/src/java/org/apache/ti/util/SourceResolver.java   (contents, props changed)
    struts/sandbox/trunk/ti/src/test/org/apache/ti/config/TestProcessTags.java   (contents, props changed)
    struts/sandbox/trunk/ti/src/test/org/apache/ti/config/TestXDocletParser.java   (contents, props changed)
    struts/sandbox/trunk/ti/src/test/org/apache/ti/config/mapper/TestServletActionMapper.java   (contents, props changed)
    struts/sandbox/trunk/ti/src/test/org/apache/ti/processor/chain/Bean.java   (contents, props changed)
    struts/sandbox/trunk/ti/src/test/org/apache/ti/processor/chain/TestSpringConfigRuleSet.java   (contents, props changed)

Propchange: struts/sandbox/trunk/ti/src/example/WEB-INF/src/java/Controller.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: struts/sandbox/trunk/ti/src/example/WEB-INF/src/java/Controller.java
------------------------------------------------------------------------------
    svn:keywords = Date Author Id Revision HeadURL

Propchange: struts/sandbox/trunk/ti/src/example/WEB-INF/src/java/ttt/Game.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: struts/sandbox/trunk/ti/src/example/WEB-INF/src/java/ttt/Game.java
------------------------------------------------------------------------------
    svn:keywords = Date Author Id Revision HeadURL

Modified: struts/sandbox/trunk/ti/src/java/org/apache/ti/config/ProcessTags.java
URL: http://svn.apache.org/viewcvs/struts/sandbox/trunk/ti/src/java/org/apache/ti/config/ProcessTags.java?rev=230394&r1=230393&r2=230394&view=diff
==============================================================================
--- struts/sandbox/trunk/ti/src/java/org/apache/ti/config/ProcessTags.java (original)
+++ struts/sandbox/trunk/ti/src/java/org/apache/ti/config/ProcessTags.java Thu Aug  4 21:13:44 2005
@@ -1,80 +1,80 @@
-/*
- * $Id$
- *
- * Copyright 2005 The Apache Software Foundation.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.ti.config;
-
-import java.io.File;
-import java.io.FileReader;
-import java.io.FileWriter;
-import java.io.IOException;
-import java.util.ArrayList;
-import java.util.Iterator;
-import java.util.List;
-
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-
-/**
- *  Crawls a directory, processing all found Java source files.
- */
-public class ProcessTags {
-
-    private XDocletParser xdocletParser;
-
-    private static final Log log = LogFactory.getLog(ProcessTags.class);
-    private static final String SEP = File.separator;
-
-    public void setXDocletParser(XDocletParser parser) {
-        this.xdocletParser = parser;
-    }
-
-    public void process(File src, String srcName, File dest, String destName) throws IOException {
-        crawl(src, srcName, dest, destName, new ArrayList());
-    }
-
-    protected void crawl(File src, String srcName, File dest, String destName, List stack) throws IOException {
-        File[] kids = src.listFiles();
-        boolean controllerFound = false;
-        for (int x=0; x<kids.length; x++) {
-            if (kids[x].isDirectory()) {
-                stack.add(kids[x].getName());
-                crawl(kids[x], srcName, dest, destName, stack);
-                stack.remove(stack.size() - 1);
-            } else if (!controllerFound && srcName.equals(kids[x].getName())) {
-                StringBuffer path = new StringBuffer();
-                for (Iterator i = stack.iterator(); i.hasNext(); ) {
-                    path.append(i.next()).append(SEP);
-                }
-                File destDir = new File(dest, path.toString());
-                destDir.mkdirs();
-                File destFile = new File(destDir, destName);
-                String filePath = path.toString() + kids[x].getName();
-
-                log.info("Generating "+destFile);
-                FileWriter writer =  new FileWriter(destFile);
-                try {
-                    xdocletParser.generate(filePath, new FileReader(kids[x]), writer);
-                } finally {
-                    try {
-                        writer.close();
-                    } catch (IOException ex) {}
-                }
-                controllerFound = true;
-            }
-        }
-    }
-}
+/*
+ * $Id$
+ *
+ * Copyright 2005 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.ti.config;
+
+import java.io.File;
+import java.io.FileReader;
+import java.io.FileWriter;
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+/**
+ *  Crawls a directory, processing all found Java source files.
+ */
+public class ProcessTags {
+
+    private XDocletParser xdocletParser;
+
+    private static final Log log = LogFactory.getLog(ProcessTags.class);
+    private static final String SEP = File.separator;
+
+    public void setXDocletParser(XDocletParser parser) {
+        this.xdocletParser = parser;
+    }
+
+    public void process(File src, String srcName, File dest, String destName) throws IOException {
+        crawl(src, srcName, dest, destName, new ArrayList());
+    }
+
+    protected void crawl(File src, String srcName, File dest, String destName, List stack) throws IOException {
+        File[] kids = src.listFiles();
+        boolean controllerFound = false;
+        for (int x=0; x<kids.length; x++) {
+            if (kids[x].isDirectory()) {
+                stack.add(kids[x].getName());
+                crawl(kids[x], srcName, dest, destName, stack);
+                stack.remove(stack.size() - 1);
+            } else if (!controllerFound && srcName.equals(kids[x].getName())) {
+                StringBuffer path = new StringBuffer();
+                for (Iterator i = stack.iterator(); i.hasNext(); ) {
+                    path.append(i.next()).append(SEP);
+                }
+                File destDir = new File(dest, path.toString());
+                destDir.mkdirs();
+                File destFile = new File(destDir, destName);
+                String filePath = path.toString() + kids[x].getName();
+
+                log.info("Generating "+destFile);
+                FileWriter writer =  new FileWriter(destFile);
+                try {
+                    xdocletParser.generate(filePath, new FileReader(kids[x]), writer);
+                } finally {
+                    try {
+                        writer.close();
+                    } catch (IOException ex) {}
+                }
+                controllerFound = true;
+            }
+        }
+    }
+}

Propchange: struts/sandbox/trunk/ti/src/java/org/apache/ti/config/ProcessTags.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: struts/sandbox/trunk/ti/src/java/org/apache/ti/config/ProcessTags.java
------------------------------------------------------------------------------
    svn:keywords = Date Author Id Revision HeadURL

Modified: struts/sandbox/trunk/ti/src/java/org/apache/ti/config/ProcessTagsTask.java
URL: http://svn.apache.org/viewcvs/struts/sandbox/trunk/ti/src/java/org/apache/ti/config/ProcessTagsTask.java?rev=230394&r1=230393&r2=230394&view=diff
==============================================================================
--- struts/sandbox/trunk/ti/src/java/org/apache/ti/config/ProcessTagsTask.java (original)
+++ struts/sandbox/trunk/ti/src/java/org/apache/ti/config/ProcessTagsTask.java Thu Aug  4 21:13:44 2005
@@ -1,57 +1,57 @@
-/*
- * $Id$
- *
- * Copyright 2005 The Apache Software Foundation.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.ti.config;
-
-import java.io.File;
-import java.io.IOException;
-
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-
-/**
- *  Ant task that wraps ProcessTags
- */
-public class ProcessTagsTask {
-
-    private ProcessTags processTags;
-    private File srcdir;
-    private File destdir;
-    
-    private static final Log log = LogFactory.getLog(ProcessTagsTask.class);
-    
-    public void setSrcdir(File file) {
-        this.srcdir = file;
-    }
-    
-    public void setDestdir(File file) {
-        this.destdir = file;
-    }
-    
-    public void execute() {
-        XDocletParser parser = new XDocletParser();
-        parser.init();
-        ProcessTags pt = new ProcessTags();
-        pt.setXDocletParser(parser);
-        
-        try {
-            pt.process(srcdir, "Controller.java", destdir, "xwork.xml");
-        } catch (IOException ex) {
-            ex.printStackTrace();
-        }
-    }
-}    
+/*
+ * $Id$
+ *
+ * Copyright 2005 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.ti.config;
+
+import java.io.File;
+import java.io.IOException;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+/**
+ *  Ant task that wraps ProcessTags
+ */
+public class ProcessTagsTask {
+
+    private ProcessTags processTags;
+    private File srcdir;
+    private File destdir;
+    
+    private static final Log log = LogFactory.getLog(ProcessTagsTask.class);
+    
+    public void setSrcdir(File file) {
+        this.srcdir = file;
+    }
+    
+    public void setDestdir(File file) {
+        this.destdir = file;
+    }
+    
+    public void execute() {
+        XDocletParser parser = new XDocletParser();
+        parser.init();
+        ProcessTags pt = new ProcessTags();
+        pt.setXDocletParser(parser);
+        
+        try {
+            pt.process(srcdir, "Controller.java", destdir, "xwork.xml");
+        } catch (IOException ex) {
+            ex.printStackTrace();
+        }
+    }
+}    

Propchange: struts/sandbox/trunk/ti/src/java/org/apache/ti/config/ProcessTagsTask.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: struts/sandbox/trunk/ti/src/java/org/apache/ti/config/ProcessTagsTask.java
------------------------------------------------------------------------------
    svn:keywords = Date Author Id Revision HeadURL

Modified: struts/sandbox/trunk/ti/src/java/org/apache/ti/config/XDocletParser.java
URL: http://svn.apache.org/viewcvs/struts/sandbox/trunk/ti/src/java/org/apache/ti/config/XDocletParser.java?rev=230394&r1=230393&r2=230394&view=diff
==============================================================================
--- struts/sandbox/trunk/ti/src/java/org/apache/ti/config/XDocletParser.java (original)
+++ struts/sandbox/trunk/ti/src/java/org/apache/ti/config/XDocletParser.java Thu Aug  4 21:13:44 2005
@@ -1,102 +1,102 @@
-/*
- * $Id$
- *
- * Copyright 2005 The Apache Software Foundation.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.ti.config;
-
-import java.io.Reader;
-import java.io.Writer;
-import java.util.HashMap;
-import java.util.Map;
-import java.util.Properties;
-
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import org.apache.velocity.Template;
-import org.apache.velocity.VelocityContext;
-import org.apache.velocity.app.VelocityEngine;
-import org.apache.velocity.exception.ResourceNotFoundException;
-
-import xjavadoc.XClass;
-import xjavadoc.XJavaDoc;
-import xjavadoc.filesystem.ReaderFile;
-
-/**
- *  Processes xdoclet-style tags and uses a velocity template to generate 
- *  content.
- */
-public class XDocletParser {
-
-    private String templateName = "org/apache/ti/config/xdocletToXWork.vm";
-    private Template template;
-    private Map parameters;
-    private static final Log log = LogFactory.getLog(XDocletParser.class);
-    
-    public void init() {
-        VelocityEngine velocity = new VelocityEngine();
-        
-        Properties props = new Properties();
-        try {
-            props.load(getClass().getResourceAsStream("velocity.properties"));
-            velocity.init(props);
-            template = velocity.getTemplate(templateName);
-        } catch (ResourceNotFoundException ex) {
-            log.error("Unable to locate template to process javadoc tags", ex);
-        }catch (Exception ex) {
-            log.error("Unable to intialize velocity", ex);
-        }    
-        
-    }
-    
-    public void setParameters(Map map) {
-        this.parameters = map;
-    }
-    
-    public Map getParameters() {
-        return parameters;
-    }
-        
-    public void setTemplateName(String name) {
-        this.templateName = name;
-    }
-    
-    public void generate(String name, Reader reader, Writer writer) {
-        XJavaDoc jdoc = new XJavaDoc();
-        ReaderFile file = new ReaderFile(reader);
-        
-        
-        String className = name.replace('/', '.');
-        className = className.replace('\\', '.');
-        className = className.substring(0, className.indexOf(".java"));
-        
-        jdoc.addAbstractFile(className, file);
-        XClass xclass = jdoc.getXClass(className);
-        
-        Map contextMap = new HashMap();
-        if (parameters != null) {
-            contextMap.putAll(parameters);
-        }    
-        VelocityContext context = new VelocityContext(contextMap);
-        context.put("xclass", xclass);
-        context.put("javaFile", name);
-        
-        try {
-            template.merge(context, writer);
-        } catch (Exception ex) {
-            log.error("Unable to generate javadoc output", ex);
-        }    
-    }
-}   
+/*
+ * $Id$
+ *
+ * Copyright 2005 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.ti.config;
+
+import java.io.Reader;
+import java.io.Writer;
+import java.util.HashMap;
+import java.util.Map;
+import java.util.Properties;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.apache.velocity.Template;
+import org.apache.velocity.VelocityContext;
+import org.apache.velocity.app.VelocityEngine;
+import org.apache.velocity.exception.ResourceNotFoundException;
+
+import xjavadoc.XClass;
+import xjavadoc.XJavaDoc;
+import xjavadoc.filesystem.ReaderFile;
+
+/**
+ *  Processes xdoclet-style tags and uses a velocity template to generate 
+ *  content.
+ */
+public class XDocletParser {
+
+    private String templateName = "org/apache/ti/config/xdocletToXWork.vm";
+    private Template template;
+    private Map parameters;
+    private static final Log log = LogFactory.getLog(XDocletParser.class);
+    
+    public void init() {
+        VelocityEngine velocity = new VelocityEngine();
+        
+        Properties props = new Properties();
+        try {
+            props.load(getClass().getResourceAsStream("velocity.properties"));
+            velocity.init(props);
+            template = velocity.getTemplate(templateName);
+        } catch (ResourceNotFoundException ex) {
+            log.error("Unable to locate template to process javadoc tags", ex);
+        }catch (Exception ex) {
+            log.error("Unable to intialize velocity", ex);
+        }    
+        
+    }
+    
+    public void setParameters(Map map) {
+        this.parameters = map;
+    }
+    
+    public Map getParameters() {
+        return parameters;
+    }
+        
+    public void setTemplateName(String name) {
+        this.templateName = name;
+    }
+    
+    public void generate(String name, Reader reader, Writer writer) {
+        XJavaDoc jdoc = new XJavaDoc();
+        ReaderFile file = new ReaderFile(reader);
+        
+        
+        String className = name.replace('/', '.');
+        className = className.replace('\\', '.');
+        className = className.substring(0, className.indexOf(".java"));
+        
+        jdoc.addAbstractFile(className, file);
+        XClass xclass = jdoc.getXClass(className);
+        
+        Map contextMap = new HashMap();
+        if (parameters != null) {
+            contextMap.putAll(parameters);
+        }    
+        VelocityContext context = new VelocityContext(contextMap);
+        context.put("xclass", xclass);
+        context.put("javaFile", name);
+        
+        try {
+            template.merge(context, writer);
+        } catch (Exception ex) {
+            log.error("Unable to generate javadoc output", ex);
+        }    
+    }
+}   

Propchange: struts/sandbox/trunk/ti/src/java/org/apache/ti/config/XDocletParser.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: struts/sandbox/trunk/ti/src/java/org/apache/ti/config/XDocletParser.java
------------------------------------------------------------------------------
    svn:keywords = Date Author Id Revision HeadURL

Modified: struts/sandbox/trunk/ti/src/java/org/apache/ti/config/mapper/ActionMapper.java
URL: http://svn.apache.org/viewcvs/struts/sandbox/trunk/ti/src/java/org/apache/ti/config/mapper/ActionMapper.java?rev=230394&r1=230393&r2=230394&view=diff
==============================================================================
--- struts/sandbox/trunk/ti/src/java/org/apache/ti/config/mapper/ActionMapper.java (original)
+++ struts/sandbox/trunk/ti/src/java/org/apache/ti/config/mapper/ActionMapper.java Thu Aug  4 21:13:44 2005
@@ -1,29 +1,29 @@
-/*
- * $Id$
- *
- * Copyright 2005 The Apache Software Foundation.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.ti.config.mapper;
-
-import org.apache.commons.chain.web.WebContext;
-
-/**
- * Handles creation of ActionMapping and reconstruction of URI's from one
- */
-public interface ActionMapper {
-    ActionMapping getMapping(WebContext ctx);
-
-    String getUriFromActionMapping(ActionMapping mapping);
-}
+/*
+ * $Id$
+ *
+ * Copyright 2005 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.ti.config.mapper;
+
+import org.apache.commons.chain.web.WebContext;
+
+/**
+ * Handles creation of ActionMapping and reconstruction of URI's from one
+ */
+public interface ActionMapper {
+    ActionMapping getMapping(WebContext ctx);
+
+    String getUriFromActionMapping(ActionMapping mapping);
+}

Propchange: struts/sandbox/trunk/ti/src/java/org/apache/ti/config/mapper/ActionMapper.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: struts/sandbox/trunk/ti/src/java/org/apache/ti/config/mapper/ActionMapper.java
------------------------------------------------------------------------------
    svn:keywords = Date Author Id Revision HeadURL

Modified: struts/sandbox/trunk/ti/src/java/org/apache/ti/config/mapper/ActionMapping.java
URL: http://svn.apache.org/viewcvs/struts/sandbox/trunk/ti/src/java/org/apache/ti/config/mapper/ActionMapping.java?rev=230394&r1=230393&r2=230394&view=diff
==============================================================================
--- struts/sandbox/trunk/ti/src/java/org/apache/ti/config/mapper/ActionMapping.java (original)
+++ struts/sandbox/trunk/ti/src/java/org/apache/ti/config/mapper/ActionMapping.java Thu Aug  4 21:13:44 2005
@@ -1,58 +1,58 @@
-/*
- * $Id$
- *
- * Copyright 2005 The Apache Software Foundation.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.ti.config.mapper;
-
-import java.util.Map;
-
-/**
- * Simple class that holds the action mapping information used to invoke an
- * action. The name and namespace are required, but the params map
- * is optional, and as such may be null. If a params map is supplied,
- * it <b>must</b> be a mutable map, such as a HashMap.
- *
- * @author Patrick Lightbody
- */
-public class ActionMapping {
-    private String name;
-    private String externalMapping;
-    private String namespace;
-    private Map params;
-
-    public ActionMapping(String name, String namespace, String extMapping, Map params) {
-        this.name = name;
-        this.namespace = namespace;
-        this.params = params;
-        this.externalMapping = extMapping;
-    }
-
-    public String getName() {
-        return name;
-    }
-
-    public String getNamespace() {
-        return namespace;
-    }
-
-    public Map getParams() {
-        return params;
-    }
-    
-    public String getExternalMapping() {
-        return externalMapping;
-    }
-}
+/*
+ * $Id$
+ *
+ * Copyright 2005 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.ti.config.mapper;
+
+import java.util.Map;
+
+/**
+ * Simple class that holds the action mapping information used to invoke an
+ * action. The name and namespace are required, but the params map
+ * is optional, and as such may be null. If a params map is supplied,
+ * it <b>must</b> be a mutable map, such as a HashMap.
+ *
+ * @author Patrick Lightbody
+ */
+public class ActionMapping {
+    private String name;
+    private String externalMapping;
+    private String namespace;
+    private Map params;
+
+    public ActionMapping(String name, String namespace, String extMapping, Map params) {
+        this.name = name;
+        this.namespace = namespace;
+        this.params = params;
+        this.externalMapping = extMapping;
+    }
+
+    public String getName() {
+        return name;
+    }
+
+    public String getNamespace() {
+        return namespace;
+    }
+
+    public Map getParams() {
+        return params;
+    }
+    
+    public String getExternalMapping() {
+        return externalMapping;
+    }
+}

Propchange: struts/sandbox/trunk/ti/src/java/org/apache/ti/config/mapper/ActionMapping.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: struts/sandbox/trunk/ti/src/java/org/apache/ti/config/mapper/ActionMapping.java
------------------------------------------------------------------------------
    svn:keywords = Date Author Id Revision HeadURL

Modified: struts/sandbox/trunk/ti/src/java/org/apache/ti/config/mapper/ServletActionMapper.java
URL: http://svn.apache.org/viewcvs/struts/sandbox/trunk/ti/src/java/org/apache/ti/config/mapper/ServletActionMapper.java?rev=230394&r1=230393&r2=230394&view=diff
==============================================================================
--- struts/sandbox/trunk/ti/src/java/org/apache/ti/config/mapper/ServletActionMapper.java (original)
+++ struts/sandbox/trunk/ti/src/java/org/apache/ti/config/mapper/ServletActionMapper.java Thu Aug  4 21:13:44 2005
@@ -1,108 +1,108 @@
-/*
- * $Id$
- *
- * Copyright 2005 The Apache Software Foundation.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.ti.config.mapper;
-
-import java.util.Iterator;
-import java.util.List;
-
-import javax.servlet.http.HttpServletRequest;
-
-import org.apache.commons.chain.web.WebContext;
-import org.apache.commons.chain.web.servlet.ServletWebContext;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import org.apache.ti.servlet.StrutsTiServlet;
-
-/**
- * Handles creation of ActionMapping and reconstruction of URI's from one.  Uses
- * original servlet mapping to determine action mapping and reconstructed uri.
- */
-public class ServletActionMapper implements ActionMapper {
-    
-    protected static final Log log = LogFactory.getLog(ServletActionMapper.class);
-    
-    public ActionMapping getMapping(WebContext ctx) {
-        
-        HttpServletRequest request = ((ServletWebContext)ctx).getRequest();
-        List mappings = (List) ctx.get(StrutsTiServlet.SERVLET_MAPPINGS_KEY);
-        String servletPath = request.getServletPath();
-        return getMapping(servletPath, mappings);
-    }
-    
-    protected ActionMapping getMapping(String servletPath, List mappings) {
-        String uri = null;
-        String mapping = null;
-        for (Iterator i = mappings.iterator(); i.hasNext(); ) {
-            mapping = (String)i.next();
-            
-            // Try to match prefix-based mapping
-            if (mapping.charAt(mapping.length() - 1) == '*') {
-                String prefix = mapping.substring(0, mapping.length() - 1);
-                if (servletPath.startsWith(prefix)) {
-                    uri = servletPath.substring(prefix.length());
-                    log.debug("matched prefix:"+prefix);
-                    break;
-                }
-            
-            // Try to match extension mapping
-            } else if (mapping.charAt(0) == '*') {
-                String ext = mapping.substring(1);
-                if (servletPath.endsWith(ext)) {
-                    uri = servletPath.substring(1, (servletPath.length() - ext.length()));
-                    log.debug("matched ext:"+ext);
-                    break;
-                }
-            }
-        }
-        
-        if (uri != null) {
-            log.debug("uri:"+uri);
-            int div = uri.lastIndexOf('/');
-            String action = uri.substring(div + 1);
-            String namespace = "";
-            if (div > 0) {
-                namespace = uri.substring(0, div);
-            }
-            
-            return new ActionMapping(action, namespace, mapping, null);
-        } else {
-            // Couldn't find any action mapping
-            return null;
-        }
-    }
-
-    public String getUriFromActionMapping(ActionMapping mapping) {
-        
-        String ext = mapping.getExternalMapping();
-        int star = ext.indexOf('*');
-        
-        StringBuffer sb = new StringBuffer();
-        if (star > 0) {
-            sb.append(ext.substring(0, star));
-        } else {
-            sb.append('/');
-        }
-        sb.append(mapping.getNamespace());
-        sb.append('/');
-        sb.append(mapping.getName());
-        if (star < ext.length() - 1) {
-            sb.append(ext.substring(star + 1));
-        }
-        return sb.toString();
-    }
-}
+/*
+ * $Id$
+ *
+ * Copyright 2005 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.ti.config.mapper;
+
+import java.util.Iterator;
+import java.util.List;
+
+import javax.servlet.http.HttpServletRequest;
+
+import org.apache.commons.chain.web.WebContext;
+import org.apache.commons.chain.web.servlet.ServletWebContext;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.apache.ti.servlet.StrutsTiServlet;
+
+/**
+ * Handles creation of ActionMapping and reconstruction of URI's from one.  Uses
+ * original servlet mapping to determine action mapping and reconstructed uri.
+ */
+public class ServletActionMapper implements ActionMapper {
+    
+    protected static final Log log = LogFactory.getLog(ServletActionMapper.class);
+    
+    public ActionMapping getMapping(WebContext ctx) {
+        
+        HttpServletRequest request = ((ServletWebContext)ctx).getRequest();
+        List mappings = (List) ctx.get(StrutsTiServlet.SERVLET_MAPPINGS_KEY);
+        String servletPath = request.getServletPath();
+        return getMapping(servletPath, mappings);
+    }
+    
+    protected ActionMapping getMapping(String servletPath, List mappings) {
+        String uri = null;
+        String mapping = null;
+        for (Iterator i = mappings.iterator(); i.hasNext(); ) {
+            mapping = (String)i.next();
+            
+            // Try to match prefix-based mapping
+            if (mapping.charAt(mapping.length() - 1) == '*') {
+                String prefix = mapping.substring(0, mapping.length() - 1);
+                if (servletPath.startsWith(prefix)) {
+                    uri = servletPath.substring(prefix.length());
+                    log.debug("matched prefix:"+prefix);
+                    break;
+                }
+            
+            // Try to match extension mapping
+            } else if (mapping.charAt(0) == '*') {
+                String ext = mapping.substring(1);
+                if (servletPath.endsWith(ext)) {
+                    uri = servletPath.substring(1, (servletPath.length() - ext.length()));
+                    log.debug("matched ext:"+ext);
+                    break;
+                }
+            }
+        }
+        
+        if (uri != null) {
+            log.debug("uri:"+uri);
+            int div = uri.lastIndexOf('/');
+            String action = uri.substring(div + 1);
+            String namespace = "";
+            if (div > 0) {
+                namespace = uri.substring(0, div);
+            }
+            
+            return new ActionMapping(action, namespace, mapping, null);
+        } else {
+            // Couldn't find any action mapping
+            return null;
+        }
+    }
+
+    public String getUriFromActionMapping(ActionMapping mapping) {
+        
+        String ext = mapping.getExternalMapping();
+        int star = ext.indexOf('*');
+        
+        StringBuffer sb = new StringBuffer();
+        if (star > 0) {
+            sb.append(ext.substring(0, star));
+        } else {
+            sb.append('/');
+        }
+        sb.append(mapping.getNamespace());
+        sb.append('/');
+        sb.append(mapping.getName());
+        if (star < ext.length() - 1) {
+            sb.append(ext.substring(star + 1));
+        }
+        return sb.toString();
+    }
+}

Propchange: struts/sandbox/trunk/ti/src/java/org/apache/ti/config/mapper/ServletActionMapper.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: struts/sandbox/trunk/ti/src/java/org/apache/ti/config/mapper/ServletActionMapper.java
------------------------------------------------------------------------------
    svn:keywords = Date Author Id Revision HeadURL

Modified: struts/sandbox/trunk/ti/src/java/org/apache/ti/processor/BaseResult.java
URL: http://svn.apache.org/viewcvs/struts/sandbox/trunk/ti/src/java/org/apache/ti/processor/BaseResult.java?rev=230394&r1=230393&r2=230394&view=diff
==============================================================================
--- struts/sandbox/trunk/ti/src/java/org/apache/ti/processor/BaseResult.java (original)
+++ struts/sandbox/trunk/ti/src/java/org/apache/ti/processor/BaseResult.java Thu Aug  4 21:13:44 2005
@@ -1,28 +1,28 @@
-/*
- * Copyright (c) 2002-2003 by OpenSymphony
- * All rights reserved.
- */
-package org.apache.ti.processor;
-
-import com.opensymphony.xwork.ActionInvocation;
-import com.opensymphony.xwork.Result;
-
-/**
- *  Wraps a controller
- */
-public abstract class BaseResult implements Result {
-
-    protected String location;
-    
-    public void setLocation(String loc) {
-        this.location = loc;
-    }
-    
-    public void execute(ActionInvocation invocation) throws Exception {
-        // perform processing like evaluating location argument as expression
-        doExecute(location, invocation);
-    }
-    
-    protected abstract void doExecute(String path, ActionInvocation invocation) throws Exception;  
-    
-}
+/*
+ * Copyright (c) 2002-2003 by OpenSymphony
+ * All rights reserved.
+ */
+package org.apache.ti.processor;
+
+import com.opensymphony.xwork.ActionInvocation;
+import com.opensymphony.xwork.Result;
+
+/**
+ *  Wraps a controller
+ */
+public abstract class BaseResult implements Result {
+
+    protected String location;
+    
+    public void setLocation(String loc) {
+        this.location = loc;
+    }
+    
+    public void execute(ActionInvocation invocation) throws Exception {
+        // perform processing like evaluating location argument as expression
+        doExecute(location, invocation);
+    }
+    
+    protected abstract void doExecute(String path, ActionInvocation invocation) throws Exception;  
+    
+}

Propchange: struts/sandbox/trunk/ti/src/java/org/apache/ti/processor/BaseResult.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: struts/sandbox/trunk/ti/src/java/org/apache/ti/processor/BaseResult.java
------------------------------------------------------------------------------
    svn:keywords = Date Author Id Revision HeadURL

Modified: struts/sandbox/trunk/ti/src/java/org/apache/ti/processor/ControllerAction.java
URL: http://svn.apache.org/viewcvs/struts/sandbox/trunk/ti/src/java/org/apache/ti/processor/ControllerAction.java?rev=230394&r1=230393&r2=230394&view=diff
==============================================================================
--- struts/sandbox/trunk/ti/src/java/org/apache/ti/processor/ControllerAction.java (original)
+++ struts/sandbox/trunk/ti/src/java/org/apache/ti/processor/ControllerAction.java Thu Aug  4 21:13:44 2005
@@ -1,40 +1,40 @@
-/*
- * Copyright (c) 2002-2003 by OpenSymphony
- * All rights reserved.
- */
-package org.apache.ti.processor;
-
-import com.opensymphony.xwork.Action;
-
-/**
- *  Wraps a controller
- */
-public class ControllerAction implements Action {
-
-    protected Object controller;
-    protected Object form;
-    
-    public void setController(Object w) {
-        this.controller = w;
-    }
-    
-    public Object getController() {
-        return controller;
-    }
-    
-    public Object getForm() {
-        return form;
-    }
-    
-    public void setForm(Object obj) {
-        this.form  = obj;
-    }
-    
-
-    public String execute() {
-        
-        // TODO
-        return Action.SUCCESS;
-    }
-    
-}
+/*
+ * Copyright (c) 2002-2003 by OpenSymphony
+ * All rights reserved.
+ */
+package org.apache.ti.processor;
+
+import com.opensymphony.xwork.Action;
+
+/**
+ *  Wraps a controller
+ */
+public class ControllerAction implements Action {
+
+    protected Object controller;
+    protected Object form;
+    
+    public void setController(Object w) {
+        this.controller = w;
+    }
+    
+    public Object getController() {
+        return controller;
+    }
+    
+    public Object getForm() {
+        return form;
+    }
+    
+    public void setForm(Object obj) {
+        this.form  = obj;
+    }
+    
+
+    public String execute() {
+        
+        // TODO
+        return Action.SUCCESS;
+    }
+    
+}

Propchange: struts/sandbox/trunk/ti/src/java/org/apache/ti/processor/ControllerAction.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: struts/sandbox/trunk/ti/src/java/org/apache/ti/processor/ControllerAction.java
------------------------------------------------------------------------------
    svn:keywords = Date Author Id Revision HeadURL

Modified: struts/sandbox/trunk/ti/src/java/org/apache/ti/processor/ControllerActionInvocation.java
URL: http://svn.apache.org/viewcvs/struts/sandbox/trunk/ti/src/java/org/apache/ti/processor/ControllerActionInvocation.java?rev=230394&r1=230393&r2=230394&view=diff
==============================================================================
--- struts/sandbox/trunk/ti/src/java/org/apache/ti/processor/ControllerActionInvocation.java (original)
+++ struts/sandbox/trunk/ti/src/java/org/apache/ti/processor/ControllerActionInvocation.java Thu Aug  4 21:13:44 2005
@@ -1,129 +1,129 @@
-/*
- * Copyright (c) 2002-2003 by OpenSymphony
- * All rights reserved.
- */
-package org.apache.ti.processor;
-
-import java.lang.reflect.InvocationTargetException;
-import java.lang.reflect.Method;
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.Map;
-
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import org.springframework.beans.factory.BeanFactory;
-
-import com.opensymphony.xwork.Action;
-import com.opensymphony.xwork.ActionProxy;
-import com.opensymphony.xwork.DefaultActionInvocation;
-import com.opensymphony.xwork.config.entities.ActionConfig;
-
-
-/**
- * Adds code to handle ControllerActions if detected
- * 
- * @see com.opensymphony.xwork.DefaultActionInvocation
- */
-public class ControllerActionInvocation extends DefaultActionInvocation {
-
-    private static final Log log = LogFactory.getLog(ControllerActionInvocation.class);
-    
-    protected static final Map methodsCache = Collections.synchronizedMap(new HashMap());
-
-    protected BeanFactory beanFactory;
-    protected ControllerAction ctrAction;
-    protected Method actionMethod;
-
-    protected ControllerActionInvocation(BeanFactory factory, ActionProxy proxy) throws Exception {
-        this(factory, proxy, null);
-    }
-
-    protected ControllerActionInvocation(BeanFactory factory, ActionProxy proxy, Map extraContext) throws Exception {
-        this(factory, proxy, extraContext, true);
-    }
-
-    protected ControllerActionInvocation(BeanFactory factory, ActionProxy proxy, Map extraContext, boolean pushAction) throws Exception {
-        super(proxy, extraContext, pushAction);
-    }
-    
-    protected Object getController() {
-        return ((ControllerAction)action).getController();
-    }
-    
-    public Method getActionMethod() {
-        return actionMethod;
-    }
-
-    protected void createAction() {
-        super.createAction();
-        
-        if (action instanceof ControllerAction) {
-            ctrAction = (ControllerAction)action;
-            createActionMethod();
-        }
-    }
-
-    protected String invokeAction(Action action, ActionConfig actionConfig) throws Exception {
-
-        if (action instanceof ControllerAction) {
-            try {
-                if (actionMethod.getParameterTypes().length == 1) {
-                    return (String) actionMethod.invoke(getController(), new Object[]{ctrAction.getForm()});
-                } else {
-                    return (String) actionMethod.invoke(getController(), new Object[0]);
-                }
-            } catch (InvocationTargetException e) {
-                // We try to return the source exception.
-                Throwable t = e.getTargetException();
-
-                if (t instanceof Exception) {
-                    throw (Exception) t;
-                } else {
-                    throw e;
-                }
-            }
-            // DO STUFF
-        } else {
-            return super.invokeAction(action, actionConfig);
-        }
-    }
-    
-    
-    protected void createActionMethod() {
-        //String methodName = proxy.getMethod();
-        
-        //if (methodName == null && actionConfig.getMethodName() == null) {
-        //    return null;
-        //}
-        //if (methodName == null) {
-        //    methodName = actionConfig.getMethodName();
-        //}
-        String methodName = getProxy().getConfig().getMethodName();
-        Method method = null;
-        Class ctrClass = getController().getClass();
-        
-        
-        
-        Method[] methods = (Method[])methodsCache.get(ctrClass);
-        if (methods == null) {
-            methods = ctrClass.getMethods();
-            methodsCache.put(ctrClass, methods);
-        }
-        
-        Method m;
-        for (int x=0; x < methods.length; x++) {
-            m = methods[x];
-            if (m.getName().equals(methodName) && m.getParameterTypes().length < 2) {
-                method = m;
-                break;
-            }
-        }
-        
-        if (method == null) {
-            throw new IllegalArgumentException("Method '" + methodName + "()' is not defined in controller '" + ctrClass + "'");
-        }
-        
-        actionMethod = method;
-    }
-}
+/*
+ * Copyright (c) 2002-2003 by OpenSymphony
+ * All rights reserved.
+ */
+package org.apache.ti.processor;
+
+import java.lang.reflect.InvocationTargetException;
+import java.lang.reflect.Method;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.Map;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.springframework.beans.factory.BeanFactory;
+
+import com.opensymphony.xwork.Action;
+import com.opensymphony.xwork.ActionProxy;
+import com.opensymphony.xwork.DefaultActionInvocation;
+import com.opensymphony.xwork.config.entities.ActionConfig;
+
+
+/**
+ * Adds code to handle ControllerActions if detected
+ * 
+ * @see com.opensymphony.xwork.DefaultActionInvocation
+ */
+public class ControllerActionInvocation extends DefaultActionInvocation {
+
+    private static final Log log = LogFactory.getLog(ControllerActionInvocation.class);
+    
+    protected static final Map methodsCache = Collections.synchronizedMap(new HashMap());
+
+    protected BeanFactory beanFactory;
+    protected ControllerAction ctrAction;
+    protected Method actionMethod;
+
+    protected ControllerActionInvocation(BeanFactory factory, ActionProxy proxy) throws Exception {
+        this(factory, proxy, null);
+    }
+
+    protected ControllerActionInvocation(BeanFactory factory, ActionProxy proxy, Map extraContext) throws Exception {
+        this(factory, proxy, extraContext, true);
+    }
+
+    protected ControllerActionInvocation(BeanFactory factory, ActionProxy proxy, Map extraContext, boolean pushAction) throws Exception {
+        super(proxy, extraContext, pushAction);
+    }
+    
+    protected Object getController() {
+        return ((ControllerAction)action).getController();
+    }
+    
+    public Method getActionMethod() {
+        return actionMethod;
+    }
+
+    protected void createAction() {
+        super.createAction();
+        
+        if (action instanceof ControllerAction) {
+            ctrAction = (ControllerAction)action;
+            createActionMethod();
+        }
+    }
+
+    protected String invokeAction(Action action, ActionConfig actionConfig) throws Exception {
+
+        if (action instanceof ControllerAction) {
+            try {
+                if (actionMethod.getParameterTypes().length == 1) {
+                    return (String) actionMethod.invoke(getController(), new Object[]{ctrAction.getForm()});
+                } else {
+                    return (String) actionMethod.invoke(getController(), new Object[0]);
+                }
+            } catch (InvocationTargetException e) {
+                // We try to return the source exception.
+                Throwable t = e.getTargetException();
+
+                if (t instanceof Exception) {
+                    throw (Exception) t;
+                } else {
+                    throw e;
+                }
+            }
+            // DO STUFF
+        } else {
+            return super.invokeAction(action, actionConfig);
+        }
+    }
+    
+    
+    protected void createActionMethod() {
+        //String methodName = proxy.getMethod();
+        
+        //if (methodName == null && actionConfig.getMethodName() == null) {
+        //    return null;
+        //}
+        //if (methodName == null) {
+        //    methodName = actionConfig.getMethodName();
+        //}
+        String methodName = getProxy().getConfig().getMethodName();
+        Method method = null;
+        Class ctrClass = getController().getClass();
+        
+        
+        
+        Method[] methods = (Method[])methodsCache.get(ctrClass);
+        if (methods == null) {
+            methods = ctrClass.getMethods();
+            methodsCache.put(ctrClass, methods);
+        }
+        
+        Method m;
+        for (int x=0; x < methods.length; x++) {
+            m = methods[x];
+            if (m.getName().equals(methodName) && m.getParameterTypes().length < 2) {
+                method = m;
+                break;
+            }
+        }
+        
+        if (method == null) {
+            throw new IllegalArgumentException("Method '" + methodName + "()' is not defined in controller '" + ctrClass + "'");
+        }
+        
+        actionMethod = method;
+    }
+}

Propchange: struts/sandbox/trunk/ti/src/java/org/apache/ti/processor/ControllerActionInvocation.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: struts/sandbox/trunk/ti/src/java/org/apache/ti/processor/ControllerActionInvocation.java
------------------------------------------------------------------------------
    svn:keywords = Date Author Id Revision HeadURL

Modified: struts/sandbox/trunk/ti/src/java/org/apache/ti/processor/ControllerContext.java
URL: http://svn.apache.org/viewcvs/struts/sandbox/trunk/ti/src/java/org/apache/ti/processor/ControllerContext.java?rev=230394&r1=230393&r2=230394&view=diff
==============================================================================
--- struts/sandbox/trunk/ti/src/java/org/apache/ti/processor/ControllerContext.java (original)
+++ struts/sandbox/trunk/ti/src/java/org/apache/ti/processor/ControllerContext.java Thu Aug  4 21:13:44 2005
@@ -1,55 +1,55 @@
-/*
- * $Id$
- *
- * Copyright 2005 The Apache Software Foundation.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.ti.processor;
-
-import org.apache.commons.chain.web.WebContext;
-import org.apache.ti.config.mapper.ActionMapping;
-
-import com.opensymphony.xwork.ActionContext;
-
-/**
- *  Context that adds Controller methods, using ActionContext for storage.
- */
-public class ControllerContext {
-    
-    public static final String CONTROLLER_CONTEXT = "controllerContext";
-
-    public static void setControllerContext(ControllerContext ctx) {
-        ActionContext.getContext().put(CONTROLLER_CONTEXT, ctx);
-    }
-    
-    public static ControllerContext getContext() {
-        return (ControllerContext) ActionContext.getContext().get(CONTROLLER_CONTEXT);
-    }
-
-    public WebContext getWebContext() {
-        return (WebContext)getFromStore("webContext");
-    }
-
-    public ActionMapping getActionMapping() {
-        return (ActionMapping) get("actionMapping");
-    }
-
-    protected Object getFromStore(String key) {
-        return ActionContext.getContext().get(key);
-    }
-
-    protected Object get(String key) {
-        return getWebContext().get(key);
-    }    
-}
+/*
+ * $Id$
+ *
+ * Copyright 2005 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.ti.processor;
+
+import org.apache.commons.chain.web.WebContext;
+import org.apache.ti.config.mapper.ActionMapping;
+
+import com.opensymphony.xwork.ActionContext;
+
+/**
+ *  Context that adds Controller methods, using ActionContext for storage.
+ */
+public class ControllerContext {
+    
+    public static final String CONTROLLER_CONTEXT = "controllerContext";
+
+    public static void setControllerContext(ControllerContext ctx) {
+        ActionContext.getContext().put(CONTROLLER_CONTEXT, ctx);
+    }
+    
+    public static ControllerContext getContext() {
+        return (ControllerContext) ActionContext.getContext().get(CONTROLLER_CONTEXT);
+    }
+
+    public WebContext getWebContext() {
+        return (WebContext)getFromStore("webContext");
+    }
+
+    public ActionMapping getActionMapping() {
+        return (ActionMapping) get("actionMapping");
+    }
+
+    protected Object getFromStore(String key) {
+        return ActionContext.getContext().get(key);
+    }
+
+    protected Object get(String key) {
+        return getWebContext().get(key);
+    }    
+}

Propchange: struts/sandbox/trunk/ti/src/java/org/apache/ti/processor/ControllerContext.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: struts/sandbox/trunk/ti/src/java/org/apache/ti/processor/ControllerContext.java
------------------------------------------------------------------------------
    svn:keywords = Date Author Id Revision HeadURL

Modified: struts/sandbox/trunk/ti/src/java/org/apache/ti/processor/ProcessorException.java
URL: http://svn.apache.org/viewcvs/struts/sandbox/trunk/ti/src/java/org/apache/ti/processor/ProcessorException.java?rev=230394&r1=230393&r2=230394&view=diff
==============================================================================
--- struts/sandbox/trunk/ti/src/java/org/apache/ti/processor/ProcessorException.java (original)
+++ struts/sandbox/trunk/ti/src/java/org/apache/ti/processor/ProcessorException.java Thu Aug  4 21:13:44 2005
@@ -1,39 +1,39 @@
-/*
- * $Id$
- *
- * Copyright 2005 The Apache Software Foundation.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.ti.processor;
-
-
-
-/**
- *  Wraps any exception thrown during request processing
- */
-public class ProcessorException extends RuntimeException {
-    
-    public ProcessorException(String msg) {
-        super(msg);
-    }
-    
-    public ProcessorException(String msg, Throwable e) {
-        super(msg, e);
-    }
-    
-    public ProcessorException(Throwable e) {
-        super(e);
-    }
-    
-}
+/*
+ * $Id$
+ *
+ * Copyright 2005 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.ti.processor;
+
+
+
+/**
+ *  Wraps any exception thrown during request processing
+ */
+public class ProcessorException extends RuntimeException {
+    
+    public ProcessorException(String msg) {
+        super(msg);
+    }
+    
+    public ProcessorException(String msg, Throwable e) {
+        super(msg, e);
+    }
+    
+    public ProcessorException(Throwable e) {
+        super(e);
+    }
+    
+}

Propchange: struts/sandbox/trunk/ti/src/java/org/apache/ti/processor/ProcessorException.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: struts/sandbox/trunk/ti/src/java/org/apache/ti/processor/ProcessorException.java
------------------------------------------------------------------------------
    svn:keywords = Date Author Id Revision HeadURL

Modified: struts/sandbox/trunk/ti/src/java/org/apache/ti/processor/RequestProcessor.java
URL: http://svn.apache.org/viewcvs/struts/sandbox/trunk/ti/src/java/org/apache/ti/processor/RequestProcessor.java?rev=230394&r1=230393&r2=230394&view=diff
==============================================================================
--- struts/sandbox/trunk/ti/src/java/org/apache/ti/processor/RequestProcessor.java (original)
+++ struts/sandbox/trunk/ti/src/java/org/apache/ti/processor/RequestProcessor.java Thu Aug  4 21:13:44 2005
@@ -1,37 +1,37 @@
-/*
- * $Id: ServletRequestHandler.java 170184 2005-05-14 23:54:24Z martinc $
- *
- * Copyright 2000-2004 The Apache Software Foundation.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.ti.processor;
-
-import java.util.Map;
-
-import org.apache.commons.chain.web.WebContext;
-
-
-/**
- *  Defines a class that processes requests
- */
-public interface RequestProcessor {
-
-    public void init(Map initParameters, WebContext ctx);
-    
-    public void process(WebContext ctx);
-    
-    public void destroy();
-    
-}
+/*
+ * $Id$
+ *
+ * Copyright 2000-2004 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.ti.processor;
+
+import java.util.Map;
+
+import org.apache.commons.chain.web.WebContext;
+
+
+/**
+ *  Defines a class that processes requests
+ */
+public interface RequestProcessor {
+
+    public void init(Map initParameters, WebContext ctx);
+    
+    public void process(WebContext ctx);
+    
+    public void destroy();
+    
+}

Propchange: struts/sandbox/trunk/ti/src/java/org/apache/ti/processor/RequestProcessor.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: struts/sandbox/trunk/ti/src/java/org/apache/ti/processor/RequestProcessor.java
------------------------------------------------------------------------------
    svn:keywords = Date Author Id Revision HeadURL

Modified: struts/sandbox/trunk/ti/src/java/org/apache/ti/processor/SpringActionProxyFactory.java
URL: http://svn.apache.org/viewcvs/struts/sandbox/trunk/ti/src/java/org/apache/ti/processor/SpringActionProxyFactory.java?rev=230394&r1=230393&r2=230394&view=diff
==============================================================================
--- struts/sandbox/trunk/ti/src/java/org/apache/ti/processor/SpringActionProxyFactory.java (original)
+++ struts/sandbox/trunk/ti/src/java/org/apache/ti/processor/SpringActionProxyFactory.java Thu Aug  4 21:13:44 2005
@@ -1,42 +1,42 @@
-/*
- * Copyright (c) 2002-2003 by OpenSymphony
- * All rights reserved.
- */
-package org.apache.ti.processor;
-
-import java.util.Map;
-
-import org.springframework.beans.factory.BeanFactory;
-import org.springframework.beans.factory.BeanFactoryAware;
-
-import com.opensymphony.xwork.ActionInvocation;
-import com.opensymphony.xwork.ActionProxy;
-import com.opensymphony.xwork.DefaultActionProxyFactory;
-
-
-/**
- *  Creates special action invocation instances that handle ControllerActions
- */
-public class SpringActionProxyFactory extends DefaultActionProxyFactory implements BeanFactoryAware {
-
-    public static final String ACTION_INVOCATION = "actionInvocation";
-
-    protected BeanFactory beanFactory;
-    
-    public void setBeanFactory(BeanFactory factory) {
-        this.beanFactory = factory;
-    }
-    
-    public ActionInvocation createActionInvocation(ActionProxy actionProxy) throws Exception {
-        return new ControllerActionInvocation(beanFactory, actionProxy);
-    }
-
-    public ActionInvocation createActionInvocation(ActionProxy actionProxy, Map extraContext) throws Exception {
-        return new ControllerActionInvocation(beanFactory, actionProxy, extraContext);
-    }
-
-    public ActionInvocation createActionInvocation(ActionProxy actionProxy, Map extraContext, boolean pushAction) throws Exception {
-        return new ControllerActionInvocation(beanFactory, actionProxy, extraContext, pushAction);
-    }
-
-}
+/*
+ * Copyright (c) 2002-2003 by OpenSymphony
+ * All rights reserved.
+ */
+package org.apache.ti.processor;
+
+import java.util.Map;
+
+import org.springframework.beans.factory.BeanFactory;
+import org.springframework.beans.factory.BeanFactoryAware;
+
+import com.opensymphony.xwork.ActionInvocation;
+import com.opensymphony.xwork.ActionProxy;
+import com.opensymphony.xwork.DefaultActionProxyFactory;
+
+
+/**
+ *  Creates special action invocation instances that handle ControllerActions
+ */
+public class SpringActionProxyFactory extends DefaultActionProxyFactory implements BeanFactoryAware {
+
+    public static final String ACTION_INVOCATION = "actionInvocation";
+
+    protected BeanFactory beanFactory;
+    
+    public void setBeanFactory(BeanFactory factory) {
+        this.beanFactory = factory;
+    }
+    
+    public ActionInvocation createActionInvocation(ActionProxy actionProxy) throws Exception {
+        return new ControllerActionInvocation(beanFactory, actionProxy);
+    }
+
+    public ActionInvocation createActionInvocation(ActionProxy actionProxy, Map extraContext) throws Exception {
+        return new ControllerActionInvocation(beanFactory, actionProxy, extraContext);
+    }
+
+    public ActionInvocation createActionInvocation(ActionProxy actionProxy, Map extraContext, boolean pushAction) throws Exception {
+        return new ControllerActionInvocation(beanFactory, actionProxy, extraContext, pushAction);
+    }
+
+}

Propchange: struts/sandbox/trunk/ti/src/java/org/apache/ti/processor/SpringActionProxyFactory.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: struts/sandbox/trunk/ti/src/java/org/apache/ti/processor/SpringActionProxyFactory.java
------------------------------------------------------------------------------
    svn:keywords = Date Author Id Revision HeadURL

Modified: struts/sandbox/trunk/ti/src/java/org/apache/ti/processor/SpringObjectFactory.java
URL: http://svn.apache.org/viewcvs/struts/sandbox/trunk/ti/src/java/org/apache/ti/processor/SpringObjectFactory.java?rev=230394&r1=230393&r2=230394&view=diff
==============================================================================
--- struts/sandbox/trunk/ti/src/java/org/apache/ti/processor/SpringObjectFactory.java (original)
+++ struts/sandbox/trunk/ti/src/java/org/apache/ti/processor/SpringObjectFactory.java Thu Aug  4 21:13:44 2005
@@ -1,43 +1,43 @@
-/*
- * Copyright (c) 2002-2003 by OpenSymphony
- * All rights reserved.
- */
-package org.apache.ti.processor;
-
-import org.springframework.beans.factory.BeanFactory;
-import org.springframework.beans.factory.BeanFactoryAware;
-
-import com.opensymphony.xwork.Action;
-import com.opensymphony.xwork.ObjectFactory;
-import com.opensymphony.xwork.config.entities.ActionConfig;
-
-
-/**
- * Builds actions from the config.  If an Action is not created, it is assumed to be a Controller.
- */
-public class SpringObjectFactory extends ObjectFactory implements BeanFactoryAware {
-
-    public static final String CONTROLLER_ACTION = "controllerAction";
-    
-    protected BeanFactory beanFactory;
-    
-    public void setBeanFactory(BeanFactory factory) {
-        this.beanFactory = factory;
-    }
-    
-    /**
-     * Build an Action of the given type
-     */
-    public Action buildAction(ActionConfig config) throws Exception {
-        Object obj = buildBean(config.getClassName());
-        if (obj instanceof Action) {
-            return (Action) obj;
-        } else {
-            ControllerAction action = (ControllerAction) beanFactory.getBean(CONTROLLER_ACTION); 
-            Object controller = buildBean(config.getClassName());
-            action.setController(controller);
-            return action;
-        }
-    }
-
-}
+/*
+ * Copyright (c) 2002-2003 by OpenSymphony
+ * All rights reserved.
+ */
+package org.apache.ti.processor;
+
+import org.springframework.beans.factory.BeanFactory;
+import org.springframework.beans.factory.BeanFactoryAware;
+
+import com.opensymphony.xwork.Action;
+import com.opensymphony.xwork.ObjectFactory;
+import com.opensymphony.xwork.config.entities.ActionConfig;
+
+
+/**
+ * Builds actions from the config.  If an Action is not created, it is assumed to be a Controller.
+ */
+public class SpringObjectFactory extends ObjectFactory implements BeanFactoryAware {
+
+    public static final String CONTROLLER_ACTION = "controllerAction";
+    
+    protected BeanFactory beanFactory;
+    
+    public void setBeanFactory(BeanFactory factory) {
+        this.beanFactory = factory;
+    }
+    
+    /**
+     * Build an Action of the given type
+     */
+    public Action buildAction(ActionConfig config) throws Exception {
+        Object obj = buildBean(config.getClassName());
+        if (obj instanceof Action) {
+            return (Action) obj;
+        } else {
+            ControllerAction action = (ControllerAction) beanFactory.getBean(CONTROLLER_ACTION); 
+            Object controller = buildBean(config.getClassName());
+            action.setController(controller);
+            return action;
+        }
+    }
+
+}

Propchange: struts/sandbox/trunk/ti/src/java/org/apache/ti/processor/SpringObjectFactory.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: struts/sandbox/trunk/ti/src/java/org/apache/ti/processor/SpringObjectFactory.java
------------------------------------------------------------------------------
    svn:keywords = Date Author Id Revision HeadURL

Modified: struts/sandbox/trunk/ti/src/java/org/apache/ti/processor/chain/ChainRequestProcessor.java
URL: http://svn.apache.org/viewcvs/struts/sandbox/trunk/ti/src/java/org/apache/ti/processor/chain/ChainRequestProcessor.java?rev=230394&r1=230393&r2=230394&view=diff
==============================================================================
--- struts/sandbox/trunk/ti/src/java/org/apache/ti/processor/chain/ChainRequestProcessor.java (original)
+++ struts/sandbox/trunk/ti/src/java/org/apache/ti/processor/chain/ChainRequestProcessor.java Thu Aug  4 21:13:44 2005
@@ -1,236 +1,236 @@
-/*
- * $Id$
- *
- * Copyright 2005 The Apache Software Foundation.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.ti.processor.chain;
-
-import java.net.URL;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Map;
-
-import javax.servlet.ServletException;
-
-import org.apache.commons.chain.Catalog;
-import org.apache.commons.chain.CatalogFactory;
-import org.apache.commons.chain.Command;
-import org.apache.commons.chain.config.ConfigParser;
-import org.apache.commons.chain.web.WebContext;
-import org.apache.commons.digester.RuleSet;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import org.apache.ti.processor.ProcessorException;
-import org.apache.ti.processor.RequestProcessor;
-import org.apache.ti.util.SourceResolver;
-
-
-/**
- *  Request processor that uses commons-chain
- */
-public class ChainRequestProcessor implements RequestProcessor {
-
-    /**
-     * <p>Comma-separated list of context or classloader-relative path(s) that
-     * contain the configuration for the default commons-chain catalog(s).</p>
-     */
-    protected String chainConfig = "org/apache/ti/processor/chain/chain-config-servlet.xml";
-    
-    /**
-     * <p>Commons Logging instance.</p>
-     */
-    protected static Log log = LogFactory.getLog(ChainRequestProcessor.class);
-    
-    /**
-     * <p>The {@link CatalogFactory} from which catalog containing the the
-     * base request-processing {@link Command} will be retrieved.</p>
-     */
-    protected CatalogFactory catalogFactory = null;
-
-
-    /**
-     * <p>The {@link Catalog} containing all of the available command chains
-     * for this module.
-     */
-    protected Catalog catalog = null;
-
-
-    /**
-     * <p>The {@link Command} to be executed for each request.</p>
-     */
-    protected Command startCmd = null;
-    
-    protected String catalogName = "struts-ti";
-    protected String startCmdName = "start";
-    protected String initCmdName = "init";
-    
-    protected SourceResolver resolver = null;
-    
-    protected RuleSet ruleSet = null;
-    
-    protected Map initParameters = null;
-    
-    public void setSourceResolver(SourceResolver resolver) {
-        this.resolver = resolver;
-    }
-    
-    public void setStartCommandName(String name) {
-        this.startCmdName = name;
-    }
-    
-    public void setInitCommandName(String name) {
-        this.initCmdName = name;
-    }
-    
-    public void setCatalogName(String name) {
-        this.catalogName = name;
-    }
-    
-    public void setChainConfig(String name) {
-        this.chainConfig = name;
-    }
-    
-    public void setChainRuleSet(RuleSet ruleset) {
-        this.ruleSet = ruleset;
-    }
-    
-    
-    public void init(Map initParameters, WebContext webContext) {
-        this.initParameters = initParameters;
-        
-        String chain = (String)initParameters.get("chainConfig");
-        try {
-            initChain(chain, webContext);
-            
-            initCatalogFactory();
-            
-            catalog = this.catalogFactory.getCatalog(catalogName);
-            if (catalog == null) {
-                throw new ProcessorException("Cannot find catalog '" +
-                                           catalogName + "'");
-            }
-    
-            Command initCmd = catalog.getCommand(initCmdName);
-            if (initCmd == null) {
-                throw new ProcessorException("Cannot find init command '" +
-                                           startCmdName + "'");
-            }
-            initCmd.execute(webContext);
-            
-            startCmd = catalog.getCommand(startCmdName);
-            if (startCmd == null) {
-                throw new ProcessorException("Cannot find command '" +
-                                           startCmdName + "'");
-            }
-
-        } catch (Throwable t) {
-
-            // The follow error message is not retrieved from internal message
-            // resources as they may not have been able to have been
-            // initialized
-            log.error("Unable to initialize Struts ServletRequestHandler due to an "
-                + "unexpected exception or error thrown, so marking the "
-                + "servlet as unavailable.  Most likely, this is due to an "
-                + "incorrect or missing library dependency.", t);
-            throw new ProcessorException(t);
-        }
-    }
-    
-    
-    public void process(WebContext ctx) {
-        // Create and execute the command.
-        try {
-            if (log.isDebugEnabled()) {
-                log.debug("Using processing chain for this request");
-            }
-            
-            // Add initialization parameters directly to context.  
-            ctx.putAll(initParameters);
-            startCmd.execute(ctx);
-        } catch (Exception e) {
-            // Execute the exception processing chain??
-            throw new ProcessorException(e);
-        }
-    }
-    
-    public void destroy() {
-        // Release our LogFactory and Log instances (if any)
-        ClassLoader classLoader =
-                Thread.currentThread().getContextClassLoader();
-        if (classLoader == null) {
-            classLoader = ChainRequestProcessor.class.getClassLoader();
-        }
-        try {
-            LogFactory.release(classLoader);
-        } catch (Throwable t) {
-            ; // Servlet container doesn't have the latest version
-              // of commons-logging-api.jar installed
-
-            // :FIXME: Why is this dependent on the container's version of
-            // commons-logging? Shouldn't this depend on the version packaged
-            // with Struts?
-            /*
-              Reason: LogFactory.release(classLoader); was added as
-              an attempt to investigate the OutOfMemory error reported on
-              Bugzilla #14042. It was committed for version 1.136 by craigmcc
-            */
-        }
-
-        CatalogFactory.clear();   
-        catalogFactory = null;
-        catalog = null;
-        startCmd = null;
-    }
-    
-    /**
-     * <p>Parse the configuration documents specified by the
-     * <code>chainConfig</code> init-param to configure the default
-     * {@link Catalog} that is registered in the {@link CatalogFactory}
-     * instance for this application.</p>
-     *
-     * @throws ServletException if an error occurs.
-     */
-    protected void initChain(String paths, WebContext ctx) {
-
-        // Parse the configuration file specified by path or resource
-        try {
-            if (paths != null) {
-                chainConfig = paths;
-            }
-
-            ConfigParser parser = new ConfigParser();
-            parser.setRuleSet(ruleSet);
-            List urls = resolver.resolveList(chainConfig, ctx);
-            URL resource = null;
-            for (Iterator i = urls.iterator(); i.hasNext();) {
-                resource = (URL) i.next();
-                log.info("Loading chain catalog from " + resource);
-                parser.parse(resource);
-            }
-        } catch (Throwable t) {
-            log.error("Exception loading resources", t);
-            throw new ProcessorException(t);
-        }
-    }
-
-    protected void initCatalogFactory() {
-        if (this.catalogFactory != null) {
-            return;
-        }
-        this.catalogFactory = CatalogFactory.getInstance();
-
-    }
-    
-}
+/*
+ * $Id$
+ *
+ * Copyright 2005 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.ti.processor.chain;
+
+import java.net.URL;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+
+import javax.servlet.ServletException;
+
+import org.apache.commons.chain.Catalog;
+import org.apache.commons.chain.CatalogFactory;
+import org.apache.commons.chain.Command;
+import org.apache.commons.chain.config.ConfigParser;
+import org.apache.commons.chain.web.WebContext;
+import org.apache.commons.digester.RuleSet;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.apache.ti.processor.ProcessorException;
+import org.apache.ti.processor.RequestProcessor;
+import org.apache.ti.util.SourceResolver;
+
+
+/**
+ *  Request processor that uses commons-chain
+ */
+public class ChainRequestProcessor implements RequestProcessor {
+
+    /**
+     * <p>Comma-separated list of context or classloader-relative path(s) that
+     * contain the configuration for the default commons-chain catalog(s).</p>
+     */
+    protected String chainConfig = "org/apache/ti/processor/chain/chain-config-servlet.xml";
+    
+    /**
+     * <p>Commons Logging instance.</p>
+     */
+    protected static Log log = LogFactory.getLog(ChainRequestProcessor.class);
+    
+    /**
+     * <p>The {@link CatalogFactory} from which catalog containing the the
+     * base request-processing {@link Command} will be retrieved.</p>
+     */
+    protected CatalogFactory catalogFactory = null;
+
+
+    /**
+     * <p>The {@link Catalog} containing all of the available command chains
+     * for this module.
+     */
+    protected Catalog catalog = null;
+
+
+    /**
+     * <p>The {@link Command} to be executed for each request.</p>
+     */
+    protected Command startCmd = null;
+    
+    protected String catalogName = "struts-ti";
+    protected String startCmdName = "start";
+    protected String initCmdName = "init";
+    
+    protected SourceResolver resolver = null;
+    
+    protected RuleSet ruleSet = null;
+    
+    protected Map initParameters = null;
+    
+    public void setSourceResolver(SourceResolver resolver) {
+        this.resolver = resolver;
+    }
+    
+    public void setStartCommandName(String name) {
+        this.startCmdName = name;
+    }
+    
+    public void setInitCommandName(String name) {
+        this.initCmdName = name;
+    }
+    
+    public void setCatalogName(String name) {
+        this.catalogName = name;
+    }
+    
+    public void setChainConfig(String name) {
+        this.chainConfig = name;
+    }
+    
+    public void setChainRuleSet(RuleSet ruleset) {
+        this.ruleSet = ruleset;
+    }
+    
+    
+    public void init(Map initParameters, WebContext webContext) {
+        this.initParameters = initParameters;
+        
+        String chain = (String)initParameters.get("chainConfig");
+        try {
+            initChain(chain, webContext);
+            
+            initCatalogFactory();
+            
+            catalog = this.catalogFactory.getCatalog(catalogName);
+            if (catalog == null) {
+                throw new ProcessorException("Cannot find catalog '" +
+                                           catalogName + "'");
+            }
+    
+            Command initCmd = catalog.getCommand(initCmdName);
+            if (initCmd == null) {
+                throw new ProcessorException("Cannot find init command '" +
+                                           startCmdName + "'");
+            }
+            initCmd.execute(webContext);
+            
+            startCmd = catalog.getCommand(startCmdName);
+            if (startCmd == null) {
+                throw new ProcessorException("Cannot find command '" +
+                                           startCmdName + "'");
+            }
+
+        } catch (Throwable t) {
+
+            // The follow error message is not retrieved from internal message
+            // resources as they may not have been able to have been
+            // initialized
+            log.error("Unable to initialize Struts ServletRequestHandler due to an "
+                + "unexpected exception or error thrown, so marking the "
+                + "servlet as unavailable.  Most likely, this is due to an "
+                + "incorrect or missing library dependency.", t);
+            throw new ProcessorException(t);
+        }
+    }
+    
+    
+    public void process(WebContext ctx) {
+        // Create and execute the command.
+        try {
+            if (log.isDebugEnabled()) {
+                log.debug("Using processing chain for this request");
+            }
+            
+            // Add initialization parameters directly to context.  
+            ctx.putAll(initParameters);
+            startCmd.execute(ctx);
+        } catch (Exception e) {
+            // Execute the exception processing chain??
+            throw new ProcessorException(e);
+        }
+    }
+    
+    public void destroy() {
+        // Release our LogFactory and Log instances (if any)
+        ClassLoader classLoader =
+                Thread.currentThread().getContextClassLoader();
+        if (classLoader == null) {
+            classLoader = ChainRequestProcessor.class.getClassLoader();
+        }
+        try {
+            LogFactory.release(classLoader);
+        } catch (Throwable t) {
+            ; // Servlet container doesn't have the latest version
+              // of commons-logging-api.jar installed
+
+            // :FIXME: Why is this dependent on the container's version of
+            // commons-logging? Shouldn't this depend on the version packaged
+            // with Struts?
+            /*
+              Reason: LogFactory.release(classLoader); was added as
+              an attempt to investigate the OutOfMemory error reported on
+              Bugzilla #14042. It was committed for version 1.136 by craigmcc
+            */
+        }
+
+        CatalogFactory.clear();   
+        catalogFactory = null;
+        catalog = null;
+        startCmd = null;
+    }
+    
+    /**
+     * <p>Parse the configuration documents specified by the
+     * <code>chainConfig</code> init-param to configure the default
+     * {@link Catalog} that is registered in the {@link CatalogFactory}
+     * instance for this application.</p>
+     *
+     * @throws ServletException if an error occurs.
+     */
+    protected void initChain(String paths, WebContext ctx) {
+
+        // Parse the configuration file specified by path or resource
+        try {
+            if (paths != null) {
+                chainConfig = paths;
+            }
+
+            ConfigParser parser = new ConfigParser();
+            parser.setRuleSet(ruleSet);
+            List urls = resolver.resolveList(chainConfig, ctx);
+            URL resource = null;
+            for (Iterator i = urls.iterator(); i.hasNext();) {
+                resource = (URL) i.next();
+                log.info("Loading chain catalog from " + resource);
+                parser.parse(resource);
+            }
+        } catch (Throwable t) {
+            log.error("Exception loading resources", t);
+            throw new ProcessorException(t);
+        }
+    }
+
+    protected void initCatalogFactory() {
+        if (this.catalogFactory != null) {
+            return;
+        }
+        this.catalogFactory = CatalogFactory.getInstance();
+
+    }
+    
+}



---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@struts.apache.org
For additional commands, e-mail: dev-help@struts.apache.org