Author: norman
Date: Wed Feb  2 13:59:34 2011
New Revision: 1066469

URL: http://svn.apache.org/viewvc?rev=1066469&view=rev
Log:
Just move some variables to static fields

Added:
    
james/server/trunk/imapserver/src/main/java/org/apache/james/imapserver/netty/NettyConstants.java
Modified:
    
james/server/trunk/imapserver/src/main/java/org/apache/james/imapserver/netty/IMAPServer.java
    
james/server/trunk/imapserver/src/main/java/org/apache/james/imapserver/netty/NettyImapSession.java

Modified: 
james/server/trunk/imapserver/src/main/java/org/apache/james/imapserver/netty/IMAPServer.java
URL: 
http://svn.apache.org/viewvc/james/server/trunk/imapserver/src/main/java/org/apache/james/imapserver/netty/IMAPServer.java?rev=1066469&r1=1066468&r2=1066469&view=diff
==============================================================================
--- 
james/server/trunk/imapserver/src/main/java/org/apache/james/imapserver/netty/IMAPServer.java
 (original)
+++ 
james/server/trunk/imapserver/src/main/java/org/apache/james/imapserver/netty/IMAPServer.java
 Wed Feb  2 13:59:34 2011
@@ -46,7 +46,7 @@ import org.jboss.netty.util.HashedWheelT
  * NIO IMAP Server which use Netty
  *
  */
-public class IMAPServer extends AbstractConfigurableAsyncServer implements 
ImapConstants, IMAPServerMBean {
+public class IMAPServer extends AbstractConfigurableAsyncServer implements 
ImapConstants, IMAPServerMBean, NettyConstants {
 
     private static final String softwaretype = "JAMES "+VERSION+" Server ";
     
@@ -110,17 +110,17 @@ public class IMAPServer extends Abstract
 
             public ChannelPipeline getPipeline() throws Exception {
                 ChannelPipeline pipeline = pipeline();
-                pipeline.addLast("groupHandler", groupHandler);
-                pipeline.addLast("timeoutHandler", new TimeoutHandler(timer, 
TIMEOUT));
-                pipeline.addLast("connectionLimit", new 
ConnectionLimitUpstreamHandler(IMAPServer.this.connectionLimit));
+                pipeline.addLast(GROUP_HANDLER, groupHandler);
+                pipeline.addLast(TIMEOUT_HANDLER, new TimeoutHandler(timer, 
TIMEOUT));
+                pipeline.addLast(CONNECTION_LIMIT_HANDLER, new 
ConnectionLimitUpstreamHandler(IMAPServer.this.connectionLimit));
 
-                pipeline.addLast("connectionPerIpLimit", new 
ConnectionPerIpLimitUpstreamHandler(IMAPServer.this.connPerIP));
+                pipeline.addLast(CONNECTION_LIMIT_PER_IP_HANDLER, new 
ConnectionPerIpLimitUpstreamHandler(IMAPServer.this.connPerIP));
 
 
                 
                 // Add the text line decoder which limit the max line length, 
don't strip the delimiter and use CRLF as delimiter
-                pipeline.addLast("framer", new 
DelimiterBasedFrameDecoder(MAX_LINE_LENGTH, false, Delimiters.lineDelimiter()));
-                pipeline.addLast("requestDecoder", new 
ImapRequestFrameDecoder(decoder));
+                pipeline.addLast(FRAMER, new 
DelimiterBasedFrameDecoder(MAX_LINE_LENGTH, false, Delimiters.lineDelimiter()));
+                pipeline.addLast(REQUEST_DECODER, new 
ImapRequestFrameDecoder(decoder));
 
                 
                 if (isSSLSocket()) {
@@ -128,16 +128,16 @@ public class IMAPServer extends Abstract
                     // See https://issues.apache.org/jira/browse/JAMES-1025
                     SSLEngine engine = getSSLContext().createSSLEngine();
                     engine.setUseClientMode(false);
-                    pipeline.addFirst("sslHandler", new SslHandler(engine));
+                    pipeline.addFirst(SSL_HANDLER, new SslHandler(engine));
                     
                 }
-                pipeline.addLast("connectionCountHandler", 
getConnectionCountHandler());
+                pipeline.addLast(CONNECTION_COUNT_HANDLER, 
getConnectionCountHandler());
                 
                 
                 if (isStartTLSSupported())  {
-                    pipeline.addLast("coreHandler",  new 
ImapChannelUpstreamHandler(hello, processor, encoder, getLogger(), compress, 
getSSLContext(), getEnabledCipherSuites()));
+                    pipeline.addLast(CORE_HANDLER,  new 
ImapChannelUpstreamHandler(hello, processor, encoder, getLogger(), compress, 
getSSLContext(), getEnabledCipherSuites()));
                 } else {
-                    pipeline.addLast("coreHandler",  new 
ImapChannelUpstreamHandler(hello, processor, encoder, getLogger(), compress));
+                    pipeline.addLast(CORE_HANDLER,  new 
ImapChannelUpstreamHandler(hello, processor, encoder, getLogger(), compress));
                 }
                 
                 return pipeline;

Added: 
james/server/trunk/imapserver/src/main/java/org/apache/james/imapserver/netty/NettyConstants.java
URL: 
http://svn.apache.org/viewvc/james/server/trunk/imapserver/src/main/java/org/apache/james/imapserver/netty/NettyConstants.java?rev=1066469&view=auto
==============================================================================
--- 
james/server/trunk/imapserver/src/main/java/org/apache/james/imapserver/netty/NettyConstants.java
 (added)
+++ 
james/server/trunk/imapserver/src/main/java/org/apache/james/imapserver/netty/NettyConstants.java
 Wed Feb  2 13:59:34 2011
@@ -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.netty;
+
+/**
+ * Just some constants which are used with the Netty implementation
+ * 
+ *
+ */
+public interface NettyConstants {
+    public final static String ZLIB_DECODER = "zlibDecoder";
+    public final static String ZLIB_ENCODER = "zlibEncoder";
+    public final static String SSL_HANDLER = "sslHandler";
+    public final static String REQUEST_DECODER = "requestDecoder";
+    public final static String FRAMER = "framer";
+    public final static String TIMEOUT_HANDLER = "timeoutHandler";
+    public final static String CORE_HANDLER = "coreHandler";
+    public final static String GROUP_HANDLER = "groupHandler";
+    public final static String CONNECTION_LIMIT_HANDLER = 
"connectionLimitHandler";
+    public final static String CONNECTION_LIMIT_PER_IP_HANDLER = 
"connectionPerIpLimitHandler";
+    public final static String CONNECTION_COUNT_HANDLER= 
"connectionCountHandler";
+}

Modified: 
james/server/trunk/imapserver/src/main/java/org/apache/james/imapserver/netty/NettyImapSession.java
URL: 
http://svn.apache.org/viewvc/james/server/trunk/imapserver/src/main/java/org/apache/james/imapserver/netty/NettyImapSession.java?rev=1066469&r1=1066468&r2=1066469&view=diff
==============================================================================
--- 
james/server/trunk/imapserver/src/main/java/org/apache/james/imapserver/netty/NettyImapSession.java
 (original)
+++ 
james/server/trunk/imapserver/src/main/java/org/apache/james/imapserver/netty/NettyImapSession.java
 Wed Feb  2 13:59:34 2011
@@ -35,7 +35,7 @@ import org.jboss.netty.handler.codec.com
 import org.jboss.netty.handler.codec.compression.ZlibWrapper;
 import org.jboss.netty.handler.ssl.SslHandler;
 
-public class NettyImapSession implements ImapSession{
+public class NettyImapSession implements ImapSession, NettyConstants{
 
     private ImapSessionState state = ImapSessionState.NON_AUTHENTICATED;
     private SelectedMailbox selectedMailbox;
@@ -46,9 +46,7 @@ public class NettyImapSession implements
     private SessionLog log;
     private ChannelHandlerContext context;
     private int handlerCount;
-    private final static String ZLIB_DECODER = "zlibDecoder";
-    private final static String ZLIB_ENCODER = "zlibEncoder";
-    private final static String SSL_HANDLER = "sslHandler";
+
 
     public NettyImapSession(ChannelHandlerContext context, Log log, SSLContext 
sslContext, String[] enabledCipherSuites, boolean compress) {
         this.context = context;



---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to