Java Doc for WebMailSession.java in  » Web-Mail » jwebmail-0.7 » net » wastl » webmail » server » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » Web Mail » jwebmail 0.7 » net.wastl.webmail.server 
Source Cross Reference  Class Diagram Java Document (Java Doc) 


java.lang.Object
   net.wastl.webmail.server.WebMailSession

WebMailSession
public class WebMailSession implements HTTPSession(Code)
A user session for WebMail. Contains the state of the actual user (loads it from disk). Has a unique session-ID.
author:
   Sebastian Schaffert
version:
   $Revision: 1.1.1.1 $


Field Summary
final public static  intGETMESSAGE_MODE_FORWARD
     Set this mode in getMessage to indicate that the message is to be forwarded to someone else and a "work" message should be generated.
final public static  intGETMESSAGE_MODE_REPLY
     Set this mode in getMessage to indicate that the message is requested to generate a reply message and should therefore be set as the current "work" message.
final public static  intGETMESSAGE_MODE_STANDARD
     This indicates standard getMessage behaviour: Fetch the message from the IMAP server and store it in the current UserModel.
protected  booleanis_logged_out
    
protected  Vectorneed_expunge_folders
    

Constructor Summary
public  WebMailSession(WebMailServer parent, Object parm, HTTPRequestHeader h)
    

Method Summary
public  voidaddFolder(String toid, String name, boolean holds_messages, boolean holds_folders)
    
public  voidaddMailbox(String name, String protocol, String host, String login, String password)
     Add the mailbox with the given parameters to this user's configuration.
public  voidaddWorkAttachment(String name, ByteStore bs, String description)
     Add an attachment to the current work message.
Parameters:
  name - Name of the attachment (e.g.
public  StringcalcCode(InetAddress a, HTTPRequestHeader h)
     Calculate session-ID for a session.
public  voidchangeSetup(HTTPRequestHeader head)
     Change a user's configuration.
public  voidclearAttachments()
    
public  voidclearWork()
    
public  Folderconnect(String name)
    
public  voidconnectAll()
    
protected  StoreconnectStore(String host, String protocol, String login, String password)
    
public  voidcopyMoveMessage(String fromfolder, String tofolder, HTTPRequestHeader head, boolean move)
     Copy or move the selected messages from folder fromfolder to folder tofolder.
public  voidcreateMessageList(String folderhash, int list_part)
     Create a Message List.
public  voiddisconnect(String name)
    
public  voiddisconnectAll()
    
protected  voiddoInit(WebMailServer parent, HTTPRequestHeader h)
     This method does the actual initialisation devink 7/15/2000 - added TwoPassAuthenticationException - updated call to getUserData(), to use my new one.
public  voidexpungeFolders()
    
protected  StringgenerateFolderHash(Folder folder)
     This method tries to generate a unique folder identifier for the given folder.
public  HashtablegetActiveConnections()
    
public  ByteStoregetAttachment(String key)
    
public  HashtablegetAttachments()
    
public  FoldergetChildFolder(Folder root, String folderhash)
    
public  StringgetEnv(String key)
    
public  FoldergetFolder(String folderhash)
     Get the folder with the given hashvalue.
protected  intgetFolderTree(Folder folder, Element xml_parent, boolean subscribed_only)
     Construct the folder subtree for the given folder and append it to xml_parent.
public  longgetLastAccess()
    
public  LocalegetLocale()
    
public  ByteStoregetMIMEPart(String msgid, String name)
    
public  voidgetMessage(String folderhash, int msgnum)
     This is a wrapper to call getMessage with standard mode.
public  voidgetMessage(String folderhash, int msgnum, int mode)
     Fetch a message from a folder. Will put the messages parameters in the sessions environment
Parameters:
  foldername - Name of the folder were the message should be fetched from
Parameters:
  msgnum - Number of the message to fetch
Parameters:
  mode - there are three different modes: standard, reply and forward.
public  EnumerationgetMimeParts(String msgid)
    
public  DocumentgetModel()
    
public  InetAddressgetRemoteAddress()
    
public  FoldergetRootFolder(String name)
    
protected static  int[]getSelectedMessages(HTTPRequestHeader head, int max)
    
public  StringgetSessionCode()
     Return the session id that was generated for this session.
public  StringgetStringResource(String key)
    
public  longgetTimeout()
    
public  UserDatagetUser()
    
public  XMLUserModelgetUserModel()
    
public  StringgetUserName()
    
public  voidhandleTransportException(SendFailedException e)
    
public  booleanisLoggedOut()
     Check whether this session is already logged out.
public  booleanisSent()
    
public  voidlogin(HTTPRequestHeader h)
     Login to this session.
public  voidlogin()
     Login this session.
public  voidlogout()
     Terminate this session.
protected  voidparseMIMEContent(Part p, XMLMessagePart parent_part, String msgid)
     Use depth-first search to go through MIME-Parts recursively.
public  voidprepareCompose()
    
public  voidrefreshFolderInformation()
    
public  voidrefreshFolderInformation(boolean subscribed_only)
     Refresh Information about folders.
public  voidrefreshFolderInformation(String folderhash)
    
public  voidremoveFolder(String id, boolean recurse)
    
public  voidremoveMailbox(String name)
     Remove the mailbox with the given name.
public  voidremoveWorkAttachment(String name)
     Remove the attachment with the given name from the current work message.
public  voidsaveData()
    
public  voidsetAddToFolder(String id)
    
public  voidsetEnv(String key, String value)
    
public  voidsetEnv()
    
public  voidsetException(Exception ex)
    
public  voidsetFlags(String folderhash, HTTPRequestHeader head)
     Change the Flags of the messages the user selected.
public  voidsetLastAccess()
     Update the last access time.
public  voidsetSent(boolean b)
    
public  voidsetSubscribedAll(String id, boolean subscribed)
    
public  voidstoreMessage(HTTPRequestHeader head)
     Store a message in the environment for further processing.
public  voidsubscribeFolder(String folderhash)
     Try to subscribe to a folder (i.e.
public  voidtimeoutOccured()
     Handle a timeout for this session.
public  voidunsubscribeFolder(String folderhash)
     Try to unsubscribe from a folder (i.e.

Field Detail
GETMESSAGE_MODE_FORWARD
final public static int GETMESSAGE_MODE_FORWARD(Code)
Set this mode in getMessage to indicate that the message is to be forwarded to someone else and a "work" message should be generated.
See Also:    getMessage(String,int,int)



GETMESSAGE_MODE_REPLY
final public static int GETMESSAGE_MODE_REPLY(Code)
Set this mode in getMessage to indicate that the message is requested to generate a reply message and should therefore be set as the current "work" message.
See Also:    getMessage(String,int,int)



GETMESSAGE_MODE_STANDARD
final public static int GETMESSAGE_MODE_STANDARD(Code)
This indicates standard getMessage behaviour: Fetch the message from the IMAP server and store it in the current UserModel.
See Also:    getMessage(String,int,int)



is_logged_out
protected boolean is_logged_out(Code)



need_expunge_folders
protected Vector need_expunge_folders(Code)




Constructor Detail
WebMailSession
public WebMailSession(WebMailServer parent, Object parm, HTTPRequestHeader h) throws UserDataException, InvalidPasswordException, WebMailException(Code)




Method Detail
addFolder
public void addFolder(String toid, String name, boolean holds_messages, boolean holds_folders) throws MessagingException(Code)



addMailbox
public void addMailbox(String name, String protocol, String host, String login, String password) throws MessagingException(Code)
Add the mailbox with the given parameters to this user's configuration. Subscribe all folders on startup (the user can later unsubscribe them) and update the model.
Parameters:
  name - Name for the mailbox (used for identification within the session)
Parameters:
  protocol - The protocol used for this mailbox (most likely IMAP or POP3)
Parameters:
  host - The hostname of the host this mailbox lives on
Parameters:
  login - Login name the user provided for the host
Parameters:
  password - Password the user provided to the given login



addWorkAttachment
public void addWorkAttachment(String name, ByteStore bs, String description) throws WebMailException(Code)
Add an attachment to the current work message.
Parameters:
  name - Name of the attachment (e.g. filename)
Parameters:
  bs - The contents of the attachment, as a ByteStore object
Parameters:
  description - A short description of the contents (will be used as the "Description:" header



calcCode
public String calcCode(InetAddress a, HTTPRequestHeader h)(Code)
Calculate session-ID for a session.
Parameters:
  a - Adress of the remote host
Parameters:
  h - Requestheader of the remote user agent



changeSetup
public void changeSetup(HTTPRequestHeader head) throws WebMailException(Code)
Change a user's configuration. Header fields given in the requestheader are parsed and turned into user options (probably should not be in WebMailSession but in a plugin or something; this is very hacky).



clearAttachments
public void clearAttachments()(Code)
This method removes all of the attachments of the current "work" message



clearWork
public void clearWork()(Code)



connect
public Folder connect(String name) throws MessagingException(Code)
Connect to mailhost "name"



connectAll
public void connectAll()(Code)
Connect to all Mailhosts



connectStore
protected Store connectStore(String host, String protocol, String login, String password) throws MessagingException(Code)



copyMoveMessage
public void copyMoveMessage(String fromfolder, String tofolder, HTTPRequestHeader head, boolean move) throws MessagingException(Code)
Copy or move the selected messages from folder fromfolder to folder tofolder.



createMessageList
public void createMessageList(String folderhash, int list_part) throws NoSuchFolderException(Code)
Create a Message List. Fetches a list of headers in folder foldername for part list_part. The messagelist will be stored in the "MESSAGES" environment.
Parameters:
  foldername - folder for which a message list should be built
Parameters:
  list_part - part of list to display (1 = last xx messages, 2 = total-2*xx - total-xx messages)



disconnect
public void disconnect(String name)(Code)
Disconnect from mailhost "name"



disconnectAll
public void disconnectAll()(Code)
Disconnect from all Mailhosts



doInit
protected void doInit(WebMailServer parent, HTTPRequestHeader h) throws UserDataException, InvalidPasswordException, WebMailException(Code)
This method does the actual initialisation devink 7/15/2000 - added TwoPassAuthenticationException - updated call to getUserData(), to use my new one. devink 9/24/2000 - reverted back to old getUserData call



expungeFolders
public void expungeFolders()(Code)
Expunge all folders that have messages waiting to be deleted



generateFolderHash
protected String generateFolderHash(Folder folder)(Code)
This method tries to generate a unique folder identifier for the given folder. This method generates an MD5 sum over the complete folder URL, if possible.
See Also:   getFolderTree
See Also:   net.wastl.webmail.misc.MD5



getActiveConnections
public Hashtable getActiveConnections()(Code)



getAttachment
public ByteStore getAttachment(String key)(Code)
This method returns the attachment with the given name of the current "work" message



getAttachments
public Hashtable getAttachments()(Code)
This method returns a table of attachments for the current "work" message



getChildFolder
public Folder getChildFolder(Folder root, String folderhash)(Code)
Get a childfolder of a rootfolder for a specified hash value



getEnv
public String getEnv(String key)(Code)



getFolder
public Folder getFolder(String folderhash)(Code)
Get the folder with the given hashvalue.



getFolderTree
protected int getFolderTree(Folder folder, Element xml_parent, boolean subscribed_only)(Code)
Construct the folder subtree for the given folder and append it to xml_parent.
Parameters:
  folder - the folder where we begin
Parameters:
  xml_parent - the XML Element where the gathered information will be appended
Parameters:
  subscribed_only - Only list subscribed folders



getLastAccess
public long getLastAccess()(Code)
Return the last access time of this session
See Also:   TimeableConnection



getLocale
public Locale getLocale()(Code)



getMIMEPart
public ByteStore getMIMEPart(String msgid, String name)(Code)



getMessage
public void getMessage(String folderhash, int msgnum) throws NoSuchFolderException(Code)
This is a wrapper to call getMessage with standard mode.
See Also:    getMessage(String,int,int)



getMessage
public void getMessage(String folderhash, int msgnum, int mode) throws NoSuchFolderException(Code)
Fetch a message from a folder. Will put the messages parameters in the sessions environment
Parameters:
  foldername - Name of the folder were the message should be fetched from
Parameters:
  msgnum - Number of the message to fetch
Parameters:
  mode - there are three different modes: standard, reply and forward. reply and forward will enter the messageinto the current work element of the user and set some additional flags on the message if the userhas enabled this option.
See Also:   net.wastl.webmail.server.WebMailSession.GETMESSAGE_MODE_STANDARD
See Also:   net.wastl.webmail.server.WebMailSession.GETMESSAGE_MODE_REPLY
See Also:   net.wastl.webmail.server.WebMailSession.GETMESSAGE_MODE_FORWARD



getMimeParts
public Enumeration getMimeParts(String msgid)(Code)



getModel
public Document getModel()(Code)



getRemoteAddress
public InetAddress getRemoteAddress()(Code)



getRootFolder
public Folder getRootFolder(String name) throws MessagingException(Code)



getSelectedMessages
protected static int[] getSelectedMessages(HTTPRequestHeader head, int max)(Code)



getSessionCode
public String getSessionCode()(Code)
Return the session id that was generated for this session.



getStringResource
public String getStringResource(String key)(Code)
Return a locale-specific string resource



getTimeout
public long getTimeout()(Code)



getUser
public UserData getUser()(Code)



getUserModel
public XMLUserModel getUserModel()(Code)



getUserName
public String getUserName()(Code)



handleTransportException
public void handleTransportException(SendFailedException e)(Code)



isLoggedOut
public boolean isLoggedOut()(Code)
Check whether this session is already logged out. Useful to avoid loops.



isSent
public boolean isSent()(Code)



login
public void login(HTTPRequestHeader h) throws InvalidPasswordException(Code)
Login to this session. Establishes connections to a userīs Mailhosts
Parameters:
  h - RequestHeader with content from Login-POST operation.



login
public void login()(Code)
Login this session. Updates access time, sets initial environment and connects all configured mailboxes.



logout
public void logout()(Code)
Terminate this session. This will expunge deleted messages, close all mailbox connections, save the user data and then remove this session from the session list, effectively destroying this session.



parseMIMEContent
protected void parseMIMEContent(Part p, XMLMessagePart parent_part, String msgid) throws MessagingException(Code)
Use depth-first search to go through MIME-Parts recursively.
Parameters:
  p - Part to begin with



prepareCompose
public void prepareCompose()(Code)



refreshFolderInformation
public void refreshFolderInformation()(Code)



refreshFolderInformation
public void refreshFolderInformation(boolean subscribed_only)(Code)
Refresh Information about folders. Tries to connect folders that are not yet connected.



refreshFolderInformation
public void refreshFolderInformation(String folderhash)(Code)



removeFolder
public void removeFolder(String id, boolean recurse) throws MessagingException(Code)



removeMailbox
public void removeMailbox(String name)(Code)
Remove the mailbox with the given name. Will first disconnect all mailboxes, remove the given mailbox and then update the model.
Parameters:
  name - Name of the mailbox that is to be removed.



removeWorkAttachment
public void removeWorkAttachment(String name)(Code)
Remove the attachment with the given name from the current work message.



saveData
public void saveData()(Code)



setAddToFolder
public void setAddToFolder(String id)(Code)



setEnv
public void setEnv(String key, String value)(Code)



setEnv
public void setEnv()(Code)



setException
public void setException(Exception ex)(Code)



setFlags
public void setFlags(String folderhash, HTTPRequestHeader head) throws MessagingException(Code)
Change the Flags of the messages the user selected.



setLastAccess
public void setLastAccess()(Code)
Update the last access time. Sets the last access time to the current time.
See Also:   TimeableConnection



setSent
public void setSent(boolean b)(Code)



setSubscribedAll
public void setSubscribedAll(String id, boolean subscribed) throws MessagingException(Code)
Subscribe all folders for a Mailhost Do it the non-recursive way: Uses a simple Queue :-)



storeMessage
public void storeMessage(HTTPRequestHeader head)(Code)
Store a message in the environment for further processing.



subscribeFolder
public void subscribeFolder(String folderhash)(Code)
Try to subscribe to a folder (i.e. unhide it)



timeoutOccured
public void timeoutOccured()(Code)
Handle a timeout for this session. This calls the logout method, effectively terminating this session.
See Also:   TimeableConnection
See Also:    logout()



unsubscribeFolder
public void unsubscribeFolder(String folderhash)(Code)
Try to unsubscribe from a folder (i.e. hide it)



Methods inherited from java.lang.Object
native protected Object clone() throws CloneNotSupportedException(Code)(Java Doc)
public boolean equals(Object obj)(Code)(Java Doc)
protected void finalize() throws Throwable(Code)(Java Doc)
final native public Class getClass()(Code)(Java Doc)
native public int hashCode()(Code)(Java Doc)
final native public void notify()(Code)(Java Doc)
final native public void notifyAll()(Code)(Java Doc)
public String toString()(Code)(Java Doc)
final native public void wait(long timeout) throws InterruptedException(Code)(Java Doc)
final public void wait(long timeout, int nanos) throws InterruptedException(Code)(Java Doc)
final public void wait() throws InterruptedException(Code)(Java Doc)

www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.