OSDN Git Service

Merge branch 'master' of ssh://www.deister.jp/mnt/hdb1/git/hayashi
[hayashilib/hayashi.git] / src / hayashi / yuu / tools / mail / SiteData.java
index c686428..319c1ca 100644 (file)
-package hayashi.yuu.tools.mail;
-
-import hayashi.yuu.tools.properties.Properties;
-import java.io.FileInputStream;
-
-/**
- * メールアカウント設定情報を保持するインスタンス
- * @author hayashi
- * @version    2010/02/05      項目'MAIL_SMTP_PORT'を追加
- */
-public class SiteData {
-    public String MAIL_SMTP = "192.168.0.10";
-    public String MAIL_SMTP_PORT = "25";
-    public String MAIL_FROM = "webserver@xxx.co.jp";
-    public String MAIL_TO = "";
-    public String MAIL_CC = "";
-    public String MAIL_BCC = "";
-    
-    /**
-     * 'POP before SMTP'認証を行うかどうか
-     */
-    public boolean POP_before_SMTP = false;
-    
-    /**
-     * 'USER_AUTH'認証を行うかどうか
-     */
-    public boolean USER_AUTH = false;
-    
-    /**
-     * 'STARTTLS'認証を行うかどうか
-     */
-    public boolean STARTTLS = false;
-    
-    /**
-     * POPサーバー名('POP before SMTP'認証時のみ)
-     */
-    public String MAIL_POP = "";
-    
-    /**
-     * POPアカウント('POP before SMTP'認証時のみ)
-     */
-    public String USER_ID = "";
-    
-    /**
-     * POPアカウントのパスワード('POP before SMTP'認証時のみ)
-     */
-    public String PASSWORD = "";
-
-    /**
-     * 指定されたプロパティファイルに定義された値でインスタンスを生成する。
-     * @param propertyFile     設定値を定義したプロパティファイルのパス名
-     */
-    public SiteData(String propertyFile) {
-        try {
-            Properties properties = new Properties();
-            properties.setPasswordItem("MAIL_PASSWORD");
-            properties.load(new FileInputStream(propertyFile));
-
-            String str = "";
-            if ((str = properties.getProperty("mail.smtp.host")) != null) {
-               MAIL_SMTP = str;
-            }
-            if ((str = properties.getProperty("mail.smtp.port")) != null) {
-               MAIL_SMTP_PORT = str;
-            }
-            if ((str = properties.getProperty("mail.smtp.from")) != null) {
-               MAIL_FROM = str;
-            }
-            if ((str = properties.getProperty("MAIL_TO")) != null) {
-               MAIL_TO = str;
-            }
-            if ((str = properties.getProperty("MAIL_CC")) != null) {
-               MAIL_CC = str;
-            }
-            if ((str = properties.getProperty("MAIL_BCC")) != null) {
-               MAIL_BCC = str;
-            }
-            
-            str = properties.getProperty("MAIL_POP_before_SMTP");
-            if ((str != null) && str.equals("true")) {
-               POP_before_SMTP = true;
-            }
-            
-            str = properties.getProperty("mail.smtp.auth");
-            if ((str != null) && str.equals("true")) {
-               USER_AUTH = true;
-            }
-
-            str = properties.getProperty("mail.smtp.starttls.enable");
-            if ((str != null) && str.equals("true")) {
-               STARTTLS = true;
-            }
-            
-            if ((str = properties.getProperty("MAIL_POP")) != null) {
-               MAIL_POP = str;
-            }
-            if ((str = properties.getProperty("mail.smtp.user")) != null) {
-               USER_ID = str;
-            }
-            if ((str = properties.getProperty("MAIL_PASSWORD")) != null) {
-               PASSWORD = str;
-            }
-        }
-        catch(Exception e) {
-            System.out.println(e);
-        }
-    }
-}
+package hayashi.yuu.tools.mail;\r
+\r
+import hayashi.yuu.tools.properties.Properties;\r
+import java.io.FileInputStream;\r
+\r
+/**\r
+ * メールアカウント設定情報を保持するインスタンス\r
+ * @author hayashi\r
+ * @version    2010/02/05      項目'MAIL_SMTP_PORT'を追加\r
+ */\r
+public class SiteData {\r
+    public String MAIL_SMTP = "192.168.0.10";\r
+    public String MAIL_SMTP_PORT = "25";\r
+    public String MAIL_FROM = "webserver@xxx.co.jp";\r
+    public String MAIL_TO = "";\r
+    public String MAIL_CC = "";\r
+    public String MAIL_BCC = "";\r
+\r
+    /**\r
+     * 'POP before SMTP'認証を行うかどうか\r
+     */\r
+    public boolean POP_before_SMTP = false;\r
+\r
+    /**\r
+     * 'USER_AUTH'認証を行うかどうか\r
+     */\r
+    public boolean USER_AUTH = false;\r
+\r
+    /**\r
+     * 'STARTTLS'認証を行うかどうか\r
+     */\r
+    public boolean STARTTLS = false;\r
+\r
+    /**\r
+     * POPサーバー名('POP before SMTP'認証時のみ)\r
+     */\r
+    public String MAIL_POP = "";\r
+\r
+    /**\r
+     * POPアカウント('POP before SMTP'認証時のみ)\r
+     */\r
+    public String USER_ID = "";\r
+\r
+    /**\r
+     * POPアカウントのパスワード('POP before SMTP'認証時のみ)\r
+     */\r
+    public String PASSWORD = "";\r
+\r
+    /**\r
+     * 指定されたプロパティファイルに定義された値でインスタンスを生成する。\r
+     * @param propertyFile     設定値を定義したプロパティファイルのパス名\r
+     */\r
+    public SiteData(String propertyFile) {\r
+        try {\r
+            Properties properties = new Properties();\r
+            properties.setPasswordItem("MAIL_PASSWORD");\r
+            properties.load(new FileInputStream(propertyFile));\r
+            setup(properties);\r
+        }\r
+        catch(Exception e) {\r
+            System.out.println(e);\r
+        }\r
+    }\r
+\r
+    /**\r
+     * 指定されたプロパティファイルに定義された値でインスタンスを生成する。\r
+     * @param properties       設定値を定義したプロパティファイル\r
+     */\r
+    public SiteData(Properties properties) {\r
+        setup(properties);\r
+    }\r
+\r
+    public void setup(java.util.Properties properties) {\r
+        String str = "";\r
+        if ((str = properties.getProperty("mail.smtp.host")) != null) {\r
+               MAIL_SMTP = str;\r
+        }\r
+        if ((str = properties.getProperty("mail.smtp.port")) != null) {\r
+               MAIL_SMTP_PORT = str;\r
+        }\r
+        if ((str = properties.getProperty("mail.smtp.from")) != null) {\r
+               MAIL_FROM = str;\r
+        }\r
+        if ((str = properties.getProperty("MAIL_TO")) != null) {\r
+               MAIL_TO = str;\r
+        }\r
+        if ((str = properties.getProperty("MAIL_CC")) != null) {\r
+               MAIL_CC = str;\r
+        }\r
+        if ((str = properties.getProperty("MAIL_BCC")) != null) {\r
+               MAIL_BCC = str;\r
+        }\r
+\r
+        str = properties.getProperty("MAIL_POP_before_SMTP");\r
+        if ((str != null) && str.equals("true")) {\r
+               POP_before_SMTP = true;\r
+        }\r
+\r
+        str = properties.getProperty("mail.smtp.auth");\r
+        if ((str != null) && str.equals("true")) {\r
+               USER_AUTH = true;\r
+        }\r
+\r
+        str = properties.getProperty("mail.smtp.starttls.enable");\r
+        if ((str != null) && str.equals("true")) {\r
+               STARTTLS = true;\r
+        }\r
+\r
+        if ((str = properties.getProperty("MAIL_POP")) != null) {\r
+               MAIL_POP = str;\r
+        }\r
+        if ((str = properties.getProperty("mail.smtp.user")) != null) {\r
+               USER_ID = str;\r
+        }\r
+        if ((str = properties.getProperty("MAIL_PASSWORD")) != null) {\r
+               PASSWORD = str;\r
+        }\r
+    }\r
+}\r