本文整理汇总了Java中com.icegreen.greenmail.store.FolderException类的典型用法代码示例。如果您正苦于以下问题:Java FolderException类的具体用法?Java FolderException怎么用?Java FolderException使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
FolderException类属于com.icegreen.greenmail.store包,在下文中一共展示了FolderException类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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);
}
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:29,代码来源:AlfrescoImapFolder.java
示例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();
}
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:25,代码来源:AbstractImapFolder.java
示例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();
}
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:25,代码来源:AbstractImapFolder.java
示例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();
}
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:20,代码来源:AbstractImapFolder.java
示例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();
}
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:30,代码来源:AbstractImapFolder.java
示例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());
}
}
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:19,代码来源:AlfrescoImapFolder.java
示例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);
}
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:35,代码来源:AlfrescoImapFolder.java
示例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());
}
}
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:27,代码来源:AlfrescoImapHostManager.java
示例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());
}
}
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:37,代码来源:AlfrescoImapHostManager.java
示例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());
}
}
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:27,代码来源:AlfrescoImapHostManager.java
示例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;
}
}
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:24,代码来源:AlfrescoImapHostManager.java
示例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);
}
开发者ID:Alfresco,项目名称:alfresco-greenmail,代码行数:22,代码来源:DeleteCommand.java
示例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);
}
开发者ID:Alfresco,项目名称:alfresco-greenmail,代码行数:20,代码来源:CloseCommand.java
示例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;
}
开发者ID:Alfresco,项目名称:alfresco-greenmail,代码行数:17,代码来源:ImapHostManagerImpl.java
示例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.");
}
}
}
开发者ID:Alfresco,项目名称:alfresco-greenmail,代码行数:20,代码来源:ImapHostManagerImpl.java
示例16: getExpunged
import com.icegreen.greenmail.store.FolderException; //导入依赖的package包/类
public int[] getExpunged() throws FolderException {
synchronized (_expungedMsns) {
int[] expungedMsns = new int[_expungedMsns.size()];
for (int i = 0; i < expungedMsns.length; i++) {
int msn = ((Integer) _expungedMsns.get(i)).intValue();
expungedMsns[i] = msn;
}
_expungedMsns.clear();
// TODO - renumber any cached ids (for now we assume the _modifiedFlags has been cleared)\
if (!(_modifiedFlags.isEmpty() && !_sizeChanged)) {
throw new IllegalStateException("Need to do this properly...");
}
return expungedMsns;
}
}
开发者ID:Alfresco,项目名称:alfresco-greenmail,代码行数:17,代码来源:ImapSessionFolder.java
示例17: execute
import com.icegreen.greenmail.store.FolderException; //导入依赖的package包/类
public void execute(Pop3Connection conn, Pop3State state,
String cmd) {
try {
MailFolder folder = state.getFolder();
if (folder != null) {
folder.expunge();
}
conn.println("+OK bye see you soon");
conn.quit();
} catch (FolderException me) {
conn.println("+OK Signing off, but message deletion failed");
conn.quit();
}
}
开发者ID:Alfresco,项目名称:alfresco-greenmail,代码行数:17,代码来源:QuitCommand.java
示例18: testSimpleEmail
import com.icegreen.greenmail.store.FolderException; //导入依赖的package包/类
@Test
public void testSimpleEmail() throws MangooMailerException, MessagingException, IOException, FolderException {
//given
greenMail.purgeEmailFromAllMailboxes();
assertThat(greenMail.getReceivedMessagesForDomain("winterfell.com").length, equalTo(0));
//when
Mail.newMail()
.withFrom("Jon Snow <[email protected]>")
.withRecipient("[email protected]")
.withSubject("Lord of light")
.withTemplate("emails/simple.ftl")
.withContent("king", "geofrey")
.send();
//then
assertThat(greenMail.getReceivedMessagesForDomain("winterfell.com")[0].getContent().toString(), containsString("geofrey"));
assertThat(greenMail.getReceivedMessagesForDomain("winterfell.com").length, equalTo(1));
}
开发者ID:svenkubiak,项目名称:mangooio,代码行数:20,代码来源:MailTest.java
示例19: testHtmlEmail
import com.icegreen.greenmail.store.FolderException; //导入依赖的package包/类
@Test
public void testHtmlEmail() throws MangooMailerException, FolderException, IOException, MessagingException {
//given
greenMail.purgeEmailFromAllMailboxes();
assertThat(greenMail.getReceivedMessagesForDomain("thewall.com").length, equalTo(0));
//when
Mail.newMail()
.withFrom("Jon Snow <[email protected]>")
.withRecipient("[email protected]")
.withSubject("Lord of light")
.withTemplate("emails/html.ftl")
.withContent("king", "kong")
.send();
//then
assertThat(greenMail.getReceivedMessagesForDomain("thewall.com").length, equalTo(1));
assertThat(greenMail.getReceivedMessagesForDomain("thewall.com")[0].getContent().toString(), containsString("kong"));
}
开发者ID:svenkubiak,项目名称:mangooio,代码行数:20,代码来源:MailTest.java
示例20: testMultiPartEmail
import com.icegreen.greenmail.store.FolderException; //导入依赖的package包/类
@Test
public void testMultiPartEmail() throws MangooMailerException, IOException, FolderException, MessagingException {
//given
greenMail.purgeEmailFromAllMailboxes();
assertThat(greenMail.getReceivedMessagesForDomain("westeros.com").length, equalTo(0));
File file = new File(UUID.randomUUID().toString());
file.createNewFile();
//when
Mail.newMail()
.withFrom("Jon Snow <[email protected]>")
.withRecipient("[email protected]")
.withSubject("Lord of light")
.withTemplate("emails/multipart.ftl")
.withContent("name", "raven")
.withContent("king", "none")
.withAttachment(file)
.send();
//then
assertThat(file.delete(), equalTo(true));
assertThat(greenMail.getReceivedMessagesForDomain("westeros.com").length, equalTo(1));
}
开发者ID:svenkubiak,项目名称:mangooio,代码行数:24,代码来源:MailTest.java
注:本文中的com.icegreen.greenmail.store.FolderException类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论