Commits

Anonymous committed 4fff93c

Comments (0)

Files changed (7)

src/java/com/opensymphony/xwork/Action.java

 
 
 /**
- * All Actions must minimally implement this interface. It provides the
- * execute methodName, which is done by actions to perform whatever their
- * purpose is.
+ * All Actions must minimally implement this interface, which exposes
+ * the execute() method.
  *
  * @author $Author$
  * @version $Revision$
     //~ Methods ////////////////////////////////////////////////////////////////
 
     /**
-     * This methodName is where the logic of the action is executed.
-     * Parameters are passed by calling set-methods, or by implementing
-     * the ParameterAware interface.
+     * Where the logic of the action is executed.
      *
      * @return     a string representing the logical result of the execution.
      * See constants in this interface for a list of standard result values.

src/java/com/opensymphony/xwork/ActionSupport.java

 
 
 /**
- * User: Mike
- * Date: May 27, 2003
- * Time: 3:45:29 PM
+ * Provides a default implementation for the most common actions.
+ * See the documentation for all the interfaces this class implements for more detailed information.
  */
 public class ActionSupport implements Action, Serializable, Validateable, ValidationAware, TextProvider, LocaleProvider {
     //~ Static fields/initializers /////////////////////////////////////////////
         validationAware.addFieldError(fieldName, errorMessage);
     }
 
+    /**
+     * A default implementation that does nothing an returns "success".
+     *
+     * @return {@link #SUCCESS}
+     */
     public String execute() throws Exception {
         return SUCCESS;
     }
     }
 
     /**
+     * A default implementation that validates nothing.
      * Subclasses should override this method to provide validations.
      */
     public void validate() {

src/java/com/opensymphony/xwork/Validateable.java

 
 
 /**
- * Validateable provides an Interface for Actions which can be validated.
+ * Provides an interface in which a call for a validation check can be done. 
+ *
  * @author Jason Carreira
  * @see ActionSupport
  * @see com.opensymphony.xwork.interceptor.DefaultWorkflowInterceptor
- * Created Aug 29, 2003 1:42:21 PM
  */
 public interface Validateable {
     //~ Methods ////////////////////////////////////////////////////////////////

src/java/com/opensymphony/xwork/ValidationAware.java

     //~ Methods ////////////////////////////////////////////////////////////////
 
     /**
- * Set the Collection of Action level String error messages
- * @param errorMessages
- */
+     * Set the Collection of Action level String error messages
+     *
+     * @param errorMessages
+     */
     void setActionErrors(Collection errorMessages);
 
     /**
-* Get the Collection of Action level error messages for this action. Error messages should not be added directly
-* here, as implementations are free to return a new Collection or an Unmodifiable Collection.
-*
-* @return Collection of String error messages
-*/
+     * Get the Collection of Action level error messages for this action. Error messages should not be added directly
+     * here, as implementations are free to return a new Collection or an Unmodifiable Collection.
+     *
+     * @return Collection of String error messages
+     */
     Collection getActionErrors();
 
     /**
- *  Set the field error map of fieldname (String) to Collection of String error messages
- * @param errorMap
- */
+     * Set the field error map of fieldname (String) to Collection of String error messages
+     *
+     * @param errorMap
+     */
     void setFieldErrors(Map errorMap);
 
     /**
-* Get the field specific errors associated with this action. Error messages should not be added directly
-* here, as implementations are free to return a new Collection or an Unmodifiable Collection.
-*
-* @return Map with errors mapped from fieldname (String) to Collection of String error messages
-*/
+     * Get the field specific errors associated with this action. Error messages should not be added directly
+     * here, as implementations are free to return a new Collection or an Unmodifiable Collection.
+     *
+     * @return Map with errors mapped from fieldname (String) to Collection of String error messages
+     */
     Map getFieldErrors();
 
     /**
-* Add an Action level error message to this Action
-*
-* @param   anErrorMessage
-*/
+     * Add an Action level error message to this Action
+     *
+     * @param anErrorMessage
+     */
     void addActionError(String anErrorMessage);
 
     /**
-* Add an error message for a given field
-*
-* @param   fieldName  name of field
-* @param   errorMessage  the error message
-*/
+     * Add an error message for a given field
+     *
+     * @param fieldName    name of field
+     * @param errorMessage the error message
+     */
     void addFieldError(String fieldName, String errorMessage);
 
     /**
-* Check whether there are any Action level error messages
-*
-* @return true if any Action level error messages have been registered
-*/
+     * Check whether there are any Action level error messages
+     *
+     * @return true if any Action level error messages have been registered
+     */
     boolean hasActionErrors();
 
     /**
- * @return (hasActionErrors() || hasFieldErrors())
- */
+     * @return (hasActionErrors() || hasFieldErrors())
+     */
     boolean hasErrors();
 
     /**
-* Check whether there are any field errors associated with this action.
-*
-* @return     whether there are any field errors
-*/
+     * Check whether there are any field errors associated with this action.
+     *
+     * @return whether there are any field errors
+     */
     boolean hasFieldErrors();
 }

src/java/com/opensymphony/xwork/interceptor/AroundInterceptor.java

 /**
  * AroundInterceptor
  *
- * Created : Jan 7, 2003 10:38:50 PM
- *
  * @author Jason Carreira
  */
 public abstract class AroundInterceptor implements Interceptor {

src/java/com/opensymphony/xwork/interceptor/DefaultWorkflowInterceptor.java

 
 
 /**
- * DefaultWorkflowInterceptor
+ * An interceptor that does some basic validation workflow before allowing the interceptor chain to continue.
+ * The order of execution in the workflow is:
+ *
+ * <ol>
+ *  <li>If the action being executed implements {@link Validateable}, the action's
+ *      {@link Validateable#validate() validate} method is called.</li>
+ *  <li>Next, if the action implements {@link ValidationAware}, the action's
+ *      {@link ValidationAware#hasErrors() hasErrors} method is called. If this
+ *      method returns true, this interceptor stops the chain from continuing and
+ *      immediately returns {@link Action#INPUT}</li>
+ * </ol>
+ *
+ * <i>Note: if the action doesn't implement either interface, this interceptor effectively does nothing.</i>
+ *
  * @author Jason Carreira
- * Created Jul 2, 2003 9:50:10 PM
  */
 public class DefaultWorkflowInterceptor implements Interceptor {
     //~ Methods ////////////////////////////////////////////////////////////////
 
-    /**
-     * Called to let an interceptor clean up any resources it has allocated.
-     */
     public void destroy() {
     }
 
-    /**
-     * Called after an Interceptor is created, but before any requests are processed using the intercept() methodName. This
-     * gives the Interceptor a chance to initialize any needed resources.
-     */
     public void init() {
     }
 
-    /**
-     * Allows the Interceptor to do some processing on the request before and/or after the rest of the processing of the
-     * request by the DefaultActionInvocation or to short-circuit the processing and just return a String return code.
-     *
-     * @param invocation
-     * @return
-     * @throws Exception
-     */
     public String intercept(ActionInvocation invocation) throws Exception {
         Action action = invocation.getAction();
 

src/java/com/opensymphony/xwork/util/TextParseUtil.java

 
 
 /**
- * TextParseUtil
+ * Utility class for text parsing.
+ *
  * @author Jason Carreira
  * Created Feb 10, 2003 8:55:11 PM
  */
 public class TextParseUtil {
     //~ Methods ////////////////////////////////////////////////////////////////
 
+    /**
+     * Converts all instances of ${...} in <code>expression</code> to the value returned
+     * by a call to {@link OgnlValueStack#findValue(java.lang.String)}. If an item cannot
+     * be found on the stack (null is returned), then the entire variable ${...} is not
+     * displayed, just as if the item was on the stack but returned an empty string.
+     *
+     * @param expression an expression that hasn't yet been translated
+     * @return the parsed expression
+     */
     public static String translateVariables(String expression, OgnlValueStack stack) {
         while (true) {
             int x = expression.indexOf("${");