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 2020/04/21 02:56:50 UTC

[james-project] 14/19: [Refactoring] remove some setters from ProtocolConfigurationImpl

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 713f78f6f07e0a26abf20e283541f9e582637306
Author: Matthieu Baechler <ma...@apache.org>
AuthorDate: Fri Apr 3 17:17:26 2020 +0200

    [Refactoring] remove some setters from ProtocolConfigurationImpl
---
 .../protocols/api/ProtocolConfigurationImpl.java    | 21 ++++++++-------------
 .../james/protocols/lmtp/LMTPConfiguration.java     |  6 +++++-
 .../james/protocols/lmtp/LMTPConfigurationImpl.java |  2 +-
 .../james/protocols/pop3/POP3Configuration.java     |  2 +-
 .../james/protocols/smtp/SMTPConfigurationImpl.java |  2 +-
 .../apache/james/lmtpserver/netty/LMTPServer.java   |  4 ++++
 6 files changed, 20 insertions(+), 17 deletions(-)

diff --git a/protocols/api/src/main/java/org/apache/james/protocols/api/ProtocolConfigurationImpl.java b/protocols/api/src/main/java/org/apache/james/protocols/api/ProtocolConfigurationImpl.java
index 5482920..6e7f2bb 100644
--- a/protocols/api/src/main/java/org/apache/james/protocols/api/ProtocolConfigurationImpl.java
+++ b/protocols/api/src/main/java/org/apache/james/protocols/api/ProtocolConfigurationImpl.java
@@ -44,7 +44,14 @@ public class ProtocolConfigurationImpl implements ProtocolConfiguration {
         }
         DEFAULT_HELLO_NAME = hName;
     }
-    
+
+    private ProtocolConfigurationImpl() {
+    }
+
+    protected ProtocolConfigurationImpl(String softwareName) {
+        this.softwareName = softwareName;
+    }
+
     @Override
     public String getHelloName() {
         if (helloName == null) {
@@ -53,26 +60,14 @@ public class ProtocolConfigurationImpl implements ProtocolConfiguration {
         return helloName;
     }
     
-    public void setHelloName(String helloName) {
-        this.helloName = helloName;
-    }
-    
     @Override
     public String getGreeting() {
         return greeting;
     }
-    
-    public void setGreeting(String greeting) {
-        this.greeting = greeting;
-    }
 
     @Override
     public String getSoftwareName() {
         return softwareName;
     }
-    
-    public void setSoftwareName(String softwareName) {
-        this.softwareName = softwareName;
-    }
 
 }
diff --git a/protocols/lmtp/src/main/java/org/apache/james/protocols/lmtp/LMTPConfiguration.java b/protocols/lmtp/src/main/java/org/apache/james/protocols/lmtp/LMTPConfiguration.java
index fa3f374..92022aa 100644
--- a/protocols/lmtp/src/main/java/org/apache/james/protocols/lmtp/LMTPConfiguration.java
+++ b/protocols/lmtp/src/main/java/org/apache/james/protocols/lmtp/LMTPConfiguration.java
@@ -26,7 +26,11 @@ import org.apache.james.protocols.smtp.SMTPConfiguration;
  * A {@link ProtocolConfigurationImpl} which is used in the context of LMTP
  */
 public abstract class LMTPConfiguration extends ProtocolConfigurationImpl implements SMTPConfiguration {
-    
+
+    protected LMTPConfiguration(String softwareName) {
+        super(softwareName);
+    }
+
     @Override
     public boolean isRelayingAllowed(String remoteIP) {
         return false;
diff --git a/protocols/lmtp/src/main/java/org/apache/james/protocols/lmtp/LMTPConfigurationImpl.java b/protocols/lmtp/src/main/java/org/apache/james/protocols/lmtp/LMTPConfigurationImpl.java
index 3bc5d2d..281b7c2 100644
--- a/protocols/lmtp/src/main/java/org/apache/james/protocols/lmtp/LMTPConfigurationImpl.java
+++ b/protocols/lmtp/src/main/java/org/apache/james/protocols/lmtp/LMTPConfigurationImpl.java
@@ -23,7 +23,7 @@ public class LMTPConfigurationImpl extends LMTPConfiguration {
     private long maxMessageSize = 0;    
 
     public LMTPConfigurationImpl() {
-        setSoftwareName("JAMES Protocols LMTP Server");
+        super("JAMES Protocols LMTP Server");
     }
     
     @Override
diff --git a/protocols/pop3/src/main/java/org/apache/james/protocols/pop3/POP3Configuration.java b/protocols/pop3/src/main/java/org/apache/james/protocols/pop3/POP3Configuration.java
index b63a3a0..20f5fcc 100644
--- a/protocols/pop3/src/main/java/org/apache/james/protocols/pop3/POP3Configuration.java
+++ b/protocols/pop3/src/main/java/org/apache/james/protocols/pop3/POP3Configuration.java
@@ -26,6 +26,6 @@ import org.apache.james.protocols.api.ProtocolConfigurationImpl;
 public class POP3Configuration extends ProtocolConfigurationImpl {
 
     public POP3Configuration() {
-        setSoftwareName("JAMES Protocols POP3 Server");
+        super("JAMES Protocols POP3 Server");
     }
 }
diff --git a/protocols/smtp/src/main/java/org/apache/james/protocols/smtp/SMTPConfigurationImpl.java b/protocols/smtp/src/main/java/org/apache/james/protocols/smtp/SMTPConfigurationImpl.java
index f16aa29..012a31c 100644
--- a/protocols/smtp/src/main/java/org/apache/james/protocols/smtp/SMTPConfigurationImpl.java
+++ b/protocols/smtp/src/main/java/org/apache/james/protocols/smtp/SMTPConfigurationImpl.java
@@ -34,7 +34,7 @@ public class SMTPConfigurationImpl extends ProtocolConfigurationImpl implements
     private boolean enforceHeloEhlo = true;
 
     public SMTPConfigurationImpl() {
-        setSoftwareName("JAMES SMTP Protocols Server");
+        super("JAMES SMTP Protocols Server");
     }
     
     @Override
diff --git a/server/protocols/protocols-lmtp/src/main/java/org/apache/james/lmtpserver/netty/LMTPServer.java b/server/protocols/protocols-lmtp/src/main/java/org/apache/james/lmtpserver/netty/LMTPServer.java
index 0452d71..c07a59f 100644
--- a/server/protocols/protocols-lmtp/src/main/java/org/apache/james/lmtpserver/netty/LMTPServer.java
+++ b/server/protocols/protocols-lmtp/src/main/java/org/apache/james/lmtpserver/netty/LMTPServer.java
@@ -86,6 +86,10 @@ public class LMTPServer extends AbstractProtocolAsyncServer implements LMTPServe
      */
     public class LMTPConfigurationImpl extends LMTPConfiguration {
 
+        protected LMTPConfigurationImpl() {
+            super("JAMES Protocols Server");
+        }
+        
         @Override
         public String getHelloName() {
             return LMTPServer.this.getHelloName();


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