Added: james/server/sandbox/seda-imap/src/java/org/apache/james/imapserver/commands/RenameCommandParser.java URL: http://svn.apache.org/viewvc/james/server/sandbox/seda-imap/src/java/org/apache/james/imapserver/commands/RenameCommandParser.java?view=auto&rev=505688 ============================================================================== --- james/server/sandbox/seda-imap/src/java/org/apache/james/imapserver/commands/RenameCommandParser.java (added) +++ james/server/sandbox/seda-imap/src/java/org/apache/james/imapserver/commands/RenameCommandParser.java Sat Feb 10 05:49:22 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.ImapRequestLineReader; +import org.apache.james.imapserver.ProtocolException; + +class RenameCommandParser extends CommandParser { + + public RenameCommandParser(ImapCommand command) { + super(command); + } + + protected AbstractImapCommandMessage decode(ImapCommand command, ImapRequestLineReader request, String tag) throws ProtocolException { + final String existingName = mailbox( request ); + final String newName = mailbox( request ); + endLine( request ); + final RenameCommandMessage result = new RenameCommandMessage(command, existingName, newName, tag); + return result; + } + +}
Modified: james/server/sandbox/seda-imap/src/java/org/apache/james/imapserver/commands/SearchCommand.java URL: http://svn.apache.org/viewvc/james/server/sandbox/seda-imap/src/java/org/apache/james/imapserver/commands/SearchCommand.java?view=diff&rev=505688&r1=505687&r2=505688 ============================================================================== --- james/server/sandbox/seda-imap/src/java/org/apache/james/imapserver/commands/SearchCommand.java (original) +++ james/server/sandbox/seda-imap/src/java/org/apache/james/imapserver/commands/SearchCommand.java Sat Feb 10 05:49:22 2007 @@ -19,8 +19,6 @@ package org.apache.james.imapserver.commands; -import javax.mail.Message; -import javax.mail.search.SearchTerm; import org.apache.james.imapserver.ImapRequestLineReader; import org.apache.james.imapserver.ProtocolException; @@ -47,51 +45,6 @@ public String getArgSyntax() { return ARGS; - } - - private static class SearchCommandParser extends UidCommandParser - { - public SearchCommandParser(ImapCommand command) { - super(command); - } - - /** - * Parses the request argument into a valid search term. - * Not yet implemented - all searches will return everything for now. - * TODO implement search - */ - public SearchTerm searchTerm( ImapRequestLineReader request ) - throws ProtocolException - { - // Dummy implementation - // Consume to the end of the line. - char next = request.nextChar(); - while ( next != '\n' ) { - request.consume(); - next = request.nextChar(); - } - - // Return a search term that matches everything. - return new SearchTerm() - { - private static final long serialVersionUID = 5290284637903768771L; - - public boolean match( Message message ) - { - return true; - } - }; - } - - protected AbstractImapCommandMessage decode(ImapCommand command, ImapRequestLineReader request, String tag, boolean useUids) throws ProtocolException { - // Parse the search term from the request - final SearchTerm searchTerm = searchTerm( request ); - endLine( request ); - final SearchImapCommand result - = new SearchImapCommand(command, searchTerm, useUids, tag); - return result; - } - } protected AbstractImapCommandMessage decode(ImapRequestLineReader request, String tag) throws ProtocolException { Added: james/server/sandbox/seda-imap/src/java/org/apache/james/imapserver/commands/SearchCommandParser.java URL: http://svn.apache.org/viewvc/james/server/sandbox/seda-imap/src/java/org/apache/james/imapserver/commands/SearchCommandParser.java?view=auto&rev=505688 ============================================================================== --- james/server/sandbox/seda-imap/src/java/org/apache/james/imapserver/commands/SearchCommandParser.java (added) +++ james/server/sandbox/seda-imap/src/java/org/apache/james/imapserver/commands/SearchCommandParser.java Sat Feb 10 05:49:22 2007 @@ -0,0 +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 javax.mail.Message; +import javax.mail.search.SearchTerm; + +import org.apache.james.imapserver.ImapRequestLineReader; +import org.apache.james.imapserver.ProtocolException; + +class SearchCommandParser extends AbstractUidCommandParser +{ + public SearchCommandParser(ImapCommand command) { + super(command); + } + + /** + * Parses the request argument into a valid search term. + * Not yet implemented - all searches will return everything for now. + * TODO implement search + */ + public SearchTerm searchTerm( ImapRequestLineReader request ) + throws ProtocolException + { + // Dummy implementation + // Consume to the end of the line. + char next = request.nextChar(); + while ( next != '\n' ) { + request.consume(); + next = request.nextChar(); + } + + // Return a search term that matches everything. + return new SearchTerm() + { + private static final long serialVersionUID = 5290284637903768771L; + + public boolean match( Message message ) + { + return true; + } + }; + } + + protected AbstractImapCommandMessage decode(ImapCommand command, ImapRequestLineReader request, String tag, boolean useUids) throws ProtocolException { + // Parse the search term from the request + final SearchTerm searchTerm = searchTerm( request ); + endLine( request ); + final SearchImapCommand result + = new SearchImapCommand(command, searchTerm, useUids, tag); + return result; + } + +} Modified: james/server/sandbox/seda-imap/src/java/org/apache/james/imapserver/commands/SelectCommand.java URL: http://svn.apache.org/viewvc/james/server/sandbox/seda-imap/src/java/org/apache/james/imapserver/commands/SelectCommand.java?view=diff&rev=505688&r1=505687&r2=505688 ============================================================================== --- james/server/sandbox/seda-imap/src/java/org/apache/james/imapserver/commands/SelectCommand.java (original) +++ james/server/sandbox/seda-imap/src/java/org/apache/james/imapserver/commands/SelectCommand.java Sat Feb 10 05:49:22 2007 @@ -59,23 +59,6 @@ final AbstractImapCommandMessage result = parser.decode(request, tag); return result; } - - private static class SelectCommandParser extends CommandParser { - private final boolean isExamine; - - public SelectCommandParser(ImapCommand command, boolean isExamine) { - super(command); - this.isExamine = isExamine; - } - - protected AbstractImapCommandMessage decode(ImapCommand command, ImapRequestLineReader request, String tag) throws ProtocolException { - final String mailboxName = mailbox( request ); - endLine( request ); - final SelectCommandMessage result = new SelectCommandMessage(command, mailboxName, isExamine, tag); - return result; - } - - } } /* Added: james/server/sandbox/seda-imap/src/java/org/apache/james/imapserver/commands/SelectCommandParser.java URL: http://svn.apache.org/viewvc/james/server/sandbox/seda-imap/src/java/org/apache/james/imapserver/commands/SelectCommandParser.java?view=auto&rev=505688 ============================================================================== --- james/server/sandbox/seda-imap/src/java/org/apache/james/imapserver/commands/SelectCommandParser.java (added) +++ james/server/sandbox/seda-imap/src/java/org/apache/james/imapserver/commands/SelectCommandParser.java Sat Feb 10 05:49:22 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.ImapRequestLineReader; +import org.apache.james.imapserver.ProtocolException; + +class SelectCommandParser extends CommandParser { + private final boolean isExamine; + + public SelectCommandParser(ImapCommand command, boolean isExamine) { + super(command); + this.isExamine = isExamine; + } + + protected AbstractImapCommandMessage decode(ImapCommand command, ImapRequestLineReader request, String tag) throws ProtocolException { + final String mailboxName = mailbox( request ); + endLine( request ); + final SelectCommandMessage result = new SelectCommandMessage(command, mailboxName, isExamine, tag); + return result; + } + +} 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=505688&r1=505687&r2=505688 ============================================================================== --- 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 05:49:22 2007 @@ -52,66 +52,6 @@ return ARGS; } - private static class StatusCommandParser extends CommandParser - { - public StatusCommandParser(ImapCommand command) { - super(command); - } - - StatusDataItems statusDataItems( ImapRequestLineReader request ) - throws ProtocolException - { - StatusDataItems items = new StatusDataItems(); - - request.nextWordChar(); - consumeChar( request, '(' ); - CharacterValidator validator = new NoopCharValidator(); - String nextWord = consumeWord( request, validator ); - while ( ! nextWord.endsWith(")" ) ) { - addItem( nextWord, items ); - nextWord = consumeWord( request, validator ); - } - // Got the closing ")", may be attached to a word. - if ( nextWord.length() > 1 ) { - addItem( nextWord.substring(0, nextWord.length() - 1 ), items ); - } - - return items; - } - - private void addItem( String nextWord, StatusDataItems items ) - throws ProtocolException - { - if ( nextWord.equals( MESSAGES ) ) { - items.messages = true; - } - else if ( nextWord.equals( RECENT ) ) { - items.recent = true; - } - else if ( nextWord.equals( UIDNEXT ) ) { - items.uidNext = true; - } - else if ( nextWord.equals( UIDVALIDITY ) ) { - items.uidValidity = true; - } - else if ( nextWord.equals( UNSEEN ) ) { - items.unseen = true; - } - else { - throw new ProtocolException( "Unknown status item: '" + nextWord + "'" ); - } - } - - protected AbstractImapCommandMessage decode(ImapCommand command, ImapRequestLineReader request, String tag) throws ProtocolException { - final String mailboxName = mailbox( request ); - final StatusDataItems statusDataItems = statusDataItems( request ); - endLine( request ); - final StatusCommandMessage result = - new StatusCommandMessage(command, mailboxName, statusDataItems, tag); - return result; - } - } - protected AbstractImapCommandMessage decode(ImapRequestLineReader request, String tag) throws ProtocolException { final AbstractImapCommandMessage result = parser.decode(request, tag); return result; Added: james/server/sandbox/seda-imap/src/java/org/apache/james/imapserver/commands/StatusCommandParser.java URL: http://svn.apache.org/viewvc/james/server/sandbox/seda-imap/src/java/org/apache/james/imapserver/commands/StatusCommandParser.java?view=auto&rev=505688 ============================================================================== --- james/server/sandbox/seda-imap/src/java/org/apache/james/imapserver/commands/StatusCommandParser.java (added) +++ james/server/sandbox/seda-imap/src/java/org/apache/james/imapserver/commands/StatusCommandParser.java Sat Feb 10 05:49:22 2007 @@ -0,0 +1,84 @@ +/**************************************************************** + * 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.ProtocolException; +import org.apache.james.imapserver.commands.CommandParser.CharacterValidator; +import org.apache.james.imapserver.commands.CommandParser.NoopCharValidator; + +class StatusCommandParser extends CommandParser +{ + public StatusCommandParser(ImapCommand command) { + super(command); + } + + StatusDataItems statusDataItems( ImapRequestLineReader request ) + throws ProtocolException + { + StatusDataItems items = new StatusDataItems(); + + request.nextWordChar(); + consumeChar( request, '(' ); + CharacterValidator validator = new NoopCharValidator(); + String nextWord = consumeWord( request, validator ); + while ( ! nextWord.endsWith(")" ) ) { + addItem( nextWord, items ); + nextWord = consumeWord( request, validator ); + } + // Got the closing ")", may be attached to a word. + if ( nextWord.length() > 1 ) { + addItem( nextWord.substring(0, nextWord.length() - 1 ), items ); + } + + return items; + } + + private void addItem( String nextWord, StatusDataItems items ) + throws ProtocolException + { + if ( nextWord.equals( StatusCommand.MESSAGES ) ) { + items.messages = true; + } + else if ( nextWord.equals( StatusCommand.RECENT ) ) { + items.recent = true; + } + else if ( nextWord.equals( StatusCommand.UIDNEXT ) ) { + items.uidNext = true; + } + else if ( nextWord.equals( StatusCommand.UIDVALIDITY ) ) { + items.uidValidity = true; + } + else if ( nextWord.equals( StatusCommand.UNSEEN ) ) { + items.unseen = true; + } + else { + throw new ProtocolException( "Unknown status item: '" + nextWord + "'" ); + } + } + + protected AbstractImapCommandMessage decode(ImapCommand command, ImapRequestLineReader request, String tag) throws ProtocolException { + final String mailboxName = mailbox( request ); + final StatusDataItems statusDataItems = statusDataItems( request ); + endLine( request ); + final StatusCommandMessage result = + new StatusCommandMessage(command, mailboxName, statusDataItems, tag); + return result; + } +} 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=505688&r1=505687&r2=505688 ============================================================================== --- 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 05:49:22 2007 @@ -19,7 +19,6 @@ package org.apache.james.imapserver.commands; -import javax.mail.Flags; import org.apache.james.imapserver.ImapRequestLineReader; import org.apache.james.imapserver.ProtocolException; @@ -46,54 +45,6 @@ public String getArgSyntax() { return ARGS; - } - - private static class StoreCommandParser extends UidCommandParser - { - public StoreCommandParser(ImapCommand command) { - super(command); - } - - 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 ); - } - - protected AbstractImapCommandMessage decode(ImapCommand command, ImapRequestLineReader request, String tag, boolean useUids) throws ProtocolException { - final IdRange[] idSet = parseIdRange( request ); - final StoreDirective directive = storeDirective( request ); - final Flags flags = flagList( request ); - endLine( request ); - final StoreCommandMessage result = - new StoreCommandMessage(command, idSet, directive, flags, useUids, tag); - return result; - } } protected AbstractImapCommandMessage decode(ImapRequestLineReader request, String tag) throws ProtocolException { Added: james/server/sandbox/seda-imap/src/java/org/apache/james/imapserver/commands/StoreCommandParser.java URL: http://svn.apache.org/viewvc/james/server/sandbox/seda-imap/src/java/org/apache/james/imapserver/commands/StoreCommandParser.java?view=auto&rev=505688 ============================================================================== --- james/server/sandbox/seda-imap/src/java/org/apache/james/imapserver/commands/StoreCommandParser.java (added) +++ james/server/sandbox/seda-imap/src/java/org/apache/james/imapserver/commands/StoreCommandParser.java Sat Feb 10 05:49:22 2007 @@ -0,0 +1,73 @@ +/**************************************************************** + * 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.ProtocolException; +import org.apache.james.imapserver.commands.CommandParser.NoopCharValidator; + +class StoreCommandParser extends AbstractUidCommandParser +{ + public StoreCommandParser(ImapCommand command) { + super(command); + } + + 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 ); + } + + protected AbstractImapCommandMessage decode(ImapCommand command, ImapRequestLineReader request, String tag, boolean useUids) throws ProtocolException { + final IdRange[] idSet = parseIdRange( request ); + final StoreDirective directive = storeDirective( request ); + final Flags flags = flagList( request ); + endLine( request ); + final StoreCommandMessage result = + new StoreCommandMessage(command, idSet, directive, flags, useUids, tag); + return result; + } +} 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=505688&r1=505687&r2=505688 ============================================================================== --- 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 05:49:22 2007 @@ -47,21 +47,4 @@ final AbstractImapCommandMessage result = parser.decode(request, tag); return result; } - - private static class SubscribeCommandParser extends CommandParser { - - public SubscribeCommandParser(ImapCommand command) { - super(command); - } - - protected AbstractImapCommandMessage decode(ImapCommand command, ImapRequestLineReader request, String tag) throws ProtocolException { - final String mailboxName = mailbox( request ); - endLine( request ); - - final SubscribeCommandMessage result = - new SubscribeCommandMessage(command, mailboxName, tag); - return result; - } - - } } Added: james/server/sandbox/seda-imap/src/java/org/apache/james/imapserver/commands/SubscribeCommandParser.java URL: http://svn.apache.org/viewvc/james/server/sandbox/seda-imap/src/java/org/apache/james/imapserver/commands/SubscribeCommandParser.java?view=auto&rev=505688 ============================================================================== --- james/server/sandbox/seda-imap/src/java/org/apache/james/imapserver/commands/SubscribeCommandParser.java (added) +++ james/server/sandbox/seda-imap/src/java/org/apache/james/imapserver/commands/SubscribeCommandParser.java Sat Feb 10 05:49:22 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.ImapRequestLineReader; +import org.apache.james.imapserver.ProtocolException; + +class SubscribeCommandParser extends CommandParser { + + public SubscribeCommandParser(ImapCommand command) { + super(command); + } + + protected AbstractImapCommandMessage decode(ImapCommand command, ImapRequestLineReader request, String tag) throws ProtocolException { + final String mailboxName = mailbox( request ); + endLine( request ); + + final SubscribeCommandMessage result = + new SubscribeCommandMessage(command, mailboxName, tag); + return result; + } + +} Modified: james/server/sandbox/seda-imap/src/java/org/apache/james/imapserver/commands/UidCommand.java URL: http://svn.apache.org/viewvc/james/server/sandbox/seda-imap/src/java/org/apache/james/imapserver/commands/UidCommand.java?view=diff&rev=505688&r1=505687&r2=505688 ============================================================================== --- james/server/sandbox/seda-imap/src/java/org/apache/james/imapserver/commands/UidCommand.java (original) +++ james/server/sandbox/seda-imap/src/java/org/apache/james/imapserver/commands/UidCommand.java Sat Feb 10 05:49:22 2007 @@ -56,31 +56,4 @@ final AbstractImapCommandMessage result = parser.decode(request, tag); return result; } - - private class UidCommandParser extends CommandParser { - private final ImapCommandFactory commandFactory; - - public UidCommandParser(ImapCommand command, final ImapCommandFactory commandFactory) { - super(command); - this.commandFactory = commandFactory; - } - - protected AbstractImapCommandMessage decode(ImapCommand command, ImapRequestLineReader request, String tag) throws ProtocolException { - // TODO: check the logic against the specification: - // TODO: suspect that it is now bust - // TODO: the command written may be wrong - // TODO: this will be easier to fix a little later - // TODO: also not sure whether the old implementation shares this flaw - String commandName = atom( request ); - ImapCommand helperCommand = commandFactory.getCommand( commandName ); - if ( helperCommand == null || - ! (helperCommand instanceof UidEnabledCommand ) ) { - throw new ProtocolException("Invalid UID command: '" + commandName + "'" ); - } - final UidEnabledCommand uidEnabled = (UidEnabledCommand) helperCommand; - final AbstractImapCommandMessage result = uidEnabled.decode( request, true, tag ); - return result; - } - - } } Added: james/server/sandbox/seda-imap/src/java/org/apache/james/imapserver/commands/UidCommandParser.java URL: http://svn.apache.org/viewvc/james/server/sandbox/seda-imap/src/java/org/apache/james/imapserver/commands/UidCommandParser.java?view=auto&rev=505688 ============================================================================== --- james/server/sandbox/seda-imap/src/java/org/apache/james/imapserver/commands/UidCommandParser.java (added) +++ james/server/sandbox/seda-imap/src/java/org/apache/james/imapserver/commands/UidCommandParser.java Sat Feb 10 05:49:22 2007 @@ -0,0 +1,49 @@ +/**************************************************************** + * 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.ProtocolException; + +class UidCommandParser extends CommandParser { + private final ImapCommandFactory commandFactory; + + public UidCommandParser(ImapCommand command, final ImapCommandFactory commandFactory) { + super(command); + this.commandFactory = commandFactory; + } + + protected AbstractImapCommandMessage decode(ImapCommand command, ImapRequestLineReader request, String tag) throws ProtocolException { + // TODO: check the logic against the specification: + // TODO: suspect that it is now bust + // TODO: the command written may be wrong + // TODO: this will be easier to fix a little later + // TODO: also not sure whether the old implementation shares this flaw + String commandName = atom( request ); + ImapCommand helperCommand = commandFactory.getCommand( commandName ); + if ( helperCommand == null || + ! (helperCommand instanceof UidEnabledCommand ) ) { + throw new ProtocolException("Invalid UID command: '" + commandName + "'" ); + } + final UidEnabledCommand uidEnabled = (UidEnabledCommand) helperCommand; + final AbstractImapCommandMessage result = uidEnabled.decode( request, true, tag ); + return result; + } + +} 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=505688&r1=505687&r2=505688 ============================================================================== --- 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 05:49:22 2007 @@ -48,19 +48,4 @@ final AbstractImapCommandMessage result = parser.decode(request, tag); return result; } - - private static class UnsubscribeCommandParser extends CommandParser { - - public UnsubscribeCommandParser(ImapCommand command) { - super(command); - } - - protected AbstractImapCommandMessage decode(ImapCommand command, ImapRequestLineReader request, String tag) throws ProtocolException { - final String mailboxName = mailbox( request ); - endLine( request ); - final UnsubscribeCommandMessage result = new UnsubscribeCommandMessage(command, mailboxName, tag); - return result; - } - - } } Added: james/server/sandbox/seda-imap/src/java/org/apache/james/imapserver/commands/UnsubscribeCommandParser.java URL: http://svn.apache.org/viewvc/james/server/sandbox/seda-imap/src/java/org/apache/james/imapserver/commands/UnsubscribeCommandParser.java?view=auto&rev=505688 ============================================================================== --- james/server/sandbox/seda-imap/src/java/org/apache/james/imapserver/commands/UnsubscribeCommandParser.java (added) +++ james/server/sandbox/seda-imap/src/java/org/apache/james/imapserver/commands/UnsubscribeCommandParser.java Sat Feb 10 05:49:22 2007 @@ -0,0 +1,37 @@ +/**************************************************************** + * 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.ProtocolException; + +class UnsubscribeCommandParser extends CommandParser { + + public UnsubscribeCommandParser(ImapCommand command) { + super(command); + } + + protected AbstractImapCommandMessage decode(ImapCommand command, ImapRequestLineReader request, String tag) throws ProtocolException { + final String mailboxName = mailbox( request ); + endLine( request ); + final UnsubscribeCommandMessage result = new UnsubscribeCommandMessage(command, mailboxName, tag); + return result; + } + +} --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]