/* -----------------------------------------------------------------------------
* Copyright (c) 2001, Low Kin Onn
* All rights reserved.
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
*
* Redistributions of source code must retain the above copyright notice, this
* list of conditions and the following disclaimer.
*
* Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
*
* Neither name of the Scioworks Pte. Ltd. nor the names of its contributors
* may beused to endorse or promote products derived from this software without
* specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR
* ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* -----------------------------------------------------------------------------
*/
package scioworks.imap.presentation;
import javax.mail.*;
public class ImapWebSessionData implements java.io.Serializable {
public static final String SESSION_KEY = "ImapWebSessionData";
private URLName imapURL = null;
private Session imapSession = null;
private Store imapStore = null;
String userMessage = null;
public ImapWebSessionData() {
}
public ImapWebSessionData(URLName url) {
this.imapURL = url;
}
public URLName getImapURL() {
return imapURL;
}
public void setImapURL(URLName url) {
this.imapURL = url;
}
public void setImapSession(Session session){
this.imapSession = session;
}
public Session getImapSession(){
return imapSession;
}
public void setImapStore(Store store){
this.imapStore = store;
}
public Store getImapStore(){
return imapStore;
}
public void setUserMessage(String msg) {
this.userMessage = msg;
}
public String getUserMessage() {
return userMessage;
}
/**
* Retrieve the most recent user message and then clear it so no
* other app tries to use it.
*/
public String getAndClearUserMessage() {
String msg = this.userMessage;
this.userMessage = null;
return msg;
}
public boolean isValidSession() {
/** @todo : to check if this is sufficient */
if (imapSession == null) {
return false;
} else {
return true;
}
}
}
|