Author: niallp Date: Tue May 30 14:48:31 2006 New Revision: 410386 URL: http://svn.apache.org/viewvc?rev=410386&view=rev Log: Start Checkstyle clean up.
Modified: jakarta/commons/proper/chain/trunk/checkstyle.xml jakarta/commons/proper/chain/trunk/src/java/org/apache/commons/chain/Catalog.java jakarta/commons/proper/chain/trunk/src/java/org/apache/commons/chain/CatalogFactory.java jakarta/commons/proper/chain/trunk/src/java/org/apache/commons/chain/config/ConfigParser.java jakarta/commons/proper/chain/trunk/src/java/org/apache/commons/chain/config/ConfigRuleSet.java jakarta/commons/proper/chain/trunk/src/java/org/apache/commons/chain/generic/CopyCommand.java jakarta/commons/proper/chain/trunk/src/java/org/apache/commons/chain/generic/DispatchCommand.java jakarta/commons/proper/chain/trunk/src/java/org/apache/commons/chain/generic/DispatchLookupCommand.java jakarta/commons/proper/chain/trunk/src/java/org/apache/commons/chain/generic/LookupCommand.java jakarta/commons/proper/chain/trunk/src/java/org/apache/commons/chain/generic/RemoveCommand.java Modified: jakarta/commons/proper/chain/trunk/checkstyle.xml URL: http://svn.apache.org/viewvc/jakarta/commons/proper/chain/trunk/checkstyle.xml?rev=410386&r1=410385&r2=410386&view=diff ============================================================================== --- jakarta/commons/proper/chain/trunk/checkstyle.xml (original) +++ jakarta/commons/proper/chain/trunk/checkstyle.xml Tue May 30 14:48:31 2006 @@ -58,9 +58,16 @@ <!-- Checks for Javadoc comments. --> <!-- See http://checkstyle.sf.net/config_javadoc.html --> - <module name="JavadocMethod"/> - <module name="JavadocType"/> - <module name="JavadocVariable"/> + <module name="JavadocMethod"> + <property name="scope" value="protected"/> + <property name="allowUndeclaredRTE" value="true"/> + </module> + <module name="JavadocType"> + <property name="scope" value="protected"/> + </module> + <module name="JavadocVariable"> + <property name="scope" value="protected"/> + </module> <!-- Checks for Naming Conventions. --> @@ -93,16 +100,18 @@ <module name="EmptyForIteratorPad"/> <module name="NoWhitespaceAfter"/> <module name="NoWhitespaceBefore"/> - <module name="OperatorWrap"/> + <!-- module name="OperatorWrap"/ --> <module name="TabCharacter"/> - <module name="WhitespaceAfter"/> + <module name="WhitespaceAfter"> + <property name="tokens" value="COMMA, SEMI"/> + </module> <module name="WhitespaceAround"/> <!-- Modifier Checks --> <!-- See http://checkstyle.sf.net/config_modifiers.html --> <module name="ModifierOrder"/> - <module name="RedundantModifier"/> + <!-- module name="RedundantModifier"/ --> <!-- Checks for blocks. You know, those {}'s --> @@ -119,7 +128,7 @@ <module name="DoubleCheckedLocking"/> <!-- MY FAVOURITE --> <module name="EmptyStatement"/> <module name="EqualsHashCode"/> - <module name="HiddenField"/> + <!-- module name="HiddenField"/ --> <module name="IllegalInstantiation"/> <module name="InnerAssignment"/> <module name="MagicNumber"/> Modified: jakarta/commons/proper/chain/trunk/src/java/org/apache/commons/chain/Catalog.java URL: http://svn.apache.org/viewvc/jakarta/commons/proper/chain/trunk/src/java/org/apache/commons/chain/Catalog.java?rev=410386&r1=410385&r2=410386&view=diff ============================================================================== --- jakarta/commons/proper/chain/trunk/src/java/org/apache/commons/chain/Catalog.java (original) +++ jakarta/commons/proper/chain/trunk/src/java/org/apache/commons/chain/Catalog.java Tue May 30 14:48:31 2006 @@ -58,6 +58,7 @@ * * @param name Name for which a [EMAIL PROTECTED] Command} or [EMAIL PROTECTED] Chain} * should be retrieved + * @return The Command associated with the specified name. */ Command getCommand(String name); @@ -67,6 +68,7 @@ * <p>Return an <code>Iterator</code> over the set of named commands * known to this [EMAIL PROTECTED] Catalog}. If there are no known commands, * an empty Iterator is returned.</p> + * @return An iterator of the names in this Catalog. */ Iterator getNames(); Modified: jakarta/commons/proper/chain/trunk/src/java/org/apache/commons/chain/CatalogFactory.java URL: http://svn.apache.org/viewvc/jakarta/commons/proper/chain/trunk/src/java/org/apache/commons/chain/CatalogFactory.java?rev=410386&r1=410385&r2=410386&view=diff ============================================================================== --- jakarta/commons/proper/chain/trunk/src/java/org/apache/commons/chain/CatalogFactory.java (original) +++ jakarta/commons/proper/chain/trunk/src/java/org/apache/commons/chain/CatalogFactory.java Tue May 30 14:48:31 2006 @@ -98,6 +98,7 @@ * <p>Return an <code>Iterator</code> over the set of named * [EMAIL PROTECTED] Catalog}s known to this [EMAIL PROTECTED] CatalogFactory}. * If there are no known catalogs, an empty Iterator is returned.</p> + * @return An Iterator of the names of the Catalogs known by this factory. */ public abstract Iterator getNames(); @@ -124,7 +125,7 @@ * @throws IllegalArgumentException if the commandID contains more than * one DELIMITER */ - public Command getCommand(String commandID) throws IllegalArgumentException { + public Command getCommand(String commandID) { String commandName = commandID; String catalogName = null; @@ -157,7 +158,7 @@ } } - return catalog.getCommand(commandName); + return catalog.getCommand(commandName); } Modified: jakarta/commons/proper/chain/trunk/src/java/org/apache/commons/chain/config/ConfigParser.java URL: http://svn.apache.org/viewvc/jakarta/commons/proper/chain/trunk/src/java/org/apache/commons/chain/config/ConfigParser.java?rev=410386&r1=410385&r2=410386&view=diff ============================================================================== --- jakarta/commons/proper/chain/trunk/src/java/org/apache/commons/chain/config/ConfigParser.java (original) +++ jakarta/commons/proper/chain/trunk/src/java/org/apache/commons/chain/config/ConfigParser.java Tue May 30 14:48:31 2006 @@ -66,6 +66,7 @@ /** * <p>Return the <code>Digester</code> instance to be used for * parsing, creating one if necessary.</p> + * @return A Digester instance. */ public Digester getDigester() { @@ -85,6 +86,7 @@ /** * <p>Return the <code>RuleSet</code> to be used for configuring * our <code>Digester</code> parsing rules, creating one if necessary.</p> + * @return The RuleSet for configuring a Digester instance. */ public RuleSet getRuleSet() { @@ -114,6 +116,7 @@ * <p>Return the "use context class loader" flag. If set to * <code>true</code>, Digester will attempt to instantiate new * command and chain instances from the context class loader.</p> + * @return <code>true</code> if Digester should use the context class loader. */ public boolean getUseContextClassLoader() { Modified: jakarta/commons/proper/chain/trunk/src/java/org/apache/commons/chain/config/ConfigRuleSet.java URL: http://svn.apache.org/viewvc/jakarta/commons/proper/chain/trunk/src/java/org/apache/commons/chain/config/ConfigRuleSet.java?rev=410386&r1=410385&r2=410386&view=diff ============================================================================== --- jakarta/commons/proper/chain/trunk/src/java/org/apache/commons/chain/config/ConfigRuleSet.java (original) +++ jakarta/commons/proper/chain/trunk/src/java/org/apache/commons/chain/config/ConfigRuleSet.java Tue May 30 14:48:31 2006 @@ -91,6 +91,7 @@ /** * <p>Return the fully qualified [EMAIL PROTECTED] Catalog} implementation class.</p> + * @return The Catalog's class name. */ public String getCatalogClass() { return (this.catalogClass); @@ -109,6 +110,7 @@ /** * <p>Return the element name of a catalog element.</p> + * @return The element name of a catalog element. */ public String getCatalogElement() { return (this.catalogElement); @@ -127,6 +129,7 @@ /** * <p>Return the fully qualified [EMAIL PROTECTED] Chain} implementation class.</p> + * @return The Chain's class name. */ public String getChainClass() { return (this.chainClass); @@ -145,6 +148,7 @@ /** * <p>Return the element name of a chain element.</p> + * @return The element name of a catalog element. */ public String getChainElement() { return (this.chainElement); @@ -163,6 +167,7 @@ /** * <p>Return the attribute name of a class attribute.</p> + * @return The attribute name of a class attribute. */ public String getClassAttribute() { return (this.classAttribute); @@ -181,6 +186,7 @@ /** * <p>Return the element name of a command element.</p> + * @return The element name of a command element. */ public String getCommandElement() { return (this.commandElement); @@ -199,6 +205,7 @@ /** * <p>Return the element name of a define element.</p> + * @return The element name of a define element. */ public String getDefineElement() { return (this.defineElement); @@ -217,6 +224,7 @@ /** * <p>Return the attribute name of a name attribute.</p> + * @return The attribute name of an attribute element. */ public String getNameAttribute() { return (this.nameAttribute); Modified: jakarta/commons/proper/chain/trunk/src/java/org/apache/commons/chain/generic/CopyCommand.java URL: http://svn.apache.org/viewvc/jakarta/commons/proper/chain/trunk/src/java/org/apache/commons/chain/generic/CopyCommand.java?rev=410386&r1=410385&r2=410386&view=diff ============================================================================== --- jakarta/commons/proper/chain/trunk/src/java/org/apache/commons/chain/generic/CopyCommand.java (original) +++ jakarta/commons/proper/chain/trunk/src/java/org/apache/commons/chain/generic/CopyCommand.java Tue May 30 14:48:31 2006 @@ -39,6 +39,7 @@ /** * <p>Return the context attribute key for the source attribute.</p> + * @return The source attribute key. */ public String getFromKey() { @@ -64,6 +65,7 @@ /** * <p>Return the context attribute key for the destination attribute.</p> + * @return The destination attribute key. */ public String getToKey() { @@ -89,6 +91,7 @@ /** * <p>Return the literal value to be copied.</p> + * @return The literal value. */ public String getValue() { @@ -119,21 +122,22 @@ * @param context [EMAIL PROTECTED] Context} in which we are operating * * @return <code>false</code> so that processing will continue + * @throws Exception in the if an error occurs during execution. */ public boolean execute(Context context) throws Exception { Object value = this.value; - + if (value == null) { value = context.get(getFromKey()); } - + if (value != null) { context.put(getToKey(), value); } else { context.remove(getToKey()); } - + return (false); } Modified: jakarta/commons/proper/chain/trunk/src/java/org/apache/commons/chain/generic/DispatchCommand.java URL: http://svn.apache.org/viewvc/jakarta/commons/proper/chain/trunk/src/java/org/apache/commons/chain/generic/DispatchCommand.java?rev=410386&r1=410385&r2=410386&view=diff ============================================================================== --- jakarta/commons/proper/chain/trunk/src/java/org/apache/commons/chain/generic/DispatchCommand.java (original) +++ jakarta/commons/proper/chain/trunk/src/java/org/apache/commons/chain/generic/DispatchCommand.java Tue May 30 14:48:31 2006 @@ -1,3 +1,18 @@ +/* + * Copyright 2005-2006 The Apache Software Foundation + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ package org.apache.commons.chain.generic; import org.apache.commons.chain.Command; @@ -8,23 +23,26 @@ import java.util.WeakHashMap; /** - * An abstract base command which uses introspection to look up a method to execute. + * An abstract base command which uses introspection to look up a method to execute. * For use by developers who prefer to group related functionality into a single class * rather than an inheritance family. */ public abstract class DispatchCommand implements Command { + /** Cache of methods */ protected WeakHashMap methods = new WeakHashMap(); + /** Method name */ protected String method = null; + /** Method key */ protected String methodKey = null; /** * The base implementation expects dispatch methods to take a <code>Context</code> * as their only argument. */ - protected static final Class[] DEFAULT_SIGNATURE = new Class[] { Context.class }; + protected static final Class[] DEFAULT_SIGNATURE = new Class[] {Context.class}; /** @@ -36,7 +54,11 @@ * @throws Exception if any is thrown by the invocation. Note that if invoking the method * results in an InvocationTargetException, the cause of that exception is thrown instead of * the exception itself, unless the cause is an <code>Error</code> or other <code>Throwable</code> - * which is not an <code>Exception</code>. + * which is not an <code>Exception</code>. + * + * @param context The Context to be processed by this Command. + * + * @return the result of method being dispatched to. */ public boolean execute(Context context) throws Exception { @@ -52,20 +74,20 @@ Throwable cause = e.getTargetException(); if (cause instanceof Exception) { throw (Exception)cause; - } + } throw e; } } /** - * Extract the dispatch method. The base implementation uses the command's - * <code>method</code> property at the name of a method to look up, or, if that is not defined, - * - * and <code>methodKey</code> - * @param context - * @return + * Extract the dispatch method. The base implementation uses the command's + * <code>method</code> property as the name of a method to look up, or, if that is not defined, + * looks up the the method name in the Context using the <code>methodKey</code>. + * + * @param context The Context being processed by this Command. + * @return The method to execute * @throws NoSuchMethodException if no method can be found under the specified name. - * @throws NullPointerException if no methodName can be determined + * @throws NullPointerException if no methodName cannot be determined */ protected Method extractMethod(Context context) throws NoSuchMethodException { @@ -98,50 +120,67 @@ * 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 * implement other interpretations. - * @param o - * @return + * @param o The result of the methid execution + * @return The evaluated result/ */ protected boolean evaluateResult(Object o) { - + Boolean result = (Boolean) o; return (result != null && result.booleanValue()); - + } /** - * Return a <code>Class[]</code> describing the expected signature of the method - * @return + * Return a <code>Class[]</code> describing the expected signature of the method. + * @return The method signature. */ protected Class[] getSignature() { return DEFAULT_SIGNATURE; } - + /** - * Get the arguments to be passed into the dispatch method. + * Get the arguments to be passed into the dispatch method. * Default implementation simply returns the context which was passed in, but subclasses - * could use this to wrap the context in some other type, or extract key values from the + * could use this to wrap the context in some other type, or extract key values from the * context to pass in. The length and types of values returned by this must coordinate * with the return value of <code>getSignature()</code> - * @param context - * @return + * @param context The Context being processed by this Command. + * @return The method arguments. */ protected Object[] getArguments(Context context) { - return new Object[] { context }; + return new Object[] {context}; } + /** + * Return the method name. + * @return The method name. + */ public String getMethod() { return method; } + + /** + * Return the Context key for the method name. + * @return The Context key for the method name. + */ public String getMethodKey() { return methodKey; } + + /** + * Set the method name. + * @param method The method name. + */ public void setMethod(String method) { this.method = method; } + + /** + * Set the Context key for the method name. + * @param methodKey The Context key for the method name. + */ public void setMethodKey(String methodKey) { this.methodKey = methodKey; } - - } Modified: jakarta/commons/proper/chain/trunk/src/java/org/apache/commons/chain/generic/DispatchLookupCommand.java URL: http://svn.apache.org/viewvc/jakarta/commons/proper/chain/trunk/src/java/org/apache/commons/chain/generic/DispatchLookupCommand.java?rev=410386&r1=410385&r2=410386&view=diff ============================================================================== --- jakarta/commons/proper/chain/trunk/src/java/org/apache/commons/chain/generic/DispatchLookupCommand.java (original) +++ jakarta/commons/proper/chain/trunk/src/java/org/apache/commons/chain/generic/DispatchLookupCommand.java Tue May 30 14:48:31 2006 @@ -24,22 +24,22 @@ import java.util.WeakHashMap; /** - * <p>This command combines elements of the [EMAIL PROTECTED] LookupCommand} with the - * [EMAIL PROTECTED] DispatchCommand}. Look up a specified [EMAIL PROTECTED] Command} (which could - * also be a [EMAIL PROTECTED] Chain}) in a [EMAIL PROTECTED] Catalog}, and delegate execution to - * it. Introspection is used to lookup the appropriate method to delegate - * execution to. If the delegated-to [EMAIL PROTECTED] Command} is also a - * [EMAIL PROTECTED] Filter}, its <code>postprocess()</code> method will also be invoked + * <p>This command combines elements of the [EMAIL PROTECTED] LookupCommand} with the + * [EMAIL PROTECTED] DispatchCommand}. Look up a specified [EMAIL PROTECTED] Command} (which could + * also be a [EMAIL PROTECTED] Chain}) in a [EMAIL PROTECTED] Catalog}, and delegate execution to + * it. Introspection is used to lookup the appropriate method to delegate + * execution to. If the delegated-to [EMAIL PROTECTED] Command} is also a + * [EMAIL PROTECTED] Filter}, its <code>postprocess()</code> method will also be invoked * at the appropriate time.</p> * * <p>The name of the [EMAIL PROTECTED] Command} can be specified either directly (via * the <code>name</code> property) or indirectly (via the <code>nameKey</code> * property). Exactly one of these must be set.</p> * - * <p>The name of the method to be called can be specified either directly + * <p>The name of the method to be called can be specified either directly * (via the <code>method</code> property) or indirectly (via the <code> * methodKey</code> property). Exactly one of these must be set.</p> - * + * * <p>If the <code>optional</code> property is set to <code>true</code>, * failure to find the specified command in the specified catalog will be * silently ignored. Otherwise, a lookup failure will trigger an @@ -54,33 +54,33 @@ // -------------------------------------------------------------- Constructors /** - * Create an instance with an unspecified <code>catalogFactory</code> property. + * Create an instance with an unspecified <code>catalogFactory</code> property. * This property can be set later using <code>setProperty</code>, or if it is not set, - * the static singleton instance from <code>CatalogFactory.getInstance()</code> will be used. - * + * the static singleton instance from <code>CatalogFactory.getInstance()</code> will be used. */ public DispatchLookupCommand() { super(); }; - + /** * Create an instance and initialize the <code>catalogFactory</code> property - * to given <code>factory</code>/ + * to given <code>factory</code>. + * @param factory The Catalog Factory. */ public DispatchLookupCommand(CatalogFactory factory) { super(factory); } - + // ------------------------------------------------------- Static Variables - + /** * 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 WeakHashMap methods = new WeakHashMap(); @@ -89,15 +89,34 @@ private String method = null; private String methodKey = null; + /** + * Return the method name. + * @return The method name. + */ public String getMethod() { return method; } + + /** + * Return the Context key for the method name. + * @return The Context key for the method name. + */ public String getMethodKey() { return methodKey; } + + /** + * Set the method name. + * @param method The method name. + */ public void setMethod(String method) { this.method = method; } + + /** + * Set the Context key for the method name. + * @param methodKey The Context key for the method name. + */ public void setMethodKey(String methodKey) { this.methodKey = methodKey; } @@ -109,8 +128,10 @@ * <p>Look up the specified command, and (if found) execute it.</p> * * @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. * - * @throws Exception if no such [EMAIL PROTECTED] Command} can be found and the + * @throws Exception if no such [EMAIL PROTECTED] Command} can be found and the * <code>optional</code> property is set to <code>false</code> */ public boolean execute(Context context) throws Exception { @@ -122,12 +143,12 @@ } Command command = getCommand(context); - + if (command != null) { Method methodObject = extractMethod(command, context); Object obj = methodObject.invoke(command, getArguments(context)); Boolean result = (Boolean)obj; - + return (result != null && result.booleanValue()); } else { return false; @@ -137,13 +158,13 @@ // ------------------------------------------------------ Protected Methods - + /** - * <p>Return a <code>Class[]</code> describing the expected signature of - * the method. The default is a signature that just accepts the command's - * [EMAIL PROTECTED] Context}. The method can be overidden to provide a different + * <p>Return a <code>Class[]</code> describing the expected signature of + * the method. The default is a signature that just accepts the command's + * [EMAIL PROTECTED] Context}. The method can be overidden to provide a different * method signature.<p> - * + * * @return the expected method signature */ protected Class[] getSignature() { @@ -151,18 +172,18 @@ } /** - * Get the arguments to be passed into the dispatch method. - * Default implementation simply returns the context which was passed in, - * but subclasses could use this to wrap the context in some other type, - * or extract key values from the context to pass in. The length and types - * of values returned by this must coordinate with the return value of + * Get the arguments to be passed into the dispatch method. + * Default implementation simply returns the context which was passed in, + * but subclasses could use this to wrap the context in some other type, + * or extract key values from the context to pass in. The length and types + * of values returned by this must coordinate with the return value of * <code>getSignature()</code> - * + * * @param context The context associated with the request * @return the method arguments to be used */ protected Object[] getArguments(Context context) { - return new Object[] { context }; + return new Object[] {context}; } @@ -170,21 +191,21 @@ /** - * Extract the dispatch method. The base implementation uses the - * command's <code>method</code> property at the name of a method + * Extract the dispatch method. The base implementation uses the + * command's <code>method</code> property at the name of a method * to look up, or, if that is not defined, uses the <code> * methodKey</code> to lookup the method name in the context. - * - * @param command The commmand that contains the method to be + * + * @param command The commmand that contains the method to be * executed. * @param context The context associated with this request * @return the dispatch method - * - * @throws NoSuchMethodException if no method can be found under the + * + * @throws NoSuchMethodException if no method can be found under the * specified name. * @throws NullPointerException if no methodName can be determined */ - private Method extractMethod(Command command, Context context) + private Method extractMethod(Command command, Context context) throws NoSuchMethodException { String methodName = this.getMethod(); @@ -192,7 +213,7 @@ if (methodName == null) { Object methodContextObj = context.get(getMethodKey()); if (methodContextObj == null) { - throw new NullPointerException("No value found in context under " + + throw new NullPointerException("No value found in context under " + getMethodKey()); } methodName = methodContextObj.toString(); @@ -205,7 +226,7 @@ theMethod = (Method) methods.get(methodName); if (theMethod == null) { - theMethod = command.getClass().getMethod(methodName, + theMethod = command.getClass().getMethod(methodName, getSignature()); methods.put(methodName, theMethod); } Modified: jakarta/commons/proper/chain/trunk/src/java/org/apache/commons/chain/generic/LookupCommand.java URL: http://svn.apache.org/viewvc/jakarta/commons/proper/chain/trunk/src/java/org/apache/commons/chain/generic/LookupCommand.java?rev=410386&r1=410385&r2=410386&view=diff ============================================================================== --- jakarta/commons/proper/chain/trunk/src/java/org/apache/commons/chain/generic/LookupCommand.java (original) +++ jakarta/commons/proper/chain/trunk/src/java/org/apache/commons/chain/generic/LookupCommand.java Tue May 30 14:48:31 2006 @@ -49,21 +49,22 @@ /** * Create an instance, setting its <code>catalogFactory</code> property to the - * value of <code>CatalogFactory.getInstance()</code>. - * + * value of <code>CatalogFactory.getInstance()</code>. */ - public LookupCommand() { + public LookupCommand() { this(CatalogFactory.getInstance()); } - + /** * Create an instance and initialize the <code>catalogFactory</code> property * to given <code>factory</code>/ + * + * @param factory The Catalog Factory. */ public LookupCommand(CatalogFactory factory) { this.catalogFactory = factory; } - + // -------------------------------------------------------------- Properties @@ -72,26 +73,29 @@ /** * <p>Set the [EMAIL PROTECTED] CatalogFactory} from which lookups will be * performed.</p> + * + * @param catalogFactory The Catalog Factory. */ public void setCatalogFactory(CatalogFactory catalogFactory) { this.catalogFactory = catalogFactory; } - + /** - * Return the [EMAIL PROTECTED] CatalogFactory} from which lookups will be performed. - * @return + * Return the [EMAIL PROTECTED] CatalogFactory} from which lookups will be performed. + * @return The Catalog factory. */ public CatalogFactory getCatalogFactory() { return this.catalogFactory; } - + private String catalogName = null; /** * <p>Return the name of the [EMAIL PROTECTED] Catalog} to be searched, or * <code>null</code> to search the default [EMAIL PROTECTED] Catalog}.</p> + * @return The Catalog name. */ public String getCatalogName() { @@ -119,6 +123,7 @@ /** * <p>Return the name of the [EMAIL PROTECTED] Command} that we will look up and * delegate execution to.</p> + * @return The name of the Command. */ public String getName() { @@ -146,6 +151,7 @@ /** * <p>Return the context attribute key under which the [EMAIL PROTECTED] Command} * name is stored.</p> + * @return The context key of the Command. */ public String getNameKey() { @@ -173,6 +179,7 @@ /** * <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() { @@ -196,10 +203,12 @@ /** * <p>Return <code>true</code> if this command should ignore - * the return value from executing the looked-up command. - * Defaults to <code>false</code>, which means that the return result + * the return value from executing the looked-up command. + * Defaults to <code>false</code>, which means that the return result * of executing this lookup will be whatever is returned from that * command.</p> + * @return <code>true</code> if result of the looked up Command + * should be ignored. */ public boolean isIgnoreExecuteResult() { return ignoreExecuteResult; @@ -207,22 +216,44 @@ /** * <p>Set the rules for whether or not this class will ignore or - * pass through the value returned from executing the looked up + * pass through the value returned from executing the looked up * command.</p> * <p>If you are looking up a chain which may be "aborted" and - * you do not want this class to stop chain processing, then this + * you do not want this class to stop chain processing, then this * value should be set to <code>true</code></p> - * @param ignoreExecuteResult + * @param ignoreReturn <code>true</code> if result of the + * looked up Command should be ignored. */ public void setIgnoreExecuteResult(boolean ignoreReturn) { this.ignoreExecuteResult = ignoreReturn; } private boolean ignorePostprocessResult = false; - + + /** + * <p>Return <code>true</code> if this command is a Filter and + * should ignore the return value from executing the looked-up Filter's + * <code>postprocess()</code> method. + * Defaults to <code>false</code>, which means that the return result + * of executing this lookup will be whatever is returned from that + * Filter.</p> + * @return <code>true</code> if result of the looked up Filter's + * <code>postprocess()</code> method should be ignored. + */ public boolean isIgnorePostprocessResult() { return ignorePostprocessResult; } + + /** + * <p>Set the rules for whether or not this class will ignore or + * pass through the value returned from executing the looked up + * Filter's <code>postprocess()</code> method.</p> + * <p>If you are looking up a Filter which may be "aborted" and + * you do not want this class to stop chain processing, then this + * value should be set to <code>true</code></p> + * @param ignorePostprocessResult <code>true</code> if result of the + * looked up Filter's <code>postprocess()</code> method should be ignored. + */ public void setIgnorePostprocessResult(boolean ignorePostprocessResult) { this.ignorePostprocessResult = ignorePostprocessResult; } @@ -231,11 +262,11 @@ /** * <p>Look up the specified command, and (if found) execute it. - * Unless <code>ignoreExecuteResult</code> is set to <code>true</code>, + * 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> * property is <code>false</code>, in which case an <code>IllegalArgumentException</code> - * will be thrown. + * will be thrown. * </p> * * @param context The context for this request @@ -243,10 +274,11 @@ * @exception IllegalArgumentException if no such [EMAIL PROTECTED] Command} * 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 + * @return the result of executing the looked-up command, or * <code>false</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 Exception if and error occurs in the looked-up Command. */ public boolean execute(Context context) throws Exception { @@ -271,11 +303,10 @@ * @param context The context for this request * @param exception Any <code>Exception</code> thrown by command execution * - * @exception Exception if thrown by the <code>postprocess()</code> method * @return the result of executing the <code>postprocess</code> method - * of the looked-up command, unless <code>ignorePostprocessResult</code> is + * of the looked-up command, unless <code>ignorePostprocessResult</code> is * <code>true</code>. If no command is found, return <code>false</code>, - * unless the <code>optional</code> property is <code>false</code>, in which + * unless the <code>optional</code> property is <code>false</code>, in which * case <code>IllegalArgumentException</code> will be thrown. */ public boolean postprocess(Context context, Exception exception) { @@ -284,7 +315,9 @@ if (command != null) { if (command instanceof Filter) { boolean result = (((Filter) command).postprocess(context, exception)); - if (isIgnorePostprocessResult()) return false; + if (isIgnorePostprocessResult()) { + return false; + } return result; } } @@ -300,14 +333,16 @@ * <p>Return the [EMAIL PROTECTED] Command} instance to be delegated to.</p> * * @param context [EMAIL PROTECTED] Context} for this request - * + * @return The looked-up Command. * @exception IllegalArgumentException if no such [EMAIL PROTECTED] Command} * can be found and the <code>optional</code> property is set * to <code>false</code> */ protected Command getCommand(Context context) { CatalogFactory lookupFactory = this.catalogFactory; - if (lookupFactory == null) lookupFactory = CatalogFactory.getInstance(); + if (lookupFactory == null) { + lookupFactory = CatalogFactory.getInstance(); + } String catalogName = getCatalogName(); Catalog catalog = null; Modified: jakarta/commons/proper/chain/trunk/src/java/org/apache/commons/chain/generic/RemoveCommand.java URL: http://svn.apache.org/viewvc/jakarta/commons/proper/chain/trunk/src/java/org/apache/commons/chain/generic/RemoveCommand.java?rev=410386&r1=410385&r2=410386&view=diff ============================================================================== --- jakarta/commons/proper/chain/trunk/src/java/org/apache/commons/chain/generic/RemoveCommand.java (original) +++ jakarta/commons/proper/chain/trunk/src/java/org/apache/commons/chain/generic/RemoveCommand.java Tue May 30 14:48:31 2006 @@ -38,6 +38,7 @@ /** * <p>Return the context attribute key for the attribute.</p> + * @return The context attribute key. */ public String getFromKey() { @@ -68,6 +69,7 @@ * @param context [EMAIL PROTECTED] Context} in which we are operating * * @return <code>false</code> so that processing will continue + * @throws Exception if and error occurs. */ public boolean execute(Context context) throws Exception { --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]