SK.gnome.dwarf.mail.store
Class FileMailStore

java.lang.Object
  extended bySK.gnome.dwarf.GenericService
      extended bySK.gnome.dwarf.mail.store.GenericFileStore
          extended bySK.gnome.dwarf.mail.store.FileMailStore
All Implemented Interfaces:
MailStore, SK.gnome.dwarf.Service
Direct Known Subclasses:
SyncFileMailStore

public class FileMailStore
extends GenericFileStore
implements MailStore

This class provides a filesystem-based mail store.


Field Summary
 
Fields inherited from class SK.gnome.dwarf.mail.store.GenericFileStore
autoCreate, backupObjects, letterSubdirs, userBaseDir
 
Fields inherited from class SK.gnome.dwarf.GenericService
initParameters, parent
 
Fields inherited from interface SK.gnome.dwarf.Service
INITIALIZED, LOG_DEBUG, LOG_ERROR, LOG_FATAL, LOG_INFO, LOG_TRACE, LOG_WARN, LOG_XFER, SHUTDOWN, STARTED, STOPPED
 
Constructor Summary
FileMailStore(java.lang.String name)
          Creates a new FileMailStore.
 
Method Summary
 void addMailEventListener(MailEventListener listener)
          Adds the given mail event listener to this store.
 void dispatchMailEvent(MailEvent event)
          Dispatches the given mail event to the registered listeners.
 MailFolder getDefaultFolder(java.lang.String user)
          Returns a default folder for the given user.
protected  int getPreloadLimit()
          Returns the maximum size of a message which will be always preloaded and cached in the memory.
protected  boolean getSharedAccess()
          Whether the simultaneous multiple access to the same mail folder is enabled.
 MailFolder getSharedDefaultFolder()
           
protected  java.lang.String getSharedPrefix()
          Returns the prefix for the shared folders.
 void removeMailEventListener(MailEventListener listener)
          Removes the given mail event listener from this store.
 void setPreloadLimit(int limit)
          Maximum size for a message to be always preloaded into the memory.
 void setSharedAccess(boolean enable)
          Enables or disables simultaneous access to the same mail folder.
 void setSharedPrefix(java.lang.String prefix)
          Sets the prefix for the shared folders.
 void setSharedUser(java.lang.String user)
          Sets the user account for sharing.
 
Methods inherited from class SK.gnome.dwarf.mail.store.GenericFileStore
create, exists, getUserDirectory, init, listUsers, lock, readObject, remove, setAutoCreate, setBackupObjects, setLetterSubdirs, setUserBaseDir, storeObject, unlock
 
Methods inherited from class SK.gnome.dwarf.GenericService
getAuthenticator, getAuthFacility, getFullName, getInitParameter, getInitParameterNames, getLogFacility, getLogger, getName, getParameters, getPrincipal, getShutdownTimeout, getState, log, log, login, logout, setAuthFacility, setInitParameters, setLogFacility, shutdown, start, stop, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface SK.gnome.dwarf.mail.store.MailStore
create, exists, listUsers, remove
 

Constructor Detail

FileMailStore

public FileMailStore(java.lang.String name)
Creates a new FileMailStore.

Method Detail

setSharedAccess

public void setSharedAccess(boolean enable)
Enables or disables simultaneous access to the same mail folder.

If disabled, a folder will refuse call to MailFolder.open(int) method if MailFolder.isOpen() already returns true.

This feature may be used to force mail storage to operate in the "single thread per mailbox" mode. It is recommended to disable the simultaneous access in very busy production servers.

Default value: true

Parameters:
enable - true to enable the simultaneous access, false otherwise

setPreloadLimit

public void setPreloadLimit(int limit)
Maximum size for a message to be always preloaded into the memory.

If this is a non-zero value and the particular message size is less or equal to it, the message content will be always loaded into memory and cached by the mail store from the time a mail folder is opened until it is closed. Higher limit means faster access to folders and messages, but also a higher memory footprint. Setting this attribute to zero completely disables this feature. A reasonable value for preloading limit is about 4096 bytes.

Default value: 0

Parameters:
limit - the message size limit in bytes

setSharedUser

public void setSharedUser(java.lang.String user)
Sets the user account for sharing.

The whole user's folder hierarchy will be mapped to the namespace of other users. It will appear under a special folder, whose name must be set by the setSharedPrefix(String) method.

Parameters:
user - the name of the shared user account

setSharedPrefix

public void setSharedPrefix(java.lang.String prefix)
Sets the prefix for the shared folders.

This is the name of a special folder under which the shared account will appear in the namespace of other users.

Parameters:
prefix - the shared folders prefix

getDefaultFolder

public MailFolder getDefaultFolder(java.lang.String user)
                            throws MailException
Description copied from interface: MailStore
Returns a default folder for the given user.

Specified by:
getDefaultFolder in interface MailStore
Parameters:
user - the user identification
Returns:
the user's default folder
Throws:
MailException - if an error occured

getSharedDefaultFolder

public MailFolder getSharedDefaultFolder()
                                  throws MailException
Throws:
MailException

addMailEventListener

public void addMailEventListener(MailEventListener listener)
Description copied from interface: MailStore
Adds the given mail event listener to this store.

Specified by:
addMailEventListener in interface MailStore
Parameters:
listener - the mail event listener

removeMailEventListener

public void removeMailEventListener(MailEventListener listener)
Description copied from interface: MailStore
Removes the given mail event listener from this store.

Specified by:
removeMailEventListener in interface MailStore
Parameters:
listener - the mail event listener

dispatchMailEvent

public final void dispatchMailEvent(MailEvent event)
Description copied from interface: MailStore
Dispatches the given mail event to the registered listeners.

Specified by:
dispatchMailEvent in interface MailStore
Parameters:
event - the mail event

getSharedAccess

protected boolean getSharedAccess()
Whether the simultaneous multiple access to the same mail folder is enabled.

Returns:
true if the simultaneous access is enabled, false otherwise
See Also:
setSharedAccess(boolean)

getPreloadLimit

protected int getPreloadLimit()
Returns the maximum size of a message which will be always preloaded and cached in the memory.

Returns:
the message size limit in bytes or zero
See Also:
setPreloadLimit(int)

getSharedPrefix

protected java.lang.String getSharedPrefix()
Returns the prefix for the shared folders.

Returns:
the prefix
See Also:
setSharedPrefix(String)


Copyright (c) 2004-2005, Gnome Ltd. All rights reserved.