Author: jmitchell Date: Thu Nov 3 05:10:35 2005 New Revision: 330544 URL: http://svn.apache.org/viewcvs?rev=330544&view=rev Log: Summary of changes: * mailreader now works with mailreader-dao-1.3.0 (make sure you have the latest version that does not depend on struts-core) * fix Spring Web Flow package changes
Modified: struts/shale/trunk/core-library/src/java/org/apache/shale/spring/webflow/WebFlowNavigationHandler.java struts/shale/trunk/core-library/src/java/org/apache/shale/spring/webflow/WebFlowNavigationStrategy.java struts/shale/trunk/mailreader/src/java/org/apache/shale/examples/mailreader/ApplicationListener.java struts/shale/trunk/mailreader/src/java/org/apache/shale/examples/mailreader/BaseViewController.java struts/shale/trunk/mailreader/src/java/org/apache/shale/examples/mailreader/Logon.java struts/shale/trunk/mailreader/src/java/org/apache/shale/examples/mailreader/MainMenu.java struts/shale/trunk/mailreader/src/java/org/apache/shale/examples/mailreader/Registration.java struts/shale/trunk/mailreader/src/java/org/apache/shale/examples/mailreader/State.java struts/shale/trunk/mailreader/src/java/org/apache/shale/examples/mailreader/Subscription.java struts/shale/trunk/mailreader/src/web/WEB-INF/faces-config.xml struts/shale/trunk/mailreader/src/web/subscription.jsp Modified: struts/shale/trunk/core-library/src/java/org/apache/shale/spring/webflow/WebFlowNavigationHandler.java URL: http://svn.apache.org/viewcvs/struts/shale/trunk/core-library/src/java/org/apache/shale/spring/webflow/WebFlowNavigationHandler.java?rev=330544&r1=330543&r2=330544&view=diff ============================================================================== --- struts/shale/trunk/core-library/src/java/org/apache/shale/spring/webflow/WebFlowNavigationHandler.java (original) +++ struts/shale/trunk/core-library/src/java/org/apache/shale/spring/webflow/WebFlowNavigationHandler.java Thu Nov 3 05:10:35 2005 @@ -22,9 +22,9 @@ import org.apache.commons.logging.LogFactory; import org.springframework.web.context.WebApplicationContext; import org.springframework.web.jsf.FacesContextUtils; -import org.springframework.webflow.ViewDescriptor; -import org.springframework.webflow.execution.FlowExecutionManager; -import org.springframework.webflow.execution.servlet.ServletFlowExecutionManager; +import org.springframework.web.flow.ViewDescriptor; +import org.springframework.web.flow.execution.FlowExecutionManager; +import org.springframework.web.flow.execution.servlet.ServletFlowExecutionManager; /** Modified: struts/shale/trunk/core-library/src/java/org/apache/shale/spring/webflow/WebFlowNavigationStrategy.java URL: http://svn.apache.org/viewcvs/struts/shale/trunk/core-library/src/java/org/apache/shale/spring/webflow/WebFlowNavigationStrategy.java?rev=330544&r1=330543&r2=330544&view=diff ============================================================================== --- struts/shale/trunk/core-library/src/java/org/apache/shale/spring/webflow/WebFlowNavigationStrategy.java (original) +++ struts/shale/trunk/core-library/src/java/org/apache/shale/spring/webflow/WebFlowNavigationStrategy.java Thu Nov 3 05:10:35 2005 @@ -21,10 +21,10 @@ import javax.faces.context.FacesContext; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; -import org.springframework.webflow.Event; -import org.springframework.webflow.ViewDescriptor; -import org.springframework.webflow.execution.FlowExecutionManager; -import org.springframework.webflow.execution.servlet.ServletEvent; +import org.springframework.web.flow.Event; +import org.springframework.web.flow.ViewDescriptor; +import org.springframework.web.flow.execution.FlowExecutionManager; +import org.springframework.web.flow.execution.servlet.ServletEvent; /** * <p>Strategy methods for [EMAIL PROTECTED] WebFlowNavigationHandler}. Because a JSF Modified: struts/shale/trunk/mailreader/src/java/org/apache/shale/examples/mailreader/ApplicationListener.java URL: http://svn.apache.org/viewcvs/struts/shale/trunk/mailreader/src/java/org/apache/shale/examples/mailreader/ApplicationListener.java?rev=330544&r1=330543&r2=330544&view=diff ============================================================================== --- struts/shale/trunk/mailreader/src/java/org/apache/shale/examples/mailreader/ApplicationListener.java (original) +++ struts/shale/trunk/mailreader/src/java/org/apache/shale/examples/mailreader/ApplicationListener.java Thu Nov 3 05:10:35 2005 @@ -33,7 +33,8 @@ import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; -import org.apache.struts.examples.mailreader.memory.MemoryUserDatabase; +import org.apache.struts.apps.mailreader.dao.UserDatabase; +import org.apache.struts.apps.mailreader.dao.impl.memory.MemoryUserDatabase; /** * <p><code>ServletContextListener</code> that initializes and finalizes the Modified: struts/shale/trunk/mailreader/src/java/org/apache/shale/examples/mailreader/BaseViewController.java URL: http://svn.apache.org/viewcvs/struts/shale/trunk/mailreader/src/java/org/apache/shale/examples/mailreader/BaseViewController.java?rev=330544&r1=330543&r2=330544&view=diff ============================================================================== --- struts/shale/trunk/mailreader/src/java/org/apache/shale/examples/mailreader/BaseViewController.java (original) +++ struts/shale/trunk/mailreader/src/java/org/apache/shale/examples/mailreader/BaseViewController.java Thu Nov 3 05:10:35 2005 @@ -19,7 +19,7 @@ import javax.faces.context.FacesContext; import javax.faces.el.ValueBinding; import org.apache.shale.view.AbstractViewController; -import org.apache.struts.examples.mailreader.UserDatabase; +import org.apache.struts.apps.mailreader.dao.UserDatabase;; /** * <p>Convenience abstract base <code>ViewController</code> Modified: struts/shale/trunk/mailreader/src/java/org/apache/shale/examples/mailreader/Logon.java URL: http://svn.apache.org/viewcvs/struts/shale/trunk/mailreader/src/java/org/apache/shale/examples/mailreader/Logon.java?rev=330544&r1=330543&r2=330544&view=diff ============================================================================== --- struts/shale/trunk/mailreader/src/java/org/apache/shale/examples/mailreader/Logon.java (original) +++ struts/shale/trunk/mailreader/src/java/org/apache/shale/examples/mailreader/Logon.java Thu Nov 3 05:10:35 2005 @@ -17,11 +17,11 @@ package org.apache.shale.examples.mailreader; import javax.faces.application.FacesMessage; + import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; -import org.apache.shale.view.AbstractViewController; -import org.apache.struts.examples.mailreader.User; -import org.apache.struts.examples.mailreader.UserDatabase; +import org.apache.struts.apps.mailreader.dao.ExpiredPasswordException; +import org.apache.struts.apps.mailreader.dao.User; /** * <p><code>ViewController</code> for the <code>logon</code> page.</p> @@ -48,22 +48,50 @@ * <p>The password input field.</p> */ private String password = null; - public String getPassword() { return this.password; } - public void setPassword(String password) { this.password = password; } /** * <p>The username input field.</p> */ private String username = null; - public String getUsername() { return this.username; } - public void setUsername(String username) { this.username = username; } + + + /** + * @return Returns the password. + */ + public String getPassword() { + return this.password; + } + + + /** + * @param password The password to set. + */ + public void setPassword(String password) { + this.password = password; + } + + + /** + * @return Returns the username. + */ + public String getUsername() { + return this.username; + } + + + /** + * @param username The username to set. + */ + public void setUsername(String username) { + this.username = username; + } // ---------------------------------------------------------- Event Handlers - /** + /** * <p>Authenticate this user and proceed based on the results.</p> */ public String logon() { @@ -72,7 +100,12 @@ log.debug("logon(" + username + "," + password + ")"); } - User user = getUserDatabase().findUser(username); + User user = null; + try { + user = getUserDatabase().findUser(username); + } catch (ExpiredPasswordException e) { + log.debug(e.getCause()); + } if ((user != null) && (user.getPassword().equals(password))) { getState().setUser(user); return "success"; Modified: struts/shale/trunk/mailreader/src/java/org/apache/shale/examples/mailreader/MainMenu.java URL: http://svn.apache.org/viewcvs/struts/shale/trunk/mailreader/src/java/org/apache/shale/examples/mailreader/MainMenu.java?rev=330544&r1=330543&r2=330544&view=diff ============================================================================== --- struts/shale/trunk/mailreader/src/java/org/apache/shale/examples/mailreader/MainMenu.java (original) +++ struts/shale/trunk/mailreader/src/java/org/apache/shale/examples/mailreader/MainMenu.java Thu Nov 3 05:10:35 2005 @@ -16,6 +16,9 @@ package org.apache.shale.examples.mailreader; +import org.apache.commons.beanutils.BeanUtils; +import org.apache.struts.apps.mailreader.dao.User; + /** * <p><code>ViewController</code> for the <code>index</code> page.</p> * @@ -37,6 +40,14 @@ public String edit() { getState().setMode("EDIT"); + Registration registration = (Registration)getBean("registration"); + try { + User user = getState().getUser(); + BeanUtils.copyProperties(registration, user); + } catch (Exception e) { + // display something + e.printStackTrace(); + } return "registration"; } Modified: struts/shale/trunk/mailreader/src/java/org/apache/shale/examples/mailreader/Registration.java URL: http://svn.apache.org/viewcvs/struts/shale/trunk/mailreader/src/java/org/apache/shale/examples/mailreader/Registration.java?rev=330544&r1=330543&r2=330544&view=diff ============================================================================== --- struts/shale/trunk/mailreader/src/java/org/apache/shale/examples/mailreader/Registration.java (original) +++ struts/shale/trunk/mailreader/src/java/org/apache/shale/examples/mailreader/Registration.java Thu Nov 3 05:10:35 2005 @@ -17,11 +17,13 @@ package org.apache.shale.examples.mailreader; import javax.faces.application.FacesMessage; + import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; -import org.apache.struts.examples.mailreader.Subscription; -import org.apache.struts.examples.mailreader.User; -import org.apache.struts.examples.mailreader.UserDatabase; +import org.apache.struts.apps.mailreader.dao.ExpiredPasswordException; +import org.apache.struts.apps.mailreader.dao.Subscription; +import org.apache.struts.apps.mailreader.dao.User; +import org.apache.struts.apps.mailreader.dao.UserDatabase; /** * <p><code>ViewController</code> for the <code>registration</code> page.</p> @@ -48,58 +50,145 @@ * <p>The logon username for this user.</p> */ private String username = null; - public String getUsername() { return this.username; } - public void setUsername(String username) { this.username = username; } - /** * <p>The login password for this user.</p> */ private String password = null; - public String getPassword() { return this.password; } - public void setPassword(String password) { this.password = password; } - /** * <p>The confirmation password for this user.</p> */ private String password2 = null; - public String getPassword2() { return this.password2; } - public void setPassword2(String password2) { this.password2 = password2; } - /** * <p>The full name of this user.</p> */ private String fullName = null; - public String getFullName() { return this.fullName; } - public void setFullName(String fullName) { this.fullName = fullName; } - /** * <p>The from address of this user.</p> */ private String fromAddress = null; - public String getFromAddress() { return this.fromAddress; } - public void setFromAddress(String fromAddress) { this.fromAddress = fromAddress; } - /** * <p>The reply to address of this user.</p> */ private String replyToAddress = null; - public String getReplyToAddress() { return this.replyToAddress; } - public void setReplyToAddress(String replyToAddress) { - this.replyToAddress = replyToAddress; - } - /** * <p>The set of subscriptions for the currently logged in user. */ private Subscription[] subscriptions = null; - public Subscription[] getSubscriptions() { return this.subscriptions; } - private void setSubscriptions(Subscription subscriptions[]) { + + + /** + * @return Returns the fromAddress. + */ + public String getFromAddress() { + return this.fromAddress; + } + + + /** + * @param fromAddress The fromAddress to set. + */ + public void setFromAddress(String fromAddress) { + this.fromAddress = fromAddress; + } + + + /** + * @return Returns the fullName. + */ + public String getFullName() { + return this.fullName; + } + + + /** + * @param fullName The fullName to set. + */ + public void setFullName(String fullName) { + this.fullName = fullName; + } + + + /** + * @return Returns the password. + */ + public String getPassword() { + return this.password; + } + + + /** + * @param password The password to set. + */ + public void setPassword(String password) { + this.password = password; + } + + + /** + * @return Returns the password2. + */ + public String getPassword2() { + return this.password2; + } + + + /** + * @param password2 The password2 to set. + */ + public void setPassword2(String password2) { + this.password2 = password2; + } + + + /** + * @return Returns the replyToAddress. + */ + public String getReplyToAddress() { + return this.replyToAddress; + } + + + /** + * @param replyToAddress The replyToAddress to set. + */ + public void setReplyToAddress(String replyToAddress) { + this.replyToAddress = replyToAddress; + } + + + /** + * @return Returns the username. + */ + public String getUsername() { + return this.username; + } + + + /** + * @param username The username to set. + */ + public void setUsername(String username) { + this.username = username; + } + + + /** + * @return Returns the subscriptions. + */ + public Subscription[] getSubscriptions() { + return this.subscriptions; + } + + /** + * @param subscriptions The subscriptions to set. + */ + public void setSubscriptions(Subscription subscriptions[]) { if (log.isTraceEnabled()) { if (subscriptions == null) { log.trace("Erasing stored subscriptions"); @@ -178,8 +267,9 @@ /** * <p>Create or update the user information.</p> + * @throws ExpiredPasswordException */ - public String save() { + public String save() throws ExpiredPasswordException { UserDatabase database = getUserDatabase(); String mode = getState().getMode(); @@ -327,6 +417,7 @@ setSubscriptions(null); } + } Modified: struts/shale/trunk/mailreader/src/java/org/apache/shale/examples/mailreader/State.java URL: http://svn.apache.org/viewcvs/struts/shale/trunk/mailreader/src/java/org/apache/shale/examples/mailreader/State.java?rev=330544&r1=330543&r2=330544&view=diff ============================================================================== --- struts/shale/trunk/mailreader/src/java/org/apache/shale/examples/mailreader/State.java (original) +++ struts/shale/trunk/mailreader/src/java/org/apache/shale/examples/mailreader/State.java Thu Nov 3 05:10:35 2005 @@ -16,7 +16,8 @@ package org.apache.shale.examples.mailreader; -import org.apache.struts.examples.mailreader.User; +import org.apache.struts.apps.mailreader.dao.User; + /** * <p>In the absence of a <code>DialogController</code>, provide some @@ -29,30 +30,63 @@ // -------------------------------------------------------------- Properties - - + /** * <p>Host name used to select which subscription to process.</p> */ private String host = null; - public String getHost() { return this.host; } - public void setHost(String host) { this.host = host; } - - + /** * <p>Transaction processing mode.</p> */ private String mode = null; - public String getMode() { return this.mode; } - public void setMode(String mode) { this.mode = mode; } - - + /** * <p>The currently logged on <code>User</code>.</p> */ private User user = null; - public User getUser() { return this.user; } - public void setUser(User user) { this.user = user; } + + /** + * @return Returns the host. + */ + public String getHost() { + return this.host; + } + + /** + * @param host The host to set. + */ + public void setHost(String host) { + this.host = host; + } + + /** + * @return Returns the mode. + */ + public String getMode() { + return this.mode; + } + + /** + * @param mode The mode to set. + */ + public void setMode(String mode) { + this.mode = mode; + } + + /** + * @return Returns the user. + */ + public User getUser() { + return this.user; + } + + /** + * @param user The user to set. + */ + public void setUser(User user) { + this.user = user; + } } Modified: struts/shale/trunk/mailreader/src/java/org/apache/shale/examples/mailreader/Subscription.java URL: http://svn.apache.org/viewcvs/struts/shale/trunk/mailreader/src/java/org/apache/shale/examples/mailreader/Subscription.java?rev=330544&r1=330543&r2=330544&view=diff ============================================================================== --- struts/shale/trunk/mailreader/src/java/org/apache/shale/examples/mailreader/Subscription.java (original) +++ struts/shale/trunk/mailreader/src/java/org/apache/shale/examples/mailreader/Subscription.java Thu Nov 3 05:10:35 2005 @@ -17,11 +17,12 @@ package org.apache.shale.examples.mailreader; import javax.faces.application.FacesMessage; + +import org.apache.commons.beanutils.BeanUtils; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; -//import org.apache.struts.examples.mailreader.Subscription; -import org.apache.struts.examples.mailreader.User; -import org.apache.struts.examples.mailreader.UserDatabase; +import org.apache.struts.apps.mailreader.dao.User; +import org.apache.struts.apps.mailreader.dao.UserDatabase; /** * <p><code>ViewController</code> for the <code>subscription</code> page.</p> @@ -48,46 +49,110 @@ * <p>The host for this subscription.</p> */ private String host = null; - public String getHost() { return this.host; } - public void setHost(String host) { this.host = host; } - /** * <p>The logon username for this subscription.</p> */ private String username = null; - public String getUsername() { return this.username; } - public void setUsername(String username) { this.username = username; } - /** * <p>The login password for this subscription.</p> */ private String password = null; - public String getPassword() { return this.password; } - public void setPassword(String password) { this.password = password; } - /** * <p>The type for this subscription.</p> */ private String type = null; - public String getType() { return this.type; } - public void setType(String type) { this.type = type; } - /** * <p>The autoConnect state for this subscription.</p> */ private boolean autoConnect = false; - public boolean isAutoConnect() { return this.autoConnect; } - public void setAutoConnect(boolean autoConnect) { - this.autoConnect = autoConnect; - } + + + /** + * @return Returns the autoConnect. + */ + public boolean isAutoConnect() { + return this.autoConnect; + } + + + /** + * @param autoConnect The autoConnect to set. + */ + public void setAutoConnect(boolean autoConnect) { + this.autoConnect = autoConnect; + } + + + /** + * @return Returns the host. + */ + public String getHost() { + return this.host; + } + + + /** + * @param host The host to set. + */ + public void setHost(String host) { + this.host = host; + } + + + /** + * @return Returns the password. + */ + public String getPassword() { + return this.password; + } + + + /** + * @param password The password to set. + */ + public void setPassword(String password) { + this.password = password; + } + + + /** + * @return Returns the type. + */ + public String getType() { + return this.type; + } + + + /** + * @param type The type to set. + */ + public void setType(String type) { + this.type = type; + } + + + /** + * @return Returns the username. + */ + public String getUsername() { + return this.username; + } + + + /** + * @param username The username to set. + */ + public void setUsername(String username) { + this.username = username; + } - // ---------------------------------------------------------- Event Handlers + // ---------------------------------------------------------- Event Handlers /** * <p>Return to the appropriate page depending on the current mode.</p> @@ -114,7 +179,7 @@ String mode = state.getMode(); boolean ok = true; User user = state.getUser(); - org.apache.struts.examples.mailreader.Subscription subscription = + org.apache.struts.apps.mailreader.dao.Subscription subscription = user.findSubscription(state.getHost()); if ("CREATE".equals(mode)) { @@ -129,6 +194,14 @@ // Create a new subscription subscription = user.createSubscription(host); + Registration registration = (Registration)getBean("registration"); + try { + user = getState().getUser(); + BeanUtils.copyProperties(registration, user); + } catch (Exception e) { + // display something + e.printStackTrace(); + } } else if ("DELETE".equals(mode)) { @@ -192,7 +265,7 @@ // The first time in, prepopulate our input field values User user = state.getUser(); - org.apache.struts.examples.mailreader.Subscription subscription = + org.apache.struts.apps.mailreader.dao.Subscription subscription = user.findSubscription(state.getHost()); if (!isPostBack()) { setHost(subscription.getHost()); @@ -203,6 +276,5 @@ } } - } Modified: struts/shale/trunk/mailreader/src/web/WEB-INF/faces-config.xml URL: http://svn.apache.org/viewcvs/struts/shale/trunk/mailreader/src/web/WEB-INF/faces-config.xml?rev=330544&r1=330543&r2=330544&view=diff ============================================================================== --- struts/shale/trunk/mailreader/src/web/WEB-INF/faces-config.xml (original) +++ struts/shale/trunk/mailreader/src/web/WEB-INF/faces-config.xml Thu Nov 3 05:10:35 2005 @@ -76,7 +76,7 @@ </managed-bean-class> <managed-bean-scope>session</managed-bean-scope> <managed-property> - <managed-property-name>mode</managed-property-name> + <property-name>mode</property-name> <value>EDIT</value> </managed-property> </managed-bean> Modified: struts/shale/trunk/mailreader/src/web/subscription.jsp URL: http://svn.apache.org/viewcvs/struts/shale/trunk/mailreader/src/web/subscription.jsp?rev=330544&r1=330543&r2=330544&view=diff ============================================================================== --- struts/shale/trunk/mailreader/src/web/subscription.jsp (original) +++ struts/shale/trunk/mailreader/src/web/subscription.jsp Thu Nov 3 05:10:35 2005 @@ -33,22 +33,7 @@ rendered="#{state.mode == 'DELETE'}"/> <h:outputText value="#{messages['subscription.title.edit']}" rendered="#{state.mode == 'EDIT'}"/> -<%-- - <c:choose> - <c:when test="${state.mode == 'CREATE'}"> - <h:outputText id="titleCreate" - value="#{messages['subscription.title.create']}"/> - </c:when> - <c:when test="${state.mode == 'DELETE'}"> - <h:outputText id="titleDelete" - value="#{messages['subscription.title.delete']}"/> - </c:when> - <c:when test="${state.mode == 'Edit'}"> - <h:outputText id="titleEdit" - value="#{messages['subscription.title.edit']}"/> - </c:when> - </c:choose> ---%> + </title> </head> <body> @@ -72,25 +57,6 @@ <h:outputText value="#{messages['subscription.title.edit']}" rendered="#{state.mode == 'EDIT'}"/> -<%-- - <c:choose> - <c:when test="${state.mode == 'CREATE'}"> - <h:outputText - id="headerCreate" - value="#{messages['subscription.title.create']}"/> - </c:when> - <c:when test="${state.mode == 'DELETE'}"> - <h:outputText - id="headerDelete" - value="#{messages['subscription.title.delete']}"/> - </c:when> - <c:when test="${state.mode == 'EDIT'}"> - <h:outputText - id="headerEdit" - value="#{messages['subscription.title.edit']}"/> - </c:when> - </c:choose> ---%> </h:panelGroup> </f:facet> @@ -128,24 +94,6 @@ rendered="#{state.mode != 'CREATE'"/> </h:panelGroup> -<%-- - <c:choose> - <c:when test="${state.mode == 'CREATE'}"> - <h:inputText id="host" - size="50" - value="#{subscription.host}"/> - <h:message id="hostMessages" - for="host"/> - </c:when> - <c:otherwise> - <h:outputText id="hostDisplay" - value="#{subscription.host}"/> - <h:outputText id="hostEmpty" - value=""/> - </c:otherwise> - </c:choose> ---%> - <%-- Third row --%> <h:outputLabel for="username"> @@ -212,25 +160,6 @@ value="#{messages['button.save']}" rendered="#{state.mode != 'DELETE'}"/> </h:panelGroup> - -<%-- - <c:choose> - <c:when test="${state.mode == 'DELETE'}"> - <h:commandButton - id="confirm" - action="#{subscription.save}" - type="SUBMIT" - value="#{messages['button.confirm']}"/> - </c:when> - <c:otherwise> - <h:commandButton - id="save" - action="#{subscription.save}" - type="SUBMIT" - value="#{messages['button.save']}"/> - </c:otherwise> - </c:choose> ---%> <h:panelGroup id="reset_and_cancel"> <h:commandButton id="reset" --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]