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 [1/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/...

Author: bago
Date: Tue Oct 10 01:34:56 2006
New Revision: 454662

URL: http://svn.apache.org/viewvc?view=rev&rev=454662
Log:
imapserver/mailboxmanager cleanup:
1.4 compatibility fixes (removed getCanonicalPath from SimpleMessageAttributes and added use of HashCodeBuilder in TestUtil)
Updated pom.xml and build.xml dependencies to be able to build/test (there are randomly failing tests!)
Applied svn:eol-style to all new files and fixed newlines.

Modified:
    james/server/sandbox/imap-integration/build.xml
    james/server/sandbox/imap-integration/pom.xml
    james/server/sandbox/imap-integration/src/java/org/apache/james/imapserver/AuthorizationException.java   (contents, props changed)
    james/server/sandbox/imap-integration/src/java/org/apache/james/imapserver/ImapConstants.java   (contents, props changed)
    james/server/sandbox/imap-integration/src/java/org/apache/james/imapserver/ImapHandler.java   (contents, props changed)
    james/server/sandbox/imap-integration/src/java/org/apache/james/imapserver/ImapHandlerConfigurationData.java   (contents, props changed)
    james/server/sandbox/imap-integration/src/java/org/apache/james/imapserver/ImapHandlerInterface.java   (contents, props changed)
    james/server/sandbox/imap-integration/src/java/org/apache/james/imapserver/ImapRequestHandler.java   (contents, props changed)
    james/server/sandbox/imap-integration/src/java/org/apache/james/imapserver/ImapRequestLineReader.java   (contents, props changed)
    james/server/sandbox/imap-integration/src/java/org/apache/james/imapserver/ImapResponse.java   (contents, props changed)
    james/server/sandbox/imap-integration/src/java/org/apache/james/imapserver/ImapServer.java   (contents, props changed)
    james/server/sandbox/imap-integration/src/java/org/apache/james/imapserver/ImapServer.xinfo   (props changed)
    james/server/sandbox/imap-integration/src/java/org/apache/james/imapserver/ImapSession.java   (contents, props changed)
    james/server/sandbox/imap-integration/src/java/org/apache/james/imapserver/ImapSessionImpl.java   (contents, props changed)
    james/server/sandbox/imap-integration/src/java/org/apache/james/imapserver/ImapSessionState.java   (contents, props changed)
    james/server/sandbox/imap-integration/src/java/org/apache/james/imapserver/ProtocolException.java   (contents, props changed)
    james/server/sandbox/imap-integration/src/java/org/apache/james/imapserver/SelectedMailboxSession.java   (contents, props changed)
    james/server/sandbox/imap-integration/src/java/org/apache/james/imapserver/commands/AppendCommand.java   (contents, props changed)
    james/server/sandbox/imap-integration/src/java/org/apache/james/imapserver/commands/AuthenticateCommand.java   (contents, props changed)
    james/server/sandbox/imap-integration/src/java/org/apache/james/imapserver/commands/AuthenticatedStateCommand.java   (contents, props changed)
    james/server/sandbox/imap-integration/src/java/org/apache/james/imapserver/commands/CapabilityCommand.java   (contents, props changed)
    james/server/sandbox/imap-integration/src/java/org/apache/james/imapserver/commands/CheckCommand.java   (contents, props changed)
    james/server/sandbox/imap-integration/src/java/org/apache/james/imapserver/commands/CloseCommand.java   (contents, props changed)
    james/server/sandbox/imap-integration/src/java/org/apache/james/imapserver/commands/CommandParser.java   (contents, props changed)
    james/server/sandbox/imap-integration/src/java/org/apache/james/imapserver/commands/CommandTemplate.java   (contents, props changed)
    james/server/sandbox/imap-integration/src/java/org/apache/james/imapserver/commands/CopyCommand.java   (contents, props changed)
    james/server/sandbox/imap-integration/src/java/org/apache/james/imapserver/commands/CreateCommand.java   (contents, props changed)
    james/server/sandbox/imap-integration/src/java/org/apache/james/imapserver/commands/DeleteCommand.java   (contents, props changed)
    james/server/sandbox/imap-integration/src/java/org/apache/james/imapserver/commands/ExamineCommand.java   (contents, props changed)
    james/server/sandbox/imap-integration/src/java/org/apache/james/imapserver/commands/ExpungeCommand.java   (contents, props changed)
    james/server/sandbox/imap-integration/src/java/org/apache/james/imapserver/commands/FetchCommand.java   (contents, props changed)
    james/server/sandbox/imap-integration/src/java/org/apache/james/imapserver/commands/IdRange.java   (contents, props changed)
    james/server/sandbox/imap-integration/src/java/org/apache/james/imapserver/commands/IdSet.java   (contents, props changed)
    james/server/sandbox/imap-integration/src/java/org/apache/james/imapserver/commands/ImapCommand.java   (contents, props changed)
    james/server/sandbox/imap-integration/src/java/org/apache/james/imapserver/commands/ImapCommandFactory.java   (contents, props changed)
    james/server/sandbox/imap-integration/src/java/org/apache/james/imapserver/commands/ListCommand.java   (contents, props changed)
    james/server/sandbox/imap-integration/src/java/org/apache/james/imapserver/commands/LoginCommand.java   (contents, props changed)
    james/server/sandbox/imap-integration/src/java/org/apache/james/imapserver/commands/LogoutCommand.java   (contents, props changed)
    james/server/sandbox/imap-integration/src/java/org/apache/james/imapserver/commands/LsubCommand.java   (contents, props changed)
    james/server/sandbox/imap-integration/src/java/org/apache/james/imapserver/commands/MsnRange.java   (contents, props changed)
    james/server/sandbox/imap-integration/src/java/org/apache/james/imapserver/commands/NonAuthenticatedStateCommand.java   (contents, props changed)
    james/server/sandbox/imap-integration/src/java/org/apache/james/imapserver/commands/NoopCommand.java   (contents, props changed)
    james/server/sandbox/imap-integration/src/java/org/apache/james/imapserver/commands/RenameCommand.java   (contents, props changed)
    james/server/sandbox/imap-integration/src/java/org/apache/james/imapserver/commands/SearchCommand.java   (contents, props changed)
    james/server/sandbox/imap-integration/src/java/org/apache/james/imapserver/commands/SelectCommand.java   (contents, props changed)
    james/server/sandbox/imap-integration/src/java/org/apache/james/imapserver/commands/SelectedStateCommand.java   (contents, props changed)
    james/server/sandbox/imap-integration/src/java/org/apache/james/imapserver/commands/StatusCommand.java   (contents, props changed)
    james/server/sandbox/imap-integration/src/java/org/apache/james/imapserver/commands/StoreCommand.java   (contents, props changed)
    james/server/sandbox/imap-integration/src/java/org/apache/james/imapserver/commands/SubscribeCommand.java   (contents, props changed)
    james/server/sandbox/imap-integration/src/java/org/apache/james/imapserver/commands/UidCommand.java   (contents, props changed)
    james/server/sandbox/imap-integration/src/java/org/apache/james/imapserver/commands/UidEnabledCommand.java   (contents, props changed)
    james/server/sandbox/imap-integration/src/java/org/apache/james/imapserver/commands/UnsubscribeCommand.java   (contents, props changed)
    james/server/sandbox/imap-integration/src/java/org/apache/james/imapserver/debug/CopyInputStream.java   (contents, props changed)
    james/server/sandbox/imap-integration/src/java/org/apache/james/imapserver/debug/SplitOutputStream.java   (contents, props changed)
    james/server/sandbox/imap-integration/src/java/org/apache/james/imapserver/store/ImapMessage.java   (contents, props changed)
    james/server/sandbox/imap-integration/src/java/org/apache/james/imapserver/store/ImapMessageAttributes.java   (contents, props changed)
    james/server/sandbox/imap-integration/src/java/org/apache/james/imapserver/store/JavaMailImapStore.xinfo   (contents, props changed)
    james/server/sandbox/imap-integration/src/java/org/apache/james/imapserver/store/MailboxException.java   (contents, props changed)
    james/server/sandbox/imap-integration/src/java/org/apache/james/imapserver/store/MessageFlags.java   (contents, props changed)
    james/server/sandbox/imap-integration/src/java/org/apache/james/imapserver/store/SimpleImapMessage.java   (contents, props changed)
    james/server/sandbox/imap-integration/src/java/org/apache/james/imapserver/store/SimpleMessageAttributes.java   (contents, props changed)
    james/server/sandbox/imap-integration/src/java/org/apache/james/mailboxmanager/Constants.java   (contents, props changed)
    james/server/sandbox/imap-integration/src/java/org/apache/james/mailboxmanager/GeneralMessageSet.java   (contents, props changed)
    james/server/sandbox/imap-integration/src/java/org/apache/james/mailboxmanager/ListResult.java   (contents, props changed)
    james/server/sandbox/imap-integration/src/java/org/apache/james/mailboxmanager/MailboxListener.java   (contents, props changed)
    james/server/sandbox/imap-integration/src/java/org/apache/james/mailboxmanager/MailboxManagerException.java   (contents, props changed)
    james/server/sandbox/imap-integration/src/java/org/apache/james/mailboxmanager/MessageResult.java   (contents, props changed)
    james/server/sandbox/imap-integration/src/java/org/apache/james/mailboxmanager/Namespace.java   (contents, props changed)
    james/server/sandbox/imap-integration/src/java/org/apache/james/mailboxmanager/Namespaces.java   (contents, props changed)
    james/server/sandbox/imap-integration/src/java/org/apache/james/mailboxmanager/Purger.java   (contents, props changed)
    james/server/sandbox/imap-integration/src/java/org/apache/james/mailboxmanager/Quota.java   (contents, props changed)
    james/server/sandbox/imap-integration/src/java/org/apache/james/mailboxmanager/acl/Acl.java   (contents, props changed)
    james/server/sandbox/imap-integration/src/java/org/apache/james/mailboxmanager/acl/AclManager.java   (contents, props changed)
    james/server/sandbox/imap-integration/src/java/org/apache/james/mailboxmanager/acl/EffectiveRightsComputer.java   (contents, props changed)
    james/server/sandbox/imap-integration/src/java/org/apache/james/mailboxmanager/acl/GroupAcl.java   (contents, props changed)
    james/server/sandbox/imap-integration/src/java/org/apache/james/mailboxmanager/acl/GroupAwareUser.java   (contents, props changed)
    james/server/sandbox/imap-integration/src/java/org/apache/james/mailboxmanager/acl/MailboxRights.java   (contents, props changed)
    james/server/sandbox/imap-integration/src/java/org/apache/james/mailboxmanager/acl/UserAcl.java   (contents, props changed)
    james/server/sandbox/imap-integration/src/java/org/apache/james/mailboxmanager/impl/GeneralMessageSetImpl.java   (contents, props changed)
    james/server/sandbox/imap-integration/src/java/org/apache/james/mailboxmanager/impl/ListResultImpl.java   (props changed)
    james/server/sandbox/imap-integration/src/java/org/apache/james/mailboxmanager/impl/MailboxEventDispatcher.java   (contents, props changed)
    james/server/sandbox/imap-integration/src/java/org/apache/james/mailboxmanager/impl/MailboxListenerCollector.java   (props changed)
    james/server/sandbox/imap-integration/src/java/org/apache/james/mailboxmanager/impl/MessageResultImpl.java   (props changed)
    james/server/sandbox/imap-integration/src/java/org/apache/james/mailboxmanager/impl/NamespaceImpl.java   (props changed)
    james/server/sandbox/imap-integration/src/java/org/apache/james/mailboxmanager/impl/NamespacesImpl.java   (contents, props changed)
    james/server/sandbox/imap-integration/src/java/org/apache/james/mailboxmanager/mailbox/BasicMailbox.java   (contents, props changed)
    james/server/sandbox/imap-integration/src/java/org/apache/james/mailboxmanager/mailbox/BasicMailboxSession.java   (props changed)
    james/server/sandbox/imap-integration/src/java/org/apache/james/mailboxmanager/mailbox/EventQueueingSessionMailbox.java   (contents, props changed)
    james/server/sandbox/imap-integration/src/java/org/apache/james/mailboxmanager/mailbox/EventTriggerMailbox.java   (contents, props changed)
    james/server/sandbox/imap-integration/src/java/org/apache/james/mailboxmanager/mailbox/FlaggedMailbox.java   (contents, props changed)
    james/server/sandbox/imap-integration/src/java/org/apache/james/mailboxmanager/mailbox/GeneralMailbox.java   (contents, props changed)
    james/server/sandbox/imap-integration/src/java/org/apache/james/mailboxmanager/mailbox/GeneralMailboxSession.java   (props changed)
    james/server/sandbox/imap-integration/src/java/org/apache/james/mailboxmanager/mailbox/ImapMailbox.java   (contents, props changed)
    james/server/sandbox/imap-integration/src/java/org/apache/james/mailboxmanager/mailbox/ImapMailboxSession.java   (contents, props changed)
    james/server/sandbox/imap-integration/src/java/org/apache/james/mailboxmanager/mailbox/MailMailbox.java   (contents, props changed)
    james/server/sandbox/imap-integration/src/java/org/apache/james/mailboxmanager/mailbox/Mailbox.java   (props changed)
    james/server/sandbox/imap-integration/src/java/org/apache/james/mailboxmanager/mailbox/MailboxSession.java   (props changed)
    james/server/sandbox/imap-integration/src/java/org/apache/james/mailboxmanager/mailbox/SearchableMailbox.java   (contents, props changed)
    james/server/sandbox/imap-integration/src/java/org/apache/james/mailboxmanager/mailbox/UidMailbox.java   (contents, props changed)
    james/server/sandbox/imap-integration/src/java/org/apache/james/mailboxmanager/manager/BasicManager.java   (contents, props changed)
    james/server/sandbox/imap-integration/src/java/org/apache/james/mailboxmanager/manager/GeneralManager.java   (contents, props changed)
    james/server/sandbox/imap-integration/src/java/org/apache/james/mailboxmanager/manager/MailboxManager.java   (props changed)
    james/server/sandbox/imap-integration/src/java/org/apache/james/mailboxmanager/manager/MailboxManagerProvider.java   (props changed)
    james/server/sandbox/imap-integration/src/java/org/apache/james/mailboxmanager/manager/QuotaManager.java   (contents, props changed)
    james/server/sandbox/imap-integration/src/java/org/apache/james/mailboxmanager/package.html   (contents, props changed)
    james/server/sandbox/imap-integration/src/java/org/apache/james/mailboxmanager/repository/AbstractMailRepository.java   (contents, props changed)
    james/server/sandbox/imap-integration/src/java/org/apache/james/mailboxmanager/repository/AvalonMailStore.xinfo   (props changed)
    james/server/sandbox/imap-integration/src/java/org/apache/james/mailboxmanager/repository/MailboxManagerMailRepository.java   (contents, props changed)
    james/server/sandbox/imap-integration/src/java/org/apache/james/mailboxmanager/repository/MyAvalonMailStore.java   (props changed)
    james/server/sandbox/imap-integration/src/java/org/apache/james/mailboxmanager/repository/MyAvalonMailStore.xinfo   (props changed)
    james/server/sandbox/imap-integration/src/java/org/apache/james/mailboxmanager/repository/UidToKeyBidiMap.java   (contents, props changed)
    james/server/sandbox/imap-integration/src/java/org/apache/james/mailboxmanager/repository/UidToKeyBidiMapImpl.java   (props changed)
    james/server/sandbox/imap-integration/src/java/org/apache/james/mailboxmanager/torque/TorqueMailbox.java   (contents, props changed)
    james/server/sandbox/imap-integration/src/java/org/apache/james/mailboxmanager/torque/TorqueMailboxManager.java   (contents, props changed)
    james/server/sandbox/imap-integration/src/java/org/apache/james/mailboxmanager/torque/TorqueMailboxManagerProvider.java   (contents, props changed)
    james/server/sandbox/imap-integration/src/java/org/apache/james/mailboxmanager/torque/TorqueMailboxManagerProvider.xinfo   (props changed)
    james/server/sandbox/imap-integration/src/java/org/apache/james/mailboxmanager/torque/TorqueMimeMessage.java   (contents, props changed)
    james/server/sandbox/imap-integration/src/java/org/apache/james/mailboxmanager/torque/om/BaseMailboxRow.java   (props changed)
    james/server/sandbox/imap-integration/src/java/org/apache/james/mailboxmanager/torque/om/BaseMailboxRowPeer.java   (props changed)
    james/server/sandbox/imap-integration/src/java/org/apache/james/mailboxmanager/torque/om/BaseMessageBody.java   (props changed)
    james/server/sandbox/imap-integration/src/java/org/apache/james/mailboxmanager/torque/om/BaseMessageBodyPeer.java   (props changed)
    james/server/sandbox/imap-integration/src/java/org/apache/james/mailboxmanager/torque/om/BaseMessageFlags.java   (props changed)
    james/server/sandbox/imap-integration/src/java/org/apache/james/mailboxmanager/torque/om/BaseMessageFlagsPeer.java   (props changed)
    james/server/sandbox/imap-integration/src/java/org/apache/james/mailboxmanager/torque/om/BaseMessageHeader.java   (props changed)
    james/server/sandbox/imap-integration/src/java/org/apache/james/mailboxmanager/torque/om/BaseMessageHeaderPeer.java   (props changed)
    james/server/sandbox/imap-integration/src/java/org/apache/james/mailboxmanager/torque/om/BaseMessageRow.java   (props changed)
    james/server/sandbox/imap-integration/src/java/org/apache/james/mailboxmanager/torque/om/BaseMessageRowPeer.java   (props changed)
    james/server/sandbox/imap-integration/src/java/org/apache/james/mailboxmanager/torque/om/MailboxRow.java   (contents, props changed)
    james/server/sandbox/imap-integration/src/java/org/apache/james/mailboxmanager/torque/om/MailboxRowPeer.java   (contents, props changed)
    james/server/sandbox/imap-integration/src/java/org/apache/james/mailboxmanager/torque/om/MessageBody.java   (contents, props changed)
    james/server/sandbox/imap-integration/src/java/org/apache/james/mailboxmanager/torque/om/MessageBodyPeer.java   (contents, props changed)
    james/server/sandbox/imap-integration/src/java/org/apache/james/mailboxmanager/torque/om/MessageFlags.java   (contents, props changed)
    james/server/sandbox/imap-integration/src/java/org/apache/james/mailboxmanager/torque/om/MessageFlagsPeer.java   (contents, props changed)
    james/server/sandbox/imap-integration/src/java/org/apache/james/mailboxmanager/torque/om/MessageHeader.java   (contents, props changed)
    james/server/sandbox/imap-integration/src/java/org/apache/james/mailboxmanager/torque/om/MessageHeaderPeer.java   (contents, props changed)
    james/server/sandbox/imap-integration/src/java/org/apache/james/mailboxmanager/torque/om/MessageRow.java   (contents, props changed)
    james/server/sandbox/imap-integration/src/java/org/apache/james/mailboxmanager/torque/om/MessageRowPeer.java   (contents, props changed)
    james/server/sandbox/imap-integration/src/java/org/apache/james/mailboxmanager/torque/om/map/MailboxMapBuilder.java   (contents, props changed)
    james/server/sandbox/imap-integration/src/java/org/apache/james/mailboxmanager/torque/om/map/MailboxRowMapBuilder.java   (contents, props changed)
    james/server/sandbox/imap-integration/src/java/org/apache/james/mailboxmanager/torque/om/map/MessageBodyMapBuilder.java   (props changed)
    james/server/sandbox/imap-integration/src/java/org/apache/james/mailboxmanager/torque/om/map/MessageFlagsMapBuilder.java   (props changed)
    james/server/sandbox/imap-integration/src/java/org/apache/james/mailboxmanager/torque/om/map/MessageHeaderMapBuilder.java   (contents, props changed)
    james/server/sandbox/imap-integration/src/java/org/apache/james/mailboxmanager/torque/om/map/MessageMapBuilder.java   (props changed)
    james/server/sandbox/imap-integration/src/java/org/apache/james/mailboxmanager/torque/om/map/MessageRowMapBuilder.java   (props changed)
    james/server/sandbox/imap-integration/src/java/org/apache/james/mailboxmanager/tracking/MailboxCache.java   (contents, props changed)
    james/server/sandbox/imap-integration/src/java/org/apache/james/mailboxmanager/tracking/MailboxTracker.java   (contents, props changed)
    james/server/sandbox/imap-integration/src/java/org/apache/james/mailboxmanager/tracking/UidChangeTracker.java   (contents, props changed)
    james/server/sandbox/imap-integration/src/java/org/apache/james/mailboxmanager/tracking/UidRange.java   (contents, props changed)
    james/server/sandbox/imap-integration/src/java/org/apache/james/mailboxmanager/util/AbstractLogEnabled.java   (contents, props changed)
    james/server/sandbox/imap-integration/src/java/org/apache/james/mailboxmanager/util/SqlResources.java   (props changed)
    james/server/sandbox/imap-integration/src/java/org/apache/james/mailboxmanager/wrapper/FlaggedSessionMailboxWrapper.java   (contents, props changed)
    james/server/sandbox/imap-integration/src/java/org/apache/james/mailboxmanager/wrapper/ImapMailboxSessionWrapper.java   (contents, props changed)
    james/server/sandbox/imap-integration/src/java/org/apache/james/mailboxmanager/wrapper/NumberStableSessionWrapper.java   (contents, props changed)
    james/server/sandbox/imap-integration/src/java/org/apache/james/mailboxmanager/wrapper/SessionMailboxWrapper.java   (contents, props changed)
    james/server/sandbox/imap-integration/src/java/org/apache/james/mailboxmanager/wrapper/UidToMsnBidiMap.java   (contents, props changed)
    james/server/sandbox/imap-integration/src/java/org/apache/james/util/Assert.java   (contents, props changed)
    james/server/sandbox/imap-integration/src/test/org/apache/james/imapserver/TestConstants.java   (contents, props changed)
    james/server/sandbox/imap-integration/src/test/org/apache/james/imapserver/client/AbstractCommand.java   (contents, props changed)
    james/server/sandbox/imap-integration/src/test/org/apache/james/imapserver/client/Command.java   (contents, props changed)
    james/server/sandbox/imap-integration/src/test/org/apache/james/imapserver/client/CopyClientCommand.java   (contents, props changed)
    james/server/sandbox/imap-integration/src/test/org/apache/james/imapserver/client/CreateClientCommand.java   (contents, props changed)
    james/server/sandbox/imap-integration/src/test/org/apache/james/imapserver/client/DeleteClientCommand.java   (contents, props changed)
    james/server/sandbox/imap-integration/src/test/org/apache/james/imapserver/client/FetchCommand.java   (contents, props changed)
    james/server/sandbox/imap-integration/src/test/org/apache/james/imapserver/client/LoginCommand.java   (contents, props changed)
    james/server/sandbox/imap-integration/src/test/org/apache/james/imapserver/client/LogoutClientCommand.java   (contents, props changed)
    james/server/sandbox/imap-integration/src/test/org/apache/james/imapserver/client/MessageSet.java   (contents, props changed)
    james/server/sandbox/imap-integration/src/test/org/apache/james/imapserver/client/RenameClientCommand.java   (contents, props changed)
    james/server/sandbox/imap-integration/src/test/org/apache/james/imapserver/client/SelectCommand.java   (contents, props changed)
    james/server/sandbox/imap-integration/src/test/org/apache/james/imapserver/client/StoreClientCommand.java   (contents, props changed)
    james/server/sandbox/imap-integration/src/test/org/apache/james/imapserver/client/fetch/FetchBody.java   (contents, props changed)
    james/server/sandbox/imap-integration/src/test/org/apache/james/imapserver/client/fetch/FetchHeader.java   (contents, props changed)
    james/server/sandbox/imap-integration/src/test/org/apache/james/imapserver/handler/commands/AbstractCommandTest.java   (contents, props changed)
    james/server/sandbox/imap-integration/src/test/org/apache/james/imapserver/handler/commands/LoginTest.java   (contents, props changed)
    james/server/sandbox/imap-integration/src/test/org/apache/james/imapserver/handler/session/AbstractSessionTest.java   (contents, props changed)
    james/server/sandbox/imap-integration/src/test/org/apache/james/imapserver/handler/session/BodyFetchSessionTest.java   (contents, props changed)
    james/server/sandbox/imap-integration/src/test/org/apache/james/imapserver/handler/session/CopySessionTest.java   (contents, props changed)
    james/server/sandbox/imap-integration/src/test/org/apache/james/imapserver/handler/session/CreateSessionTest.java   (contents, props changed)
    james/server/sandbox/imap-integration/src/test/org/apache/james/imapserver/handler/session/DeleteSessionTest.java   (props changed)
    james/server/sandbox/imap-integration/src/test/org/apache/james/imapserver/handler/session/RenameSessionTest.java   (props changed)
    james/server/sandbox/imap-integration/src/test/org/apache/james/imapserver/handler/session/SessionTest.java   (contents, props changed)
    james/server/sandbox/imap-integration/src/test/org/apache/james/imapserver/handler/session/UidFlagSizeFetchSessionTest.java   (contents, props changed)
    james/server/sandbox/imap-integration/src/test/org/apache/james/imapserver/handler/session/UidStoreSessionTest.java   (contents, props changed)
    james/server/sandbox/imap-integration/src/test/org/apache/james/imapserver/mock/MailboxManagerProviderSingleton.java   (props changed)
    james/server/sandbox/imap-integration/src/test/org/apache/james/imapserver/mock/MockImapHandler.java   (contents, props changed)
    james/server/sandbox/imap-integration/src/test/org/apache/james/imapserver/mock/MockImapHandlerConfigurationData.java   (contents, props changed)
    james/server/sandbox/imap-integration/src/test/org/apache/james/imapserver/mock/MockMailServer.java   (contents, props changed)
    james/server/sandbox/imap-integration/src/test/org/apache/james/imapserver/mock/MockUser.java   (contents, props changed)
    james/server/sandbox/imap-integration/src/test/org/apache/james/imapserver/mock/MockUsersRepository.java   (contents, props changed)
    james/server/sandbox/imap-integration/src/test/org/apache/james/imapserver/mock/MockWatchdog.java   (contents, props changed)
    james/server/sandbox/imap-integration/src/test/org/apache/james/imapserver/util/ImapServerLauncher.java   (contents, props changed)
    james/server/sandbox/imap-integration/src/test/org/apache/james/imapserver/util/JavaMailFolderHelper.java   (props changed)
    james/server/sandbox/imap-integration/src/test/org/apache/james/imapserver/util/MessageGenerator.java   (contents, props changed)
    james/server/sandbox/imap-integration/src/test/org/apache/james/imapserver/util/UnsolicitedResponseGenerator.java   (contents, props changed)
    james/server/sandbox/imap-integration/src/test/org/apache/james/mailboxmanager/AbstractImapMailboxSelfTestCase.java   (contents, props changed)
    james/server/sandbox/imap-integration/src/test/org/apache/james/mailboxmanager/AbstractMailboxManagerSelfTestCase.java   (props changed)
    james/server/sandbox/imap-integration/src/test/org/apache/james/mailboxmanager/TestUtil.java   (contents, props changed)
    james/server/sandbox/imap-integration/src/test/org/apache/james/mailboxmanager/impl/UidChangeTrackerTestCase.java   (props changed)
    james/server/sandbox/imap-integration/src/test/org/apache/james/mailboxmanager/mock/MockUser.java   (props changed)
    james/server/sandbox/imap-integration/src/test/org/apache/james/mailboxmanager/mock/TorqueMailboxManagerProviderSingleton.java   (props changed)
    james/server/sandbox/imap-integration/src/test/org/apache/james/mailboxmanager/redundant/AbstractMailRepositoryNativeTestCase.java   (props changed)
    james/server/sandbox/imap-integration/src/test/org/apache/james/mailboxmanager/redundant/AbstractMailRepositorySelfTestCase.java   (props changed)
    james/server/sandbox/imap-integration/src/test/org/apache/james/mailboxmanager/redundant/AbstractMailRepositoryTestCase.java   (contents, props changed)
    james/server/sandbox/imap-integration/src/test/org/apache/james/mailboxmanager/torque/AbstractMailboxRowTestCase.java   (props changed)
    james/server/sandbox/imap-integration/src/test/org/apache/james/mailboxmanager/torque/AbstractTorqueTestCase.java   (props changed)
    james/server/sandbox/imap-integration/src/test/org/apache/james/mailboxmanager/torque/TorqueImapMailboxSelfTestCase.java   (contents, props changed)
    james/server/sandbox/imap-integration/src/test/org/apache/james/mailboxmanager/torque/TorqueMailboxManagerSelfTestCase.java   (props changed)
    james/server/sandbox/imap-integration/src/test/org/apache/james/mailboxmanager/torque/TorqueMailboxManagerTest.java   (props changed)
    james/server/sandbox/imap-integration/src/test/org/apache/james/mailboxmanager/torque/TorqueMailboxTestCase.java   (props changed)
    james/server/sandbox/imap-integration/src/test/org/apache/james/mailboxmanager/torque/TorqueTestSuite.java   (props changed)
    james/server/sandbox/imap-integration/src/test/org/apache/james/mailboxmanager/torque/TorqueTestUtil.java   (props changed)
    james/server/sandbox/imap-integration/src/test/org/apache/james/mailboxmanager/torque/om/MailboxRowPeerTest.java   (contents, props changed)
    james/server/sandbox/imap-integration/src/test/org/apache/james/mailboxmanager/torque/om/MailboxRowTest.java   (props changed)
    james/server/sandbox/imap-integration/src/test/org/apache/james/mailboxmanager/torque/repository/TorqueMailboxManagerMailRepositoryNativeTestCase.java   (contents, props changed)

Modified: james/server/sandbox/imap-integration/build.xml
URL: http://svn.apache.org/viewvc/james/server/sandbox/imap-integration/build.xml?view=diff&rev=454662&r1=454661&r2=454662
==============================================================================
--- james/server/sandbox/imap-integration/build.xml (original)
+++ james/server/sandbox/imap-integration/build.xml Tue Oct 10 01:34:56 2006
@@ -756,6 +756,7 @@
     <target name="unit-tests-classpath" depends="compile">
         <path id="unittest.class.path">
             <pathelement location="tools/lib/commons-net-1.4.1.jar"/>
+            <pathelement location="tools/lib/jmock-1.1.0RC1.jar"/>
             <fileset dir="${lib.dir}">
                 <include name="*.jar"/>
             </fileset>

Modified: james/server/sandbox/imap-integration/pom.xml
URL: http://svn.apache.org/viewvc/james/server/sandbox/imap-integration/pom.xml?view=diff&rev=454662&r1=454661&r2=454662
==============================================================================
--- james/server/sandbox/imap-integration/pom.xml (original)
+++ james/server/sandbox/imap-integration/pom.xml Tue Oct 10 01:34:56 2006
@@ -203,6 +203,12 @@
     </dependency>
 
     <dependency>
+      <groupId>commons-collections</groupId>
+      <artifactId>commons-collections</artifactId>
+      <version>3.1</version>
+    </dependency>
+
+    <dependency>
       <groupId>cornerstone-connection</groupId>
       <artifactId>cornerstone-connection-api</artifactId>
       <version>2.1</version>
@@ -365,6 +371,13 @@
     </dependency>
     
     <dependency>
+      <groupId>jmock</groupId>
+      <artifactId>jmock</artifactId>
+      <version>1.1.0</version>
+      <scope>test</scope>
+    </dependency>
+    
+    <dependency>
       <groupId>org.apache.derby</groupId>
       <artifactId>derby</artifactId>
       <version>10.1.3.1</version>
@@ -387,6 +400,22 @@
       <groupId>xstream</groupId>
       <artifactId>xstream</artifactId>
       <version>1.2</version>
+    </dependency>
+
+    <dependency>
+      <groupId>torque</groupId>
+      <artifactId>torque</artifactId>
+      <version>3.2</version>
+      <exclusions>
+        <exclusion>
+          <groupId>jndi</groupId>
+          <artifactId>jndi</artifactId>
+        </exclusion>
+        <exclusion>
+          <groupId>javax.sql</groupId>
+          <artifactId>jdbc-stdext</artifactId>
+        </exclusion>
+      </exclusions>
     </dependency>
 
   </dependencies>

Modified: james/server/sandbox/imap-integration/src/java/org/apache/james/imapserver/AuthorizationException.java
URL: http://svn.apache.org/viewvc/james/server/sandbox/imap-integration/src/java/org/apache/james/imapserver/AuthorizationException.java?view=diff&rev=454662&r1=454661&r2=454662
==============================================================================
--- james/server/sandbox/imap-integration/src/java/org/apache/james/imapserver/AuthorizationException.java (original)
+++ james/server/sandbox/imap-integration/src/java/org/apache/james/imapserver/AuthorizationException.java Tue Oct 10 01:34:56 2006
@@ -1,42 +1,42 @@
-/****************************************************************
- * 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;
-
-/**
- * Thrown when a user attempts to do something (e.g. alter mailbox) for which
- * they do not have appropriate rights.
- *
- * @author <a href="mailto:charles@benett1.demon.co.uk">Charles Benett</a>
- * @version  0.1 on 14 Dec 2000
- */
-public class AuthorizationException
-        extends Exception
-{
-
-    /**
-     * Construct a new <code>AuthorizationException</code> instance.
-     *
-     * @param message The detail message for this exception (mandatory).
-     */
-    public AuthorizationException( final String message )
-    {
-        super( message );
-    }
-}
+/****************************************************************
+ * 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;
+
+/**
+ * Thrown when a user attempts to do something (e.g. alter mailbox) for which
+ * they do not have appropriate rights.
+ *
+ * @author <a href="mailto:charles@benett1.demon.co.uk">Charles Benett</a>
+ * @version  0.1 on 14 Dec 2000
+ */
+public class AuthorizationException
+        extends Exception
+{
+
+    /**
+     * Construct a new <code>AuthorizationException</code> instance.
+     *
+     * @param message The detail message for this exception (mandatory).
+     */
+    public AuthorizationException( final String message )
+    {
+        super( message );
+    }
+}

Propchange: james/server/sandbox/imap-integration/src/java/org/apache/james/imapserver/AuthorizationException.java
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: james/server/sandbox/imap-integration/src/java/org/apache/james/imapserver/ImapConstants.java
URL: http://svn.apache.org/viewvc/james/server/sandbox/imap-integration/src/java/org/apache/james/imapserver/ImapConstants.java?view=diff&rev=454662&r1=454661&r2=454662
==============================================================================
--- james/server/sandbox/imap-integration/src/java/org/apache/james/imapserver/ImapConstants.java (original)
+++ james/server/sandbox/imap-integration/src/java/org/apache/james/imapserver/ImapConstants.java Tue Oct 10 01:34:56 2006
@@ -1,43 +1,43 @@
-/****************************************************************
- * 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;
-
-public interface ImapConstants
-{
-    // Basic response types
-    String OK = "OK";
-    String NO = "NO";
-    String BAD = "BAD";
-    String BYE = "BYE";
-    String UNTAGGED = "*";
-
-    String SP = " ";
-    String VERSION = "IMAP4rev1";
-    String CAPABILITIES = "LITERAL+";
-
-    String USER_NAMESPACE = "#mail";
-
-    char HIERARCHY_DELIMITER_CHAR = '.';
-    final char NAMESPACE_PREFIX_CHAR = '#';
-    String HIERARCHY_DELIMITER = String.valueOf( HIERARCHY_DELIMITER_CHAR );
-    final String NAMESPACE_PREFIX = String.valueOf( NAMESPACE_PREFIX_CHAR );
-
-    String INBOX_NAME = "INBOX";
-}
+/****************************************************************
+ * 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;
+
+public interface ImapConstants
+{
+    // Basic response types
+    String OK = "OK";
+    String NO = "NO";
+    String BAD = "BAD";
+    String BYE = "BYE";
+    String UNTAGGED = "*";
+
+    String SP = " ";
+    String VERSION = "IMAP4rev1";
+    String CAPABILITIES = "LITERAL+";
+
+    String USER_NAMESPACE = "#mail";
+
+    char HIERARCHY_DELIMITER_CHAR = '.';
+    final char NAMESPACE_PREFIX_CHAR = '#';
+    String HIERARCHY_DELIMITER = String.valueOf( HIERARCHY_DELIMITER_CHAR );
+    final String NAMESPACE_PREFIX = String.valueOf( NAMESPACE_PREFIX_CHAR );
+
+    String INBOX_NAME = "INBOX";
+}

Propchange: james/server/sandbox/imap-integration/src/java/org/apache/james/imapserver/ImapConstants.java
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: james/server/sandbox/imap-integration/src/java/org/apache/james/imapserver/ImapHandler.java
URL: http://svn.apache.org/viewvc/james/server/sandbox/imap-integration/src/java/org/apache/james/imapserver/ImapHandler.java?view=diff&rev=454662&r1=454661&r2=454662
==============================================================================
--- james/server/sandbox/imap-integration/src/java/org/apache/james/imapserver/ImapHandler.java (original)
+++ james/server/sandbox/imap-integration/src/java/org/apache/james/imapserver/ImapHandler.java Tue Oct 10 01:34:56 2006
@@ -1,387 +1,387 @@
-/****************************************************************
- * 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;
-
-import java.io.BufferedOutputStream;
-import java.io.BufferedReader;
-import java.io.File;
-import java.io.FileOutputStream;
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.InputStreamReader;
-import java.io.OutputStream;
-import java.io.PrintWriter;
-import java.net.Socket;
-
-import org.apache.avalon.cornerstone.services.connection.ConnectionHandler;
-import org.apache.avalon.excalibur.pool.Poolable;
-import org.apache.avalon.framework.activity.Disposable;
-import org.apache.avalon.framework.logger.AbstractLogEnabled;
-import org.apache.james.Constants;
-import org.apache.james.imapserver.debug.CopyInputStream;
-import org.apache.james.imapserver.debug.SplitOutputStream;
-import org.apache.james.util.InternetPrintWriter;
-import org.apache.james.util.watchdog.Watchdog;
-import org.apache.james.util.watchdog.WatchdogTarget;
-
-/**
- * The handler class for IMAP connections.
- * TODO: This is a quick cut-and-paste hack from POP3Handler. This, and the ImapServer
- * should probably be rewritten from scratch.
- *
- * @author Federico Barbieri <sc...@systemy.it>
- * @author Peter M. Goldstein <fa...@alum.mit.edu>
- */
-public class ImapHandler
-        extends AbstractLogEnabled
-        implements ImapHandlerInterface, ConnectionHandler, Poolable, ImapConstants
-{
-
-    private String softwaretype = "JAMES IMAP4rev1 Server " + Constants.SOFTWARE_VERSION;
-    private ImapRequestHandler requestHandler = new ImapRequestHandler();
-    private ImapSession session;
-
-    /**
-     * The per-service configuration data that applies to all handlers
-     */
-    private ImapHandlerConfigurationData theConfigData;
-
-    /**
-     * The thread executing this handler
-     */
-    private Thread handlerThread;
-
-    /**
-     * The TCP/IP socket over which the IMAP interaction
-     * is occurring
-     */
-    private Socket socket;
-
-    /**
-     * The reader associated with incoming characters.
-     */
-    private BufferedReader in;
-
-    /**
-     * The socket's input stream.
-     */
-    private InputStream ins;
-
-    /**
-     * The writer to which outgoing messages are written.
-     */
-    private PrintWriter out;
-
-    /**
-     * The socket's output stream
-     */
-    private OutputStream outs;
-
-    /**
-     * The watchdog being used by this handler to deal with idle timeouts.
-     */
-    private Watchdog theWatchdog;
-
-    /**
-     * The watchdog target that idles out this handler.
-     */
-    private WatchdogTarget theWatchdogTarget = new IMAPWatchdogTarget();
-    
-    private boolean handlerIsUp=false;
-
-    /**
-     * Set the configuration data for the handler.
-     *
-     * @param theData the configuration data
-     */
-    public void setConfigurationData( Object theData )
-    {
-        if (theData instanceof ImapHandlerConfigurationData) {
-            theConfigData = (ImapHandlerConfigurationData) theData;
-        } else {
-            throw new IllegalArgumentException("Configuration object does not implement POP3HandlerConfigurationData");
-        }
-    }
-
-    /**
-     * Set the Watchdog for use by this handler.
-     *
-     * @param theWatchdog the watchdog
-     */
-    public void setWatchdog( Watchdog theWatchdog )
-    {
-        this.theWatchdog = theWatchdog;
-    }
-
-    /**
-     * Gets the Watchdog Target that should be used by Watchdogs managing
-     * this connection.
-     *
-     * @return the WatchdogTarget
-     */
-    WatchdogTarget getWatchdogTarget()
-    {
-        return theWatchdogTarget;
-    }
-
-    public void forceConnectionClose(final String message) {
-    	getLogger().debug("forceConnectionClose: "+message);
-        ImapResponse response = new ImapResponse(outs);
-        response.byeResponse(message);        
-        resetHandler();
-    }
-
-    /**
-     * @see ConnectionHandler#handleConnection(Socket)
-     */
-    public void handleConnection( Socket connection )
-            throws IOException
-    {
-    	handlerIsUp=true;
-    	getLogger().debug("Accepting connection for "+connection.toString());
-    	// DEBUG
-    	
-    	String tcplogprefix= null;
-    	if (theConfigData.doStreamdump()) {
-    		String streamdumpDir=theConfigData.getStreamdumpDir();
-    		tcplogprefix= streamdumpDir+"/TCP-IMAP."+System.currentTimeMillis()+".";
-			File logdir = new File(streamdumpDir);
-			if (!logdir.exists()) {
-				logdir.mkdir();
-			}
-		}
-        String remoteHost = "";
-        String remoteIP = "";
-
-        try {
-            this.socket = connection;
-            synchronized ( this ) {
-                handlerThread = Thread.currentThread();
-            }
-            ins = socket.getInputStream();
-            if (theConfigData.doStreamdump()) {
-				ins = new CopyInputStream(ins, new FileOutputStream(
-						tcplogprefix + "in"));
-			}
-            in = new BufferedReader( new InputStreamReader( socket.getInputStream(), "ASCII" ), 512 );
-            remoteIP = socket.getInetAddress().getHostAddress();
-            remoteHost = socket.getInetAddress().getHostName();
-        }
-        catch ( IOException e ) {
-            if ( getLogger().isErrorEnabled() ) {
-                StringBuffer exceptionBuffer =
-                        new StringBuffer( 256 )
-                        .append( "Cannot open connection from " )
-                        .append( remoteHost )
-                        .append( " (" )
-                        .append( remoteIP )
-                        .append( "): " )
-                        .append( e.getMessage() );
-                getLogger().error( exceptionBuffer.toString(), e );
-            }
-            throw e;
-        }
-
-        if ( getLogger().isInfoEnabled() ) {
-            StringBuffer logBuffer =
-                    new StringBuffer( 128 )
-                    .append( "Connection from " )
-                    .append( remoteHost )
-                    .append( " (" )
-                    .append( remoteIP )
-                    .append( ") " );
-            getLogger().info( logBuffer.toString() );
-        }
-
-        try {
-            outs = new BufferedOutputStream( socket.getOutputStream(), 1024 );
-            if (theConfigData.doStreamdump()) {
-               outs = new SplitOutputStream(outs, new FileOutputStream(tcplogprefix+"out"));
-            }
-            out = new InternetPrintWriter( outs, true );
-            ImapResponse response = new ImapResponse( outs );
-
-            // Write welcome message
-            StringBuffer responseBuffer =
-                    new StringBuffer( 256 )
-                    .append( VERSION )
-                    .append( " Server " )
-                    .append( theConfigData.getHelloName() )
-                    .append( " ready" );
-            response.okResponse( null, responseBuffer.toString() );
-
-            session = new ImapSessionImpl( theConfigData.getMailboxManagerProvider(),
-                                           theConfigData.getUsersRepository(),
-                                           this,
-                                           socket.getInetAddress().getHostName(),
-                                           socket.getInetAddress().getHostAddress());
-
-            theWatchdog.start();
-            while ( requestHandler.handleRequest( ins, outs, session ) ) {
-            	if (!handlerIsUp) {
-            		getLogger().debug("Handler has been resetted");
-            		return;
-            	}
-                theWatchdog.reset();
-            }
-            theWatchdog.stop();
-            
-
-            //Write BYE message.
-            if ( getLogger().isInfoEnabled() ) {
-                StringBuffer logBuffer =
-                        new StringBuffer( 128 )
-                        .append( "Connection for " )
-                        .append( session.getUser().getUserName() )
-                        .append( " from " )
-                        .append( remoteHost )
-                        .append( " (" )
-                        .append( remoteIP )
-                        .append( ") closed." );
-                getLogger().info( logBuffer.toString() );
-            }
-
-        }
-        catch (Exception e) {
-			out.println("Error closing connection.");
-			out.flush();
-            StringBuffer exceptionBuffer =
-                    new StringBuffer( 128 )
-                    .append( "Exception on connection from " )
-                    .append( remoteHost )
-                    .append( " (" )
-                    .append( remoteIP )
-                    .append( ") : " )
-                    .append( e.getMessage() );
-            getLogger().error( exceptionBuffer.toString(), e );
-        }
-        finally {
-            resetHandler();
-        }
-    }
-
-    /**
-     * Resets the handler data to a basic state.
-     */
-    public void resetHandler()
-	{
-		if (handlerIsUp == false) {
-			return;
-		}
-		handlerIsUp = false;
-		if (theWatchdog != null) {
-			if (theWatchdog instanceof Disposable) {
-				((Disposable) theWatchdog).dispose();
-			}
-			theWatchdog = null;
-		}
-
-        // Close and clear streams, sockets
-
-        try {
-            if ( socket != null ) {
-                socket.close();
-                socket = null;
-            }
-        }
-        catch ( IOException ioe ) {
-            // Ignoring exception on close
-        }
-        finally {
-            socket = null;
-        }
-
-        try {
-            if ( in != null ) {
-                in.close();
-            }
-        }
-        catch ( Exception e ) {
-            // Ignored
-        }
-        finally {
-            in = null;
-        }
-
-        try {
-            if ( out != null ) {
-                out.close();
-            }
-        }
-        catch ( Exception e ) {
-            // Ignored
-        }
-        finally {
-            out = null;
-        }
-
-        try {
-            if ( outs != null ) {
-                outs.close();
-            }
-        }
-        catch ( Exception e ) {
-            // Ignored
-        }
-        finally {
-            outs = null;
-        }
-
-        synchronized ( this ) {
-            // Interrupt the thread to recover from internal hangs
-            if ( handlerThread != null ) {
-                handlerThread.interrupt();
-                handlerThread = null;
-            }
-        }
-
-        // Clear user data
-        
-        try {
-               session.closeMailbox();
-        } catch (Exception e) {
-        	getLogger().error("session.cleanUp", e);
-        }
-        session = null;
-
-        // Clear config data
-        theConfigData = null;
-    }
-
-    /**
-     * A private inner class which serves as an adaptor
-     * between the WatchdogTarget interface and this
-     * handler class.
-     */
-    private class IMAPWatchdogTarget
-            implements WatchdogTarget
-    {
-
-        /**
-         * @see WatchdogTarget#execute()
-         */
-        public void execute()
-        {
-            forceConnectionClose("IMAP Connection has idled out.");
-        }
-    }
-
-}
-
+/****************************************************************
+ * 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;
+
+import java.io.BufferedOutputStream;
+import java.io.BufferedReader;
+import java.io.File;
+import java.io.FileOutputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.InputStreamReader;
+import java.io.OutputStream;
+import java.io.PrintWriter;
+import java.net.Socket;
+
+import org.apache.avalon.cornerstone.services.connection.ConnectionHandler;
+import org.apache.avalon.excalibur.pool.Poolable;
+import org.apache.avalon.framework.activity.Disposable;
+import org.apache.avalon.framework.logger.AbstractLogEnabled;
+import org.apache.james.Constants;
+import org.apache.james.imapserver.debug.CopyInputStream;
+import org.apache.james.imapserver.debug.SplitOutputStream;
+import org.apache.james.util.InternetPrintWriter;
+import org.apache.james.util.watchdog.Watchdog;
+import org.apache.james.util.watchdog.WatchdogTarget;
+
+/**
+ * The handler class for IMAP connections.
+ * TODO: This is a quick cut-and-paste hack from POP3Handler. This, and the ImapServer
+ * should probably be rewritten from scratch.
+ *
+ * @author Federico Barbieri <sc...@systemy.it>
+ * @author Peter M. Goldstein <fa...@alum.mit.edu>
+ */
+public class ImapHandler
+        extends AbstractLogEnabled
+        implements ImapHandlerInterface, ConnectionHandler, Poolable, ImapConstants
+{
+
+    private String softwaretype = "JAMES IMAP4rev1 Server " + Constants.SOFTWARE_VERSION;
+    private ImapRequestHandler requestHandler = new ImapRequestHandler();
+    private ImapSession session;
+
+    /**
+     * The per-service configuration data that applies to all handlers
+     */
+    private ImapHandlerConfigurationData theConfigData;
+
+    /**
+     * The thread executing this handler
+     */
+    private Thread handlerThread;
+
+    /**
+     * The TCP/IP socket over which the IMAP interaction
+     * is occurring
+     */
+    private Socket socket;
+
+    /**
+     * The reader associated with incoming characters.
+     */
+    private BufferedReader in;
+
+    /**
+     * The socket's input stream.
+     */
+    private InputStream ins;
+
+    /**
+     * The writer to which outgoing messages are written.
+     */
+    private PrintWriter out;
+
+    /**
+     * The socket's output stream
+     */
+    private OutputStream outs;
+
+    /**
+     * The watchdog being used by this handler to deal with idle timeouts.
+     */
+    private Watchdog theWatchdog;
+
+    /**
+     * The watchdog target that idles out this handler.
+     */
+    private WatchdogTarget theWatchdogTarget = new IMAPWatchdogTarget();
+    
+    private boolean handlerIsUp=false;
+
+    /**
+     * Set the configuration data for the handler.
+     *
+     * @param theData the configuration data
+     */
+    public void setConfigurationData( Object theData )
+    {
+        if (theData instanceof ImapHandlerConfigurationData) {
+            theConfigData = (ImapHandlerConfigurationData) theData;
+        } else {
+            throw new IllegalArgumentException("Configuration object does not implement POP3HandlerConfigurationData");
+        }
+    }
+
+    /**
+     * Set the Watchdog for use by this handler.
+     *
+     * @param theWatchdog the watchdog
+     */
+    public void setWatchdog( Watchdog theWatchdog )
+    {
+        this.theWatchdog = theWatchdog;
+    }
+
+    /**
+     * Gets the Watchdog Target that should be used by Watchdogs managing
+     * this connection.
+     *
+     * @return the WatchdogTarget
+     */
+    WatchdogTarget getWatchdogTarget()
+    {
+        return theWatchdogTarget;
+    }
+
+    public void forceConnectionClose(final String message) {
+        getLogger().debug("forceConnectionClose: "+message);
+        ImapResponse response = new ImapResponse(outs);
+        response.byeResponse(message);        
+        resetHandler();
+    }
+
+    /**
+     * @see ConnectionHandler#handleConnection(Socket)
+     */
+    public void handleConnection( Socket connection )
+            throws IOException
+    {
+        handlerIsUp=true;
+        getLogger().debug("Accepting connection for "+connection.toString());
+        // DEBUG
+        
+        String tcplogprefix= null;
+        if (theConfigData.doStreamdump()) {
+            String streamdumpDir=theConfigData.getStreamdumpDir();
+            tcplogprefix= streamdumpDir+"/TCP-IMAP."+System.currentTimeMillis()+".";
+            File logdir = new File(streamdumpDir);
+            if (!logdir.exists()) {
+                logdir.mkdir();
+            }
+        }
+        String remoteHost = "";
+        String remoteIP = "";
+
+        try {
+            this.socket = connection;
+            synchronized ( this ) {
+                handlerThread = Thread.currentThread();
+            }
+            ins = socket.getInputStream();
+            if (theConfigData.doStreamdump()) {
+                ins = new CopyInputStream(ins, new FileOutputStream(
+                        tcplogprefix + "in"));
+            }
+            in = new BufferedReader( new InputStreamReader( socket.getInputStream(), "ASCII" ), 512 );
+            remoteIP = socket.getInetAddress().getHostAddress();
+            remoteHost = socket.getInetAddress().getHostName();
+        }
+        catch ( IOException e ) {
+            if ( getLogger().isErrorEnabled() ) {
+                StringBuffer exceptionBuffer =
+                        new StringBuffer( 256 )
+                        .append( "Cannot open connection from " )
+                        .append( remoteHost )
+                        .append( " (" )
+                        .append( remoteIP )
+                        .append( "): " )
+                        .append( e.getMessage() );
+                getLogger().error( exceptionBuffer.toString(), e );
+            }
+            throw e;
+        }
+
+        if ( getLogger().isInfoEnabled() ) {
+            StringBuffer logBuffer =
+                    new StringBuffer( 128 )
+                    .append( "Connection from " )
+                    .append( remoteHost )
+                    .append( " (" )
+                    .append( remoteIP )
+                    .append( ") " );
+            getLogger().info( logBuffer.toString() );
+        }
+
+        try {
+            outs = new BufferedOutputStream( socket.getOutputStream(), 1024 );
+            if (theConfigData.doStreamdump()) {
+               outs = new SplitOutputStream(outs, new FileOutputStream(tcplogprefix+"out"));
+            }
+            out = new InternetPrintWriter( outs, true );
+            ImapResponse response = new ImapResponse( outs );
+
+            // Write welcome message
+            StringBuffer responseBuffer =
+                    new StringBuffer( 256 )
+                    .append( VERSION )
+                    .append( " Server " )
+                    .append( theConfigData.getHelloName() )
+                    .append( " ready" );
+            response.okResponse( null, responseBuffer.toString() );
+
+            session = new ImapSessionImpl( theConfigData.getMailboxManagerProvider(),
+                                           theConfigData.getUsersRepository(),
+                                           this,
+                                           socket.getInetAddress().getHostName(),
+                                           socket.getInetAddress().getHostAddress());
+
+            theWatchdog.start();
+            while ( requestHandler.handleRequest( ins, outs, session ) ) {
+                if (!handlerIsUp) {
+                    getLogger().debug("Handler has been resetted");
+                    return;
+                }
+                theWatchdog.reset();
+            }
+            theWatchdog.stop();
+            
+
+            //Write BYE message.
+            if ( getLogger().isInfoEnabled() ) {
+                StringBuffer logBuffer =
+                        new StringBuffer( 128 )
+                        .append( "Connection for " )
+                        .append( session.getUser().getUserName() )
+                        .append( " from " )
+                        .append( remoteHost )
+                        .append( " (" )
+                        .append( remoteIP )
+                        .append( ") closed." );
+                getLogger().info( logBuffer.toString() );
+            }
+
+        }
+        catch (Exception e) {
+            out.println("Error closing connection.");
+            out.flush();
+            StringBuffer exceptionBuffer =
+                    new StringBuffer( 128 )
+                    .append( "Exception on connection from " )
+                    .append( remoteHost )
+                    .append( " (" )
+                    .append( remoteIP )
+                    .append( ") : " )
+                    .append( e.getMessage() );
+            getLogger().error( exceptionBuffer.toString(), e );
+        }
+        finally {
+            resetHandler();
+        }
+    }
+
+    /**
+     * Resets the handler data to a basic state.
+     */
+    public void resetHandler()
+    {
+        if (handlerIsUp == false) {
+            return;
+        }
+        handlerIsUp = false;
+        if (theWatchdog != null) {
+            if (theWatchdog instanceof Disposable) {
+                ((Disposable) theWatchdog).dispose();
+            }
+            theWatchdog = null;
+        }
+
+        // Close and clear streams, sockets
+
+        try {
+            if ( socket != null ) {
+                socket.close();
+                socket = null;
+            }
+        }
+        catch ( IOException ioe ) {
+            // Ignoring exception on close
+        }
+        finally {
+            socket = null;
+        }
+
+        try {
+            if ( in != null ) {
+                in.close();
+            }
+        }
+        catch ( Exception e ) {
+            // Ignored
+        }
+        finally {
+            in = null;
+        }
+
+        try {
+            if ( out != null ) {
+                out.close();
+            }
+        }
+        catch ( Exception e ) {
+            // Ignored
+        }
+        finally {
+            out = null;
+        }
+
+        try {
+            if ( outs != null ) {
+                outs.close();
+            }
+        }
+        catch ( Exception e ) {
+            // Ignored
+        }
+        finally {
+            outs = null;
+        }
+
+        synchronized ( this ) {
+            // Interrupt the thread to recover from internal hangs
+            if ( handlerThread != null ) {
+                handlerThread.interrupt();
+                handlerThread = null;
+            }
+        }
+
+        // Clear user data
+        
+        try {
+               session.closeMailbox();
+        } catch (Exception e) {
+            getLogger().error("session.cleanUp", e);
+        }
+        session = null;
+
+        // Clear config data
+        theConfigData = null;
+    }
+
+    /**
+     * A private inner class which serves as an adaptor
+     * between the WatchdogTarget interface and this
+     * handler class.
+     */
+    private class IMAPWatchdogTarget
+            implements WatchdogTarget
+    {
+
+        /**
+         * @see WatchdogTarget#execute()
+         */
+        public void execute()
+        {
+            forceConnectionClose("IMAP Connection has idled out.");
+        }
+    }
+
+}
+

Propchange: james/server/sandbox/imap-integration/src/java/org/apache/james/imapserver/ImapHandler.java
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: james/server/sandbox/imap-integration/src/java/org/apache/james/imapserver/ImapHandlerConfigurationData.java
URL: http://svn.apache.org/viewvc/james/server/sandbox/imap-integration/src/java/org/apache/james/imapserver/ImapHandlerConfigurationData.java?view=diff&rev=454662&r1=454661&r2=454662
==============================================================================
--- james/server/sandbox/imap-integration/src/java/org/apache/james/imapserver/ImapHandlerConfigurationData.java (original)
+++ james/server/sandbox/imap-integration/src/java/org/apache/james/imapserver/ImapHandlerConfigurationData.java Tue Oct 10 01:34:56 2006
@@ -1,63 +1,63 @@
-/****************************************************************
- * 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;
-
-import org.apache.james.mailboxmanager.manager.MailboxManagerProvider;
-import org.apache.james.services.UsersRepository;
-
-
-/**
- * Provides a number of server-wide constant values to the
- * POP3Handlers
- *
- * @author Peter M. Goldstein <fa...@alum.mit.edu>
- */
-public interface ImapHandlerConfigurationData
-{
-
-    /**
-     * Returns the service wide hello name
-     *
-     * @return the hello name
-     */
-    String getHelloName();
-
-    /**
-     * Returns the service wide reset length in bytes.
-     *
-     * @return the reset length
-     */
-    int getResetLength();
-
-    /**
-     * Returns the UsersRepository for this service.
-     *
-     * @return the local users repository
-     */
-    UsersRepository getUsersRepository();
-    
-    MailboxManagerProvider getMailboxManagerProvider();
-    
-    boolean doStreamdump();
-    
-    String getStreamdumpDir();
-
-
-}
+/****************************************************************
+ * 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;
+
+import org.apache.james.mailboxmanager.manager.MailboxManagerProvider;
+import org.apache.james.services.UsersRepository;
+
+
+/**
+ * Provides a number of server-wide constant values to the
+ * POP3Handlers
+ *
+ * @author Peter M. Goldstein <fa...@alum.mit.edu>
+ */
+public interface ImapHandlerConfigurationData
+{
+
+    /**
+     * Returns the service wide hello name
+     *
+     * @return the hello name
+     */
+    String getHelloName();
+
+    /**
+     * Returns the service wide reset length in bytes.
+     *
+     * @return the reset length
+     */
+    int getResetLength();
+
+    /**
+     * Returns the UsersRepository for this service.
+     *
+     * @return the local users repository
+     */
+    UsersRepository getUsersRepository();
+    
+    MailboxManagerProvider getMailboxManagerProvider();
+    
+    boolean doStreamdump();
+    
+    String getStreamdumpDir();
+
+
+}

Propchange: james/server/sandbox/imap-integration/src/java/org/apache/james/imapserver/ImapHandlerConfigurationData.java
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: james/server/sandbox/imap-integration/src/java/org/apache/james/imapserver/ImapHandlerInterface.java
URL: http://svn.apache.org/viewvc/james/server/sandbox/imap-integration/src/java/org/apache/james/imapserver/ImapHandlerInterface.java?view=diff&rev=454662&r1=454661&r2=454662
==============================================================================
--- james/server/sandbox/imap-integration/src/java/org/apache/james/imapserver/ImapHandlerInterface.java (original)
+++ james/server/sandbox/imap-integration/src/java/org/apache/james/imapserver/ImapHandlerInterface.java Tue Oct 10 01:34:56 2006
@@ -3,8 +3,8 @@
 public interface ImapHandlerInterface
 {
 
-	void forceConnectionClose(String byeMessage);
+    void forceConnectionClose(String byeMessage);
 
-	void resetHandler();
+    void resetHandler();
 
 }

Propchange: james/server/sandbox/imap-integration/src/java/org/apache/james/imapserver/ImapHandlerInterface.java
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: james/server/sandbox/imap-integration/src/java/org/apache/james/imapserver/ImapRequestHandler.java
URL: http://svn.apache.org/viewvc/james/server/sandbox/imap-integration/src/java/org/apache/james/imapserver/ImapRequestHandler.java?view=diff&rev=454662&r1=454661&r2=454662
==============================================================================
--- james/server/sandbox/imap-integration/src/java/org/apache/james/imapserver/ImapRequestHandler.java (original)
+++ james/server/sandbox/imap-integration/src/java/org/apache/james/imapserver/ImapRequestHandler.java Tue Oct 10 01:34:56 2006
@@ -1,117 +1,117 @@
-/****************************************************************
- * 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;
-
-import java.io.InputStream;
-import java.io.OutputStream;
-
-import org.apache.james.imapserver.commands.CommandParser;
-import org.apache.james.imapserver.commands.ImapCommand;
-import org.apache.james.imapserver.commands.ImapCommandFactory;
-
-/**
- *
- * @author  Darrell DeBoer <da...@apache.org>
- *
- * @version $Revision: 109034 $
- */
-public final class ImapRequestHandler
-{
-    private ImapCommandFactory imapCommands = new ImapCommandFactory();
-    private CommandParser parser = new CommandParser();
-    private static final String REQUEST_SYNTAX = "Protocol Error: Was expecting <tag SPACE command [arguments]>";
-
-    /**
-     * This method parses POP3 commands read off the wire in handleConnection.
-     * Actual processing of the command (possibly including additional back and
-     * forth communication with the client) is delegated to one of a number of
-     * command specific handler methods.  The primary purpose of this method is
-     * to parse the raw command string to determine exactly which handler should
-     * be called.  It returns true if expecting additional commands, false otherwise.
-     *
-     * @return whether additional commands are expected.
-     */
-    public boolean handleRequest( InputStream input,
-                                  OutputStream output,
-                                  ImapSession session )
-            throws ProtocolException
-    {
-        ImapRequestLineReader request = new ImapRequestLineReader( input, output );
-        try {
-            request.nextChar();
-        }
-        catch ( ProtocolException e ) {
-            return false;
-        }
-
-        ImapResponse response = new ImapResponse( output );
-
-        doProcessRequest( request, response, session );
-
-        // Consume the rest of the line, throwing away any extras. This allows us
-        // to clean up after a protocol error.
-        request.consumeLine();
-
-        return true;
-    }
-
-    private void doProcessRequest( ImapRequestLineReader request,
-                                   ImapResponse response,
-                                   ImapSession session)
-    {
-        String tag = null;
-        String commandName = null;
-
-        try {
-            tag = parser.tag( request );
-        }
-        catch ( ProtocolException e ) {
-            response.badResponse( REQUEST_SYNTAX );
-            return;
-        }
-
-//        System.out.println( "Got <tag>: " + tag );
-        response.setTag( tag );
-        try {
-            commandName = parser.atom( request );
-        }
-        catch ( ProtocolException e ) {
-            response.commandError( REQUEST_SYNTAX );
-            return;
-        }
-
-//        System.out.println( "Got <command>: " + commandName );
-        ImapCommand command = imapCommands.getCommand( commandName );
-        if ( command == null )
-        {
-            response.commandError( "Invalid command.");
-            return;
-        }
-
-        if ( !command.validForState( session.getState() ) ) {
-            response.commandFailed( command, "Command not valid in this state" );
-            return;
-        }
-
-        command.process( request, response, session );
-    }
-
-
-}
+/****************************************************************
+ * 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;
+
+import java.io.InputStream;
+import java.io.OutputStream;
+
+import org.apache.james.imapserver.commands.CommandParser;
+import org.apache.james.imapserver.commands.ImapCommand;
+import org.apache.james.imapserver.commands.ImapCommandFactory;
+
+/**
+ *
+ * @author  Darrell DeBoer <da...@apache.org>
+ *
+ * @version $Revision: 109034 $
+ */
+public final class ImapRequestHandler
+{
+    private ImapCommandFactory imapCommands = new ImapCommandFactory();
+    private CommandParser parser = new CommandParser();
+    private static final String REQUEST_SYNTAX = "Protocol Error: Was expecting <tag SPACE command [arguments]>";
+
+    /**
+     * This method parses POP3 commands read off the wire in handleConnection.
+     * Actual processing of the command (possibly including additional back and
+     * forth communication with the client) is delegated to one of a number of
+     * command specific handler methods.  The primary purpose of this method is
+     * to parse the raw command string to determine exactly which handler should
+     * be called.  It returns true if expecting additional commands, false otherwise.
+     *
+     * @return whether additional commands are expected.
+     */
+    public boolean handleRequest( InputStream input,
+                                  OutputStream output,
+                                  ImapSession session )
+            throws ProtocolException
+    {
+        ImapRequestLineReader request = new ImapRequestLineReader( input, output );
+        try {
+            request.nextChar();
+        }
+        catch ( ProtocolException e ) {
+            return false;
+        }
+
+        ImapResponse response = new ImapResponse( output );
+
+        doProcessRequest( request, response, session );
+
+        // Consume the rest of the line, throwing away any extras. This allows us
+        // to clean up after a protocol error.
+        request.consumeLine();
+
+        return true;
+    }
+
+    private void doProcessRequest( ImapRequestLineReader request,
+                                   ImapResponse response,
+                                   ImapSession session)
+    {
+        String tag = null;
+        String commandName = null;
+
+        try {
+            tag = parser.tag( request );
+        }
+        catch ( ProtocolException e ) {
+            response.badResponse( REQUEST_SYNTAX );
+            return;
+        }
+
+//        System.out.println( "Got <tag>: " + tag );
+        response.setTag( tag );
+        try {
+            commandName = parser.atom( request );
+        }
+        catch ( ProtocolException e ) {
+            response.commandError( REQUEST_SYNTAX );
+            return;
+        }
+
+//        System.out.println( "Got <command>: " + commandName );
+        ImapCommand command = imapCommands.getCommand( commandName );
+        if ( command == null )
+        {
+            response.commandError( "Invalid command.");
+            return;
+        }
+
+        if ( !command.validForState( session.getState() ) ) {
+            response.commandFailed( command, "Command not valid in this state" );
+            return;
+        }
+
+        command.process( request, response, session );
+    }
+
+
+}

Propchange: james/server/sandbox/imap-integration/src/java/org/apache/james/imapserver/ImapRequestHandler.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