You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@struts.apache.org by mr...@apache.org on 2005/08/02 20:57:11 UTC

svn commit: r227065 [1/2] - in /struts/sandbox/trunk/ti: ./ src/ src/example/ src/example/WEB-INF/ src/example/WEB-INF/src/ src/example/WEB-INF/src/java/ src/example/WEB-INF/src/java/ttt/ src/java/ src/java/org/ src/java/org/apache/ src/java/org/apache...

Author: mrdon
Date: Tue Aug  2 11:57:06 2005
New Revision: 227065

URL: http://svn.apache.org/viewcvs?rev=227065&view=rev
Log:
Adding first cut of Struts Ti

Added:
    struts/sandbox/trunk/ti/
    struts/sandbox/trunk/ti/project.xml   (with props)
    struts/sandbox/trunk/ti/src/
    struts/sandbox/trunk/ti/src/example/
    struts/sandbox/trunk/ti/src/example/WEB-INF/
    struts/sandbox/trunk/ti/src/example/WEB-INF/src/
    struts/sandbox/trunk/ti/src/example/WEB-INF/src/build.xml
    struts/sandbox/trunk/ti/src/example/WEB-INF/src/java/
    struts/sandbox/trunk/ti/src/example/WEB-INF/src/java/Controller.java
    struts/sandbox/trunk/ti/src/example/WEB-INF/src/java/ttt/
    struts/sandbox/trunk/ti/src/example/WEB-INF/src/java/ttt/Game.java
    struts/sandbox/trunk/ti/src/example/WEB-INF/web.xml
    struts/sandbox/trunk/ti/src/example/index.jsp
    struts/sandbox/trunk/ti/src/java/
    struts/sandbox/trunk/ti/src/java/org/
    struts/sandbox/trunk/ti/src/java/org/apache/
    struts/sandbox/trunk/ti/src/java/org/apache/ti/
    struts/sandbox/trunk/ti/src/java/org/apache/ti/config/
    struts/sandbox/trunk/ti/src/java/org/apache/ti/config/ProcessTags.java
    struts/sandbox/trunk/ti/src/java/org/apache/ti/config/ProcessTagsTask.java
    struts/sandbox/trunk/ti/src/java/org/apache/ti/config/XDocletParser.java
    struts/sandbox/trunk/ti/src/java/org/apache/ti/config/mapper/
    struts/sandbox/trunk/ti/src/java/org/apache/ti/config/mapper/ActionMapper.java   (with props)
    struts/sandbox/trunk/ti/src/java/org/apache/ti/config/mapper/ActionMapping.java   (with props)
    struts/sandbox/trunk/ti/src/java/org/apache/ti/config/mapper/ServletActionMapper.java   (with props)
    struts/sandbox/trunk/ti/src/java/org/apache/ti/config/spring-config-servlet.xml
    struts/sandbox/trunk/ti/src/java/org/apache/ti/config/velocity.properties
    struts/sandbox/trunk/ti/src/java/org/apache/ti/config/xdocletToXWork.vm
    struts/sandbox/trunk/ti/src/java/org/apache/ti/processor/
    struts/sandbox/trunk/ti/src/java/org/apache/ti/processor/BaseResult.java   (with props)
    struts/sandbox/trunk/ti/src/java/org/apache/ti/processor/ControllerAction.java   (with props)
    struts/sandbox/trunk/ti/src/java/org/apache/ti/processor/ControllerActionInvocation.java   (with props)
    struts/sandbox/trunk/ti/src/java/org/apache/ti/processor/ControllerContext.java
    struts/sandbox/trunk/ti/src/java/org/apache/ti/processor/ProcessorException.java
    struts/sandbox/trunk/ti/src/java/org/apache/ti/processor/RequestProcessor.java
    struts/sandbox/trunk/ti/src/java/org/apache/ti/processor/SpringActionProxyFactory.java   (with props)
    struts/sandbox/trunk/ti/src/java/org/apache/ti/processor/SpringObjectFactory.java   (with props)
    struts/sandbox/trunk/ti/src/java/org/apache/ti/processor/chain/
    struts/sandbox/trunk/ti/src/java/org/apache/ti/processor/chain/ChainRequestProcessor.java
    struts/sandbox/trunk/ti/src/java/org/apache/ti/processor/chain/CreateActionMapping.java   (with props)
    struts/sandbox/trunk/ti/src/java/org/apache/ti/processor/chain/CreateActionProxy.java   (with props)
    struts/sandbox/trunk/ti/src/java/org/apache/ti/processor/chain/ExecuteAction.java   (with props)
    struts/sandbox/trunk/ti/src/java/org/apache/ti/processor/chain/InitControllerContext.java   (with props)
    struts/sandbox/trunk/ti/src/java/org/apache/ti/processor/chain/InitXWork.java   (with props)
    struts/sandbox/trunk/ti/src/java/org/apache/ti/processor/chain/ProcessActionChain.java   (with props)
    struts/sandbox/trunk/ti/src/java/org/apache/ti/processor/chain/SpringConfigRuleSet.java   (with props)
    struts/sandbox/trunk/ti/src/java/org/apache/ti/processor/chain/chain-config-servlet.xml
    struts/sandbox/trunk/ti/src/java/org/apache/ti/servlet/
    struts/sandbox/trunk/ti/src/java/org/apache/ti/servlet/ServletDispatcherResult.java   (with props)
    struts/sandbox/trunk/ti/src/java/org/apache/ti/servlet/StrutsTiServlet.java
    struts/sandbox/trunk/ti/src/java/org/apache/ti/util/
    struts/sandbox/trunk/ti/src/java/org/apache/ti/util/ServletSourceResolver.java
    struts/sandbox/trunk/ti/src/java/org/apache/ti/util/SourceResolver.java
    struts/sandbox/trunk/ti/src/java/xwork-default.xml   (with props)
    struts/sandbox/trunk/ti/src/test/
    struts/sandbox/trunk/ti/src/test/org/
    struts/sandbox/trunk/ti/src/test/org/apache/
    struts/sandbox/trunk/ti/src/test/org/apache/ti/
    struts/sandbox/trunk/ti/src/test/org/apache/ti/config/
    struts/sandbox/trunk/ti/src/test/org/apache/ti/config/Controller.jsrc
    struts/sandbox/trunk/ti/src/test/org/apache/ti/config/TestProcessTags.java
    struts/sandbox/trunk/ti/src/test/org/apache/ti/config/TestXDocletParser.java
    struts/sandbox/trunk/ti/src/test/org/apache/ti/config/foo/
    struts/sandbox/trunk/ti/src/test/org/apache/ti/config/foo/Controller.jsrc
    struts/sandbox/trunk/ti/src/test/org/apache/ti/config/mapper/
    struts/sandbox/trunk/ti/src/test/org/apache/ti/config/mapper/TestServletActionMapper.java   (with props)
    struts/sandbox/trunk/ti/src/test/org/apache/ti/config/test.vm
    struts/sandbox/trunk/ti/src/test/org/apache/ti/config/testTag.vm
    struts/sandbox/trunk/ti/src/test/org/apache/ti/processor/
    struts/sandbox/trunk/ti/src/test/org/apache/ti/processor/chain/
    struts/sandbox/trunk/ti/src/test/org/apache/ti/processor/chain/Bean.java   (with props)
    struts/sandbox/trunk/ti/src/test/org/apache/ti/processor/chain/TestSpringConfigRuleSet.java   (with props)
    struts/sandbox/trunk/ti/src/test/org/apache/ti/processor/chain/chain-config.xml   (with props)

Added: struts/sandbox/trunk/ti/project.xml
URL: http://svn.apache.org/viewcvs/struts/sandbox/trunk/ti/project.xml?rev=227065&view=auto
==============================================================================
--- struts/sandbox/trunk/ti/project.xml (added)
+++ struts/sandbox/trunk/ti/project.xml Tue Aug  2 11:57:06 2005
@@ -0,0 +1,486 @@
+<?xml version="1.0"?>
+<!-- 
+/*
+ * Copyright 2001-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.
+ */
+ -->
+
+
+<project>
+  <pomVersion>3</pomVersion>
+  <id>struts</id>
+  <name>Struts TI</name>
+  <groupId>ti</groupId>
+  <currentVersion>0.1-dev</currentVersion>
+
+
+    <!-- ################################################################ -->
+    <!--        Project management section                                -->
+    <!-- ################################################################ -->
+
+  
+  <organization>
+    <name>The Apache Software Foundation</name>
+    <url>http://www.apache.org/</url>
+    <logo>http://www.apache.org/images/asf-logo.gif</logo>
+  </organization>
+  <logo>http://struts.apache.org/images/struts.gif</logo>
+  <inceptionYear>2000</inceptionYear>
+  <package>org.apache.ti</package>
+  <logo>http://struts.apache.org/images/struts.gif</logo>
+  <gumpRepositoryId>struts-ti-svn</gumpRepositoryId>
+
+  <description>
+      The core of the Struts framework is a flexible control layer based on 
+      standard technologies like Java Servlets, JavaBeans, ResourceBundles, 
+      and Extensible Markup Language (XML), as well as various Jakarta Commons 
+      packages. 
+      
+      Struts encourages application architectures based on the Model 
+      2 approach, a variation of the classic Model-View-Controller (MVC) design 
+      paradigm. Struts provides its own Controller component and integrates with 
+      other technologies to provide the Model and the View. 
+      
+      For the Model, Struts can interact with any standard data access technology, 
+      including Enterprise Java Beans, JDBC, and Object Relational Bridge. 
+      
+      For the View, Struts works well with JavaServer Pages, including JSTL and 
+      JSF, as well as Velocity Templates, XSLT, and other presentation systems. 
+      
+      The Struts framework provides the invisible underpinnings every professional 
+      web application needs to survive. Struts helps you create an extensible 
+      development environment for your application, based on published standards 
+      and proven design patterns.
+      
+  </description>
+      
+  <shortDescription>MVC Web Application Framework</shortDescription>
+  <url>http://struts.apache.org/index.html</url>
+  <issueTrackingUrl>http://issues.apache.org/bugzilla/</issueTrackingUrl>
+  <siteAddress>struts.apache.org</siteAddress>
+  <siteDirectory>/www/struts.apache.org/</siteDirectory>
+  <distributionSite>struts.apache.org</distributionSite>
+  <distributionDirectory>/www/www.apache.org/builds/</distributionDirectory>
+<!--  <distributionDirectory>/www/www.apache.org/dist/java-repository/</distributionDirectory>-->
+  
+  <mailingLists>
+    <mailingList>
+      <name>Struts User List</name>
+      <subscribe>user-subscribe@struts.apache.org</subscribe>
+      <unsubscribe>user-unsubscribe@struts.apache.org</unsubscribe>
+      <archive>http://mail-archives.apache.org/eyebrowse/SummarizeList?listId=42</archive>
+    </mailingList>
+    <mailingList>
+      <name>Struts Developer List</name>
+      <subscribe>dev-subscribe@struts.apache.org</subscribe>
+      <unsubscribe>dev-unsubscribe@struts.apache.org</unsubscribe>
+      <archive>http://mail-archives.apache.org/eyebrowse/SummarizeList?listId=41</archive>
+    </mailingList>
+  </mailingLists>
+
+  <developers>
+    <developer>
+      <name>Craig R. McClanahan</name>
+      <id>craigmcc</id>
+      <email>craigmcc at apache.org</email>
+      <organization></organization>
+    </developer>
+    
+    <developer>
+      <name>Ted Husted</name>
+      <id>husted</id>
+      <email>husted at apache.org</email>
+      <organization></organization>
+    </developer>
+    
+    <developer>
+      <name>Rob Leland</name>
+      <id>rleland</id>
+      <email>rleland at apache.org</email>
+      <organization></organization>
+    </developer>
+    
+    <developer>
+      <name>Cedric Dumoulin</name>
+      <id>cedric</id>
+      <email>cedric.dumoulin at lifl.fr</email>
+      <organization></organization>
+    </developer>
+    
+    <developer>
+      <name>Martin Cooper</name>
+      <id>martinc</id>
+      <email>martinc at apache.org</email>
+      <organization></organization>
+    </developer>
+    
+    <developer>
+      <name>Arron Bates</name>
+      <id>arron</id>
+      <email>arron at apache.org</email>
+      <organization></organization>
+    </developer>
+    
+    <developer>
+      <name>James Holmes</name>
+      <id>jholmes</id>
+      <email>jholmes at apache.org</email>
+      <organization></organization>
+    </developer>
+    
+    <developer>
+      <name>David M. Karr</name>
+      <id>dmkarr</id>
+      <email>dmkarr at apache.org</email>
+      <organization></organization>
+    </developer>
+
+    <developer>
+      <name>Eddie Bush</name>
+      <id>ekbush</id>
+      <email>ekbush at apache.org</email>
+      <organization></organization>
+    </developer>
+
+    <developer>
+      <name>David Graham</name>
+      <id>dgraham</id>
+      <email>dgraham at apache.org</email>
+      <organization></organization>
+    </developer>
+
+    <developer>
+      <name>James Mitchell</name>
+      <id>jmitchell</id>
+      <email>jmitchell at apache.org</email>
+      <organization></organization>
+    </developer>
+
+    <developer>
+      <name>James Turner</name>
+      <id>turner</id>
+      <email>turner at blackbear.com</email>
+      <organization></organization>
+    </developer>
+
+    <developer>
+      <name>Steve Raeburn</name>
+      <id>sraeburn</id>
+      <email>sraeburn at apache.org</email>
+      <organization></organization>
+    </developer>
+
+    <developer>
+      <name>Don Brown</name>
+      <id>mrdon</id>
+      <email>mrdon at apache.org</email>
+      <organization></organization>
+    </developer>
+
+    <developer>
+      <name>Joe Germuska</name>
+      <id>germuska</id>
+      <email>germuska at apache.org</email>
+      <organization></organization>
+    </developer>
+
+    <developer>
+      <name>Niall Pemberton</name>
+      <id>niallp</id>
+      <email>niallp at apache.org</email>
+      <organization></organization>
+    </developer>
+    
+    <developer>
+      <name>Hubert Rabago</name>
+      <id>hrabago</id>
+      <email>hrabago at apache.org</email>
+      <organization></organization>
+    </developer>
+    
+    <developer>
+      <name>David Geary</name>
+      <id>dgeary</id>
+      <email>dgeary at apache.org</email>
+      <organization></organization>
+    </developer>
+    
+  </developers>
+
+  <contributors/>
+  
+  <licenses>
+    <license>
+      <name>The Apache Software License, Version 2.0</name>
+      <url>http://www.apache.org/licenses/LICENSE-2.0</url>
+      <distribution>repo</distribution>
+    </license>
+  </licenses>
+
+  <!-- ################################################################ -->
+  <!--        Project dependency section                                -->
+  <!-- ################################################################ -->
+
+  <dependencies>
+
+	<!-- Standard dependencies -->  
+    <dependency>
+      <groupId>servletapi</groupId>
+      <artifactId>servletapi</artifactId>
+      <version>2.4</version>
+      <url>http://java.sun.com/products/servlet/</url>
+    </dependency>
+    
+    <dependency>
+      <groupId>commons-chain</groupId>
+      <artifactId>commons-chain</artifactId>
+      <version>1.0</version>
+      <url>http://jakarta.apache.org/commons/chain/</url>
+      <properties>
+        <war.bundle>true</war.bundle>
+      </properties>
+    </dependency>
+  
+    <dependency>
+      <groupId>commons-collections</groupId>
+      <artifactId>commons-collections</artifactId>
+      <version>2.1</version>
+      <url>http://jakarta.apache.org/commons/collections/</url>
+      <properties>
+        <war.bundle>true</war.bundle>
+      </properties>
+    </dependency>
+ 
+    <dependency>
+      <groupId>commons-beanutils</groupId>
+      <artifactId>commons-beanutils</artifactId>
+      <version>1.7.0</version>
+      <url>http://jakarta.apache.org/commons/beanutils/</url>
+      <properties>
+        <war.bundle>true</war.bundle>
+      </properties>
+    </dependency>
+    
+    <dependency>
+      <groupId>commons-digester</groupId>
+      <artifactId>commons-digester</artifactId>
+      <version>1.7</version>
+      <url>http://jakarta.apache.org/commons/digester/</url>
+      <properties>
+        <war.bundle>true</war.bundle>
+      </properties>
+    </dependency>
+    
+
+    <dependency>
+      <groupId>commons-logging</groupId>
+      <artifactId>commons-logging</artifactId>
+      <version>1.0.4</version>
+      <url>http://jakarta.apache.org/commons/logging/</url>
+      <properties>
+        <war.bundle>true</war.bundle>
+      </properties>
+    </dependency>
+    
+
+ 
+    <dependency>
+      <groupId>opensymphony</groupId>
+      <artifactId>xwork</artifactId>
+      <version>1.0.5</version>
+      <properties>
+        <war.bundle>true</war.bundle>
+      </properties>
+    </dependency>
+
+    <dependency>
+      <groupId>opensymphony</groupId>
+      <artifactId>oscore</artifactId>
+      <version>2.2.4</version>
+      <properties>
+        <war.bundle>true</war.bundle>
+      </properties>
+    </dependency>
+
+    <dependency>
+      <groupId>ognl</groupId>
+      <artifactId>ognl</artifactId>
+      <version>2.6.7</version>
+      <properties>
+        <war.bundle>true</war.bundle>
+      </properties>
+    </dependency>
+    
+    <dependency>
+      <groupId>velocity</groupId>
+      <artifactId>velocity</artifactId>
+      <version>1.4</version>
+      <properties>
+        <war.bundle>true</war.bundle>
+      </properties>
+    </dependency>
+    
+    <dependency>
+      <groupId>velocity</groupId>
+      <artifactId>velocity-dep</artifactId>
+      <version>1.4</version>
+      <properties>
+        <war.bundle>true</war.bundle>
+      </properties>
+    </dependency>
+    
+    <dependency>
+      <groupId>xjavadoc</groupId>
+      <artifactId>xjavadoc</artifactId>
+      <version>1.1</version>
+      <properties>
+        <war.bundle>true</war.bundle>
+      </properties>
+    </dependency>
+    
+    <dependency>
+      <groupId>springframework</groupId>
+      <artifactId>spring-core</artifactId>
+      <version>1.2.1</version>
+      <properties>
+        <war.bundle>true</war.bundle>
+      </properties>
+    </dependency>
+    
+    <dependency>
+      <groupId>springframework</groupId>
+      <artifactId>spring-beans</artifactId>
+      <version>1.2.1</version>
+      <properties>
+        <war.bundle>true</war.bundle>
+      </properties>
+    </dependency>
+    
+    <dependency>
+      <groupId>ant</groupId>
+      <artifactId>ant</artifactId>
+      <version>1.6.5</version>
+      <url>http://ant.apache.org</url>
+    </dependency>
+
+    <!-- for unit tests -->
+    <dependency>
+      <groupId>junit</groupId>
+      <artifactId>junit</artifactId>
+      <version>3.8.1</version>
+      <url>http://www.junit.org/</url>
+    </dependency>
+    
+    <dependency>
+      <groupId>jdom</groupId>
+      <artifactId>jdom</artifactId>
+      <version>1.0</version>
+      <url>http://www.jdom.org</url>
+    </dependency>
+    
+    <dependency>
+      <groupId>jaxen</groupId>
+      <artifactId>jaxen</artifactId>
+      <version>1.0-FCS-full</version>
+      <url>http://www.jaxen.org</url>
+    </dependency>
+    
+    <dependency>
+      <groupId>saxpath</groupId>
+      <artifactId>saxpath</artifactId>
+      <version>1.0-FCS</version>
+      <url>http://www.saxpath.org</url>
+    </dependency>
+
+  </dependencies>
+
+
+  <!-- ################################################################ -->
+  <!--        Project build and reports section                         -->
+  <!-- ################################################################ -->
+
+  <build>
+    <nagEmailAddress>struts-dev@struts.apache.org</nagEmailAddress>
+    <sourceDirectory>src/java</sourceDirectory>
+    <unitTestSourceDirectory>src/test</unitTestSourceDirectory>
+    
+    <unitTest>
+      <includes>
+        <include>**/Test*.java</include>
+      </includes>
+      <resources>
+        <resource>
+          <directory>${basedir}/src/test</directory>
+          <includes>
+            <exclude>**/*.java</exclude>
+          </includes>
+        </resource>
+      </resources>
+    </unitTest>
+    <resources>
+      <resource>
+        <directory>${basedir}/src/java</directory>
+        <excludes>
+          <exclude>**/*.java</exclude>
+        </excludes>
+      </resource>
+    </resources>
+ 
+    <!-- J A R  R E S O U R C E S -->
+    <!-- Resources that are packaged up inside the JAR file -->
+<!--
+    <resources>
+      <resource>
+        <directory>${basedir}/src/share</directory>
+        <includes>
+          <include>**/*.properties</include>
+        </includes>
+      </resource>
+    </resources>
+-->
+
+  </build>
+
+  <reports>
+    <!--
+     |
+     | These should all be completely self contained. You should be able
+     | to generate each of them individually without needing the final
+     | xdoc transformation.
+     |
+     | Each report plugin with it's POM and plugin.jelly logic should
+     | contain everything needed to produced the report.
+     |
+    -->
+
+    <report>maven-checkstyle-plugin</report>
+    <report>maven-changelog-plugin</report>
+    <report>maven-changes-plugin</report>
+    <report>maven-developer-activity-plugin</report>
+    <report>maven-faq-plugin</report>
+    <report>maven-file-activity-plugin</report>
+    <report>maven-javadoc-plugin</report>
+    <report>maven-jdepend-plugin</report>
+    <report>maven-junit-report-plugin</report>
+    <report>maven-jxr-plugin</report>
+	<!--report>maven-linkcheck-plugin</report-->
+    <report>maven-pmd-plugin</report>
+    <report>maven-simian-plugin</report>
+    <report>maven-tasklist-plugin</report>
+    <report>maven-jcoverage-plugin</report>
+    <!--report>maven-findbugs-plugin</report-->
+
+  </reports>
+</project>

Propchange: struts/sandbox/trunk/ti/project.xml
------------------------------------------------------------------------------
    svn:executable = *

Added: struts/sandbox/trunk/ti/src/example/WEB-INF/src/build.xml
URL: http://svn.apache.org/viewcvs/struts/sandbox/trunk/ti/src/example/WEB-INF/src/build.xml?rev=227065&view=auto
==============================================================================
--- struts/sandbox/trunk/ti/src/example/WEB-INF/src/build.xml (added)
+++ struts/sandbox/trunk/ti/src/example/WEB-INF/src/build.xml Tue Aug  2 11:57:06 2005
@@ -0,0 +1,120 @@
+<project name="blank" basedir="../" default="all">
+
+
+    <!-- Local system paths -->
+    <property name="servlet.jar" value="../../common/lib/servlet-api.jar"/>
+    <property name="distpath.project" value="dist"/>
+
+
+    <!-- Project settings -->
+    <property name="project.title" value="Jakarta Struts Blank "/>
+    <property name="project.distname" value="blank"/>
+    <property name="project.version" value="1.3"/>
+
+
+    <!-- Path settings -->
+    <property name="doc.path" value="./doc/api"/>
+    <property name="doc.src" value="./src/java"/>
+
+
+    <!-- classpath for Struts 1.3 -->
+    <path id="compile.classpath">
+        <fileset dir="lib" includes="*.jar" />
+        <pathelement path ="${servlet.jar}"/>
+        <pathelement path ="classes"/>
+        <pathelement path ="${classpath}"/>
+    </path>
+
+
+    <!-- Check timestamp on files -->
+    <target name="prepare">
+        <tstamp/>
+    </target>
+
+
+    <!-- Copy any resource or configuration files -->
+    <target name="resources">
+        <copy todir="classes" includeEmptyDirs="no">
+            <fileset dir="src/java">
+            <patternset>
+                <include name="**/*.conf"/>
+                <include name="**/*.properties"/>
+                <include name="**/*.xml"/>
+            </patternset>
+            </fileset>
+        </copy>
+    </target>
+
+
+    <!-- Normal build of application -->
+    <target name="compile" depends="prepare,resources">
+        <taskdef name="ti-tags" classname="org.apache.ti.config.ProcessTagsTask"
+                classpathref="compile.classpath" />
+
+        <ti-tags srcdir="src/java" destdir="classes" />
+        <javac srcdir="src/java" destdir="classes">
+            <classpath refid="compile.classpath"/>
+        </javac>
+    </target>
+
+
+    <!-- Remove classes directory for clean build -->
+    <target name="clean"
+      description="Prepare for clean build">
+      <delete dir="classes"/>
+      <mkdir  dir="classes"/>
+    </target>
+
+
+    <!-- Build Javadoc documentation -->
+    <target name="javadoc"
+     description="Generate JavaDoc API docs">
+        <delete dir="./doc/api"/>
+        <mkdir dir="./doc/api"/>
+        <javadoc sourcepath="./src/java"
+            destdir="./doc/api"
+            classpath="${servlet.jar}"
+            packagenames="*"
+            author="false"
+            private="true"
+            version="true"
+            windowtitle="${project.title} API Documentation"
+            doctitle="&lt;h1&gt;${project.title} Documentation (Version ${project.version})&lt;/h1&gt;"
+            bottom="Copyright &#169; 2002">
+            <classpath refid="compile.classpath"/>
+        </javadoc>
+    </target>
+
+
+    <!-- Build entire project -->
+    <target name="project" depends="clean,prepare,compile,javadoc"/>
+
+
+    <!-- Create binary distribution -->
+    <target name="dist"
+        description="Create binary distribution">
+
+      <mkdir
+        dir="${distpath.project}"/>
+      <jar
+        jarfile="${distpath.project}/${project.distname}.jar"
+        basedir="./classes"/>
+      <copy
+        file="${distpath.project}/${project.distname}.jar"
+        todir="${distpath.project}"/>
+
+      <war
+        basedir="../"
+        warfile="../../${project.distname}.war"
+        webxml="web.xml">
+        <exclude name="**/${distpath.project}/**"/>
+       </war>
+      <move file="../../${project.distname}.war" tofile="${distpath.project}/${project.distname}.war" />
+
+    </target>
+
+
+    <!-- Build project and create distribution-->
+    <target name="all" depends="project,dist"/>
+
+</project>

Added: struts/sandbox/trunk/ti/src/example/WEB-INF/src/java/Controller.java
URL: http://svn.apache.org/viewcvs/struts/sandbox/trunk/ti/src/example/WEB-INF/src/java/Controller.java?rev=227065&view=auto
==============================================================================
--- struts/sandbox/trunk/ti/src/example/WEB-INF/src/java/Controller.java (added)
+++ struts/sandbox/trunk/ti/src/example/WEB-INF/src/java/Controller.java Tue Aug  2 11:57:06 2005
@@ -0,0 +1,106 @@
+/*
+ * Copyright 2004-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.
+ *
+ * $Header:$
+ */
+
+
+import com.opensymphony.xwork.Action;
+import com.opensymphony.xwork.ActionContext;
+import java.util.Map;
+
+public class Controller {
+
+    /** @ti.action */
+    public String index() {
+        System.out.println("sucess returned: "+ActionContext.getContext().get("webContext"));
+        return Action.SUCCESS;
+    }    
+    
+    //    /** @ti.action */
+    //    public String login() {
+    //        return Action.SUCCESS;
+    //    }
+    //
+    //    /**
+    //     * @ti.action 
+    //     * @ti.validateRequired userName "User name is required"
+    //     * @ti.validateRequired password "Password is required"
+    //     *
+    //     * @ti.forward name="success" type="redirect" location="index"
+    //     * @ti.forward name="error" type="action" location="login"
+    //     */
+    //    public String processLogin() {
+    //        ActionContext ctx = ActionContext.getContext();
+    //        Map params = ctx.getParameters();
+    //        String userName = (String)params.get("userName");
+    //        String password = (String)params.get("password");
+    //
+    //        UserManager mgr = new UserManager();
+    //        if (mgr.isValid(userName, password)) {
+    //            return Action.SUCCESS;
+    //        } else {
+    //            ActionContext.getContext().put("error", "Invalid login");
+    //            return Action.ERROR;
+    //        }    
+    //    }
+    //
+    //    /**
+    //     * Demonstrates login action with POJO form
+    //     * @ti.action 
+    //     */
+    //    public String processLoginWithForm(LoginForm form) {
+    //        // do something
+    //        return Action.SUCCESS;
+    //    }
+    // 
+    //    /**
+    //     * POJO form with validation annotations on fields.
+    //     */
+    //    public static final class LoginForm {
+    //        
+    //        private String userName;
+    //        private String password;
+    //
+    //        public void setUserName(String name) {
+    //            this.userName = name;
+    //        }
+    //
+    //        public void setPassword(String val) {
+    //            this.password = val;
+    //        }
+    //
+    //        /**
+    //         * @ti.validateRequired "User name is required"
+    //         */
+    //        public String getUserName() {
+    //            return this.userName;
+    //        }
+    //
+    //        /**
+    //         * @ti.validateRequired "Password is required"
+    //         */
+    //        public String getPassword() {
+    //            return this.password;
+    //        }
+    //    }   
+    //    
+    //    static class UserManager {
+    //        public boolean isValid(String username, String password) {
+    //            return (username.equals("test") && password.equals("test"));
+    //        }
+    //    }    
+    //        
+}   

Added: struts/sandbox/trunk/ti/src/example/WEB-INF/src/java/ttt/Game.java
URL: http://svn.apache.org/viewcvs/struts/sandbox/trunk/ti/src/example/WEB-INF/src/java/ttt/Game.java?rev=227065&view=auto
==============================================================================
--- struts/sandbox/trunk/ti/src/example/WEB-INF/src/java/ttt/Game.java (added)
+++ struts/sandbox/trunk/ti/src/example/WEB-INF/src/java/ttt/Game.java Tue Aug  2 11:57:06 2005
@@ -0,0 +1,63 @@
+package ttt;
+
+public class Game {
+    public static final char X = 'X';
+    public static final char O = 'O';
+    public static final char NONE = ' ';
+
+    private char[] board;
+    private char winner;
+    private static final char[][] winCombos = new char[][] {
+        {0, 1, 2},
+        {3, 4, 5},
+        {6, 7, 8},
+        {0, 3, 6},
+        {1, 4, 7},
+        {2, 5, 8},
+        {0, 4, 8},
+        {2, 4, 6}
+    };    
+    
+    public Game() {
+        board = new char[9];
+        for (int x=0; x<board.length; x++) {
+            board[x] = NONE;
+        }
+        winner = NONE;
+    }
+
+    public char getWinner() {
+        return winner;
+    }
+
+    public char[] getBoard() {
+        char[] ret = new char[9];
+        System.arraycopy(board, 0, ret, 0, board.length);
+        return ret;
+    }
+
+    public boolean move(char player, int pos) {
+        if (board[pos] != NONE) {
+            return false;
+        } else {
+            board[pos] = player;
+            checkWin();
+            return true;
+        }  
+    }
+
+    private void checkWin() {
+        char[] players = new char[] {X, O};
+        for (int p=0; p<players.length; p++) {
+            for (int x=0; x<winCombos.length; x++) {
+                if (winCombos[x][0] == players[p] &&
+                    winCombos[x][1] == players[p] &&
+                    winCombos[x][2] == players[p]) {
+                    winner = players[p];
+                    break;
+                }
+            }
+            if (winner != NONE) break;
+        }
+    } 
+}

Added: struts/sandbox/trunk/ti/src/example/WEB-INF/web.xml
URL: http://svn.apache.org/viewcvs/struts/sandbox/trunk/ti/src/example/WEB-INF/web.xml?rev=227065&view=auto
==============================================================================
--- struts/sandbox/trunk/ti/src/example/WEB-INF/web.xml (added)
+++ struts/sandbox/trunk/ti/src/example/WEB-INF/web.xml Tue Aug  2 11:57:06 2005
@@ -0,0 +1,30 @@
+<?xml version="1.0" encoding="ISO-8859-1"?>
+
+  <!DOCTYPE web-app PUBLIC
+	"-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"
+	"http://java.sun.com/dtd/web-app_2_3.dtd">
+
+<web-app>
+  <display-name>Struts Blank Application</display-name>
+  
+  <!-- Standard Action Servlet Configuration -->
+  <servlet>
+    <servlet-name>action</servlet-name>
+    <servlet-class>org.apache.ti.servlet.StrutsTiServlet</servlet-class>
+    <load-on-startup>2</load-on-startup>
+ </servlet>
+
+
+  <!-- Standard Action Servlet Mapping -->
+  <servlet-mapping>
+    <servlet-name>action</servlet-name>
+    <url-pattern>*.do</url-pattern>
+  </servlet-mapping>
+
+
+  <!-- The Usual Welcome File List -->
+  <welcome-file-list>
+    <welcome-file>index.jsp</welcome-file>
+  </welcome-file-list>
+
+</web-app>

Added: struts/sandbox/trunk/ti/src/example/index.jsp
URL: http://svn.apache.org/viewcvs/struts/sandbox/trunk/ti/src/example/index.jsp?rev=227065&view=auto
==============================================================================
--- struts/sandbox/trunk/ti/src/example/index.jsp (added)
+++ struts/sandbox/trunk/ti/src/example/index.jsp Tue Aug  2 11:57:06 2005
@@ -0,0 +1 @@
+Hello world

Added: 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=227065&view=auto
==============================================================================
--- struts/sandbox/trunk/ti/src/java/org/apache/ti/config/ProcessTags.java (added)
+++ struts/sandbox/trunk/ti/src/java/org/apache/ti/config/ProcessTags.java Tue Aug  2 11:57:06 2005
@@ -0,0 +1,75 @@
+/*
+ * Copyright 2004-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.
+ *
+ * $Header:$
+ */
+package org.apache.ti.config;
+
+import org.apache.commons.logging.*;
+import java.util.*;
+import java.io.*;
+import xjavadoc.*;
+import xjavadoc.filesystem.*;
+
+/**
+ *  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;
+            }
+        }
+    }
+}    

Added: 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=227065&view=auto
==============================================================================
--- struts/sandbox/trunk/ti/src/java/org/apache/ti/config/ProcessTagsTask.java (added)
+++ struts/sandbox/trunk/ti/src/java/org/apache/ti/config/ProcessTagsTask.java Tue Aug  2 11:57:06 2005
@@ -0,0 +1,56 @@
+/*
+ * Copyright 2004-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.
+ *
+ * $Header:$
+ */
+package org.apache.ti.config;
+
+import org.apache.commons.logging.*;
+import org.apache.tools.ant.*;
+import java.util.*;
+import java.io.*;
+
+/**
+ *  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();
+        }
+    }
+}    

Added: 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=227065&view=auto
==============================================================================
--- struts/sandbox/trunk/ti/src/java/org/apache/ti/config/XDocletParser.java (added)
+++ struts/sandbox/trunk/ti/src/java/org/apache/ti/config/XDocletParser.java Tue Aug  2 11:57:06 2005
@@ -0,0 +1,94 @@
+/*
+ * Copyright 2004-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.
+ *
+ * $Header:$
+ */
+package org.apache.ti.config;
+
+import org.apache.velocity.*;
+import org.apache.velocity.app.*;
+import org.apache.velocity.exception.*;
+import org.apache.commons.logging.*;
+import java.util.*;
+import java.io.*;
+import xjavadoc.*;
+import xjavadoc.filesystem.*;
+
+/**
+ *  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);
+        }    
+    }
+}   

Added: 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=227065&view=auto
==============================================================================
--- struts/sandbox/trunk/ti/src/java/org/apache/ti/config/mapper/ActionMapper.java (added)
+++ struts/sandbox/trunk/ti/src/java/org/apache/ti/config/mapper/ActionMapper.java Tue Aug  2 11:57:06 2005
@@ -0,0 +1,12 @@
+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:executable = *

Added: 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=227065&view=auto
==============================================================================
--- struts/sandbox/trunk/ti/src/java/org/apache/ti/config/mapper/ActionMapping.java (added)
+++ struts/sandbox/trunk/ti/src/java/org/apache/ti/config/mapper/ActionMapping.java Tue Aug  2 11:57:06 2005
@@ -0,0 +1,41 @@
+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:executable = *

Added: 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=227065&view=auto
==============================================================================
--- struts/sandbox/trunk/ti/src/java/org/apache/ti/config/mapper/ServletActionMapper.java (added)
+++ struts/sandbox/trunk/ti/src/java/org/apache/ti/config/mapper/ServletActionMapper.java Tue Aug  2 11:57:06 2005
@@ -0,0 +1,88 @@
+package org.apache.ti.config.mapper;
+
+import java.util.*;
+import javax.servlet.http.*;
+import org.apache.commons.chain.web.WebContext;
+import org.apache.commons.chain.web.servlet.ServletWebContext;
+import org.apache.ti.servlet.*;
+
+import org.apache.commons.logging.*;
+
+/**
+ * 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:executable = *

Added: struts/sandbox/trunk/ti/src/java/org/apache/ti/config/spring-config-servlet.xml
URL: http://svn.apache.org/viewcvs/struts/sandbox/trunk/ti/src/java/org/apache/ti/config/spring-config-servlet.xml?rev=227065&view=auto
==============================================================================
--- struts/sandbox/trunk/ti/src/java/org/apache/ti/config/spring-config-servlet.xml (added)
+++ struts/sandbox/trunk/ti/src/java/org/apache/ti/config/spring-config-servlet.xml Tue Aug  2 11:57:06 2005
@@ -0,0 +1,40 @@
+<!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN//EN" "http://www.springframework.org/dtd/spring-beans.dtd">
+
+<beans>
+  
+  <bean id="requestProcessor" class="org.apache.ti.processor.chain.ChainRequestProcessor">
+    <property name="sourceResolver"><ref bean="sourceResolver" /></property>
+    <property name="chainConfig"><value>org/apache/ti/processor/chain/chain-config-servlet.xml</value></property>
+    <property name="catalogName"><value>struts-ti</value></property>
+    <property name="startCommandName"><value>start</value></property>
+    <property name="initCommandName"><value>init</value></property>
+    <property name="chainRuleSet" ref="chainRuleSet" />
+  </bean>
+  
+  <bean id="chainRuleSet" class="org.apache.ti.processor.chain.SpringConfigRuleSet" />
+  
+  <bean id="sourceResolver" class="org.apache.ti.util.ServletSourceResolver" />
+  
+  <bean id="actionMapper" class="org.apache.ti.config.mapper.ServletActionMapper" />
+  
+  <bean id="controllerContext" class="org.apache.ti.processor.ControllerContext" />
+  
+  <bean id="objectFactory" class="org.apache.ti.processor.SpringObjectFactory" />
+  
+  <bean id="actionProxyFactory" class="org.apache.ti.processor.SpringActionProxyFactory" />
+  
+  <bean id="controllerAction" class="org.apache.ti.processor.ControllerAction" singleton="false" />
+  
+  <!-- Chain commands that need DI -->
+  <bean id="createActionMapping" class="org.apache.ti.processor.chain.CreateActionMapping">
+    <property name="actionMapper" ref="actionMapper" />
+  </bean>
+  <bean id="initXWork" class="org.apache.ti.processor.chain.InitXWork">
+    <property name="objectFactory" ref="objectFactory" />
+    <property name="actionProxyFactory" ref="actionProxyFactory" />
+  </bean>
+  <bean id="initControllerContext" class="org.apache.ti.processor.chain.InitControllerContext">
+    <property name="controllerContext" ref="controllerContext" />
+  </bean>
+  
+</beans>  

Added: struts/sandbox/trunk/ti/src/java/org/apache/ti/config/velocity.properties
URL: http://svn.apache.org/viewcvs/struts/sandbox/trunk/ti/src/java/org/apache/ti/config/velocity.properties?rev=227065&view=auto
==============================================================================
--- struts/sandbox/trunk/ti/src/java/org/apache/ti/config/velocity.properties (added)
+++ struts/sandbox/trunk/ti/src/java/org/apache/ti/config/velocity.properties Tue Aug  2 11:57:06 2005
@@ -0,0 +1,11 @@
+
+#
+# specify resource loaders to use
+#
+resource.loader = class
+
+#
+#  for the loader we call 'class', use the ClasspathResourceLoader
+#
+class.resource.loader.description = Velocity Classpath Resource Loader
+class.resource.loader.class = org.apache.velocity.runtime.resource.loader.ClasspathResourceLoader

Added: struts/sandbox/trunk/ti/src/java/org/apache/ti/config/xdocletToXWork.vm
URL: http://svn.apache.org/viewcvs/struts/sandbox/trunk/ti/src/java/org/apache/ti/config/xdocletToXWork.vm?rev=227065&view=auto
==============================================================================
--- struts/sandbox/trunk/ti/src/java/org/apache/ti/config/xdocletToXWork.vm (added)
+++ struts/sandbox/trunk/ti/src/java/org/apache/ti/config/xdocletToXWork.vm Tue Aug  2 11:57:06 2005
@@ -0,0 +1,44 @@
+<?xml version="1.0"?>
+<!DOCTYPE xwork PUBLIC
+    "-//OpenSymphony Group//XWork 1.0//EN"
+    "http://www.opensymphony.com/xwork/xwork-1.0.dtd"
+ >
+
+<xwork>
+<include file="xwork-default.xml"/>
+#set( $pkg=$xclass.containingPackage)
+
+#if( $pkg.name=="")
+<package name="default" extends="xwork-default">
+#else
+<package name="$pkg.name" namespace="/${pkg.name}" extends="xwork-default">
+#end
+
+    <result-types>
+        <result-type name="chain" class="com.opensymphony.xwork.ActionChainResult"/>
+        <result-type name="dispatcher" class="org.apache.ti.servlet.ServletDispatcherResult" default="true"/>
+    </result-types>
+    #foreach( $method in $xclass.getMethods(true) )
+      #if( $method.returnType.type.type == "java.lang.String.class" && $method.doc.hasTag("ti.action"))
+        #if( $method.parameters.size() == 0 || $method.parameters.size() == 1) 
+        <action name="$method.name" method="$method.name" class="$xclass.qualifiedName">
+           #set( $forwards = $method.doc.getTags("ti.forward"))
+           #if( $forwards.size() == 0) 
+           <result name="success">
+                <param name="location">${method.name}.jsp</param>
+           </result>
+           #else
+             #foreach( $fwd in $forwards )
+             <result name="${fwd.getAttributeValue("name")}"
+                     type="${fwd.getAttributeValue("type")}">
+                <param name="location">${fwd.getAttributeValue("location")}</param>
+             </result>
+             #end
+           #end  
+        </action>
+        #end
+      #end  
+    #end
+
+</package>
+</xwork>

Added: 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=227065&view=auto
==============================================================================
--- struts/sandbox/trunk/ti/src/java/org/apache/ti/processor/BaseResult.java (added)
+++ struts/sandbox/trunk/ti/src/java/org/apache/ti/processor/BaseResult.java Tue Aug  2 11:57:06 2005
@@ -0,0 +1,27 @@
+/*
+ * Copyright (c) 2002-2003 by OpenSymphony
+ * All rights reserved.
+ */
+package org.apache.ti.processor;
+
+import com.opensymphony.xwork.*;
+
+/**
+ *  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:executable = *

Added: 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=227065&view=auto
==============================================================================
--- struts/sandbox/trunk/ti/src/java/org/apache/ti/processor/ControllerAction.java (added)
+++ struts/sandbox/trunk/ti/src/java/org/apache/ti/processor/ControllerAction.java Tue Aug  2 11:57:06 2005
@@ -0,0 +1,41 @@
+/*
+ * Copyright (c) 2002-2003 by OpenSymphony
+ * All rights reserved.
+ */
+package org.apache.ti.processor;
+
+import com.opensymphony.xwork.*;
+import com.opensymphony.xwork.config.entities.*;
+
+/**
+ *  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:executable = *

Added: 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=227065&view=auto
==============================================================================
--- struts/sandbox/trunk/ti/src/java/org/apache/ti/processor/ControllerActionInvocation.java (added)
+++ struts/sandbox/trunk/ti/src/java/org/apache/ti/processor/ControllerActionInvocation.java Tue Aug  2 11:57:06 2005
@@ -0,0 +1,133 @@
+/*
+ * Copyright (c) 2002-2003 by OpenSymphony
+ * All rights reserved.
+ */
+package org.apache.ti.processor;
+
+import com.opensymphony.xwork.config.entities.ActionConfig;
+import com.opensymphony.xwork.config.entities.ResultConfig;
+import com.opensymphony.xwork.interceptor.Interceptor;
+import com.opensymphony.xwork.interceptor.PreResultListener;
+import com.opensymphony.xwork.util.OgnlValueStack;
+import com.opensymphony.xwork.*;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+import java.lang.reflect.InvocationTargetException;
+import java.lang.reflect.Method;
+import java.lang.reflect.Proxy;
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.*;
+import java.util.Map;
+
+import org.springframework.beans.factory.*;
+
+
+/**
+ * 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:executable = *

Added: 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=227065&view=auto
==============================================================================
--- struts/sandbox/trunk/ti/src/java/org/apache/ti/processor/ControllerContext.java (added)
+++ struts/sandbox/trunk/ti/src/java/org/apache/ti/processor/ControllerContext.java Tue Aug  2 11:57:06 2005
@@ -0,0 +1,55 @@
+/*
+ * $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 org.apache.commons.chain.web.*;
+import com.opensymphony.xwork.*;
+import org.apache.ti.config.mapper.*;
+
+/**
+ *  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);
+    }    
+}

Added: 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=227065&view=auto
==============================================================================
--- struts/sandbox/trunk/ti/src/java/org/apache/ti/processor/ProcessorException.java (added)
+++ struts/sandbox/trunk/ti/src/java/org/apache/ti/processor/ProcessorException.java Tue Aug  2 11:57:06 2005
@@ -0,0 +1,41 @@
+/*
+ * $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 org.apache.commons.chain.web.*;
+
+
+/**
+ *  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);
+    }
+    
+}

Added: 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=227065&view=auto
==============================================================================
--- struts/sandbox/trunk/ti/src/java/org/apache/ti/processor/RequestProcessor.java (added)
+++ struts/sandbox/trunk/ti/src/java/org/apache/ti/processor/RequestProcessor.java Tue Aug  2 11:57:06 2005
@@ -0,0 +1,36 @@
+/*
+ * $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 org.apache.commons.chain.web.*;
+import java.util.Map;
+
+
+/**
+ *  Defines a class that processes requests
+ */
+public interface RequestProcessor {
+
+    public void init(Map initParameters, WebContext ctx);
+    
+    public void process(WebContext ctx);
+    
+    public void destroy();
+    
+}

Added: 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=227065&view=auto
==============================================================================
--- struts/sandbox/trunk/ti/src/java/org/apache/ti/processor/SpringActionProxyFactory.java (added)
+++ struts/sandbox/trunk/ti/src/java/org/apache/ti/processor/SpringActionProxyFactory.java Tue Aug  2 11:57:06 2005
@@ -0,0 +1,39 @@
+/*
+ * Copyright (c) 2002-2003 by OpenSymphony
+ * All rights reserved.
+ */
+package org.apache.ti.processor;
+
+import com.opensymphony.xwork.*;
+import com.opensymphony.xwork.config.entities.ActionConfig;
+import org.springframework.beans.factory.*;
+
+import java.util.Map;
+
+
+/**
+ *  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:executable = *

Added: 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=227065&view=auto
==============================================================================
--- struts/sandbox/trunk/ti/src/java/org/apache/ti/processor/SpringObjectFactory.java (added)
+++ struts/sandbox/trunk/ti/src/java/org/apache/ti/processor/SpringObjectFactory.java Tue Aug  2 11:57:06 2005
@@ -0,0 +1,42 @@
+/*
+ * Copyright (c) 2002-2003 by OpenSymphony
+ * All rights reserved.
+ */
+package org.apache.ti.processor;
+
+import com.opensymphony.xwork.config.entities.ActionConfig;
+import com.opensymphony.xwork.ObjectFactory;
+import com.opensymphony.xwork.Action;
+
+import org.springframework.beans.factory.*;
+
+
+/**
+ * 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:executable = *

Added: 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=227065&view=auto
==============================================================================
--- struts/sandbox/trunk/ti/src/java/org/apache/ti/processor/chain/ChainRequestProcessor.java (added)
+++ struts/sandbox/trunk/ti/src/java/org/apache/ti/processor/chain/ChainRequestProcessor.java Tue Aug  2 11:57:06 2005
@@ -0,0 +1,232 @@
+/*
+ * $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.chain;
+
+import org.apache.commons.chain.*;
+import org.apache.commons.chain.web.*;
+import org.apache.commons.chain.config.*;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.apache.commons.digester.*;
+import org.xml.sax.InputSource;
+import org.xml.sax.SAXException;
+import java.util.*;
+import java.net.*;
+import java.io.*;
+import org.apache.ti.processor.*;
+import org.apache.ti.util.*;
+
+
+/**
+ *  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();
+
+    }
+    
+}

Added: struts/sandbox/trunk/ti/src/java/org/apache/ti/processor/chain/CreateActionMapping.java
URL: http://svn.apache.org/viewcvs/struts/sandbox/trunk/ti/src/java/org/apache/ti/processor/chain/CreateActionMapping.java?rev=227065&view=auto
==============================================================================
--- struts/sandbox/trunk/ti/src/java/org/apache/ti/processor/chain/CreateActionMapping.java (added)
+++ struts/sandbox/trunk/ti/src/java/org/apache/ti/processor/chain/CreateActionMapping.java Tue Aug  2 11:57:06 2005
@@ -0,0 +1,46 @@
+/*
+ * $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.chain;
+
+import org.apache.commons.chain.web.*;
+import org.apache.commons.chain.*;
+import org.apache.ti.config.mapper.*;
+import com.opensymphony.xwork.*;
+
+/**
+ *  Creates an ActionMapping and stores it in the context.
+ */
+public class CreateActionMapping implements Command {
+    
+    protected ActionMapper actionMapper;
+    
+    public void setActionMapper(ActionMapper mapper) {
+        this.actionMapper = mapper;
+    }
+    
+    public boolean execute(Context origctx) {
+        WebContext ctx = (WebContext)origctx;
+        
+        ActionMapping mapping = actionMapper.getMapping(ctx);
+        ctx.put("actionMapping", mapping); 
+        return false;
+    }
+    
+    
+}

Propchange: struts/sandbox/trunk/ti/src/java/org/apache/ti/processor/chain/CreateActionMapping.java
------------------------------------------------------------------------------
    svn:executable = *

Added: struts/sandbox/trunk/ti/src/java/org/apache/ti/processor/chain/CreateActionProxy.java
URL: http://svn.apache.org/viewcvs/struts/sandbox/trunk/ti/src/java/org/apache/ti/processor/chain/CreateActionProxy.java?rev=227065&view=auto
==============================================================================
--- struts/sandbox/trunk/ti/src/java/org/apache/ti/processor/chain/CreateActionProxy.java (added)
+++ struts/sandbox/trunk/ti/src/java/org/apache/ti/processor/chain/CreateActionProxy.java Tue Aug  2 11:57:06 2005
@@ -0,0 +1,118 @@
+/*
+ * $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.chain;
+
+import org.apache.commons.chain.web.*;
+import org.apache.commons.chain.*;
+import org.apache.commons.logging.*;
+import org.apache.ti.config.mapper.*;
+import org.apache.ti.config.*;
+import org.apache.ti.processor.*;
+import com.opensymphony.xwork.*;
+import com.opensymphony.xwork.config.*;
+
+import java.util.*;
+
+
+/**
+ *  Creates an ActionProxy instance
+ */
+public class CreateActionProxy implements Command {
+    
+    protected static final Log log = LogFactory.getLog(CreateActionProxy.class);
+   
+    public boolean execute(Context origctx) {
+        WebContext ctx = (WebContext)origctx;
+        
+        ActionMapping mapping = (ActionMapping)ctx.get("actionMapping");
+        ActionProxy proxy = getActionProxy(ctx, mapping);
+
+        ctx.put("actionProxy", proxy);
+        return false;
+    }
+ 
+    protected ActionProxy getActionProxy(WebContext ctx, ActionMapping mapping) {
+        
+        // request map wrapping the http request objects
+        Map requestMap = ctx.getRequestScope();
+
+        // parameters map wrapping the http paraneters.
+        Map params = mapping.getParams();
+        Map requestParams = ctx.getParamValues();
+        if (params != null) {
+            params.putAll(requestParams);
+        } else {
+            params = requestParams;
+        }
+
+        HashMap extraContext = createContextMap(requestMap, params, ctx.getSessionScope(), ctx.getApplicationScope(), ctx);
+
+        // If there was a previous value stack, then create a new copy and pass it in to be used by the new Action
+        //OgnlValueStack stack = (OgnlValueStack) requestMap.get(ServletActionContext.WEBWORK_VALUESTACK_KEY);
+        //if (stack != null) {
+        //    extraContext.put(ActionContext.VALUE_STACK, new OgnlValueStack(stack));
+        //}
+        try {
+            ActionProxy proxy = ActionProxyFactory.getFactory().createActionProxy(mapping.getNamespace(), mapping.getName(), extraContext);
+            //request.setAttribute(ServletActionContext.WEBWORK_VALUESTACK_KEY, proxy.getInvocation().getStack());
+            return proxy;
+        } catch (ConfigurationException e) {
+            log.error("Could not find action", e);
+            throw new ProcessorException(e);
+        } catch (Exception e) {
+            log.error("Could not execute action", e);
+            throw new ProcessorException(e);
+        }
+    }
+        
+    /**
+     * Merges all application and servlet attributes into a single <tt>HashMap</tt> to represent the entire
+     * <tt>Action</tt> context.
+     *
+     * @param requestMap     a Map of all request attributes.
+     * @param parameterMap   a Map of all request parameters.
+     * @param sessionMap     a Map of all session attributes.
+     * @param applicationMap a Map of all servlet context attributes.
+     * @return a HashMap representing the <tt>Action</tt> context.
+     */
+    public HashMap createContextMap(Map requestMap,
+                                    Map parameterMap,
+                                    Map sessionMap,
+                                    Map applicationMap,
+                                    WebContext ctx) {
+        HashMap extraContext = new HashMap();
+        extraContext.put(ActionContext.PARAMETERS, new HashMap(parameterMap));
+        extraContext.put(ActionContext.SESSION, sessionMap);
+        extraContext.put(ActionContext.APPLICATION, applicationMap);
+        //extraContext.put(ActionContext.LOCALE, (locale == null) ? request.getLocale() : locale);
+
+        extraContext.put("webContext", ctx);
+
+        // helpers to get access to request/session/application scope
+        extraContext.put("request", requestMap);
+        extraContext.put("session", sessionMap);
+        extraContext.put("application", applicationMap);
+        extraContext.put("parameters", parameterMap);
+
+        return extraContext;
+    }
+
+   
+    
+}

Propchange: struts/sandbox/trunk/ti/src/java/org/apache/ti/processor/chain/CreateActionProxy.java
------------------------------------------------------------------------------
    svn:executable = *



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