You are viewing a plain text version of this content. The canonical link for it is here.
Posted to server-dev@james.apache.org by rd...@apache.org on 2007/02/10 09:18:56 UTC
svn commit: r505653 [3/3] -
/james/server/sandbox/seda-imap/src/java/org/apache/james/imapserver/commands/
Modified: james/server/sandbox/seda-imap/src/java/org/apache/james/imapserver/commands/StatusCommand.java
URL: http://svn.apache.org/viewvc/james/server/sandbox/seda-imap/src/java/org/apache/james/imapserver/commands/StatusCommand.java?view=diff&rev=505653&r1=505652&r2=505653
==============================================================================
--- james/server/sandbox/seda-imap/src/java/org/apache/james/imapserver/commands/StatusCommand.java (original)
+++ james/server/sandbox/seda-imap/src/java/org/apache/james/imapserver/commands/StatusCommand.java Sat Feb 10 00:18:54 2007
@@ -19,15 +19,8 @@
package org.apache.james.imapserver.commands;
-import org.apache.avalon.framework.logger.Logger;
-import org.apache.james.imapserver.AuthorizationException;
import org.apache.james.imapserver.ImapRequestLineReader;
-import org.apache.james.imapserver.ImapResponse;
-import org.apache.james.imapserver.ImapSession;
import org.apache.james.imapserver.ProtocolException;
-import org.apache.james.imapserver.store.MailboxException;
-import org.apache.james.mailboxmanager.MailboxManagerException;
-import org.apache.james.mailboxmanager.mailbox.ImapMailboxSession;
/**
* Handles processeing for the STATUS imap command.
@@ -39,11 +32,11 @@
public static final String NAME = "STATUS";
public static final String ARGS = "<mailbox> ( <status-data-item>+ )";
- private static final String MESSAGES = "MESSAGES";
- private static final String RECENT = "RECENT";
- private static final String UIDNEXT = "UIDNEXT";
- private static final String UIDVALIDITY = "UIDVALIDITY";
- private static final String UNSEEN = "UNSEEN";
+ static final String MESSAGES = "MESSAGES";
+ static final String RECENT = "RECENT";
+ static final String UIDNEXT = "UIDNEXT";
+ static final String UIDVALIDITY = "UIDVALIDITY";
+ static final String UNSEEN = "UNSEEN";
private StatusCommandParser parser = new StatusCommandParser();
@@ -106,15 +99,6 @@
}
}
- private class StatusDataItems
- {
- boolean messages;
- boolean recent;
- boolean uidNext;
- boolean uidValidity;
- boolean unseen;
- }
-
protected AbstractImapCommandMessage decode(ImapRequestLineReader request, String tag) throws ProtocolException {
final String mailboxName = parser.mailbox( request );
final StatusDataItems statusDataItems = parser.statusDataItems( request );
@@ -122,98 +106,6 @@
final StatusCommandMessage result =
new StatusCommandMessage(this, mailboxName, statusDataItems, tag);
return result;
- }
-
- private static class StatusCommandMessage extends AbstractImapCommandMessage {
- private final String mailboxName;
- private final StatusDataItems statusDataItems;
-
- public StatusCommandMessage(final ImapCommand command, final String mailboxName, final StatusDataItems statusDataItems, final String tag) {
- super(tag, command);
- this.mailboxName = mailboxName;
- this.statusDataItems = statusDataItems;
- }
-
- protected ImapResponseMessage doProcess(ImapSession session, String tag, ImapCommand command) throws MailboxException, AuthorizationException, ProtocolException {
- final Logger logger = getLogger();
-
- StringBuffer buffer = new StringBuffer( mailboxName );
- buffer.append( SP );
- buffer.append( "(" );
- try {
- String fullMailboxName= session.buildFullName(mailboxName);
-
- if (logger != null && logger.isDebugEnabled()) {
- logger.debug("Status called on mailbox named " + mailboxName + " (" + fullMailboxName + ")");
- }
-
- ImapMailboxSession mailbox = session.getMailboxManager().getImapMailboxSession(fullMailboxName);
-
- if (statusDataItems.messages) {
- buffer.append(MESSAGES);
- buffer.append(SP);
-
- buffer.append(mailbox.getMessageCount());
-
- buffer.append(SP);
- }
-
- if (statusDataItems.recent) {
- buffer.append(RECENT);
- buffer.append(SP);
- buffer.append(mailbox.getRecentCount(false));
- buffer.append(SP);
- }
-
- if (statusDataItems.uidNext) {
- buffer.append(UIDNEXT);
- buffer.append(SP);
- buffer.append(mailbox.getUidNext());
- buffer.append(SP);
- }
-
- if (statusDataItems.uidValidity) {
- buffer.append(UIDVALIDITY);
- buffer.append(SP);
- buffer.append(mailbox.getUidValidity());
- buffer.append(SP);
- }
-
- if (statusDataItems.unseen) {
- buffer.append(UNSEEN);
- buffer.append(SP);
- buffer.append(mailbox.getUnseenCount());
- buffer.append(SP);
- }
- } catch (MailboxManagerException e) {
- if (logger != null && logger.isDebugEnabled()) {
- logger.debug("STATUS command failed: ", e);
- }
- throw new MailboxException(e);
- }
- if ( buffer.charAt( buffer.length() - 1 ) == ' ' ) {
- buffer.setLength( buffer.length() - 1 );
- }
- buffer.append(')');
- final StatusResponseMessage result =
- new StatusResponseMessage(command, buffer.toString(), tag);
- return result;
- }
- }
-
- private static class StatusResponseMessage extends AbstractCommandResponseMessage {
- private final String message;
-
- public StatusResponseMessage(ImapCommand command, final String message, final String tag) {
- super(command, tag);
- this.message = message;
- }
-
- void doEncode(ImapResponse response, ImapSession session, ImapCommand command, String tag) throws MailboxException {
- response.commandResponse( command, message);
- session.unsolicitedResponses( response, false );
- response.commandComplete( command, tag );
- }
}
}
/*
Added: james/server/sandbox/seda-imap/src/java/org/apache/james/imapserver/commands/StatusCommandMessage.java
URL: http://svn.apache.org/viewvc/james/server/sandbox/seda-imap/src/java/org/apache/james/imapserver/commands/StatusCommandMessage.java?view=auto&rev=505653
==============================================================================
--- james/server/sandbox/seda-imap/src/java/org/apache/james/imapserver/commands/StatusCommandMessage.java (added)
+++ james/server/sandbox/seda-imap/src/java/org/apache/james/imapserver/commands/StatusCommandMessage.java Sat Feb 10 00:18:54 2007
@@ -0,0 +1,104 @@
+/****************************************************************
+ * Licensed to the Apache Software Foundation (ASF) under one *
+ * or more contributor license agreements. See the NOTICE file *
+ * distributed with this work for additional information *
+ * regarding copyright ownership. The ASF licenses this file *
+ * to you under the Apache License, Version 2.0 (the *
+ * "License"); you may not use this file except in compliance *
+ * with the License. You may obtain a copy of the License at *
+ * *
+ * http://www.apache.org/licenses/LICENSE-2.0 *
+ * *
+ * Unless required by applicable law or agreed to in writing, *
+ * software distributed under the License is distributed on an *
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY *
+ * KIND, either express or implied. See the License for the *
+ * specific language governing permissions and limitations *
+ * under the License. *
+ ****************************************************************/
+package org.apache.james.imapserver.commands;
+
+import org.apache.avalon.framework.logger.Logger;
+import org.apache.james.imapserver.AuthorizationException;
+import org.apache.james.imapserver.ImapSession;
+import org.apache.james.imapserver.ProtocolException;
+import org.apache.james.imapserver.store.MailboxException;
+import org.apache.james.mailboxmanager.MailboxManagerException;
+import org.apache.james.mailboxmanager.mailbox.ImapMailboxSession;
+
+class StatusCommandMessage extends AbstractImapCommandMessage {
+ private final String mailboxName;
+ private final StatusDataItems statusDataItems;
+
+ public StatusCommandMessage(final ImapCommand command, final String mailboxName, final StatusDataItems statusDataItems, final String tag) {
+ super(tag, command);
+ this.mailboxName = mailboxName;
+ this.statusDataItems = statusDataItems;
+ }
+
+ protected ImapResponseMessage doProcess(ImapSession session, String tag, ImapCommand command) throws MailboxException, AuthorizationException, ProtocolException {
+ final Logger logger = getLogger();
+
+ StringBuffer buffer = new StringBuffer( mailboxName );
+ buffer.append( StatusCommand.SP );
+ buffer.append( "(" );
+ try {
+ String fullMailboxName= session.buildFullName(mailboxName);
+
+ if (logger != null && logger.isDebugEnabled()) {
+ logger.debug("Status called on mailbox named " + mailboxName + " (" + fullMailboxName + ")");
+ }
+
+ ImapMailboxSession mailbox = session.getMailboxManager().getImapMailboxSession(fullMailboxName);
+
+ if (statusDataItems.messages) {
+ buffer.append(StatusCommand.MESSAGES);
+ buffer.append(StatusCommand.SP);
+
+ buffer.append(mailbox.getMessageCount());
+
+ buffer.append(StatusCommand.SP);
+ }
+
+ if (statusDataItems.recent) {
+ buffer.append(StatusCommand.RECENT);
+ buffer.append(StatusCommand.SP);
+ buffer.append(mailbox.getRecentCount(false));
+ buffer.append(StatusCommand.SP);
+ }
+
+ if (statusDataItems.uidNext) {
+ buffer.append(StatusCommand.UIDNEXT);
+ buffer.append(StatusCommand.SP);
+ buffer.append(mailbox.getUidNext());
+ buffer.append(StatusCommand.SP);
+ }
+
+ if (statusDataItems.uidValidity) {
+ buffer.append(StatusCommand.UIDVALIDITY);
+ buffer.append(StatusCommand.SP);
+ buffer.append(mailbox.getUidValidity());
+ buffer.append(StatusCommand.SP);
+ }
+
+ if (statusDataItems.unseen) {
+ buffer.append(StatusCommand.UNSEEN);
+ buffer.append(StatusCommand.SP);
+ buffer.append(mailbox.getUnseenCount());
+ buffer.append(StatusCommand.SP);
+ }
+ } catch (MailboxManagerException e) {
+ if (logger != null && logger.isDebugEnabled()) {
+ logger.debug("STATUS command failed: ", e);
+ }
+ throw new MailboxException(e);
+ }
+ if ( buffer.charAt( buffer.length() - 1 ) == ' ' ) {
+ buffer.setLength( buffer.length() - 1 );
+ }
+ buffer.append(')');
+ final StatusResponseMessage result =
+ new StatusResponseMessage(command, buffer.toString(), tag);
+ return result;
+ }
+}
Added: james/server/sandbox/seda-imap/src/java/org/apache/james/imapserver/commands/StatusDataItems.java
URL: http://svn.apache.org/viewvc/james/server/sandbox/seda-imap/src/java/org/apache/james/imapserver/commands/StatusDataItems.java?view=auto&rev=505653
==============================================================================
--- james/server/sandbox/seda-imap/src/java/org/apache/james/imapserver/commands/StatusDataItems.java (added)
+++ james/server/sandbox/seda-imap/src/java/org/apache/james/imapserver/commands/StatusDataItems.java Sat Feb 10 00:18:54 2007
@@ -0,0 +1,28 @@
+/****************************************************************
+ * Licensed to the Apache Software Foundation (ASF) under one *
+ * or more contributor license agreements. See the NOTICE file *
+ * distributed with this work for additional information *
+ * regarding copyright ownership. The ASF licenses this file *
+ * to you under the Apache License, Version 2.0 (the *
+ * "License"); you may not use this file except in compliance *
+ * with the License. You may obtain a copy of the License at *
+ * *
+ * http://www.apache.org/licenses/LICENSE-2.0 *
+ * *
+ * Unless required by applicable law or agreed to in writing, *
+ * software distributed under the License is distributed on an *
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY *
+ * KIND, either express or implied. See the License for the *
+ * specific language governing permissions and limitations *
+ * under the License. *
+ ****************************************************************/
+package org.apache.james.imapserver.commands;
+
+class StatusDataItems
+{
+ boolean messages;
+ boolean recent;
+ boolean uidNext;
+ boolean uidValidity;
+ boolean unseen;
+}
Added: james/server/sandbox/seda-imap/src/java/org/apache/james/imapserver/commands/StatusResponseMessage.java
URL: http://svn.apache.org/viewvc/james/server/sandbox/seda-imap/src/java/org/apache/james/imapserver/commands/StatusResponseMessage.java?view=auto&rev=505653
==============================================================================
--- james/server/sandbox/seda-imap/src/java/org/apache/james/imapserver/commands/StatusResponseMessage.java (added)
+++ james/server/sandbox/seda-imap/src/java/org/apache/james/imapserver/commands/StatusResponseMessage.java Sat Feb 10 00:18:54 2007
@@ -0,0 +1,38 @@
+/****************************************************************
+ * Licensed to the Apache Software Foundation (ASF) under one *
+ * or more contributor license agreements. See the NOTICE file *
+ * distributed with this work for additional information *
+ * regarding copyright ownership. The ASF licenses this file *
+ * to you under the Apache License, Version 2.0 (the *
+ * "License"); you may not use this file except in compliance *
+ * with the License. You may obtain a copy of the License at *
+ * *
+ * http://www.apache.org/licenses/LICENSE-2.0 *
+ * *
+ * Unless required by applicable law or agreed to in writing, *
+ * software distributed under the License is distributed on an *
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY *
+ * KIND, either express or implied. See the License for the *
+ * specific language governing permissions and limitations *
+ * under the License. *
+ ****************************************************************/
+package org.apache.james.imapserver.commands;
+
+import org.apache.james.imapserver.ImapResponse;
+import org.apache.james.imapserver.ImapSession;
+import org.apache.james.imapserver.store.MailboxException;
+
+class StatusResponseMessage extends AbstractCommandResponseMessage {
+ private final String message;
+
+ public StatusResponseMessage(ImapCommand command, final String message, final String tag) {
+ super(command, tag);
+ this.message = message;
+ }
+
+ void doEncode(ImapResponse response, ImapSession session, ImapCommand command, String tag) throws MailboxException {
+ response.commandResponse( command, message);
+ session.unsolicitedResponses( response, false );
+ response.commandComplete( command, tag );
+ }
+}
Modified: james/server/sandbox/seda-imap/src/java/org/apache/james/imapserver/commands/StoreCommand.java
URL: http://svn.apache.org/viewvc/james/server/sandbox/seda-imap/src/java/org/apache/james/imapserver/commands/StoreCommand.java?view=diff&rev=505653&r1=505652&r2=505653
==============================================================================
--- james/server/sandbox/seda-imap/src/java/org/apache/james/imapserver/commands/StoreCommand.java (original)
+++ james/server/sandbox/seda-imap/src/java/org/apache/james/imapserver/commands/StoreCommand.java Sat Feb 10 00:18:54 2007
@@ -21,17 +21,8 @@
import javax.mail.Flags;
-import org.apache.james.imapserver.AuthorizationException;
import org.apache.james.imapserver.ImapRequestLineReader;
-import org.apache.james.imapserver.ImapResponse;
-import org.apache.james.imapserver.ImapSession;
import org.apache.james.imapserver.ProtocolException;
-import org.apache.james.imapserver.store.MailboxException;
-import org.apache.james.mailboxmanager.GeneralMessageSet;
-import org.apache.james.mailboxmanager.MailboxListener;
-import org.apache.james.mailboxmanager.MailboxManagerException;
-import org.apache.james.mailboxmanager.impl.GeneralMessageSetImpl;
-import org.apache.james.mailboxmanager.mailbox.ImapMailboxSession;
/**
* Handles processeing for the STORE imap command.
@@ -91,28 +82,6 @@
}
}
- private class StoreDirective
- {
- private int sign;
- private boolean silent;
-
- public StoreDirective( int sign, boolean silent )
- {
- this.sign = sign;
- this.silent = silent;
- }
-
- public int getSign()
- {
- return sign;
- }
-
- public boolean isSilent()
- {
- return silent;
- }
- }
-
protected AbstractImapCommandMessage decode(ImapRequestLineReader request, String tag) throws ProtocolException {
return decode(request, false, tag);
}
@@ -124,78 +93,6 @@
final Flags flags = parser.flagList( request );
parser.endLine( request );
return new StoreCommandMessage(this, idSet, directive, flags, useUids, tag);
- }
-
- private static class StoreCommandMessage extends AbstractImapCommandMessage {
- private final IdRange[] idSet;
- private final StoreDirective directive;
- private final Flags flags;
- private final boolean useUids;
-
- public StoreCommandMessage(final ImapCommand command, final IdRange[] idSet, final StoreDirective directive, final Flags flags,
- final boolean useUids, final String tag) {
- super(tag, command);
- this.idSet = idSet;
- this.directive = directive;
- this.flags = flags;
- this.useUids = useUids;
- }
-
- protected ImapResponseMessage doProcess(ImapSession session, String tag, ImapCommand command) throws MailboxException, AuthorizationException, ProtocolException {
-
- ImapMailboxSession mailbox = session.getSelected().getMailbox();
- MailboxListener silentListener = null;
-
- final boolean replace;
- final boolean value;
- if (directive.getSign() < 0) {
- value=false;
- replace=false;
- }
- else if (directive.getSign() > 0) {
- value=true;
- replace=false;
- }
- else {
- replace=true;
- value=true;
- }
- try {
- if (directive.isSilent()) {
- silentListener = session.getSelected().getMailbox();
- }
- for (int i = 0; i < idSet.length; i++) {
- final GeneralMessageSet messageSet = GeneralMessageSetImpl
- .range(idSet[i].getLowVal(), idSet[i].getHighVal(),
- useUids);
-
- mailbox.setFlags(flags, value, replace, messageSet,
- silentListener);
- }
- } catch (MailboxManagerException e) {
- throw new MailboxException(e);
- }
-
- final StoreResponseMessage result =
- new StoreResponseMessage(command, useUids, tag);
- return result;
- }
- }
-
- private static class StoreResponseMessage extends AbstractCommandResponseMessage {
- private final boolean useUids;
-
- public StoreResponseMessage(ImapCommand command, final boolean useUids, final String tag) {
- super(command, tag);
- this.useUids = useUids;
- }
-
- void doEncode(ImapResponse response, ImapSession session, ImapCommand command, String tag) throws MailboxException {
- boolean omitExpunged = (!useUids);
- session.unsolicitedResponses( response, omitExpunged , useUids);
- response.commandComplete( command, tag );
- }
-
}
}
/*
Added: james/server/sandbox/seda-imap/src/java/org/apache/james/imapserver/commands/StoreCommandMessage.java
URL: http://svn.apache.org/viewvc/james/server/sandbox/seda-imap/src/java/org/apache/james/imapserver/commands/StoreCommandMessage.java?view=auto&rev=505653
==============================================================================
--- james/server/sandbox/seda-imap/src/java/org/apache/james/imapserver/commands/StoreCommandMessage.java (added)
+++ james/server/sandbox/seda-imap/src/java/org/apache/james/imapserver/commands/StoreCommandMessage.java Sat Feb 10 00:18:54 2007
@@ -0,0 +1,87 @@
+/****************************************************************
+ * Licensed to the Apache Software Foundation (ASF) under one *
+ * or more contributor license agreements. See the NOTICE file *
+ * distributed with this work for additional information *
+ * regarding copyright ownership. The ASF licenses this file *
+ * to you under the Apache License, Version 2.0 (the *
+ * "License"); you may not use this file except in compliance *
+ * with the License. You may obtain a copy of the License at *
+ * *
+ * http://www.apache.org/licenses/LICENSE-2.0 *
+ * *
+ * Unless required by applicable law or agreed to in writing, *
+ * software distributed under the License is distributed on an *
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY *
+ * KIND, either express or implied. See the License for the *
+ * specific language governing permissions and limitations *
+ * under the License. *
+ ****************************************************************/
+package org.apache.james.imapserver.commands;
+
+import javax.mail.Flags;
+
+import org.apache.james.imapserver.AuthorizationException;
+import org.apache.james.imapserver.ImapSession;
+import org.apache.james.imapserver.ProtocolException;
+import org.apache.james.imapserver.store.MailboxException;
+import org.apache.james.mailboxmanager.GeneralMessageSet;
+import org.apache.james.mailboxmanager.MailboxListener;
+import org.apache.james.mailboxmanager.MailboxManagerException;
+import org.apache.james.mailboxmanager.impl.GeneralMessageSetImpl;
+import org.apache.james.mailboxmanager.mailbox.ImapMailboxSession;
+
+class StoreCommandMessage extends AbstractImapCommandMessage {
+ private final IdRange[] idSet;
+ private final StoreDirective directive;
+ private final Flags flags;
+ private final boolean useUids;
+
+ public StoreCommandMessage(final ImapCommand command, final IdRange[] idSet, final StoreDirective directive, final Flags flags,
+ final boolean useUids, final String tag) {
+ super(tag, command);
+ this.idSet = idSet;
+ this.directive = directive;
+ this.flags = flags;
+ this.useUids = useUids;
+ }
+
+ protected ImapResponseMessage doProcess(ImapSession session, String tag, ImapCommand command) throws MailboxException, AuthorizationException, ProtocolException {
+
+ ImapMailboxSession mailbox = session.getSelected().getMailbox();
+ MailboxListener silentListener = null;
+
+ final boolean replace;
+ final boolean value;
+ if (directive.getSign() < 0) {
+ value=false;
+ replace=false;
+ }
+ else if (directive.getSign() > 0) {
+ value=true;
+ replace=false;
+ }
+ else {
+ replace=true;
+ value=true;
+ }
+ try {
+ if (directive.isSilent()) {
+ silentListener = session.getSelected().getMailbox();
+ }
+ for (int i = 0; i < idSet.length; i++) {
+ final GeneralMessageSet messageSet = GeneralMessageSetImpl
+ .range(idSet[i].getLowVal(), idSet[i].getHighVal(),
+ useUids);
+
+ mailbox.setFlags(flags, value, replace, messageSet,
+ silentListener);
+ }
+ } catch (MailboxManagerException e) {
+ throw new MailboxException(e);
+ }
+
+ final StoreResponseMessage result =
+ new StoreResponseMessage(command, useUids, tag);
+ return result;
+ }
+}
Added: james/server/sandbox/seda-imap/src/java/org/apache/james/imapserver/commands/StoreDirective.java
URL: http://svn.apache.org/viewvc/james/server/sandbox/seda-imap/src/java/org/apache/james/imapserver/commands/StoreDirective.java?view=auto&rev=505653
==============================================================================
--- james/server/sandbox/seda-imap/src/java/org/apache/james/imapserver/commands/StoreDirective.java (added)
+++ james/server/sandbox/seda-imap/src/java/org/apache/james/imapserver/commands/StoreDirective.java Sat Feb 10 00:18:54 2007
@@ -0,0 +1,41 @@
+/****************************************************************
+ * Licensed to the Apache Software Foundation (ASF) under one *
+ * or more contributor license agreements. See the NOTICE file *
+ * distributed with this work for additional information *
+ * regarding copyright ownership. The ASF licenses this file *
+ * to you under the Apache License, Version 2.0 (the *
+ * "License"); you may not use this file except in compliance *
+ * with the License. You may obtain a copy of the License at *
+ * *
+ * http://www.apache.org/licenses/LICENSE-2.0 *
+ * *
+ * Unless required by applicable law or agreed to in writing, *
+ * software distributed under the License is distributed on an *
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY *
+ * KIND, either express or implied. See the License for the *
+ * specific language governing permissions and limitations *
+ * under the License. *
+ ****************************************************************/
+package org.apache.james.imapserver.commands;
+
+class StoreDirective
+{
+ private int sign;
+ private boolean silent;
+
+ public StoreDirective( int sign, boolean silent )
+ {
+ this.sign = sign;
+ this.silent = silent;
+ }
+
+ public int getSign()
+ {
+ return sign;
+ }
+
+ public boolean isSilent()
+ {
+ return silent;
+ }
+}
Added: james/server/sandbox/seda-imap/src/java/org/apache/james/imapserver/commands/StoreResponseMessage.java
URL: http://svn.apache.org/viewvc/james/server/sandbox/seda-imap/src/java/org/apache/james/imapserver/commands/StoreResponseMessage.java?view=auto&rev=505653
==============================================================================
--- james/server/sandbox/seda-imap/src/java/org/apache/james/imapserver/commands/StoreResponseMessage.java (added)
+++ james/server/sandbox/seda-imap/src/java/org/apache/james/imapserver/commands/StoreResponseMessage.java Sat Feb 10 00:18:54 2007
@@ -0,0 +1,39 @@
+/****************************************************************
+ * Licensed to the Apache Software Foundation (ASF) under one *
+ * or more contributor license agreements. See the NOTICE file *
+ * distributed with this work for additional information *
+ * regarding copyright ownership. The ASF licenses this file *
+ * to you under the Apache License, Version 2.0 (the *
+ * "License"); you may not use this file except in compliance *
+ * with the License. You may obtain a copy of the License at *
+ * *
+ * http://www.apache.org/licenses/LICENSE-2.0 *
+ * *
+ * Unless required by applicable law or agreed to in writing, *
+ * software distributed under the License is distributed on an *
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY *
+ * KIND, either express or implied. See the License for the *
+ * specific language governing permissions and limitations *
+ * under the License. *
+ ****************************************************************/
+package org.apache.james.imapserver.commands;
+
+import org.apache.james.imapserver.ImapResponse;
+import org.apache.james.imapserver.ImapSession;
+import org.apache.james.imapserver.store.MailboxException;
+
+class StoreResponseMessage extends AbstractCommandResponseMessage {
+ private final boolean useUids;
+
+ public StoreResponseMessage(ImapCommand command, final boolean useUids, final String tag) {
+ super(command, tag);
+ this.useUids = useUids;
+ }
+
+ void doEncode(ImapResponse response, ImapSession session, ImapCommand command, String tag) throws MailboxException {
+ boolean omitExpunged = (!useUids);
+ session.unsolicitedResponses( response, omitExpunged , useUids);
+ response.commandComplete( command, tag );
+ }
+
+}
Modified: james/server/sandbox/seda-imap/src/java/org/apache/james/imapserver/commands/SubscribeCommand.java
URL: http://svn.apache.org/viewvc/james/server/sandbox/seda-imap/src/java/org/apache/james/imapserver/commands/SubscribeCommand.java?view=diff&rev=505653&r1=505652&r2=505653
==============================================================================
--- james/server/sandbox/seda-imap/src/java/org/apache/james/imapserver/commands/SubscribeCommand.java (original)
+++ james/server/sandbox/seda-imap/src/java/org/apache/james/imapserver/commands/SubscribeCommand.java Sat Feb 10 00:18:54 2007
@@ -19,12 +19,8 @@
package org.apache.james.imapserver.commands;
-import org.apache.james.imapserver.AuthorizationException;
import org.apache.james.imapserver.ImapRequestLineReader;
-import org.apache.james.imapserver.ImapSession;
import org.apache.james.imapserver.ProtocolException;
-import org.apache.james.imapserver.store.MailboxException;
-import org.apache.james.mailboxmanager.MailboxManagerException;
/**
* Handles processeing for the SUBSCRIBE imap command.
@@ -52,25 +48,5 @@
final SubscribeCommandMessage result =
new SubscribeCommandMessage(this, mailboxName, tag);
return result;
- }
-
- private static class SubscribeCommandMessage extends AbstractImapCommandMessage {
- private final String mailboxName;
-
- public SubscribeCommandMessage(final ImapCommand command, final String mailboxName, final String tag) {
- super(tag, command);
- this.mailboxName = mailboxName;
- }
-
- protected ImapResponseMessage doProcess(ImapSession session, String tag, ImapCommand command) throws MailboxException, AuthorizationException, ProtocolException {
- try {
- final String fullMailboxName = session.buildFullName(this.mailboxName);
- session.getMailboxManager().setSubscription(fullMailboxName,true);
- } catch (MailboxManagerException e) {
- throw new MailboxException(e);
- }
- return new CommandCompleteResponseMessage(false, command, tag);
- }
-
}
}
Added: james/server/sandbox/seda-imap/src/java/org/apache/james/imapserver/commands/SubscribeCommandMessage.java
URL: http://svn.apache.org/viewvc/james/server/sandbox/seda-imap/src/java/org/apache/james/imapserver/commands/SubscribeCommandMessage.java?view=auto&rev=505653
==============================================================================
--- james/server/sandbox/seda-imap/src/java/org/apache/james/imapserver/commands/SubscribeCommandMessage.java (added)
+++ james/server/sandbox/seda-imap/src/java/org/apache/james/imapserver/commands/SubscribeCommandMessage.java Sat Feb 10 00:18:54 2007
@@ -0,0 +1,45 @@
+/****************************************************************
+ * Licensed to the Apache Software Foundation (ASF) under one *
+ * or more contributor license agreements. See the NOTICE file *
+ * distributed with this work for additional information *
+ * regarding copyright ownership. The ASF licenses this file *
+ * to you under the Apache License, Version 2.0 (the *
+ * "License"); you may not use this file except in compliance *
+ * with the License. You may obtain a copy of the License at *
+ * *
+ * http://www.apache.org/licenses/LICENSE-2.0 *
+ * *
+ * Unless required by applicable law or agreed to in writing, *
+ * software distributed under the License is distributed on an *
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY *
+ * KIND, either express or implied. See the License for the *
+ * specific language governing permissions and limitations *
+ * under the License. *
+ ****************************************************************/
+package org.apache.james.imapserver.commands;
+
+import org.apache.james.imapserver.AuthorizationException;
+import org.apache.james.imapserver.ImapSession;
+import org.apache.james.imapserver.ProtocolException;
+import org.apache.james.imapserver.store.MailboxException;
+import org.apache.james.mailboxmanager.MailboxManagerException;
+
+class SubscribeCommandMessage extends AbstractImapCommandMessage {
+ private final String mailboxName;
+
+ public SubscribeCommandMessage(final ImapCommand command, final String mailboxName, final String tag) {
+ super(tag, command);
+ this.mailboxName = mailboxName;
+ }
+
+ protected ImapResponseMessage doProcess(ImapSession session, String tag, ImapCommand command) throws MailboxException, AuthorizationException, ProtocolException {
+ try {
+ final String fullMailboxName = session.buildFullName(this.mailboxName);
+ session.getMailboxManager().setSubscription(fullMailboxName,true);
+ } catch (MailboxManagerException e) {
+ throw new MailboxException(e);
+ }
+ return new CommandCompleteResponseMessage(false, command, tag);
+ }
+
+}
Modified: james/server/sandbox/seda-imap/src/java/org/apache/james/imapserver/commands/UidEnabledCommand.java
URL: http://svn.apache.org/viewvc/james/server/sandbox/seda-imap/src/java/org/apache/james/imapserver/commands/UidEnabledCommand.java?view=diff&rev=505653&r1=505652&r2=505653
==============================================================================
--- james/server/sandbox/seda-imap/src/java/org/apache/james/imapserver/commands/UidEnabledCommand.java (original)
+++ james/server/sandbox/seda-imap/src/java/org/apache/james/imapserver/commands/UidEnabledCommand.java Sat Feb 10 00:18:54 2007
@@ -21,7 +21,6 @@
import org.apache.james.imapserver.ImapRequestLineReader;
import org.apache.james.imapserver.ProtocolException;
-import org.apache.james.imapserver.commands.CommandTemplate.AbstractImapCommandMessage;
/**
* @version $Revision: 109034 $
Modified: james/server/sandbox/seda-imap/src/java/org/apache/james/imapserver/commands/UnsubscribeCommand.java
URL: http://svn.apache.org/viewvc/james/server/sandbox/seda-imap/src/java/org/apache/james/imapserver/commands/UnsubscribeCommand.java?view=diff&rev=505653&r1=505652&r2=505653
==============================================================================
--- james/server/sandbox/seda-imap/src/java/org/apache/james/imapserver/commands/UnsubscribeCommand.java (original)
+++ james/server/sandbox/seda-imap/src/java/org/apache/james/imapserver/commands/UnsubscribeCommand.java Sat Feb 10 00:18:54 2007
@@ -19,12 +19,8 @@
package org.apache.james.imapserver.commands;
-import org.apache.james.imapserver.AuthorizationException;
import org.apache.james.imapserver.ImapRequestLineReader;
-import org.apache.james.imapserver.ImapSession;
import org.apache.james.imapserver.ProtocolException;
-import org.apache.james.imapserver.store.MailboxException;
-import org.apache.james.mailboxmanager.MailboxManagerException;
/**
* Handles processeing for the UNSUBSCRIBE imap command.
@@ -50,25 +46,5 @@
final String mailboxName = parser.mailbox( request );
parser.endLine( request );
return new UnsubscribeCommandMessage(this, mailboxName, tag);
- }
-
- private static class UnsubscribeCommandMessage extends AbstractImapCommandMessage {
- private final String mailboxName;
-
- public UnsubscribeCommandMessage(final ImapCommand command, final String mailboxName, final String tag) {
- super(tag, command);
- this.mailboxName = mailboxName;
- }
-
- protected ImapResponseMessage doProcess(ImapSession session, String tag, ImapCommand command) throws MailboxException, AuthorizationException, ProtocolException {
- try {
- final String fullMailboxName=session.buildFullName(this.mailboxName);
- session.getMailboxManager().setSubscription(fullMailboxName,false);
- } catch (MailboxManagerException e) {
- throw new MailboxException(e);
- }
- return new CommandCompleteResponseMessage(false, command, tag);
- }
-
}
}
Added: james/server/sandbox/seda-imap/src/java/org/apache/james/imapserver/commands/UnsubscribeCommandMessage.java
URL: http://svn.apache.org/viewvc/james/server/sandbox/seda-imap/src/java/org/apache/james/imapserver/commands/UnsubscribeCommandMessage.java?view=auto&rev=505653
==============================================================================
--- james/server/sandbox/seda-imap/src/java/org/apache/james/imapserver/commands/UnsubscribeCommandMessage.java (added)
+++ james/server/sandbox/seda-imap/src/java/org/apache/james/imapserver/commands/UnsubscribeCommandMessage.java Sat Feb 10 00:18:54 2007
@@ -0,0 +1,45 @@
+/****************************************************************
+ * Licensed to the Apache Software Foundation (ASF) under one *
+ * or more contributor license agreements. See the NOTICE file *
+ * distributed with this work for additional information *
+ * regarding copyright ownership. The ASF licenses this file *
+ * to you under the Apache License, Version 2.0 (the *
+ * "License"); you may not use this file except in compliance *
+ * with the License. You may obtain a copy of the License at *
+ * *
+ * http://www.apache.org/licenses/LICENSE-2.0 *
+ * *
+ * Unless required by applicable law or agreed to in writing, *
+ * software distributed under the License is distributed on an *
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY *
+ * KIND, either express or implied. See the License for the *
+ * specific language governing permissions and limitations *
+ * under the License. *
+ ****************************************************************/
+package org.apache.james.imapserver.commands;
+
+import org.apache.james.imapserver.AuthorizationException;
+import org.apache.james.imapserver.ImapSession;
+import org.apache.james.imapserver.ProtocolException;
+import org.apache.james.imapserver.store.MailboxException;
+import org.apache.james.mailboxmanager.MailboxManagerException;
+
+class UnsubscribeCommandMessage extends AbstractImapCommandMessage {
+ private final String mailboxName;
+
+ public UnsubscribeCommandMessage(final ImapCommand command, final String mailboxName, final String tag) {
+ super(tag, command);
+ this.mailboxName = mailboxName;
+ }
+
+ protected ImapResponseMessage doProcess(ImapSession session, String tag, ImapCommand command) throws MailboxException, AuthorizationException, ProtocolException {
+ try {
+ final String fullMailboxName=session.buildFullName(this.mailboxName);
+ session.getMailboxManager().setSubscription(fullMailboxName,false);
+ } catch (MailboxManagerException e) {
+ throw new MailboxException(e);
+ }
+ return new CommandCompleteResponseMessage(false, command, tag);
+ }
+
+}
---------------------------------------------------------------------
To unsubscribe, e-mail: server-dev-unsubscribe@james.apache.org
For additional commands, e-mail: server-dev-help@james.apache.org