commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Simone Tripodi <simonetrip...@apache.org>
Subject Re: svn commit: r1499551 - in /commons/proper/chain/trunk: api/src/main/java/org/apache/commons/chain2/ apps/cookbook-examples/src/main/java/org/apache/commons/chain2/cookbook/agility/impl/ apps/cookbook-examples/src/main/java/org/apache/commons/chain2/coo...
Date Thu, 04 Jul 2013 13:06:26 GMT
nice! thanks for reviewing! :)

http://people.apache.org/~simonetripodi/
http://twitter.com/simonetripodi


On Wed, Jul 3, 2013 at 10:45 PM,  <britter@apache.org> wrote:
> Author: britter
> Date: Wed Jul  3 20:45:37 2013
> New Revision: 1499551
>
> URL: http://svn.apache.org/r1499551
> Log:
> CHAIN-98 - Refactor command interface and base Implementations to enumeration to represent states. Patch provided by Jonas Sprenger
>
> Added:
>     commons/proper/chain/trunk/api/src/main/java/org/apache/commons/chain2/Processing.java   (with props)
>     commons/proper/chain/trunk/test-utils/src/main/java/org/apache/commons/chain2/testutils/NullReturningCommand.java   (with props)
> Modified:
>     commons/proper/chain/trunk/api/src/main/java/org/apache/commons/chain2/Chain.java
>     commons/proper/chain/trunk/api/src/main/java/org/apache/commons/chain2/ChainExecutor.java
>     commons/proper/chain/trunk/api/src/main/java/org/apache/commons/chain2/Chains.java
>     commons/proper/chain/trunk/api/src/main/java/org/apache/commons/chain2/Command.java
>     commons/proper/chain/trunk/api/src/main/java/org/apache/commons/chain2/Filter.java
>     commons/proper/chain/trunk/apps/cookbook-examples/src/main/java/org/apache/commons/chain2/cookbook/agility/impl/HandlerCommand.java
>     commons/proper/chain/trunk/apps/cookbook-examples/src/main/java/org/apache/commons/chain2/cookbook/mailreader/commands/LocaleChange.java
>     commons/proper/chain/trunk/apps/cookbook-examples/src/main/java/org/apache/commons/chain2/cookbook/mailreader/commands/LogonUser.java
>     commons/proper/chain/trunk/apps/cookbook-examples/src/main/java/org/apache/commons/chain2/cookbook/mailreader/commands/ProfileCheck.java
>     commons/proper/chain/trunk/apps/cookbook-examples/src/main/java/org/apache/commons/chain2/cookbook/profile/ProfileCheck.java
>     commons/proper/chain/trunk/apps/cookbook-examples/src/test/java/org/apache/commons/chain2/cookbook/mailreader/CatalogTest.java
>     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/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/ForwardCommand.java
>     commons/proper/chain/trunk/base/src/main/java/org/apache/commons/chain2/base/CopyCommand.java
>     commons/proper/chain/trunk/base/src/main/java/org/apache/commons/chain2/base/DispatchCommand.java
>     commons/proper/chain/trunk/base/src/main/java/org/apache/commons/chain2/base/DispatchLookupCommand.java
>     commons/proper/chain/trunk/base/src/main/java/org/apache/commons/chain2/base/LookupCommand.java
>     commons/proper/chain/trunk/base/src/main/java/org/apache/commons/chain2/base/OverrideCommand.java
>     commons/proper/chain/trunk/base/src/main/java/org/apache/commons/chain2/base/RemoveCommand.java
>     commons/proper/chain/trunk/base/src/main/java/org/apache/commons/chain2/impl/ChainBase.java
>     commons/proper/chain/trunk/base/src/test/java/org/apache/commons/chain2/base/CopyCommandTestCase.java
>     commons/proper/chain/trunk/base/src/test/java/org/apache/commons/chain2/base/DispatchCommandTestCase.java
>     commons/proper/chain/trunk/base/src/test/java/org/apache/commons/chain2/base/DispatchLookupCommandTestCase.java
>     commons/proper/chain/trunk/base/src/test/java/org/apache/commons/chain2/base/LookupCommandTestCase.java
>     commons/proper/chain/trunk/base/src/test/java/org/apache/commons/chain2/impl/ChainBaseTestCase.java
>     commons/proper/chain/trunk/configuration/xml/src/test/java/org/apache/commons/chain2/config/xml/TestCommand.java
>     commons/proper/chain/trunk/configuration/xml/src/test/java/org/apache/commons/chain2/config/xml/XmlConfigParserTestCase.java
>     commons/proper/chain/trunk/test-utils/src/main/java/org/apache/commons/chain2/testutils/DelegatingCommand.java
>     commons/proper/chain/trunk/test-utils/src/main/java/org/apache/commons/chain2/testutils/DelegatingFilter.java
>     commons/proper/chain/trunk/test-utils/src/main/java/org/apache/commons/chain2/testutils/NonDelegatingCommand.java
>     commons/proper/chain/trunk/test-utils/src/main/java/org/apache/commons/chain2/testutils/NonDelegatingFilter.java
>     commons/proper/chain/trunk/test-utils/src/test/java/org/apache/commons/chain2/testutils/NonDelegatingCommandTestCase.java
>     commons/proper/chain/trunk/web/src/main/java/org/apache/commons/chain2/web/AbstractGetLocaleCommand.java
>     commons/proper/chain/trunk/web/src/main/java/org/apache/commons/chain2/web/AbstractSetLocaleCommand.java
>     commons/proper/chain/trunk/web/src/test/java/org/apache/commons/chain2/web/portlet/PortletGetLocaleCommandTestCase.java
>     commons/proper/chain/trunk/web/src/test/java/org/apache/commons/chain2/web/servlet/ServletGetLocaleCommandTestCase.java
>     commons/proper/chain/trunk/web/src/test/java/org/apache/commons/chain2/web/servlet/ServletSetLocaleCommandTestCase.java
>
> Modified: commons/proper/chain/trunk/api/src/main/java/org/apache/commons/chain2/Chain.java
> URL: http://svn.apache.org/viewvc/commons/proper/chain/trunk/api/src/main/java/org/apache/commons/chain2/Chain.java?rev=1499551&r1=1499550&r2=1499551&view=diff
> ==============================================================================
> --- commons/proper/chain/trunk/api/src/main/java/org/apache/commons/chain2/Chain.java (original)
> +++ commons/proper/chain/trunk/api/src/main/java/org/apache/commons/chain2/Chain.java Wed Jul  3 20:45:37 2013
> @@ -22,7 +22,7 @@ import java.util.Map;
>   * <p>A {@link Chain} represents a configured list of
>   * {@link Command}s that will be executed in order to perform processing
>   * on a specified {@link Context}.  Each included {@link Command} will be
> - * executed in turn, until either one of them returns <code>true</code>,
> + * executed in turn, until either one of them returns <code>FINISHED</code>,
>   * one of the executed {@link Command}s throws an exception,
>   * or the end of the chain has been reached.  The {@link Chain} itself will
>   * return the return value of the last {@link Command} that was executed
> @@ -78,12 +78,12 @@ public interface Chain<K, V, C extends M
>       * to the following algorithm.</p>
>       * <ul>
>       * <li>If there are no configured {@link Command}s in the {@link Chain},
> -     *     return <code>false</code>.</li>
> +     *     return <code>CONTINUE</code>.</li>
>       * <li>Call the <code>execute()</code> method of each {@link Command}
>       *     configured on this chain, in the order they were added via calls
>       *     to the <code>addCommand()</code> method, until the end of the
>       *     configured {@link Command}s is encountered, or until one of
> -     *     the executed {@link Command}s returns <code>true</code>
> +     *     the executed {@link Command}s returns <code>FINISHED</code>
>       *     or throws an exception.</li>
>       * <li>Walk backwards through the {@link Command}s whose
>       *     <code>execute()</code> methods, starting with the last one that
> @@ -94,10 +94,10 @@ public interface Chain<K, V, C extends M
>       *     was called threw an exception, rethrow that exception.</li>
>       * <li>Otherwise, return the value returned by the <code>execute()</code>
>       *     method of the last {@link Command} that was executed.  This will be
> -     *     <code>true</code> if the last {@link Command} indicated that
> +     *     <code>FINISHED</code> if the last {@link Command} indicated that
>       *     processing of this {@link Context} has been completed, or
> -     *     <code>false</code> if none of the called {@link Command}s
> -     *     returned <code>true</code>.</li>
> +     *     <code>CONTINUE</code> if none of the called {@link Command}s
> +     *     returned <code>FINISHED</code>.</li>
>       * </ul>
>       *
>       * @param context The {@link Context} to be processed by this
> @@ -106,11 +106,11 @@ public interface Chain<K, V, C extends M
>       * @exception IllegalArgumentException if <code>context</code>
>       *  is <code>null</code>
>       *
> -     * @return <code>true</code> if the processing of this {@link Context}
> -     *  has been completed, or <code>false</code> if the processing
> -     *  of this {@link Context} should be delegated to a subsequent
> -     *  {@link Command} in an enclosing {@link Chain}
> +     * @return {@link Processing#FINISHED} if the processing of this context
> +     *  has been completed. Returns {@link Processing#CONTINUE} if the processing
> +     *  of this context should be delegated to a subsequent command in an
> +     *  enclosing chain.
>       */
> -    boolean execute(C context);
> +    Processing execute(C context);
>
>  }
>
> Modified: commons/proper/chain/trunk/api/src/main/java/org/apache/commons/chain2/ChainExecutor.java
> URL: http://svn.apache.org/viewvc/commons/proper/chain/trunk/api/src/main/java/org/apache/commons/chain2/ChainExecutor.java?rev=1499551&r1=1499550&r2=1499551&view=diff
> ==============================================================================
> --- commons/proper/chain/trunk/api/src/main/java/org/apache/commons/chain2/ChainExecutor.java (original)
> +++ commons/proper/chain/trunk/api/src/main/java/org/apache/commons/chain2/ChainExecutor.java Wed Jul  3 20:45:37 2013
> @@ -18,6 +18,8 @@ package org.apache.commons.chain2;
>
>  import java.util.Map;
>
> +import org.apache.commons.chain2.Processing;
> +
>  /**
>   * Builder that allows continue adding a command in the target chain and execute it.
>   *
> @@ -33,10 +35,13 @@ public interface ChainExecutor<K, V, C e
>       * Execute the processing represented by the target chain.
>       *
>       * @param context the context processed by the target chain
> -     * @return true, if the processing of the target chain has been completed,
> -     *         false otherwise
> +     * @return {@link Processing#FINISHED} if the processing of this context
> +     *  has been completed. Returns {@link Processing#CONTINUE} if the processing
> +     *  of this context should be delegated to a subsequent command in an
> +     *  enclosing chain.
> +     *
>       * @see Chain#execute(Map)
>       */
> -    boolean execute(C context);
> +    Processing execute(C context);
>
>  }
>
> Modified: commons/proper/chain/trunk/api/src/main/java/org/apache/commons/chain2/Chains.java
> URL: http://svn.apache.org/viewvc/commons/proper/chain/trunk/api/src/main/java/org/apache/commons/chain2/Chains.java?rev=1499551&r1=1499550&r2=1499551&view=diff
> ==============================================================================
> --- commons/proper/chain/trunk/api/src/main/java/org/apache/commons/chain2/Chains.java (original)
> +++ commons/proper/chain/trunk/api/src/main/java/org/apache/commons/chain2/Chains.java Wed Jul  3 20:45:37 2013
> @@ -91,7 +91,7 @@ public final class Chains {
>              return this;
>          }
>
> -        public boolean execute(C context) {
> +        public Processing execute(C context) {
>              return chain.execute(checkNotNullArgument(context, "Chain cannot be applied to a null context."));
>          }
>
>
> Modified: commons/proper/chain/trunk/api/src/main/java/org/apache/commons/chain2/Command.java
> URL: http://svn.apache.org/viewvc/commons/proper/chain/trunk/api/src/main/java/org/apache/commons/chain2/Command.java?rev=1499551&r1=1499550&r2=1499551&view=diff
> ==============================================================================
> --- commons/proper/chain/trunk/api/src/main/java/org/apache/commons/chain2/Command.java (original)
> +++ commons/proper/chain/trunk/api/src/main/java/org/apache/commons/chain2/Command.java Wed Jul  3 20:45:37 2013
> @@ -18,6 +18,8 @@ package org.apache.commons.chain2;
>
>  import java.util.Map;
>
> +import org.apache.commons.chain2.Processing;
> +
>  /**
>   * <p>A {@link Command} encapsulates a unit of processing work to be
>   * performed, whose purpose is to examine and/or modify the state of a
> @@ -83,29 +85,11 @@ import java.util.Map;
>  public interface Command<K, V, C extends Map<K, V>> {
>
>      /**
> -     * <p>Commands should return <code>CONTINUE_PROCESSING</code> if the processing
> -     *  of the given {@link Context} should be delegated to a subsequent
> -     *  {@link Command} in an enclosing {@link Chain}.</p>
> -     *
> -     * @since Chain 1.1
> -     */
> -    public static final boolean CONTINUE_PROCESSING = false;
> -
> -    /**
> -     * <p>Commands should return <code>PROCESSING_COMPLETE</code>
> -     * if the processing of the given {@link Context}
> -     *  has been completed.</p>
> -     *
> -     * @since Chain 1.1
> -     */
> -    public static final boolean PROCESSING_COMPLETE = true;
> -
> -    /**
> -     * <p>Execute a unit of processing work to be performed.  This
> -     * {@link Command} may either complete the required processing
> -     * and return <code>true</code>, or delegate remaining processing
> -     * to the next {@link Command} in a {@link Chain} containing this
> -     * {@link Command} by returning <code>false</code>
> +     * Execute a unit of processing work to be performed.
> +     * <p>
> +     * A command may either complete the required processing and return
> +     * finished, or delegate remaining processing to the subsequent command
> +     * in the enclosing {@link Chain} by returning continue.
>       *
>       * @param context The {@link Context} to be processed by this
>       *  {@link Command}
> @@ -115,11 +99,11 @@ public interface Command<K, V, C extends
>       * @exception IllegalArgumentException if <code>context</code>
>       *  is <code>null</code>
>       *
> -     * @return <code>true</code> if the processing of this {@link Context}
> -     *  has been completed, or <code>false</code> if the processing
> -     *  of this {@link Context} should be delegated to a subsequent
> -     *  {@link Command} in an enclosing {@link Chain}
> +     * @return {@link Processing#FINISHED} if the processing of this contex
> +     *  has been completed. Returns {@link Processing#CONTINUE} if the processing
> +     *  of this context should be delegated to a subsequent command in an
> +     *  enclosing chain.
>       */
> -    boolean execute(C context);
> +    Processing execute(C context);
>
>  }
>
> Modified: commons/proper/chain/trunk/api/src/main/java/org/apache/commons/chain2/Filter.java
> URL: http://svn.apache.org/viewvc/commons/proper/chain/trunk/api/src/main/java/org/apache/commons/chain2/Filter.java?rev=1499551&r1=1499550&r2=1499551&view=diff
> ==============================================================================
> --- commons/proper/chain/trunk/api/src/main/java/org/apache/commons/chain2/Filter.java (original)
> +++ commons/proper/chain/trunk/api/src/main/java/org/apache/commons/chain2/Filter.java Wed Jul  3 20:45:37 2013
> @@ -34,7 +34,7 @@ import java.util.Map;
>   * {@link Command}, is where potentially expensive resources must be acquired
>   * and held until the processing of a particular request has been completed,
>   * even if execution is delegated to a subsequent {@link Command} via the
> - * <code>execute()</code> returning <code>false</code>.  A {@link Filter}
> + * <code>execute()</code> returning <code>CONTINUE</code>.  A {@link Filter}
>   * can reliably release such resources in the <code>postprocess()</code>
>   * method, which is guaranteed to be called by the owning {@link Chain}.</p>
>   *
> @@ -61,8 +61,8 @@ public interface Filter<K, V, C extends
>       *  is <code>null</code>
>       *
>       * @return If a non-null <code>exception</code> was "handled" by this
> -     *  method (and therefore need not be rethrown), return <code>true</code>;
> -     *  otherwise return <code>false</code>
> +     *  method (and therefore need not be rethrown), return <code>FINISHED</code>;
> +     *  otherwise return <code>CONTINUE</code>
>       */
>     boolean postprocess(C context, Exception exception);
>
>
> Added: commons/proper/chain/trunk/api/src/main/java/org/apache/commons/chain2/Processing.java
> URL: http://svn.apache.org/viewvc/commons/proper/chain/trunk/api/src/main/java/org/apache/commons/chain2/Processing.java?rev=1499551&view=auto
> ==============================================================================
> --- commons/proper/chain/trunk/api/src/main/java/org/apache/commons/chain2/Processing.java (added)
> +++ commons/proper/chain/trunk/api/src/main/java/org/apache/commons/chain2/Processing.java Wed Jul  3 20:45:37 2013
> @@ -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;
> +
> +/**
> + * A <code>Processing</code> encapsulates states that can be returned by
> + * commands.
> + * <p>
> + * {@link Command}s should either return <code>FINISHED</code> if the
> + * processing of the given context has been completed, or return
> + * <code>CONTINUE</code> if the processing of the given {@link Context} should
> + * be delegated to a subsequent command in an enclosing {@link Chain}.
> + *
> + * @version $Id $
> + */
> +public enum Processing {
> +
> +    /**
> +     * Commands should return continue if the processing of the given
> +     * context should be delegated to a subsequent command in an enclosing chain.
> +     *
> +     * @since Chain 2.0
> +     */
> +    CONTINUE,
> +
> +    /**
> +     * Commands should return finished if the processing of the given context
> +     * has been completed.
> +     *
> +     * @since Chain 2.0
> +     */
> +    FINISHED;
> +
> +}
>
> Propchange: commons/proper/chain/trunk/api/src/main/java/org/apache/commons/chain2/Processing.java
> ------------------------------------------------------------------------------
>     svn:eol-style = native
>
> Propchange: commons/proper/chain/trunk/api/src/main/java/org/apache/commons/chain2/Processing.java
> ------------------------------------------------------------------------------
>     svn:keywords = Date Author Id Revision HeadURL
>
> Modified: 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=1499551&r1=1499550&r2=1499551&view=diff
> ==============================================================================
> --- commons/proper/chain/trunk/apps/cookbook-examples/src/main/java/org/apache/commons/chain2/cookbook/agility/impl/HandlerCommand.java (original)
> +++ commons/proper/chain/trunk/apps/cookbook-examples/src/main/java/org/apache/commons/chain2/cookbook/agility/impl/HandlerCommand.java Wed Jul  3 20:45:37 2013
> @@ -17,6 +17,7 @@
>  package org.apache.commons.chain2.cookbook.agility.impl;
>
>  import org.apache.commons.chain2.Command;
> +import org.apache.commons.chain2.Processing;
>  import org.apache.commons.chain2.cookbook.agility.ProcessException;
>  import org.apache.commons.chain2.cookbook.agility.Request;
>  import org.apache.commons.chain2.cookbook.agility.RequestHandler;
> @@ -48,10 +49,10 @@ public class HandlerCommand implements C
>          }
>      }
>
> -    public boolean execute(RequestContext requestContext) {
> +    public Processing execute(RequestContext requestContext) {
>          handle(requestContext);
>
> -        return CONTINUE_PROCESSING;
> +        return Processing.CONTINUE;
>      }
>
>  }
>
> Modified: 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=1499551&r1=1499550&r2=1499551&view=diff
> ==============================================================================
> --- commons/proper/chain/trunk/apps/cookbook-examples/src/main/java/org/apache/commons/chain2/cookbook/mailreader/commands/LocaleChange.java (original)
> +++ commons/proper/chain/trunk/apps/cookbook-examples/src/main/java/org/apache/commons/chain2/cookbook/mailreader/commands/LocaleChange.java Wed Jul  3 20:45:37 2013
> @@ -17,6 +17,7 @@
>  package org.apache.commons.chain2.cookbook.mailreader.commands;
>
>  import org.apache.commons.chain2.Command;
> +import org.apache.commons.chain2.Processing;
>  import org.apache.commons.chain2.cookbook.mailreader.MailReader;
>
>  import java.io.IOException;
> @@ -30,7 +31,7 @@ public class LocaleChange implements Com
>      public LocaleChange() {
>      }
>
> -    public boolean execute(MailReader mailReader) {
> +    public Processing execute(MailReader mailReader) {
>          try {
>              Writer logger = mailReader.getLogger();
>              logger.write("LocaleChange.execute ");
> @@ -39,7 +40,7 @@ public class LocaleChange implements Com
>              throw new RuntimeException(ioe);
>          }
>
> -        return CONTINUE_PROCESSING;
> +        return Processing.CONTINUE;
>      }
>
>  }
>
> Modified: 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=1499551&r1=1499550&r2=1499551&view=diff
> ==============================================================================
> --- commons/proper/chain/trunk/apps/cookbook-examples/src/main/java/org/apache/commons/chain2/cookbook/mailreader/commands/LogonUser.java (original)
> +++ commons/proper/chain/trunk/apps/cookbook-examples/src/main/java/org/apache/commons/chain2/cookbook/mailreader/commands/LogonUser.java Wed Jul  3 20:45:37 2013
> @@ -17,6 +17,7 @@
>  package org.apache.commons.chain2.cookbook.mailreader.commands;
>
>  import org.apache.commons.chain2.Command;
> +import org.apache.commons.chain2.Processing;
>  import org.apache.commons.chain2.cookbook.mailreader.MailReader;
>
>  import java.io.IOException;
> @@ -29,14 +30,14 @@ public class LogonUser implements Comman
>      public LogonUser() {
>      }
>
> -    public boolean execute(MailReader mailReader) {
> +    public Processing execute(MailReader mailReader) {
>          try {
>              mailReader.getLogger().write("LogonUser.execute");
>          } catch (IOException ioe) {
>              throw new RuntimeException(ioe);
>          }
>
> -        return CONTINUE_PROCESSING;
> +        return Processing.CONTINUE;
>      }
>
>  }
>
> Modified: 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=1499551&r1=1499550&r2=1499551&view=diff
> ==============================================================================
> --- commons/proper/chain/trunk/apps/cookbook-examples/src/main/java/org/apache/commons/chain2/cookbook/mailreader/commands/ProfileCheck.java (original)
> +++ commons/proper/chain/trunk/apps/cookbook-examples/src/main/java/org/apache/commons/chain2/cookbook/mailreader/commands/ProfileCheck.java Wed Jul  3 20:45:37 2013
> @@ -17,6 +17,7 @@
>  package org.apache.commons.chain2.cookbook.mailreader.commands;
>
>  import org.apache.commons.chain2.Command;
> +import org.apache.commons.chain2.Processing;
>  import org.apache.commons.chain2.cookbook.mailreader.MailReader;
>
>  import java.io.IOException;
> @@ -29,14 +30,14 @@ public class ProfileCheck implements Com
>      public ProfileCheck() {
>      }
>
> -    public boolean execute(MailReader mailReader) {
> +    public Processing execute(MailReader mailReader) {
>          try {
>              mailReader.getLogger().write("ProfileCheck.execute\n");
>          } catch (IOException ioe) {
>              throw new RuntimeException(ioe);
>          }
>
> -        return CONTINUE_PROCESSING;
> +        return Processing.CONTINUE;
>      }
>
>  }
>
> Modified: 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=1499551&r1=1499550&r2=1499551&view=diff
> ==============================================================================
> --- commons/proper/chain/trunk/apps/cookbook-examples/src/main/java/org/apache/commons/chain2/cookbook/profile/ProfileCheck.java (original)
> +++ commons/proper/chain/trunk/apps/cookbook-examples/src/main/java/org/apache/commons/chain2/cookbook/profile/ProfileCheck.java Wed Jul  3 20:45:37 2013
> @@ -17,6 +17,7 @@
>  package org.apache.commons.chain2.cookbook.profile;
>
>  import org.apache.commons.chain2.Command;
> +import org.apache.commons.chain2.Processing;
>
>  /**
>   * @version $Id$
> @@ -25,13 +26,13 @@ public class ProfileCheck implements Com
>
>      public Profile newProfile(ProfileContext context) { return new Profile(); }
>
> -    public boolean execute(ProfileContext context) {
> +    public Processing execute(ProfileContext context) {
>          Profile profile = context.getProfile();
>
>          if (null == profile) {
>              context.setProfile(newProfile(context));
>          }
> -        return false;
> +        return Processing.CONTINUE;
>      }
>
>  }
>
> Modified: 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=1499551&r1=1499550&r2=1499551&view=diff
> ==============================================================================
> --- commons/proper/chain/trunk/apps/cookbook-examples/src/test/java/org/apache/commons/chain2/cookbook/mailreader/CatalogTest.java (original)
> +++ commons/proper/chain/trunk/apps/cookbook-examples/src/test/java/org/apache/commons/chain2/cookbook/mailreader/CatalogTest.java Wed Jul  3 20:45:37 2013
> @@ -18,6 +18,7 @@ package org.apache.commons.chain2.cookbo
>
>  import org.apache.commons.chain2.Catalog;
>  import org.apache.commons.chain2.Command;
> +import org.apache.commons.chain2.Processing;
>  import org.junit.Before;
>  import org.junit.Test;
>  import org.mockito.Mock;
> @@ -28,6 +29,7 @@ import javax.servlet.http.HttpServletReq
>  import javax.servlet.http.HttpSession;
>  import java.util.Locale;
>
> +import static org.junit.Assert.assertEquals;
>  import static org.junit.Assert.assertTrue;
>  import static org.mockito.Matchers.anyString;
>  import static org.mockito.Mockito.verify;
> @@ -51,8 +53,8 @@ public class CatalogTest {
>          when(request.getSession()).thenReturn(session);
>      }
>
> -    private boolean executeCatalogCommand(MailReader context,
> -            String name, HttpServletRequest request) {
> +    private Processing executeCatalogCommand(MailReader context,
> +                                             String name, HttpServletRequest request) {
>
>          ServletContext servletContext =
>                  request.getSession().getServletContext();
> @@ -73,9 +75,9 @@ public class CatalogTest {
>          MailReader context = new MailReader();
>          context.setLocale(Locale.CANADA);
>
> -        when(testCommand.execute(context)).thenReturn(true);
> +        when(testCommand.execute(context)).thenReturn(Processing.FINISHED);
>
> -        assertTrue("Catalog execution did not complete as expected",
> +        assertEquals("Catalog execution did not complete as expected", Processing.FINISHED,
>                  executeCatalogCommand(context, "aCommand", request));
>
>          verify(testCommand).execute(context);
>
> 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=1499551&r1=1499550&r2=1499551&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 Jul  3 20:45:37 2013
> @@ -18,6 +18,7 @@ package org.apache.commons.chain2.apps.e
>
>  import org.apache.commons.chain2.Command;
>  import org.apache.commons.chain2.Context;
> +import org.apache.commons.chain2.Processing;
>  import org.apache.commons.chain2.web.WebContext;
>  import org.apache.commons.logging.Log;
>  import org.apache.commons.logging.LogFactory;
> @@ -58,15 +59,15 @@ public class CountCommand implements Com
>       * <p>Execute the command.</p>
>       *
>       * @param context The {@link Context} we are operating on
> -     * @return <code>false</code> so that processng will continue
> +     * @return {@link Processing#CONTINUE} so that processing will continue.
>       */
> -    public boolean execute(WebContext<String, Object> context) {
> +    public Processing execute(WebContext<String, Object> context) {
>          count++;
>          log.info("Executing: " + attribute + "=" + count);
>
>          context.getSessionScope().put(attribute, new Integer(count));
>
> -        return false;
> +        return Processing.CONTINUE;
>      }
>
>  }
>
> Modified: commons/proper/chain/trunk/apps/example1/src/main/java/org/apache/commons/chain2/apps/example/ForwardCommand.java
> URL: http://svn.apache.org/viewvc/commons/proper/chain/trunk/apps/example1/src/main/java/org/apache/commons/chain2/apps/example/ForwardCommand.java?rev=1499551&r1=1499550&r2=1499551&view=diff
> ==============================================================================
> --- commons/proper/chain/trunk/apps/example1/src/main/java/org/apache/commons/chain2/apps/example/ForwardCommand.java (original)
> +++ commons/proper/chain/trunk/apps/example1/src/main/java/org/apache/commons/chain2/apps/example/ForwardCommand.java Wed Jul  3 20:45:37 2013
> @@ -18,6 +18,7 @@ package org.apache.commons.chain2.apps.e
>
>  import org.apache.commons.chain2.Command;
>  import org.apache.commons.chain2.Context;
> +import org.apache.commons.chain2.Processing;
>  import org.apache.commons.chain2.web.servlet.ServletWebContext;
>  import org.apache.commons.logging.Log;
>  import org.apache.commons.logging.LogFactory;
> @@ -59,9 +60,9 @@ public class ForwardCommand implements C
>       * <p>Execute the command.</p>
>       *
>       * @param context The {@link Context} we are operating on
> -     * @return <code>false</code> so that processng will continue
> +     * @return {@link Processing#CONTINUE} so that processing will continue.
>       */
> -    public boolean execute(ServletWebContext<String, Object> context) {
> +    public Processing execute(ServletWebContext<String, Object> context) {
>          try {
>              String uri = getForward(context);
>              if (uri != null) {
> @@ -70,12 +71,12 @@ public class ForwardCommand implements C
>                  }
>                  RequestDispatcher rd = context.getContext().getRequestDispatcher(uri);
>                  rd.forward(context.getRequest(), context.getResponse());
> -                return true;
> +                return Processing.FINISHED;
>              } else {
>                  if (log.isDebugEnabled()) {
>                      log.debug("No forward found");
>                  }
> -                return false;
> +                return Processing.CONTINUE;
>              }
>          } catch (ServletException e) {
>              throw new RuntimeException(e);
>
> Modified: commons/proper/chain/trunk/apps/example2/src/main/java/org/apache/commons/chain2/apps/example/CountCommand.java
> URL: http://svn.apache.org/viewvc/commons/proper/chain/trunk/apps/example2/src/main/java/org/apache/commons/chain2/apps/example/CountCommand.java?rev=1499551&r1=1499550&r2=1499551&view=diff
> ==============================================================================
> --- commons/proper/chain/trunk/apps/example2/src/main/java/org/apache/commons/chain2/apps/example/CountCommand.java (original)
> +++ commons/proper/chain/trunk/apps/example2/src/main/java/org/apache/commons/chain2/apps/example/CountCommand.java Wed Jul  3 20:45:37 2013
> @@ -18,6 +18,7 @@ package org.apache.commons.chain2.apps.e
>
>  import org.apache.commons.chain2.Command;
>  import org.apache.commons.chain2.Context;
> +import org.apache.commons.chain2.Processing;
>  import org.apache.commons.chain2.web.WebContext;
>  import org.apache.commons.logging.Log;
>  import org.apache.commons.logging.LogFactory;
> @@ -57,16 +58,17 @@ public class CountCommand implements Com
>      /**
>       * <p>Execute the command.</p>
>       *
> -     * @param context The {@link Context} we are operating on
> -     * @return <code>false</code> so that processng will continue
> +     *
> +     * @param context The {@link org.apache.commons.chain2.Context} we are operating on
> +     * @return {@link Processing#CONTINUE} so that processing will continue.
>       */
> -    public boolean execute(WebContext<String, Object> context) {
> +    public Processing execute(WebContext<String, Object> context) {
>          count++;
>          log.info("Executing: " + attribute + "=" + count);
>
>          context.getSessionScope().put(attribute, new Integer(count));
>
> -        return false;
> +        return Processing.CONTINUE;
>      }
>
>  }
>
> Modified: commons/proper/chain/trunk/apps/example2/src/main/java/org/apache/commons/chain2/apps/example/ForwardCommand.java
> URL: http://svn.apache.org/viewvc/commons/proper/chain/trunk/apps/example2/src/main/java/org/apache/commons/chain2/apps/example/ForwardCommand.java?rev=1499551&r1=1499550&r2=1499551&view=diff
> ==============================================================================
> --- commons/proper/chain/trunk/apps/example2/src/main/java/org/apache/commons/chain2/apps/example/ForwardCommand.java (original)
> +++ commons/proper/chain/trunk/apps/example2/src/main/java/org/apache/commons/chain2/apps/example/ForwardCommand.java Wed Jul  3 20:45:37 2013
> @@ -18,6 +18,7 @@ package org.apache.commons.chain2.apps.e
>
>  import org.apache.commons.chain2.Command;
>  import org.apache.commons.chain2.Context;
> +import org.apache.commons.chain2.Processing;
>  import org.apache.commons.chain2.web.servlet.ServletWebContext;
>  import org.apache.commons.logging.Log;
>  import org.apache.commons.logging.LogFactory;
> @@ -57,10 +58,11 @@ public class ForwardCommand implements C
>      /**
>       * <p>Execute the command.</p>
>       *
> -     * @param context The {@link Context} we are operating on
> -     * @return <code>false</code> so that processng will continue
> +     *
> +     * @param context The {@link org.apache.commons.chain2.Context} we are operating on
> +     * @return {@link Processing#CONTINUE} so that processnig will continue.
>       */
> -    public boolean execute(ServletWebContext<String, Object> context) {
> +    public Processing execute(ServletWebContext<String, Object> context) {
>          try {
>              String uri = getForward(context);
>              if (uri != null) {
> @@ -69,12 +71,12 @@ public class ForwardCommand implements C
>                  }
>                  RequestDispatcher rd = context.getContext().getRequestDispatcher(uri);
>                  rd.forward(context.getRequest(), context.getResponse());
> -                return true;
> +                return Processing.FINISHED;
>              } else {
>                  if (log.isDebugEnabled()) {
>                      log.debug("No forward found");
>                  }
> -                return false;
> +                return Processing.CONTINUE;
>              }
>          } catch (IOException e) {
>              throw new RuntimeException(e);
>
> Modified: commons/proper/chain/trunk/base/src/main/java/org/apache/commons/chain2/base/CopyCommand.java
> URL: http://svn.apache.org/viewvc/commons/proper/chain/trunk/base/src/main/java/org/apache/commons/chain2/base/CopyCommand.java?rev=1499551&r1=1499550&r2=1499551&view=diff
> ==============================================================================
> --- commons/proper/chain/trunk/base/src/main/java/org/apache/commons/chain2/base/CopyCommand.java (original)
> +++ commons/proper/chain/trunk/base/src/main/java/org/apache/commons/chain2/base/CopyCommand.java Wed Jul  3 20:45:37 2013
> @@ -19,6 +19,7 @@ package org.apache.commons.chain2.base;
>  import java.util.Map;
>
>  import org.apache.commons.chain2.Command;
> +import org.apache.commons.chain2.Processing;
>
>  /**
>   * <p>Copy a specified literal value, or a context attribute stored under
> @@ -78,17 +79,17 @@ public class CopyCommand<K, V, C extends
>       * <p>Copy a specified literal value, or a context attribute stored under
>       * the <code>fromKey</code> (if any), to the <code>toKey</code>.</p>
>       *
> -     * @param context {@link org.apache.commons.chain2.Context Context} in which we are operating
> +     * @param context {@link org.apache.commons.chain2.Context Context} in which we are operating.
>       *
> -     * @return <code>false</code> so that processing will continue
> +     * @return {@link Processing#CONTINUE} so that processing will continue.
>       * @throws org.apache.commons.chain2.ChainException in the if an error occurs during execution.
>       */
> -    public boolean execute(C context) {
> +    public Processing execute(C context) {
>          if (containsKeys(context)) {
>              V value = context.get(getFromKey());
>              context.put(getToKey(), value);
>          }
> -        return false;
> +        return Processing.CONTINUE;
>      }
>
>      private boolean containsKeys(C context) {
>
> Modified: commons/proper/chain/trunk/base/src/main/java/org/apache/commons/chain2/base/DispatchCommand.java
> URL: http://svn.apache.org/viewvc/commons/proper/chain/trunk/base/src/main/java/org/apache/commons/chain2/base/DispatchCommand.java?rev=1499551&r1=1499550&r2=1499551&view=diff
> ==============================================================================
> --- commons/proper/chain/trunk/base/src/main/java/org/apache/commons/chain2/base/DispatchCommand.java (original)
> +++ commons/proper/chain/trunk/base/src/main/java/org/apache/commons/chain2/base/DispatchCommand.java Wed Jul  3 20:45:37 2013
> @@ -18,6 +18,7 @@ package org.apache.commons.chain2.base;
>
>  import org.apache.commons.chain2.Command;
>  import org.apache.commons.chain2.Context;
> +import org.apache.commons.chain2.Processing;
>
>  import java.lang.reflect.InvocationTargetException;
>  import java.lang.reflect.Method;
> @@ -55,7 +56,7 @@ public abstract class DispatchCommand<K,
>
>      /**
>       * Look up the method specified by either "method" or "methodKey" and invoke it,
> -     * returning a boolean value as interpreted by <code>evaluateResult</code>.
> +     * returning a {@link Processing} value as interpreted by <code>evaluateResult</code>.
>       * @param context The Context to be processed by this Command.
>       * @return the result of method being dispatched to.
>       * @throws IllegalStateException if neither 'method' nor 'methodKey' properties are defined
> @@ -64,7 +65,7 @@ public abstract class DispatchCommand<K,
>       * the exception itself, unless the cause is an <code>Error</code> or other <code>Throwable</code>
>       * which is not an <code>Exception</code>.
>       */
> -    public boolean execute(C context) {
> +    public Processing execute(C context) {
>          if (this.getMethod() == null && this.getMethodKey() == null) {
>              throw new IllegalStateException("Neither 'method' nor 'methodKey' properties are defined ");
>          }
> @@ -120,15 +121,19 @@ public abstract class DispatchCommand<K,
>      }
>
>      /**
> -     * Evaluate the result of the method invocation as a boolean value.  Base implementation
> -     * expects that the invoked method returns boolean true/false, but subclasses might
> +     * Evaluate the result of the method invocation as a processing value. Base implementation
> +     * expects that the invoked method returns processing, but subclasses might
>       * implement other interpretations.
> -     * @param o The result of the methid execution
> +     * @param obj The result of the method execution
>       * @return The evaluated result/
>       */
> -    protected boolean evaluateResult(Object o) {
> -        Boolean result = (Boolean) o;
> -        return result != null && result.booleanValue();
> +    protected Processing evaluateResult(Object obj) {
> +        if(obj instanceof Processing) {
> +            Processing result = (Processing) obj;
> +            return result;
> +        } else {
> +            return Processing.CONTINUE;
> +        }
>      }
>
>      /**
>
> Modified: commons/proper/chain/trunk/base/src/main/java/org/apache/commons/chain2/base/DispatchLookupCommand.java
> URL: http://svn.apache.org/viewvc/commons/proper/chain/trunk/base/src/main/java/org/apache/commons/chain2/base/DispatchLookupCommand.java?rev=1499551&r1=1499550&r2=1499551&view=diff
> ==============================================================================
> --- commons/proper/chain/trunk/base/src/main/java/org/apache/commons/chain2/base/DispatchLookupCommand.java (original)
> +++ commons/proper/chain/trunk/base/src/main/java/org/apache/commons/chain2/base/DispatchLookupCommand.java Wed Jul  3 20:45:37 2013
> @@ -20,6 +20,7 @@ import org.apache.commons.chain2.Catalog
>  import org.apache.commons.chain2.Command;
>  import org.apache.commons.chain2.Context;
>  import org.apache.commons.chain2.Filter;
> +import org.apache.commons.chain2.Processing;
>
>  import java.lang.reflect.InvocationTargetException;
>  import java.lang.reflect.Method;
> @@ -133,13 +134,13 @@ public class DispatchLookupCommand<K, V,
>       *
>       * @param context The context for this request
>       * @return the result of executing the looked-up command's method, or
> -     * <code>false</code> if no command is found.
> +     * {@link Processing#CONTINUE} if no command is found.
>       *
>       * @throws DispatchException if no such {@link Command} can be found and the
>       *  <code>optional</code> property is set to <code>false</code>
>       */
>      @Override
> -    public boolean execute(C context) {
> +    public Processing execute(C context) {
>          if (this.getMethod() == null && this.getMethodKey() == null) {
>              throw new IllegalStateException("Neither 'method' nor 'methodKey' properties are defined");
>          }
> @@ -150,9 +151,13 @@ public class DispatchLookupCommand<K, V,
>              try {
>                  Method methodObject = extractMethod(command, context);
>                  Object obj = methodObject.invoke(command, getArguments(context));
> -
> -                Boolean result = (Boolean) obj;
> -                return result != null && result.booleanValue(); // might cause NPE (obj could be null)
> +
> +                if(obj instanceof Processing) {
> +                    Processing result = (Processing) obj;
> +                    return result;
> +                } else {
> +                    return Processing.CONTINUE;
> +                }
>              } catch (NoSuchMethodException e) {
>                  throw new DispatchException("Error extracting method from context", e, context, this);
>              } catch (IllegalAccessException e) {
> @@ -162,7 +167,7 @@ public class DispatchLookupCommand<K, V,
>                  throw new DispatchException("Error in reflected dispatched command", cause, context, this);
>              }
>          }
> -        return false;
> +        return Processing.CONTINUE;
>      }
>
>      // ------------------------------------------------------ Protected Methods
>
> Modified: commons/proper/chain/trunk/base/src/main/java/org/apache/commons/chain2/base/LookupCommand.java
> URL: http://svn.apache.org/viewvc/commons/proper/chain/trunk/base/src/main/java/org/apache/commons/chain2/base/LookupCommand.java?rev=1499551&r1=1499550&r2=1499551&view=diff
> ==============================================================================
> --- commons/proper/chain/trunk/base/src/main/java/org/apache/commons/chain2/base/LookupCommand.java (original)
> +++ commons/proper/chain/trunk/base/src/main/java/org/apache/commons/chain2/base/LookupCommand.java Wed Jul  3 20:45:37 2013
> @@ -21,6 +21,7 @@ import org.apache.commons.chain2.Catalog
>  import org.apache.commons.chain2.Command;
>  import org.apache.commons.chain2.Context;
>  import org.apache.commons.chain2.Filter;
> +import org.apache.commons.chain2.Processing;
>
>  import java.util.Map;
>
> @@ -254,7 +255,7 @@ public class LookupCommand<K, V, C exten
>       * <p>Look up the specified command, and (if found) execute it.
>       * Unless <code>ignoreExecuteResult</code> is set to <code>true</code>,
>       * return the result of executing the found command.  If no command
> -     * is found, return <code>false</code>, unless the <code>optional</code>
> +     * is found, return {@link Processing#CONTINUE}, unless the <code>optional</code>
>       * property is <code>false</code>, in which case an <code>IllegalArgumentException</code>
>       * will be thrown.
>       * </p>
> @@ -265,21 +266,21 @@ public class LookupCommand<K, V, C exten
>       *  can be found and the <code>optional</code> property is set
>       *  to <code>false</code>
>       * @return the result of executing the looked-up command, or
> -     * <code>false</code> if no command is found or if the command
> +     * <code>CONTINUE</code> if no command is found or if the command
>       * is found but the <code>ignoreExecuteResult</code> property of this
>       * instance is <code>true</code>
>       * @throws org.apache.commons.chain2.ChainException if and error occurs in the looked-up Command.
>       */
> -    public boolean execute(C context) {
> +    public Processing execute(C context) {
>          Command<K, V, C> command = getCommand(context);
>          if (command != null) {
> -            boolean result = command.execute(context);
> +            Processing result = command.execute(context);
>              if (isIgnoreExecuteResult()) {
> -                return false;
> +                return Processing.CONTINUE;
>              }
>              return result;
>          }
> -        return false;
> +        return Processing.CONTINUE;
>      }
>
>
>
> Modified: commons/proper/chain/trunk/base/src/main/java/org/apache/commons/chain2/base/OverrideCommand.java
> URL: http://svn.apache.org/viewvc/commons/proper/chain/trunk/base/src/main/java/org/apache/commons/chain2/base/OverrideCommand.java?rev=1499551&r1=1499550&r2=1499551&view=diff
> ==============================================================================
> --- commons/proper/chain/trunk/base/src/main/java/org/apache/commons/chain2/base/OverrideCommand.java (original)
> +++ commons/proper/chain/trunk/base/src/main/java/org/apache/commons/chain2/base/OverrideCommand.java Wed Jul  3 20:45:37 2013
> @@ -21,6 +21,7 @@ import java.util.Map;
>
>  import org.apache.commons.chain2.Command;
>  import org.apache.commons.chain2.Context;
> +import org.apache.commons.chain2.Processing;
>
>  /**
>   * <p>Override any context attribute stored under the <code>key</code> with <code>value</code>.</p>
> @@ -79,14 +80,14 @@ public class OverrideCommand<K, V, C ext
>       *
>       * @param context {@link org.apache.commons.chain2.Context} in which we are operating
>       *
> -     * @return <code>false</code> so that processing will continue
> +     * @return {@link Processing#CONTINUE} so that {@link Processing} will continue.
>       * @throws org.apache.commons.chain2.ChainException if and error occurs.
>       */
> -    public boolean execute(C context) {
> +    public Processing execute(C context) {
>          if (context.containsKey(getKey())) {
>              context.put(getKey(), getValue());
>          }
> -        return false;
> +        return Processing.CONTINUE;
>      }
>
>  }
>
> Modified: commons/proper/chain/trunk/base/src/main/java/org/apache/commons/chain2/base/RemoveCommand.java
> URL: http://svn.apache.org/viewvc/commons/proper/chain/trunk/base/src/main/java/org/apache/commons/chain2/base/RemoveCommand.java?rev=1499551&r1=1499550&r2=1499551&view=diff
> ==============================================================================
> --- commons/proper/chain/trunk/base/src/main/java/org/apache/commons/chain2/base/RemoveCommand.java (original)
> +++ commons/proper/chain/trunk/base/src/main/java/org/apache/commons/chain2/base/RemoveCommand.java Wed Jul  3 20:45:37 2013
> @@ -18,6 +18,7 @@ package org.apache.commons.chain2.base;
>
>  import org.apache.commons.chain2.Command;
>  import org.apache.commons.chain2.Context;
> +import org.apache.commons.chain2.Processing;
>
>  /**
>   * <p>Remove any context attribute stored under the <code>fromKey</code>.</p>
> @@ -59,12 +60,12 @@ public class RemoveCommand<K, V, C exten
>       *
>       * @param context {@link Context} in which we are operating
>       *
> -     * @return <code>false</code> so that processing will continue
> +     * @return {@link Processing#CONTINUE} so that processing will continue.
>       * @throws org.apache.commons.chain2.ChainException if and error occurs.
>       */
> -    public boolean execute(C context) {
> +    public Processing execute(C context) {
>          context.remove(getFromKey());
> -        return false;
> +        return Processing.CONTINUE;
>      }
>
>  }
>
> Modified: commons/proper/chain/trunk/base/src/main/java/org/apache/commons/chain2/impl/ChainBase.java
> URL: http://svn.apache.org/viewvc/commons/proper/chain/trunk/base/src/main/java/org/apache/commons/chain2/impl/ChainBase.java?rev=1499551&r1=1499550&r2=1499551&view=diff
> ==============================================================================
> --- commons/proper/chain/trunk/base/src/main/java/org/apache/commons/chain2/impl/ChainBase.java (original)
> +++ commons/proper/chain/trunk/base/src/main/java/org/apache/commons/chain2/impl/ChainBase.java Wed Jul  3 20:45:37 2013
> @@ -21,6 +21,7 @@ import org.apache.commons.chain2.Command
>  import org.apache.commons.chain2.Context;
>  import org.apache.commons.chain2.Filter;
>  import org.apache.commons.chain2.ChainException;
> +import org.apache.commons.chain2.Processing;
>
>  import java.util.ArrayList;
>  import java.util.Collection;
> @@ -145,12 +146,12 @@ public class ChainBase<K, V, C extends M
>       * @throws IllegalArgumentException if <code>context</code>
>       *  is <code>null</code>
>       *
> -     * @return <code>true</code> if the processing of this {@link Context}
> -     *  has been completed, or <code>false</code> if the processing
> -     *  of this {@link Context} should be delegated to a subsequent
> -     *  {@link Command} in an enclosing {@link Chain}
> +     * @return {@link Processing#FINISHED} if the processing of this contex
> +     *  has been completed. Returns {@link Processing#CONTINUE} if the processing
> +     *  of this context should be delegated to a subsequent command in an
> +     *  enclosing chain.
>       */
> -    public boolean execute(C context) {
> +    public Processing execute(C context) {
>          // Verify our parameters
>          if (context == null) {
>              throw new IllegalArgumentException("Can't execute a null context");
> @@ -159,9 +160,9 @@ public class ChainBase<K, V, C extends M
>          // Freeze the configuration of the command list
>          frozen = true;
>
> -        // Execute the commands in this list until one returns true
> -        // or throws an exception
> -        boolean saveResult = false;
> +        // Execute the commands in this list until one returns something else
> +        // than Processing.CONTINUE or throws an exception
> +        Processing saveResult = Processing.CONTINUE;
>          Exception saveException = null;
>          int i = 0;
>          int n = commands.size();
> @@ -170,7 +171,11 @@ public class ChainBase<K, V, C extends M
>              try {
>                  lastCommand = commands.get(i);
>                  saveResult = lastCommand.execute(context);
> -                if (saveResult) {
> +                if(saveResult == null) {
> +                    String format = String.format("The command '%s' returned an invalid processing value: '%s'",
> +                            lastCommand.getClass().getName(), saveResult);
> +                    throw new ChainException(format);
> +                } else if (saveResult != Processing.CONTINUE) {
>                      break;
>                  }
>              } catch (Exception e) {
>
> Modified: commons/proper/chain/trunk/base/src/test/java/org/apache/commons/chain2/base/CopyCommandTestCase.java
> URL: http://svn.apache.org/viewvc/commons/proper/chain/trunk/base/src/test/java/org/apache/commons/chain2/base/CopyCommandTestCase.java?rev=1499551&r1=1499550&r2=1499551&view=diff
> ==============================================================================
> --- commons/proper/chain/trunk/base/src/test/java/org/apache/commons/chain2/base/CopyCommandTestCase.java (original)
> +++ commons/proper/chain/trunk/base/src/test/java/org/apache/commons/chain2/base/CopyCommandTestCase.java Wed Jul  3 20:45:37 2013
> @@ -27,6 +27,7 @@ import java.util.Collections;
>  import java.util.HashMap;
>  import java.util.Map;
>
> +import org.apache.commons.chain2.Processing;
>  import org.junit.After;
>  import org.junit.Before;
>  import org.junit.Test;
> @@ -94,8 +95,8 @@ public class CopyCommandTestCase {
>      }
>
>      private void execute() {
> -        // make sure execute always returns false
> -        assertFalse(command.execute(context));
> +        // make sure execute always returns continue
> +        assertEquals(Processing.CONTINUE, command.execute(context));
>      }
>
>  }
>
> Modified: commons/proper/chain/trunk/base/src/test/java/org/apache/commons/chain2/base/DispatchCommandTestCase.java
> URL: http://svn.apache.org/viewvc/commons/proper/chain/trunk/base/src/test/java/org/apache/commons/chain2/base/DispatchCommandTestCase.java?rev=1499551&r1=1499550&r2=1499551&view=diff
> ==============================================================================
> --- commons/proper/chain/trunk/base/src/test/java/org/apache/commons/chain2/base/DispatchCommandTestCase.java (original)
> +++ commons/proper/chain/trunk/base/src/test/java/org/apache/commons/chain2/base/DispatchCommandTestCase.java Wed Jul  3 20:45:37 2013
> @@ -17,6 +17,7 @@
>  package org.apache.commons.chain2.base;
>
>  import org.apache.commons.chain2.Context;
> +import org.apache.commons.chain2.Processing;
>  import org.apache.commons.chain2.impl.ContextBase;
>  import org.junit.Test;
>
> @@ -32,8 +33,8 @@ public class DispatchCommandTestCase {
>          test.setMethod("testMethod");
>          Context<String, Object> context = new ContextBase();
>          assertNull(context.get("foo"));
> -        boolean result = test.execute(context);
> -        assertTrue(result);
> +        Processing result = test.execute(context);
> +        assertEquals(Processing.FINISHED, result);
>          assertNotNull(context.get("foo"));
>          assertEquals("foo", context.get("foo"));
>
> @@ -49,8 +50,8 @@ public class DispatchCommandTestCase {
>          Context<String, Object> context = new ContextBase();
>          context.put("foo", "testMethodKey");
>          assertNull(context.get("bar"));
> -        boolean result = test.execute(context);
> -        assertFalse(result);
> +        Processing result = test.execute(context);
> +        assertEquals(Processing.CONTINUE, result);
>          assertNotNull(context.get("bar"));
>          assertEquals("bar", context.get("bar"));
>
> @@ -64,8 +65,8 @@ public class DispatchCommandTestCase {
>          test.setMethod("foo");
>          Context<String, Object> context = new ContextBase();
>          assertNull(context.get("elephant"));
> -        boolean result = test.execute(context);
> -        assertTrue(result);
> +        Processing result = test.execute(context);
> +        assertEquals(Processing.FINISHED, result);
>          assertNotNull(context.get("elephant"));
>          assertEquals("elephant", context.get("elephant"));
>
> @@ -76,15 +77,15 @@ public class DispatchCommandTestCase {
>      class TestCommand extends DispatchCommand<String, Object, Context<String, Object>> {
>
>
> -        public boolean testMethod(Context<String, Object> context) {
> +        public Processing testMethod(Context<String, Object> context) {
>              context.put("foo", "foo");
> -            return true;
> +            return Processing.FINISHED;
>          }
>
> -        public boolean testMethodKey(Context<String, Object> context) {
> +        public Processing testMethodKey(Context<String, Object> context) {
>
>              context.put("bar", "bar");
> -            return false;
> +            return Processing.CONTINUE;
>          }
>
>      }
> @@ -106,9 +107,9 @@ public class DispatchCommandTestCase {
>              return new Object[] { new TestAlternateContext(context) };
>          }
>
> -        public boolean foo(TestAlternateContext context) {
> +        public Processing foo(TestAlternateContext context) {
>              context.put("elephant", "elephant");
> -            return true;
> +            return Processing.FINISHED;
>          }
>
>      }
>
> Modified: commons/proper/chain/trunk/base/src/test/java/org/apache/commons/chain2/base/DispatchLookupCommandTestCase.java
> URL: http://svn.apache.org/viewvc/commons/proper/chain/trunk/base/src/test/java/org/apache/commons/chain2/base/DispatchLookupCommandTestCase.java?rev=1499551&r1=1499550&r2=1499551&view=diff
> ==============================================================================
> --- commons/proper/chain/trunk/base/src/test/java/org/apache/commons/chain2/base/DispatchLookupCommandTestCase.java (original)
> +++ commons/proper/chain/trunk/base/src/test/java/org/apache/commons/chain2/base/DispatchLookupCommandTestCase.java Wed Jul  3 20:45:37 2013
> @@ -17,6 +17,7 @@
>  package org.apache.commons.chain2.base;
>
>  import static org.apache.commons.chain2.testutils.HasLog.hasLog;
> +import static org.junit.Assert.assertEquals;
>  import static org.junit.Assert.assertThat;
>  import static org.junit.Assert.assertTrue;
>  import static org.junit.Assert.fail;
> @@ -24,6 +25,7 @@ import static org.junit.Assert.fail;
>  import org.apache.commons.chain2.Catalog;
>  import org.apache.commons.chain2.CatalogFactory;
>  import org.apache.commons.chain2.Context;
> +import org.apache.commons.chain2.Processing;
>  import org.apache.commons.chain2.impl.CatalogBase;
>  import org.apache.commons.chain2.impl.CatalogFactoryBase;
>  import org.apache.commons.chain2.impl.ContextBase;
> @@ -102,8 +104,8 @@ public class DispatchLookupCommandTestCa
>          command.setMethod("fooMethod");
>
>          try {
> -            assertTrue("Command should return true",
> -                       command.execute(context));
> +            assertEquals("Command should return finished",
> +                    Processing.FINISHED, command.execute(context));
>          } catch (Exception e) {
>
>              fail("Threw exception: " + e);
> @@ -113,8 +115,8 @@ public class DispatchLookupCommandTestCa
>          command.setMethod("barMethod");
>
>          try {
> -            assertTrue("Command should return true",
> -                       command.execute(context));
> +            assertEquals("Command should return finished",
> +                    Processing.FINISHED, command.execute(context));
>          } catch (Exception e) {
>              fail("Threw exception: " + e);
>          }
> @@ -160,8 +162,8 @@ public class DispatchLookupCommandTestCa
>          context.put("methodKey", "fooMethod");
>
>          try {
> -            assertTrue("Command should return true",
> -                       command.execute(context));
> +            assertEquals("Command should return finished",
> +                    Processing.FINISHED, command.execute(context));
>          } catch (Exception e) {
>              fail("Threw exception: " + e);
>          }
> @@ -172,8 +174,8 @@ public class DispatchLookupCommandTestCa
>
>
>          try {
> -            assertTrue("Command should return true",
> -                       command.execute(context));
> +            assertEquals("Command should return finished",
> +                    Processing.FINISHED, command.execute(context));
>          } catch (Exception e) {
>              fail("Threw exception: " + e);
>          }
> @@ -193,14 +195,14 @@ public class DispatchLookupCommandTestCa
>              super(id);
>          }
>
> -        public boolean fooMethod(C context) {
> +        public Processing fooMethod(C context) {
>              log(context, id);
> -            return true;
> +            return Processing.FINISHED;
>          }
>
> -        public boolean barMethod(C context) {
> +        public Processing barMethod(C context) {
>              log(context, id);
> -            return true;
> +            return Processing.FINISHED;
>          }
>
>      }
>
> Modified: commons/proper/chain/trunk/base/src/test/java/org/apache/commons/chain2/base/LookupCommandTestCase.java
> URL: http://svn.apache.org/viewvc/commons/proper/chain/trunk/base/src/test/java/org/apache/commons/chain2/base/LookupCommandTestCase.java?rev=1499551&r1=1499550&r2=1499551&view=diff
> ==============================================================================
> --- commons/proper/chain/trunk/base/src/test/java/org/apache/commons/chain2/base/LookupCommandTestCase.java (original)
> +++ commons/proper/chain/trunk/base/src/test/java/org/apache/commons/chain2/base/LookupCommandTestCase.java Wed Jul  3 20:45:37 2013
> @@ -28,6 +28,7 @@ import org.apache.commons.chain2.Catalog
>  import org.apache.commons.chain2.CatalogFactory;
>  import org.apache.commons.chain2.Chain;
>  import org.apache.commons.chain2.Context;
> +import org.apache.commons.chain2.Processing;
>  import org.apache.commons.chain2.impl.CatalogBase;
>  import org.apache.commons.chain2.impl.CatalogFactoryBase;
>  import org.apache.commons.chain2.impl.ChainBase;
> @@ -104,8 +105,8 @@ public class LookupCommandTestCase {
>          command.setName("foo");
>
>          try {
> -            assertTrue("Command should return true",
> -                       command.execute(context));
> +            assertEquals("Command should return finished",
> +                   Processing.FINISHED, command.execute(context));
>          } catch (Exception e) {
>              fail("Threw exception: " + e);
>          }
> @@ -127,8 +128,8 @@ public class LookupCommandTestCase {
>          command.setName("foo");
>
>          try {
> -            assertTrue("Command should return true",
> -                    command.execute(context));
> +            assertEquals("Command should return finished",
> +                   Processing.FINISHED, command.execute(context));
>          } catch (Exception e) {
>              fail("Threw exception: " + e);
>          }
> @@ -146,8 +147,8 @@ public class LookupCommandTestCase {
>          context.put("nameKey", "foo");
>
>          try {
> -            assertTrue("Command should return true",
> -                    command.execute(context));
> +            assertEquals("Command should return finished",
> +                Processing.FINISHED, command.execute(context));
>          } catch (Exception e) {
>              fail("Threw exception: " + e);
>          }
> @@ -170,8 +171,8 @@ public class LookupCommandTestCase {
>          context.put("nameKey", "foo");
>
>          try {
> -            assertTrue("Command should return true",
> -                       command.execute(context));
> +            assertEquals("Command should return finished",
> +                Processing.FINISHED, command.execute(context));
>          } catch (Exception e) {
>              fail("Threw exception: " + e);
>          }
> @@ -189,8 +190,8 @@ public class LookupCommandTestCase {
>          command.setName("foo");
>
>          try {
> -            assertFalse("Command should return false",
> -                       command.execute(context));
> +            assertEquals("Command should return continue",
> +                Processing.CONTINUE, command.execute(context));
>          } catch (Exception e) {
>              fail("Threw exception: " + e);
>          }
>
> Modified: commons/proper/chain/trunk/base/src/test/java/org/apache/commons/chain2/impl/ChainBaseTestCase.java
> URL: http://svn.apache.org/viewvc/commons/proper/chain/trunk/base/src/test/java/org/apache/commons/chain2/impl/ChainBaseTestCase.java?rev=1499551&r1=1499550&r2=1499551&view=diff
> ==============================================================================
> --- commons/proper/chain/trunk/base/src/test/java/org/apache/commons/chain2/impl/ChainBaseTestCase.java (original)
> +++ commons/proper/chain/trunk/base/src/test/java/org/apache/commons/chain2/impl/ChainBaseTestCase.java Wed Jul  3 20:45:37 2013
> @@ -28,8 +28,10 @@ import java.util.Collection;
>  import java.util.List;
>
>  import org.apache.commons.chain2.Chain;
> +import org.apache.commons.chain2.ChainException;
>  import org.apache.commons.chain2.Command;
>  import org.apache.commons.chain2.Context;
> +import org.apache.commons.chain2.Processing;
>  import org.apache.commons.chain2.testutils.AddingCommand;
>  import org.apache.commons.chain2.testutils.DelegatingCommand;
>  import org.apache.commons.chain2.testutils.DelegatingFilter;
> @@ -37,6 +39,7 @@ import org.apache.commons.chain2.testuti
>  import org.apache.commons.chain2.testutils.ExceptionFilter;
>  import org.apache.commons.chain2.testutils.NonDelegatingCommand;
>  import org.apache.commons.chain2.testutils.NonDelegatingFilter;
> +import org.apache.commons.chain2.testutils.NullReturningCommand;
>  import org.junit.After;
>  import org.junit.Before;
>  import org.junit.Test;
> @@ -91,6 +94,15 @@ public class ChainBaseTestCase {
>      // ------------------------------------------------ Individual Test Methods
>
>
> +    @Test (expected = ChainException.class)
> +    public void nullReturningCommandForcesException() {
> +        chain.addCommand(new DelegatingCommand("BeforeNullReturningCommand"));
> +        chain.addCommand(new NullReturningCommand());
> +        chain.addCommand(new NonDelegatingCommand("AfterNullReturningCommand"));
> +
> +        chain.execute(context);
> +    }
> +
>      // Test the ability to add commands
>      @Test
>      public void testCommands() {
> @@ -117,8 +129,7 @@ public class ChainBaseTestCase {
>      public void testExecute1a() {
>          chain.addCommand(new NonDelegatingCommand("1"));
>          try {
> -            assertTrue("Chain returned true",
> -                       chain.execute(context));
> +            assertEquals(Processing.FINISHED, chain.execute(context));
>          } catch (Exception e) {
>              fail("Threw exception: " + e);
>          }
> @@ -131,8 +142,7 @@ public class ChainBaseTestCase {
>      public void testExecute1b() {
>          chain.addCommand(new DelegatingCommand("1"));
>          try {
> -            assertTrue("Chain returned false",
> -                       !chain.execute(context));
> +            assertEquals(Processing.CONTINUE, chain.execute(context));
>          } catch (Exception e) {
>              fail("Threw exception: " + e);
>          }
> @@ -177,8 +187,7 @@ public class ChainBaseTestCase {
>          chain.addCommand(new DelegatingCommand("2"));
>          chain.addCommand(new NonDelegatingCommand("3"));
>          try {
> -            assertTrue("Chain returned true",
> -                       chain.execute(context));
> +            assertEquals(Processing.FINISHED, chain.execute(context));
>          } catch (Exception e) {
>              fail("Threw exception: " + e);
>          }
> @@ -193,8 +202,7 @@ public class ChainBaseTestCase {
>          chain.addCommand(new DelegatingCommand("2"));
>          chain.addCommand(new DelegatingCommand("3"));
>          try {
> -            assertTrue("Chain returned false",
> -                       !chain.execute(context));
> +            assertEquals(Processing.CONTINUE, chain.execute(context));
>          } catch (Exception e) {
>              fail("Threw exception: " + e);
>          }
> @@ -241,8 +249,7 @@ public class ChainBaseTestCase {
>      public void testExecute3a() {
>          chain.addCommand(new NonDelegatingFilter("1", "a"));
>          try {
> -            assertTrue("Chain returned true",
> -                       chain.execute(context));
> +            assertEquals(Processing.FINISHED, chain.execute(context));
>          } catch (Exception e) {
>              fail("Threw exception: " + e);
>          }
> @@ -255,8 +262,7 @@ public class ChainBaseTestCase {
>      public void testExecute3b() {
>          chain.addCommand(new DelegatingFilter("1", "a"));
>          try {
> -            assertTrue("Chain returned false",
> -                       !chain.execute(context));
> +            assertEquals(Processing.CONTINUE, chain.execute(context));
>          } catch (Exception e) {
>              fail("Threw exception: " + e);
>          }
> @@ -286,8 +292,7 @@ public class ChainBaseTestCase {
>          chain.addCommand(new DelegatingCommand("2"));
>          chain.addCommand(new NonDelegatingFilter("3", "c"));
>          try {
> -            assertTrue("Chain returned true",
> -                       chain.execute(context));
> +            assertEquals(Processing.FINISHED, chain.execute(context));
>          } catch (Exception e) {
>              fail("Threw exception: " + e);
>          }
> @@ -302,8 +307,7 @@ public class ChainBaseTestCase {
>          chain.addCommand(new DelegatingFilter("2", "b"));
>          chain.addCommand(new DelegatingCommand("3"));
>          try {
> -            assertTrue("Chain returned false",
> -                       !chain.execute(context));
> +            assertEquals(Processing.CONTINUE, chain.execute(context));
>          } catch (Exception e) {
>              fail("Threw exception: " + e);
>          }
>
> Modified: commons/proper/chain/trunk/configuration/xml/src/test/java/org/apache/commons/chain2/config/xml/TestCommand.java
> URL: http://svn.apache.org/viewvc/commons/proper/chain/trunk/configuration/xml/src/test/java/org/apache/commons/chain2/config/xml/TestCommand.java?rev=1499551&r1=1499550&r2=1499551&view=diff
> ==============================================================================
> --- commons/proper/chain/trunk/configuration/xml/src/test/java/org/apache/commons/chain2/config/xml/TestCommand.java (original)
> +++ commons/proper/chain/trunk/configuration/xml/src/test/java/org/apache/commons/chain2/config/xml/TestCommand.java Wed Jul  3 20:45:37 2013
> @@ -19,6 +19,7 @@ package org.apache.commons.chain2.config
>
>  import org.apache.commons.chain2.Command;
>  import org.apache.commons.chain2.Context;
> +import org.apache.commons.chain2.Processing;
>
>
>  /**
> @@ -47,8 +48,8 @@ public class TestCommand implements Comm
>      }
>
>
> -    public boolean execute(Context<String, Object> context) {
> -    return (false);
> +    public Processing execute(Context<String, Object> context) {
> +        return Processing.CONTINUE;
>      }
>
>
>
> Modified: commons/proper/chain/trunk/configuration/xml/src/test/java/org/apache/commons/chain2/config/xml/XmlConfigParserTestCase.java
> URL: http://svn.apache.org/viewvc/commons/proper/chain/trunk/configuration/xml/src/test/java/org/apache/commons/chain2/config/xml/XmlConfigParserTestCase.java?rev=1499551&r1=1499550&r2=1499551&view=diff
> ==============================================================================
> --- commons/proper/chain/trunk/configuration/xml/src/test/java/org/apache/commons/chain2/config/xml/XmlConfigParserTestCase.java (original)
> +++ commons/proper/chain/trunk/configuration/xml/src/test/java/org/apache/commons/chain2/config/xml/XmlConfigParserTestCase.java Wed Jul  3 20:45:37 2013
> @@ -33,6 +33,7 @@ import java.util.List;
>  import org.apache.commons.chain2.Catalog;
>  import org.apache.commons.chain2.CatalogFactory;
>  import org.apache.commons.chain2.Context;
> +import org.apache.commons.chain2.Processing;
>  import org.apache.commons.chain2.testutils.AddingCommand;
>  import org.apache.commons.chain2.impl.CatalogBase;
>  import org.apache.commons.chain2.impl.ChainBase;
> @@ -160,8 +161,7 @@ public class XmlConfigParserTestCase {
>      @Test
>      public void testExecute2a() throws Exception {
>
> -        assertTrue("Chain returned true",
> -                catalog.getCommand("Execute2a").execute(context));
> +        assertEquals(Processing.FINISHED, catalog.getCommand("Execute2a").execute(context));
>          assertThat(context, hasLog("1/2/3"));
>
>      }
> @@ -171,8 +171,7 @@ public class XmlConfigParserTestCase {
>      @Test
>      public void testExecute2b() throws Exception {
>
> -        assertFalse("Chain returned false",
> -                catalog.getCommand("Execute2b").execute(context));
> +        assertEquals(Processing.CONTINUE, catalog.getCommand("Execute2b").execute(context));
>          assertThat(context, hasLog("1/2/3"));
>
>      }
> @@ -212,8 +211,7 @@ public class XmlConfigParserTestCase {
>      @Test
>      public void testExecute4a() throws Exception {
>
> -        assertTrue("Chain returned true",
> -                catalog.getCommand("Execute4a").execute(context));
> +        assertEquals(Processing.FINISHED, catalog.getCommand("Execute4a").execute(context));
>          assertThat(context, hasLog("1/2/3/c/a"));
>
>      }
> @@ -223,8 +221,7 @@ public class XmlConfigParserTestCase {
>      @Test
>      public void testExecute4b() throws Exception {
>
> -        assertFalse("Chain returned false",
> -                catalog.getCommand("Execute4b").execute(context));
> +        assertEquals(Processing.CONTINUE, catalog.getCommand("Execute4b").execute(context));
>          assertThat(context, hasLog("1/2/3/b"));
>
>      }
>
> Modified: commons/proper/chain/trunk/test-utils/src/main/java/org/apache/commons/chain2/testutils/DelegatingCommand.java
> URL: http://svn.apache.org/viewvc/commons/proper/chain/trunk/test-utils/src/main/java/org/apache/commons/chain2/testutils/DelegatingCommand.java?rev=1499551&r1=1499550&r2=1499551&view=diff
> ==============================================================================
> --- commons/proper/chain/trunk/test-utils/src/main/java/org/apache/commons/chain2/testutils/DelegatingCommand.java (original)
> +++ commons/proper/chain/trunk/test-utils/src/main/java/org/apache/commons/chain2/testutils/DelegatingCommand.java Wed Jul  3 20:45:37 2013
> @@ -19,6 +19,7 @@ package org.apache.commons.chain2.testut
>
>  import org.apache.commons.chain2.Command;
>  import org.apache.commons.chain2.Context;
> +import org.apache.commons.chain2.Processing;
>
>
>  /**
> @@ -50,10 +51,10 @@ public class DelegatingCommand extends N
>
>      // Execution method for this Command
>      @Override
> -    public boolean execute(Context<String, Object> context) {
> +    public Processing execute(Context<String, Object> context) {
>
>          super.execute(context);
> -        return (false);
> +        return Processing.CONTINUE;
>
>      }
>
>
> Modified: commons/proper/chain/trunk/test-utils/src/main/java/org/apache/commons/chain2/testutils/DelegatingFilter.java
> URL: http://svn.apache.org/viewvc/commons/proper/chain/trunk/test-utils/src/main/java/org/apache/commons/chain2/testutils/DelegatingFilter.java?rev=1499551&r1=1499550&r2=1499551&view=diff
> ==============================================================================
> --- commons/proper/chain/trunk/test-utils/src/main/java/org/apache/commons/chain2/testutils/DelegatingFilter.java (original)
> +++ commons/proper/chain/trunk/test-utils/src/main/java/org/apache/commons/chain2/testutils/DelegatingFilter.java Wed Jul  3 20:45:37 2013
> @@ -19,6 +19,7 @@ package org.apache.commons.chain2.testut
>
>  import org.apache.commons.chain2.Context;
>  import org.apache.commons.chain2.Filter;
> +import org.apache.commons.chain2.Processing;
>
>
>  /**
> @@ -50,10 +51,10 @@ public class DelegatingFilter extends No
>
>      // Execution method for this Command
>      @Override
> -    public boolean execute(Context<String, Object> context) {
> +    public Processing execute(Context<String, Object> context) {
>
>          super.execute(context);
> -        return (false);
> +        return Processing.CONTINUE;
>
>      }
>
>
> Modified: commons/proper/chain/trunk/test-utils/src/main/java/org/apache/commons/chain2/testutils/NonDelegatingCommand.java
> URL: http://svn.apache.org/viewvc/commons/proper/chain/trunk/test-utils/src/main/java/org/apache/commons/chain2/testutils/NonDelegatingCommand.java?rev=1499551&r1=1499550&r2=1499551&view=diff
> ==============================================================================
> --- commons/proper/chain/trunk/test-utils/src/main/java/org/apache/commons/chain2/testutils/NonDelegatingCommand.java (original)
> +++ commons/proper/chain/trunk/test-utils/src/main/java/org/apache/commons/chain2/testutils/NonDelegatingCommand.java Wed Jul  3 20:45:37 2013
> @@ -19,6 +19,7 @@ package org.apache.commons.chain2.testut
>
>  import org.apache.commons.chain2.Command;
>  import org.apache.commons.chain2.Context;
> +import org.apache.commons.chain2.Processing;
>
>
>  /**
> @@ -64,13 +65,13 @@ public class NonDelegatingCommand implem
>
>
>      // Execution method for this Command
> -    public boolean execute(Context<String, Object> context) {
> +    public Processing execute(Context<String, Object> context) {
>
>          if (context == null) {
>              throw new IllegalArgumentException();
>          }
>          log(context, id);
> -        return (true);
> +        return Processing.FINISHED;
>
>      }
>
>
> Modified: commons/proper/chain/trunk/test-utils/src/main/java/org/apache/commons/chain2/testutils/NonDelegatingFilter.java
> URL: http://svn.apache.org/viewvc/commons/proper/chain/trunk/test-utils/src/main/java/org/apache/commons/chain2/testutils/NonDelegatingFilter.java?rev=1499551&r1=1499550&r2=1499551&view=diff
> ==============================================================================
> --- commons/proper/chain/trunk/test-utils/src/main/java/org/apache/commons/chain2/testutils/NonDelegatingFilter.java (original)
> +++ commons/proper/chain/trunk/test-utils/src/main/java/org/apache/commons/chain2/testutils/NonDelegatingFilter.java Wed Jul  3 20:45:37 2013
> @@ -19,6 +19,7 @@ package org.apache.commons.chain2.testut
>
>  import org.apache.commons.chain2.Context;
>  import org.apache.commons.chain2.Filter;
> +import org.apache.commons.chain2.Processing;
>
>
>  /**
> @@ -64,10 +65,10 @@ public class NonDelegatingFilter
>
>      // Execution method for this Command
>      @Override
> -    public boolean execute(Context<String, Object> context) {
> +    public Processing execute(Context<String, Object> context) {
>
>          super.execute(context);
> -        return (true);
> +        return Processing.FINISHED;
>
>      }
>
>
> Added: commons/proper/chain/trunk/test-utils/src/main/java/org/apache/commons/chain2/testutils/NullReturningCommand.java
> URL: http://svn.apache.org/viewvc/commons/proper/chain/trunk/test-utils/src/main/java/org/apache/commons/chain2/testutils/NullReturningCommand.java?rev=1499551&view=auto
> ==============================================================================
> --- commons/proper/chain/trunk/test-utils/src/main/java/org/apache/commons/chain2/testutils/NullReturningCommand.java (added)
> +++ commons/proper/chain/trunk/test-utils/src/main/java/org/apache/commons/chain2/testutils/NullReturningCommand.java Wed Jul  3 20:45:37 2013
> @@ -0,0 +1,61 @@
> +/*
> + * 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.testutils;
> +
> +
> +import org.apache.commons.chain2.Chain;
> +import org.apache.commons.chain2.Command;
> +import org.apache.commons.chain2.Context;
> +import org.apache.commons.chain2.Processing;
> +
> +
> +/**
> + * Implementation of {@link Command} that always returns null if it's executed.
> + *
> + * @version $Id $
> + */
> +public class NullReturningCommand extends DelegatingCommand {
> +
> +
> +    // ------------------------------------------------------------ Constructor
> +
> +
> +    public NullReturningCommand() {
> +        this("");
> +    }
> +
> +
> +    // Construct an instance that will log the specified identifier
> +    public NullReturningCommand(String id) {
> +        super(id);
> +    }
> +
> +
> +    // -------------------------------------------------------- Command Methods
> +
> +    @Override
> +    public Processing execute(Context<String, Object> context) {
> +        return null;
> +    }
> +
> +
> +    public Processing execute(Context<String, Object> context, Chain<String, Object, Context<String, Object>> chain) {
> +        return null;
> +    }
> +
> +
> +}
>
> Propchange: commons/proper/chain/trunk/test-utils/src/main/java/org/apache/commons/chain2/testutils/NullReturningCommand.java
> ------------------------------------------------------------------------------
>     svn:eol-style = native
>
> Propchange: commons/proper/chain/trunk/test-utils/src/main/java/org/apache/commons/chain2/testutils/NullReturningCommand.java
> ------------------------------------------------------------------------------
>     svn:keywords = Date Author Id Revision HeadURL
>
> Modified: commons/proper/chain/trunk/test-utils/src/test/java/org/apache/commons/chain2/testutils/NonDelegatingCommandTestCase.java
> URL: http://svn.apache.org/viewvc/commons/proper/chain/trunk/test-utils/src/test/java/org/apache/commons/chain2/testutils/NonDelegatingCommandTestCase.java?rev=1499551&r1=1499550&r2=1499551&view=diff
> ==============================================================================
> --- commons/proper/chain/trunk/test-utils/src/test/java/org/apache/commons/chain2/testutils/NonDelegatingCommandTestCase.java (original)
> +++ commons/proper/chain/trunk/test-utils/src/test/java/org/apache/commons/chain2/testutils/NonDelegatingCommandTestCase.java Wed Jul  3 20:45:37 2013
> @@ -18,14 +18,15 @@
>  package org.apache.commons.chain2.testutils;
>
>  import static org.apache.commons.chain2.testutils.HasLog.hasLog;
> -import static org.hamcrest.Matchers.is;
>  import static org.hamcrest.collection.IsCollectionWithSize.hasSize;
>  import static org.hamcrest.collection.IsMapContaining.hasKey;
>  import static org.junit.Assert.assertThat;
> +import static org.junit.Assert.assertEquals;
>
>  import java.util.UUID;
>
>  import org.apache.commons.chain2.Context;
> +import org.apache.commons.chain2.Processing;
>  import org.junit.Before;
>  import org.junit.Test;
>
> @@ -68,6 +69,6 @@ public class NonDelegatingCommandTestCas
>      }
>
>      private void execute() {
> -        assertThat(command.execute(context), is(true));
> +        assertEquals(Processing.FINISHED, command.execute(context));
>      }
>  }
>
> Modified: commons/proper/chain/trunk/web/src/main/java/org/apache/commons/chain2/web/AbstractGetLocaleCommand.java
> URL: http://svn.apache.org/viewvc/commons/proper/chain/trunk/web/src/main/java/org/apache/commons/chain2/web/AbstractGetLocaleCommand.java?rev=1499551&r1=1499550&r2=1499551&view=diff
> ==============================================================================
> --- commons/proper/chain/trunk/web/src/main/java/org/apache/commons/chain2/web/AbstractGetLocaleCommand.java (original)
> +++ commons/proper/chain/trunk/web/src/main/java/org/apache/commons/chain2/web/AbstractGetLocaleCommand.java Wed Jul  3 20:45:37 2013
> @@ -18,6 +18,7 @@ package org.apache.commons.chain2.web;
>
>  import org.apache.commons.chain2.Command;
>  import org.apache.commons.chain2.Context;
> +import org.apache.commons.chain2.Processing;
>
>  import java.util.Locale;
>
> @@ -68,12 +69,12 @@ public abstract class AbstractGetLocaleC
>       *
>       * @param context The {@link Context} we are operating on
>       *
> -     * @return <code>false</code> so that processng will continue
> +     * @return {@link Processing#CONTINUE} so that the processing will continue.
>       * @throws org.apache.commons.chain2.ChainException If an error occurs during execution.
>       */
> -    public boolean execute(C context) {
> +    public Processing execute(C context) {
>          context.put(getLocaleKey(), getLocale(context));
> -        return (false);
> +        return Processing.CONTINUE;
>      }
>
>      // ------------------------------------------------------- Protected Methods
>
> Modified: commons/proper/chain/trunk/web/src/main/java/org/apache/commons/chain2/web/AbstractSetLocaleCommand.java
> URL: http://svn.apache.org/viewvc/commons/proper/chain/trunk/web/src/main/java/org/apache/commons/chain2/web/AbstractSetLocaleCommand.java?rev=1499551&r1=1499550&r2=1499551&view=diff
> ==============================================================================
> --- commons/proper/chain/trunk/web/src/main/java/org/apache/commons/chain2/web/AbstractSetLocaleCommand.java (original)
> +++ commons/proper/chain/trunk/web/src/main/java/org/apache/commons/chain2/web/AbstractSetLocaleCommand.java Wed Jul  3 20:45:37 2013
> @@ -18,6 +18,7 @@ package org.apache.commons.chain2.web;
>
>  import org.apache.commons.chain2.Command;
>  import org.apache.commons.chain2.Context;
> +import org.apache.commons.chain2.Processing;
>
>  import java.util.Locale;
>
> @@ -69,12 +70,12 @@ public abstract class AbstractSetLocaleC
>       *
>       * @param context The {@link Context} we are operating on
>       *
> -     * @return <code>false</code> so that processing will continue
> +     * @return {@link Processing#CONTINUE} so that the processing will continue.
>       * @throws org.apache.commons.chain2.ChainException If an error occurs during execution.
>       */
> -    public boolean execute(C context) {
> +    public Processing execute(C context) {
>          setLocale(context, (Locale) context.get(getLocaleKey()));
> -        return (false);
> +        return Processing.CONTINUE;
>      }
>
>      // ------------------------------------------------------- Protected Methods
>
> Modified: commons/proper/chain/trunk/web/src/test/java/org/apache/commons/chain2/web/portlet/PortletGetLocaleCommandTestCase.java
> URL: http://svn.apache.org/viewvc/commons/proper/chain/trunk/web/src/test/java/org/apache/commons/chain2/web/portlet/PortletGetLocaleCommandTestCase.java?rev=1499551&r1=1499550&r2=1499551&view=diff
> ==============================================================================
> --- commons/proper/chain/trunk/web/src/test/java/org/apache/commons/chain2/web/portlet/PortletGetLocaleCommandTestCase.java (original)
> +++ commons/proper/chain/trunk/web/src/test/java/org/apache/commons/chain2/web/portlet/PortletGetLocaleCommandTestCase.java Wed Jul  3 20:45:37 2013
> @@ -16,6 +16,7 @@
>   */
>  package org.apache.commons.chain2.web.portlet;
>
> +import org.apache.commons.chain2.Processing;
>  import org.junit.After;
>  import org.junit.Before;
>  import org.junit.Test;
> @@ -125,8 +126,8 @@ public class PortletGetLocaleCommandTest
>          assertNotNull(localeKey);
>          Object value = context.get(localeKey);
>          assertNull(value);
> -        boolean result = command.execute(context);
> -        assertFalse(result);
> +        Processing result = command.execute(context);
> +        assertEquals(Processing.CONTINUE, result);
>          value = context.get(localeKey);
>          assertNotNull(value);
>          assertTrue(value instanceof Locale);
>
> Modified: commons/proper/chain/trunk/web/src/test/java/org/apache/commons/chain2/web/servlet/ServletGetLocaleCommandTestCase.java
> URL: http://svn.apache.org/viewvc/commons/proper/chain/trunk/web/src/test/java/org/apache/commons/chain2/web/servlet/ServletGetLocaleCommandTestCase.java?rev=1499551&r1=1499550&r2=1499551&view=diff
> ==============================================================================
> --- commons/proper/chain/trunk/web/src/test/java/org/apache/commons/chain2/web/servlet/ServletGetLocaleCommandTestCase.java (original)
> +++ commons/proper/chain/trunk/web/src/test/java/org/apache/commons/chain2/web/servlet/ServletGetLocaleCommandTestCase.java Wed Jul  3 20:45:37 2013
> @@ -16,6 +16,7 @@
>   */
>  package org.apache.commons.chain2.web.servlet;
>
> +import org.apache.commons.chain2.Processing;
>  import org.junit.After;
>  import org.junit.Before;
>  import org.junit.Test;
> @@ -128,8 +129,8 @@ public class ServletGetLocaleCommandTest
>      assertNotNull(localeKey);
>      Object value = context.get(localeKey);
>      assertNull(value);
> -    boolean result = command.execute(context);
> -    assertFalse(result);
> +    Processing result = command.execute(context);
> +    assertEquals(Processing.CONTINUE, result);
>      value = context.get(localeKey);
>      assertNotNull(value);
>      assertTrue(value instanceof Locale);
>
> Modified: commons/proper/chain/trunk/web/src/test/java/org/apache/commons/chain2/web/servlet/ServletSetLocaleCommandTestCase.java
> URL: http://svn.apache.org/viewvc/commons/proper/chain/trunk/web/src/test/java/org/apache/commons/chain2/web/servlet/ServletSetLocaleCommandTestCase.java?rev=1499551&r1=1499550&r2=1499551&view=diff
> ==============================================================================
> --- commons/proper/chain/trunk/web/src/test/java/org/apache/commons/chain2/web/servlet/ServletSetLocaleCommandTestCase.java (original)
> +++ commons/proper/chain/trunk/web/src/test/java/org/apache/commons/chain2/web/servlet/ServletSetLocaleCommandTestCase.java Wed Jul  3 20:45:37 2013
> @@ -16,6 +16,7 @@
>   */
>  package org.apache.commons.chain2.web.servlet;
>
> +import org.apache.commons.chain2.Processing;
>  import org.junit.After;
>  import org.junit.Before;
>  import org.junit.Test;
> @@ -130,8 +131,8 @@ public class ServletSetLocaleCommandTest
>          context.put(localeKey, locale);
>          assertNotNull(context.get(localeKey));
>          assertNull(response.getLocale());
> -        boolean result = command.execute(context);
> -        assertFalse(result);
> +        Processing result = command.execute(context);
> +        assertEquals(Processing.CONTINUE, result);
>          assertNotNull(response.getLocale());
>          assertEquals(locale, response.getLocale());
>      }
>
>

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


Mime
View raw message