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 ba...@apache.org on 2006/10/10 10:35:02 UTC
svn commit: r454662 [9/15] - in /james/server/sandbox/imap-integration: ./
src/java/org/apache/james/imapserver/
src/java/org/apache/james/imapserver/commands/
src/java/org/apache/james/imapserver/debug/
src/java/org/apache/james/imapserver/store/ src/...
Modified: james/server/sandbox/imap-integration/src/java/org/apache/james/imapserver/commands/StoreCommand.java
URL: http://svn.apache.org/viewvc/james/server/sandbox/imap-integration/src/java/org/apache/james/imapserver/commands/StoreCommand.java?view=diff&rev=454662&r1=454661&r2=454662
==============================================================================
--- james/server/sandbox/imap-integration/src/java/org/apache/james/imapserver/commands/StoreCommand.java (original)
+++ james/server/sandbox/imap-integration/src/java/org/apache/james/imapserver/commands/StoreCommand.java Tue Oct 10 01:34:56 2006
@@ -1,236 +1,236 @@
-/****************************************************************
- * 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.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.
- *
- * @author Darrell DeBoer <da...@apache.org>
- *
- * @version $Revision: 109034 $
- */
-class StoreCommand extends SelectedStateCommand implements UidEnabledCommand
-{
- public static final String NAME = "STORE";
- public static final String ARGS = "<Message-set> ['+'|'-']FLAG[.SILENT] <flag-list>";
-
- private final StoreCommandParser parser = new StoreCommandParser();
-
- /** @see CommandTemplate#doProcess */
- protected void doProcess( ImapRequestLineReader request,
- ImapResponse response,
- ImapSession session )
- throws ProtocolException, MailboxException
- {
- doProcess( request, response, session , false );
- }
-
- public void doProcess( ImapRequestLineReader request,
- ImapResponse response,
- ImapSession session,
- boolean useUids )
- throws ProtocolException, MailboxException
- {
- IdRange[] idSet = parser.parseIdRange( request );
- StoreDirective directive = parser.storeDirective( request );
- Flags flags = parser.flagList( request );
- parser.endLine( request );
-
- 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);
- }
- boolean omitExpunged = (!useUids);
- session.unsolicitedResponses( response, omitExpunged , useUids);
- response.commandComplete( this );
- }
-
-
- /** @see ImapCommand#getName */
- public String getName()
- {
- return NAME;
- }
-
- /** @see CommandTemplate#getArgSyntax */
- public String getArgSyntax()
- {
- return ARGS;
- }
-
- private class StoreCommandParser extends CommandParser
- {
- StoreDirective storeDirective( ImapRequestLineReader request ) throws ProtocolException
- {
- int sign = 0;
- boolean silent = false;
-
- char next = request.nextWordChar();
- if ( next == '+' ) {
- sign = 1;
- request.consume();
- }
- else if ( next == '-' ) {
- sign = -1;
- request.consume();
- }
- else {
- sign = 0;
- }
-
- String directive = consumeWord( request, new NoopCharValidator() );
- if ( "FLAGS".equalsIgnoreCase( directive ) ) {
- silent = false;
- }
- else if ( "FLAGS.SILENT".equalsIgnoreCase( directive ) ) {
- silent = true;
- }
- else {
- throw new ProtocolException( "Invalid Store Directive: '" + directive + "'" );
- }
- return new StoreDirective( sign, silent );
- }
- }
-
- 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;
- }
- }
-}
-/*
-6.4.6. STORE Command
-
- Arguments: message set
- message data item name
- value for message data item
-
- Responses: untagged responses: FETCH
-
- Result: OK - store completed
- NO - store error: can't store that data
- BAD - command unknown or arguments invalid
-
- The STORE command alters data associated with a message in the
- mailbox. Normally, STORE will return the updated value of the
- data with an untagged FETCH response. A suffix of ".SILENT" in
- the data item name prevents the untagged FETCH, and the server
- SHOULD assume that the client has determined the updated value
- itself or does not care about the updated value.
-
- Note: regardless of whether or not the ".SILENT" suffix was
- used, the server SHOULD send an untagged FETCH response if a
- change to a message's flags from an external source is
- observed. The intent is that the status of the flags is
- determinate without a race condition.
-
- The currently defined data items that can be stored are:
-
- FLAGS <flag list>
- Replace the flags for the message with the
- argument. The new value of the flags are returned
- as if a FETCH of those flags was done.
-
- FLAGS.SILENT <flag list>
- Equivalent to FLAGS, but without returning a new
- value.
-
- +FLAGS <flag list>
- Add the argument to the flags for the message. The
- new value of the flags are returned as if a FETCH
- of those flags was done.
-
- +FLAGS.SILENT <flag list>
- Equivalent to +FLAGS, but without returning a new
- value.
-
- -FLAGS <flag list>
- Remove the argument from the flags for the message.
- The new value of the flags are returned as if a
- FETCH of those flags was done.
-
- -FLAGS.SILENT <flag list>
- Equivalent to -FLAGS, but without returning a new
- value.
-
- Example: C: A003 STORE 2:4 +FLAGS (\Deleted)
- S: * 2 FETCH FLAGS (\Deleted \Seen)
- S: * 3 FETCH FLAGS (\Deleted)
- S: * 4 FETCH FLAGS (\Deleted \Flagged \Seen)
- S: A003 OK STORE completed
-
-*/
+/****************************************************************
+ * 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.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.
+ *
+ * @author Darrell DeBoer <da...@apache.org>
+ *
+ * @version $Revision: 109034 $
+ */
+class StoreCommand extends SelectedStateCommand implements UidEnabledCommand
+{
+ public static final String NAME = "STORE";
+ public static final String ARGS = "<Message-set> ['+'|'-']FLAG[.SILENT] <flag-list>";
+
+ private final StoreCommandParser parser = new StoreCommandParser();
+
+ /** @see CommandTemplate#doProcess */
+ protected void doProcess( ImapRequestLineReader request,
+ ImapResponse response,
+ ImapSession session )
+ throws ProtocolException, MailboxException
+ {
+ doProcess( request, response, session , false );
+ }
+
+ public void doProcess( ImapRequestLineReader request,
+ ImapResponse response,
+ ImapSession session,
+ boolean useUids )
+ throws ProtocolException, MailboxException
+ {
+ IdRange[] idSet = parser.parseIdRange( request );
+ StoreDirective directive = parser.storeDirective( request );
+ Flags flags = parser.flagList( request );
+ parser.endLine( request );
+
+ 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);
+ }
+ boolean omitExpunged = (!useUids);
+ session.unsolicitedResponses( response, omitExpunged , useUids);
+ response.commandComplete( this );
+ }
+
+
+ /** @see ImapCommand#getName */
+ public String getName()
+ {
+ return NAME;
+ }
+
+ /** @see CommandTemplate#getArgSyntax */
+ public String getArgSyntax()
+ {
+ return ARGS;
+ }
+
+ private class StoreCommandParser extends CommandParser
+ {
+ StoreDirective storeDirective( ImapRequestLineReader request ) throws ProtocolException
+ {
+ int sign = 0;
+ boolean silent = false;
+
+ char next = request.nextWordChar();
+ if ( next == '+' ) {
+ sign = 1;
+ request.consume();
+ }
+ else if ( next == '-' ) {
+ sign = -1;
+ request.consume();
+ }
+ else {
+ sign = 0;
+ }
+
+ String directive = consumeWord( request, new NoopCharValidator() );
+ if ( "FLAGS".equalsIgnoreCase( directive ) ) {
+ silent = false;
+ }
+ else if ( "FLAGS.SILENT".equalsIgnoreCase( directive ) ) {
+ silent = true;
+ }
+ else {
+ throw new ProtocolException( "Invalid Store Directive: '" + directive + "'" );
+ }
+ return new StoreDirective( sign, silent );
+ }
+ }
+
+ 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;
+ }
+ }
+}
+/*
+6.4.6. STORE Command
+
+ Arguments: message set
+ message data item name
+ value for message data item
+
+ Responses: untagged responses: FETCH
+
+ Result: OK - store completed
+ NO - store error: can't store that data
+ BAD - command unknown or arguments invalid
+
+ The STORE command alters data associated with a message in the
+ mailbox. Normally, STORE will return the updated value of the
+ data with an untagged FETCH response. A suffix of ".SILENT" in
+ the data item name prevents the untagged FETCH, and the server
+ SHOULD assume that the client has determined the updated value
+ itself or does not care about the updated value.
+
+ Note: regardless of whether or not the ".SILENT" suffix was
+ used, the server SHOULD send an untagged FETCH response if a
+ change to a message's flags from an external source is
+ observed. The intent is that the status of the flags is
+ determinate without a race condition.
+
+ The currently defined data items that can be stored are:
+
+ FLAGS <flag list>
+ Replace the flags for the message with the
+ argument. The new value of the flags are returned
+ as if a FETCH of those flags was done.
+
+ FLAGS.SILENT <flag list>
+ Equivalent to FLAGS, but without returning a new
+ value.
+
+ +FLAGS <flag list>
+ Add the argument to the flags for the message. The
+ new value of the flags are returned as if a FETCH
+ of those flags was done.
+
+ +FLAGS.SILENT <flag list>
+ Equivalent to +FLAGS, but without returning a new
+ value.
+
+ -FLAGS <flag list>
+ Remove the argument from the flags for the message.
+ The new value of the flags are returned as if a
+ FETCH of those flags was done.
+
+ -FLAGS.SILENT <flag list>
+ Equivalent to -FLAGS, but without returning a new
+ value.
+
+ Example: C: A003 STORE 2:4 +FLAGS (\Deleted)
+ S: * 2 FETCH FLAGS (\Deleted \Seen)
+ S: * 3 FETCH FLAGS (\Deleted)
+ S: * 4 FETCH FLAGS (\Deleted \Flagged \Seen)
+ S: A003 OK STORE completed
+
+*/
Propchange: james/server/sandbox/imap-integration/src/java/org/apache/james/imapserver/commands/StoreCommand.java
------------------------------------------------------------------------------
svn:eol-style = native
Modified: james/server/sandbox/imap-integration/src/java/org/apache/james/imapserver/commands/SubscribeCommand.java
URL: http://svn.apache.org/viewvc/james/server/sandbox/imap-integration/src/java/org/apache/james/imapserver/commands/SubscribeCommand.java?view=diff&rev=454662&r1=454661&r2=454662
==============================================================================
--- james/server/sandbox/imap-integration/src/java/org/apache/james/imapserver/commands/SubscribeCommand.java (original)
+++ james/server/sandbox/imap-integration/src/java/org/apache/james/imapserver/commands/SubscribeCommand.java Tue Oct 10 01:34:56 2006
@@ -1,70 +1,70 @@
-/****************************************************************
- * 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.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;
-
-/**
- * Handles processeing for the SUBSCRIBE imap command.
- *
- * @author Darrell DeBoer <da...@apache.org>
- *
- * @version $Revision: 109034 $
- */
-class SubscribeCommand extends AuthenticatedStateCommand
-{
- public static final String NAME = "SUBSCRIBE";
- public static final String ARGS = "<mailbox>";
-
- /** @see CommandTemplate#doProcess */
- protected void doProcess( ImapRequestLineReader request,
- ImapResponse response,
- ImapSession session )
- throws ProtocolException, MailboxException
- {
- String mailboxName = parser.mailbox( request );
- parser.endLine( request );
-
- try {
- session.getMailboxManager().setSubscription(mailboxName,true);
- } catch (MailboxManagerException e) {
- throw new MailboxException(e);
- }
- session.unsolicitedResponses( response, false );
- response.commandComplete( this );
- }
-
- /** @see ImapCommand#getName */
- public String getName()
- {
- return NAME;
- }
-
- /** @see CommandTemplate#getArgSyntax */
- public String getArgSyntax()
- {
- return ARGS;
- }
-}
+/****************************************************************
+ * 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.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;
+
+/**
+ * Handles processeing for the SUBSCRIBE imap command.
+ *
+ * @author Darrell DeBoer <da...@apache.org>
+ *
+ * @version $Revision: 109034 $
+ */
+class SubscribeCommand extends AuthenticatedStateCommand
+{
+ public static final String NAME = "SUBSCRIBE";
+ public static final String ARGS = "<mailbox>";
+
+ /** @see CommandTemplate#doProcess */
+ protected void doProcess( ImapRequestLineReader request,
+ ImapResponse response,
+ ImapSession session )
+ throws ProtocolException, MailboxException
+ {
+ String mailboxName = parser.mailbox( request );
+ parser.endLine( request );
+
+ try {
+ session.getMailboxManager().setSubscription(mailboxName,true);
+ } catch (MailboxManagerException e) {
+ throw new MailboxException(e);
+ }
+ session.unsolicitedResponses( response, false );
+ response.commandComplete( this );
+ }
+
+ /** @see ImapCommand#getName */
+ public String getName()
+ {
+ return NAME;
+ }
+
+ /** @see CommandTemplate#getArgSyntax */
+ public String getArgSyntax()
+ {
+ return ARGS;
+ }
+}
Propchange: james/server/sandbox/imap-integration/src/java/org/apache/james/imapserver/commands/SubscribeCommand.java
------------------------------------------------------------------------------
svn:eol-style = native
Modified: james/server/sandbox/imap-integration/src/java/org/apache/james/imapserver/commands/UidCommand.java
URL: http://svn.apache.org/viewvc/james/server/sandbox/imap-integration/src/java/org/apache/james/imapserver/commands/UidCommand.java?view=diff&rev=454662&r1=454661&r2=454662
==============================================================================
--- james/server/sandbox/imap-integration/src/java/org/apache/james/imapserver/commands/UidCommand.java (original)
+++ james/server/sandbox/imap-integration/src/java/org/apache/james/imapserver/commands/UidCommand.java Tue Oct 10 01:34:56 2006
@@ -1,74 +1,74 @@
-/****************************************************************
- * 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.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;
-
-/**
- * Handles processeing for the UID imap command.
- *
- * @author Darrell DeBoer <da...@apache.org>
- *
- * @version $Revision: 109034 $
- */
-class UidCommand extends SelectedStateCommand
-{
- public static final String NAME = "UID";
- public static final String ARGS = "<fetch-command>|<store-command>|<copy-command>|<search-command>";
-
- private ImapCommandFactory commandFactory;
-
- /** @see CommandTemplate#doProcess */
- protected void doProcess( ImapRequestLineReader request,
- ImapResponse response,
- ImapSession session )
- throws ProtocolException, MailboxException
- {
- String commandName = parser.atom( request );
- ImapCommand command = commandFactory.getCommand( commandName );
- if ( command == null ||
- ! (command instanceof UidEnabledCommand ) ) {
- throw new ProtocolException("Invalid UID command: '" + commandName + "'" );
- }
-
- ((UidEnabledCommand)command).doProcess( request, response, session, true );
- }
-
- /** @see ImapCommand#getName */
- public String getName()
- {
- return NAME;
- }
-
- /** @see CommandTemplate#getArgSyntax */
- public String getArgSyntax()
- {
- return ARGS;
- }
-
- public void setCommandFactory( ImapCommandFactory imapCommandFactory )
- {
- this.commandFactory = imapCommandFactory;
- }
-}
+/****************************************************************
+ * 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.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;
+
+/**
+ * Handles processeing for the UID imap command.
+ *
+ * @author Darrell DeBoer <da...@apache.org>
+ *
+ * @version $Revision: 109034 $
+ */
+class UidCommand extends SelectedStateCommand
+{
+ public static final String NAME = "UID";
+ public static final String ARGS = "<fetch-command>|<store-command>|<copy-command>|<search-command>";
+
+ private ImapCommandFactory commandFactory;
+
+ /** @see CommandTemplate#doProcess */
+ protected void doProcess( ImapRequestLineReader request,
+ ImapResponse response,
+ ImapSession session )
+ throws ProtocolException, MailboxException
+ {
+ String commandName = parser.atom( request );
+ ImapCommand command = commandFactory.getCommand( commandName );
+ if ( command == null ||
+ ! (command instanceof UidEnabledCommand ) ) {
+ throw new ProtocolException("Invalid UID command: '" + commandName + "'" );
+ }
+
+ ((UidEnabledCommand)command).doProcess( request, response, session, true );
+ }
+
+ /** @see ImapCommand#getName */
+ public String getName()
+ {
+ return NAME;
+ }
+
+ /** @see CommandTemplate#getArgSyntax */
+ public String getArgSyntax()
+ {
+ return ARGS;
+ }
+
+ public void setCommandFactory( ImapCommandFactory imapCommandFactory )
+ {
+ this.commandFactory = imapCommandFactory;
+ }
+}
Propchange: james/server/sandbox/imap-integration/src/java/org/apache/james/imapserver/commands/UidCommand.java
------------------------------------------------------------------------------
svn:eol-style = native
Modified: james/server/sandbox/imap-integration/src/java/org/apache/james/imapserver/commands/UidEnabledCommand.java
URL: http://svn.apache.org/viewvc/james/server/sandbox/imap-integration/src/java/org/apache/james/imapserver/commands/UidEnabledCommand.java?view=diff&rev=454662&r1=454661&r2=454662
==============================================================================
--- james/server/sandbox/imap-integration/src/java/org/apache/james/imapserver/commands/UidEnabledCommand.java (original)
+++ james/server/sandbox/imap-integration/src/java/org/apache/james/imapserver/commands/UidEnabledCommand.java Tue Oct 10 01:34:56 2006
@@ -1,41 +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;
-
-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;
-
-/**
- *
- * @author Darrell DeBoer <da...@apache.org>
- *
- * @version $Revision: 109034 $
- */
-public interface UidEnabledCommand
-{
- void doProcess( ImapRequestLineReader request,
- ImapResponse response,
- ImapSession session,
- boolean useUids)
- throws ProtocolException, MailboxException;
-}
+/****************************************************************
+ * 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.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;
+
+/**
+ *
+ * @author Darrell DeBoer <da...@apache.org>
+ *
+ * @version $Revision: 109034 $
+ */
+public interface UidEnabledCommand
+{
+ void doProcess( ImapRequestLineReader request,
+ ImapResponse response,
+ ImapSession session,
+ boolean useUids)
+ throws ProtocolException, MailboxException;
+}
Propchange: james/server/sandbox/imap-integration/src/java/org/apache/james/imapserver/commands/UidEnabledCommand.java
------------------------------------------------------------------------------
svn:eol-style = native
Modified: james/server/sandbox/imap-integration/src/java/org/apache/james/imapserver/commands/UnsubscribeCommand.java
URL: http://svn.apache.org/viewvc/james/server/sandbox/imap-integration/src/java/org/apache/james/imapserver/commands/UnsubscribeCommand.java?view=diff&rev=454662&r1=454661&r2=454662
==============================================================================
--- james/server/sandbox/imap-integration/src/java/org/apache/james/imapserver/commands/UnsubscribeCommand.java (original)
+++ james/server/sandbox/imap-integration/src/java/org/apache/james/imapserver/commands/UnsubscribeCommand.java Tue Oct 10 01:34:56 2006
@@ -1,70 +1,70 @@
-/****************************************************************
- * 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.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;
-
-/**
- * Handles processeing for the UNSUBSCRIBE imap command.
- *
- * @author Darrell DeBoer <da...@apache.org>
- *
- * @version $Revision: 109034 $
- */
-class UnsubscribeCommand extends AuthenticatedStateCommand
-{
- public static final String NAME = "UNSUBSCRIBE";
- public static final String ARGS = "<mailbox>";
-
- /** @see CommandTemplate#doProcess */
- protected void doProcess( ImapRequestLineReader request,
- ImapResponse response,
- ImapSession session )
- throws ProtocolException, MailboxException
- {
- String mailboxName = parser.mailbox( request );
- parser.endLine( request );
-
- try {
- session.getMailboxManager().setSubscription(mailboxName,false);
- } catch (MailboxManagerException e) {
- throw new MailboxException(e);
- }
- session.unsolicitedResponses( response , false );
- response.commandComplete( this );
- }
-
- /** @see ImapCommand#getName */
- public String getName()
- {
- return NAME;
- }
-
- /** @see CommandTemplate#getArgSyntax */
- public String getArgSyntax()
- {
- return ARGS;
- }
-}
+/****************************************************************
+ * 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.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;
+
+/**
+ * Handles processeing for the UNSUBSCRIBE imap command.
+ *
+ * @author Darrell DeBoer <da...@apache.org>
+ *
+ * @version $Revision: 109034 $
+ */
+class UnsubscribeCommand extends AuthenticatedStateCommand
+{
+ public static final String NAME = "UNSUBSCRIBE";
+ public static final String ARGS = "<mailbox>";
+
+ /** @see CommandTemplate#doProcess */
+ protected void doProcess( ImapRequestLineReader request,
+ ImapResponse response,
+ ImapSession session )
+ throws ProtocolException, MailboxException
+ {
+ String mailboxName = parser.mailbox( request );
+ parser.endLine( request );
+
+ try {
+ session.getMailboxManager().setSubscription(mailboxName,false);
+ } catch (MailboxManagerException e) {
+ throw new MailboxException(e);
+ }
+ session.unsolicitedResponses( response , false );
+ response.commandComplete( this );
+ }
+
+ /** @see ImapCommand#getName */
+ public String getName()
+ {
+ return NAME;
+ }
+
+ /** @see CommandTemplate#getArgSyntax */
+ public String getArgSyntax()
+ {
+ return ARGS;
+ }
+}
Propchange: james/server/sandbox/imap-integration/src/java/org/apache/james/imapserver/commands/UnsubscribeCommand.java
------------------------------------------------------------------------------
svn:eol-style = native
Modified: james/server/sandbox/imap-integration/src/java/org/apache/james/imapserver/debug/CopyInputStream.java
URL: http://svn.apache.org/viewvc/james/server/sandbox/imap-integration/src/java/org/apache/james/imapserver/debug/CopyInputStream.java?view=diff&rev=454662&r1=454661&r2=454662
==============================================================================
--- james/server/sandbox/imap-integration/src/java/org/apache/james/imapserver/debug/CopyInputStream.java (original)
+++ james/server/sandbox/imap-integration/src/java/org/apache/james/imapserver/debug/CopyInputStream.java Tue Oct 10 01:34:56 2006
@@ -1,58 +1,58 @@
-package org.apache.james.imapserver.debug;
-
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.OutputStream;
-
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.impl.SimpleLog;
-/**
- *
- * @author Joachim Draeger <jd at joachim-draeger.de>
- *
- */
-public class CopyInputStream extends InputStream
-{
-
- private InputStream is;
-
- private OutputStream copy;
-
- private Log log;
-
- StringBuffer logString = new StringBuffer();
-
- private boolean DEEP_DEBUG = false;
-
- public CopyInputStream(InputStream is, OutputStream copy)
- {
- this.is = is;
- this.copy = copy;
- }
-
- public int read() throws IOException {
- int in = is.read();
- copy.write(in);
- if (DEEP_DEBUG) {
- if (in == 10) {
- getLog().debug(logString);
- logString = new StringBuffer();
- } else if (in != 13) {
- logString.append((char) in);
- }
- }
- return in;
- }
-
- protected Log getLog() {
- if (log==null) {
- log=new SimpleLog("CopyInputStream");
- }
- return log;
- }
-
- public void setLog(Log log) {
- this.log=log;
- }
-
-}
+package org.apache.james.imapserver.debug;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.OutputStream;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.impl.SimpleLog;
+/**
+ *
+ * @author Joachim Draeger <jd at joachim-draeger.de>
+ *
+ */
+public class CopyInputStream extends InputStream
+{
+
+ private InputStream is;
+
+ private OutputStream copy;
+
+ private Log log;
+
+ StringBuffer logString = new StringBuffer();
+
+ private boolean DEEP_DEBUG = false;
+
+ public CopyInputStream(InputStream is, OutputStream copy)
+ {
+ this.is = is;
+ this.copy = copy;
+ }
+
+ public int read() throws IOException {
+ int in = is.read();
+ copy.write(in);
+ if (DEEP_DEBUG) {
+ if (in == 10) {
+ getLog().debug(logString);
+ logString = new StringBuffer();
+ } else if (in != 13) {
+ logString.append((char) in);
+ }
+ }
+ return in;
+ }
+
+ protected Log getLog() {
+ if (log==null) {
+ log=new SimpleLog("CopyInputStream");
+ }
+ return log;
+ }
+
+ public void setLog(Log log) {
+ this.log=log;
+ }
+
+}
Propchange: james/server/sandbox/imap-integration/src/java/org/apache/james/imapserver/debug/CopyInputStream.java
------------------------------------------------------------------------------
svn:eol-style = native
Modified: james/server/sandbox/imap-integration/src/java/org/apache/james/imapserver/debug/SplitOutputStream.java
URL: http://svn.apache.org/viewvc/james/server/sandbox/imap-integration/src/java/org/apache/james/imapserver/debug/SplitOutputStream.java?view=diff&rev=454662&r1=454661&r2=454662
==============================================================================
--- james/server/sandbox/imap-integration/src/java/org/apache/james/imapserver/debug/SplitOutputStream.java (original)
+++ james/server/sandbox/imap-integration/src/java/org/apache/james/imapserver/debug/SplitOutputStream.java Tue Oct 10 01:34:56 2006
@@ -1,64 +1,64 @@
-package org.apache.james.imapserver.debug;
-
-import java.io.FilterOutputStream;
-import java.io.IOException;
-import java.io.OutputStream;
-
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.impl.SimpleLog;
-
-/**
- *
- * @author Joachim Draeger <jd at joachim-draeger.de>
- *
- */
-public class SplitOutputStream extends FilterOutputStream {
-
- private OutputStream debugOutputStream;
-
- StringBuffer logString = new StringBuffer();
-
- private boolean DEEP_DEBUG = false;
-
- private Log log;
-
- public SplitOutputStream(OutputStream out, OutputStream debug) {
- super(out);
- debugOutputStream = debug;
- }
-
- public void flush() throws IOException {
- super.flush();
- if (debugOutputStream != null) {
- debugOutputStream.flush();
- }
- }
-
- public void write(int b) throws IOException {
- super.write(b);
- if (DEEP_DEBUG) {
- if (b == 10) {
- getLog().debug(logString);
- logString = new StringBuffer();
- } else if (b != 13) {
- logString.append((char) b);
- }
- }
- if (debugOutputStream != null) {
- debugOutputStream.write(b);
- debugOutputStream.flush();
- }
- }
-
- public void setLog(Log log) {
- this.log = log;
- }
-
- protected Log getLog() {
- if (log == null) {
- log = new SimpleLog("SplitOutputStream");
- }
- return log;
- }
-
-}
+package org.apache.james.imapserver.debug;
+
+import java.io.FilterOutputStream;
+import java.io.IOException;
+import java.io.OutputStream;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.impl.SimpleLog;
+
+/**
+ *
+ * @author Joachim Draeger <jd at joachim-draeger.de>
+ *
+ */
+public class SplitOutputStream extends FilterOutputStream {
+
+ private OutputStream debugOutputStream;
+
+ StringBuffer logString = new StringBuffer();
+
+ private boolean DEEP_DEBUG = false;
+
+ private Log log;
+
+ public SplitOutputStream(OutputStream out, OutputStream debug) {
+ super(out);
+ debugOutputStream = debug;
+ }
+
+ public void flush() throws IOException {
+ super.flush();
+ if (debugOutputStream != null) {
+ debugOutputStream.flush();
+ }
+ }
+
+ public void write(int b) throws IOException {
+ super.write(b);
+ if (DEEP_DEBUG) {
+ if (b == 10) {
+ getLog().debug(logString);
+ logString = new StringBuffer();
+ } else if (b != 13) {
+ logString.append((char) b);
+ }
+ }
+ if (debugOutputStream != null) {
+ debugOutputStream.write(b);
+ debugOutputStream.flush();
+ }
+ }
+
+ public void setLog(Log log) {
+ this.log = log;
+ }
+
+ protected Log getLog() {
+ if (log == null) {
+ log = new SimpleLog("SplitOutputStream");
+ }
+ return log;
+ }
+
+}
Propchange: james/server/sandbox/imap-integration/src/java/org/apache/james/imapserver/debug/SplitOutputStream.java
------------------------------------------------------------------------------
svn:eol-style = native
Modified: james/server/sandbox/imap-integration/src/java/org/apache/james/imapserver/store/ImapMessage.java
URL: http://svn.apache.org/viewvc/james/server/sandbox/imap-integration/src/java/org/apache/james/imapserver/store/ImapMessage.java?view=diff&rev=454662&r1=454661&r2=454662
==============================================================================
--- james/server/sandbox/imap-integration/src/java/org/apache/james/imapserver/store/ImapMessage.java (original)
+++ james/server/sandbox/imap-integration/src/java/org/apache/james/imapserver/store/ImapMessage.java Tue Oct 10 01:34:56 2006
@@ -1,44 +1,44 @@
-/****************************************************************
- * 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.store;
-
-import java.util.Date;
-
-import javax.mail.Flags;
-import javax.mail.internet.MimeMessage;
-
-/**
- *
- * @author Darrell DeBoer <da...@apache.org>
- *
- * @version $Revision: 109034 $
- */
-public interface ImapMessage
-{
- MimeMessage getMimeMessage();
-
- Flags getFlags();
-
- Date getInternalDate();
-
- long getUid();
-
- ImapMessageAttributes getAttributes() throws MailboxException;
-}
+/****************************************************************
+ * 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.store;
+
+import java.util.Date;
+
+import javax.mail.Flags;
+import javax.mail.internet.MimeMessage;
+
+/**
+ *
+ * @author Darrell DeBoer <da...@apache.org>
+ *
+ * @version $Revision: 109034 $
+ */
+public interface ImapMessage
+{
+ MimeMessage getMimeMessage();
+
+ Flags getFlags();
+
+ Date getInternalDate();
+
+ long getUid();
+
+ ImapMessageAttributes getAttributes() throws MailboxException;
+}
Propchange: james/server/sandbox/imap-integration/src/java/org/apache/james/imapserver/store/ImapMessage.java
------------------------------------------------------------------------------
svn:eol-style = native
Modified: james/server/sandbox/imap-integration/src/java/org/apache/james/imapserver/store/ImapMessageAttributes.java
URL: http://svn.apache.org/viewvc/james/server/sandbox/imap-integration/src/java/org/apache/james/imapserver/store/ImapMessageAttributes.java?view=diff&rev=454662&r1=454661&r2=454662
==============================================================================
--- james/server/sandbox/imap-integration/src/java/org/apache/james/imapserver/store/ImapMessageAttributes.java (original)
+++ james/server/sandbox/imap-integration/src/java/org/apache/james/imapserver/store/ImapMessageAttributes.java Tue Oct 10 01:34:56 2006
@@ -1,82 +1,82 @@
-/****************************************************************
- * 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.store;
-
-import java.util.Date;
-
-/**
- * Interface for objects holding IMAP4rev1 Message Attributes. Message
- * Attributes should be set when a message enters a mailbox. Implementations
- * are encouraged to implement and store MessageAttributes apart from the
- * underlying message. This allows the Mailbox to respond to questions about
- * very large message without needing to access them directly.
- * <p> Note that the message in a mailbox have the same order using either
- * Message Sequence Numbers or UIDs.
- *
- * Reference: RFC 2060 - para 2.3
- * @author <a href="mailto:charles@benett1.demon.co.uk">Charles Benett</a>
- * @version 0.1 on 14 Dec 2000
- */
-public interface ImapMessageAttributes {
-
- /**
- * Provides the date and time at which the message was received. In the
- * case of delivery by SMTP, this SHOULD be the date and time of final
- * delivery as defined for SMTP. In the case of messages copied from
- * another mailbox, it shuld be the internalDate of the source message. In
- * the case of messages Appended to the mailbox, example drafts, the
- * internalDate is either specified in the Append command or is the
- * current dat and time at the time of the Append.
- *
- * @return Date imap internal date
- */
- Date getInternalDate();
-
- /**
- * Returns IMAP formatted String representation of Date
- */
- String getInternalDateAsString();
-
- /**
- * Provides the sizeof the message in octets.
- *
- * @return int number of octets in message.
- */
- int getSize();
-
- /**
- * Provides the Envelope structure information for this message.
- * This is a parsed representation of the rfc-822 envelope information.
- * This is not to be confused with the SMTP envelope!
- *
- * @return String satisfying envelope syntax in rfc 2060.
- */
- String getEnvelope();
-
- /**
- * Provides the Body Structure information for this message.
- * This is a parsed representtion of the MIME structure of the message.
- *
- * @return String satisfying body syntax in rfc 2060.
- */
- String getBodyStructure( boolean includeExtensions );
-}
-
-
+/****************************************************************
+ * 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.store;
+
+import java.util.Date;
+
+/**
+ * Interface for objects holding IMAP4rev1 Message Attributes. Message
+ * Attributes should be set when a message enters a mailbox. Implementations
+ * are encouraged to implement and store MessageAttributes apart from the
+ * underlying message. This allows the Mailbox to respond to questions about
+ * very large message without needing to access them directly.
+ * <p> Note that the message in a mailbox have the same order using either
+ * Message Sequence Numbers or UIDs.
+ *
+ * Reference: RFC 2060 - para 2.3
+ * @author <a href="mailto:charles@benett1.demon.co.uk">Charles Benett</a>
+ * @version 0.1 on 14 Dec 2000
+ */
+public interface ImapMessageAttributes {
+
+ /**
+ * Provides the date and time at which the message was received. In the
+ * case of delivery by SMTP, this SHOULD be the date and time of final
+ * delivery as defined for SMTP. In the case of messages copied from
+ * another mailbox, it shuld be the internalDate of the source message. In
+ * the case of messages Appended to the mailbox, example drafts, the
+ * internalDate is either specified in the Append command or is the
+ * current dat and time at the time of the Append.
+ *
+ * @return Date imap internal date
+ */
+ Date getInternalDate();
+
+ /**
+ * Returns IMAP formatted String representation of Date
+ */
+ String getInternalDateAsString();
+
+ /**
+ * Provides the sizeof the message in octets.
+ *
+ * @return int number of octets in message.
+ */
+ int getSize();
+
+ /**
+ * Provides the Envelope structure information for this message.
+ * This is a parsed representation of the rfc-822 envelope information.
+ * This is not to be confused with the SMTP envelope!
+ *
+ * @return String satisfying envelope syntax in rfc 2060.
+ */
+ String getEnvelope();
+
+ /**
+ * Provides the Body Structure information for this message.
+ * This is a parsed representtion of the MIME structure of the message.
+ *
+ * @return String satisfying body syntax in rfc 2060.
+ */
+ String getBodyStructure( boolean includeExtensions );
+}
+
+
Propchange: james/server/sandbox/imap-integration/src/java/org/apache/james/imapserver/store/ImapMessageAttributes.java
------------------------------------------------------------------------------
svn:eol-style = native
Modified: james/server/sandbox/imap-integration/src/java/org/apache/james/imapserver/store/JavaMailImapStore.xinfo
URL: http://svn.apache.org/viewvc/james/server/sandbox/imap-integration/src/java/org/apache/james/imapserver/store/JavaMailImapStore.xinfo?view=diff&rev=454662&r1=454661&r2=454662
==============================================================================
--- james/server/sandbox/imap-integration/src/java/org/apache/james/imapserver/store/JavaMailImapStore.xinfo (original)
+++ james/server/sandbox/imap-integration/src/java/org/apache/james/imapserver/store/JavaMailImapStore.xinfo Tue Oct 10 01:34:56 2006
@@ -1,21 +1,21 @@
-<?xml version="1.0"?>
-
-<blockinfo>
-
- <!-- section to describe block -->
- <block>
- <version>1.0</version>
- </block>
-
- <!-- services that are offered by this block -->
- <services>
- <service name="org.apache.james.imapserver.store.ImapStore" version="1.0"/>
- </services>
-
- <dependencies>
- <dependency>
- <service name="org.apache.james.services.MailServer" version="1.0"/>
- </dependency>
- </dependencies>
-
-</blockinfo>
\ No newline at end of file
+<?xml version="1.0"?>
+
+<blockinfo>
+
+ <!-- section to describe block -->
+ <block>
+ <version>1.0</version>
+ </block>
+
+ <!-- services that are offered by this block -->
+ <services>
+ <service name="org.apache.james.imapserver.store.ImapStore" version="1.0"/>
+ </services>
+
+ <dependencies>
+ <dependency>
+ <service name="org.apache.james.services.MailServer" version="1.0"/>
+ </dependency>
+ </dependencies>
+
+</blockinfo>
Propchange: james/server/sandbox/imap-integration/src/java/org/apache/james/imapserver/store/JavaMailImapStore.xinfo
------------------------------------------------------------------------------
svn:eol-style = native
Modified: james/server/sandbox/imap-integration/src/java/org/apache/james/imapserver/store/MailboxException.java
URL: http://svn.apache.org/viewvc/james/server/sandbox/imap-integration/src/java/org/apache/james/imapserver/store/MailboxException.java?view=diff&rev=454662&r1=454661&r2=454662
==============================================================================
--- james/server/sandbox/imap-integration/src/java/org/apache/james/imapserver/store/MailboxException.java (original)
+++ james/server/sandbox/imap-integration/src/java/org/apache/james/imapserver/store/MailboxException.java Tue Oct 10 01:34:56 2006
@@ -1,127 +1,127 @@
-/****************************************************************
- * 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.store;
-
-import javax.mail.MessagingException;
-
-import org.apache.james.mailboxmanager.MailboxManagerException;
-
-/**
- * Thrown on an inappropriate attempt to reference a mailbox.
- * Includes attempting to create a mailbox that already exists and attempting
- * to open a mailbox that does not exist.
- * If status is ALREADY_EXISTS_REMOTELY or IF_CREATED_REMOTE then field
- * remoteServer should be set to the url of the remote server, formatted for
- * Mailbox Referral.
- *
- * @author <a href="mailto:charles@benett1.demon.co.uk">Charles Benett</a>
- * @version 0.1 on 14 Dec 2000
- */
-public class MailboxException extends Exception
-{
-
- public final static String ALREADY_EXISTS_LOCALLY
- = "Already exists locally";
- public final static String ALREADY_EXISTS_REMOTELY
- = "Already exists remotely";
- public final static String IF_CREATED_LOCAL
- = "If created, mailbox would be local";
- public final static String IF_CREATED_REMOTE
- = "If created, mailbox would be remote";
- public final static String NOT_LOCAL
- = "Does not exist locally, no further information available";
- public final static String LOCAL_BUT_DELETED
- = "Was local but has been deleted.";
-
- protected String status = null;
- protected String remoteServer = null;
-
- private String responseCode = null;
-
- /**
- * Construct a new <code>MailboxException</code> instance.
- *
- * @param message The detail message for this exception (mandatory).
- */
- public MailboxException( String message )
- {
- super( message );
- }
-
- /**
- * Construct a new <code>MailBoxException</code> instance.
- *
- * @param message The detail message for this exception (mandatory).
- * @param aStatus String constant indicating condition
- */
- public MailboxException( String message, String aStatus )
- {
- super( message );
- this.status = aStatus;
- }
-
- /**
- * Construct a new <code>MailBoxException</code> instance.
- *
- * @param message The detail message for this exception (mandatory).
- * @param aStatus String constant indicating condition
- * @param aServer String indicating another server where Mailbox should be.
- */
- public MailboxException( String message, String aStatus, String aServer )
- {
- super( message );
- this.status = aStatus;
- this.remoteServer = aServer;
- }
-
- public MailboxException(MailboxManagerException e) {
- super(e);
- }
-
- public MailboxException(MessagingException e) {
- super(e);
- }
-
- public String getStatus()
- {
- return status;
- }
-
- public String getRemoteServer()
- {
- return remoteServer;
- }
-
- public boolean isRemote()
- {
- return ( status.equals( ALREADY_EXISTS_REMOTELY )
- || status.equals( IF_CREATED_REMOTE ) );
- }
-
- public String getResponseCode()
- {
- return responseCode;
- }
-
- public void setResponseCode( String responseCode )
- {
- this.responseCode = responseCode;
- }
-}
+/****************************************************************
+ * 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.store;
+
+import javax.mail.MessagingException;
+
+import org.apache.james.mailboxmanager.MailboxManagerException;
+
+/**
+ * Thrown on an inappropriate attempt to reference a mailbox.
+ * Includes attempting to create a mailbox that already exists and attempting
+ * to open a mailbox that does not exist.
+ * If status is ALREADY_EXISTS_REMOTELY or IF_CREATED_REMOTE then field
+ * remoteServer should be set to the url of the remote server, formatted for
+ * Mailbox Referral.
+ *
+ * @author <a href="mailto:charles@benett1.demon.co.uk">Charles Benett</a>
+ * @version 0.1 on 14 Dec 2000
+ */
+public class MailboxException extends Exception
+{
+
+ public final static String ALREADY_EXISTS_LOCALLY
+ = "Already exists locally";
+ public final static String ALREADY_EXISTS_REMOTELY
+ = "Already exists remotely";
+ public final static String IF_CREATED_LOCAL
+ = "If created, mailbox would be local";
+ public final static String IF_CREATED_REMOTE
+ = "If created, mailbox would be remote";
+ public final static String NOT_LOCAL
+ = "Does not exist locally, no further information available";
+ public final static String LOCAL_BUT_DELETED
+ = "Was local but has been deleted.";
+
+ protected String status = null;
+ protected String remoteServer = null;
+
+ private String responseCode = null;
+
+ /**
+ * Construct a new <code>MailboxException</code> instance.
+ *
+ * @param message The detail message for this exception (mandatory).
+ */
+ public MailboxException( String message )
+ {
+ super( message );
+ }
+
+ /**
+ * Construct a new <code>MailBoxException</code> instance.
+ *
+ * @param message The detail message for this exception (mandatory).
+ * @param aStatus String constant indicating condition
+ */
+ public MailboxException( String message, String aStatus )
+ {
+ super( message );
+ this.status = aStatus;
+ }
+
+ /**
+ * Construct a new <code>MailBoxException</code> instance.
+ *
+ * @param message The detail message for this exception (mandatory).
+ * @param aStatus String constant indicating condition
+ * @param aServer String indicating another server where Mailbox should be.
+ */
+ public MailboxException( String message, String aStatus, String aServer )
+ {
+ super( message );
+ this.status = aStatus;
+ this.remoteServer = aServer;
+ }
+
+ public MailboxException(MailboxManagerException e) {
+ super(e);
+ }
+
+ public MailboxException(MessagingException e) {
+ super(e);
+ }
+
+ public String getStatus()
+ {
+ return status;
+ }
+
+ public String getRemoteServer()
+ {
+ return remoteServer;
+ }
+
+ public boolean isRemote()
+ {
+ return ( status.equals( ALREADY_EXISTS_REMOTELY )
+ || status.equals( IF_CREATED_REMOTE ) );
+ }
+
+ public String getResponseCode()
+ {
+ return responseCode;
+ }
+
+ public void setResponseCode( String responseCode )
+ {
+ this.responseCode = responseCode;
+ }
+}
Propchange: james/server/sandbox/imap-integration/src/java/org/apache/james/imapserver/store/MailboxException.java
------------------------------------------------------------------------------
svn:eol-style = native
Modified: james/server/sandbox/imap-integration/src/java/org/apache/james/imapserver/store/MessageFlags.java
URL: http://svn.apache.org/viewvc/james/server/sandbox/imap-integration/src/java/org/apache/james/imapserver/store/MessageFlags.java?view=diff&rev=454662&r1=454661&r2=454662
==============================================================================
--- james/server/sandbox/imap-integration/src/java/org/apache/james/imapserver/store/MessageFlags.java (original)
+++ james/server/sandbox/imap-integration/src/java/org/apache/james/imapserver/store/MessageFlags.java Tue Oct 10 01:34:56 2006
@@ -1,85 +1,85 @@
-/****************************************************************
- * 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.store;
-
-import javax.mail.Flags;
-
-
-/**
- * The set of flags associated with a message.
- * TODO - why not use javax.mail.Flags instead of having our own.
- *
- * <p>Reference: RFC 2060 - para 2.3
- * @author <a href="mailto:charles@benett1.demon.co.uk">Charles Benett</a>
- * @version 0.1 on 14 Dec 2000
- */
-public class MessageFlags
-{
- public static final Flags ALL_FLAGS = new Flags();
- static {
- ALL_FLAGS.add(Flags.Flag.ANSWERED);
- ALL_FLAGS.add(Flags.Flag.DELETED);
- ALL_FLAGS.add(Flags.Flag.DRAFT);
- ALL_FLAGS.add(Flags.Flag.FLAGGED);
- ALL_FLAGS.add(Flags.Flag.RECENT);
- ALL_FLAGS.add(Flags.Flag.SEEN);
- }
-
- public static final String ANSWERED = "\\ANSWERED";
- public static final String DELETED = "\\DELETED";
- public static final String DRAFT = "\\DRAFT";
- public static final String FLAGGED = "\\FLAGGED";
- public static final String SEEN = "\\SEEN";
-
- /**
- * Returns IMAP formatted String of MessageFlags for named user
- */
- public static String format(Flags flags)
- {
- StringBuffer buf = new StringBuffer();
- buf.append( "(" );
- if ( flags.contains(Flags.Flag.ANSWERED) ) {
- buf.append( "\\Answered " );
- }
- if ( flags.contains(Flags.Flag.DELETED) ) {
- buf.append( "\\Deleted " );
- }
- if ( flags.contains(Flags.Flag.DRAFT) ) {
- buf.append( "\\Draft " );
- }
- if ( flags.contains(Flags.Flag.FLAGGED) ) {
- buf.append( "\\Flagged " );
- }
- if ( flags.contains(Flags.Flag.RECENT) ) {
- buf.append( "\\Recent " );
- }
- if ( flags.contains(Flags.Flag.SEEN) ) {
- buf.append( "\\Seen " );
- }
- // Remove the trailing space, if necessary.
- if ( buf.length() > 1 )
- {
- buf.setLength( buf.length() - 1 );
- }
- buf.append( ")" );
- return buf.toString();
- }
-}
-
+/****************************************************************
+ * 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.store;
+
+import javax.mail.Flags;
+
+
+/**
+ * The set of flags associated with a message.
+ * TODO - why not use javax.mail.Flags instead of having our own.
+ *
+ * <p>Reference: RFC 2060 - para 2.3
+ * @author <a href="mailto:charles@benett1.demon.co.uk">Charles Benett</a>
+ * @version 0.1 on 14 Dec 2000
+ */
+public class MessageFlags
+{
+ public static final Flags ALL_FLAGS = new Flags();
+ static {
+ ALL_FLAGS.add(Flags.Flag.ANSWERED);
+ ALL_FLAGS.add(Flags.Flag.DELETED);
+ ALL_FLAGS.add(Flags.Flag.DRAFT);
+ ALL_FLAGS.add(Flags.Flag.FLAGGED);
+ ALL_FLAGS.add(Flags.Flag.RECENT);
+ ALL_FLAGS.add(Flags.Flag.SEEN);
+ }
+
+ public static final String ANSWERED = "\\ANSWERED";
+ public static final String DELETED = "\\DELETED";
+ public static final String DRAFT = "\\DRAFT";
+ public static final String FLAGGED = "\\FLAGGED";
+ public static final String SEEN = "\\SEEN";
+
+ /**
+ * Returns IMAP formatted String of MessageFlags for named user
+ */
+ public static String format(Flags flags)
+ {
+ StringBuffer buf = new StringBuffer();
+ buf.append( "(" );
+ if ( flags.contains(Flags.Flag.ANSWERED) ) {
+ buf.append( "\\Answered " );
+ }
+ if ( flags.contains(Flags.Flag.DELETED) ) {
+ buf.append( "\\Deleted " );
+ }
+ if ( flags.contains(Flags.Flag.DRAFT) ) {
+ buf.append( "\\Draft " );
+ }
+ if ( flags.contains(Flags.Flag.FLAGGED) ) {
+ buf.append( "\\Flagged " );
+ }
+ if ( flags.contains(Flags.Flag.RECENT) ) {
+ buf.append( "\\Recent " );
+ }
+ if ( flags.contains(Flags.Flag.SEEN) ) {
+ buf.append( "\\Seen " );
+ }
+ // Remove the trailing space, if necessary.
+ if ( buf.length() > 1 )
+ {
+ buf.setLength( buf.length() - 1 );
+ }
+ buf.append( ")" );
+ return buf.toString();
+ }
+}
+
Propchange: james/server/sandbox/imap-integration/src/java/org/apache/james/imapserver/store/MessageFlags.java
------------------------------------------------------------------------------
svn:eol-style = native
Modified: james/server/sandbox/imap-integration/src/java/org/apache/james/imapserver/store/SimpleImapMessage.java
URL: http://svn.apache.org/viewvc/james/server/sandbox/imap-integration/src/java/org/apache/james/imapserver/store/SimpleImapMessage.java?view=diff&rev=454662&r1=454661&r2=454662
==============================================================================
--- james/server/sandbox/imap-integration/src/java/org/apache/james/imapserver/store/SimpleImapMessage.java (original)
+++ james/server/sandbox/imap-integration/src/java/org/apache/james/imapserver/store/SimpleImapMessage.java Tue Oct 10 01:34:56 2006
@@ -1,91 +1,91 @@
-/****************************************************************
- * 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.store;
-
-import java.util.Date;
-
-import javax.mail.Flags;
-import javax.mail.MessagingException;
-import javax.mail.internet.MimeMessage;
-
-import org.apache.avalon.framework.logger.AbstractLogEnabled;
-
-/**
- * A mail message with all of the extra stuff that IMAP requires.
- * This is just a placeholder object, while I work out what's really required. A common
- * way of handling *all* messages needs to be available for James (maybe MailImpl?)
- * @author Darrell DeBoer <da...@apache.org>
- *
- * @version $Revision: 109034 $
- */
-public class SimpleImapMessage
- extends AbstractLogEnabled implements ImapMessage
-{
- private MimeMessage mimeMessage;
- private Flags flags;
- private Date internalDate;
- private long uid;
- private SimpleMessageAttributes attributes;
-
- public SimpleImapMessage(MimeMessage mimeMessage, Date internalDate, long uid)
- throws MessagingException {
- this(mimeMessage, mimeMessage.getFlags(), internalDate, uid);
- }
-
- SimpleImapMessage( MimeMessage mimeMessage, Flags flags,
- Date internalDate, long uid )
- {
- this.mimeMessage = mimeMessage;
- this.flags = flags;
- this.internalDate = internalDate;
- this.uid = uid;
- }
-
- public MimeMessage getMimeMessage() {
- return mimeMessage;
- }
-
- public Flags getFlags() {
- return flags;
- }
-
- public Date getInternalDate() {
- return internalDate;
- }
-
- public long getUid() {
- return uid;
- }
-
- public ImapMessageAttributes getAttributes() throws MailboxException
- {
- if ( attributes == null ) {
- attributes = new SimpleMessageAttributes();
- setupLogger( attributes );
- try {
- attributes.setAttributesFor( mimeMessage );
- }
- catch ( MessagingException e ) {
- throw new MailboxException( "Could not parse mime message." );
- }
- }
- return attributes;
- }
-}
+/****************************************************************
+ * 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.store;
+
+import java.util.Date;
+
+import javax.mail.Flags;
+import javax.mail.MessagingException;
+import javax.mail.internet.MimeMessage;
+
+import org.apache.avalon.framework.logger.AbstractLogEnabled;
+
+/**
+ * A mail message with all of the extra stuff that IMAP requires.
+ * This is just a placeholder object, while I work out what's really required. A common
+ * way of handling *all* messages needs to be available for James (maybe MailImpl?)
+ * @author Darrell DeBoer <da...@apache.org>
+ *
+ * @version $Revision: 109034 $
+ */
+public class SimpleImapMessage
+ extends AbstractLogEnabled implements ImapMessage
+{
+ private MimeMessage mimeMessage;
+ private Flags flags;
+ private Date internalDate;
+ private long uid;
+ private SimpleMessageAttributes attributes;
+
+ public SimpleImapMessage(MimeMessage mimeMessage, Date internalDate, long uid)
+ throws MessagingException {
+ this(mimeMessage, mimeMessage.getFlags(), internalDate, uid);
+ }
+
+ SimpleImapMessage( MimeMessage mimeMessage, Flags flags,
+ Date internalDate, long uid )
+ {
+ this.mimeMessage = mimeMessage;
+ this.flags = flags;
+ this.internalDate = internalDate;
+ this.uid = uid;
+ }
+
+ public MimeMessage getMimeMessage() {
+ return mimeMessage;
+ }
+
+ public Flags getFlags() {
+ return flags;
+ }
+
+ public Date getInternalDate() {
+ return internalDate;
+ }
+
+ public long getUid() {
+ return uid;
+ }
+
+ public ImapMessageAttributes getAttributes() throws MailboxException
+ {
+ if ( attributes == null ) {
+ attributes = new SimpleMessageAttributes();
+ setupLogger( attributes );
+ try {
+ attributes.setAttributesFor( mimeMessage );
+ }
+ catch ( MessagingException e ) {
+ throw new MailboxException( "Could not parse mime message." );
+ }
+ }
+ return attributes;
+ }
+}
Propchange: james/server/sandbox/imap-integration/src/java/org/apache/james/imapserver/store/SimpleImapMessage.java
------------------------------------------------------------------------------
svn:eol-style = native
---------------------------------------------------------------------
To unsubscribe, e-mail: server-dev-unsubscribe@james.apache.org
For additional commands, e-mail: server-dev-help@james.apache.org