OSDN Git Service

Support: [ #25090 ] TLS/SSL SMTP server connection suuport. Ph.1
[mdc/BetaProject.git] / src / org / jent / checksmtp / ApplicationProperties.java
index a227e5f..faee9c0 100644 (file)
@@ -15,9 +15,11 @@ import java.util.Properties;
  * <H3>Properties</H3>
  * <DL>
  * <DT> -.port       <DD>Service port number.       (Default:8725)
+ * <DT> -.ssl        <DD>Service port use SSL.      (Default:false) //Not use yet.
  * <DT> -.enableRemoteConnect <DD>Permit connect from remote host. (Default:false)
  * <DT> -.serverHost <DD>STMP Server host name.     (Default:mail)
  * <DT> -.serverPort <DD>STMP Server port.          (Default:25)
+ * <DT> -.serverSSL <DD>SMTP Server port use SSL.   (Default:false)
  * <DT> -.confirm.timeout <DD> Confirm auto push OK timeput (Default:0 = forever)
  * <DT> -.ladp       <DD>If "true" use LDAP search. (Default:false)
  * <DT> -.ldap.providerUrl <DD>LDAP Provider URL    (Default:ldap://localhost:389
@@ -31,9 +33,11 @@ import java.util.Properties;
 public class ApplicationProperties {
   private static final String PREFIX = "org.jent.checksmtp";
   private static final String SMTP_PORT = PREFIX + ".port";
+  private static final String SMTP_SSL = PREFIX + ".SSL";
   private static final String SMTP_ENEBLE_REMOTE_CONNECT = PREFIX + ".enableRemoteConnect";
   private static final String SMTP_SERVER_HOST = PREFIX + ".serverHost";
   private static final String SMTP_SERVER_PORT = PREFIX + ".serverPort";
+  private static final String SMTP_SERVER_SSL = PREFIX + ".serverSSL";
   private static final String CONFIRM_TIMEOUT = PREFIX + ".confirmTimeout";
   private static final String LDAP_PREFIX = PREFIX + ".ldap";
   private static final String LDAP_PROVIDER_URL = LDAP_PREFIX + ".providerUrl";
@@ -109,10 +113,19 @@ public class ApplicationProperties {
   public static int getSmtpServerPort() {
     return Integer.parseInt(applicationProperties.getProperty(SMTP_SERVER_PORT, "25"));
   }
-  
   public static void setSmtpServerPort(int port) {
     applicationProperties.setProperty(SMTP_SERVER_PORT, new Integer(port).toString());
   }
+
+  public static boolean getSmtpServerSSL() {
+    //getProperty(str) default value is null. valueOf(null) retrun FALSE.
+    return Boolean.valueOf(applicationProperties.getProperty(SMTP_SERVER_SSL)).booleanValue();
+  }
+  
+  public static void setSmtpServerSSL(boolean ssl) {
+    applicationProperties.setProperty(SMTP_SERVER_SSL, Boolean.toString(ssl));
+  }
   
   public static int getSmtpPort() {
     return Integer.parseInt(applicationProperties.getProperty(SMTP_PORT, "8725"));
@@ -121,10 +134,18 @@ public class ApplicationProperties {
   public static void setSmtpPort(int port) {
     applicationProperties.setProperty(SMTP_PORT, new Integer(port).toString());
   }
-  
+
+  public static boolean getSmtpSSL() {
+    return Boolean.valueOf(applicationProperties.getProperty(SMTP_SSL)).booleanValue();
+  }
+
+  public static void setSmtpSSL(boolean ssl) {
+    applicationProperties.setProperty(SMTP_SSL, Boolean.toString(ssl));
+  }
+
   public static boolean getSmtpEnebleRemoteConnect() {
     String str = applicationProperties.getProperty(SMTP_ENEBLE_REMOTE_CONNECT);
-    return new Boolean(str).booleanValue();
+    return Boolean.valueOf(str).booleanValue();
   }
   
   public static void setSmtpEnableRemoteConnect(boolean obj) {
@@ -148,7 +169,7 @@ public class ApplicationProperties {
   }
   
   public static boolean getLdapIsSjis() {
-    return new Boolean(applicationProperties.getProperty(LDAP_IS_SJIS)).booleanValue();
+    return Boolean.valueOf(applicationProperties.getProperty(LDAP_IS_SJIS)).booleanValue();
   }
   
   public static void setLdapIsSjis(boolean obj) {
@@ -157,7 +178,8 @@ public class ApplicationProperties {
   
   public static boolean getLdap() {
     String str = applicationProperties.getProperty(LDAP_PREFIX);
-    Boolean flg = new Boolean(str);
+    //the value true if the string is ignoring case "true".
+    Boolean flg = Boolean.valueOf(str);
     return flg.booleanValue();
   }