public CapabilityCommandParser() { super(ImapCommand.anyStateCommand(ImapConstants.CAPABILITY_COMMAND_NAME)); }
public static ImapCommand anyStateCommand(final String name) { return new ImapCommand(true, true, true, name); }
public UnselectCommandParser() { // from the RFC it seems like the command should be valid in any state. // At least kind of, as we will return a "BAD" response if no mailbox is // currently selected in the UnselectProcessor super(ImapCommand.authenticatedStateCommand(ImapConstants.UNSELECT_COMMAND_NAME)); }
@Override protected void doProcess(SetQuotaRequest message, ImapSession session, String tag, ImapCommand command, Responder responder) { Object[] params = new Object[]{ "Full admin rights", command.getName(), "Can not perform SETQUOTA commands" }; HumanReadableText humanReadableText = new HumanReadableText(HumanReadableText.UNSUFFICIENT_RIGHTS_KEY, HumanReadableText.UNSUFFICIENT_RIGHTS_DEFAULT_VALUE, params); no(command, tag, responder, humanReadableText); }
public CheckCommandParser() { super(ImapCommand.selectedStateCommand(ImapConstants.CHECK_COMMAND_NAME)); }
/** * Parses a request into a command message for later processing. * * @param request * <code>ImapRequestLineReader</code>, not null * @return <code>ImapCommandMessage</code>, not null */ @Override public final ImapMessage parse(ImapRequestLineReader request, String tag, ImapSession session) { ImapMessage result; if (!command.validForState(session.getState())) { result = statusResponseFactory.taggedNo(tag, command, HumanReadableText.INVALID_COMMAND); } else { try { result = decode(command, request, tag, session); } catch (DecodingException e) { LOGGER.debug("Cannot parse protocol ", e); result = statusResponseFactory.taggedBad(tag, command, e.getKey()); } } return result; }
public AuthenticateCommandParser() { super(ImapCommand.nonAuthenticatedStateCommand(ImapConstants.AUTHENTICATE_COMMAND_NAME)); }
/** * @see * org.apache.james.imap.encode.ImapResponseComposer#commandResponse(org.apache.james.imap.api.ImapCommand, * java.lang.String) */ public ImapResponseComposer commandResponse(ImapCommand command, String message) throws IOException { untagged(); commandName(command.getName()); message(message); end(); return this; }
public CopyCommandParser() { super(ImapCommand.selectedStateCommand(ImapConstants.COPY_COMMAND_NAME)); }
/** * Parses a request into a command message for later processing. * * @param request * <code>ImapRequestLineReader</code>, not null * @return <code>ImapCommandMessage</code>, not null */ public final ImapMessage parse(ImapRequestLineReader request, String tag, ImapSession session) { ImapMessage result; if (!command.validForState(session.getState())) { result = statusResponseFactory.taggedNo(tag, command, HumanReadableText.INVALID_COMMAND); } else { try { result = decode(command, request, tag, session); } catch (DecodingException e) { if (session.getLog().isDebugEnabled()) { session.getLog().debug("Cannot parse protocol ", e); } result = statusResponseFactory.taggedBad(tag, command, e.getKey()); } } return result; }
public AuthenticateCommandParser() { super(ImapCommand.nonAuthenticatedStateCommand(ImapConstants.AUTHENTICATE_COMMAND_NAME)); }
public NoopCommandParser() { super(ImapCommand.anyStateCommand(ImapConstants.NOOP_COMMAND_NAME)); }
@Override public ImapResponseComposer commandResponse(ImapCommand command, String message) throws IOException { untagged(); commandName(command.getName()); message(message); end(); return this; }
public UnselectCommandParser() { // from the RFC it seems like the command should be valid in any state. // At least kind of, as we will return a "BAD" response if no mailbox is // currently selected in the UnselectProcessor super(ImapCommand.authenticatedStateCommand(ImapConstants.UNSELECT_COMMAND_NAME)); }
public CopyCommandParser() { super(ImapCommand.selectedStateCommand(ImapConstants.COPY_COMMAND_NAME)); }
final void doProcess(final M message, final ImapCommand command, final String tag, Responder responder, ImapSession session) { if (!command.validForState(session.getState())) { ImapResponseMessage response = factory.taggedNo(tag, command, HumanReadableText.INVALID_COMMAND); responder.respond(response); } else { getMailboxManager().startProcessingRequest(ImapSessionUtils.getMailboxSession(session)); doProcess(message, session, tag, command, responder); getMailboxManager().endProcessingRequest(ImapSessionUtils.getMailboxSession(session)); } }
public static ImapCommand nonAuthenticatedStateCommand(final String name) { return new ImapCommand(false, false, true, name); }
public StartTLSCommandParser() { super(ImapCommand.nonAuthenticatedStateCommand(ImapConstants.STARTTLS)); }
public LogoutCommandParser() { super(ImapCommand.anyStateCommand(ImapConstants.LOGOUT_COMMAND_NAME)); }
@Override protected void doProcess(GetAnnotationRequest message, ImapSession session, String tag, ImapCommand command, Responder responder) { try { proceed(message, session, tag, command, responder); } catch (MailboxNotFoundException e) { LOGGER.info("The command: {} is failed because not found mailbox {}", command.getName(), message.getMailboxName()); no(command, tag, responder, HumanReadableText.FAILURE_NO_SUCH_MAILBOX, ResponseCode.tryCreate()); } catch (MailboxException e) { LOGGER.error("GetAnnotation on mailbox {} failed for user {}", message.getMailboxName(), ImapSessionUtils.getUserName(session), e); no(command, tag, responder, HumanReadableText.GENERIC_FAILURE_DURING_PROCESSING); } }