commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From simonetrip...@apache.org
Subject svn commit: r1363102 - in /commons/proper/chain/trunk/core/src/main/java/org/apache/commons/chain2/generic: CopyCommand.java DispatchCommand.java DispatchException.java DispatchLookupCommand.java LookupCommand.java RemoveCommand.java
Date Wed, 18 Jul 2012 20:43:47 GMT
Author: simonetripodi
Date: Wed Jul 18 20:43:46 2012
New Revision: 1363102

URL: http://svn.apache.org/viewvc?rev=1363102&view=rev
Log:
code format, no functional modifications

Modified:
    commons/proper/chain/trunk/core/src/main/java/org/apache/commons/chain2/generic/CopyCommand.java
    commons/proper/chain/trunk/core/src/main/java/org/apache/commons/chain2/generic/DispatchCommand.java
    commons/proper/chain/trunk/core/src/main/java/org/apache/commons/chain2/generic/DispatchException.java
    commons/proper/chain/trunk/core/src/main/java/org/apache/commons/chain2/generic/DispatchLookupCommand.java
    commons/proper/chain/trunk/core/src/main/java/org/apache/commons/chain2/generic/LookupCommand.java
    commons/proper/chain/trunk/core/src/main/java/org/apache/commons/chain2/generic/RemoveCommand.java

Modified: commons/proper/chain/trunk/core/src/main/java/org/apache/commons/chain2/generic/CopyCommand.java
URL: http://svn.apache.org/viewvc/commons/proper/chain/trunk/core/src/main/java/org/apache/commons/chain2/generic/CopyCommand.java?rev=1363102&r1=1363101&r2=1363102&view=diff
==============================================================================
--- commons/proper/chain/trunk/core/src/main/java/org/apache/commons/chain2/generic/CopyCommand.java
(original)
+++ commons/proper/chain/trunk/core/src/main/java/org/apache/commons/chain2/generic/CopyCommand.java
Wed Jul 18 20:43:46 2012
@@ -16,13 +16,11 @@
  */
 package org.apache.commons.chain2.generic;
 
-
 import org.apache.commons.chain2.Command;
 import org.apache.commons.chain2.Context;
 
 import java.util.Map;
 
-
 /**
  * <p>Copy a specified literal value, or a context attribute stored under
  * the <code>fromKey</code> (if any), to the <code>toKey</code>.</p>
@@ -34,94 +32,69 @@ import java.util.Map;
  * @author Craig R. McClanahan
  * @version $Revision$ $Date$
  */
-
 public class CopyCommand<K, V, C extends Map<K, V>> implements Command<K,
V, C> {
 
-
     // -------------------------------------------------------------- Properties
 
-
     private K fromKey = null;
 
-
     /**
      * <p>Return the context attribute key for the source attribute.</p>
      * @return The source attribute key.
      */
     public K getFromKey() {
-
-    return (this.fromKey);
-
+        return (this.fromKey);
     }
 
-
     /**
      * <p>Set the context attribute key for the source attribute.</p>
      *
      * @param fromKey The new key
      */
     public void setFromKey(K fromKey) {
-
-    this.fromKey = fromKey;
-
+        this.fromKey = fromKey;
     }
 
-
     private K toKey = null;
 
-
     /**
      * <p>Return the context attribute key for the destination attribute.</p>
      * @return The destination attribute key.
      */
     public K getToKey() {
-
-    return (this.toKey);
-
+        return (this.toKey);
     }
 
-
     /**
      * <p>Set the context attribute key for the destination attribute.</p>
      *
      * @param toKey The new key
      */
     public void setToKey(K toKey) {
-
-    this.toKey = toKey;
-
+        this.toKey = toKey;
     }
 
-
     private V value = null;
 
-
     /**
      * <p>Return the literal value to be copied.</p>
      * @return The literal value.
      */
     public V getValue() {
-
         return (this.value);
-
     }
 
-
     /**
      * <p>Set the literal value to be copied.</p>
      *
      * @param value The new value
      */
     public void setValue(V value) {
-
         this.value = value;
-
     }
 
-
     // ---------------------------------------------------------- Filter Methods
 
-
     /**
      * <p>Copy a specified literal value, or a context attribute stored under
      * the <code>fromKey</code> (if any), to the <code>toKey</code>.</p>
@@ -132,7 +105,6 @@ public class CopyCommand<K, V, C extends
      * @throws org.apache.commons.chain2.ChainException in the if an error occurs during
execution.
      */
     public boolean execute(C context) {
-
         V value = this.value;
 
         if (value == null) {
@@ -146,8 +118,6 @@ public class CopyCommand<K, V, C extends
         }
 
         return (false);
-
     }
 
-
 }

Modified: commons/proper/chain/trunk/core/src/main/java/org/apache/commons/chain2/generic/DispatchCommand.java
URL: http://svn.apache.org/viewvc/commons/proper/chain/trunk/core/src/main/java/org/apache/commons/chain2/generic/DispatchCommand.java?rev=1363102&r1=1363101&r2=1363102&view=diff
==============================================================================
--- commons/proper/chain/trunk/core/src/main/java/org/apache/commons/chain2/generic/DispatchCommand.java
(original)
+++ commons/proper/chain/trunk/core/src/main/java/org/apache/commons/chain2/generic/DispatchCommand.java
Wed Jul 18 20:43:46 2012
@@ -52,7 +52,6 @@ public abstract class DispatchCommand<K,
      */
     protected static final Class<?>[] DEFAULT_SIGNATURE = new Class<?>[] {Context.class};
 
-
     /**
      * Look up the method specified by either "method" or "methodKey" and invoke it,
      * returning a boolean value as interpreted by <code>evaluateResult</code>.
@@ -65,13 +64,11 @@ public abstract class DispatchCommand<K,
      * which is not an <code>Exception</code>.
      */
     public boolean execute(C context) {
-
         if (this.getMethod() == null && this.getMethodKey() == null) {
             throw new IllegalStateException("Neither 'method' nor 'methodKey' properties
are defined ");
         }
 
         try {
-
             Method methodObject = extractMethod(context);
             return evaluateResult(methodObject.invoke(this,
                     getArguments(context)));
@@ -97,7 +94,6 @@ public abstract class DispatchCommand<K,
      * @throws NullPointerException if no methodName cannot be determined
      */
     protected Method extractMethod(C context) throws NoSuchMethodException {
-
         String methodName = this.getMethod();
 
         if (methodName == null) {
@@ -108,7 +104,6 @@ public abstract class DispatchCommand<K,
             methodName = methodContextObj.toString();
         }
 
-
         Method theMethod = null;
 
         synchronized (methods) {
@@ -131,10 +126,8 @@ public abstract class DispatchCommand<K,
      * @return The evaluated result/
      */
     protected boolean evaluateResult(Object o) {
-
         Boolean result = (Boolean) o;
         return (result != null && result.booleanValue());
-
     }
 
     /**
@@ -190,4 +183,4 @@ public abstract class DispatchCommand<K,
         this.methodKey = methodKey;
     }
 
-}
\ No newline at end of file
+}

Modified: commons/proper/chain/trunk/core/src/main/java/org/apache/commons/chain2/generic/DispatchException.java
URL: http://svn.apache.org/viewvc/commons/proper/chain/trunk/core/src/main/java/org/apache/commons/chain2/generic/DispatchException.java?rev=1363102&r1=1363101&r2=1363102&view=diff
==============================================================================
--- commons/proper/chain/trunk/core/src/main/java/org/apache/commons/chain2/generic/DispatchException.java
(original)
+++ commons/proper/chain/trunk/core/src/main/java/org/apache/commons/chain2/generic/DispatchException.java
Wed Jul 18 20:43:46 2012
@@ -29,6 +29,7 @@ import org.apache.commons.chain2.Command
  * @version $Id$
  */
 public class DispatchException extends ChainException {
+
     /**
      *
      */
@@ -46,4 +47,5 @@ public class DispatchException extends C
                                                          C context, Command<K, V, C>
failedCommand) {
         super(message, cause, context, failedCommand);
     }
+
 }

Modified: commons/proper/chain/trunk/core/src/main/java/org/apache/commons/chain2/generic/DispatchLookupCommand.java
URL: http://svn.apache.org/viewvc/commons/proper/chain/trunk/core/src/main/java/org/apache/commons/chain2/generic/DispatchLookupCommand.java?rev=1363102&r1=1363101&r2=1363102&view=diff
==============================================================================
--- commons/proper/chain/trunk/core/src/main/java/org/apache/commons/chain2/generic/DispatchLookupCommand.java
(original)
+++ commons/proper/chain/trunk/core/src/main/java/org/apache/commons/chain2/generic/DispatchLookupCommand.java
Wed Jul 18 20:43:46 2012
@@ -16,7 +16,6 @@
  */
 package org.apache.commons.chain2.generic;
 
-
 import org.apache.commons.chain2.CatalogFactory;
 import org.apache.commons.chain2.Command;
 import org.apache.commons.chain2.Context;
@@ -57,7 +56,6 @@ import java.util.WeakHashMap;
  * @version $Revision$
  * @since Chain 1.1
  */
-
 public class DispatchLookupCommand<K, V, C extends Context<K, V>>
     extends LookupCommand<K, V, C> implements Filter<K, V, C> {
 
@@ -85,18 +83,16 @@ public class DispatchLookupCommand<K, V,
      * The base implementation expects dispatch methods to take a <code>
      * Context</code> as their only argument.
      */
-    private static final Class<?>[] DEFAULT_SIGNATURE =
-        new Class<?>[] {Context.class};
-
+    private static final Class<?>[] DEFAULT_SIGNATURE = new Class<?>[] {Context.class};
 
     // ----------------------------------------------------- Instance Variables
 
     private final WeakHashMap<String, Method> methods = new WeakHashMap<String,
Method>();
 
-
     // ------------------------------------------------------------- Properties
 
     private String method = null;
+
     private String methodKey = null;
 
     /**
@@ -131,7 +127,6 @@ public class DispatchLookupCommand<K, V,
         this.methodKey = methodKey;
     }
 
-
     // --------------------------------------------------------- Public Methods
 
     /**
@@ -146,7 +141,6 @@ public class DispatchLookupCommand<K, V,
      */
     @Override
     public boolean execute(C context) {
-
         if (this.getMethod() == null && this.getMethodKey() == null) {
             throw new IllegalStateException("Neither 'method' nor 'methodKey' properties
are defined");
         }
@@ -160,7 +154,6 @@ public class DispatchLookupCommand<K, V,
 
                 Boolean result = (Boolean) obj;
                 return (result != null && result);
-
             } catch (NoSuchMethodException e) {
                 throw new DispatchException("Error extracting method from context", e, context,
this);
             } catch (IllegalAccessException e) {
@@ -169,14 +162,11 @@ public class DispatchLookupCommand<K, V,
                 Throwable cause = e.getTargetException();
                 throw new DispatchException("Error in reflected dispatched command", cause,
context, this);
             }
-
         } else {
             return false;
         }
-
     }
 
-
     // ------------------------------------------------------ Protected Methods
 
     /**
@@ -206,10 +196,8 @@ public class DispatchLookupCommand<K, V,
         return new Object[] {context};
     }
 
-
     // -------------------------------------------------------- Private Methods
 
-
     /**
      * Extract the dispatch method.  The base implementation uses the
      * command's <code>method</code> property at the name of a method
@@ -225,21 +213,17 @@ public class DispatchLookupCommand<K, V,
      *    specified name.
      * @throws NullPointerException if no methodName can be determined
      */
-    private Method extractMethod(Command<K, V, C> command, C context)
-        throws NoSuchMethodException {
-
+    private Method extractMethod(Command<K, V, C> command, C context) throws NoSuchMethodException
{
         String methodName = this.getMethod();
 
         if (methodName == null) {
             Object methodContextObj = context.get(getMethodKey());
             if (methodContextObj == null) {
-                throw new NullPointerException("No value found in context under " +
-                                               getMethodKey());
+                throw new NullPointerException("No value found in context under " + getMethodKey());
             }
             methodName = methodContextObj.toString();
         }
 
-
         Method theMethod = null;
 
         synchronized (methods) {

Modified: commons/proper/chain/trunk/core/src/main/java/org/apache/commons/chain2/generic/LookupCommand.java
URL: http://svn.apache.org/viewvc/commons/proper/chain/trunk/core/src/main/java/org/apache/commons/chain2/generic/LookupCommand.java?rev=1363102&r1=1363101&r2=1363102&view=diff
==============================================================================
--- commons/proper/chain/trunk/core/src/main/java/org/apache/commons/chain2/generic/LookupCommand.java
(original)
+++ commons/proper/chain/trunk/core/src/main/java/org/apache/commons/chain2/generic/LookupCommand.java
Wed Jul 18 20:43:46 2012
@@ -16,7 +16,6 @@
  */
 package org.apache.commons.chain2.generic;
 
-
 import org.apache.commons.chain2.Catalog;
 import org.apache.commons.chain2.CatalogFactory;
 import org.apache.commons.chain2.Command;
@@ -25,7 +24,6 @@ import org.apache.commons.chain2.Filter;
 
 import java.util.Map;
 
-
 /**
  * <p>Look up a specified {@link Command} (which could also be a
  * {@link org.apache.commons.chain2.Chain})
@@ -49,10 +47,8 @@ import java.util.Map;
  * @author Craig R. McClanahan
  * @version $Revision$ $Date$
  */
-
 public class LookupCommand<K, V, C extends Map<K, V>> implements Filter<K,
V, C> {
 
-
     // -------------------------------------------------------------- Constructors
 
     /**
@@ -77,7 +73,6 @@ public class LookupCommand<K, V, C exten
         this.catalogFactory = factory;
     }
 
-
     // -------------------------------------------------------------- Properties
 
     private CatalogFactory<K, V, C> catalogFactory = null;
@@ -101,11 +96,9 @@ public class LookupCommand<K, V, C exten
      * @since Chain 1.1
      */
     public CatalogFactory<K, V, C> getCatalogFactory() {
-
         return this.catalogFactory;
     }
 
-
     private String catalogName = null;
 
     /**
@@ -114,12 +107,9 @@ public class LookupCommand<K, V, C exten
      * @return The Catalog name.
      */
     public String getCatalogName() {
-
         return (this.catalogName);
-
     }
 
-
     /**
      * <p>Set the name of the {@link Catalog} to be searched, or
      * <code>null</code> to search the default {@link Catalog}.</p>
@@ -127,27 +117,20 @@ public class LookupCommand<K, V, C exten
      * @param catalogName The new {@link Catalog} name or <code>null</code>
      */
     public void setCatalogName(String catalogName) {
-
         this.catalogName = catalogName;
-
     }
 
-
     private String name = null;
 
-
     /**
      * <p>Return the name of the {@link Command} that we will look up and
      * delegate execution to.</p>
      * @return The name of the Command.
      */
     public String getName() {
-
         return (this.name);
-
     }
 
-
     /**
      * <p>Set the name of the {@link Command} that we will look up and
      * delegate execution to.</p>
@@ -155,27 +138,20 @@ public class LookupCommand<K, V, C exten
      * @param name The new command name
      */
     public void setName(String name) {
-
         this.name = name;
-
     }
 
-
     private String nameKey = null;
 
-
     /**
      * <p>Return the context attribute key under which the {@link Command}
      * name is stored.</p>
      * @return The context key of the Command.
      */
     public String getNameKey() {
-
         return (this.nameKey);
-
     }
 
-
     /**
      * <p>Set the context attribute key under which the {@link Command}
      * name is stored.</p>
@@ -183,36 +159,27 @@ public class LookupCommand<K, V, C exten
      * @param nameKey The new context attribute key
      */
     public void setNameKey(String nameKey) {
-
         this.nameKey = nameKey;
-
     }
 
-
     private boolean optional = false;
 
-
     /**
      * <p>Return <code>true</code> if locating the specified command
      * is optional.</p>
      * @return <code>true</code> if the Command is optional.
      */
     public boolean isOptional() {
-
         return (this.optional);
-
     }
 
-
     /**
      * <p>Set the optional flag for finding the specified command.</p>
      *
      * @param optional The new optional flag
      */
     public void setOptional(boolean optional) {
-
         this.optional = optional;
-
     }
 
     private boolean ignoreExecuteResult = false;
@@ -281,8 +248,8 @@ public class LookupCommand<K, V, C exten
     public void setIgnorePostprocessResult(boolean ignorePostprocessResult) {
         this.ignorePostprocessResult = ignorePostprocessResult;
     }
-    // ---------------------------------------------------------- Filter Methods
 
+    // ---------------------------------------------------------- Filter Methods
 
     /**
      * <p>Look up the specified command, and (if found) execute it.
@@ -305,7 +272,6 @@ public class LookupCommand<K, V, C exten
      * @throws org.apache.commons.chain2.ChainException if and error occurs in the looked-up
Command.
      */
     public boolean execute(C context) {
-
         Command<K, V, C> command = getCommand(context);
         if (command != null) {
             boolean result = (command.execute(context));
@@ -316,7 +282,6 @@ public class LookupCommand<K, V, C exten
         } else {
             return (false);
         }
-
     }
 
 
@@ -334,7 +299,6 @@ public class LookupCommand<K, V, C exten
      * case <code>IllegalArgumentException</code> will be thrown.
      */
     public boolean postprocess(C context, Exception exception) {
-
         Command<K, V, C> command = getCommand(context);
         if (command != null) {
             if (command instanceof Filter) {
@@ -343,13 +307,10 @@ public class LookupCommand<K, V, C exten
             }
         }
         return (false);
-
     }
 
-
     // --------------------------------------------------------- Private Methods
 
-
     /**
      * <p>Return the {@link Catalog} to look up the {@link Command} in.</p>
      *
@@ -397,7 +358,6 @@ public class LookupCommand<K, V, C exten
      *  to <code>false</code>
      */
     protected Command<K, V, C> getCommand(C context) {
-
         Catalog<K, V, C> catalog = getCatalog(context);
 
         Command<K, V, C> command;
@@ -419,7 +379,6 @@ public class LookupCommand<K, V, C exten
         } else {
             throw new IllegalArgumentException("No command name");
         }
-
     }
 
     /**
@@ -431,13 +390,11 @@ public class LookupCommand<K, V, C exten
      * @since Chain 1.2
      */
     protected String getCommandName(C context) {
-
         String name = getName();
         if (name == null) {
             name = (String) context.get(getNameKey());
         }
         return name;
-
     }
 
 }

Modified: commons/proper/chain/trunk/core/src/main/java/org/apache/commons/chain2/generic/RemoveCommand.java
URL: http://svn.apache.org/viewvc/commons/proper/chain/trunk/core/src/main/java/org/apache/commons/chain2/generic/RemoveCommand.java?rev=1363102&r1=1363101&r2=1363102&view=diff
==============================================================================
--- commons/proper/chain/trunk/core/src/main/java/org/apache/commons/chain2/generic/RemoveCommand.java
(original)
+++ commons/proper/chain/trunk/core/src/main/java/org/apache/commons/chain2/generic/RemoveCommand.java
Wed Jul 18 20:43:46 2012
@@ -16,11 +16,9 @@
  */
 package org.apache.commons.chain2.generic;
 
-
 import org.apache.commons.chain2.Command;
 import org.apache.commons.chain2.Context;
 
-
 /**
  * <p>Remove any context attribute stored under the <code>fromKey</code>.</p>
  *
@@ -31,42 +29,31 @@ import org.apache.commons.chain2.Context
  * @author Craig R. McClanahan
  * @version $Revision$ $Date$
  */
-
 public class RemoveCommand<K, V, C extends Context<K, V>> implements Command<K,
V, C> {
 
-
     // -------------------------------------------------------------- Properties
 
-
     private K fromKey = null;
 
-
     /**
      * <p>Return the context attribute key for the attribute.</p>
      * @return The context attribute key.
      */
     public K getFromKey() {
-
-    return (this.fromKey);
-
+        return (this.fromKey);
     }
 
-
     /**
      * <p>Set the context attribute key for the attribute.</p>
      *
      * @param fromKey The new key
      */
     public void setFromKey(K fromKey) {
-
-    this.fromKey = fromKey;
-
+        this.fromKey = fromKey;
     }
 
-
     // ---------------------------------------------------------- Filter Methods
 
-
     /**
      * <p>Copy the specified source attribute to the specified destination
      * attribute.</p>
@@ -77,11 +64,8 @@ public class RemoveCommand<K, V, C exten
      * @throws org.apache.commons.chain2.ChainException if and error occurs.
      */
     public boolean execute(C context) {
-
-    context.remove(getFromKey());
-    return (false);
-
+        context.remove(getFromKey());
+        return (false);
     }
 
-
 }



Mime
View raw message