本文整理汇总了Java中com.icegreen.greenmail.store.FolderException类的典型用法代码示例。如果您正苦于以下问题:Java FolderException类的具体用法?Java FolderException怎么用?Java FolderException使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
FolderException类属于com.icegreen.greenmail.store包,在下文中一共展示了FolderException类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: replaceFlagsInternal
import com.icegreen.greenmail.store.FolderException; //导入依赖的package包/类
/**
* Replaces flags for the message with the given UID. If {@code addUid} is set to {@code true}
* {@link FolderListener} objects defined for this folder will be notified.
* {@code silentListener} can be provided - this listener wouldn't be notified.
*
* @param flags - new flags.
* @param uid - message UID.
* @param silentListener - listener that shouldn't be notified.
* @param addUid - defines whether or not listeners be notified.
* @throws FolderException
* @throws MessagingException
*/
@Override
protected void replaceFlagsInternal(
Flags flags,
long uid,
FolderListener silentListener,
boolean addUid)
throws FolderException, MessagingException
{
int msn = getMsn(uid);
FileInfo fileInfo = searchMails().get(uid);
imapService.setFlags(fileInfo, MessageFlags.ALL_FLAGS, false);
imapService.setFlags(fileInfo, flags, true);
Long uidNotification = addUid ? uid : null;
notifyFlagUpdate(msn, flags, uidNotification, silentListener);
}
示例2: appendMessage
import com.icegreen.greenmail.store.FolderException; //导入依赖的package包/类
/**
* Appends message to the folder.
*
* @param message - message.
* @param flags - message flags.
* @param internalDate - not used. Current date used instead.
* @return long
*/
public long appendMessage(final MimeMessage message, final Flags flags, final Date internalDate) throws FolderException
{
if (isReadOnly())
{
throw new FolderException("Can't append message - Permission denied");
}
CommandCallback<Long> command = new CommandCallback<Long>()
{
public Long command() throws Throwable
{
return appendMessageInternal(message, flags, internalDate);
}
};
return command.runFeedback();
}
示例3: copyMessage
import com.icegreen.greenmail.store.FolderException; //导入依赖的package包/类
/**
* Copies message with the given UID to the specified {@link MailFolder}.
*
* @param uid - UID of the message
* @param toFolder - reference to the destination folder.
*/
public long copyMessage(final long uid, final MailFolder toFolder) throws FolderException
{
AbstractImapFolder toImapMailFolder = (AbstractImapFolder) toFolder;
if (toImapMailFolder.isReadOnly())
{
throw new FolderException(AlfrescoImapFolderException.PERMISSION_DENIED);
}
CommandCallback<Long> command = new CommandCallback<Long>()
{
public Long command() throws Throwable
{
return copyMessageInternal(uid, toFolder);
}
};
return command.runFeedback();
}
示例4: expunge
import com.icegreen.greenmail.store.FolderException; //导入依赖的package包/类
/**
* Deletes messages marked with {@link javax.mail.Flags.Flag#DELETED}. Note that this message deletes all messages with this flag.
*/
public void expunge() throws FolderException
{
if (isReadOnly())
{
throw new FolderException("Can't expunge - Permission denied");
}
CommandCallback<Object> command = new CommandCallback<Object>()
{
public Object command() throws Throwable
{
expungeInternal();
return null;
}
};
command.runFeedback();
}
示例5: setFlags
import com.icegreen.greenmail.store.FolderException; //导入依赖的package包/类
/**
* Sets flags for the message with the given UID. If {@code addUid} is set to {@code true}
* {@link FolderListener} objects defined for this folder will be notified.
* {@code silentListener} can be provided - this listener wouldn't be notified.
*
* @param flags - new flags.
* @param value - flags value.
* @param uid - message UID.
* @param silentListener - listener that shouldn't be notified.
* @param addUid - defines whether or not listeners be notified.
*/
public void setFlags(
final Flags flags,
final boolean value,
final long uid,
final FolderListener silentListener,
final boolean addUid)
throws FolderException
{
CommandCallback<Object> command = new CommandCallback<Object>()
{
public Object command() throws Throwable
{
setFlagsInternal(flags, value, uid, silentListener, addUid);
return null;
}
};
command.runFeedback();
}
示例6: deleteAllMessagesInternal
import com.icegreen.greenmail.store.FolderException; //导入依赖的package包/类
/**
* Marks all messages in the folder as deleted using {@link javax.mail.Flags.Flag#DELETED} flag.
*/
@Override
public void deleteAllMessagesInternal() throws FolderException
{
if (isReadOnly())
{
throw new FolderException("Can't delete all - Permission denied");
}
for (Map.Entry<Long, FileInfo> entry : searchMails().entrySet())
{
imapService.setFlag(entry.getValue(), Flags.Flag.DELETED, true);
// comment out to physically remove content.
// fileFolderService.delete(fileInfo.getNodeRef());
}
}
示例7: setFlagsInternal
import com.icegreen.greenmail.store.FolderException; //导入依赖的package包/类
/**
* Sets flags for the message with the given UID. If {@code addUid} is set to {@code true}
* {@link FolderListener} objects defined for this folder will be notified.
* {@code silentListener} can be provided - this listener wouldn't be notified.
*
* @param flags - new flags.
* @param value - flags value.
* @param uid - message UID.
* @param silentListener - listener that shouldn't be notified.
* @param addUid - defines whether or not listeners be notified.
* @throws MessagingException
* @throws FolderException
*/
@Override
protected void setFlagsInternal(
Flags flags,
boolean value,
long uid,
FolderListener silentListener,
boolean addUid)
throws MessagingException, FolderException
{
int msn = getMsn(uid);
FileInfo fileInfo = searchMails().get(uid);
imapService.setFlags(fileInfo, flags, value);
Long uidNotification = null;
if (addUid)
{
uidNotification = new Long(uid);
}
notifyFlagUpdate(msn, flags, uidNotification, silentListener);
}
示例8: listSubscribedMailboxes
import com.icegreen.greenmail.store.FolderException; //导入依赖的package包/类
/**
* Returns an collection of subscribed mailboxes. To appear in search result mailboxes should have
* {http://www.alfresco.org/model/imap/1.0}subscribed property specified for user. Method searches
* subscribed mailboxes under mount points defined for a specific user. Mount points include user's
* IMAP Virtualised Views and Email Archive Views. This method serves LSUB command of the IMAP protocol.
*
* @param user User making the request
* @param mailboxPattern String name of a mailbox possible including a wildcard.
* @return Collection of mailboxes matching the pattern.
* @throws com.icegreen.greenmail.store.FolderException
*/
public Collection<MailFolder> listSubscribedMailboxes(GreenMailUser user, String mailboxPattern)
throws FolderException
{
try
{
AlfrescoImapUser alfrescoUser = new AlfrescoImapUser(user.getEmail(), user.getLogin(), user.getPassword());
return registerMailboxes(imapService.listMailboxes(alfrescoUser, getUnqualifiedMailboxPattern(
alfrescoUser, mailboxPattern), true));
}
catch (Throwable e)
{
logger.debug(e.getMessage(), e);
throw new FolderException(e.getMessage());
}
}
示例9: renameMailbox
import com.icegreen.greenmail.store.FolderException; //导入依赖的package包/类
/**
* Renames an existing mailbox. The specified mailbox must already exist, the requested name must not exist
* already but must be able to be created and the user must have rights to delete the existing mailbox and
* create a mailbox with the new name. Any inferior hierarchical names must also be renamed. If INBOX is renamed,
* the contents of INBOX are transferred to a new mailbox with the new name, but INBOX is not deleted.
* If INBOX has inferior mailbox these are not renamed. This method serves RENAME command of the IMAP
* protocol. <p/> Method searches mailbox under mount points defined for a specific user. Mount points
* include user's IMAP Virtualised Views and Email Archive Views.
*
* @param user User making the request.
* @param oldMailboxName String name of the existing folder
* @param newMailboxName String target new name
* @throws com.icegreen.greenmail.store.FolderException if an existing folder with the new name.
* @throws AlfrescoImapFolderException if user does not have rights to create the new mailbox.
*/
public void renameMailbox(GreenMailUser user, String oldMailboxName, String newMailboxName) throws FolderException, AuthorizationException
{
try
{
AlfrescoImapUser alfrescoUser = new AlfrescoImapUser(user.getEmail(), user.getLogin(), user.getPassword());
String oldFolderPath = getUnqualifiedMailboxPattern(alfrescoUser,
oldMailboxName);
String newFolderpath = getUnqualifiedMailboxPattern(alfrescoUser, newMailboxName);
imapService.renameMailbox(alfrescoUser, oldFolderPath, newFolderpath);
if (folderCache != null)
{
folderCache.remove(oldFolderPath);
folderCache.remove(newFolderpath);
}
}
catch (Throwable e)
{
logger.debug(e.getMessage(), e);
throw new FolderException(e.getMessage());
}
}
示例10: deleteMailbox
import com.icegreen.greenmail.store.FolderException; //导入依赖的package包/类
/**
* Deletes an existing MailBox. Specified mailbox must already exist on this server, and the user
* must have rights to delete it. <p/> This method serves DELETE command of the IMAP protocol.
*
* @param user User making the request.
* @param mailboxName String name of the target
* @throws com.icegreen.greenmail.store.FolderException if mailbox has a non-selectable store with children
*/
public void deleteMailbox(GreenMailUser user, String mailboxName) throws FolderException, AuthorizationException
{
try
{
AlfrescoImapUser alfrescoUser = new AlfrescoImapUser(user.getEmail(), user.getLogin(), user.getPassword());
String folderPath = getUnqualifiedMailboxPattern(alfrescoUser, mailboxName);
imapService.deleteMailbox(alfrescoUser, folderPath);
if (folderCache != null)
{
folderCache.remove(folderPath);
}
}
catch (Throwable e)
{
logger.debug(e.getMessage(), e);
throw new FolderException(e.getMessage());
}
}
示例11: getFolder
import com.icegreen.greenmail.store.FolderException; //导入依赖的package包/类
/**
* Simply calls {@link #getFolder(GreenMailUser, String)}. <p/> Added to implement {@link ImapHostManager}.
*/
public MailFolder getFolder(final GreenMailUser user, final String mailboxName, boolean mustExist)
throws FolderException
{
try
{
return getFolder(user, mailboxName);
}
catch (AlfrescoImapRuntimeException e)
{
if (!mustExist)
{
return null;
}
else if (e.getCause() instanceof FolderException)
{
throw (FolderException) e.getCause();
}
throw e;
}
}
示例12: doProcess
import com.icegreen.greenmail.store.FolderException; //导入依赖的package包/类
/**
* @see CommandTemplate#doProcess
*/
protected void doProcess(ImapRequestLineReader request,
ImapResponse response,
ImapSession session)
throws ProtocolException, FolderException, AuthorizationException {
String mailboxName = parser.mailbox(request);
parser.endLine(request);
MailFolder folder = getMailbox(mailboxName, session, true);
if (session.getSelected() != null &&
folder.getFullName().equals(session.getSelected().getFullName())) {
session.deselect();
}
session.getHost().deleteMailbox(session.getUser(), mailboxName);
session.unsolicitedResponses(response);
response.commandComplete(this);
}
示例13: doProcess
import com.icegreen.greenmail.store.FolderException; //导入依赖的package包/类
/**
* @see CommandTemplate#doProcess
*/
protected void doProcess(ImapRequestLineReader request,
ImapResponse response,
ImapSession session)
throws ProtocolException, FolderException {
parser.endLine(request);
if (!session.getSelected().isReadonly()) {
MailFolder folder = session.getSelected();
folder.expunge();
}
session.deselect();
// Don't send unsolicited responses on close.
session.unsolicitedResponses(response);
response.commandComplete(this);
}
示例14: getAllMessages
import com.icegreen.greenmail.store.FolderException; //导入依赖的package包/类
public List getAllMessages() {
List ret = new ArrayList();
try {
Collection boxes = store.listMailboxes("*");
for (Iterator iterator = boxes.iterator(); iterator.hasNext();) {
MailFolder folder = (MailFolder) iterator.next();
List messages = folder.getMessages();
for (int i = 0; i < messages.size(); i++) {
ret.add(messages.get(i));
}
}
} catch (FolderException e) {
throw new RuntimeException(e);
}
return ret;
}
示例15: deleteMailbox
import com.icegreen.greenmail.store.FolderException; //导入依赖的package包/类
/**
* @see ImapHostManager#deleteMailbox
*/
public void deleteMailbox(GreenMailUser user, String mailboxName)
throws FolderException, AuthorizationException {
MailFolder toDelete = getFolder(user, mailboxName, true);
if (store.getChildren(toDelete).isEmpty()) {
toDelete.deleteAllMessages();
toDelete.signalDeletion();
store.deleteMailbox(toDelete);
} else {
if (toDelete.isSelectable()) {
toDelete.deleteAllMessages();
store.setSelectable(toDelete, false);
} else {
throw new FolderException("Can't delete a non-selectable store with children.");
}
}
}