commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From simonetrip...@apache.org
Subject svn commit: r1363109 - in /commons/proper/chain/trunk/core/src/main/java/org/apache/commons/chain2/impl: CatalogBase.java CatalogFactoryBase.java ChainBase.java ContextBase.java
Date Wed, 18 Jul 2012 20:56:01 GMT
Author: simonetripodi
Date: Wed Jul 18 20:56:01 2012
New Revision: 1363109

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

Modified:
    commons/proper/chain/trunk/core/src/main/java/org/apache/commons/chain2/impl/CatalogBase.java
    commons/proper/chain/trunk/core/src/main/java/org/apache/commons/chain2/impl/CatalogFactoryBase.java
    commons/proper/chain/trunk/core/src/main/java/org/apache/commons/chain2/impl/ChainBase.java
    commons/proper/chain/trunk/core/src/main/java/org/apache/commons/chain2/impl/ContextBase.java

Modified: commons/proper/chain/trunk/core/src/main/java/org/apache/commons/chain2/impl/CatalogBase.java
URL: http://svn.apache.org/viewvc/commons/proper/chain/trunk/core/src/main/java/org/apache/commons/chain2/impl/CatalogBase.java?rev=1363109&r1=1363108&r2=1363109&view=diff
==============================================================================
--- commons/proper/chain/trunk/core/src/main/java/org/apache/commons/chain2/impl/CatalogBase.java
(original)
+++ commons/proper/chain/trunk/core/src/main/java/org/apache/commons/chain2/impl/CatalogBase.java
Wed Jul 18 20:56:01 2012
@@ -25,7 +25,6 @@ import java.util.concurrent.ConcurrentHa
 import org.apache.commons.chain2.Catalog;
 import org.apache.commons.chain2.Command;
 
-
 /**
  * <p>Simple in-memory implementation of {@link Catalog}.  This class can
  * also be used as the basis for more advanced implementations.</p>
@@ -40,19 +39,14 @@ import org.apache.commons.chain2.Command
  * @author Matthew J. Sgarlata
  * @version $Revision$ $Date$
  */
-
 public class CatalogBase<K, V, C extends Map<K, V>> implements Catalog<K,
V, C> {
 
-
     // ----------------------------------------------------- Instance Variables
 
-
     /**
      * <p>The map of named {@link Command}s, keyed by name.
      */
-    private final Map<String, Command<K, V, C>> commands =
-            new ConcurrentHashMap<String, Command<K, V, C>>();
-
+    private final Map<String, Command<K, V, C>> commands = new ConcurrentHashMap<String,
Command<K, V, C>>();
 
     // --------------------------------------------------------- Constructors
 
@@ -75,7 +69,6 @@ public class CatalogBase<K, V, C extends
 
     // --------------------------------------------------------- Public Methods
 
-
     /**
      * <p>Add a new name and associated {@link Command}
      * to the set of named commands known to this {@link Catalog},
@@ -86,9 +79,7 @@ public class CatalogBase<K, V, C extends
      *  for later lookups on this name
      */
     public void addCommand(String name, Command<K, V, C> command) {
-
         commands.put(name, command);
-
     }
 
     /**
@@ -100,9 +91,7 @@ public class CatalogBase<K, V, C extends
      * @return The Command associated with the specified name.
      */
     public Command<K, V, C> getCommand(String name) {
-
         return commands.get(name);
-
     }
 
     /**
@@ -122,9 +111,7 @@ public class CatalogBase<K, V, C extends
      * @return An iterator of the names in this Catalog.
      */
     public Iterator<String> getNames() {
-
         return commands.keySet().iterator();
-
     }
 
     /**
@@ -133,7 +120,6 @@ public class CatalogBase<K, V, C extends
      */
     @Override
     public String toString() {
-
         Iterator<String> names = getNames();
         StringBuffer str =
             new StringBuffer("[" + this.getClass().getName() + ": ");
@@ -141,12 +127,12 @@ public class CatalogBase<K, V, C extends
         while (names.hasNext()) {
             str.append(names.next());
             if (names.hasNext()) {
-            str.append(", ");
+                str.append(", ");
             }
         }
         str.append("]");
 
         return str.toString();
-
     }
+
 }

Modified: commons/proper/chain/trunk/core/src/main/java/org/apache/commons/chain2/impl/CatalogFactoryBase.java
URL: http://svn.apache.org/viewvc/commons/proper/chain/trunk/core/src/main/java/org/apache/commons/chain2/impl/CatalogFactoryBase.java?rev=1363109&r1=1363108&r2=1363109&view=diff
==============================================================================
--- commons/proper/chain/trunk/core/src/main/java/org/apache/commons/chain2/impl/CatalogFactoryBase.java
(original)
+++ commons/proper/chain/trunk/core/src/main/java/org/apache/commons/chain2/impl/CatalogFactoryBase.java
Wed Jul 18 20:56:01 2012
@@ -33,13 +33,10 @@ import org.apache.commons.chain2.Catalog
  * @author Sean Schofield
  * @version $Revision$ $Date$
  */
-
 public class CatalogFactoryBase<K, V, C extends Map<K, V>> extends CatalogFactory<K,
V, C> {
 
-
     // ----------------------------------------------------------- Constructors
 
-
     /**
      * <p>Construct an empty instance of {@link CatalogFactoryBase}.  This
      * constructor is intended solely for use by {@link CatalogFactory}.</p>
@@ -47,26 +44,20 @@ public class CatalogFactoryBase<K, V, C 
     public CatalogFactoryBase() {
     }
 
-
     // ----------------------------------------------------- Instance Variables
 
-
     /**
      * <p>The default {@link Catalog} for this {@link CatalogFactory}.</p>
      */
     private Catalog<K, V, C> catalog = null;
 
-
     /**
      * <p>Map of named {@link Catalog}s, keyed by catalog name.</p>
      */
-    private final Map<String, Catalog<K, V, C>> catalogs =
-            new ConcurrentHashMap<String, Catalog<K, V, C>>();
-
+    private final Map<String, Catalog<K, V, C>> catalogs = new ConcurrentHashMap<String,
Catalog<K, V, C>>();
 
     // --------------------------------------------------------- Public Methods
 
-
     /**
      * <p>Gets the default instance of Catalog associated with the factory
      * (if any); otherwise, return <code>null</code>.</p>
@@ -74,24 +65,18 @@ public class CatalogFactoryBase<K, V, C 
      * @return the default Catalog instance
      */
     public Catalog<K, V, C> getCatalog() {
-
         return catalog;
-
     }
 
-
     /**
      * <p>Sets the default instance of Catalog associated with the factory.</p>
      *
      * @param catalog the default Catalog instance
      */
     public void setCatalog(Catalog<K, V, C> catalog) {
-
         this.catalog = catalog;
-
     }
 
-
     /**
      * <p>Retrieves a Catalog instance by name (if any); otherwise
      * return <code>null</code>.</p>
@@ -101,12 +86,9 @@ public class CatalogFactoryBase<K, V, C 
      */
     @Override
     public Catalog<K, V, C> getCatalog(String name) {
-
         return catalogs.get(name);
-
     }
 
-
     /**
      * <p>Adds a named instance of Catalog to the factory (for subsequent
      * retrieval later).</p>
@@ -115,12 +97,9 @@ public class CatalogFactoryBase<K, V, C 
      * @param catalog the Catalog to add
      */
     public void addCatalog(String name, Catalog<K, V, C> catalog) {
-
         catalogs.put(name, catalog);
-
     }
 
-
     /**
      * <p>Return an <code>Iterator</code> over the set of named
      * {@link Catalog}s known to this {@link CatalogFactory}.
@@ -129,10 +108,7 @@ public class CatalogFactoryBase<K, V, C 
      * @return An Iterator of the names of the Catalogs known by this factory.
      */
     public Iterator<String> getNames() {
-
         return catalogs.keySet().iterator();
-
     }
 
-
 }

Modified: commons/proper/chain/trunk/core/src/main/java/org/apache/commons/chain2/impl/ChainBase.java
URL: http://svn.apache.org/viewvc/commons/proper/chain/trunk/core/src/main/java/org/apache/commons/chain2/impl/ChainBase.java?rev=1363109&r1=1363108&r2=1363109&view=diff
==============================================================================
--- commons/proper/chain/trunk/core/src/main/java/org/apache/commons/chain2/impl/ChainBase.java
(original)
+++ commons/proper/chain/trunk/core/src/main/java/org/apache/commons/chain2/impl/ChainBase.java
Wed Jul 18 20:56:01 2012
@@ -27,7 +27,6 @@ import java.util.Collection;
 import java.util.List;
 import java.util.Map;
 
-
 /**
  * <p>Convenience base class for {@link Chain} implementations.</p>
  *
@@ -38,21 +37,16 @@ import java.util.Map;
  * @author Craig R. McClanahan
  * @version $Revision$ $Date$
  */
-
 public class ChainBase<K, V, C extends Map<K, V>> implements Chain<K, V, C>
{
 
-
     // ----------------------------------------------------------- Constructors
 
-
     /**
      * <p>Construct a {@link Chain} with no configured {@link Command}s.</p>
      */
     public ChainBase() {
-
     }
 
-
     /**
      * <p>Construct a {@link Chain} configured with the specified
      * {@link Command}.</p>
@@ -63,12 +57,9 @@ public class ChainBase<K, V, C extends M
      *  is <code>null</code>
      */
     public ChainBase(Command<K, V, C> command) {
-
         addCommand(command);
-
     }
 
-
     /**
      * <p>Construct a {@link Chain} configured with the specified
      * {@link Command}s.</p>
@@ -80,17 +71,14 @@ public class ChainBase<K, V, C extends M
      *  is <code>null</code>
      */
     public ChainBase(Command<K, V, C>[] commands) {
-
         if (commands == null) {
             throw new IllegalArgumentException();
         }
         for (int i = 0; i < commands.length; i++) {
             addCommand(commands[i]);
         }
-
     }
 
-
     /**
      * <p>Construct a {@link Chain} configured with the specified
      * {@link Command}s.</p>
@@ -102,18 +90,14 @@ public class ChainBase<K, V, C extends M
      *  is <code>null</code>
      */
     public ChainBase(Collection<Command<K, V, C>> commands) {
-
         if (commands == null) {
             throw new IllegalArgumentException();
         }
         this.commands.addAll( commands );
-
     }
 
-
     // ----------------------------------------------------- Instance Variables
 
-
     /**
      * <p>The list of {@link Command}s configured for this {@link Chain}, in
      * the order in which they may delegate processing to the remainder of
@@ -121,17 +105,14 @@ public class ChainBase<K, V, C extends M
      */
     private final List<Command<K, V, C>> commands = new ArrayList<Command<K,
V, C>>();
 
-
     /**
      * <p>Flag indicating whether the configuration of our commands list
      * has been frozen by a call to the <code>execute()</code> method.</p>
      */
     private boolean frozen = false;
 
-
     // ---------------------------------------------------------- Chain Methods
 
-
     /**
      * See the {@link Chain} JavaDoc.
      *
@@ -142,7 +123,6 @@ public class ChainBase<K, V, C extends M
      * @exception IllegalStateException if no further configuration is allowed
      */
     public void addCommand(Command<K, V, C> command) {
-
         if (command == null) {
             throw new IllegalArgumentException();
         }
@@ -150,10 +130,8 @@ public class ChainBase<K, V, C extends M
             throw new IllegalStateException();
         }
         commands.add( command );
-
     }
 
-
     /**
      * See the {@link Chain} JavaDoc.
      *
@@ -171,7 +149,6 @@ public class ChainBase<K, V, C extends M
      *  {@link Command} in an enclosing {@link Chain}
      */
     public boolean execute(C context) {
-
         // Verify our parameters
         if (context == null) {
             throw new IllegalArgumentException("Can't execute a null context");
@@ -229,7 +206,6 @@ public class ChainBase<K, V, C extends M
         } else {
             return (saveResult);
         }
-
     }
 
     /**
@@ -272,17 +248,13 @@ public class ChainBase<K, V, C extends M
 
     // -------------------------------------------------------- Package Methods
 
-
     /**
      * <p>Return an array of the configured {@link Command}s for this
      * {@link Chain}.  This method is package private, and is used only
      * for the unit tests.</p>
      */
     List<Command<K, V, C>> getCommands() {
-
         return (commands);
-
     }
 
-
 }

Modified: commons/proper/chain/trunk/core/src/main/java/org/apache/commons/chain2/impl/ContextBase.java
URL: http://svn.apache.org/viewvc/commons/proper/chain/trunk/core/src/main/java/org/apache/commons/chain2/impl/ContextBase.java?rev=1363109&r1=1363108&r2=1363109&view=diff
==============================================================================
--- commons/proper/chain/trunk/core/src/main/java/org/apache/commons/chain2/impl/ContextBase.java
(original)
+++ commons/proper/chain/trunk/core/src/main/java/org/apache/commons/chain2/impl/ContextBase.java
Wed Jul 18 20:56:01 2012
@@ -48,30 +48,23 @@ import java.util.Set;
  * @author Craig R. McClanahan
  * @version $Revision$ $Date$
  */
-
 public class ContextBase extends ContextMap<String, Object> {
 
-
     // ------------------------------------------------------------ Constructors
 
-
     /**
      *
      */
     private static final long serialVersionUID = -3137668177106072122L;
 
-
     /**
      * Default, no argument constructor.
      */
     public ContextBase() {
-
         super();
         initialize();
-
     }
 
-
     /**
      * <p>Initialize the contents of this {@link Context} by copying the
      * values from the specified <code>Map</code>.  Any keys in <code>map</code>
@@ -86,17 +79,13 @@ public class ContextBase extends Context
      *  have a write method.
      */
     public ContextBase(Map<? extends String, ? extends Object> map) {
-
         super(map);
         initialize();
         putAll(map);
-
     }
 
-
     // ------------------------------------------------------ Instance Variables
 
-
     // NOTE - PropertyDescriptor instances are not Serializable, so the
     // following variables must be declared as transient.  When a ContextBase
     // instance is deserialized, the no-arguments constructor is called,
@@ -111,13 +100,11 @@ public class ContextBase extends Context
      */
     private transient Map<String, PropertyDescriptor> descriptors = null;
 
-
     /**
      * <p>The same <code>PropertyDescriptor</code>s as an array.</p>
      */
     private transient PropertyDescriptor[] pd = null;
 
-
     /**
      * <p>Distinguished singleton value that is stored in the map for each
      * key that is actually a property.  This value is used to ensure that
@@ -126,7 +113,6 @@ public class ContextBase extends Context
     private static final Object singleton;
 
     static {
-
         singleton = new Serializable() {
                 private static final long serialVersionUID = -6023767081282668587L;
 
@@ -134,26 +120,21 @@ public class ContextBase extends Context
                     return (false);
                 }
             };
-
     }
 
-
     /**
      * <p>Zero-length array of parameter values for calling property getters.
      * </p>
      */
     private static Object[] zeroParams = new Object[0];
 
-
     // ------------------------------------------------------------- Map Methods
 
-
     /**
      * <p>Override the default <code>Map</code> behavior to clear all keys
and
      * values except those corresponding to JavaBeans properties.</p>
      */
     public void clear() {
-
         if (descriptors == null) {
             super.clear();
         } else {
@@ -165,10 +146,8 @@ public class ContextBase extends Context
                 }
             }
         }
-
     }
 
-
     /**
      * <p>Override the default <code>Map</code> behavior to return
      * <code>true</code> if the specified value is present in either the
@@ -181,7 +160,6 @@ public class ContextBase extends Context
      *  throws an exception
      */
     public boolean containsValue(Object value) {
-
         // Case 1 -- no local properties
         if (descriptors == null) {
             return (super.containsValue(value));
@@ -205,10 +183,8 @@ public class ContextBase extends Context
             }
         }
         return (false);
-
     }
 
-
     /**
      * <p>Override the default <code>Map</code> behavior to return a
      * <code>Set</code> that meets the specified default behavior except
@@ -219,12 +195,9 @@ public class ContextBase extends Context
      * @return Set of entries in the Context.
      */
     public Set<Entry<String, Object>> entrySet() {
-
         return (new EntrySetImpl());
-
     }
 
-
     /**
      * <p>Override the default <code>Map</code> behavior to return the
value
      * of a local property if the specified key matches a local property name.
@@ -244,7 +217,6 @@ public class ContextBase extends Context
      *  have a read method.
      */
     public Object get(Object key) {
-
         // Case 1 -- no local properties
         if (descriptors == null) {
             return (super.get(key));
@@ -264,10 +236,8 @@ public class ContextBase extends Context
 
         // Case 3 -- retrieve value from our underlying Map
         return (super.get(key));
-
     }
 
-
     /**
      * <p>Override the default <code>Map</code> behavior to return
      * <code>true</code> if the underlying <code>Map</code> only
contains
@@ -277,7 +247,6 @@ public class ContextBase extends Context
      *  <code>false</code>.
      */
     public boolean isEmpty() {
-
         // Case 1 -- no local properties
         if (descriptors == null) {
             return (super.isEmpty());
@@ -285,10 +254,8 @@ public class ContextBase extends Context
 
         // Case 2 -- compare key count to property count
         return (super.size() <= descriptors.size());
-
     }
 
-
     /**
      * <p>Override the default <code>Map</code> behavior to return a
      * <code>Set</code> that meets the specified default behavior except
@@ -299,13 +266,9 @@ public class ContextBase extends Context
      * @return The set of keys for objects in this Context.
      */
     public Set<String> keySet() {
-
-
         return (super.keySet());
-
     }
 
-
     /**
      * <p>Override the default <code>Map</code> behavior to set the value
      * of a local property if the specified key matches a local property name.
@@ -353,10 +316,8 @@ public class ContextBase extends Context
 
         // Case 3 -- store or replace value in our underlying map
         return (super.put(key, value));
-
     }
 
-
     /**
      * <p>Override the default <code>Map</code> behavior to call the
      * <code>put()</code> method individually for each key-value pair
@@ -371,14 +332,11 @@ public class ContextBase extends Context
      *  have both a read method and a write method
      */
     public void putAll(Map<? extends String, ? extends Object> map) {
-
         for (Entry<? extends String, ? extends Object> pair : map.entrySet()) {
             put(pair.getKey(), pair.getValue());
         }
-
     }
 
-
     /**
      * <p>Override the default <code>Map</code> behavior to throw
      * <code>UnsupportedOperationException</code> on any attempt to
@@ -391,7 +349,6 @@ public class ContextBase extends Context
      *  <code>key</code> matches the name of a local property
      */
     public Object remove(Object key) {
-
         // Case 1 -- no local properties
         if (descriptors == null) {
             return (super.remove(key));
@@ -408,10 +365,8 @@ public class ContextBase extends Context
 
         // Case 3 -- remove from underlying Map
         return (super.remove(key));
-
     }
 
-
     /**
      * <p>Override the default <code>Map</code> behavior to return a
      * <code>Collection</code> that meets the specified default behavior except
@@ -422,26 +377,19 @@ public class ContextBase extends Context
      * @return The collection of values in this Context.
      */
     public Collection<Object> values() {
-
         return (new ValuesImpl());
-
     }
 
-
     // --------------------------------------------------------- Private Methods
 
-
     /**
      * <p>Return an <code>Iterator</code> over the set of <code>Map.Entry</code>
      * objects representing our key-value pairs.</p>
      */
     private Iterator<Entry<String, Object>> entriesIterator() {
-
         return (new EntrySetIterator());
-
     }
 
-
     /**
      * <p>Return a <code>Map.Entry</code> for the specified key value,
if it
      * is present; otherwise, return <code>null</code>.</p>
@@ -449,16 +397,13 @@ public class ContextBase extends Context
      * @param key Attribute key or property name
      */
     private Map.Entry<String, Object> entry(String key) {
-
         if (containsKey(key)) {
             return (new MapEntryImpl(key, get(key)));
         } else {
             return (null);
         }
-
     }
 
-
     /**
      * <p>Customize the contents of our underlying <code>Map</code> so
that
      * it contains keys corresponding to all of the JavaBeans properties of
@@ -471,7 +416,6 @@ public class ContextBase extends Context
      *  have a write method.
      */
     private void initialize() {
-
         // Retrieve the set of property descriptors for this Context class
         try {
             pd = Introspector.getBeanInfo
@@ -493,10 +437,8 @@ public class ContextBase extends Context
                 super.put(name, singleton);
             }
         }
-
     }
 
-
     /**
      * <p>Get and return the value for the specified property.</p>
      *
@@ -509,7 +451,6 @@ public class ContextBase extends Context
      *  have a read method.
      */
     private Object readProperty(PropertyDescriptor descriptor) {
-
         try {
             Method method = descriptor.getReadMethod();
             if (method == null) {
@@ -523,10 +464,8 @@ public class ContextBase extends Context
                 ("Exception reading property '" + descriptor.getName()
                  + "': " + e.getMessage());
         }
-
     }
 
-
     /**
      * <p>Remove the specified key-value pair, if it exists, and return
      * <code>true</code>.  If this pair does not exist, return
@@ -538,7 +477,6 @@ public class ContextBase extends Context
      *  identifies a property instead of an attribute
      */
     private boolean remove(Map.Entry<String, Object> entry) {
-
         Map.Entry<String, Object> actual = entry(entry.getKey());
         if (actual == null) {
             return (false);
@@ -548,21 +486,16 @@ public class ContextBase extends Context
             remove(entry.getKey());
             return (true);
         }
-
     }
 
-
     /**
      * <p>Return an <code>Iterator</code> over the set of values in this
      * <code>Map</code>.</p>
      */
     private Iterator<Object> valuesIterator() {
-
         return (new ValuesIterator());
-
     }
 
-
     /**
      * <p>Set the value for the specified property.</p>
      *
@@ -577,7 +510,6 @@ public class ContextBase extends Context
      *  have a write method.
      */
     private void writeProperty(PropertyDescriptor descriptor, Object value) {
-
         try {
             Method method = descriptor.getWriteMethod();
             if (method == null) {
@@ -591,13 +523,10 @@ public class ContextBase extends Context
                 ("Exception writing property '" + descriptor.getName()
                  + "': " + e.getMessage());
         }
-
     }
 
-
     // --------------------------------------------------------- Private Classes
 
-
     /**
      * <p>Private implementation of <code>Set</code> that implements the
      * semantics required for the value returned by <code>entrySet()</code>.</p>
@@ -655,10 +584,8 @@ public class ContextBase extends Context
         public int size() {
             return (ContextBase.this.size());
         }
-
     }
 
-
     /**
      * <p>Private implementation of <code>Iterator</code> for the
      * <code>Set</code> returned by <code>entrySet()</code>.</p>
@@ -666,6 +593,7 @@ public class ContextBase extends Context
     private class EntrySetIterator implements Iterator<Entry<String, Object>>
{
 
         private Map.Entry<String, Object> entry = null;
+
         private Iterator<String> keys = ContextBase.this.keySet().iterator();
 
         public boolean hasNext() {
@@ -696,6 +624,7 @@ public class ContextBase extends Context
         }
 
         private String key;
+
         private Object value;
 
         @Override
@@ -806,6 +735,7 @@ public class ContextBase extends Context
     private class ValuesIterator implements Iterator<Object> {
 
         private Map.Entry<String, Object> entry = null;
+
         private Iterator<String> keys = ContextBase.this.keySet().iterator();
 
         public boolean hasNext() {
@@ -823,5 +753,4 @@ public class ContextBase extends Context
 
     }
 
-
 }



Mime
View raw message