You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by si...@apache.org on 2012/04/18 15:41:58 UTC

svn commit: r1327509 [1/2] - in /commons/proper/chain/trunk: ./ apps/ apps/cookbook-examples/ apps/cookbook-examples/src/ apps/cookbook-examples/src/main/ apps/cookbook-examples/src/main/java/ apps/cookbook-examples/src/main/java/org/ apps/cookbook-exa...

Author: simonetripodi
Date: Wed Apr 18 13:41:56 2012
New Revision: 1327509

URL: http://svn.apache.org/viewvc?rev=1327509&view=rev
Log:
[CHAIN-66] Updated Chain documentation to include new changes to the API - patch provided by Elijah Zupancic

Added:
    commons/proper/chain/trunk/apps/cookbook-examples/
    commons/proper/chain/trunk/apps/cookbook-examples/pom.xml   (with props)
    commons/proper/chain/trunk/apps/cookbook-examples/src/
    commons/proper/chain/trunk/apps/cookbook-examples/src/main/
    commons/proper/chain/trunk/apps/cookbook-examples/src/main/java/
    commons/proper/chain/trunk/apps/cookbook-examples/src/main/java/org/
    commons/proper/chain/trunk/apps/cookbook-examples/src/main/java/org/apache/
    commons/proper/chain/trunk/apps/cookbook-examples/src/main/java/org/apache/commons/
    commons/proper/chain/trunk/apps/cookbook-examples/src/main/java/org/apache/commons/chain2/
    commons/proper/chain/trunk/apps/cookbook-examples/src/main/java/org/apache/commons/chain2/cookbook/
    commons/proper/chain/trunk/apps/cookbook-examples/src/main/java/org/apache/commons/chain2/cookbook/agility/
    commons/proper/chain/trunk/apps/cookbook-examples/src/main/java/org/apache/commons/chain2/cookbook/agility/Controller.java   (with props)
    commons/proper/chain/trunk/apps/cookbook-examples/src/main/java/org/apache/commons/chain2/cookbook/agility/ProcessException.java   (with props)
    commons/proper/chain/trunk/apps/cookbook-examples/src/main/java/org/apache/commons/chain2/cookbook/agility/Request.java   (with props)
    commons/proper/chain/trunk/apps/cookbook-examples/src/main/java/org/apache/commons/chain2/cookbook/agility/RequestHandler.java   (with props)
    commons/proper/chain/trunk/apps/cookbook-examples/src/main/java/org/apache/commons/chain2/cookbook/agility/Response.java   (with props)
    commons/proper/chain/trunk/apps/cookbook-examples/src/main/java/org/apache/commons/chain2/cookbook/agility/impl/
    commons/proper/chain/trunk/apps/cookbook-examples/src/main/java/org/apache/commons/chain2/cookbook/agility/impl/ControllerCatalog.java   (with props)
    commons/proper/chain/trunk/apps/cookbook-examples/src/main/java/org/apache/commons/chain2/cookbook/agility/impl/HandlerCommand.java   (with props)
    commons/proper/chain/trunk/apps/cookbook-examples/src/main/java/org/apache/commons/chain2/cookbook/agility/impl/RequestContext.java   (with props)
    commons/proper/chain/trunk/apps/cookbook-examples/src/main/java/org/apache/commons/chain2/cookbook/agility/impl/ResponseContext.java   (with props)
    commons/proper/chain/trunk/apps/cookbook-examples/src/main/java/org/apache/commons/chain2/cookbook/mailreader/
    commons/proper/chain/trunk/apps/cookbook-examples/src/main/java/org/apache/commons/chain2/cookbook/mailreader/MailReader.java   (with props)
    commons/proper/chain/trunk/apps/cookbook-examples/src/main/java/org/apache/commons/chain2/cookbook/mailreader/MailReaderServlet.java   (with props)
    commons/proper/chain/trunk/apps/cookbook-examples/src/main/java/org/apache/commons/chain2/cookbook/mailreader/commands/
    commons/proper/chain/trunk/apps/cookbook-examples/src/main/java/org/apache/commons/chain2/cookbook/mailreader/commands/LocaleChange.java   (with props)
    commons/proper/chain/trunk/apps/cookbook-examples/src/main/java/org/apache/commons/chain2/cookbook/mailreader/commands/LogonUser.java   (with props)
    commons/proper/chain/trunk/apps/cookbook-examples/src/main/java/org/apache/commons/chain2/cookbook/mailreader/commands/ProfileCheck.java   (with props)
    commons/proper/chain/trunk/apps/cookbook-examples/src/main/java/org/apache/commons/chain2/cookbook/profile/
    commons/proper/chain/trunk/apps/cookbook-examples/src/main/java/org/apache/commons/chain2/cookbook/profile/Profile.java   (with props)
    commons/proper/chain/trunk/apps/cookbook-examples/src/main/java/org/apache/commons/chain2/cookbook/profile/ProfileCheck.java   (with props)
    commons/proper/chain/trunk/apps/cookbook-examples/src/main/java/org/apache/commons/chain2/cookbook/profile/ProfileContext.java   (with props)
    commons/proper/chain/trunk/apps/cookbook-examples/src/main/resources/
    commons/proper/chain/trunk/apps/cookbook-examples/src/main/resources/chain/
    commons/proper/chain/trunk/apps/cookbook-examples/src/main/resources/chain/catalog.xml   (with props)
    commons/proper/chain/trunk/apps/cookbook-examples/src/main/webapp/
    commons/proper/chain/trunk/apps/cookbook-examples/src/main/webapp/WEB-INF/
    commons/proper/chain/trunk/apps/cookbook-examples/src/main/webapp/WEB-INF/web.xml   (with props)
    commons/proper/chain/trunk/apps/cookbook-examples/src/test/
    commons/proper/chain/trunk/apps/cookbook-examples/src/test/java/
    commons/proper/chain/trunk/apps/cookbook-examples/src/test/java/org/
    commons/proper/chain/trunk/apps/cookbook-examples/src/test/java/org/apache/
    commons/proper/chain/trunk/apps/cookbook-examples/src/test/java/org/apache/commons/
    commons/proper/chain/trunk/apps/cookbook-examples/src/test/java/org/apache/commons/chain2/
    commons/proper/chain/trunk/apps/cookbook-examples/src/test/java/org/apache/commons/chain2/cookbook/
    commons/proper/chain/trunk/apps/cookbook-examples/src/test/java/org/apache/commons/chain2/cookbook/agility/
    commons/proper/chain/trunk/apps/cookbook-examples/src/test/java/org/apache/commons/chain2/cookbook/agility/ProcessingTest.java   (with props)
    commons/proper/chain/trunk/apps/cookbook-examples/src/test/java/org/apache/commons/chain2/cookbook/mailreader/
    commons/proper/chain/trunk/apps/cookbook-examples/src/test/java/org/apache/commons/chain2/cookbook/mailreader/CatalogTest.java   (with props)
    commons/proper/chain/trunk/apps/cookbook-examples/src/test/java/org/apache/commons/chain2/cookbook/mailreader/LocaleValueTest.java   (with props)
    commons/proper/chain/trunk/apps/cookbook-examples/src/test/java/org/apache/commons/chain2/cookbook/profile/
    commons/proper/chain/trunk/apps/cookbook-examples/src/test/java/org/apache/commons/chain2/cookbook/profile/ProfileCheckTest.java   (with props)
    commons/proper/chain/trunk/apps/example1/src/main/java/org/apache/commons/chain2/
    commons/proper/chain/trunk/apps/example1/src/main/java/org/apache/commons/chain2/apps/
    commons/proper/chain/trunk/apps/example1/src/main/java/org/apache/commons/chain2/apps/example/
      - copied from r1295180, commons/proper/chain/trunk/apps/example1/src/main/java/org/apache/commons/chain/apps/example/
    commons/proper/chain/trunk/apps/example2/src/main/java/org/apache/commons/chain2/
    commons/proper/chain/trunk/apps/example2/src/main/java/org/apache/commons/chain2/apps/
    commons/proper/chain/trunk/apps/example2/src/main/java/org/apache/commons/chain2/apps/example/
      - copied from r1295180, commons/proper/chain/trunk/apps/example2/src/main/java/org/apache/commons/chain/apps/example/
    commons/proper/chain/trunk/apps/pom.xml   (with props)
Removed:
    commons/proper/chain/trunk/apps/example1/src/main/java/org/apache/commons/chain/apps/
    commons/proper/chain/trunk/apps/example2/src/main/java/org/apache/commons/chain/apps/
Modified:
    commons/proper/chain/trunk/apps/   (props changed)
    commons/proper/chain/trunk/apps/example1/   (props changed)
    commons/proper/chain/trunk/apps/example1/pom.xml
    commons/proper/chain/trunk/apps/example1/src/main/java/org/apache/commons/chain2/apps/example/CountCommand.java
    commons/proper/chain/trunk/apps/example1/src/main/java/org/apache/commons/chain2/apps/example/ForwardCommand.java
    commons/proper/chain/trunk/apps/example2/   (props changed)
    commons/proper/chain/trunk/apps/example2/pom.xml
    commons/proper/chain/trunk/apps/example2/src/main/java/org/apache/commons/chain2/apps/example/CountCommand.java
    commons/proper/chain/trunk/apps/example2/src/main/java/org/apache/commons/chain2/apps/example/ExampleServlet.java
    commons/proper/chain/trunk/apps/example2/src/main/java/org/apache/commons/chain2/apps/example/ForwardCommand.java
    commons/proper/chain/trunk/build-tools/   (props changed)
    commons/proper/chain/trunk/configuration/   (props changed)
    commons/proper/chain/trunk/core/   (props changed)
    commons/proper/chain/trunk/core/src/main/java/org/apache/commons/chain2/Command.java
    commons/proper/chain/trunk/pom.xml
    commons/proper/chain/trunk/src/changes/changes.xml
    commons/proper/chain/trunk/src/site/xdoc/cookbook.xml
    commons/proper/chain/trunk/src/site/xdoc/mail-lists.xml

Propchange: commons/proper/chain/trunk/apps/
------------------------------------------------------------------------------
--- svn:ignore (added)
+++ svn:ignore Wed Apr 18 13:41:56 2012
@@ -0,0 +1 @@
+target

Added: commons/proper/chain/trunk/apps/cookbook-examples/pom.xml
URL: http://svn.apache.org/viewvc/commons/proper/chain/trunk/apps/cookbook-examples/pom.xml?rev=1327509&view=auto
==============================================================================
--- commons/proper/chain/trunk/apps/cookbook-examples/pom.xml (added)
+++ commons/proper/chain/trunk/apps/cookbook-examples/pom.xml Wed Apr 18 13:41:56 2012
@@ -0,0 +1,87 @@
+<?xml version="1.0" ?>
+<!--
+   Licensed to the Apache Software Foundation (ASF) under one or more
+   contributor license agreements.  See the NOTICE file distributed with
+   this work for additional information regarding copyright ownership.
+   The ASF licenses this file to You 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 xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+     xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+  <modelVersion>4.0.0</modelVersion>
+
+  <parent>
+    <groupId>org.apache.commons</groupId>
+    <artifactId>commons-chain-examples</artifactId>
+    <version>2.0-SNAPSHOT</version>
+    <relativePath>../</relativePath>
+  </parent>
+
+  <artifactId>chain-cookbook-examples</artifactId>
+  <packaging>war</packaging>
+
+  <name>Apache Commons Chain :: Examples :: Cookbook</name>
+
+  <dependencies>
+    <dependency>
+      <groupId>org.apache.commons</groupId>
+      <artifactId>commons-chain2</artifactId>
+      <version>${project.version}</version>
+    </dependency>
+
+    <dependency>
+      <groupId>org.apache.commons</groupId>
+      <artifactId>commons-chain2-web</artifactId>
+      <version>${project.version}</version>
+    </dependency>
+
+    <dependency>
+      <groupId>org.mockito</groupId>
+      <artifactId>mockito-all</artifactId>
+      <version>1.8.5</version>
+      <scope>test</scope>
+    </dependency>
+
+    <dependency>
+      <groupId>javax.servlet</groupId>
+      <artifactId>servlet-api</artifactId>
+      <version>2.5</version>
+      <scope>provided</scope>
+    </dependency>
+  </dependencies>
+
+  <build>
+    <resources>
+      <resource>
+        <directory>${basedir}/src/main/resources/chain</directory>
+        <targetPath>resources</targetPath>
+        <includes>
+          <include>catalog.xml</include>
+        </includes>
+      </resource>
+    </resources>
+
+    <plugins>
+      <plugin>
+        <groupId>org.apache.tomcat.maven</groupId>
+        <artifactId>tomcat7-maven-plugin</artifactId>
+        <version>2.0-SNAPSHOT</version>
+        <configuration>
+          <!-- http port -->
+          <port>9091</port>
+          <path>/</path>
+        </configuration>
+      </plugin>
+    </plugins>
+  </build>
+
+</project>

Propchange: commons/proper/chain/trunk/apps/cookbook-examples/pom.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: commons/proper/chain/trunk/apps/cookbook-examples/pom.xml
------------------------------------------------------------------------------
    svn:keywords = Date Revision Author HeadURL Id

Propchange: commons/proper/chain/trunk/apps/cookbook-examples/pom.xml
------------------------------------------------------------------------------
    svn:mime-type = text/xml

Added: commons/proper/chain/trunk/apps/cookbook-examples/src/main/java/org/apache/commons/chain2/cookbook/agility/Controller.java
URL: http://svn.apache.org/viewvc/commons/proper/chain/trunk/apps/cookbook-examples/src/main/java/org/apache/commons/chain2/cookbook/agility/Controller.java?rev=1327509&view=auto
==============================================================================
--- commons/proper/chain/trunk/apps/cookbook-examples/src/main/java/org/apache/commons/chain2/cookbook/agility/Controller.java (added)
+++ commons/proper/chain/trunk/apps/cookbook-examples/src/main/java/org/apache/commons/chain2/cookbook/agility/Controller.java Wed Apr 18 13:41:56 2012
@@ -0,0 +1,23 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You 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.commons.chain2.cookbook.agility;
+
+public interface Controller {
+    void addHandler(RequestHandler handler);
+    RequestHandler getHandler(String name) throws ProcessException;
+    void process(Request request) throws ProcessException;
+}

Propchange: commons/proper/chain/trunk/apps/cookbook-examples/src/main/java/org/apache/commons/chain2/cookbook/agility/Controller.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: commons/proper/chain/trunk/apps/cookbook-examples/src/main/java/org/apache/commons/chain2/cookbook/agility/Controller.java
------------------------------------------------------------------------------
    svn:keywords = Date Author Id Revision HeadURL

Propchange: commons/proper/chain/trunk/apps/cookbook-examples/src/main/java/org/apache/commons/chain2/cookbook/agility/Controller.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: commons/proper/chain/trunk/apps/cookbook-examples/src/main/java/org/apache/commons/chain2/cookbook/agility/ProcessException.java
URL: http://svn.apache.org/viewvc/commons/proper/chain/trunk/apps/cookbook-examples/src/main/java/org/apache/commons/chain2/cookbook/agility/ProcessException.java?rev=1327509&view=auto
==============================================================================
--- commons/proper/chain/trunk/apps/cookbook-examples/src/main/java/org/apache/commons/chain2/cookbook/agility/ProcessException.java (added)
+++ commons/proper/chain/trunk/apps/cookbook-examples/src/main/java/org/apache/commons/chain2/cookbook/agility/ProcessException.java Wed Apr 18 13:41:56 2012
@@ -0,0 +1,23 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You 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.commons.chain2.cookbook.agility;
+
+public class ProcessException extends RuntimeException {
+    public ProcessException(Throwable cause) {
+        super(cause);
+    }
+}

Propchange: commons/proper/chain/trunk/apps/cookbook-examples/src/main/java/org/apache/commons/chain2/cookbook/agility/ProcessException.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: commons/proper/chain/trunk/apps/cookbook-examples/src/main/java/org/apache/commons/chain2/cookbook/agility/ProcessException.java
------------------------------------------------------------------------------
    svn:keywords = Date Author Id Revision HeadURL

Propchange: commons/proper/chain/trunk/apps/cookbook-examples/src/main/java/org/apache/commons/chain2/cookbook/agility/ProcessException.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: commons/proper/chain/trunk/apps/cookbook-examples/src/main/java/org/apache/commons/chain2/cookbook/agility/Request.java
URL: http://svn.apache.org/viewvc/commons/proper/chain/trunk/apps/cookbook-examples/src/main/java/org/apache/commons/chain2/cookbook/agility/Request.java?rev=1327509&view=auto
==============================================================================
--- commons/proper/chain/trunk/apps/cookbook-examples/src/main/java/org/apache/commons/chain2/cookbook/agility/Request.java (added)
+++ commons/proper/chain/trunk/apps/cookbook-examples/src/main/java/org/apache/commons/chain2/cookbook/agility/Request.java Wed Apr 18 13:41:56 2012
@@ -0,0 +1,23 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You 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.commons.chain2.cookbook.agility;
+
+public interface Request {
+    String getName();
+    Response getResponse();
+    void setResponse(Response response);
+}

Propchange: commons/proper/chain/trunk/apps/cookbook-examples/src/main/java/org/apache/commons/chain2/cookbook/agility/Request.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: commons/proper/chain/trunk/apps/cookbook-examples/src/main/java/org/apache/commons/chain2/cookbook/agility/Request.java
------------------------------------------------------------------------------
    svn:keywords = Date Author Id Revision HeadURL

Propchange: commons/proper/chain/trunk/apps/cookbook-examples/src/main/java/org/apache/commons/chain2/cookbook/agility/Request.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: commons/proper/chain/trunk/apps/cookbook-examples/src/main/java/org/apache/commons/chain2/cookbook/agility/RequestHandler.java
URL: http://svn.apache.org/viewvc/commons/proper/chain/trunk/apps/cookbook-examples/src/main/java/org/apache/commons/chain2/cookbook/agility/RequestHandler.java?rev=1327509&view=auto
==============================================================================
--- commons/proper/chain/trunk/apps/cookbook-examples/src/main/java/org/apache/commons/chain2/cookbook/agility/RequestHandler.java (added)
+++ commons/proper/chain/trunk/apps/cookbook-examples/src/main/java/org/apache/commons/chain2/cookbook/agility/RequestHandler.java Wed Apr 18 13:41:56 2012
@@ -0,0 +1,22 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You 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.commons.chain2.cookbook.agility;
+
+public interface RequestHandler {
+    String getName();
+    void handle(Request request) throws ProcessException;
+}

Propchange: commons/proper/chain/trunk/apps/cookbook-examples/src/main/java/org/apache/commons/chain2/cookbook/agility/RequestHandler.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: commons/proper/chain/trunk/apps/cookbook-examples/src/main/java/org/apache/commons/chain2/cookbook/agility/RequestHandler.java
------------------------------------------------------------------------------
    svn:keywords = Date Author Id Revision HeadURL

Propchange: commons/proper/chain/trunk/apps/cookbook-examples/src/main/java/org/apache/commons/chain2/cookbook/agility/RequestHandler.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: commons/proper/chain/trunk/apps/cookbook-examples/src/main/java/org/apache/commons/chain2/cookbook/agility/Response.java
URL: http://svn.apache.org/viewvc/commons/proper/chain/trunk/apps/cookbook-examples/src/main/java/org/apache/commons/chain2/cookbook/agility/Response.java?rev=1327509&view=auto
==============================================================================
--- commons/proper/chain/trunk/apps/cookbook-examples/src/main/java/org/apache/commons/chain2/cookbook/agility/Response.java (added)
+++ commons/proper/chain/trunk/apps/cookbook-examples/src/main/java/org/apache/commons/chain2/cookbook/agility/Response.java Wed Apr 18 13:41:56 2012
@@ -0,0 +1,21 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You 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.commons.chain2.cookbook.agility;
+
+public interface Response {
+    String getName();
+}

Propchange: commons/proper/chain/trunk/apps/cookbook-examples/src/main/java/org/apache/commons/chain2/cookbook/agility/Response.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: commons/proper/chain/trunk/apps/cookbook-examples/src/main/java/org/apache/commons/chain2/cookbook/agility/Response.java
------------------------------------------------------------------------------
    svn:keywords = Date Author Id Revision HeadURL

Propchange: commons/proper/chain/trunk/apps/cookbook-examples/src/main/java/org/apache/commons/chain2/cookbook/agility/Response.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: commons/proper/chain/trunk/apps/cookbook-examples/src/main/java/org/apache/commons/chain2/cookbook/agility/impl/ControllerCatalog.java
URL: http://svn.apache.org/viewvc/commons/proper/chain/trunk/apps/cookbook-examples/src/main/java/org/apache/commons/chain2/cookbook/agility/impl/ControllerCatalog.java?rev=1327509&view=auto
==============================================================================
--- commons/proper/chain/trunk/apps/cookbook-examples/src/main/java/org/apache/commons/chain2/cookbook/agility/impl/ControllerCatalog.java (added)
+++ commons/proper/chain/trunk/apps/cookbook-examples/src/main/java/org/apache/commons/chain2/cookbook/agility/impl/ControllerCatalog.java Wed Apr 18 13:41:56 2012
@@ -0,0 +1,48 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You 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.commons.chain2.cookbook.agility.impl;
+
+import org.apache.commons.chain2.Command;
+import org.apache.commons.chain2.cookbook.agility.Controller;
+import org.apache.commons.chain2.cookbook.agility.ProcessException;
+import org.apache.commons.chain2.cookbook.agility.Request;
+import org.apache.commons.chain2.cookbook.agility.RequestHandler;
+import org.apache.commons.chain2.impl.CatalogBase;
+
+public class ControllerCatalog extends CatalogBase<String, Object, RequestContext>
+        implements Controller {
+
+    public RequestHandler getHandler(String name) {
+        @SuppressWarnings("unchecked")
+        RequestHandler handler = (RequestHandler) getCommand(name);
+
+        return handler;
+    }
+
+    public void addHandler(RequestHandler handler) {
+        @SuppressWarnings("unchecked")
+        Command<String, Object, RequestContext> command =
+                (Command<String, Object, RequestContext>)handler;
+
+        this.addCommand(handler.getName(), command);
+    }
+
+    public void process(Request request) throws ProcessException {
+        RequestHandler handler = getHandler(request.getName());
+        if (handler != null) handler.handle(request);
+    }
+}

Propchange: commons/proper/chain/trunk/apps/cookbook-examples/src/main/java/org/apache/commons/chain2/cookbook/agility/impl/ControllerCatalog.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: commons/proper/chain/trunk/apps/cookbook-examples/src/main/java/org/apache/commons/chain2/cookbook/agility/impl/ControllerCatalog.java
------------------------------------------------------------------------------
    svn:keywords = Date Author Id Revision HeadURL

Propchange: commons/proper/chain/trunk/apps/cookbook-examples/src/main/java/org/apache/commons/chain2/cookbook/agility/impl/ControllerCatalog.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: commons/proper/chain/trunk/apps/cookbook-examples/src/main/java/org/apache/commons/chain2/cookbook/agility/impl/HandlerCommand.java
URL: http://svn.apache.org/viewvc/commons/proper/chain/trunk/apps/cookbook-examples/src/main/java/org/apache/commons/chain2/cookbook/agility/impl/HandlerCommand.java?rev=1327509&view=auto
==============================================================================
--- commons/proper/chain/trunk/apps/cookbook-examples/src/main/java/org/apache/commons/chain2/cookbook/agility/impl/HandlerCommand.java (added)
+++ commons/proper/chain/trunk/apps/cookbook-examples/src/main/java/org/apache/commons/chain2/cookbook/agility/impl/HandlerCommand.java Wed Apr 18 13:41:56 2012
@@ -0,0 +1,52 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You 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.commons.chain2.cookbook.agility.impl;
+
+import org.apache.commons.chain2.Command;
+import org.apache.commons.chain2.cookbook.agility.ProcessException;
+import org.apache.commons.chain2.cookbook.agility.Request;
+import org.apache.commons.chain2.cookbook.agility.RequestHandler;
+import org.apache.commons.chain2.cookbook.agility.Response;
+
+public class HandlerCommand implements Command<String, Object, RequestContext>,
+        RequestHandler {
+    String name =  null;
+
+    public HandlerCommand(String name) {
+        this.name = name;
+    }
+
+    public String getName() {
+        return name;
+    }
+
+    public void handle(Request request) throws ProcessException {
+        try {
+            String name = request.getName();
+            Response response = new ResponseContext(name);
+            request.setResponse(response);
+        } catch (Exception e) {
+            throw new ProcessException(e);
+        }
+    }
+
+    public boolean execute(RequestContext requestContext) {
+        handle(requestContext);
+
+        return CONTINUE_PROCESSING;
+    }
+}
\ No newline at end of file

Propchange: commons/proper/chain/trunk/apps/cookbook-examples/src/main/java/org/apache/commons/chain2/cookbook/agility/impl/HandlerCommand.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: commons/proper/chain/trunk/apps/cookbook-examples/src/main/java/org/apache/commons/chain2/cookbook/agility/impl/HandlerCommand.java
------------------------------------------------------------------------------
    svn:keywords = Date Author Id Revision HeadURL

Propchange: commons/proper/chain/trunk/apps/cookbook-examples/src/main/java/org/apache/commons/chain2/cookbook/agility/impl/HandlerCommand.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: commons/proper/chain/trunk/apps/cookbook-examples/src/main/java/org/apache/commons/chain2/cookbook/agility/impl/RequestContext.java
URL: http://svn.apache.org/viewvc/commons/proper/chain/trunk/apps/cookbook-examples/src/main/java/org/apache/commons/chain2/cookbook/agility/impl/RequestContext.java?rev=1327509&view=auto
==============================================================================
--- commons/proper/chain/trunk/apps/cookbook-examples/src/main/java/org/apache/commons/chain2/cookbook/agility/impl/RequestContext.java (added)
+++ commons/proper/chain/trunk/apps/cookbook-examples/src/main/java/org/apache/commons/chain2/cookbook/agility/impl/RequestContext.java Wed Apr 18 13:41:56 2012
@@ -0,0 +1,44 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You 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.commons.chain2.cookbook.agility.impl;
+
+import org.apache.commons.chain2.cookbook.agility.Request;
+import org.apache.commons.chain2.cookbook.agility.Response;
+import org.apache.commons.chain2.impl.ContextBase;
+
+public class RequestContext extends ContextBase implements Request {
+
+    private String name;
+    private Response response;
+
+    public RequestContext(String name) {
+        super();
+        this.name = name;
+    }
+
+    public String getName() {
+        return name;
+    }
+
+    public Response getResponse() {
+        return response;
+    }
+
+    public void setResponse(Response response) {
+        this.response = response;
+    }
+}

Propchange: commons/proper/chain/trunk/apps/cookbook-examples/src/main/java/org/apache/commons/chain2/cookbook/agility/impl/RequestContext.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: commons/proper/chain/trunk/apps/cookbook-examples/src/main/java/org/apache/commons/chain2/cookbook/agility/impl/RequestContext.java
------------------------------------------------------------------------------
    svn:keywords = Date Author Id Revision HeadURL

Propchange: commons/proper/chain/trunk/apps/cookbook-examples/src/main/java/org/apache/commons/chain2/cookbook/agility/impl/RequestContext.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: commons/proper/chain/trunk/apps/cookbook-examples/src/main/java/org/apache/commons/chain2/cookbook/agility/impl/ResponseContext.java
URL: http://svn.apache.org/viewvc/commons/proper/chain/trunk/apps/cookbook-examples/src/main/java/org/apache/commons/chain2/cookbook/agility/impl/ResponseContext.java?rev=1327509&view=auto
==============================================================================
--- commons/proper/chain/trunk/apps/cookbook-examples/src/main/java/org/apache/commons/chain2/cookbook/agility/impl/ResponseContext.java (added)
+++ commons/proper/chain/trunk/apps/cookbook-examples/src/main/java/org/apache/commons/chain2/cookbook/agility/impl/ResponseContext.java Wed Apr 18 13:41:56 2012
@@ -0,0 +1,34 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You 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.commons.chain2.cookbook.agility.impl;
+
+import org.apache.commons.chain2.cookbook.agility.Response;
+import org.apache.commons.chain2.impl.ContextBase;
+
+public class ResponseContext extends ContextBase implements Response {
+
+    private String name;
+
+    public ResponseContext(String name) {
+        super();
+        this.name = name;
+    }
+
+    public String getName() {
+        return name;
+    }
+}

Propchange: commons/proper/chain/trunk/apps/cookbook-examples/src/main/java/org/apache/commons/chain2/cookbook/agility/impl/ResponseContext.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: commons/proper/chain/trunk/apps/cookbook-examples/src/main/java/org/apache/commons/chain2/cookbook/agility/impl/ResponseContext.java
------------------------------------------------------------------------------
    svn:keywords = Date Author Id Revision HeadURL

Propchange: commons/proper/chain/trunk/apps/cookbook-examples/src/main/java/org/apache/commons/chain2/cookbook/agility/impl/ResponseContext.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: commons/proper/chain/trunk/apps/cookbook-examples/src/main/java/org/apache/commons/chain2/cookbook/mailreader/MailReader.java
URL: http://svn.apache.org/viewvc/commons/proper/chain/trunk/apps/cookbook-examples/src/main/java/org/apache/commons/chain2/cookbook/mailreader/MailReader.java?rev=1327509&view=auto
==============================================================================
--- commons/proper/chain/trunk/apps/cookbook-examples/src/main/java/org/apache/commons/chain2/cookbook/mailreader/MailReader.java (added)
+++ commons/proper/chain/trunk/apps/cookbook-examples/src/main/java/org/apache/commons/chain2/cookbook/mailreader/MailReader.java Wed Apr 18 13:41:56 2012
@@ -0,0 +1,47 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You 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.commons.chain2.cookbook.mailreader;
+
+import org.apache.commons.chain2.impl.ContextBase;
+
+import java.io.Writer;
+import java.util.Locale;
+
+public class MailReader extends ContextBase {
+
+    public static String LOCALE_KEY = "locale";
+
+    private Writer logger;
+    private Locale locale;
+
+    public MailReader() {}
+
+    public Locale getLocale() {
+        return locale;
+    }
+    public void setLocale(Locale locale) {
+        this.locale = locale;
+    }
+
+    public Writer getLogger() {
+        return logger;
+    }
+
+    public void setLogger(Writer logger) {
+        this.logger = logger;
+    }
+}
\ No newline at end of file

Propchange: commons/proper/chain/trunk/apps/cookbook-examples/src/main/java/org/apache/commons/chain2/cookbook/mailreader/MailReader.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: commons/proper/chain/trunk/apps/cookbook-examples/src/main/java/org/apache/commons/chain2/cookbook/mailreader/MailReader.java
------------------------------------------------------------------------------
    svn:keywords = Date Author Id Revision HeadURL

Propchange: commons/proper/chain/trunk/apps/cookbook-examples/src/main/java/org/apache/commons/chain2/cookbook/mailreader/MailReader.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: commons/proper/chain/trunk/apps/cookbook-examples/src/main/java/org/apache/commons/chain2/cookbook/mailreader/MailReaderServlet.java
URL: http://svn.apache.org/viewvc/commons/proper/chain/trunk/apps/cookbook-examples/src/main/java/org/apache/commons/chain2/cookbook/mailreader/MailReaderServlet.java?rev=1327509&view=auto
==============================================================================
--- commons/proper/chain/trunk/apps/cookbook-examples/src/main/java/org/apache/commons/chain2/cookbook/mailreader/MailReaderServlet.java (added)
+++ commons/proper/chain/trunk/apps/cookbook-examples/src/main/java/org/apache/commons/chain2/cookbook/mailreader/MailReaderServlet.java Wed Apr 18 13:41:56 2012
@@ -0,0 +1,53 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You 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.commons.chain2.cookbook.mailreader;
+
+import org.apache.commons.chain2.Catalog;
+import org.apache.commons.chain2.CatalogFactory;
+import org.apache.commons.chain2.Command;
+
+import javax.servlet.ServletException;
+import javax.servlet.http.HttpServlet;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+import java.io.IOException;
+
+public class MailReaderServlet extends HttpServlet {
+    public MailReaderServlet() {
+    }
+
+    @Override
+    protected void doGet(HttpServletRequest request, HttpServletResponse response)
+            throws ServletException, IOException {
+        response.setContentType("text/plain");
+
+        MailReader context = new MailReader();
+        context.setLocale(request.getLocale());
+        context.setLogger(response.getWriter());
+
+        CatalogFactory<String, Object, MailReader> catalogFactory =
+                CatalogFactory.getInstance();
+
+        Catalog<String, Object, MailReader> catalog =
+                catalogFactory.getCatalog();
+
+        Command<String, Object, MailReader> profileCheckCmd =
+                catalog.getCommand("LocaleChange");
+
+        profileCheckCmd.execute(context);
+    }
+}

Propchange: commons/proper/chain/trunk/apps/cookbook-examples/src/main/java/org/apache/commons/chain2/cookbook/mailreader/MailReaderServlet.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: commons/proper/chain/trunk/apps/cookbook-examples/src/main/java/org/apache/commons/chain2/cookbook/mailreader/MailReaderServlet.java
------------------------------------------------------------------------------
    svn:keywords = Date Author Id Revision HeadURL

Propchange: commons/proper/chain/trunk/apps/cookbook-examples/src/main/java/org/apache/commons/chain2/cookbook/mailreader/MailReaderServlet.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: commons/proper/chain/trunk/apps/cookbook-examples/src/main/java/org/apache/commons/chain2/cookbook/mailreader/commands/LocaleChange.java
URL: http://svn.apache.org/viewvc/commons/proper/chain/trunk/apps/cookbook-examples/src/main/java/org/apache/commons/chain2/cookbook/mailreader/commands/LocaleChange.java?rev=1327509&view=auto
==============================================================================
--- commons/proper/chain/trunk/apps/cookbook-examples/src/main/java/org/apache/commons/chain2/cookbook/mailreader/commands/LocaleChange.java (added)
+++ commons/proper/chain/trunk/apps/cookbook-examples/src/main/java/org/apache/commons/chain2/cookbook/mailreader/commands/LocaleChange.java Wed Apr 18 13:41:56 2012
@@ -0,0 +1,41 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You 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.commons.chain2.cookbook.mailreader.commands;
+
+import org.apache.commons.chain2.Command;
+import org.apache.commons.chain2.cookbook.mailreader.MailReader;
+
+import java.io.IOException;
+import java.io.Writer;
+
+public class LocaleChange implements Command<String, Object, MailReader> {
+    public LocaleChange() {
+    }
+
+    public boolean execute(MailReader mailReader) {
+        try {
+            Writer logger = mailReader.getLogger();
+            logger.write("LocaleChange.execute ");
+            logger.write("[Locale is: " + mailReader.getLocale() + "]\n");
+        }
+        catch (IOException ioe) {
+            throw new RuntimeException(ioe);
+        }
+
+        return CONTINUE_PROCESSING;
+    }
+}

Propchange: commons/proper/chain/trunk/apps/cookbook-examples/src/main/java/org/apache/commons/chain2/cookbook/mailreader/commands/LocaleChange.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: commons/proper/chain/trunk/apps/cookbook-examples/src/main/java/org/apache/commons/chain2/cookbook/mailreader/commands/LocaleChange.java
------------------------------------------------------------------------------
    svn:keywords = Date Author Id Revision HeadURL

Propchange: commons/proper/chain/trunk/apps/cookbook-examples/src/main/java/org/apache/commons/chain2/cookbook/mailreader/commands/LocaleChange.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: commons/proper/chain/trunk/apps/cookbook-examples/src/main/java/org/apache/commons/chain2/cookbook/mailreader/commands/LogonUser.java
URL: http://svn.apache.org/viewvc/commons/proper/chain/trunk/apps/cookbook-examples/src/main/java/org/apache/commons/chain2/cookbook/mailreader/commands/LogonUser.java?rev=1327509&view=auto
==============================================================================
--- commons/proper/chain/trunk/apps/cookbook-examples/src/main/java/org/apache/commons/chain2/cookbook/mailreader/commands/LogonUser.java (added)
+++ commons/proper/chain/trunk/apps/cookbook-examples/src/main/java/org/apache/commons/chain2/cookbook/mailreader/commands/LogonUser.java Wed Apr 18 13:41:56 2012
@@ -0,0 +1,38 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You 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.commons.chain2.cookbook.mailreader.commands;
+
+import org.apache.commons.chain2.Command;
+import org.apache.commons.chain2.cookbook.mailreader.MailReader;
+
+import java.io.IOException;
+
+public class LogonUser implements Command<String, Object, MailReader> {
+    public LogonUser() {
+    }
+
+    public boolean execute(MailReader mailReader) {
+        try {
+            mailReader.getLogger().write("LogonUser.execute");
+        }
+        catch (IOException ioe) {
+            throw new RuntimeException(ioe);
+        }
+
+        return CONTINUE_PROCESSING;
+    }
+}

Propchange: commons/proper/chain/trunk/apps/cookbook-examples/src/main/java/org/apache/commons/chain2/cookbook/mailreader/commands/LogonUser.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: commons/proper/chain/trunk/apps/cookbook-examples/src/main/java/org/apache/commons/chain2/cookbook/mailreader/commands/LogonUser.java
------------------------------------------------------------------------------
    svn:keywords = Date Author Id Revision HeadURL

Propchange: commons/proper/chain/trunk/apps/cookbook-examples/src/main/java/org/apache/commons/chain2/cookbook/mailreader/commands/LogonUser.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: commons/proper/chain/trunk/apps/cookbook-examples/src/main/java/org/apache/commons/chain2/cookbook/mailreader/commands/ProfileCheck.java
URL: http://svn.apache.org/viewvc/commons/proper/chain/trunk/apps/cookbook-examples/src/main/java/org/apache/commons/chain2/cookbook/mailreader/commands/ProfileCheck.java?rev=1327509&view=auto
==============================================================================
--- commons/proper/chain/trunk/apps/cookbook-examples/src/main/java/org/apache/commons/chain2/cookbook/mailreader/commands/ProfileCheck.java (added)
+++ commons/proper/chain/trunk/apps/cookbook-examples/src/main/java/org/apache/commons/chain2/cookbook/mailreader/commands/ProfileCheck.java Wed Apr 18 13:41:56 2012
@@ -0,0 +1,38 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You 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.commons.chain2.cookbook.mailreader.commands;
+
+import org.apache.commons.chain2.Command;
+import org.apache.commons.chain2.cookbook.mailreader.MailReader;
+
+import java.io.IOException;
+
+public class ProfileCheck implements Command<String, Object, MailReader> {
+    public ProfileCheck() {
+    }
+
+    public boolean execute(MailReader mailReader) {
+        try {
+            mailReader.getLogger().write("ProfileCheck.execute\n");
+        }
+        catch (IOException ioe) {
+            throw new RuntimeException(ioe);
+        }
+
+        return CONTINUE_PROCESSING;
+    }
+}

Propchange: commons/proper/chain/trunk/apps/cookbook-examples/src/main/java/org/apache/commons/chain2/cookbook/mailreader/commands/ProfileCheck.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: commons/proper/chain/trunk/apps/cookbook-examples/src/main/java/org/apache/commons/chain2/cookbook/mailreader/commands/ProfileCheck.java
------------------------------------------------------------------------------
    svn:keywords = Date Author Id Revision HeadURL

Propchange: commons/proper/chain/trunk/apps/cookbook-examples/src/main/java/org/apache/commons/chain2/cookbook/mailreader/commands/ProfileCheck.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: commons/proper/chain/trunk/apps/cookbook-examples/src/main/java/org/apache/commons/chain2/cookbook/profile/Profile.java
URL: http://svn.apache.org/viewvc/commons/proper/chain/trunk/apps/cookbook-examples/src/main/java/org/apache/commons/chain2/cookbook/profile/Profile.java?rev=1327509&view=auto
==============================================================================
--- commons/proper/chain/trunk/apps/cookbook-examples/src/main/java/org/apache/commons/chain2/cookbook/profile/Profile.java (added)
+++ commons/proper/chain/trunk/apps/cookbook-examples/src/main/java/org/apache/commons/chain2/cookbook/profile/Profile.java Wed Apr 18 13:41:56 2012
@@ -0,0 +1,21 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You 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.commons.chain2.cookbook.profile;
+
+public class Profile {
+    public static String PROFILE_KEY = "profile";
+}

Propchange: commons/proper/chain/trunk/apps/cookbook-examples/src/main/java/org/apache/commons/chain2/cookbook/profile/Profile.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: commons/proper/chain/trunk/apps/cookbook-examples/src/main/java/org/apache/commons/chain2/cookbook/profile/Profile.java
------------------------------------------------------------------------------
    svn:keywords = Date Author Id Revision HeadURL

Propchange: commons/proper/chain/trunk/apps/cookbook-examples/src/main/java/org/apache/commons/chain2/cookbook/profile/Profile.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: commons/proper/chain/trunk/apps/cookbook-examples/src/main/java/org/apache/commons/chain2/cookbook/profile/ProfileCheck.java
URL: http://svn.apache.org/viewvc/commons/proper/chain/trunk/apps/cookbook-examples/src/main/java/org/apache/commons/chain2/cookbook/profile/ProfileCheck.java?rev=1327509&view=auto
==============================================================================
--- commons/proper/chain/trunk/apps/cookbook-examples/src/main/java/org/apache/commons/chain2/cookbook/profile/ProfileCheck.java (added)
+++ commons/proper/chain/trunk/apps/cookbook-examples/src/main/java/org/apache/commons/chain2/cookbook/profile/ProfileCheck.java Wed Apr 18 13:41:56 2012
@@ -0,0 +1,33 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You 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.commons.chain2.cookbook.profile;
+
+import org.apache.commons.chain2.Command;
+
+public class ProfileCheck implements Command<String, Object, ProfileContext> {
+
+    public Profile newProfile(ProfileContext context) { return new Profile(); }
+
+    public boolean execute(ProfileContext context) {
+        Profile profile = context.getProfile();
+
+        if (null == profile) {
+            context.setProfile(newProfile(context));
+        }
+        return false;
+    }
+}
\ No newline at end of file

Propchange: commons/proper/chain/trunk/apps/cookbook-examples/src/main/java/org/apache/commons/chain2/cookbook/profile/ProfileCheck.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: commons/proper/chain/trunk/apps/cookbook-examples/src/main/java/org/apache/commons/chain2/cookbook/profile/ProfileCheck.java
------------------------------------------------------------------------------
    svn:keywords = Date Author Id Revision HeadURL

Propchange: commons/proper/chain/trunk/apps/cookbook-examples/src/main/java/org/apache/commons/chain2/cookbook/profile/ProfileCheck.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: commons/proper/chain/trunk/apps/cookbook-examples/src/main/java/org/apache/commons/chain2/cookbook/profile/ProfileContext.java
URL: http://svn.apache.org/viewvc/commons/proper/chain/trunk/apps/cookbook-examples/src/main/java/org/apache/commons/chain2/cookbook/profile/ProfileContext.java?rev=1327509&view=auto
==============================================================================
--- commons/proper/chain/trunk/apps/cookbook-examples/src/main/java/org/apache/commons/chain2/cookbook/profile/ProfileContext.java (added)
+++ commons/proper/chain/trunk/apps/cookbook-examples/src/main/java/org/apache/commons/chain2/cookbook/profile/ProfileContext.java Wed Apr 18 13:41:56 2012
@@ -0,0 +1,33 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You 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.commons.chain2.cookbook.profile;
+
+import org.apache.commons.chain2.impl.ContextBase;
+
+public class ProfileContext extends ContextBase {
+    private Profile profile;
+
+    public ProfileContext() {}
+
+    public Profile getProfile() {
+        return profile;
+    }
+
+    public void setProfile(Profile profile) {
+        this.profile = profile;
+    }
+}
\ No newline at end of file

Propchange: commons/proper/chain/trunk/apps/cookbook-examples/src/main/java/org/apache/commons/chain2/cookbook/profile/ProfileContext.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: commons/proper/chain/trunk/apps/cookbook-examples/src/main/java/org/apache/commons/chain2/cookbook/profile/ProfileContext.java
------------------------------------------------------------------------------
    svn:keywords = Date Author Id Revision HeadURL

Propchange: commons/proper/chain/trunk/apps/cookbook-examples/src/main/java/org/apache/commons/chain2/cookbook/profile/ProfileContext.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: commons/proper/chain/trunk/apps/cookbook-examples/src/main/resources/chain/catalog.xml
URL: http://svn.apache.org/viewvc/commons/proper/chain/trunk/apps/cookbook-examples/src/main/resources/chain/catalog.xml?rev=1327509&view=auto
==============================================================================
--- commons/proper/chain/trunk/apps/cookbook-examples/src/main/resources/chain/catalog.xml (added)
+++ commons/proper/chain/trunk/apps/cookbook-examples/src/main/resources/chain/catalog.xml Wed Apr 18 13:41:56 2012
@@ -0,0 +1,24 @@
+<?xml version="1.0" ?>
+<!--
+   Licensed to the Apache Software Foundation (ASF) under one or more
+   contributor license agreements.  See the NOTICE file distributed with
+   this work for additional information regarding copyright ownership.
+   The ASF licenses this file to You 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.
+-->
+<catalog>
+  <chain name="LocaleChange">
+    <command className="org.apache.commons.chain2.cookbook.mailreader.commands.ProfileCheck"/>
+    <command className="org.apache.commons.chain2.cookbook.mailreader.commands.LocaleChange"/>
+  </chain>
+  <command name="LogonUser" className="org.apache.commons.chain2.cookbook.mailreader.commands.LogonUser"/>
+</catalog>

Propchange: commons/proper/chain/trunk/apps/cookbook-examples/src/main/resources/chain/catalog.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: commons/proper/chain/trunk/apps/cookbook-examples/src/main/resources/chain/catalog.xml
------------------------------------------------------------------------------
    svn:keywords = Date Revision Author HeadURL Id

Propchange: commons/proper/chain/trunk/apps/cookbook-examples/src/main/resources/chain/catalog.xml
------------------------------------------------------------------------------
    svn:mime-type = text/xml

Added: commons/proper/chain/trunk/apps/cookbook-examples/src/main/webapp/WEB-INF/web.xml
URL: http://svn.apache.org/viewvc/commons/proper/chain/trunk/apps/cookbook-examples/src/main/webapp/WEB-INF/web.xml?rev=1327509&view=auto
==============================================================================
--- commons/proper/chain/trunk/apps/cookbook-examples/src/main/webapp/WEB-INF/web.xml (added)
+++ commons/proper/chain/trunk/apps/cookbook-examples/src/main/webapp/WEB-INF/web.xml Wed Apr 18 13:41:56 2012
@@ -0,0 +1,24 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<web-app version="2.5" xmlns="http://java.sun.com/xml/ns/javaee"
+         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+         xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd">
+    <display-name>Apache Commons Chain Cookbook Examples</display-name>
+    <!-- Commons Chain listener to load catalogs  -->
+    <context-param>
+        <param-name>org.apache.commons.chain2.CONFIG_CLASS_RESOURCE</param-name>
+        <param-value>resources/catalog.xml</param-value>
+    </context-param>
+    <listener>
+        <listener-class>org.apache.commons.chain2.web.ChainListener</listener-class>
+    </listener>
+
+    <servlet>
+        <servlet-name>mailReaderServlet</servlet-name>
+        <servlet-class>org.apache.commons.chain2.cookbook.mailreader.MailReaderServlet</servlet-class>
+    </servlet>
+
+    <servlet-mapping>
+        <servlet-name>mailReaderServlet</servlet-name>
+        <url-pattern>/</url-pattern>
+    </servlet-mapping>
+</web-app>

Propchange: commons/proper/chain/trunk/apps/cookbook-examples/src/main/webapp/WEB-INF/web.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: commons/proper/chain/trunk/apps/cookbook-examples/src/main/webapp/WEB-INF/web.xml
------------------------------------------------------------------------------
    svn:keywords = Date Revision Author HeadURL Id

Propchange: commons/proper/chain/trunk/apps/cookbook-examples/src/main/webapp/WEB-INF/web.xml
------------------------------------------------------------------------------
    svn:mime-type = text/xml

Added: commons/proper/chain/trunk/apps/cookbook-examples/src/test/java/org/apache/commons/chain2/cookbook/agility/ProcessingTest.java
URL: http://svn.apache.org/viewvc/commons/proper/chain/trunk/apps/cookbook-examples/src/test/java/org/apache/commons/chain2/cookbook/agility/ProcessingTest.java?rev=1327509&view=auto
==============================================================================
--- commons/proper/chain/trunk/apps/cookbook-examples/src/test/java/org/apache/commons/chain2/cookbook/agility/ProcessingTest.java (added)
+++ commons/proper/chain/trunk/apps/cookbook-examples/src/test/java/org/apache/commons/chain2/cookbook/agility/ProcessingTest.java Wed Apr 18 13:41:56 2012
@@ -0,0 +1,44 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You 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.commons.chain2.cookbook.agility;
+
+import org.apache.commons.chain2.cookbook.agility.impl.ControllerCatalog;
+import org.apache.commons.chain2.cookbook.agility.impl.HandlerCommand;
+import org.apache.commons.chain2.cookbook.agility.impl.RequestContext;
+import org.junit.Test;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+
+public class ProcessingTest {
+
+    @Test
+    public void testRequestResponseName() {
+        String NAME = "TestProcessing";
+
+        Controller controller = new ControllerCatalog();
+
+        RequestHandler handler = new HandlerCommand(NAME);
+        controller.addHandler(handler);
+        Request request = new RequestContext(NAME);
+        controller.process(request);
+        Response response = request.getResponse();
+
+        assertNotNull(response);
+        assertEquals(NAME, response.getName());
+    }
+}

Propchange: commons/proper/chain/trunk/apps/cookbook-examples/src/test/java/org/apache/commons/chain2/cookbook/agility/ProcessingTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: commons/proper/chain/trunk/apps/cookbook-examples/src/test/java/org/apache/commons/chain2/cookbook/agility/ProcessingTest.java
------------------------------------------------------------------------------
    svn:keywords = Date Author Id Revision HeadURL

Propchange: commons/proper/chain/trunk/apps/cookbook-examples/src/test/java/org/apache/commons/chain2/cookbook/agility/ProcessingTest.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: commons/proper/chain/trunk/apps/cookbook-examples/src/test/java/org/apache/commons/chain2/cookbook/mailreader/CatalogTest.java
URL: http://svn.apache.org/viewvc/commons/proper/chain/trunk/apps/cookbook-examples/src/test/java/org/apache/commons/chain2/cookbook/mailreader/CatalogTest.java?rev=1327509&view=auto
==============================================================================
--- commons/proper/chain/trunk/apps/cookbook-examples/src/test/java/org/apache/commons/chain2/cookbook/mailreader/CatalogTest.java (added)
+++ commons/proper/chain/trunk/apps/cookbook-examples/src/test/java/org/apache/commons/chain2/cookbook/mailreader/CatalogTest.java Wed Apr 18 13:41:56 2012
@@ -0,0 +1,83 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You 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.commons.chain2.cookbook.mailreader;
+
+import org.apache.commons.chain2.Catalog;
+import org.apache.commons.chain2.Command;
+import org.junit.Before;
+import org.junit.Test;
+import org.mockito.Mock;
+import org.mockito.MockitoAnnotations;
+
+import javax.servlet.ServletContext;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpSession;
+import java.util.Locale;
+
+import static org.junit.Assert.assertTrue;
+import static org.mockito.Matchers.anyString;
+import static org.mockito.Mockito.verify;
+import static org.mockito.Mockito.when;
+
+public class CatalogTest {
+
+    @Mock private ServletContext servletContext;
+    @Mock private HttpSession session;
+    @Mock private HttpServletRequest request;
+    @Mock private Catalog<String, Object, MailReader> testCatalog;
+    @Mock private Command<String, Object, MailReader> testCommand;
+    
+    @Before
+    public void setUp() {
+        MockitoAnnotations.initMocks(this);
+
+        when(testCatalog.getCommand(anyString())).thenReturn(testCommand);
+        when(servletContext.getAttribute("catalog")).thenReturn(testCatalog);
+        when(session.getServletContext()).thenReturn(servletContext);
+        when(request.getSession()).thenReturn(session);
+    }
+
+    private boolean executeCatalogCommand(MailReader context,
+            String name, HttpServletRequest request) {
+
+        ServletContext servletContext =
+                request.getSession().getServletContext();
+
+        // Due to limitation with the servlet API we have to do a cast here
+        @SuppressWarnings("unchecked")
+        Catalog<String, Object, MailReader> catalog = 
+                (Catalog<String, Object, MailReader>) servletContext
+                        .getAttribute("catalog");
+        
+        Command<String, Object, MailReader> command = catalog.getCommand(name);
+
+        return command.execute(context);
+    }
+    
+    @Test
+    public void loadCatalogTest() {
+        MailReader context = new MailReader();
+        context.setLocale(Locale.CANADA);
+
+        when(testCommand.execute(context)).thenReturn(true);
+
+        assertTrue("Catalog execution did not complete as expected",
+                executeCatalogCommand(context, "aCommand", request));
+
+        verify(testCommand).execute(context);
+    }
+}

Propchange: commons/proper/chain/trunk/apps/cookbook-examples/src/test/java/org/apache/commons/chain2/cookbook/mailreader/CatalogTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: commons/proper/chain/trunk/apps/cookbook-examples/src/test/java/org/apache/commons/chain2/cookbook/mailreader/CatalogTest.java
------------------------------------------------------------------------------
    svn:keywords = Date Author Id Revision HeadURL

Propchange: commons/proper/chain/trunk/apps/cookbook-examples/src/test/java/org/apache/commons/chain2/cookbook/mailreader/CatalogTest.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: commons/proper/chain/trunk/apps/cookbook-examples/src/test/java/org/apache/commons/chain2/cookbook/mailreader/LocaleValueTest.java
URL: http://svn.apache.org/viewvc/commons/proper/chain/trunk/apps/cookbook-examples/src/test/java/org/apache/commons/chain2/cookbook/mailreader/LocaleValueTest.java?rev=1327509&view=auto
==============================================================================
--- commons/proper/chain/trunk/apps/cookbook-examples/src/test/java/org/apache/commons/chain2/cookbook/mailreader/LocaleValueTest.java (added)
+++ commons/proper/chain/trunk/apps/cookbook-examples/src/test/java/org/apache/commons/chain2/cookbook/mailreader/LocaleValueTest.java Wed Apr 18 13:41:56 2012
@@ -0,0 +1,58 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You 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.commons.chain2.cookbook.mailreader;
+
+import org.junit.Before;
+import org.junit.Test;
+import java.util.Locale;
+import static org.junit.Assert.*;
+
+public class LocaleValueTest {
+
+    MailReader context;
+
+    @Before
+    public void setUp() {
+        context = new MailReader();
+    }
+
+    @Test
+    public void testLocaleSetPropertyGetMap() {
+        Locale expected = Locale.CANADA_FRENCH;
+        context.setLocale(expected);
+        // the retrieve() method is a nice type-safe alternative to get()
+        Locale locale = context.retrieve(MailReader.LOCALE_KEY);
+        assertNotNull(locale);
+        assertEquals(expected, locale);
+    }
+
+    @Test
+    public void testLocalePutMapGetProperty() {
+        Locale expected = Locale.ITALIAN;
+        context.put(MailReader.LOCALE_KEY, expected);
+        Locale locale = context.getLocale();
+        assertNotNull(locale);
+        assertEquals(expected, locale);
+    }
+
+    @Test(expected = UnsupportedOperationException.class)
+    public void testLocaleSetTypedWithStringException() {
+        String localeString = Locale.US.toString();
+        // Expected 'argument type mismatch' error
+        context.put(MailReader.LOCALE_KEY, localeString);
+    }
+}
\ No newline at end of file

Propchange: commons/proper/chain/trunk/apps/cookbook-examples/src/test/java/org/apache/commons/chain2/cookbook/mailreader/LocaleValueTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: commons/proper/chain/trunk/apps/cookbook-examples/src/test/java/org/apache/commons/chain2/cookbook/mailreader/LocaleValueTest.java
------------------------------------------------------------------------------
    svn:keywords = Date Author Id Revision HeadURL

Propchange: commons/proper/chain/trunk/apps/cookbook-examples/src/test/java/org/apache/commons/chain2/cookbook/mailreader/LocaleValueTest.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: commons/proper/chain/trunk/apps/cookbook-examples/src/test/java/org/apache/commons/chain2/cookbook/profile/ProfileCheckTest.java
URL: http://svn.apache.org/viewvc/commons/proper/chain/trunk/apps/cookbook-examples/src/test/java/org/apache/commons/chain2/cookbook/profile/ProfileCheckTest.java?rev=1327509&view=auto
==============================================================================
--- commons/proper/chain/trunk/apps/cookbook-examples/src/test/java/org/apache/commons/chain2/cookbook/profile/ProfileCheckTest.java (added)
+++ commons/proper/chain/trunk/apps/cookbook-examples/src/test/java/org/apache/commons/chain2/cookbook/profile/ProfileCheckTest.java Wed Apr 18 13:41:56 2012
@@ -0,0 +1,36 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You 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.commons.chain2.cookbook.profile;
+
+import org.apache.commons.chain2.Command;
+import org.junit.Test;
+import static org.junit.Assert.assertNotNull;
+
+public class ProfileCheckTest {
+
+    @Test
+    public void testProfileCheckNeed() {
+
+        ProfileContext context = new ProfileContext();
+        Command<String, Object, ProfileContext> command = new ProfileCheck();
+
+        command.execute(context);
+
+        Profile profile = context.getProfile();
+        assertNotNull("Missing org.apache.commons.chain2.cookbook.profile.Profile", profile);
+    }
+}
\ No newline at end of file

Propchange: commons/proper/chain/trunk/apps/cookbook-examples/src/test/java/org/apache/commons/chain2/cookbook/profile/ProfileCheckTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: commons/proper/chain/trunk/apps/cookbook-examples/src/test/java/org/apache/commons/chain2/cookbook/profile/ProfileCheckTest.java
------------------------------------------------------------------------------
    svn:keywords = Date Author Id Revision HeadURL

Propchange: commons/proper/chain/trunk/apps/cookbook-examples/src/test/java/org/apache/commons/chain2/cookbook/profile/ProfileCheckTest.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Propchange: commons/proper/chain/trunk/apps/example1/
------------------------------------------------------------------------------
--- svn:ignore (added)
+++ svn:ignore Wed Apr 18 13:41:56 2012
@@ -0,0 +1 @@
+target

Modified: commons/proper/chain/trunk/apps/example1/pom.xml
URL: http://svn.apache.org/viewvc/commons/proper/chain/trunk/apps/example1/pom.xml?rev=1327509&r1=1327508&r2=1327509&view=diff
==============================================================================
--- commons/proper/chain/trunk/apps/example1/pom.xml (original)
+++ commons/proper/chain/trunk/apps/example1/pom.xml Wed Apr 18 13:41:56 2012
@@ -7,7 +7,7 @@
  * (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
+ *    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,
@@ -19,105 +19,45 @@
  */
 -->
 <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
-         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
-    <modelVersion>4.0.0</modelVersion>
+     xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+  <modelVersion>4.0.0</modelVersion>
 
-    <parent>
-        <groupId>org.apache.commons</groupId>
-        <artifactId>commons-parent</artifactId>
-        <version>10</version>
-    </parent>
-
-    <artifactId>chain-example1</artifactId>
-    <packaging>war</packaging>
-    <version>1.3-SNAPSHOT</version>
-    <name>Chan Example 1 App</name>
+  <parent>
+    <groupId>org.apache.commons</groupId>
+    <artifactId>commons-chain-examples</artifactId>
+    <version>2.0-SNAPSHOT</version>
+    <relativePath>../</relativePath>
+  </parent>
 
-    <dependencies>
+  <artifactId>chain-example1</artifactId>
+  <packaging>war</packaging>
 
+  <name>Apache Commons Chain :: Examples :: Chain Example 1 App</name>
+
+  <dependencies>
     <dependency>
+      <groupId>javax.servlet</groupId>
+      <artifactId>servlet-api</artifactId>
+      <version>2.4</version>
+      <scope>provided</scope>
+    </dependency>
 
-        <groupId>javax.servlet</groupId>
-            <artifactId>servlet-api</artifactId>
-            <version>2.4</version>
-            <scope>provided</scope>
-        </dependency>
-
-        <dependency>
-            <groupId>commons-digester</groupId>
-            <artifactId>commons-digester</artifactId>
-            <version>1.8</version>
-        </dependency>
-
-        <dependency>
-            <groupId>commons-beanutils</groupId>
-            <artifactId>commons-beanutils</artifactId>
-            <version>1.8.2</version>
-        </dependency>
-
-        <dependency>
-            <groupId>commons-chain</groupId>
-            <artifactId>commons-chain</artifactId>
-            <version>1.3-SNAPSHOT</version>
-            <exclusions>
-                <exclusion>
-                    <groupId>javax.portlet</groupId>
-                    <artifactId>portlet-api</artifactId>
-                </exclusion>
-                <exclusion>
-                    <groupId>myfaces</groupId>
-                    <artifactId>myfaces-api</artifactId>
-                </exclusion>
-            </exclusions>
-        </dependency>
-
-        <dependency>
-            <groupId>commons-logging</groupId>
-            <artifactId>commons-logging</artifactId>
-            <version>1.1.1</version>
-        </dependency>
-
-        <dependency>
-            <groupId>log4j</groupId>
-            <artifactId>log4j</artifactId>
-            <version>1.2.12</version>
-        </dependency>
-
-        <dependency>
-            <groupId>javax.servlet</groupId>
-            <artifactId>jstl</artifactId>
-            <version>1.1.2</version>
-        </dependency>
-
-        <dependency>
-            <groupId>taglibs</groupId>
-            <artifactId>standard</artifactId>
-            <version>1.1.2</version>
-        </dependency>
-    </dependencies>
-
-<!--
-    <build>
-        <plugins>
-            <plugin>
-                <artifactId>maven-assembly-plugin</artifactId>
-                <configuration>
-                    <descriptors>
-                        <descriptor>src/main/assembly/dep.xml</descriptor>
-                    </descriptors>
-                </configuration>
-            </plugin>
-            <plugin>
-                <artifactId>maven-surefire-plugin</artifactId>
-                <configuration>
-                    <excludes>
-                        <exclude>**/systest/**</exclude>
-                    </excludes>
-                </configuration>
-            </plugin>
-        </plugins>
-    </build>
--->
+    <dependency>
+      <groupId>org.apache.commons</groupId>
+      <artifactId>commons-chain2</artifactId>
+      <version>${project.version}</version>
+    </dependency>
 
+    <dependency>
+      <groupId>org.apache.commons</groupId>
+      <artifactId>commons-chain2-web</artifactId>
+      <version>${project.version}</version>
+    </dependency>
+
+    <dependency>
+      <groupId>commons-logging</groupId>
+      <artifactId>commons-logging</artifactId>
+    </dependency>
+  </dependencies>
 
 </project>

Modified: commons/proper/chain/trunk/apps/example1/src/main/java/org/apache/commons/chain2/apps/example/CountCommand.java
URL: http://svn.apache.org/viewvc/commons/proper/chain/trunk/apps/example1/src/main/java/org/apache/commons/chain2/apps/example/CountCommand.java?rev=1327509&r1=1295180&r2=1327509&view=diff
==============================================================================
--- commons/proper/chain/trunk/apps/example1/src/main/java/org/apache/commons/chain2/apps/example/CountCommand.java (original)
+++ commons/proper/chain/trunk/apps/example1/src/main/java/org/apache/commons/chain2/apps/example/CountCommand.java Wed Apr 18 13:41:56 2012
@@ -30,7 +30,7 @@ import org.apache.commons.logging.LogFac
  * @version $Revision$ $Date$
  */
 
-public class CountCommand implements Command {
+public class CountCommand implements Command<String, Object, WebContext> {
 
 
     private Log log = LogFactory.getLog(CountCommand.class);
@@ -67,13 +67,12 @@ public class CountCommand implements Com
      * @return <code>false</code> so that processng will continue
      * @throws Exception If an error occurs during execution.
      */
-    public boolean execute(Context context) throws Exception {
+    public boolean execute(WebContext context) {
 
         count++;
         log.info("Executing: " + attribute + "=" + count);
 
-        WebContext webContext = (WebContext)context;
-        webContext.getSessionScope().put(attribute, new Integer(count));
+        context.getSessionScope().put(attribute, new Integer(count));
 
         return false;