<property name="report" value="${basedir}/report" />
<property file="build.properties" />
<property name="appname" value="hayashi"></property>
- <property name="version" value="0223"></property>
+ <property name="version" value="0224"></property>
<path id="compile.classpath">
<pathelement location="lib/junit.jar"/>
<fileset dir="${src}" includes="**/*.class" />
</delete>
</target>
-
+
<!-- コンパイル -->
<target name="compile" depends="prepare" description="Compile Java Sources">
<javac srcdir="${src}" destdir="${src}" encoding="UTF-8"
</javac>
</target>
- <!--
- Javadoc作成
+ <!--
+ Javadoc作成
実行させるには、PATHにJDKの「JAVA_HOME/bin」を追加する必要がある。
-->
<target name="javadoc" depends="compile" description="Create Javadoc API documentation">
packagenames="*"
encoding="UTF-8"
charset="UTF-8"
- sourcepath="${src}"
+ sourcepath="${src}"
destdir="${doc}/api" >
<link href="http://java.sun.com/j2se/1.5.0/ja/docs/ja/api/" />
<link href="http://java.sun.com/products/javamail/javadocs/" />
<report format="frames" todir="${report}/html"/>
</junitreport>
</target>
-
+
<target name="all" depends="clean, makejar" description="Clean build directory, then compile, and JavaDoc">
</target>
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'認証時のみ)
*/
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;
- }
+ setup(properties);
}
catch(Exception e) {
System.out.println(e);
}
}
+
+ /**
+ * 指定されたプロパティファイルに定義された値でインスタンスを生成する。
+ * @param properties 設定値を定義したプロパティファイル
+ */
+ public SiteData(Properties properties) {
+ setup(properties);
+ }
+
+ public void setup(java.util.Properties properties) {
+ 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;
+ }
+ }
}
class Command extends Thread {
String[] args; // コマンドパラメータ
private String commandName = ""; // コマンド名
- @SuppressWarnings("unchecked")
+ @SuppressWarnings({ "rawtypes" })
private Class cmd; // 実行対象インスタンス
-
+
/**
* コンストラクタ:実行対象のインスタンスを得る
* @param cmd
*/
- @SuppressWarnings("unchecked")
- public Command(Class cmd) {
+ public Command(Class<?> cmd) {
super();
this.cmd = cmd;
this.commandName = cmd.getName();
this.args = new String[0];
}
-
+
/**
* コマンドパラメータの設定
* @param folder
public void setArgs(String[] args) {
this.args = args;
}
-
+
public void setCommandName(String name) {
this.commandName = name;
}
java.lang.reflect.Method method = this.cmd.getMethod("main", new Class[] {String[].class});
method.setAccessible(true);
method.invoke(null, new Object[]{this.args});
-
+
System.out.println();
System.out.println("[END:"+ (new SimpleDateFormat("yyyy/MM/dd-HH:mm:ss")).format(new java.util.Date()) +"]\t"+ this.commandName);
}