org.apache.james.mailrepository.javamail
Class FolderGateKeeperImpl

java.lang.Object
  extended by org.apache.james.mailrepository.javamail.FolderGateKeeperImpl
All Implemented Interfaces:
FolderGateKeeper

public class FolderGateKeeperImpl
extends java.lang.Object
implements FolderGateKeeper

offers access to an underlaying Folder and manages open/close operations.
The FolderGateKeeper can be handed over to different threads.

See Also:
FolderGateKeeper

Constructor Summary
FolderGateKeeperImpl(FolderInterface folder, StoreGateKeeper storeGateKeeper)
           
 
Method Summary
 void create(int holds_folders)
           
 boolean exists()
           
 void free()
          decrements count of users and closes folder if 0 and folder is open.
 FolderInterface getFolder()
          Gets the Folder and don't care whether it is open or closed.
 java.lang.String getFullName()
           
 FolderInterface getOpenFolder()
          Gets the Folder and opens it, if necessary
 int getUseCount()
          used to test whether everyone has freed it
 void renameTo(javax.mail.Folder destination)
           
 void renameTo(java.lang.String newName)
           
 void use()
          increments count of users
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

FolderGateKeeperImpl

public FolderGateKeeperImpl(FolderInterface folder,
                            StoreGateKeeper storeGateKeeper)
Method Detail

use

public void use()
Description copied from interface: FolderGateKeeper
increments count of users

Specified by:
use in interface FolderGateKeeper
See Also:
FolderGateKeeper.use()

free

public void free()
          throws javax.mail.MessagingException
Description copied from interface: FolderGateKeeper
decrements count of users and closes folder if 0 and folder is open.

Specified by:
free in interface FolderGateKeeper
Throws:
javax.mail.MessagingException - if something went wrong closing the Folder
See Also:
FolderGateKeeper.free()

getOpenFolder

public FolderInterface getOpenFolder()
                              throws javax.mail.MessagingException
Description copied from interface: FolderGateKeeper
Gets the Folder and opens it, if necessary

Specified by:
getOpenFolder in interface FolderGateKeeper
Returns:
an open Folder
Throws:
javax.mail.MessagingException - if something went wron opening the Folder
See Also:
FolderGateKeeper.getOpenFolder()

getUseCount

public int getUseCount()
Description copied from interface: FolderGateKeeper
used to test whether everyone has freed it

Specified by:
getUseCount in interface FolderGateKeeper
Returns:
number of users
See Also:
FolderGateKeeper.getUseCount()

getFolder

public FolderInterface getFolder()
Description copied from interface: FolderGateKeeper
Gets the Folder and don't care whether it is open or closed.

Specified by:
getFolder in interface FolderGateKeeper
Returns:
a open or closed Folder
See Also:
FolderGateKeeper.getFolder()

getFullName

public java.lang.String getFullName()
                             throws javax.mail.MessagingException
Specified by:
getFullName in interface FolderGateKeeper
Throws:
javax.mail.MessagingException
See Also:
FolderGateKeeper.getFullName()

create

public void create(int holds_folders)
            throws javax.mail.MessagingException
Specified by:
create in interface FolderGateKeeper
Throws:
javax.mail.MessagingException
See Also:
FolderGateKeeper.create(int)

exists

public boolean exists()
               throws javax.mail.MessagingException
Specified by:
exists in interface FolderGateKeeper
Throws:
javax.mail.MessagingException
See Also:
FolderGateKeeper.exists()

renameTo

public void renameTo(javax.mail.Folder destination)
              throws javax.mail.MessagingException
Specified by:
renameTo in interface FolderGateKeeper
Throws:
javax.mail.MessagingException
See Also:
FolderGateKeeper.renameTo(javax.mail.Folder)

renameTo

public void renameTo(java.lang.String newName)
              throws javax.mail.MessagingException
Specified by:
renameTo in interface FolderGateKeeper
Throws:
javax.mail.MessagingException
See Also:
FolderGateKeeper.renameTo(java.lang.String)


Copyright ? 2002-2009 The Apache Software Foundation. All Rights Reserved.