Author: husted Date: Wed Dec 7 19:53:00 2005 New Revision: 354963 URL: http://svn.apache.org/viewcvs?rev=354963&view=rev Log: MailReader * JavaDoc and organizational tweaks. No code changes.
Modified: struts/apps/trunk/mailreader/src/java/org/apache/struts/apps/mailreader/Constants.java struts/apps/trunk/mailreader/src/java/org/apache/struts/apps/mailreader/actions/BaseAction.java struts/apps/trunk/mailreader/src/java/org/apache/struts/apps/mailreader/actions/LocaleAction.java struts/apps/trunk/mailreader/src/java/org/apache/struts/apps/mailreader/actions/LogoffAction.java struts/apps/trunk/mailreader/src/java/org/apache/struts/apps/mailreader/actions/LogonAction.java struts/apps/trunk/mailreader/src/java/org/apache/struts/apps/mailreader/actions/RegistrationAction.java struts/apps/trunk/mailreader/src/java/org/apache/struts/apps/mailreader/actions/SubscriptionAction.java struts/apps/trunk/mailreader/src/java/org/apache/struts/apps/mailreader/actions/WelcomeAction.java Modified: struts/apps/trunk/mailreader/src/java/org/apache/struts/apps/mailreader/Constants.java URL: http://svn.apache.org/viewcvs/struts/apps/trunk/mailreader/src/java/org/apache/struts/apps/mailreader/Constants.java?rev=354963&r1=354962&r2=354963&view=diff ============================================================================== --- struts/apps/trunk/mailreader/src/java/org/apache/struts/apps/mailreader/Constants.java (original) +++ struts/apps/trunk/mailreader/src/java/org/apache/struts/apps/mailreader/Constants.java Wed Dec 7 19:53:00 2005 @@ -21,163 +21,208 @@ /** - * Manifest constants for the example application. - * + * <p> + * Manifest constants for the MailReader application. + * </p> * @version $Rev$ $Date$ */ public final class Constants { + // --- Tokens ---- /** - * The package name for this application. + * <p> + * The token representing a "create" task. + * </p> */ - public static final String PACKAGE = "org.apache.struts.apps.mailreader"; - + public static final String CREATE = "Create"; /** - * The token representing a "failure" result for this application. + * <p> + * The application scope attribute under which our user database + * is stored. + * </p> */ - public static final String FAILURE = "Failure"; - + public static final String DATABASE_KEY = "database"; /** - * The token representing a "logon" result for this application. + * <p> + * The token representing a "edit" task. + * </p> */ - public static final String LOGON = "Logon"; - + public static final String DELETE = "Delete"; /** - * The token representing a "success" result for this application. + * <p> + * The token representing a "edit" task. + * </p> */ - public static final String SUCCESS = "Success"; - + public static final String EDIT = "Edit"; /** - * The token representing the "action" parameter for this application. + * <p> + * The request attributes key under the WelcomeAction stores an ArrayList + * of error messages, if required resources are missing. + * </p> */ - public static final String ACTION = "action"; - + public static final String ERROR_KEY = "ERROR"; /** - * The token representing a "create" action. + * <p> + * The token representing a "failure" result for this application. + * </p> */ - public static final String CREATE = "Create"; + public static final String FAILURE = "Failure"; + /** + * <p> + * The token representing a "logon" result for this application. + * </p> + */ + public static final String LOGON = "Logon"; /** - * The application scope attribute under which our user database - * is stored. + * <p> + * The package name for this application. + * </p> */ - public static final String DATABASE_KEY = "database"; + public static final String PACKAGE = "org.apache.struts.apps.mailreader"; + /** + * <p> + * The token representing a "save" task. + * </p> + */ + public static final String SAVE = "Save"; /** + * <p> * The session scope attribute under which the Subscription object * currently selected by our logged-in User is stored. + * </p> */ public static final String SUBSCRIPTION_KEY = "subscription"; - /** - * The parameter under which the host name is stored. + * <p> + * The token representing a "success" result for this application. + * </p> */ - public static final String HOST = "host"; + public static final String SUCCESS = "Success"; /** + * <p> * The session scope attribute under which the User object * for the currently logged in user is stored. + * </p> */ public static final String USER_KEY = "user"; + // ---- Error Messages ---- /** + * <p> * A static message in case database resource is not loaded. + * <p> */ public static final String ERROR_DATABASE_NOT_LOADED = "ERROR: User database not loaded -- check servlet container logs for error messages."; - /** + * <p> * A static message in case message resource is not loaded. + * </p> */ public static final String ERROR_MESSAGES_NOT_LOADED = "ERROR: Message resources not loaded -- check servlet container logs for error messages."; + // ---- Error Tokens ---- /** - * The request attributes key under the WelcomeAction stores an ArrayList - * of error messages, if required resources are missing. + * <p> + * The resource key for an error with the transactional token. + * </p> */ - public static final String ERROR_KEY = "ERROR"; + public static final String MSG_TRANSACTION_TOKEN = "error.transaction.token"; + // ---- Log Messages ---- /** - * The message to log when forwarding to a result. + * <p> + * The message to log when cancelling a transaction. + * </p> */ - public static final String LOG_RESULT = " Forwarding to result: "; - + public static final String LOG_CANCEL = " Transaction cancelled: "; /** - * The message to log when forwarding to a 'logon' result. + * <p> + * The message to log when forwarding to a result. + * </p> */ - public static final String LOG_LOGON = LOG_RESULT + LOGON ; - + public static final String LOG_RESULT = " Forwarding to result: "; /** + * <p> * The message to log when forwarding to a 'failure' result. + * <p> */ public static final String LOG_FAILURE = LOG_RESULT + FAILURE ; - /** - * The message to log when forwarding to a 'success' result. + * <p> + * The message to log when forwarding to a 'logon' result. + * </p> */ - public static final String LOG_SUCCESS = LOG_RESULT + SUCCESS ; - + public static final String LOG_LOGON = LOG_RESULT + LOGON ; /** + * <p> * The message to log when populating a form. + * </p> */ public static final String LOG_POPULATE_FORM = " Populating form from: "; /** + * <p> * The message to log when populating a subscription. + * </p> */ public static final String LOG_POPULATE_SUBSCRIPTION = " Populating subscription: "; /** + * <p> * The message to log when populating a user. + * </p> */ public static final String LOG_POPULATE_USER = " Populating user: "; /** + * <p> * The message to log when forwarding to a 'success' result. + * </p> */ public static final String LOG_PROCESSING = " Processing: "; - /** - * The message to log when cancelling a transaction. + * <p> + * The message to log when forwarding to a 'success' result. + * </p> */ - public static final String LOG_CANCEL = " Transaction cancelled: "; - + public static final String LOG_SUCCESS = LOG_RESULT + SUCCESS ; /** + * <p> * The message to log when setting a transactional token. + * </p> */ public static final String LOG_TOKEN = " Setting transactional control token"; - /** + * <p> * The message to log when checking a transactional token. + * </p> */ public static final String LOG_TOKEN_CHECK = " Checking transactional control token"; - - - /** - * The resource key for an error with the transactional token. - */ - public static final String MSG_TRANSACTION_TOKEN = "error.transaction.token"; } Modified: struts/apps/trunk/mailreader/src/java/org/apache/struts/apps/mailreader/actions/BaseAction.java URL: http://svn.apache.org/viewcvs/struts/apps/trunk/mailreader/src/java/org/apache/struts/apps/mailreader/actions/BaseAction.java?rev=354963&r1=354962&r2=354963&view=diff ============================================================================== --- struts/apps/trunk/mailreader/src/java/org/apache/struts/apps/mailreader/actions/BaseAction.java (original) +++ struts/apps/trunk/mailreader/src/java/org/apache/struts/apps/mailreader/actions/BaseAction.java Wed Dec 7 19:53:00 2005 @@ -52,7 +52,7 @@ */ public class BaseAction extends MappingDispatchAction { - // ----------------------------------------------------- Instance Variables + // ---- Protected Variables ---- /** * <p> @@ -61,7 +61,7 @@ */ protected Log log = LogFactory.getLog(Constants.PACKAGE); - // ------------------------------------------------------ Protected Methods + // ---- Protected Methods ---- /** * <p>Store User object in client session. Modified: struts/apps/trunk/mailreader/src/java/org/apache/struts/apps/mailreader/actions/LocaleAction.java URL: http://svn.apache.org/viewcvs/struts/apps/trunk/mailreader/src/java/org/apache/struts/apps/mailreader/actions/LocaleAction.java?rev=354963&r1=354962&r2=354963&view=diff ============================================================================== --- struts/apps/trunk/mailreader/src/java/org/apache/struts/apps/mailreader/actions/LocaleAction.java (original) +++ struts/apps/trunk/mailreader/src/java/org/apache/struts/apps/mailreader/actions/LocaleAction.java Wed Dec 7 19:53:00 2005 @@ -30,12 +30,16 @@ /** - * <p>Change user's Struts [EMAIL PROTECTED] java.util.Locale}.</p> + * <p> + * Change user's Struts [EMAIL PROTECTED] java.util.Locale}. + * </p> */ public final class LocaleAction extends BaseAction { /** - * <p>Return true if parameter is null or trims to empty.</p> + * <p> + * Return true if parameter is null or trims to empty. + * </p> * @param string The string to text; may be null * @return true if parameter is null or empty */ @@ -44,30 +48,37 @@ } /** - * <p>Parameter for [EMAIL PROTECTED] java.util.Locale} language property. - * ["language"]</p> + * <p> + * Parameter for [EMAIL PROTECTED] java.util.Locale} language property. ["language"] + * </p> */ private static final String LANGUAGE = "language" ; /** - * <p>Parameter for [EMAIL PROTECTED] java.util.Locale} country property. - * ["country"]</p> + * <p> + * Parameter for [EMAIL PROTECTED] java.util.Locale} country property. ["country"] + * </p> */ private static final String COUNTRY = "country"; /** - * <p>Parameter for response page URI. ["page"]</p> + * <p> + * Parameter for response page URI. ["page"] + * </p> */ private static final String PAGE = "page"; /** - * <p>Parameter for response forward name. - * ["forward"]</p> + * <p> + * Parameter for response forward name. ["forward"] + * </p> */ private static final String FORWARD = "forward"; /** - * <p>Logging message if LocaleAction is missing a target parameter.</p> + * <p> + * Logging message if LocaleAction is missing a target parameter. + * </p> */ private static final String LOCALE_LOG = "LocaleAction: Missing page or forward parameter"; Modified: struts/apps/trunk/mailreader/src/java/org/apache/struts/apps/mailreader/actions/LogoffAction.java URL: http://svn.apache.org/viewcvs/struts/apps/trunk/mailreader/src/java/org/apache/struts/apps/mailreader/actions/LogoffAction.java?rev=354963&r1=354962&r2=354963&view=diff ============================================================================== --- struts/apps/trunk/mailreader/src/java/org/apache/struts/apps/mailreader/actions/LogoffAction.java (original) +++ struts/apps/trunk/mailreader/src/java/org/apache/struts/apps/mailreader/actions/LogoffAction.java Wed Dec 7 19:53:00 2005 @@ -1,14 +1,14 @@ /* - * $Id$ + * $Id$ * * Copyright 1999-2004 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. @@ -35,8 +35,6 @@ * @version $Rev$ $Date$ */ public final class LogoffAction extends BaseAction { - - // --------------------------------------------------------- Public Methods // See superclass for Javadoc public ActionForward execute( Modified: struts/apps/trunk/mailreader/src/java/org/apache/struts/apps/mailreader/actions/LogonAction.java URL: http://svn.apache.org/viewcvs/struts/apps/trunk/mailreader/src/java/org/apache/struts/apps/mailreader/actions/LogonAction.java?rev=354963&r1=354962&r2=354963&view=diff ============================================================================== --- struts/apps/trunk/mailreader/src/java/org/apache/struts/apps/mailreader/actions/LogonAction.java (original) +++ struts/apps/trunk/mailreader/src/java/org/apache/struts/apps/mailreader/actions/LogonAction.java Wed Dec 7 19:53:00 2005 @@ -1,5 +1,5 @@ /* - * $Id$ + * $Id$ * * Copyright 2000-2004 Apache Software Foundation * @@ -28,29 +28,36 @@ import org.apache.struts.apps.mailreader.dao.UserDatabase; /** - * <p>Validate a user logon.</p> + * <p> + * Validate a user logon. + * </p> * * @version $Rev$ $Date$ */ public final class LogonAction extends BaseAction { /** + * <p> * Name of username field ["username"]. + * </p> */ public static String USERNAME = "username"; /** + * <p> * Name of password field ["password"]. + * </p> */ public static String PASSWORD = "password"; // ---- Public Methods ---- /** + * <p> * Use "username" and "password" fields from ActionForm to retrieve a User * object from the database. If credentials are not valid, or database * has disappeared, post error messages and forward to input. - * + * </p> * @param mapping The ActionMapping used to select this instance * @param form The optional ActionForm bean for this request (if any) * @param request The HTTP request we are processing Modified: struts/apps/trunk/mailreader/src/java/org/apache/struts/apps/mailreader/actions/RegistrationAction.java URL: http://svn.apache.org/viewcvs/struts/apps/trunk/mailreader/src/java/org/apache/struts/apps/mailreader/actions/RegistrationAction.java?rev=354963&r1=354962&r2=354963&view=diff ============================================================================== --- struts/apps/trunk/mailreader/src/java/org/apache/struts/apps/mailreader/actions/RegistrationAction.java (original) +++ struts/apps/trunk/mailreader/src/java/org/apache/struts/apps/mailreader/actions/RegistrationAction.java Wed Dec 7 19:53:00 2005 @@ -24,8 +24,7 @@ * <p> * Provide an Edit method for retrieving an existing user, * and a Save method for updating or inserting a user. - * </p> - * <p> + * </p><p> * Both methods utilize a RegistrationForm to obtain or expose User details. * If Save is used to create a user, * additional validations ensure input is nominal. @@ -38,42 +37,61 @@ // --- Public Constants -- /** + * <p> * Name of task field ["task"]. + * </p> */ public final static String TASK = "task"; /** + * <p> * Name of fromAddress field ["fromAddress"]. + * </p> */ public final static String FROM_ADDRESS = "fromAddress"; /** + * <p> * Name of fullName field ["fullName"]. + * </p> */ public final static String FULL_NAME = "fullName"; /** + * <p> * Name of password field ["password"]. + * </p> */ public final static String PASSWORD = "password"; /** + * <p> * Name of password2 field ["password2"]. + * </p> */ public final static String PASSWORD2 = "password2"; /** + * <p> * Name of replyToAddress field ["replyToAddress"]. + * </p> */ public final static String REPLY_TO_ADDRESS = "replyToAddress"; /** + * <p> * Name of username field ["username"]. + * </p> */ public final static String USERNAME = "username"; // ---- Private Methods ---- + /** + * <p> + * The message prefix to use when populating a Registration Form. + * </p> + */ final String LOG_REGISTRATION_POPULATE = "RegistrationForm.populate"; /** @@ -163,7 +181,7 @@ */ private void doPopulate(ActionForm form, User user) throws ServletException { - final String title = "Edit"; + final String title = Constants.EDIT; if (log.isTraceEnabled()) { log.trace(Constants.LOG_POPULATE_FORM + user); @@ -270,7 +288,7 @@ HttpServletResponse response) throws Exception { - final String method = "Edit"; + final String method = Constants.EDIT; doLogProcess(mapping,method); HttpSession session = request.getSession(); @@ -287,8 +305,7 @@ /** * <p> * Insert or update a User object to the persistent store. - * </p> - * <p> + * </p><p> * If a User is not logged in, * then a new User is created and automatically logged in. * Otherwise, the existing User is updated. @@ -307,7 +324,7 @@ HttpServletResponse response) throws Exception { - final String method = "Save"; + final String method = Constants.SAVE; doLogProcess(mapping,method); HttpSession session = request.getSession(); Modified: struts/apps/trunk/mailreader/src/java/org/apache/struts/apps/mailreader/actions/SubscriptionAction.java URL: http://svn.apache.org/viewcvs/struts/apps/trunk/mailreader/src/java/org/apache/struts/apps/mailreader/actions/SubscriptionAction.java?rev=354963&r1=354962&r2=354963&view=diff ============================================================================== --- struts/apps/trunk/mailreader/src/java/org/apache/struts/apps/mailreader/actions/SubscriptionAction.java (original) +++ struts/apps/trunk/mailreader/src/java/org/apache/struts/apps/mailreader/actions/SubscriptionAction.java Wed Dec 7 19:53:00 2005 @@ -58,6 +58,15 @@ final String LOG_SUBSCRIPTION_POPULATE = "SubscriptionForm.populate"; + /** + * <p> + * Obtain subscription matching host for the given User, + * or return null if not found. + * </p> + * @param user Our User object + * @param host The name of the mail server host + * @return The matching Subscription or null + */ private Subscription doFindSubscription(User user, String host) { Subscription subscription; @@ -118,7 +127,7 @@ */ private void doPopulate(ActionForm form, Subscription subscription) throws ServletException { - final String title = "Edit"; + final String title = Constants.EDIT; if (log.isTraceEnabled()) { log.trace(Constants.LOG_POPULATE_FORM + subscription.getHost()); @@ -154,7 +163,7 @@ Subscription subscription) throws ServletException { - final String method = "Delete"; + final String method = Constants.DELETE; doLogProcess(mapping,method); if (log.isTraceEnabled()) { @@ -199,7 +208,7 @@ HttpServletResponse response) throws Exception { - final String method = "Delete"; + final String method = Constants.DELETE; doLogProcess(mapping,method); ActionForward result = Edit(mapping,form,request,response); @@ -231,7 +240,7 @@ HttpServletResponse response) throws Exception { - final String method = "Edit"; + final String method = Constants.EDIT; doLogProcess(mapping,method); HttpSession session = request.getSession(); @@ -271,7 +280,7 @@ HttpServletResponse response) throws Exception { - final String method = "Save"; + final String method = Constants.SAVE; doLogProcess(mapping,method); User user = doGetUser(request); @@ -287,7 +296,7 @@ String action = doGet(form,TASK); Subscription subscription = doGetSubscription(request); - boolean isDelete = action.equals("Delete"); + boolean isDelete = action.equals(Constants.DELETE); if (isDelete) { return doRemoveSubscription(mapping,session,user,subscription); } Modified: struts/apps/trunk/mailreader/src/java/org/apache/struts/apps/mailreader/actions/WelcomeAction.java URL: http://svn.apache.org/viewcvs/struts/apps/trunk/mailreader/src/java/org/apache/struts/apps/mailreader/actions/WelcomeAction.java?rev=354963&r1=354962&r2=354963&view=diff ============================================================================== --- struts/apps/trunk/mailreader/src/java/org/apache/struts/apps/mailreader/actions/WelcomeAction.java (original) +++ struts/apps/trunk/mailreader/src/java/org/apache/struts/apps/mailreader/actions/WelcomeAction.java Wed Dec 7 19:53:00 2005 @@ -1,5 +1,5 @@ /* - * $Id$ + * $Id$ * * Copyright 2000-2004 Apache Software Foundation * @@ -33,13 +33,11 @@ /** * <p> * Confirm required resources are available before displaying initial page. - * </p> - * <p> + * </p><p> * If a resource is missing, * forward to "failure". Otherwise, forward to "success", where * success is usually the "welcome" page. - * </p> - * <p> + * </p><p> * Since "required resources" includes the application MessageResources * the failure page must not use the standard error or message tags. * Instead, it display the Strings stored in an ArrayList stored under @@ -49,8 +47,6 @@ * @version $Rev$ $Date$ */ public final class WelcomeAction extends BaseAction { - - // --------------------------------------------------------- Public Methods // See superclass for Javadoc public ActionForward execute( --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]