* </p>\r
*/\r
public ClassLoaderUnloadFailException() {\r
- super("クラスローダーの破棄に失敗しました。");\r
+ super(Message.classLoaderUnloadFail());\r
}\r
\r
}\r
* </p>\r
*/\r
public ClassLoaderUnloadedException() {\r
- super("クラスローダーは既に破棄されています。");\r
+ super(Message.classLoaderUnloaded());\r
}\r
\r
}\r
*/\r
public Deployer(File deployDirectory, Pattern filePattern, File workDirectory) {\r
if (deployDirectory == null) {\r
- throw new IllegalArgumentException("deployDirectory is null.");\r
+ throw new IllegalArgumentException(Message.argumentIsNull("deployDirectory"));\r
}\r
if (!deployDirectory.isDirectory()) {\r
- throw new IllegalArgumentException("deployDirectory is not directory.");\r
+ throw new IllegalArgumentException(Message.argumentIsNotDirectory("deployDirectory"));\r
}\r
if (filePattern == null) {\r
- throw new IllegalArgumentException("filePattern is null.");\r
+ throw new IllegalArgumentException(Message.argumentIsNull("filePattern"));\r
}\r
if (workDirectory == null) {\r
- throw new IllegalArgumentException("workDirectory is null.");\r
+ throw new IllegalArgumentException(Message.argumentIsNull("workDirectory"));\r
}\r
if (!workDirectory.isDirectory()) {\r
- throw new IllegalArgumentException("workDirectory is not directory.");\r
+ throw new IllegalArgumentException(Message.argumentIsNotDirectory("workDirectory"));\r
}\r
\r
this._deployDirectory = deployDirectory;\r
*/\r
public void addListener(DeployerListener listener) {\r
if (listener == null) {\r
- throw new IllegalArgumentException("listener is null.");\r
+ throw new IllegalArgumentException(Message.argumentIsNull("listener"));\r
}\r
synchronized (this._listenerList) {\r
this._listenerList.add(listener);\r
}\r
File parentDir = dir.getParentFile();\r
if (!dir.delete()) {\r
- throw new IOException("ディレクトリ\"" + dir.getAbsolutePath() + "\"の削除に失敗しました。");\r
+ throw new IOException(Message.directoryDeleteFail(dir.getAbsolutePath()));\r
}\r
this.deleteWithParent(parentDir);\r
}\r
* 作成に失敗したディレクトリ。\r
*/\r
public DirectoryCreateFailException(File dir) {\r
- super("ディレクトリ\"" + dir.getAbsolutePath() + "\"の作成に失敗しました。");\r
+ super(Message.directoryCreateFail(dir.getAbsolutePath()));\r
}\r
\r
}\r
* 削除に失敗したディレクトリ。\r
*/\r
public DirectoryDeleteFailException(File dir) {\r
- super("ディレクトリ\"" + dir.getAbsolutePath() + "\"の削除に失敗しました。");\r
+ super(Message.directoryDeleteFail(dir.getAbsolutePath()));\r
}\r
\r
}\r
* 作成に失敗したファイル。\r
*/\r
public FileCreateFailException(File file) {\r
- super("ファイル\"" + file.getAbsolutePath() + "\"の作成に失敗しました。");\r
+ super(Message.fileCreateFail(file.getAbsolutePath()));\r
}\r
\r
}\r
* 削除に失敗したファイル。\r
*/\r
public FileDeleteFailException(File file) {\r
- super("ファイル\"" + file.getAbsolutePath() + "\"の削除に失敗しました。");\r
+ super(Message.fileDeleteFail(file.getAbsolutePath()));\r
}\r
\r
}\r
*/\r
public FileMonitor(File baseDirectory, Pattern filePattern) {\r
if (baseDirectory == null) {\r
- throw new IllegalArgumentException("baseDirectory is null.");\r
+ throw new IllegalArgumentException(Message.argumentIsNull("baseDirectory"));\r
}\r
if (!baseDirectory.isDirectory()) {\r
- throw new IllegalArgumentException("baseDirectory is not directory.");\r
+ throw new IllegalArgumentException(Message.argumentIsNotDirectory("baseDirectory"));\r
}\r
if (filePattern == null) {\r
- throw new IllegalArgumentException("filePattern is null.");\r
+ throw new IllegalArgumentException(Message.argumentIsNull("filePattern"));\r
}\r
this._baseDirectory = baseDirectory;\r
this._filePattern = filePattern;\r
*/\r
public void addListener(FileMonitorListener listener) {\r
if (listener == null) {\r
- throw new IllegalArgumentException("listener is null.");\r
+ throw new IllegalArgumentException(Message.argumentIsNull("listener"));\r
}\r
synchronized (this._listenerList) {\r
this._listenerList.add(listener);\r
* 例外の原因。\r
*/\r
public FileMonitorFailException(Exception e) {\r
- super("ファイルの監視に失敗しました。", e);\r
+ super(Message.fileMonitorFail(), e);\r
}\r
\r
}\r
--- /dev/null
+/*\r
+ * Copyright (C) 2007 uguu at users.sourceforge.jp, All Rights Reserved.\r
+ *\r
+ * Redistribution and use in source and binary forms, with or without\r
+ * modification, are permitted provided that the following conditions\r
+ * are met:\r
+ *\r
+ * 1. Redistributions of source code must retain the above copyright\r
+ * notice, this list of conditions and the following disclaimer.\r
+ *\r
+ * 2. Redistributions in binary form must reproduce the above copyright\r
+ * notice, this list of conditions and the following disclaimer in the\r
+ * documentation and/or other materials provided with the distribution.\r
+ *\r
+ * 3. Neither the name of Clarkware Consulting, Inc. nor the names of its\r
+ * contributors may be used to endorse or promote products derived\r
+ * from this software without prior written permission. For written\r
+ * permission, please contact clarkware@clarkware.com.\r
+ *\r
+ * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES,\r
+ * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND\r
+ * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL\r
+ * CLARKWARE CONSULTING OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,\r
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT\r
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA,\r
+ * OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF\r
+ * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING\r
+ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,\r
+ * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\r
+ */\r
+\r
+package jp.sourceforge.deployer;\r
+\r
+import java.text.MessageFormat;\r
+import java.util.ResourceBundle;\r
+\r
+/**\r
+ * <p>\r
+ * "jp.sourceforge.deployer.message"リソース・ファイルからメッセージを取得します。\r
+ * </p>\r
+ * \r
+ * @author $Author$\r
+ * @version $Rev$\r
+ */\r
+final class Message {\r
+\r
+ /**\r
+ * <p>\r
+ * インスタンス化を禁止します。\r
+ * </p>\r
+ */\r
+ private Message() {\r
+ throw new UnsupportedOperationException();\r
+ }\r
+\r
+ /**\r
+ * <p>\r
+ * リソース・ファイルからメッセージを取得します。\r
+ * </p>\r
+ * \r
+ * @param messageID\r
+ * メッセージのID(リソースのキー)。\r
+ * @param arguments\r
+ * メッセージに埋め込む引数。\r
+ * @return メッセージ。\r
+ */\r
+ private static String format(String messageID, String... arguments) {\r
+ ResourceBundle rb = ResourceBundle.getBundle("jp_sourceforge_deployer_message");\r
+ String message = rb.getString(messageID);\r
+ message = MessageFormat.format(message, (Object[]) arguments);\r
+ return message;\r
+ }\r
+\r
+ static String classLoaderUnloaded() {\r
+ return Message.format("classLoaderUnloaded");\r
+ }\r
+\r
+ static String classLoaderUnloadFail() {\r
+ return Message.format("classLoaderUnloadFail");\r
+ }\r
+\r
+ static String directoryCreateFail(String dir) {\r
+ return Message.format("directoryCreateFail", dir);\r
+ }\r
+\r
+ static String directoryDeleteFail(String dir) {\r
+ return Message.format("directoryDeleteFail", dir);\r
+ }\r
+\r
+ static String fileCreateFail(String file) {\r
+ return Message.format("fileCreateFail", file);\r
+ }\r
+\r
+ static String fileDeleteFail(String file) {\r
+ return Message.format("fileDeleteFail", file);\r
+ }\r
+\r
+ static String fileMonitorFail() {\r
+ return Message.format("fileMonitorFail");\r
+ }\r
+\r
+ static String argumentIsNull(String arg) {\r
+ return Message.format("argumentIsNull", arg);\r
+ }\r
+\r
+ static String argumentIsNotDirectory(String arg) {\r
+ return Message.format("argumentIsNotDirectory", arg);\r
+ }\r
+\r
+}\r
--- /dev/null
+classLoaderUnloaded=\u30af\u30e9\u30b9\u30ed\u30fc\u30c0\u30fc\u306f\u65e2\u306b\u7834\u68c4\u3055\u308c\u3066\u3044\u307e\u3059\u3002\r
+classLoaderUnloadFail=\u30af\u30e9\u30b9\u30ed\u30fc\u30c0\u30fc\u306e\u7834\u68c4\u306b\u5931\u6557\u3057\u307e\u3057\u305f\u3002\r
+directoryCreateFail=\u30c7\u30a3\u30ec\u30af\u30c8\u30ea"{0}"\u306e\u4f5c\u6210\u306b\u5931\u6557\u3057\u307e\u3057\u305f\u3002\r
+directoryDeleteFail=\u30c7\u30a3\u30ec\u30af\u30c8\u30ea"{0}"\u306e\u524a\u9664\u306b\u5931\u6557\u3057\u307e\u3057\u305f\u3002\r
+fileCreateFail=\u30d5\u30a1\u30a4\u30eb"{0}"\u306e\u4f5c\u6210\u306b\u5931\u6557\u3057\u307e\u3057\u305f\u3002\r
+fileDeleteFail=\u30d5\u30a1\u30a4\u30eb"{0}"\u306e\u524a\u9664\u306b\u5931\u6557\u3057\u307e\u3057\u305f\u3002\r
+fileMonitorFail=\u30d5\u30a1\u30a4\u30eb\u306e\u76e3\u8996\u306b\u5931\u6557\u3057\u307e\u3057\u305f\u3002\r
+argumentIsNull="{0}"\u304cnull\u3067\u3059\u3002\r
+argumentIsNotDirectory="{0}"\u304c\u30c7\u30a3\u30ec\u30af\u30c8\u30ea\u3067\u306f\u3042\u308a\u307e\u305b\u3093\u3002\r
--- /dev/null
+classLoaderUnloaded=The class loader has already been unloaded.\r
+classLoaderUnloadFail=It failed in unloading the class loader.\r
+directoryCreateFail=It failed in making directory "{0}".\r
+directoryDeleteFail=It failed in the deletion of the directory "{0}".\r
+fileCreateFail=It failed in making the file "{0}".\r
+fileDeleteFail=It failed in the deletion of the file "{0}".\r
+fileMonitorFail=It failed in the watch of the file.\r
+argumentIsNull="{0}" is null.\r
+argumentIsNotDirectory="{0}" is not directory.\r
--- /dev/null
+classLoaderUnloaded=\u30af\u30e9\u30b9\u30ed\u30fc\u30c0\u30fc\u306f\u65e2\u306b\u7834\u68c4\u3055\u308c\u3066\u3044\u307e\u3059\u3002\r
+classLoaderUnloadFail=\u30af\u30e9\u30b9\u30ed\u30fc\u30c0\u30fc\u306e\u7834\u68c4\u306b\u5931\u6557\u3057\u307e\u3057\u305f\u3002\r
+directoryCreateFail=\u30c7\u30a3\u30ec\u30af\u30c8\u30ea"{0}"\u306e\u4f5c\u6210\u306b\u5931\u6557\u3057\u307e\u3057\u305f\u3002\r
+directoryDeleteFail=\u30c7\u30a3\u30ec\u30af\u30c8\u30ea"{0}"\u306e\u524a\u9664\u306b\u5931\u6557\u3057\u307e\u3057\u305f\u3002\r
+fileCreateFail=\u30d5\u30a1\u30a4\u30eb"{0}"\u306e\u4f5c\u6210\u306b\u5931\u6557\u3057\u307e\u3057\u305f\u3002\r
+fileDeleteFail=\u30d5\u30a1\u30a4\u30eb"{0}"\u306e\u524a\u9664\u306b\u5931\u6557\u3057\u307e\u3057\u305f\u3002\r
+fileMonitorFail=\u30d5\u30a1\u30a4\u30eb\u306e\u76e3\u8996\u306b\u5931\u6557\u3057\u307e\u3057\u305f\u3002\r
+argumentIsNull="{0}"\u304cnull\u3067\u3059\u3002\r
+argumentIsNotDirectory="{0}"\u304c\u30c7\u30a3\u30ec\u30af\u30c8\u30ea\u3067\u306f\u3042\u308a\u307e\u305b\u3093\u3002\r