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 bt...@apache.org on 2019/11/08 03:12:20 UTC

[james-project] 33/36: [REFACTORING] Remove unused class IMAPCommandDispatcher

This is an automated email from the ASF dual-hosted git repository.

btellier pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/james-project.git

commit 83b1c51be1b1075344d6cbbab866db97c3d424d2
Author: Benoit Tellier <bt...@linagora.com>
AuthorDate: Thu Nov 7 12:17:53 2019 +0700

    [REFACTORING] Remove unused class IMAPCommandDispatcher
    
    This is part of the unused package protocols.imap
---
 .../protocols/imap/core/IMAPCommandDispatcher.java | 78 ----------------------
 1 file changed, 78 deletions(-)

diff --git a/protocols/imap/src/main/java/org/apache/james/protocols/imap/core/IMAPCommandDispatcher.java b/protocols/imap/src/main/java/org/apache/james/protocols/imap/core/IMAPCommandDispatcher.java
deleted file mode 100644
index aac46b4..0000000
--- a/protocols/imap/src/main/java/org/apache/james/protocols/imap/core/IMAPCommandDispatcher.java
+++ /dev/null
@@ -1,78 +0,0 @@
-/****************************************************************
- * 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.protocols.imap.core;
-
-import java.nio.ByteBuffer;
-import java.util.Collection;
-import java.util.regex.Matcher;
-import java.util.regex.Pattern;
-
-import org.apache.james.protocols.api.ProtocolSession.State;
-import org.apache.james.protocols.api.Request;
-import org.apache.james.protocols.api.Response;
-import org.apache.james.protocols.api.handler.CommandDispatcher;
-import org.apache.james.protocols.api.handler.MultiLineHandler;
-import org.apache.james.protocols.imap.IMAPRequest;
-import org.apache.james.protocols.imap.IMAPSession;
-
-public class IMAPCommandDispatcher extends CommandDispatcher<IMAPSession> {
-
-    private static final Pattern LITERAL_PATTERN = Pattern.compile(".*\\{(\\d+)\\}.*");
-    
-    @Override
-    protected Request parseRequest(IMAPSession session, ByteBuffer buffer) throws Exception {
-        IMAPRequest request = new IMAPRequest(buffer);
-        Matcher matcher = LITERAL_PATTERN.matcher(request.getArgument());
-        if (matcher.matches()) {
-            final long bytesToRead = Long.parseLong(matcher.group(1));
-            MultiLineHandler<IMAPSession> handler = new MultiLineHandler<IMAPSession>() {
-                
-                private static final String BYTES_READ = "BYTES_READ";
-
-                @Override
-                protected boolean isReady(IMAPSession session, ByteBuffer line) {
-                    long bytesRead = (Long) session.setAttachment(BYTES_READ, null, State.Transaction);
-                    bytesRead += line.remaining();
-                    if (bytesRead >= bytesToRead) {
-                        return true;
-                    } else {
-                        session.setAttachment(BYTES_READ, bytesRead, State.Transaction);
-                        return false;
-                    }
-                }
-
-                @Override
-                protected Response onLines(IMAPSession session, Collection<ByteBuffer> lines) {
-                    session.popLineHandler();
-                    return dispatchCommandHandlers(session, new IMAPRequest(lines));
-                }
-            };
-            buffer.rewind();
-            
-            // push the line to the handler
-            handler.onLine(session, buffer);
-            
-            session.pushLineHandler(handler);
-            return null;
-            
-        } else {
-            return request;
-        }
-    }
-}


---------------------------------------------------------------------
To unsubscribe, e-mail: server-dev-unsubscribe@james.apache.org
For additional commands, e-mail: server-dev-help@james.apache.org