commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From hus...@apache.org
Subject cvs commit: jakarta-commons-sandbox/chain/apps/mailreader/src/java/org/apache/commons/chain/mailreader/struts MailReaderAction.java
Date Thu, 08 Apr 2004 23:21:22 GMT
husted      2004/04/08 16:21:22

  Modified:    chain/apps/mailreader/src/java/org/apache/commons/chain/mailreader/struts
                        MailReaderAction.java
  Log:
  Javadoc, refactorings
  
  Revision  Changes    Path
  1.4       +48 -9     jakarta-commons-sandbox/chain/apps/mailreader/src/java/org/apache/commons/chain/mailreader/struts/MailReaderAction.java
  
  Index: MailReaderAction.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons-sandbox/chain/apps/mailreader/src/java/org/apache/commons/chain/mailreader/struts/MailReaderAction.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- MailReaderAction.java	1 Apr 2004 03:37:20 -0000	1.3
  +++ MailReaderAction.java	8 Apr 2004 23:21:22 -0000	1.4
  @@ -23,9 +23,7 @@
   import org.apache.commons.chain.Command;
   import org.apache.commons.chain.Catalog;
   import org.apache.commons.chain.impl.ContextBase;
  -import org.apache.commons.chain.mailreader.ClientContext;
   import org.apache.commons.chain.mailreader.MailReader;
  -import org.apache.commons.chain.mailreader.MailReaderBase;
   import org.apache.commons.beanutils.BeanUtils;
   import org.apache.struts.webapp.example.Constants;
   import org.apache.struts.webapp.example.User;
  @@ -40,7 +38,7 @@
   
   /**
    * <p>Process Commands using a {@link org.apache.commons.chain.mailreader.MailReader}
  - * {@link ClientContext}.</p>
  + * {@link Context}.</p>
    */
   public class MailReaderAction extends Action {
   
  @@ -76,7 +74,7 @@
           Context input = getInput(form);
           UserDatabase database = (UserDatabase)
                   request.getSession().getServletContext().getAttribute(Constants.DATABASE_KEY);
  -        return new MailReaderBase(locale, input, database);
  +        return new MailReader(locale, input, database);
   
       }
   
  @@ -141,6 +139,23 @@
   
       }
   
  +
  +    /**
  +     * <p>
  +     * Validate state, setting messages and returning ActionForward
  +     * if appropriate.
  +     * </p>
  +     */
  +    protected ActionForward checkState(ActionMapping mapping,
  +        ActionForm form,
  +        HttpServletRequest request,
  +        HttpServletResponse response) throws Exception {
  +
  +        // override to provide functionality
  +        return null;
  +
  +    }
  +
       /**
        * <p>
        * Operations to perform prior to executing business command.
  @@ -157,19 +172,43 @@
   
           // TODO: Expose any output
           // TODO: Expose any status messages,
  -        // TODO: Expose any error messages and find input
  +
  +        ActionForward location = checkState(mapping,form,request,response);
  +        if (null!=location) return location;
   
           return null;
   
       }
   
       /**
  +     * <p>
  +     * Token representing a nominal outcome ["success"].
  +     * </p>
  +     */
  +    protected static String SUCCESS = "success";
  +
  +
  +    /**
        * <p>Convenience method to return nominal location.</p>
        * @param mapping Our ActionMapping
        * @return ActionForward named "success" or null
        */
       protected ActionForward findSuccess(ActionMapping mapping) {
  -        return mapping.findForward("success");
  +        return mapping.findForward(SUCCESS);
  +    }
  +
  +
  +    /**
  +     * <p>
  +     * Convenience method to return the Input forward.
  +     * Assumes the InputForward option and input property is set.
  +     * Otherwise, returns <code>null</code>.
  +     * </p>
  +     * @param mapping Our ActionMapping
  +     * @return a forward named "success" or null.
  +     */
  +    protected ActionForward findInput(ActionMapping mapping) {
  +        return mapping.getInputForward();
       }
   
   
  
  
  

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


Mime
View raw message