[Jiemamy-notify:1943] commit [3104] ・例外クラスの移動

Back to archive index

svnno****@sourc***** svnno****@sourc*****
2009年 4月 4日 (土) 23:17:06 JST


Revision: 3104
          http://svn.sourceforge.jp/view?root=jiemamy&view=rev&rev=3104
Author:   j5ik2o
Date:     2009-04-04 23:17:06 +0900 (Sat, 04 Apr 2009)

Log Message:
-----------
・例外クラスの移動
・例外クラスの追加

Modified Paths:
--------------
    charon/jiemamy-jpa-importer/trunk/src/main/java/org/jiemamy/composer/importer/utils/ClassTraversal.java
    charon/jiemamy-jpa-importer/trunk/src/main/java/org/jiemamy/composer/importer/utils/ResourceTraversal.java
    charon/jiemamy-jpa-importer/trunk/src/main/java/org/jiemamy/composer/importer/utils/ResourceUtil.java
    charon/jiemamy-jpa-importer/trunk/src/main/java/org/jiemamy/composer/importer/utils/ResourcesUtil.java

Added Paths:
-----------
    charon/jiemamy-jpa-importer/trunk/src/main/java/org/jiemamy/composer/importer/utils/PropertyNotFoundException.java
    charon/jiemamy-jpa-importer/trunk/src/main/java/org/jiemamy/composer/importer/utils/ResourceNotFoundException.java
    charon/jiemamy-jpa-importer/trunk/src/main/java/org/jiemamy/composer/importer/utils/TraversalHandlerException.java

Removed Paths:
-------------
    charon/jiemamy-jpa-importer/trunk/src/main/java/org/jiemamy/composer/importer/exception/PropertyNotFoundException.java
    charon/jiemamy-jpa-importer/trunk/src/main/java/org/jiemamy/composer/importer/exception/ResourceNotFoundException.java


-------------- next part --------------
Deleted: charon/jiemamy-jpa-importer/trunk/src/main/java/org/jiemamy/composer/importer/exception/PropertyNotFoundException.java
===================================================================
--- charon/jiemamy-jpa-importer/trunk/src/main/java/org/jiemamy/composer/importer/exception/PropertyNotFoundException.java	2009-04-04 13:26:10 UTC (rev 3103)
+++ charon/jiemamy-jpa-importer/trunk/src/main/java/org/jiemamy/composer/importer/exception/PropertyNotFoundException.java	2009-04-04 14:17:06 UTC (rev 3104)
@@ -1,74 +0,0 @@
-/*
- * Copyright 2007-2009 Jiemamy Project and the Others.
- *
- * This file is part of Jiemamy.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
- * either express or implied. See the License for the specific language
- * governing permissions and limitations under the License.
- */
-package org.jiemamy.composer.importer.exception;
-
-/**
- * プロパティが見つからない場合の例外。
- * 
- * @author j5ik2o
- */
- @ SuppressWarnings("serial")
-public class PropertyNotFoundException extends Exception {
-	
-	private String entityName;
-	
-	private String propertyName;
-	
-
-	/**
-	 * インスタンスを生成する。
-	 * 
-	 * @param entityName エンティティ名
-	 * @param propertyName プロパティ名
-	 */
-	public PropertyNotFoundException(String entityName, String propertyName) {
-		this(entityName, propertyName, null);
-	}
-	
-	/**
-	 * インスタンスを生成する。
-	 * 
-	 * @param entityName エンティティ名 
-	 * @param propertyName プロパティ名
-	 * @param cause 原因となった例外
-	 */
-	public PropertyNotFoundException(String entityName, String propertyName, Throwable cause) {
-		super(String.format("%s.%s is not found.", entityName, propertyName), cause);
-		this.entityName = entityName;
-		this.propertyName = propertyName;
-	}
-	
-	/**
-	 * エンティティ名を取得する。
-	 * 
-	 * @return エンティティ名
-	 */
-	public String getEntityName() {
-		return entityName;
-	}
-	
-	/**
-	 * プロパティ名を取得する。
-	 * 
-	 * @return プロパティ名
-	 */
-	public String getPropertyName() {
-		return propertyName;
-	}
-	
-}

Deleted: charon/jiemamy-jpa-importer/trunk/src/main/java/org/jiemamy/composer/importer/exception/ResourceNotFoundException.java
===================================================================
--- charon/jiemamy-jpa-importer/trunk/src/main/java/org/jiemamy/composer/importer/exception/ResourceNotFoundException.java	2009-04-04 13:26:10 UTC (rev 3103)
+++ charon/jiemamy-jpa-importer/trunk/src/main/java/org/jiemamy/composer/importer/exception/ResourceNotFoundException.java	2009-04-04 14:17:06 UTC (rev 3104)
@@ -1,49 +0,0 @@
-/*
- * Copyright 2007-2009 Jiemamy Project and the Others.
- *
- * This file is part of Jiemamy.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
- * either express or implied. See the License for the specific language
- * governing permissions and limitations under the License.
- */
-package org.jiemamy.composer.importer.exception;
-
-/**
- * リソースが見つからなかったときにスローされる例外。
- * 
- * @author j5ik2o
- */
- @ SuppressWarnings("serial")
-public class ResourceNotFoundException extends Exception {
-	
-	private String path;
-	
-
-	/**
-	 * {@link ResourceNotFoundException}を作成する。
-	 * 
-	 * @param path パス
-	 */
-	public ResourceNotFoundException(String path) {
-		super(path);
-		this.path = path;
-	}
-	
-	/**
-	 * パスを返します。
-	 * 
-	 * @return パス
-	 */
-	public String getPath() {
-		return path;
-	}
-}

Modified: charon/jiemamy-jpa-importer/trunk/src/main/java/org/jiemamy/composer/importer/utils/ClassTraversal.java
===================================================================
--- charon/jiemamy-jpa-importer/trunk/src/main/java/org/jiemamy/composer/importer/utils/ClassTraversal.java	2009-04-04 13:26:10 UTC (rev 3103)
+++ charon/jiemamy-jpa-importer/trunk/src/main/java/org/jiemamy/composer/importer/utils/ClassTraversal.java	2009-04-04 14:17:06 UTC (rev 3104)
@@ -40,9 +40,9 @@
 		 * 
 		 * @param packageName パッケージ名
 		 * @param shortClassName クラス名
-		 * @throws ClassNotFoundException 
+		 * @throws TraversalHandlerException ハンドラの処理が失敗した場合
 		 */
-		void processClass(String packageName, String shortClassName);
+		void processClass(String packageName, String shortClassName) throws TraversalHandlerException;
 	}
 	
 
@@ -58,8 +58,9 @@
 	 * 
 	 * @param rootDir ルートディレクトリ
 	 * @param handler ハンドラ
+	 * @throws TraversalHandlerException ハンドラの処理が失敗した場合
 	 */
-	public static void forEach(final File rootDir, final ClassHandler handler) {
+	public static void forEach(final File rootDir, final ClassHandler handler) throws TraversalHandlerException {
 		forEach(rootDir, null, handler);
 	}
 	
@@ -69,8 +70,10 @@
 	 * @param rootDir ルートディレクトリ
 	 * @param rootPackage ルートパッケージ
 	 * @param handler ハンドラ
+	 * @throws TraversalHandlerException ハンドラの処理が失敗した場合
 	 */
-	public static void forEach(final File rootDir, final String rootPackage, final ClassHandler handler) {
+	public static void forEach(final File rootDir, final String rootPackage, final ClassHandler handler)
+			throws TraversalHandlerException {
 		final File packageDir = getPackageDir(rootDir, rootPackage);
 		if (packageDir.exists()) {
 			traverseFileSystem(packageDir, rootPackage, handler);
@@ -82,8 +85,9 @@
 	 * 
 	 * @param jarFile Jarファイル
 	 * @param handler ハンドラ
+	 * @throws TraversalHandlerException ハンドラの処理が失敗した場合
 	 */
-	public static void forEach(final JarFile jarFile, final ClassHandler handler) {
+	public static void forEach(final JarFile jarFile, final ClassHandler handler) throws TraversalHandlerException {
 		final boolean hasWarExtension = jarFile.getName().endsWith(WAR_FILE_EXTENSION);
 		final Enumeration<JarEntry> enumeration = jarFile.entries();
 		while (enumeration.hasMoreElements()) {
@@ -114,7 +118,8 @@
 		return packageDir;
 	}
 	
-	private static void traverseFileSystem(final File dir, final String packageName, final ClassHandler handler) {
+	private static void traverseFileSystem(final File dir, final String packageName, final ClassHandler handler)
+			throws TraversalHandlerException {
 		final File[] files = dir.listFiles();
 		for (int i = 0; i < files.length; ++i) {
 			final File file = files[i];

Copied: charon/jiemamy-jpa-importer/trunk/src/main/java/org/jiemamy/composer/importer/utils/PropertyNotFoundException.java (from rev 3093, charon/jiemamy-jpa-importer/trunk/src/main/java/org/jiemamy/composer/importer/exception/PropertyNotFoundException.java)
===================================================================
--- charon/jiemamy-jpa-importer/trunk/src/main/java/org/jiemamy/composer/importer/utils/PropertyNotFoundException.java	                        (rev 0)
+++ charon/jiemamy-jpa-importer/trunk/src/main/java/org/jiemamy/composer/importer/utils/PropertyNotFoundException.java	2009-04-04 14:17:06 UTC (rev 3104)
@@ -0,0 +1,74 @@
+/*
+ * Copyright 2007-2009 Jiemamy Project and the Others.
+ *
+ * This file is part of Jiemamy.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
+ * either express or implied. See the License for the specific language
+ * governing permissions and limitations under the License.
+ */
+package org.jiemamy.composer.importer.utils;
+
+/**
+ * プロパティが見つからない場合の例外。
+ * 
+ * @author j5ik2o
+ */
+ @ SuppressWarnings("serial")
+public class PropertyNotFoundException extends Exception {
+	
+	private String entityName;
+	
+	private String propertyName;
+	
+
+	/**
+	 * インスタンスを生成する。
+	 * 
+	 * @param entityName エンティティ名
+	 * @param propertyName プロパティ名
+	 */
+	public PropertyNotFoundException(String entityName, String propertyName) {
+		this(entityName, propertyName, null);
+	}
+	
+	/**
+	 * インスタンスを生成する。
+	 * 
+	 * @param entityName エンティティ名 
+	 * @param propertyName プロパティ名
+	 * @param cause 原因となった例外
+	 */
+	public PropertyNotFoundException(String entityName, String propertyName, Throwable cause) {
+		super(String.format("%s.%s is not found.", entityName, propertyName), cause);
+		this.entityName = entityName;
+		this.propertyName = propertyName;
+	}
+	
+	/**
+	 * エンティティ名を取得する。
+	 * 
+	 * @return エンティティ名
+	 */
+	public String getEntityName() {
+		return entityName;
+	}
+	
+	/**
+	 * プロパティ名を取得する。
+	 * 
+	 * @return プロパティ名
+	 */
+	public String getPropertyName() {
+		return propertyName;
+	}
+	
+}


Property changes on: charon/jiemamy-jpa-importer/trunk/src/main/java/org/jiemamy/composer/importer/utils/PropertyNotFoundException.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Copied: charon/jiemamy-jpa-importer/trunk/src/main/java/org/jiemamy/composer/importer/utils/ResourceNotFoundException.java (from rev 3093, charon/jiemamy-jpa-importer/trunk/src/main/java/org/jiemamy/composer/importer/exception/ResourceNotFoundException.java)
===================================================================
--- charon/jiemamy-jpa-importer/trunk/src/main/java/org/jiemamy/composer/importer/utils/ResourceNotFoundException.java	                        (rev 0)
+++ charon/jiemamy-jpa-importer/trunk/src/main/java/org/jiemamy/composer/importer/utils/ResourceNotFoundException.java	2009-04-04 14:17:06 UTC (rev 3104)
@@ -0,0 +1,49 @@
+/*
+ * Copyright 2007-2009 Jiemamy Project and the Others.
+ *
+ * This file is part of Jiemamy.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
+ * either express or implied. See the License for the specific language
+ * governing permissions and limitations under the License.
+ */
+package org.jiemamy.composer.importer.utils;
+
+/**
+ * リソースが見つからなかったときにスローされる例外。
+ * 
+ * @author j5ik2o
+ */
+ @ SuppressWarnings("serial")
+public class ResourceNotFoundException extends Exception {
+	
+	private String path;
+	
+
+	/**
+	 * {@link ResourceNotFoundException}を作成する。
+	 * 
+	 * @param path パス
+	 */
+	public ResourceNotFoundException(String path) {
+		super(path);
+		this.path = path;
+	}
+	
+	/**
+	 * パスを返します。
+	 * 
+	 * @return パス
+	 */
+	public String getPath() {
+		return path;
+	}
+}


Property changes on: charon/jiemamy-jpa-importer/trunk/src/main/java/org/jiemamy/composer/importer/utils/ResourceNotFoundException.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Modified: charon/jiemamy-jpa-importer/trunk/src/main/java/org/jiemamy/composer/importer/utils/ResourceTraversal.java
===================================================================
--- charon/jiemamy-jpa-importer/trunk/src/main/java/org/jiemamy/composer/importer/utils/ResourceTraversal.java	2009-04-04 13:26:10 UTC (rev 3103)
+++ charon/jiemamy-jpa-importer/trunk/src/main/java/org/jiemamy/composer/importer/utils/ResourceTraversal.java	2009-04-04 14:17:06 UTC (rev 3104)
@@ -43,7 +43,7 @@
 		 * @param path パス
 		 * @param is {@link InputStream}
 		 */
-		void processResource(String path, InputStream is);
+		void processResource(String path, InputStream is) throws TraversalHandlerException;
 	}
 	
 
@@ -52,9 +52,11 @@
 	 * 
 	 * @param rootDir ルートディレクトリ
 	 * @param handler ハンドラ
-	 * @throws IOException forEachが失敗した場合
+	 * @throws IOException 入出力が失敗した場合
+	 * @throws TraversalHandlerException ハンドラの処理が失敗した場合 
 	 */
-	public static void forEach(final File rootDir, final ResourceHandler handler) throws IOException {
+	public static void forEach(final File rootDir, final ResourceHandler handler) throws IOException,
+			TraversalHandlerException {
 		forEach(rootDir, null, handler);
 	}
 	
@@ -64,10 +66,11 @@
 	 * @param rootDir ルートディレクトリ
 	 * @param baseDirectory ベースディレクトリ
 	 * @param handler ハンドラ
-	 * @throws IOException traverseFileSystemが失敗した場合
+	 * @throws IOException 入出力が失敗した場合
+	 * @throws TraversalHandlerException ハンドラの処理が失敗した場合 
 	 */
 	public static void forEach(final File rootDir, final String baseDirectory, final ResourceHandler handler)
-			throws IOException {
+			throws IOException, TraversalHandlerException {
 		final File baseDir = getBaseDir(rootDir, baseDirectory);
 		if (baseDir.exists()) {
 			traverseFileSystem(rootDir, baseDir, handler);
@@ -79,9 +82,11 @@
 	 * 
 	 * @param jarFile JarFile
 	 * @param handler ハンドラ
-	 * @throws IOException InputStreamUtil#closeに失敗した場合
+	 * @throws IOException 入出力が失敗した場合
+	 * @throws TraversalHandlerException ハンドラの処理が失敗した場合 
 	 */
-	public static void forEach(final JarFile jarFile, final ResourceHandler handler) throws IOException {
+	public static void forEach(final JarFile jarFile, final ResourceHandler handler) throws IOException,
+			TraversalHandlerException {
 		final Enumeration<JarEntry> enumeration = jarFile.entries();
 		while (enumeration.hasMoreElements()) {
 			final JarEntry entry = enumeration.nextElement();
@@ -109,7 +114,7 @@
 	}
 	
 	private static void traverseFileSystem(final File rootDir, final File baseDir, final ResourceHandler handler)
-			throws IOException {
+			throws IOException, TraversalHandlerException {
 		final File[] files = baseDir.listFiles();
 		for (int i = 0; i < files.length; ++i) {
 			final File file = files[i];

Modified: charon/jiemamy-jpa-importer/trunk/src/main/java/org/jiemamy/composer/importer/utils/ResourceUtil.java
===================================================================
--- charon/jiemamy-jpa-importer/trunk/src/main/java/org/jiemamy/composer/importer/utils/ResourceUtil.java	2009-04-04 13:26:10 UTC (rev 3103)
+++ charon/jiemamy-jpa-importer/trunk/src/main/java/org/jiemamy/composer/importer/utils/ResourceUtil.java	2009-04-04 14:17:06 UTC (rev 3104)
@@ -24,7 +24,6 @@
 import java.net.URL;
 import java.util.Properties;
 
-import org.jiemamy.composer.importer.exception.ResourceNotFoundException;
 
 /**
  * リソース用のユーティリティクラス。

Modified: charon/jiemamy-jpa-importer/trunk/src/main/java/org/jiemamy/composer/importer/utils/ResourcesUtil.java
===================================================================
--- charon/jiemamy-jpa-importer/trunk/src/main/java/org/jiemamy/composer/importer/utils/ResourcesUtil.java	2009-04-04 13:26:10 UTC (rev 3103)
+++ charon/jiemamy-jpa-importer/trunk/src/main/java/org/jiemamy/composer/importer/utils/ResourcesUtil.java	2009-04-04 14:17:06 UTC (rev 3104)
@@ -31,7 +31,6 @@
 
 import org.apache.commons.lang.StringUtils;
 
-import org.jiemamy.composer.importer.exception.ResourceNotFoundException;
 import org.jiemamy.composer.importer.utils.ClassTraversal.ClassHandler;
 import org.jiemamy.composer.importer.utils.ResourceTraversal.ResourceHandler;
 
@@ -88,11 +87,11 @@
 		public void close() {
 		}
 		
-		public void forEach(final ClassHandler handler) {
+		public void forEach(final ClassHandler handler) throws TraversalHandlerException {
 			ClassTraversal.forEach(baseDir, rootPackage, handler);
 		}
 		
-		public void forEach(final ResourceHandler handler) throws IOException {
+		public void forEach(final ResourceHandler handler) throws IOException, TraversalHandlerException {
 			ResourceTraversal.forEach(baseDir, rootDir, handler);
 		}
 		
@@ -149,10 +148,10 @@
 			JarFileUtil.close(jarFile);
 		}
 		
-		public void forEach(final ClassHandler handler) {
+		public void forEach(final ClassHandler handler) throws TraversalHandlerException {
 			ClassTraversal.forEach(jarFile, new ClassHandler() {
 				
-				public void processClass(String packageName, String shortClassName) {
+				public void processClass(String packageName, String shortClassName) throws TraversalHandlerException {
 					if (rootPackage == null || (packageName != null && packageName.startsWith(rootPackage))) {
 						handler.processClass(packageName, shortClassName);
 					}
@@ -160,10 +159,10 @@
 			});
 		}
 		
-		public void forEach(final ResourceHandler handler) throws IOException {
+		public void forEach(final ResourceHandler handler) throws IOException, TraversalHandlerException {
 			ResourceTraversal.forEach(jarFile, new ResourceHandler() {
 				
-				public void processResource(String path, InputStream is) {
+				public void processResource(String path, InputStream is) throws TraversalHandlerException {
 					if (rootDir == null || path.startsWith(rootDir)) {
 						handler.processResource(path, is);
 					}
@@ -198,8 +197,9 @@
 		 * </p>
 		 * 
 		 * @param handler ハンドラ
+		 * @throws TraversalHandlerException ハンドラの処理が失敗した場合
 		 */
-		void forEach(ClassHandler handler);
+		void forEach(ClassHandler handler) throws TraversalHandlerException;
 		
 		/**
 		 * このインスタンスが扱うリソースを探して
@@ -211,8 +211,9 @@
 		 * 
 		 * @param handler ハンドラ
 		 * @throws IOException 入出力が失敗した場合
+		 * @throws TraversalHandlerException ハンドラの処理が失敗した場合
 		 */
-		void forEach(ResourceHandler handler) throws IOException;
+		void forEach(ResourceHandler handler) throws IOException, TraversalHandlerException;
 		
 		/**
 		 * 指定されたクラス名に対応するクラスファイルがこのインスタンスが扱うリソースの中に存在すれば<code>true</code>を取得する。

Added: charon/jiemamy-jpa-importer/trunk/src/main/java/org/jiemamy/composer/importer/utils/TraversalHandlerException.java
===================================================================
--- charon/jiemamy-jpa-importer/trunk/src/main/java/org/jiemamy/composer/importer/utils/TraversalHandlerException.java	                        (rev 0)
+++ charon/jiemamy-jpa-importer/trunk/src/main/java/org/jiemamy/composer/importer/utils/TraversalHandlerException.java	2009-04-04 14:17:06 UTC (rev 3104)
@@ -0,0 +1,68 @@
+/*
+ * Copyright 2007-2009 Jiemamy Project and the Others.
+ * Created on Apr 4, 2009
+ *
+ * This file is part of Jiemamy.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
+ * either express or implied. See the License for the specific language
+ * governing permissions and limitations under the License.
+ */
+package org.jiemamy.composer.importer.utils;
+
+
+/**
+ * TODO for junichi
+ * 
+ * @author junichi
+ */
+public class TraversalHandlerException extends Exception {
+	
+	/**
+	 * インスタンスを生成する。
+	 * 
+	 */
+	public TraversalHandlerException() {
+		// TODO Auto-generated constructor stub
+	}
+	
+	/**
+	 * インスタンスを生成する。
+	 * 
+	 * @param message
+	 */
+	public TraversalHandlerException(String message) {
+		super(message);
+		// TODO Auto-generated constructor stub
+	}
+	
+	/**
+	 * インスタンスを生成する。
+	 * 
+	 * @param cause
+	 */
+	public TraversalHandlerException(Throwable cause) {
+		super(cause);
+		// TODO Auto-generated constructor stub
+	}
+	
+	/**
+	 * インスタンスを生成する。
+	 * 
+	 * @param message
+	 * @param cause
+	 */
+	public TraversalHandlerException(String message, Throwable cause) {
+		super(message, cause);
+		// TODO Auto-generated constructor stub
+	}
+	
+}


Property changes on: charon/jiemamy-jpa-importer/trunk/src/main/java/org/jiemamy/composer/importer/utils/TraversalHandlerException.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain



Jiemamy-notify メーリングリストの案内
Back to archive index