com.ericdaugherty.mail.server.info
Class User

java.lang.Object
  extended by com.ericdaugherty.mail.server.info.User

public class User
extends java.lang.Object

Represents a user object. This class is responsible for providing all information about a specific user and their mailbox.

Author:
Eric Daugherty

Constructor Summary
User(EmailAddress address)
          Creates a new user with the full username (user and domain).
 
Method Summary
 EmailAddress[] getDeliveryAddresses()
          Returns an array of Strings that represent email addresses to deliver email to this user.
 java.lang.String getDomain()
           
 EmailAddress[] getForwardAddresses()
           
 java.lang.String getFullUsername()
           
 Message getMessage(int messageNumber)
          Gets the specified message.
 Message[] getMessages()
          Returns an array of Message objects that represents all messages stored for this user.
 Message[] getNonDeletedMessages()
          Returns an array of Message objects that represents all messaged stored for this user not marked for deletion.
 long getNumberOfMessage()
          Gets the total number of messages currently stored for this user.
 long getNumberOfNonDeletedMessages()
          Gets the total number of non deleted messages currently stored for this user.
 java.lang.String getPassword()
           
 POP3MessagePersistenceProccessor getPOP3MessagePersistenceProccessor()
           
 long getSizeOfAllNonDeletedMessages()
          Gets the total size of the non deleted messages currently stored for this user.
 java.lang.String getUsername()
           
 boolean isPasswordValid(java.lang.String plainTextPassword)
          Returns true if and only if the specified plain text password's hash value matches the hashed password for this user.
 void reset()
          This method removes any cached message information this user may have stored
 void setDomain(java.lang.String domain)
           
 void setForwardAddresses(EmailAddress[] forwardAddresses)
           
 void setPassword(java.lang.String password)
           
 void setUsername(java.lang.String username)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

User

public User(EmailAddress address)
Creates a new user with the full username (user and domain).

Parameters:
address - User's full email address
Method Detail

isPasswordValid

public boolean isPasswordValid(java.lang.String plainTextPassword)
Returns true if and only if the specified plain text password's hash value matches the hashed password for this user.

Parameters:
plainTextPassword - the password to validate.
Returns:
true if it matches.

getUsername

public java.lang.String getUsername()

setUsername

public void setUsername(java.lang.String username)

getFullUsername

public java.lang.String getFullUsername()

getDomain

public java.lang.String getDomain()

setDomain

public void setDomain(java.lang.String domain)

getPassword

public java.lang.String getPassword()

setPassword

public void setPassword(java.lang.String password)

getForwardAddresses

public EmailAddress[] getForwardAddresses()

setForwardAddresses

public void setForwardAddresses(EmailAddress[] forwardAddresses)

getDeliveryAddresses

public EmailAddress[] getDeliveryAddresses()
Returns an array of Strings that represent email addresses to deliver email to this user. If the forwardAddresses is not null or empty, this will return the forwardAddresses array. Otherwise, this will return the user's email address.

Returns:
array of strings that represent email addresses.

getMessages

public Message[] getMessages()
Returns an array of Message objects that represents all messages stored for this user.


getNonDeletedMessages

public Message[] getNonDeletedMessages()
Returns an array of Message objects that represents all messaged stored for this user not marked for deletion.


getMessage

public Message getMessage(int messageNumber)
Gets the specified message. Message numbers are 1 based. This method counts on the calling method to verify that the messageNumber actually exists.


getNumberOfMessage

public long getNumberOfMessage()
Gets the total number of messages currently stored for this user.


getNumberOfNonDeletedMessages

public long getNumberOfNonDeletedMessages()
Gets the total number of non deleted messages currently stored for this user.


getSizeOfAllNonDeletedMessages

public long getSizeOfAllNonDeletedMessages()
Gets the total size of the non deleted messages currently stored for this user.


reset

public void reset()
This method removes any cached message information this user may have stored


getPOP3MessagePersistenceProccessor

public POP3MessagePersistenceProccessor getPOP3MessagePersistenceProccessor()