[Jiemamy-notify:2185] commit [3249] クラスを追加しました。

Back to archive index

svnno****@sourc***** svnno****@sourc*****
2009年 4月 13日 (月) 18:50:11 JST


Revision: 3249
          http://svn.sourceforge.jp/view?root=jiemamy&view=rev&rev=3249
Author:   j5ik2o
Date:     2009-04-13 18:50:11 +0900 (Mon, 13 Apr 2009)

Log Message:
-----------
クラスを追加しました。

Modified Paths:
--------------
    leto/jiemamy-entity-io/trunk/pom.xml
    leto/jiemamy-entity-io/trunk/src/main/java/org/jiemamy/entity/io/generator/Generator.java
    leto/jiemamy-entity-io/trunk/src/main/java/org/jiemamy/entity/io/meta/impl/EntityMetaWriterImpl.java

Added Paths:
-----------
    leto/jiemamy-entity-io/trunk/src/main/java/org/jiemamy/entity/io/desc/
    leto/jiemamy-entity-io/trunk/src/main/java/org/jiemamy/entity/io/desc/AssociationDesc.java
    leto/jiemamy-entity-io/trunk/src/main/java/org/jiemamy/entity/io/desc/AssociationType.java
    leto/jiemamy-entity-io/trunk/src/main/java/org/jiemamy/entity/io/desc/AttributeDesc.java
    leto/jiemamy-entity-io/trunk/src/main/java/org/jiemamy/entity/io/desc/AttributeDescFactory.java
    leto/jiemamy-entity-io/trunk/src/main/java/org/jiemamy/entity/io/desc/CompositeUniqueConstraintDesc.java
    leto/jiemamy-entity-io/trunk/src/main/java/org/jiemamy/entity/io/desc/CompositeUniqueConstraintDescFactory.java
    leto/jiemamy-entity-io/trunk/src/main/java/org/jiemamy/entity/io/desc/EntityDesc.java
    leto/jiemamy-entity-io/trunk/src/main/java/org/jiemamy/entity/io/desc/EntityDescFactory.java
    leto/jiemamy-entity-io/trunk/src/main/java/org/jiemamy/entity/io/desc/EntitySetDesc.java
    leto/jiemamy-entity-io/trunk/src/main/java/org/jiemamy/entity/io/desc/EntitySetDescFactory.java
    leto/jiemamy-entity-io/trunk/src/main/java/org/jiemamy/entity/io/desc/impl/
    leto/jiemamy-entity-io/trunk/src/main/java/org/jiemamy/entity/io/desc/impl/AssociationResolver.java
    leto/jiemamy-entity-io/trunk/src/main/java/org/jiemamy/entity/io/desc/impl/AttributeDescFactoryImpl.java
    leto/jiemamy-entity-io/trunk/src/main/java/org/jiemamy/entity/io/desc/impl/CompositeUniqueConstraintDescFactoryImpl.java
    leto/jiemamy-entity-io/trunk/src/main/java/org/jiemamy/entity/io/desc/impl/EntityDescFactoryImpl.java
    leto/jiemamy-entity-io/trunk/src/main/java/org/jiemamy/entity/io/desc/impl/EntitySetDescFactoryImpl.java
    leto/jiemamy-entity-io/trunk/src/main/java/org/jiemamy/entity/io/desc/impl/PluralFormDictinary.java
    leto/jiemamy-entity-io/trunk/src/main/java/org/jiemamy/entity/io/generator/DeleteEmptyFileWriter.java
    leto/jiemamy-entity-io/trunk/src/main/java/org/jiemamy/entity/io/generator/EntitySrcFileGenerator.java
    leto/jiemamy-entity-io/trunk/src/main/java/org/jiemamy/entity/io/generator/GenerateException.java
    leto/jiemamy-entity-io/trunk/src/main/java/org/jiemamy/entity/io/generator/GeneratorContextImpl.java
    leto/jiemamy-entity-io/trunk/src/main/java/org/jiemamy/entity/io/generator/IncludeDirective.java
    leto/jiemamy-entity-io/trunk/src/main/java/org/jiemamy/entity/io/generator/OnDemandDateModel.java
    leto/jiemamy-entity-io/trunk/src/main/java/org/jiemamy/entity/io/generator/ResourceTemplateLoader.java
    leto/jiemamy-entity-io/trunk/src/main/java/org/jiemamy/entity/io/meta/DbColumnMeta.java
    leto/jiemamy-entity-io/trunk/src/main/java/org/jiemamy/entity/io/meta/DbForeignKeyMeta.java
    leto/jiemamy-entity-io/trunk/src/main/java/org/jiemamy/entity/io/meta/DbTableMeta.java
    leto/jiemamy-entity-io/trunk/src/main/java/org/jiemamy/entity/io/meta/DbTableMetaReader.java
    leto/jiemamy-entity-io/trunk/src/main/java/org/jiemamy/entity/io/meta/DbUniqueKeyMeta.java
    leto/jiemamy-entity-io/trunk/src/main/java/org/jiemamy/entity/io/utils/
    leto/jiemamy-entity-io/trunk/src/main/java/org/jiemamy/entity/io/utils/AnnotationUtil.java
    leto/jiemamy-entity-io/trunk/src/main/java/org/jiemamy/entity/io/utils/CaseInsensitiveMap.java
    leto/jiemamy-entity-io/trunk/src/main/java/org/jiemamy/entity/io/utils/CaseInsensitiveSet.java
    leto/jiemamy-entity-io/trunk/src/main/java/org/jiemamy/entity/io/utils/ReferentialActionType.java
    leto/jiemamy-entity-io/trunk/src/main/java/org/jiemamy/entity/io/utils/ReferentialConstraint.java

Removed Paths:
-------------
    leto/jiemamy-entity-io/trunk/src/main/java/org/jiemamy/entity/io/meta/Generator.java
    leto/jiemamy-entity-io/trunk/src/main/java/org/jiemamy/entity/io/meta/GeneratorContext.java
    leto/jiemamy-entity-io/trunk/src/main/java/org/jiemamy/entity/io/meta/impl/EntityGenerator.java
    leto/jiemamy-entity-io/trunk/src/main/java/org/jiemamy/entity/io/meta/impl/GeneratorContextImpl.java


-------------- next part --------------
Modified: leto/jiemamy-entity-io/trunk/pom.xml
===================================================================
--- leto/jiemamy-entity-io/trunk/pom.xml	2009-04-13 09:46:41 UTC (rev 3248)
+++ leto/jiemamy-entity-io/trunk/pom.xml	2009-04-13 09:50:11 UTC (rev 3249)
@@ -165,6 +165,11 @@
 			<artifactId>jiemamy-commons</artifactId>
 			<version>0.0.1-SNAPSHOT</version>
 		</dependency>
+		<dependency>
+			<groupId>org.freemarker</groupId>
+			<artifactId>freemarker</artifactId>
+			<version>2.3.13</version>
+		</dependency>
 	</dependencies>
 	<reporting>
 		<plugins>

Added: leto/jiemamy-entity-io/trunk/src/main/java/org/jiemamy/entity/io/desc/AssociationDesc.java
===================================================================
--- leto/jiemamy-entity-io/trunk/src/main/java/org/jiemamy/entity/io/desc/AssociationDesc.java	                        (rev 0)
+++ leto/jiemamy-entity-io/trunk/src/main/java/org/jiemamy/entity/io/desc/AssociationDesc.java	2009-04-13 09:50:11 UTC (rev 3249)
@@ -0,0 +1,222 @@
+/*
+ * Copyright 2007-2009 Jiemamy Project and the Others.
+ * Created on Apr 7, 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.entity.io.desc;
+
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+
+/**
+ * 関連記述インターフェイス。
+ * 
+ * @author j5ik2o
+ */
+public class AssociationDesc {
+	
+	/** 名前 */
+	protected String name;
+	
+	/** 関連先のエンティティ記述 */
+	protected EntityDesc referencedEntityDesc;
+	
+	/** 関連タイプ */
+	protected AssociationType associationType;
+	
+	/** 関連の所有者側のプロパティの名前 */
+	protected String mappedBy;
+	
+	/** カラム名のリスト */
+	protected List<String> columnNameList = new ArrayList<String>();
+	
+	/** 参照されるテーブルのカタログ名 */
+	protected String referencedCatalogName;
+	
+	/** 参照されるテーブルのスキーマ名 */
+	protected String referencedSchemaName;
+	
+	/** 参照されるテーブル名 */
+	protected String referencedTableName;
+	
+	/** 参照されるカラム名のリスト */
+	protected List<String> referencedColumnNameList = new ArrayList<String>();
+	
+
+	/**
+	 * カラム名を追加する。
+	 * 
+	 * @param columnName カラム名
+	 */
+	public void addColumnName(String columnName) {
+		columnNameList.add(columnName);
+	}
+	
+	/**
+	 * 参照されるカラム名を追加する。
+	 * 
+	 * @param referencedColumnName 参照されるカラム名
+	 */
+	public void addReferencedColumnName(String referencedColumnName) {
+		referencedColumnNameList.add(referencedColumnName);
+	}
+	
+	/**
+	 * 関連タイプを取得する。
+	 * 
+	 * @return 関連タイプ
+	 */
+	public AssociationType getAssociationType() {
+		return associationType;
+	}
+	
+	/**
+	 * カラム名のリストを取得する。
+	 * 
+	 * @return カラム名のリスト
+	 */
+	public List<String> getColumnNameList() {
+		return Collections.unmodifiableList(columnNameList);
+	}
+	
+	/**
+	 * 関連の所有者側のプロパティの名前を取得する。
+	 * 
+	 * @return 関連の所有者側のプロパティの名前
+	 */
+	public String getMappedBy() {
+		return mappedBy;
+	}
+	
+	/**
+	 * 名前を取得する。
+	 * 
+	 * @return 名前
+	 */
+	public String getName() {
+		return name;
+	}
+	
+	/**
+	 * 参照されるテーブルのカタログ名を取得する。
+	 * 
+	 * @return 参照されるテーブルのカタログ名
+	 */
+	public String getReferencedCatalogName() {
+		return referencedCatalogName;
+	}
+	
+	/**
+	 * 参照されるカラム名のリストを取得する。
+	 * 
+	 * @return 参照されるカラム名のリスト
+	 */
+	public List<String> getReferencedColumnNameList() {
+		return Collections.unmodifiableList(referencedColumnNameList);
+	}
+	
+	/**
+	 * 関連先のエンティティ記述を取得する。
+	 * 
+	 * @return 関連先のエンティティ記述
+	 */
+	public EntityDesc getReferencedEntityDesc() {
+		return referencedEntityDesc;
+	}
+	
+	/**
+	 * 参照されるテーブルのスキーマ名を取得する。
+	 * 
+	 * @return 参照されるテーブルのスキーマ名
+	 */
+	public String getReferencedSchemaName() {
+		return referencedSchemaName;
+	}
+	
+	/**
+	 * 参照されるテーブル名を取得する。
+	 * 
+	 * @return 参照されるテーブル名
+	 */
+	public String getReferencedTableName() {
+		return referencedTableName;
+	}
+	
+	/**
+	 * 関連タイプを設定する。
+	 * 
+	 * @param associationType 関連タイプ
+	 */
+	public void setAssociationType(AssociationType associationType) {
+		this.associationType = associationType;
+	}
+	
+	/**
+	 * 関連の所有者側のプロパティの名前を設定する。
+	 * 
+	 * @param mappedBy 関連の所有者側のプロパティの名前
+	 */
+	public void setMappedBy(String mappedBy) {
+		this.mappedBy = mappedBy;
+	}
+	
+	/**
+	 * 名前を設定する。
+	 * 
+	 * @param name 名前
+	 */
+	public void setName(String name) {
+		this.name = name;
+	}
+	
+	/**
+	 * 参照されるテーブルのカタログ名を設定する。
+	 * 
+	 * @param referencedCatalogName 参照されるテーブルのカタログ名
+	 */
+	public void setReferencedCatalogName(String referencedCatalogName) {
+		this.referencedCatalogName = referencedCatalogName;
+	}
+	
+	/**
+	 * 関連先のエンティティ記述を設定する。
+	 * 
+	 * @param relationshipEntityDesc 関連先のエンティティ記述
+	 */
+	public void setReferencedEntityDesc(EntityDesc relationshipEntityDesc) {
+		referencedEntityDesc = relationshipEntityDesc;
+	}
+	
+	/**
+	 * 参照されるテーブルのスキーマ名を設定する。
+	 * 
+	 * @param referencedSchemaName 参照されるテーブルのスキーマ名
+	 */
+	public void setReferencedSchemaName(String referencedSchemaName) {
+		this.referencedSchemaName = referencedSchemaName;
+	}
+	
+	/**
+	 * 参照されるテーブル名を設定する。
+	 * 
+	 * @param referencedTableName 参照されるテーブル名
+	 */
+	public void setReferencedTableName(String referencedTableName) {
+		this.referencedTableName = referencedTableName;
+	}
+	
+}


Property changes on: leto/jiemamy-entity-io/trunk/src/main/java/org/jiemamy/entity/io/desc/AssociationDesc.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Added: leto/jiemamy-entity-io/trunk/src/main/java/org/jiemamy/entity/io/desc/AssociationType.java
===================================================================
--- leto/jiemamy-entity-io/trunk/src/main/java/org/jiemamy/entity/io/desc/AssociationType.java	                        (rev 0)
+++ leto/jiemamy-entity-io/trunk/src/main/java/org/jiemamy/entity/io/desc/AssociationType.java	2009-04-13 09:50:11 UTC (rev 3249)
@@ -0,0 +1,71 @@
+/*
+ * Copyright 2007-2009 Jiemamy Project and the Others.
+ * Created on Apr 7, 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.entity.io.desc;
+
+import java.lang.annotation.Annotation;
+
+import javax.persistence.ManyToOne;
+import javax.persistence.OneToMany;
+import javax.persistence.OneToOne;
+
+/**
+ * 関連タイプ。
+ * 
+ * @author j5ik2o
+ */
+public enum AssociationType {
+	
+	/**
+	 * 多対一です。
+	 */
+	MANY_TO_ONE {
+		
+		@Override
+		public Class<? extends Annotation> getAnnotation() {
+			return ManyToOne.class;
+		}
+	},
+	/**
+	 * 一対多です。
+	 */
+	ONE_TO_MANY {
+		
+		@Override
+		public Class<? extends Annotation> getAnnotation() {
+			return OneToMany.class;
+		}
+	},
+	/**
+	 * 一対一です。
+	 */
+	ONE_TO_ONE {
+		
+		@Override
+		public Class<? extends Annotation> getAnnotation() {
+			return OneToOne.class;
+		}
+	};
+	
+	/**
+	 * アノテーションを返します。
+	 * 
+	 * @return アノテーション
+	 */
+	public abstract Class<? extends Annotation> getAnnotation();
+}


Property changes on: leto/jiemamy-entity-io/trunk/src/main/java/org/jiemamy/entity/io/desc/AssociationType.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Added: leto/jiemamy-entity-io/trunk/src/main/java/org/jiemamy/entity/io/desc/AttributeDesc.java
===================================================================
--- leto/jiemamy-entity-io/trunk/src/main/java/org/jiemamy/entity/io/desc/AttributeDesc.java	                        (rev 0)
+++ leto/jiemamy-entity-io/trunk/src/main/java/org/jiemamy/entity/io/desc/AttributeDesc.java	2009-04-13 09:50:11 UTC (rev 3249)
@@ -0,0 +1,464 @@
+/*
+ * Copyright 2007-2009 Jiemamy Project and the Others.
+ * Created on Apr 7, 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.entity.io.desc;
+
+import javax.persistence.GenerationType;
+import javax.persistence.TemporalType;
+
+/**
+ * エンティティの属性記述インターフェイス。
+ * 
+ * @author j5ik2o
+ */
+public class AttributeDesc {
+	
+	/** 名前 */
+	protected String name;
+	
+	/** 属性のクラス */
+	protected Class<?> attributeClass;
+	
+	/** 識別子の場合{@code true} */
+	protected boolean id;
+	
+	/** 識別子の生成方法を示す列挙型、生成しない場合{@code null} */
+	protected GenerationType generationType;
+	
+	/** 識別子の初期値 */
+	protected int initialValue;
+	
+	/** 識別子の割り当てサイズ */
+	protected int allocationSize;
+	
+	/** バージョンの場合{@code true} */
+	protected boolean version;
+	
+	/** 一時的の場合{@code true} */
+	protected boolean trnsient;
+	
+	/** {@code LOB}の場合{@code true} */
+	protected boolean lob;
+	
+	/** カラムの名前 */
+	protected String columnName;
+	
+	/** 長さ */
+	protected int length;
+	
+	/** 精度 */
+	protected int precision;
+	
+	/** スケール */
+	protected int scale;
+	
+	/** NULL可能の場合{@code true} */
+	protected boolean nullable;
+	
+	/** 一意の場合{@code true} */
+	protected boolean unique;
+	
+	/** カラム定義 */
+	protected String columnDefinition;
+	
+	/** カラムの型名 */
+	protected String columnTypeName;
+	
+	/** サポートされていないカラム型の場合{@code true} */
+	protected boolean unsupportedColumnType;
+	
+	/** コメント */
+	protected String comment;
+	
+
+	/**
+	 * インスタンスを生成する。
+	 */
+	public AttributeDesc() {
+	}
+	
+	/**
+	 * 識別子の割り当てサイズを取得する。
+	 * 
+	 * @return 識別子の割り当てサイズ
+	 */
+	public int getAllocationSize() {
+		return allocationSize;
+	}
+	
+	/**
+	 * 属性のクラスを取得する。
+	 * 
+	 * @return 属性のクラス
+	 */
+	public Class<?> getAttributeClass() {
+		return attributeClass;
+	}
+	
+	/**
+	 * カラム定義を取得する。
+	 * 
+	 * @return カラム定義
+	 */
+	public String getColumnDefinition() {
+		return columnDefinition;
+	}
+	
+	/**
+	 * カラムの名前を取得する。
+	 * 
+	 * @return カラムの名前
+	 */
+	public String getColumnName() {
+		return columnName;
+	}
+	
+	/**
+	 * カラムの型名を取得する。
+	 * 
+	 * @return カラムの型名
+	 */
+	public String getColumnTypeName() {
+		return columnTypeName;
+	}
+	
+	/**
+	 * コメントを取得する。
+	 * 
+	 * @return コメント
+	 */
+	public String getComment() {
+		return comment;
+	}
+	
+	/**
+	 * 識別子の生成方法を示す列挙型を取得する。
+	 * 
+	 * @return 識別子の生成方法を示す列挙型、生成しない場合{@code null}
+	 */
+	public GenerationType getGenerationType() {
+		return generationType;
+	}
+	
+	/**
+	 * 識別子の初期値を取得する。
+	 * 
+	 * @return 識別子の初期値
+	 */
+	public int getInitialValue() {
+		return initialValue;
+	}
+	
+	/**
+	 * 長さを取得する。
+	 * 
+	 * @return 長さ
+	 */
+	public int getLength() {
+		return length;
+	}
+	
+	/**
+	 * 名前を取得する。
+	 * 
+	 * @return 名前
+	 */
+	public String getName() {
+		return name;
+	}
+	
+	/**
+	 * 精度を取得する。
+	 * 
+	 * @return 精度
+	 */
+	public int getPrecision() {
+		return precision;
+	}
+	
+	/**
+	 * スケールを取得する。
+	 * 
+	 * @return スケール
+	 */
+	public int getScale() {
+		return scale;
+	}
+	
+	/**
+	 * 時制の種別を取得する。
+	 * 
+	 * @return 時制の種別、対応する種別がない場合{@code null}
+	 */
+	public TemporalType getTemporalType() {
+		if (attributeClass == java.sql.Date.class) {
+			return TemporalType.DATE;
+		}
+		if (attributeClass == java.sql.Time.class) {
+			return TemporalType.TIME;
+		}
+		if (attributeClass == java.sql.Timestamp.class) {
+			return TemporalType.TIMESTAMP;
+		}
+		return null;
+	}
+	
+	/**
+	 * 識別子の場合{@code true}を取得する。
+	 * 
+	 * @return 識別子の場合{@code true}、そうでなければ{@code false}
+	 */
+	public boolean isId() {
+		return id;
+	}
+	
+	/**
+	 * {@code LOB}の場合{@code true}を取得する。
+	 * 
+	 * @return {@code LOB}の場合{@code true}、そうでなければ{@code false}
+	 */
+	public boolean isLob() {
+		return lob;
+	}
+	
+	/**
+	 * NULL可能の場合{@code true}を取得する。
+	 * 
+	 * @return NULL可能の場合{@code true}、そうでない場合{@code false}
+	 */
+	public boolean isNullable() {
+		return nullable;
+	}
+	
+	/**
+	 * 時制を表す場合{@code true}を取得する。
+	 * 
+	 * @return 時制を表す場合{@code true}
+	 */
+	public boolean isTemporal() {
+		return getTemporalType() != null;
+	}
+	
+	/**
+	 * 一時的の場合{@code true}を取得する。
+	 * 
+	 * @return 一時的の場合{@code true}、そうでなければ{@code false}
+	 */
+	public boolean isTransient() {
+		return trnsient;
+	}
+	
+	/**
+	 * 一意の場合{@code true}、そうでない場合{@code false}を取得する。
+	 * 
+	 * @return 一意の場合{@code true}、そうでない場合{@code false}
+	 */
+	public boolean isUnique() {
+		return unique;
+	}
+	
+	/**
+	 * サポートされていないカラム型の場合{@code true}を取得する。
+	 * 
+	 * @return サポートされていないカラム型の場合{@code true}、そうでない場合{@code false}
+	 */
+	public boolean isUnsupportedColumnType() {
+		return unsupportedColumnType;
+	}
+	
+	/**
+	 * バージョンの場合{@code true}を取得する。
+	 * 
+	 * @return バージョンの場合{@code true}、そうでなければ{@code false}
+	 */
+	public boolean isVersion() {
+		return version;
+	}
+	
+	/**
+	 * 識別子の割り当てサイズを設定する。
+	 * 
+	 * @param allocationSize 識別子の割り当てサイズ
+	 */
+	public void setAllocationSize(int allocationSize) {
+		this.allocationSize = allocationSize;
+	}
+	
+	/**
+	 * 属性のクラスを設定する。
+	 * 
+	 * @param attributeClass 属性のクラス
+	 */
+	public void setAttributeClass(Class<?> attributeClass) {
+		this.attributeClass = attributeClass;
+	}
+	
+	/**
+	 * カラム定義を設定する。
+	 * 
+	 * @param columnDefinition カラム定義
+	 */
+	public void setColumnDefinition(String columnDefinition) {
+		this.columnDefinition = columnDefinition;
+	}
+	
+	/**
+	 * カラムの名前を設定する。
+	 * 
+	 * @param columnName カラムの名前
+	 */
+	public void setColumnName(String columnName) {
+		this.columnName = columnName;
+	}
+	
+	/**
+	 * カラムの型名を設定する。
+	 * 
+	 * @param columnTypeName カラムの型名
+	 */
+	public void setColumnTypeName(String columnTypeName) {
+		this.columnTypeName = columnTypeName;
+	}
+	
+	/**
+	 * コメントを設定する。
+	 * 
+	 * @param comment コメント
+	 */
+	public void setComment(String comment) {
+		this.comment = comment;
+	}
+	
+	/**
+	 * 識別子の生成方法を示す列挙型を設定する。
+	 * 
+	 * @param generationType 識別子の生成方法を示す列挙型、生成しない場合{@code null}
+	 */
+	public void setGenerationType(GenerationType generationType) {
+		this.generationType = generationType;
+	}
+	
+	/**
+	 * 識別子の場合{@code true}を設定する。
+	 * 
+	 * @param id 識別子の場合{@code true}
+	 */
+	public void setId(boolean id) {
+		this.id = id;
+	}
+	
+	/**
+	 * 識別子の初期値を設定する。
+	 * 
+	 * @param initialValue 識別子の初期値
+	 */
+	public void setInitialValue(int initialValue) {
+		this.initialValue = initialValue;
+	}
+	
+	/**
+	 * 長さを設定する。
+	 * 
+	 * @param length 長さ
+	 */
+	public void setLength(int length) {
+		this.length = length;
+	}
+	
+	/**
+	 * {@code LOB}の場合{@code true}を設定する。
+	 * 
+	 * @param lob {@code LOB}の場合{@code true}
+	 */
+	public void setLob(boolean lob) {
+		this.lob = lob;
+	}
+	
+	/**
+	 * 名前を設定する。
+	 * 
+	 * @param name 名前
+	 */
+	public void setName(String name) {
+		this.name = name;
+	}
+	
+	/**
+	 * NULL可能の場合{@code true}を設定する。
+	 * 
+	 * @param nullable NULL可能の場合{@code true}
+	 */
+	public void setNullable(boolean nullable) {
+		this.nullable = nullable;
+	}
+	
+	/**
+	 * 精度を設定する。
+	 * 
+	 * @param precision	精度
+	 */
+	public void setPrecision(int precision) {
+		this.precision = precision;
+	}
+	
+	/**
+	 * スケールを設定する。
+	 * 
+	 * @param scale スケール
+	 */
+	public void setScale(int scale) {
+		this.scale = scale;
+	}
+	
+	/**
+	 * 一時的の場合{@code true}を設定する。
+	 * 
+	 * @param trnsient 一時的の場合{@code true}
+	 */
+	public void setTransient(boolean trnsient) {
+		this.trnsient = trnsient;
+	}
+	
+	/**
+	 * 一意の場合{@code true}、そうでない場合{@code false}を設定する。
+	 * 
+	 * @param unique 一意の場合{@code true}
+	 */
+	public void setUnique(boolean unique) {
+		this.unique = unique;
+	}
+	
+	/**
+	 * サポートされていないカラム型の場合{@code true}を設定する。
+	 * 
+	 * @param unsupportedColumnType サポートされていないカラム型の場合{@code true}、そうでない場合{@code false}
+	 */
+	public void setUnsupportedColumnType(boolean unsupportedColumnType) {
+		this.unsupportedColumnType = unsupportedColumnType;
+	}
+	
+	/**
+	 * バージョンの場合{@code true}を設定する。
+	 * 
+	 * @param version バージョンの場合{@code true}
+	 */
+	public void setVersion(boolean version) {
+		this.version = version;
+	}
+	
+}


Property changes on: leto/jiemamy-entity-io/trunk/src/main/java/org/jiemamy/entity/io/desc/AttributeDesc.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Added: leto/jiemamy-entity-io/trunk/src/main/java/org/jiemamy/entity/io/desc/AttributeDescFactory.java
===================================================================
--- leto/jiemamy-entity-io/trunk/src/main/java/org/jiemamy/entity/io/desc/AttributeDescFactory.java	                        (rev 0)
+++ leto/jiemamy-entity-io/trunk/src/main/java/org/jiemamy/entity/io/desc/AttributeDescFactory.java	2009-04-13 09:50:11 UTC (rev 3249)
@@ -0,0 +1,39 @@
+/*
+ * Copyright 2007-2009 Jiemamy Project and the Others.
+ * Created on Apr 7, 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.entity.io.desc;
+
+import org.jiemamy.entity.io.meta.DbColumnMeta;
+import org.jiemamy.entity.io.meta.DbTableMeta;
+
+/**
+ * {@link AttributeDesc 属性記述}のファクトリインターフェイス。
+ * 
+ * @author j5ik2o
+ */
+public interface AttributeDescFactory {
+	
+	/**
+	 * 属性記述を取得する。
+	 * 
+	 * @param tableMeta テーブルメタデータ
+	 * @param columnMeta カラムメタデータ
+	 * @return 属性記述
+	 */
+	AttributeDesc getAttributeDesc(DbTableMeta tableMeta, DbColumnMeta columnMeta);
+}


Property changes on: leto/jiemamy-entity-io/trunk/src/main/java/org/jiemamy/entity/io/desc/AttributeDescFactory.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Added: leto/jiemamy-entity-io/trunk/src/main/java/org/jiemamy/entity/io/desc/CompositeUniqueConstraintDesc.java
===================================================================
--- leto/jiemamy-entity-io/trunk/src/main/java/org/jiemamy/entity/io/desc/CompositeUniqueConstraintDesc.java	                        (rev 0)
+++ leto/jiemamy-entity-io/trunk/src/main/java/org/jiemamy/entity/io/desc/CompositeUniqueConstraintDesc.java	2009-04-13 09:50:11 UTC (rev 3249)
@@ -0,0 +1,63 @@
+/*
+ * Copyright 2007-2009 Jiemamy Project and the Others.
+ * Created on Apr 7, 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.entity.io.desc;
+
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+
+/**
+ * 複合一意制約記述インターフェイス。
+ * 
+ * @author j5ik2o
+ */
+public class CompositeUniqueConstraintDesc {
+	
+	/** カラム名のリスト */
+	protected List<String> columnNameList = new ArrayList<String>();
+	
+
+	/**
+	 * カラム名を追加する。
+	 * 
+	 * @param columnName カラム名
+	 */
+	public void addColumnName(String columnName) {
+		columnNameList.add(columnName);
+	}
+	
+	/**
+	 * カラム名のリストを取得する。
+	 * 
+	 * @return カラム名のリスト
+	 */
+	public List<String> getColumnNameList() {
+		return Collections.unmodifiableList(columnNameList);
+	}
+	
+	/**
+	 * 複合一意制約の場合{@code true}、そうでない場合{@code false}を取得する。
+	 * 
+	 * @return 複合一意制約の場合{@code true}、そうでない場合{@code false}
+	 */
+	public boolean isComposite() {
+		return columnNameList.size() > 1;
+	}
+	
+}


Property changes on: leto/jiemamy-entity-io/trunk/src/main/java/org/jiemamy/entity/io/desc/CompositeUniqueConstraintDesc.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Added: leto/jiemamy-entity-io/trunk/src/main/java/org/jiemamy/entity/io/desc/CompositeUniqueConstraintDescFactory.java
===================================================================
--- leto/jiemamy-entity-io/trunk/src/main/java/org/jiemamy/entity/io/desc/CompositeUniqueConstraintDescFactory.java	                        (rev 0)
+++ leto/jiemamy-entity-io/trunk/src/main/java/org/jiemamy/entity/io/desc/CompositeUniqueConstraintDescFactory.java	2009-04-13 09:50:11 UTC (rev 3249)
@@ -0,0 +1,37 @@
+/*
+ * Copyright 2007-2009 Jiemamy Project and the Others.
+ * Created on Apr 7, 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.entity.io.desc;
+
+import org.jiemamy.entity.io.meta.DbUniqueKeyMeta;
+
+/**
+ * {@link CompositeUniqueConstraintDesc}のファクトリインターフェイス。
+ * 
+ * @author j5ik2o
+ */
+public interface CompositeUniqueConstraintDescFactory {
+	
+	/**
+	 * 一意制約記述を取得する。
+	 * 
+	 * @param uniqueKeyMeta 一意キーメタデータ
+	 * @return 存在する場合は一意制約記述、存在しない場合は{@code null}
+	 */
+	CompositeUniqueConstraintDesc getCompositeUniqueConstraintDesc(DbUniqueKeyMeta uniqueKeyMeta);
+}


Property changes on: leto/jiemamy-entity-io/trunk/src/main/java/org/jiemamy/entity/io/desc/CompositeUniqueConstraintDescFactory.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Added: leto/jiemamy-entity-io/trunk/src/main/java/org/jiemamy/entity/io/desc/EntityDesc.java
===================================================================
--- leto/jiemamy-entity-io/trunk/src/main/java/org/jiemamy/entity/io/desc/EntityDesc.java	                        (rev 0)
+++ leto/jiemamy-entity-io/trunk/src/main/java/org/jiemamy/entity/io/desc/EntityDesc.java	2009-04-13 09:50:11 UTC (rev 3249)
@@ -0,0 +1,281 @@
+/*
+ * Copyright 2007-2009 Jiemamy Project and the Others.
+ * Created on Apr 7, 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.entity.io.desc;
+
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+
+/**
+ * エンティティ記述インターフェイス。
+ * 
+ * @author j5ik2o
+ */
+public class EntityDesc {
+	
+	/** 名前 */
+	protected String name;
+	
+	/** カタログ名 */
+	protected String catalogName;
+	
+	/** スキーマ名 */
+	protected String schemaName;
+	
+	/** テーブル名 */
+	protected String tableName;
+	
+	/** 複合識別子をもつならば{@code true} */
+	protected boolean compositeId;
+	
+	/** コメント */
+	protected String comment;
+	
+	/** 属性記述のリスト */
+	protected List<AttributeDesc> attributeDescList = new ArrayList<AttributeDesc>();
+	
+	/** 識別子である属性記述のリスト */
+	protected List<AttributeDesc> idAttributeDescList = new ArrayList<AttributeDesc>();
+	
+	/** 関連記述のリスト */
+	protected List<AssociationDesc> associationDescList = new ArrayList<AssociationDesc>();
+	
+	/** 一意制約記述のリスト */
+	protected List<CompositeUniqueConstraintDesc> compositeUniqueConstraintDescList =
+			new ArrayList<CompositeUniqueConstraintDesc>();
+	
+
+	/**
+	 * インスタンスを生成する。
+	 */
+	public EntityDesc() {
+	}
+	
+	/**
+	 * 関連記述を追加する。
+	 * 
+	 * @param associationDesc 関連記述
+	 */
+	public void addAssociationDesc(AssociationDesc associationDesc) {
+		associationDescList.add(associationDesc);
+	}
+	
+	/**
+	 * 属性記述を追加する。
+	 * 
+	 * @param attributeDesc 属性記述
+	 */
+	public void addAttributeDesc(AttributeDesc attributeDesc) {
+		attributeDescList.add(attributeDesc);
+		if (attributeDesc.isId()) {
+			idAttributeDescList.add(attributeDesc);
+		}
+	}
+	
+	/**
+	 * 複合一意制約記述を追加する。
+	 * 
+	 * @param compositeUniqueConstraintDesc 複合一意制約記述
+	 */
+	public void addCompositeUniqueConstraintDesc(CompositeUniqueConstraintDesc compositeUniqueConstraintDesc) {
+		compositeUniqueConstraintDescList.add(compositeUniqueConstraintDesc);
+	}
+	
+	/**
+	 * 関連記述のリストを取得する。
+	 * 
+	 * @return 関連記述のリスト
+	 */
+	public List<AssociationDesc> getAssociationDescList() {
+		return Collections.unmodifiableList(associationDescList);
+	}
+	
+	/**
+	 * 属性記述のリストを取得する。
+	 * 
+	 * @return 属性記述のリスト
+	 */
+	public List<AttributeDesc> getAttributeDescList() {
+		return Collections.unmodifiableList(attributeDescList);
+	}
+	
+	/**
+	 * カタログ名を取得する。
+	 * 
+	 * @return カタログ名
+	 */
+	public String getCatalogName() {
+		return catalogName;
+	}
+	
+	/**
+	 * コメントを取得する。
+	 * 
+	 * @return コメント
+	 */
+	public String getComment() {
+		return comment;
+	}
+	
+	/**
+	 * 複合一意制約記述のリストを取得する。
+	 * 
+	 * @return 複合一意制約記述のリスト
+	 */
+	public List<CompositeUniqueConstraintDesc> getCompositeUniqueConstraintDescList() {
+		return Collections.unmodifiableList(compositeUniqueConstraintDescList);
+	}
+	
+	/**
+	 * 完全なテーブル名を取得する。
+	 * 
+	 * @return 完全なテーブル名
+	 */
+	public String getFullTableName() {
+		StringBuilder buf = new StringBuilder();
+		if (catalogName != null) {
+			buf.append(catalogName).append(".");
+		}
+		if (schemaName != null) {
+			buf.append(schemaName).append(".");
+		}
+		return buf.append(tableName).toString();
+	}
+	
+	/**
+	 * 識別子である属性記述のリストを取得する。
+	 * 
+	 * @return 識別子である属性記述のリスト
+	 */
+	public List<AttributeDesc> getIdAttributeDescList() {
+		return Collections.unmodifiableList(idAttributeDescList);
+	}
+	
+	/**
+	 * 名前を取得する。
+	 * 
+	 * @return 名前
+	 */
+	public String getName() {
+		return name;
+	}
+	
+	/**
+	 * スキーマ名を取得する。
+	 * 
+	 * @return スキーマ名
+	 */
+	public String getSchemaName() {
+		return schemaName;
+	}
+	
+	/**
+	 * テーブル名を取得する。
+	 * 
+	 * @return テーブル名
+	 */
+	public String getTableName() {
+		return tableName;
+	}
+	
+	/**
+	 * 指定された関連名の関連記述を持っている場合{@code true}を取得する。
+	 * 
+	 * @param associationName 関連名
+	 * @return 指定された関連名の関連記述を持っている場合{@code true}、そうでない場合{@code false}
+	 */
+	public boolean hasAssociationDesc(String associationName) {
+		for (AssociationDesc associationDesc : associationDescList) {
+			if (associationDesc.getName().equals(associationName)) {
+				return true;
+			}
+		}
+		return false;
+	}
+	
+	/**
+	 * 指定された属性名の属性記述を持っている場合{@code true}を取得する。
+	 * 
+	 * @param attributeName 属性名
+	 * @return 指定された属性名の属性記述を持っている場合{@code true}、そうでない場合{@code false}
+	 */
+	public boolean hasAttributeDesc(String attributeName) {
+		for (AttributeDesc attributeDesc : attributeDescList) {
+			if (attributeDesc.getName().equals(attributeName)) {
+				return true;
+			}
+		}
+		return false;
+	}
+	
+	/**
+	 * 複合識別子を持つならば{@code true}を取得する。
+	 * 
+	 * @return 複合識別子を持つならば{@code true}、そうでないならば{@code false}
+	 */
+	public boolean hasCompositeId() {
+		return idAttributeDescList.size() > 1;
+	}
+	
+	/**
+	 * カタログ名を設定する。
+	 * 
+	 * @param catalogName カタログ名
+	 */
+	public void setCatalogName(String catalogName) {
+		this.catalogName = catalogName;
+	}
+	
+	/**
+	 * コメントを設定する。
+	 * 
+	 * @param comment コメント
+	 */
+	public void setComment(String comment) {
+		this.comment = comment;
+	}
+	
+	/**
+	 * 名前を設定する。
+	 * 
+	 * @param name 名前
+	 */
+	public void setName(String name) {
+		this.name = name;
+	}
+	
+	/**
+	 * スキーマ名を設定する。
+	 * 
+	 * @param schemaName スキーマ名
+	 */
+	public void setSchemaName(String schemaName) {
+		this.schemaName = schemaName;
+	}
+	
+	/**
+	 * テーブル名を設定する。
+	 * 
+	 * @param tableName テーブル名
+	 */
+	public void setTableName(String tableName) {
+		this.tableName = tableName;
+	}
+	
+}


Property changes on: leto/jiemamy-entity-io/trunk/src/main/java/org/jiemamy/entity/io/desc/EntityDesc.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Added: leto/jiemamy-entity-io/trunk/src/main/java/org/jiemamy/entity/io/desc/EntityDescFactory.java
===================================================================
--- leto/jiemamy-entity-io/trunk/src/main/java/org/jiemamy/entity/io/desc/EntityDescFactory.java	                        (rev 0)
+++ leto/jiemamy-entity-io/trunk/src/main/java/org/jiemamy/entity/io/desc/EntityDescFactory.java	2009-04-13 09:50:11 UTC (rev 3249)
@@ -0,0 +1,37 @@
+/*
+ * Copyright 2007-2009 Jiemamy Project and the Others.
+ * Created on Apr 7, 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.entity.io.desc;
+
+import org.jiemamy.entity.io.meta.DbTableMeta;
+
+/**
+ * {@link EntityDesc}のファクトリインターフェイス。
+ * 
+ * @author j5ik2o
+ */
+public interface EntityDescFactory {
+	
+	/**
+	 * エンティティ記述を取得する。
+	 * 
+	 * @param tableMeta テーブルメタデータ
+	 * @return エンティティ記述
+	 */
+	EntityDesc getEntityDesc(DbTableMeta tableMeta);
+}


Property changes on: leto/jiemamy-entity-io/trunk/src/main/java/org/jiemamy/entity/io/desc/EntityDescFactory.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Added: leto/jiemamy-entity-io/trunk/src/main/java/org/jiemamy/entity/io/desc/EntitySetDesc.java
===================================================================
--- leto/jiemamy-entity-io/trunk/src/main/java/org/jiemamy/entity/io/desc/EntitySetDesc.java	                        (rev 0)
+++ leto/jiemamy-entity-io/trunk/src/main/java/org/jiemamy/entity/io/desc/EntitySetDesc.java	2009-04-13 09:50:11 UTC (rev 3249)
@@ -0,0 +1,71 @@
+/*
+ * Copyright 2007-2009 Jiemamy Project and the Others.
+ * Created on Apr 7, 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.entity.io.desc;
+
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+import java.util.Map;
+
+import org.jiemamy.utils.ArrayMap;
+
+/**
+ * エンティティ集合記述インターフェイス。
+ * 
+ * @author j5ik2o
+ */
+public class EntitySetDesc {
+	
+	/** エンティティ記述のリスト */
+	protected List<EntityDesc> entityDescList = new ArrayList<EntityDesc>();
+	
+	/** 完全なテーブル名をキー、エンティティ記述を値とするマップ */
+	protected Map<String, EntityDesc> entityDescMap = new ArrayMap<String, EntityDesc>();
+	
+
+	/**
+	 * エンティティ記述を追加する。
+	 * 
+	 * @param entityDesc エンティティ記述
+	 */
+	public void addEntityDesc(EntityDesc entityDesc) {
+		entityDescList.add(entityDesc);
+		entityDescMap.put(entityDesc.getFullTableName(), entityDesc);
+	}
+	
+	/**
+	 * 完全なテーブル名に対応するエンティティ記述を取得する。
+	 * 
+	 * @param fullTableName 完全なテーブル名
+	 * @return エンティティ記述、存在しない場合{@code null}
+	 */
+	public EntityDesc getEntityDesc(String fullTableName) {
+		return entityDescMap.get(fullTableName);
+	}
+	
+	/**
+	 * エンティティ記述のリストを取得する。
+	 * 
+	 * @return エンティティ記述のリスト
+	 */
+	public List<EntityDesc> getEntityDescList() {
+		return Collections.unmodifiableList(entityDescList);
+	}
+	
+}


Property changes on: leto/jiemamy-entity-io/trunk/src/main/java/org/jiemamy/entity/io/desc/EntitySetDesc.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Added: leto/jiemamy-entity-io/trunk/src/main/java/org/jiemamy/entity/io/desc/EntitySetDescFactory.java
===================================================================
--- leto/jiemamy-entity-io/trunk/src/main/java/org/jiemamy/entity/io/desc/EntitySetDescFactory.java	                        (rev 0)
+++ leto/jiemamy-entity-io/trunk/src/main/java/org/jiemamy/entity/io/desc/EntitySetDescFactory.java	2009-04-13 09:50:11 UTC (rev 3249)
@@ -0,0 +1,37 @@
+/*
+ * Copyright 2007-2009 Jiemamy Project and the Others.
+ * Created on Apr 7, 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.entity.io.desc;
+
+import java.io.IOException;
+
+/**
+ * {@link EntitySetDesc}のファクトリインターフェイス。
+ * 
+ * @author j5ik2o
+ */
+public interface EntitySetDescFactory {
+	
+	/**
+	 * エンティティ集合記述を取得する。
+	 * 
+	 * @return エンティティ集合記述
+	 * @throws IOException 入出力が失敗した場合
+	 */
+	EntitySetDesc getEntitySetDesc() throws IOException;
+}


Property changes on: leto/jiemamy-entity-io/trunk/src/main/java/org/jiemamy/entity/io/desc/EntitySetDescFactory.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Added: leto/jiemamy-entity-io/trunk/src/main/java/org/jiemamy/entity/io/desc/impl/AssociationResolver.java
===================================================================
--- leto/jiemamy-entity-io/trunk/src/main/java/org/jiemamy/entity/io/desc/impl/AssociationResolver.java	                        (rev 0)
+++ leto/jiemamy-entity-io/trunk/src/main/java/org/jiemamy/entity/io/desc/impl/AssociationResolver.java	2009-04-13 09:50:11 UTC (rev 3249)
@@ -0,0 +1,262 @@
+/*
+ * Copyright 2004-2009 the Seasar Foundation and the Others.
+ *
+ * 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.entity.io.desc.impl;
+
+import org.jiemamy.entity.io.desc.AssociationDesc;
+import org.jiemamy.entity.io.desc.AssociationType;
+import org.jiemamy.entity.io.desc.AttributeDesc;
+import org.jiemamy.entity.io.desc.EntityDesc;
+import org.jiemamy.entity.io.desc.EntitySetDesc;
+import org.jiemamy.entity.io.meta.DbForeignKeyMeta;
+import org.jiemamy.entity.io.meta.DbTableMeta;
+import org.jiemamy.utils.StringUtil;
+
+/**
+ * エンティティ記述の関連を解決するクラスです。
+ * 
+ * @author j5ik2o
+ */
+public class AssociationResolver {
+	
+	/** 多側に対する関連名のサフィックス */
+	protected static final String TO_MANY_ASSOCIATION_NAME_SUFFIX = "List";
+	
+	/** エンティティ集合記述 */
+	protected EntitySetDesc entitySetDesc;
+	
+	/** 単語を複数形に変換するための辞書 */
+	protected PluralFormDictinary pluralFormDictinary;
+	
+
+	/**
+	 * インスタンスを構築します。
+	 * 
+	 * @param entitySetDesc エンティティ集合記述
+	 * @param pluralFormDictinary 単語を複数形に変換するための辞書
+	 */
+	public AssociationResolver(EntitySetDesc entitySetDesc, PluralFormDictinary pluralFormDictinary) {
+		if (entitySetDesc == null) {
+			throw new NullPointerException("entitySetDesc");
+		}
+		if (pluralFormDictinary == null) {
+			throw new NullPointerException("pluralFormDictinary");
+		}
+		this.entitySetDesc = entitySetDesc;
+		this.pluralFormDictinary = pluralFormDictinary;
+	}
+	
+	/**
+	 * エンティティ記述のすべての属性について必要であれば名前を調整します。
+	 * 
+	 * @param fkMeta 外部キーメタデータ
+	 * @param entityDesc エンティティ記述
+	 * @param associationName 関連名
+	 */
+	protected void adjustAttributeNames(DbForeignKeyMeta fkMeta, EntityDesc entityDesc, String associationName) {
+		if (fkMeta.isComposite()) {
+			return;
+		}
+		for (AttributeDesc attributeDesc : entityDesc.getAttributeDescList()) {
+			if (associationName.equalsIgnoreCase(attributeDesc.getName())) {
+				String pkColumnName = fkMeta.getPrimaryKeyColumnNameList().get(0);
+				String pkPropertyName = fromColumnNameToPropertyName(pkColumnName);
+				String candidateName = attributeDesc.getName() + StringUtil.capitalize(pkPropertyName);
+				String newName = toUniqueAttributeName(entityDesc, candidateName);
+				attributeDesc.setName(newName);
+			}
+		}
+	}
+	
+	/**
+	 * 被所有側の関連を処理します。
+	 * 
+	 * @param fkMeta 外部キーメタデータ
+	 * @param ownerEntityDesc 関連の所有者側のエンティティ記述
+	 * @param inverseEntityDesc 関連の被所有者側のエンティティ記述
+	 * @param mappedBy 関連の所有者側のプロパティ名
+	 */
+	protected void doInverseAssociationDesc(DbForeignKeyMeta fkMeta, EntityDesc ownerEntityDesc,
+			EntityDesc inverseEntityDesc, String mappedBy) {
+		AssociationDesc inverseAssociationDesc = new AssociationDesc();
+		if (fkMeta.isUnique()) {
+			String name = getInverseAssociationName(inverseEntityDesc, ownerEntityDesc, false);
+			inverseAssociationDesc.setName(name);
+			inverseAssociationDesc.setAssociationType(AssociationType.ONE_TO_ONE);
+		} else {
+			String name = getInverseAssociationName(inverseEntityDesc, ownerEntityDesc, true);
+			inverseAssociationDesc.setName(name);
+			inverseAssociationDesc.setAssociationType(AssociationType.ONE_TO_MANY);
+		}
+		inverseAssociationDesc.setMappedBy(mappedBy);
+		inverseAssociationDesc.setReferencedEntityDesc(ownerEntityDesc);
+		inverseEntityDesc.addAssociationDesc(inverseAssociationDesc);
+	}
+	
+	/**
+	 * 所有側の関連を処理します。
+	 * 
+	 * @param fkMeta 外部キーメタデータ
+	 * @param ownerEntityDesc 関連の所有者側のエンティティ記述
+	 * @param inverseEntityDesc 関連の被所有者側のエンティティ記述
+	 * @return {@link AssociationDesc}
+	 */
+	protected AssociationDesc doOwnerAssociationDesc(DbForeignKeyMeta fkMeta, EntityDesc ownerEntityDesc,
+			EntityDesc inverseEntityDesc) {
+		AssociationDesc associationDesc = new AssociationDesc();
+		associationDesc.setReferencedCatalogName(fkMeta.getPrimaryKeyCatalogName());
+		associationDesc.setReferencedSchemaName(fkMeta.getPrimaryKeySchemaName());
+		associationDesc.setReferencedTableName(fkMeta.getPrimaryKeyTableName());
+		String name = getOwnerAssociationName(fkMeta, ownerEntityDesc, inverseEntityDesc);
+		associationDesc.setName(name);
+		adjustAttributeNames(fkMeta, ownerEntityDesc, name);
+		if (fkMeta.isUnique()) {
+			associationDesc.setAssociationType(AssociationType.ONE_TO_ONE);
+		} else {
+			associationDesc.setAssociationType(AssociationType.MANY_TO_ONE);
+		}
+		for (String referencedColumnName : fkMeta.getPrimaryKeyColumnNameList()) {
+			associationDesc.addReferencedColumnName(referencedColumnName);
+		}
+		for (String columnName : fkMeta.getForeignKeyColumnNameList()) {
+			associationDesc.addColumnName(columnName);
+		}
+		associationDesc.setReferencedEntityDesc(inverseEntityDesc);
+		ownerEntityDesc.addAssociationDesc(associationDesc);
+		return associationDesc;
+	}
+	
+	private String fromColumnNameToPropertyName(String pkColumnName) {
+		// TODO Auto-generated method stub
+		return null;
+	}
+	
+	/**
+	 * 関連名を返します。
+	 * 
+	 * @param inverseEntityDesc 参照する側のエンティティ記述
+	 * @param ownerEntityDesc 参照される側のエンティティ記述
+	 * @param oneToMany 関連がOneToManyの場合{@code true}
+	 * @return 関連名
+	 */
+	protected String getInverseAssociationName(EntityDesc inverseEntityDesc, EntityDesc ownerEntityDesc,
+			boolean oneToMany) {
+		String associationName = StringUtil.decapitalize(ownerEntityDesc.getName());
+		if (oneToMany) {
+			associationName = pluralizeName(associationName);
+		}
+		return toUniqueAssociationName(inverseEntityDesc, associationName);
+	}
+	
+	/**
+	 * 関連の所有側の関連名を返します。
+	 * 
+	 * @param fkMeta 外部キーメタデータ
+	 * @param ownerEntityDesc 関連の所有者側のエンティティ記述
+	 * @param inverseEntityDesc 関連の被所有者側のエンティティ記述
+	 * @return 関連の所有側の関連名
+	 */
+	protected String getOwnerAssociationName(DbForeignKeyMeta fkMeta, EntityDesc ownerEntityDesc,
+			EntityDesc inverseEntityDesc) {
+		String associationName = StringUtil.decapitalize(inverseEntityDesc.getName());
+		if (!fkMeta.isComposite()) {
+			String fkColumnName = fkMeta.getForeignKeyColumnNameList().get(0);
+			String pkColumnName = fkMeta.getPrimaryKeyColumnNameList().get(0);
+			if (StringUtil.endsWithIgnoreCase(fkColumnName, pkColumnName)) {
+				if (fkColumnName.length() > pkColumnName.length()) {
+					String name = fkColumnName.substring(0, fkColumnName.length() - pkColumnName.length());
+					name = StringUtil.trimSuffix(name, "_");
+					name = StringUtil.camelize(name);
+					if (StringUtil.startsWithIgnoreCase(pkColumnName, inverseEntityDesc.getTableName())) {
+						associationName = StringUtil.decapitalize(name) + inverseEntityDesc.getName();
+					} else {
+						associationName = StringUtil.decapitalize(name);
+					}
+				}
+			}
+		}
+		return toUniqueAssociationName(ownerEntityDesc, associationName);
+	}
+	
+	/**
+	 * 名前を複数形に変換します。
+	 * 
+	 * @param name 名前
+	 * @return 複数形に変換された名前
+	 */
+	protected String pluralizeName(String name) {
+		String pluralizedName = pluralFormDictinary.lookup(name);
+		if (pluralizedName != null) {
+			return pluralizedName;
+		}
+		return name + TO_MANY_ASSOCIATION_NAME_SUFFIX;
+	}
+	
+	/**
+	 * 関連を解決します。
+	 * 
+	 * @param tableMeta テーブルメタデータ
+	 * @param fkMeta 外部キーメタデータ
+	 */
+	public void resolve(DbTableMeta tableMeta, DbForeignKeyMeta fkMeta) {
+		EntityDesc ownerEntityDesc = entitySetDesc.getEntityDesc(tableMeta.getFullName());
+		if (ownerEntityDesc == null) {
+			return;
+		}
+		EntityDesc inverseEntityDesc = entitySetDesc.getEntityDesc(fkMeta.getPrimaryKeyFullTableName());
+		if (inverseEntityDesc == null) {
+			return;
+		}
+		AssociationDesc ownerAssociationDesc = doOwnerAssociationDesc(fkMeta, ownerEntityDesc, inverseEntityDesc);
+		doInverseAssociationDesc(fkMeta, ownerEntityDesc, inverseEntityDesc, ownerAssociationDesc.getName());
+	}
+	
+	/**
+	 * 一意の関連名に変換します。
+	 * 
+	 * @param entityDesc エンティティ記述
+	 * @param candidateName 候補の関連名
+	 * @return 一意の関連名
+	 */
+	protected String toUniqueAssociationName(EntityDesc entityDesc, String candidateName) {
+		if (entityDesc.hasAssociationDesc(candidateName)) {
+			for (int i = 2;; i++) {
+				if (!entityDesc.hasAssociationDesc(candidateName + i)) {
+					return candidateName + i;
+				}
+			}
+		}
+		return candidateName;
+	}
+	
+	/**
+	 * 一意な属性名に変換します。
+	 * 
+	 * @param entityDesc エンティティ記述
+	 * @param candidateName 候補の属性名
+	 * @return 一意な属性名
+	 */
+	protected String toUniqueAttributeName(EntityDesc entityDesc, String candidateName) {
+		if (entityDesc.hasAttributeDesc(candidateName)) {
+			for (int i = 2;; i++) {
+				if (!entityDesc.hasAttributeDesc(candidateName + i)) {
+					return candidateName + i;
+				}
+			}
+		}
+		return candidateName;
+	}
+	
+}


Property changes on: leto/jiemamy-entity-io/trunk/src/main/java/org/jiemamy/entity/io/desc/impl/AssociationResolver.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Added: leto/jiemamy-entity-io/trunk/src/main/java/org/jiemamy/entity/io/desc/impl/AttributeDescFactoryImpl.java
===================================================================
--- leto/jiemamy-entity-io/trunk/src/main/java/org/jiemamy/entity/io/desc/impl/AttributeDescFactoryImpl.java	                        (rev 0)
+++ leto/jiemamy-entity-io/trunk/src/main/java/org/jiemamy/entity/io/desc/impl/AttributeDescFactoryImpl.java	2009-04-13 09:50:11 UTC (rev 3249)
@@ -0,0 +1,203 @@
+/*
+ * Copyright 2004-2009 the Seasar Foundation and the Others.
+ *
+ * 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.entity.io.desc.impl;
+
+import java.util.regex.Pattern;
+
+import javax.persistence.GenerationType;
+import javax.persistence.SequenceGenerator;
+import javax.persistence.TableGenerator;
+import javax.persistence.Version;
+
+import org.apache.commons.lang.Validate;
+
+import org.jiemamy.entity.io.desc.AttributeDesc;
+import org.jiemamy.entity.io.desc.AttributeDescFactory;
+import org.jiemamy.entity.io.meta.DbColumnMeta;
+import org.jiemamy.entity.io.meta.DbTableMeta;
+import org.jiemamy.entity.io.utils.AnnotationUtil;
+import org.jiemamy.utils.ClassUtil;
+
+/**
+ * {@link AttributeDescFactory}の実装クラスです。
+ * 
+ * @author taedium
+ */
+public class AttributeDescFactoryImpl implements AttributeDescFactory {
+	
+	/** バージョンカラム名のパターン */
+	protected Pattern versionColumnNamePattern;
+	
+	/** エンティティの識別子の生成方法を示す列挙型 、生成しない場合は{@code null} */
+	protected GenerationType generationType;
+	
+	/** エンティティの識別子の初期値 */
+	protected int initialValue;
+	
+	/** エンティティの識別子の割り当てサイズ */
+	protected int allocationSize;
+	
+
+	/**
+	 * インスタンスを構築します。
+	 * 
+	 * @param versionColumnNamePattern バージョンカラム名のパターン
+	 * @param generationType エンティティの識別子の生成方法を示す列挙型 、生成しない場合は{@code null}
+	 * @param initialValue エンティティの識別子の初期値、指定しない場合は{@code null}
+	 * @param allocationSize エンティティの識別子の割り当てサイズ、指定しない場合は{@code null}
+	 */
+	public AttributeDescFactoryImpl(String versionColumnNamePattern, GenerationType generationType,
+			Integer initialValue, Integer allocationSize) {
+		Validate.notNull(versionColumnNamePattern);
+		this.versionColumnNamePattern = Pattern.compile(versionColumnNamePattern, Pattern.CASE_INSENSITIVE);
+		this.generationType = generationType == GenerationType.AUTO ? getDefaultGenerationType() : generationType;
+		if (this.generationType == GenerationType.IDENTITY) {
+			
+		} else if (this.generationType == GenerationType.SEQUENCE) {
+			SequenceGenerator generator = AnnotationUtil.getDefaultSequenceGenerator();
+			this.initialValue = initialValue != null ? initialValue : generator.initialValue();
+			this.allocationSize = allocationSize != null ? allocationSize : generator.allocationSize();
+		} else if (this.generationType == GenerationType.TABLE) {
+			TableGenerator generator = AnnotationUtil.getDefaultTableGenerator();
+			this.initialValue = initialValue != null ? initialValue : generator.initialValue();
+			this.allocationSize = allocationSize != null ? allocationSize : generator.allocationSize();
+		}
+	}
+	
+	/**
+	 * カラムを処理します。
+	 * 
+	 * @param tableMeta テーブルメタデータ
+	 * @param columnMeta カラムメタデータ
+	 * @param attributeDesc 属性記述
+	 */
+	protected void doColumn(DbTableMeta tableMeta, DbColumnMeta columnMeta, AttributeDesc attributeDesc) {
+		attributeDesc.setColumnName(columnMeta.getName());
+		attributeDesc.setColumnTypeName(columnMeta.getTypeName());
+		attributeDesc.setLength(columnMeta.getLength());
+		attributeDesc.setPrecision(columnMeta.getLength());
+		attributeDesc.setScale(columnMeta.getScale());
+		attributeDesc.setNullable(columnMeta.isNullable());
+		attributeDesc.setUnique(columnMeta.isUnique());
+		attributeDesc.setComment(columnMeta.getComment());
+//		GenDialect.ColumnType columnType = dialect.getColumnType(columnMeta.getTypeName(), columnMeta.getSqlType());
+//		if (columnType != null) {
+//			Class<?> clazz =
+//					columnType.getAttributeClass(columnMeta.getLength(), columnMeta.getLength(), columnMeta.getScale());
+//			attributeDesc.setAttributeClass(clazz);
+//			String defaultValue = attributeDesc.getGenerationType() != null ? null : columnMeta.getDefaultValue();
+//			String definition =
+//					columnType.getColumnDefinition(columnMeta.getLength(), columnMeta.getLength(), columnMeta
+//						.getScale(), defaultValue);
+//			attributeDesc.setColumnDefinition(definition);
+//			attributeDesc.setLob(columnType.isLob());
+//		} else {
+//			attributeDesc.setUnsupportedColumnType(true);
+//			attributeDesc.setAttributeClass(String.class);
+//			attributeDesc.setLob(false);
+//		}
+	}
+	
+	/**
+	 * 識別子を処理します。
+	 * 
+	 * @param tableMeta テーブルメタデータ
+	 * @param columnMeta カラムメタデータ
+	 * @param attributeDesc 属性記述
+	 */
+	protected void doId(DbTableMeta tableMeta, DbColumnMeta columnMeta, AttributeDesc attributeDesc) {
+		if (columnMeta.isPrimaryKey()) {
+			attributeDesc.setId(true);
+			if (!tableMeta.hasCompositePrimaryKey()) {
+				if (columnMeta.isAutoIncrement()) {
+					attributeDesc.setGenerationType(GenerationType.IDENTITY);
+				} else {
+					attributeDesc.setGenerationType(generationType);
+					attributeDesc.setInitialValue(initialValue);
+					attributeDesc.setAllocationSize(allocationSize);
+				}
+			}
+		}
+	}
+	
+	/**
+	 * 名前を処理します。
+	 * 
+	 * @param tableMeta テーブルメタデータ
+	 * @param columnMeta カラムメタデータ
+	 * @param attributeDesc 属性記述
+	 */
+	protected void doName(DbTableMeta tableMeta, DbColumnMeta columnMeta, AttributeDesc attributeDesc) {
+		attributeDesc.setName(fromColumnNameToPropertyName(columnMeta.getName()));
+	}
+	
+	/**
+	 * 一時的なプロパティを処理します。
+	 * 
+	 * @param tableMeta テーブルメタデータ
+	 * @param columnMeta カラムメタデータ
+	 * @param attributeDesc 属性記述
+	 */
+	protected void doTransient(DbTableMeta tableMeta, DbColumnMeta columnMeta, AttributeDesc attributeDesc) {
+	}
+	
+	/**
+	 * バージョンを処理します。
+	 * 
+	 * @param tableMeta テーブルメタデータ
+	 * @param columnMeta カラムメタデータ
+	 * @param attributeDesc 属性記述
+	 */
+	protected void doVersion(DbTableMeta tableMeta, DbColumnMeta columnMeta, AttributeDesc attributeDesc) {
+		if (isVersionAnnotatable(attributeDesc.getAttributeClass())) {
+			if (versionColumnNamePattern.matcher(columnMeta.getName()).matches()) {
+				attributeDesc.setVersion(true);
+			}
+		}
+	}
+	
+	private String fromColumnNameToPropertyName(String name) {
+		// TODO Auto-generated method stub
+		return null;
+	}
+	
+	public AttributeDesc getAttributeDesc(DbTableMeta tableMeta, DbColumnMeta columnMeta) {
+		AttributeDesc attributeDesc = new AttributeDesc();
+		doName(tableMeta, columnMeta, attributeDesc);
+		doId(tableMeta, columnMeta, attributeDesc);
+		doTransient(tableMeta, columnMeta, attributeDesc);
+		doColumn(tableMeta, columnMeta, attributeDesc);
+		doVersion(tableMeta, columnMeta, attributeDesc);
+		return attributeDesc;
+	}
+	
+	private GenerationType getDefaultGenerationType() {
+		// TODO Auto-generated method stub
+		return null;
+	}
+	
+	/**
+	 * {@link Version}を注釈できるクラスの場合{@code true}
+	 * 
+	 * @param clazz クラス
+	 * @return {@link Version}を注釈できるクラスの場合{@code true}
+	 */
+	protected boolean isVersionAnnotatable(Class<?> clazz) {
+		Class<?> wrapperClass = ClassUtil.getWrapperClassIfPrimitive(clazz);
+		return wrapperClass == Integer.class || wrapperClass == Long.class;
+	}
+	
+}


Property changes on: leto/jiemamy-entity-io/trunk/src/main/java/org/jiemamy/entity/io/desc/impl/AttributeDescFactoryImpl.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Added: leto/jiemamy-entity-io/trunk/src/main/java/org/jiemamy/entity/io/desc/impl/CompositeUniqueConstraintDescFactoryImpl.java
===================================================================
--- leto/jiemamy-entity-io/trunk/src/main/java/org/jiemamy/entity/io/desc/impl/CompositeUniqueConstraintDescFactoryImpl.java	                        (rev 0)
+++ leto/jiemamy-entity-io/trunk/src/main/java/org/jiemamy/entity/io/desc/impl/CompositeUniqueConstraintDescFactoryImpl.java	2009-04-13 09:50:11 UTC (rev 3249)
@@ -0,0 +1,39 @@
+/*
+ * Copyright 2004-2009 the Seasar Foundation and the Others.
+ *
+ * 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.entity.io.desc.impl;
+
+import org.jiemamy.entity.io.desc.CompositeUniqueConstraintDesc;
+import org.jiemamy.entity.io.desc.CompositeUniqueConstraintDescFactory;
+import org.jiemamy.entity.io.meta.DbUniqueKeyMeta;
+
+/**
+ * {@link CompositeUniqueConstraintDescFactory}の実装クラス。
+ * 
+ * @author taedium
+ */
+public class CompositeUniqueConstraintDescFactoryImpl implements CompositeUniqueConstraintDescFactory {
+	
+	public CompositeUniqueConstraintDesc getCompositeUniqueConstraintDesc(DbUniqueKeyMeta uniqueKeyMeta) {
+		if (uniqueKeyMeta.isPrimaryKey() || !uniqueKeyMeta.isComposite()) {
+			return null;
+		}
+		CompositeUniqueConstraintDesc compositeUniqueConstraintDesc = new CompositeUniqueConstraintDesc();
+		for (String columnName : uniqueKeyMeta.getColumnNameList()) {
+			compositeUniqueConstraintDesc.addColumnName(columnName);
+		}
+		return compositeUniqueConstraintDesc;
+	}
+}


Property changes on: leto/jiemamy-entity-io/trunk/src/main/java/org/jiemamy/entity/io/desc/impl/CompositeUniqueConstraintDescFactoryImpl.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Added: leto/jiemamy-entity-io/trunk/src/main/java/org/jiemamy/entity/io/desc/impl/EntityDescFactoryImpl.java
===================================================================
--- leto/jiemamy-entity-io/trunk/src/main/java/org/jiemamy/entity/io/desc/impl/EntityDescFactoryImpl.java	                        (rev 0)
+++ leto/jiemamy-entity-io/trunk/src/main/java/org/jiemamy/entity/io/desc/impl/EntityDescFactoryImpl.java	2009-04-13 09:50:11 UTC (rev 3249)
@@ -0,0 +1,127 @@
+/*
+ * Copyright 2004-2009 the Seasar Foundation and the Others.
+ *
+ * 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.entity.io.desc.impl;
+
+import org.apache.commons.lang.Validate;
+
+import org.jiemamy.entity.io.desc.AttributeDesc;
+import org.jiemamy.entity.io.desc.AttributeDescFactory;
+import org.jiemamy.entity.io.desc.CompositeUniqueConstraintDesc;
+import org.jiemamy.entity.io.desc.CompositeUniqueConstraintDescFactory;
+import org.jiemamy.entity.io.desc.EntityDesc;
+import org.jiemamy.entity.io.desc.EntityDescFactory;
+import org.jiemamy.entity.io.meta.DbColumnMeta;
+import org.jiemamy.entity.io.meta.DbTableMeta;
+import org.jiemamy.entity.io.meta.DbUniqueKeyMeta;
+
+/**
+ * {@link EntityDescFactory}の実装クラスです。
+ * 
+ * @author j5ik2o
+ */
+public class EntityDescFactoryImpl implements EntityDescFactory {
+	
+	/** 属性記述のファクトリ */
+	protected AttributeDescFactory attributeDescFactory;
+	
+	/** 複合一意制約記述のファクトリ */
+	protected CompositeUniqueConstraintDescFactory compositeUniqueConstraintDescFactory;
+	
+	/** スキーマが指定されている場合{@code true} */
+	protected boolean schemaSpecified;
+	
+
+	/**
+	 * インスタンスを生成します。
+	 * 
+	 * @param compositeUniqueConstraintDescFactory 複合一意制約記述のファクトリ
+	 * @param attributeDescFactory 属性記述のファクトリ
+	 */
+	public EntityDescFactoryImpl(AttributeDescFactory attributeDescFactory,
+			CompositeUniqueConstraintDescFactory compositeUniqueConstraintDescFactory) {
+		Validate.notNull(attributeDescFactory);
+		Validate.notNull(compositeUniqueConstraintDescFactory);
+		this.attributeDescFactory = attributeDescFactory;
+		this.compositeUniqueConstraintDescFactory = compositeUniqueConstraintDescFactory;
+	}
+	
+	/**
+	 * 属性記述を処理します。
+	 * 
+	 * @param tableMeta テーブルメタデータ
+	 * @param entityDesc エンティティ記述
+	 */
+	protected void doAttributeDesc(DbTableMeta tableMeta, EntityDesc entityDesc) {
+		for (DbColumnMeta columnMeta : tableMeta.getColumnMetaList()) {
+			AttributeDesc attributeDesc = attributeDescFactory.getAttributeDesc(tableMeta, columnMeta);
+			entityDesc.addAttributeDesc(attributeDesc);
+		}
+	}
+	
+	/**
+	 * 複合一意制約記述を処理します。
+	 * 
+	 * @param tableMeta テーブルメタデータ
+	 * @param entityDesc エンティティ記述
+	 */
+	protected void doCompositeUniqueConstraintDesc(DbTableMeta tableMeta, EntityDesc entityDesc) {
+		for (DbUniqueKeyMeta uniqueKeyMeta : tableMeta.getUniqueKeyMetaList()) {
+			CompositeUniqueConstraintDesc compositeUniqueConstraintDesc =
+					compositeUniqueConstraintDescFactory.getCompositeUniqueConstraintDesc(uniqueKeyMeta);
+			if (compositeUniqueConstraintDesc != null) {
+				entityDesc.addCompositeUniqueConstraintDesc(compositeUniqueConstraintDesc);
+			}
+		}
+	}
+	
+	/**
+	 * 名前を処理します。
+	 * 
+	 * @param tableMeta テーブルメタ情報
+	 * @param entityDesc エンティティ記述
+	 */
+	protected void doName(DbTableMeta tableMeta, EntityDesc entityDesc) {
+		entityDesc.setName(fromTableNameToEntityName(tableMeta.getName()));
+	}
+	
+	/**
+	 * テーブルを処理します。
+	 * 
+	 * @param tableMeta テーブルメタ情報
+	 * @param entityDesc エンティティ記述
+	 */
+	protected void doTable(DbTableMeta tableMeta, EntityDesc entityDesc) {
+		entityDesc.setCatalogName(tableMeta.getCatalogName());
+		entityDesc.setSchemaName(tableMeta.getSchemaName());
+		entityDesc.setTableName(tableMeta.getName());
+		entityDesc.setComment(tableMeta.getComment());
+	}
+	
+	private String fromTableNameToEntityName(String name) {
+		// TODO Auto-generated method stub
+		return null;
+	}
+	
+	public EntityDesc getEntityDesc(DbTableMeta tableMeta) {
+		EntityDesc entityDesc = new EntityDesc();
+		doName(tableMeta, entityDesc);
+		doTable(tableMeta, entityDesc);
+		doAttributeDesc(tableMeta, entityDesc);
+		doCompositeUniqueConstraintDesc(tableMeta, entityDesc);
+		return entityDesc;
+	}
+	
+}


Property changes on: leto/jiemamy-entity-io/trunk/src/main/java/org/jiemamy/entity/io/desc/impl/EntityDescFactoryImpl.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Added: leto/jiemamy-entity-io/trunk/src/main/java/org/jiemamy/entity/io/desc/impl/EntitySetDescFactoryImpl.java
===================================================================
--- leto/jiemamy-entity-io/trunk/src/main/java/org/jiemamy/entity/io/desc/impl/EntitySetDescFactoryImpl.java	                        (rev 0)
+++ leto/jiemamy-entity-io/trunk/src/main/java/org/jiemamy/entity/io/desc/impl/EntitySetDescFactoryImpl.java	2009-04-13 09:50:11 UTC (rev 3249)
@@ -0,0 +1,185 @@
+/*
+ * Copyright 2004-2009 the Seasar Foundation and the Others.
+ *
+ * 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.entity.io.desc.impl;
+
+import java.io.BufferedReader;
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.IOException;
+import java.io.InputStreamReader;
+import java.util.LinkedHashMap;
+import java.util.List;
+
+import javax.persistence.GenerationType;
+
+import org.apache.commons.lang.Validate;
+
+import org.jiemamy.entity.io.desc.AttributeDescFactory;
+import org.jiemamy.entity.io.desc.CompositeUniqueConstraintDescFactory;
+import org.jiemamy.entity.io.desc.EntityDesc;
+import org.jiemamy.entity.io.desc.EntityDescFactory;
+import org.jiemamy.entity.io.desc.EntitySetDesc;
+import org.jiemamy.entity.io.desc.EntitySetDescFactory;
+import org.jiemamy.entity.io.meta.DbForeignKeyMeta;
+import org.jiemamy.entity.io.meta.DbTableMeta;
+import org.jiemamy.entity.io.meta.DbTableMetaReader;
+
+/**
+ * {@link EntitySetDescFactory}の実装クラスです。
+ * 
+ * @author taedium
+ */
+public class EntitySetDescFactoryImpl implements EntitySetDescFactory {
+	
+	/** テーブルメタデータのリーダ */
+	protected DbTableMetaReader dbTableMetaReader;
+	
+	/** バージョンカラム名のパターン */
+	protected String versionColumnNamePattern;
+	
+	/** 単語を複数系に変換するための辞書ファイル、使用しない場合は{@code null} */
+	protected File pluralFormFile;
+	
+	/** エンティティの識別子の生成方法を示す列挙型 、生成しない場合は{@code null} */
+	protected GenerationType generationType;
+	
+	/** エンティティの識別子の初期値、指定しない場合は{@code null} */
+	protected Integer initialValue;
+	
+	/** エンティティの識別子の割り当てサイズ、指定しない場合は{@code null} */
+	protected Integer allocationSize;
+	
+	/** エンティティ記述のファクトリ */
+	protected EntityDescFactory entityDescFactory;
+	
+
+	/**
+	 * インスタンスを構築します。
+	 * 
+	 * @param dbTableMetaReader テーブルメタデータのリーダ
+	 * @param versionColumnNamePattern バージョンカラム名のパターン
+	 * @param pluralFormFile 単語を複数系に変換するための辞書ファイル、使用しない場合は{@code null}
+	 * @param generationType エンティティの識別子の生成方法を示す列挙型 、生成しない場合は{@code null}
+	 * @param initialValue エンティティの識別子の初期値、指定しない場合は{@code null}
+	 * @param allocationSize エンティティの識別子の割り当てサイズ、指定しない場合は{@code null}
+	 */
+	public EntitySetDescFactoryImpl(DbTableMetaReader dbTableMetaReader, String versionColumnNamePattern,
+			File pluralFormFile, GenerationType generationType, Integer initialValue, Integer allocationSize) {
+		Validate.notNull(dbTableMetaReader);
+		Validate.notNull(versionColumnNamePattern);
+		this.dbTableMetaReader = dbTableMetaReader;
+		this.versionColumnNamePattern = versionColumnNamePattern;
+		this.pluralFormFile = pluralFormFile;
+		this.generationType = generationType;
+		this.initialValue = initialValue;
+		this.allocationSize = allocationSize;
+		entityDescFactory = createEntityDescFactory();
+	}
+	
+	/**
+	 * 関連のリゾルバを作成します。
+	 * 
+	 * @param entitySetDesc エンティティ集合記述
+	 * @param pluralFormDictinary 単語を複数形に変換するための辞書
+	 * @return 関連のリゾルバ
+	 */
+	protected AssociationResolver createAssociationResolver(EntitySetDesc entitySetDesc,
+			PluralFormDictinary pluralFormDictinary) {
+		return new AssociationResolver(entitySetDesc, pluralFormDictinary);
+	}
+	
+	/**
+	 * {@link EntityDescFactory}の実装を作成します。
+	 * 
+	 * @return {@link EntityDescFactory}の実装
+	 */
+	protected EntityDescFactory createEntityDescFactory() {
+		AttributeDescFactory attributeDescFactory =
+				new AttributeDescFactoryImpl(versionColumnNamePattern, generationType, initialValue, allocationSize);
+		CompositeUniqueConstraintDescFactory compositeUniqueConstraintDescFactory =
+				new CompositeUniqueConstraintDescFactoryImpl();
+		return new EntityDescFactoryImpl(attributeDescFactory, compositeUniqueConstraintDescFactory);
+	}
+	
+	/**
+	 * 単語を複数形に変換するための辞書を作成します。
+	 * 
+	 * @return 単語を複数形に変換するための辞書
+	 * @throws IOException 入出力が失敗した場合
+	 */
+	protected PluralFormDictinary createPluralFormDictinary() throws IOException {
+		if (pluralFormFile != null) {
+			LinkedHashMap<String, String> map = loadPluralFormFile();
+			return new PluralFormDictinary(map);
+		}
+		return new PluralFormDictinary();
+	}
+	
+	public EntitySetDesc getEntitySetDesc() throws IOException {
+		EntitySetDesc entitySetDesc = new EntitySetDesc();
+		List<DbTableMeta> dbTableMetaList = dbTableMetaReader.read();
+		for (DbTableMeta tableMeta : dbTableMetaList) {
+			EntityDesc entityDesc = entityDescFactory.getEntityDesc(tableMeta);
+			entitySetDesc.addEntityDesc(entityDesc);
+		}
+		
+		PluralFormDictinary pluralFormDictinary = createPluralFormDictinary();
+		AssociationResolver associationResolver = createAssociationResolver(entitySetDesc, pluralFormDictinary);
+		for (DbTableMeta tableMeta : dbTableMetaList) {
+			for (DbForeignKeyMeta fkMeta : tableMeta.getForeignKeyMetaList()) {
+				associationResolver.resolve(tableMeta, fkMeta);
+			}
+		}
+		return entitySetDesc;
+	}
+	
+	/**
+	 * 辞書ファイルをロードし結果を{@link LinkedHashMap}として返します。
+	 * 
+	 * @return 正規表現をキー、置換文字列を値とするマップ
+	 * @throws IOException 入出力が失敗した場合
+	 */
+	public LinkedHashMap<String, String> loadPluralFormFile() throws IOException {
+		LinkedHashMap<String, String> map = new LinkedHashMap<String, String>();
+		BufferedReader reader = null;
+		try {
+			reader = new BufferedReader(new InputStreamReader(new FileInputStream(pluralFormFile), "UTF-8"));
+			String line;
+			while ((line = reader.readLine()) != null) {
+				if (line.length() == 0) {
+					continue;
+				}
+				char firstChar = line.charAt(0);
+				if (firstChar == '#' || firstChar == '!') {
+					continue;
+				}
+				int pos = line.indexOf('=');
+				if (pos < 0) {
+					continue;
+				}
+				String key = line.substring(0, pos);
+				String value = line.substring(pos + 1, line.length());
+				map.put(key, value);
+			}
+		} finally {
+			if (reader != null) {
+				reader.close();
+			}
+		}
+		return map;
+	}
+	
+}


Property changes on: leto/jiemamy-entity-io/trunk/src/main/java/org/jiemamy/entity/io/desc/impl/EntitySetDescFactoryImpl.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Added: leto/jiemamy-entity-io/trunk/src/main/java/org/jiemamy/entity/io/desc/impl/PluralFormDictinary.java
===================================================================
--- leto/jiemamy-entity-io/trunk/src/main/java/org/jiemamy/entity/io/desc/impl/PluralFormDictinary.java	                        (rev 0)
+++ leto/jiemamy-entity-io/trunk/src/main/java/org/jiemamy/entity/io/desc/impl/PluralFormDictinary.java	2009-04-13 09:50:11 UTC (rev 3249)
@@ -0,0 +1,79 @@
+/*
+ * Copyright 2004-2009 the Seasar Foundation and the Others.
+ *
+ * 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.entity.io.desc.impl;
+
+import java.util.LinkedHashMap;
+import java.util.Map;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+
+/**
+ * 単語を複数形に変換するクラスです。
+ * 
+ * @author taedium
+ */
+public class PluralFormDictinary {
+	
+	/** {@link Pattern}をキー、置換文字列を値とするマップ */
+	protected LinkedHashMap<Pattern, String> patternMap = new LinkedHashMap<Pattern, String>();
+	
+
+	/**
+	 * インスタンスを構築します。
+	 */
+	public PluralFormDictinary() {
+	}
+	
+	/**
+	 * インスタンスを構築します。
+	 * 
+	 * @param dictinary 正規表現の文字列をキー、置換文字列を値とするマップ
+	 */
+	public PluralFormDictinary(LinkedHashMap<String, String> dictinary) {
+		for (Map.Entry<String, String> entry : dictinary.entrySet()) {
+			Pattern pattern = Pattern.compile(entry.getKey());
+			patternMap.put(pattern, entry.getValue());
+		}
+	}
+	
+	/**
+	 * 単語の複数形を検索します。
+	 * 
+	 * @param word 単語
+	 * @return 見つかれば単語の複数形、見つからなければ{@code null}
+	 */
+	public String lookup(String word) {
+		for (Map.Entry<Pattern, String> entry : patternMap.entrySet()) {
+			Pattern pattern = entry.getKey();
+			Matcher matcher = pattern.matcher(word);
+			if (!matcher.matches()) {
+				continue;
+			}
+			matcher.reset();
+			StringBuffer buf = new StringBuffer();
+			String replacement = entry.getValue();
+			for (; matcher.find();) {
+				matcher.appendReplacement(buf, replacement);
+				if (matcher.hitEnd()) {
+					break;
+				}
+			}
+			matcher.appendTail(buf);
+			return buf.toString();
+		}
+		return null;
+	}
+}


Property changes on: leto/jiemamy-entity-io/trunk/src/main/java/org/jiemamy/entity/io/desc/impl/PluralFormDictinary.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Added: leto/jiemamy-entity-io/trunk/src/main/java/org/jiemamy/entity/io/generator/DeleteEmptyFileWriter.java
===================================================================
--- leto/jiemamy-entity-io/trunk/src/main/java/org/jiemamy/entity/io/generator/DeleteEmptyFileWriter.java	                        (rev 0)
+++ leto/jiemamy-entity-io/trunk/src/main/java/org/jiemamy/entity/io/generator/DeleteEmptyFileWriter.java	2009-04-13 09:50:11 UTC (rev 3249)
@@ -0,0 +1,115 @@
+/*
+ * Copyright 2004-2009 the Seasar Foundation and the Others.
+ *
+ * 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.entity.io.generator;
+
+import java.io.File;
+import java.io.FilterWriter;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.Writer;
+
+import org.jiemamy.utils.FileInputStreamUtil;
+
+/**
+ * 空のファイルを削除する{@link Writer}の実装。
+ * 
+ * @author j5ik2o
+ */
+public class DeleteEmptyFileWriter extends FilterWriter {
+	
+	/** 書き込みが行われた場合{@code true} */
+	protected boolean written;
+	
+	/** 削除された場合{@code true} */
+	protected boolean deleted;
+	
+	/** 書き込み先のファイル */
+	protected File file;
+	
+
+	/**
+	 * インスタンスを生成する。
+	 * 
+	 * @param writer ライタ
+	 * @param file 書き込み先のファイル
+	 */
+	public DeleteEmptyFileWriter(Writer writer, File file) {
+		super(writer);
+		if (file == null) {
+			throw new NullPointerException("file");
+		}
+		this.file = file;
+	}
+	
+	@Override
+	public void close() throws IOException {
+		super.close();
+		if (!written && file.exists() && isEmpty()) {
+			deleted = file.delete();
+		}
+	}
+	
+	/**
+	 * ファイルが削除された場合のフラグを取得する。
+	 * 
+	 * @return 削除された場合{@code true}、そうでない場合{@code false}
+	 */
+	public boolean isDeleted() {
+		return deleted;
+	}
+	
+	/**
+	 * ファイルが空の場合のフラグを取得する。
+	 * 
+	 * @return ファイルが空の場合は{@code true}、そうでない場合{@code false}
+	 * @throws IOException 入出力が失敗した場合
+	 */
+	protected boolean isEmpty() throws IOException {
+		InputStream is = FileInputStreamUtil.create(file);
+		try {
+			return is.read() == -1;
+		} finally {
+			if (is != null) {
+				is.close();
+			}
+		}
+	}
+	
+	@Override
+	public void write(char[] cbuf, int off, int len) throws IOException {
+		if (len <= 0) {
+			return;
+		}
+		written = true;
+		super.write(cbuf, off, len);
+	}
+	
+	@Override
+	public void write(int c) throws IOException {
+		written = true;
+		super.write(c);
+	}
+	
+	@Override
+	public void write(String str, int off, int len) throws IOException {
+		if (len <= 0) {
+			return;
+		}
+		written = true;
+		super.write(str, off, len);
+	}
+	
+}


Property changes on: leto/jiemamy-entity-io/trunk/src/main/java/org/jiemamy/entity/io/generator/DeleteEmptyFileWriter.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Added: leto/jiemamy-entity-io/trunk/src/main/java/org/jiemamy/entity/io/generator/EntitySrcFileGenerator.java
===================================================================
--- leto/jiemamy-entity-io/trunk/src/main/java/org/jiemamy/entity/io/generator/EntitySrcFileGenerator.java	                        (rev 0)
+++ leto/jiemamy-entity-io/trunk/src/main/java/org/jiemamy/entity/io/generator/EntitySrcFileGenerator.java	2009-04-13 09:50:11 UTC (rev 3249)
@@ -0,0 +1,217 @@
+/*
+ * Copyright 2007-2009 Jiemamy Project and the Others.
+ * Created on Apr 13, 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.entity.io.generator;
+
+import java.io.BufferedWriter;
+import java.io.File;
+import java.io.FileNotFoundException;
+import java.io.FileOutputStream;
+import java.io.IOException;
+import java.io.OutputStreamWriter;
+import java.io.Writer;
+import java.nio.charset.Charset;
+import java.util.Locale;
+
+import freemarker.cache.FileTemplateLoader;
+import freemarker.cache.MultiTemplateLoader;
+import freemarker.cache.TemplateLoader;
+import freemarker.template.Configuration;
+import freemarker.template.DefaultObjectWrapper;
+import freemarker.template.Template;
+import freemarker.template.TemplateException;
+
+import org.apache.commons.lang.Validate;
+
+import org.jiemamy.utils.FileOutputStreamUtil;
+
+/**
+ * エンティティを生成するためのジェネレータクラス。
+ * 
+ * @author j5ik2o
+ */
+public class EntitySrcFileGenerator implements Generator {
+	
+	private Configuration configuration;
+	
+	/** デフォルトのテンプレートディレクトリの名前 */
+	protected static final String DEFAULT_TEMPLATE_DIR_NAME = "org/jiemamy/entity/io/tempaltes";
+	
+
+	/**
+	 * インスタンスを生成する。
+	 * 
+	 * @param configuration FreeMarkerの設定
+	 */
+	public EntitySrcFileGenerator(Configuration configuration) {
+		Validate.notNull(configuration);
+		this.configuration = configuration;
+	}
+	
+	/**
+	* インスタンスを生成する。
+	* 
+	* @param templateFileEncoding テンプレートファイルのエンコーディング
+	* @param templateFilePrimaryDir テンプレートファイルを格納したプライマリディレクトリ、プライマリディレクトリを使用しない場合{@code null}
+	 * @throws IOException 入出力が失敗した場合
+	*/
+	public EntitySrcFileGenerator(String templateFileEncoding, File templateFilePrimaryDir) throws IOException {
+		Validate.notNull(templateFileEncoding);
+		configuration = new Configuration();
+		configuration.setObjectWrapper(new DefaultObjectWrapper());
+		configuration.setSharedVariable("include", new IncludeDirective());
+		configuration.setSharedVariable("currentDate", new OnDemandDateModel());
+		configuration.setEncoding(Locale.getDefault(), templateFileEncoding);
+		configuration.setNumberFormat("0.#####");
+		configuration.setTemplateLoader(createTemplateLoader(templateFilePrimaryDir));
+	}
+	
+	/**
+	 * {@link TemplateLoader}を作成する。
+	 * 
+	 * @param templateFilePrimaryDir テンプレートファイルを格納したプライマリディレクトリ、プライマリディレクトリを使用しない場合{@code null}
+	 * @return {@link TemplateLoader}
+	 * @throws IOException 入出力が失敗した場合
+	 */
+	protected TemplateLoader createTemplateLoader(File templateFilePrimaryDir) throws IOException {
+		Validate.notNull(templateFilePrimaryDir);
+		TemplateLoader primary = null;
+		if (templateFilePrimaryDir != null) {
+			primary = new FileTemplateLoader(templateFilePrimaryDir);
+		}
+		TemplateLoader secondary = new ResourceTemplateLoader(DEFAULT_TEMPLATE_DIR_NAME);
+		if (primary == null) {
+			return secondary;
+		}
+		return new MultiTemplateLoader(new TemplateLoader[] {
+			primary,
+			secondary
+		});
+	}
+	
+	/**
+	 * {@code file}が存在する場合に{@code true}を取得する。
+	 * 
+	 * @param file ファイル
+	 * @return {@code file}が存在する場合は{@code true}、そうでない場合は{@code false}
+	 */
+	protected boolean exists(File file) {
+		Validate.notNull(file);
+		return file.exists();
+	}
+	
+	public void generate(GeneratorContext context) throws GenerateException {
+		Validate.notNull(context);
+		boolean exists = exists(context.getFile());
+		if (!context.isOverwrite() && exists) {
+			return;
+		}
+		File dir = context.getFile().getParentFile();
+		if (dir != null) {
+			mkdirs(dir);
+		}
+		Writer writer = null;
+		try {
+			writer = openWriter(context);
+		} catch (FileNotFoundException e) {
+			throw new GenerateException(e);
+		}
+		try {
+			Template template = getTemplate(context.getTemplateName());
+			process(template, context.getModel(), writer);
+		} catch (TemplateException e) {
+			throw new GenerateException(e);
+		} catch (IOException e) {
+			throw new GenerateException(e);
+		} finally {
+			if (writer != null) {
+				try {
+					writer.close();
+				} catch (IOException e) {
+					throw new GenerateException(e);
+				}
+			}
+		}
+		if (writer instanceof DeleteEmptyFileWriter) {
+			if (((DeleteEmptyFileWriter) writer).isDeleted()) {
+				return;
+			}
+		}
+	}
+	
+	/**
+	* テンプレートを取得する。
+	* 
+	* @param name テンプレートの名前
+	* @return テンプレート
+	 * @throws IOException 入出力が失敗した場合
+	*/
+	protected Template getTemplate(String name) throws IOException {
+		Validate.notNull(name);
+		return configuration.getTemplate(name);
+	}
+	
+	/**
+	 * テンプレートを取得する。
+	 * 
+	 * @param name テンプレートの名前
+	 * @return テンプレート
+	 * @throws IOException 入出力が失敗した場合
+	 */
+	protected Template getTemplate1(String name) throws IOException {
+		Validate.notNull(name);
+		return configuration.getTemplate(name);
+	}
+	
+	/**
+	 * ディレクトリを生成します。
+	 * 
+	 * @param dir ディレクトリ
+	 */
+	protected void mkdirs(File dir) {
+		dir.mkdirs();
+	}
+	
+	/**
+	 * {@link Writer}を開きます。
+	 * 
+	 * @param context コンテキスト
+	 * @return {@link Writer}
+	 * @throws FileNotFoundException ファイルが見つからなかった場合
+	 */
+	protected Writer openWriter(GeneratorContext context) throws FileNotFoundException {
+		Charset charset = Charset.forName(context.getEncoding());
+		FileOutputStream fos = FileOutputStreamUtil.create(context.getFile());
+		OutputStreamWriter osw = new OutputStreamWriter(fos, charset);
+		BufferedWriter bw = new BufferedWriter(osw);
+		return new DeleteEmptyFileWriter(bw, context.getFile());
+	}
+	
+	/**
+	 * テンプレートを処理します。
+	 * 
+	 * @param template テンプレート
+	 * @param dataModel データモデル
+	 * @param writer ライタ
+	 * @throws IOException 入出力が失敗した場合
+	 * @throws TemplateException テンプレートの処理に失敗した場合
+	 */
+	protected void process(Template template, Object dataModel, Writer writer) throws TemplateException, IOException {
+		template.process(dataModel, writer);
+	}
+}

Added: leto/jiemamy-entity-io/trunk/src/main/java/org/jiemamy/entity/io/generator/GenerateException.java
===================================================================
--- leto/jiemamy-entity-io/trunk/src/main/java/org/jiemamy/entity/io/generator/GenerateException.java	                        (rev 0)
+++ leto/jiemamy-entity-io/trunk/src/main/java/org/jiemamy/entity/io/generator/GenerateException.java	2009-04-13 09:50:11 UTC (rev 3249)
@@ -0,0 +1,65 @@
+/*
+ * Copyright 2007-2009 Jiemamy Project and the Others.
+ * Created on Apr 13, 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.entity.io.generator;
+
+/**
+ * 生成に失敗した場合の例外クラス。
+ * 
+ * @author j5ik2o
+ */
+ @ SuppressWarnings("serial")
+public class GenerateException extends Exception {
+	
+	/**
+	 * インスタンスを生成する。
+	 * 
+	 */
+	public GenerateException() {
+		super();
+	}
+	
+	/**
+	 * インスタンスを生成する。
+	 * 
+	 * @param message メッセージ
+	 */
+	public GenerateException(String message) {
+		super(message);
+	}
+	
+	/**
+	 * インスタンスを生成する。
+	 * 
+	 * @param message メッセージ
+	 * @param cause 原因
+	 */
+	public GenerateException(String message, Throwable cause) {
+		super(message, cause);
+	}
+	
+	/**
+	 * インスタンスを生成する。
+	 * 
+	 * @param cause 原因
+	 */
+	public GenerateException(Throwable cause) {
+		super(cause);
+	}
+	
+}

Modified: leto/jiemamy-entity-io/trunk/src/main/java/org/jiemamy/entity/io/generator/Generator.java
===================================================================
--- leto/jiemamy-entity-io/trunk/src/main/java/org/jiemamy/entity/io/generator/Generator.java	2009-04-13 09:46:41 UTC (rev 3248)
+++ leto/jiemamy-entity-io/trunk/src/main/java/org/jiemamy/entity/io/generator/Generator.java	2009-04-13 09:50:11 UTC (rev 3249)
@@ -18,10 +18,6 @@
  */
 package org.jiemamy.entity.io.generator;
 
-import java.io.IOException;
-
-import org.jiemamy.entity.io.generator.impl.GenerateException;
-
 /**
  * ファイルを生成するインタフェース。
  * 
@@ -33,7 +29,7 @@
 	 * ファイルを生成する。
 	 * 
 	 * @param context コンテキスト
-	 * @throws IOException 入出力が失敗した場合
+	 * @throws GenerateException 入出力が失敗した場合
 	 */
 	void generate(GeneratorContext context) throws GenerateException;
 	

Added: leto/jiemamy-entity-io/trunk/src/main/java/org/jiemamy/entity/io/generator/GeneratorContextImpl.java
===================================================================
--- leto/jiemamy-entity-io/trunk/src/main/java/org/jiemamy/entity/io/generator/GeneratorContextImpl.java	                        (rev 0)
+++ leto/jiemamy-entity-io/trunk/src/main/java/org/jiemamy/entity/io/generator/GeneratorContextImpl.java	2009-04-13 09:50:11 UTC (rev 3249)
@@ -0,0 +1,107 @@
+/*
+ * Copyright 2007-2009 Jiemamy Project and the Others.
+ * Created on Apr 13, 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.entity.io.generator;
+
+import java.io.File;
+
+
+/**
+ * {@link GeneratorContext}の実装クラス。
+ * 
+ * @author j5ik2o
+ */
+public class GeneratorContextImpl implements GeneratorContext {
+	
+	private String encoding;
+	
+	private File file;
+	
+	private Object model;
+	
+	private String templateName;
+	
+	private boolean overwrite;
+	
+
+	public String getEncoding() {
+		return encoding;
+	}
+	
+	public File getFile() {
+		return file;
+	}
+	
+	public Object getModel() {
+		return model;
+	}
+	
+	public String getTemplateName() {
+		return templateName;
+	}
+	
+	public boolean isOverwrite() {
+		return overwrite;
+	}
+	
+	/**
+	 * エンコーディングを設定する。
+	 * 
+	 * @param encoding エンコーディング
+	 */
+	public void setEncoding(String encoding) {
+		this.encoding = encoding;
+	}
+	
+	/**
+	 * 生成するファイルを設定する。
+	 * 
+	 * @param file 生成するファイル
+	 */
+	public void setFile(File file) {
+		this.file = file;
+	}
+	
+	/**
+	 * データモデルを設定する。
+	 * 
+	 * @param model データモデル
+	 */
+	public void setModel(Object model) {
+		this.model = model;
+	}
+	
+	/**
+	 * 上書きフラグを設定する。
+	 * 
+	 * @param overwrite 上書きフラグ
+	 */
+	public void setOverwrite(boolean overwrite) {
+		this.overwrite = overwrite;
+	}
+	
+	/**
+	 * テンプレート名を設定する。
+	 * 
+	 * @param templateName テンプレート名
+	 */
+	public void setTemplateName(String templateName) {
+		this.templateName = templateName;
+	}
+	
+}

Added: leto/jiemamy-entity-io/trunk/src/main/java/org/jiemamy/entity/io/generator/IncludeDirective.java
===================================================================
--- leto/jiemamy-entity-io/trunk/src/main/java/org/jiemamy/entity/io/generator/IncludeDirective.java	                        (rev 0)
+++ leto/jiemamy-entity-io/trunk/src/main/java/org/jiemamy/entity/io/generator/IncludeDirective.java	2009-04-13 09:50:11 UTC (rev 3249)
@@ -0,0 +1,65 @@
+/*
+ * Copyright 2004-2009 the Seasar Foundation and the Others.
+ *
+ * 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.entity.io.generator;
+
+import java.io.IOException;
+import java.util.Map;
+
+import freemarker.core.Environment;
+import freemarker.template.SimpleScalar;
+import freemarker.template.Template;
+import freemarker.template.TemplateDirectiveBody;
+import freemarker.template.TemplateDirectiveModel;
+import freemarker.template.TemplateException;
+import freemarker.template.TemplateModel;
+
+/**
+ * インクルードのディレクティブ。
+ * <p>
+ * インクルード先のテンプレートで任意のオブジェクトをルートのデータモデルに指定できます。
+ * </p>
+ * 
+ * @author j5ik2o
+ */
+public class IncludeDirective implements TemplateDirectiveModel {
+	
+	/** インクルードするテンプレート名のパラメータ名 */
+	protected static final String PARAM_NAME = "name";
+	
+	/** ルートモデルのパラメータ名 */
+	protected static final String PARAM_ROOT_MODEL = "rootModel";
+	
+
+	public void execute(Environment env, @SuppressWarnings("unchecked") Map params, TemplateModel[] loopVars,
+			TemplateDirectiveBody body) throws TemplateException, IOException {
+		Object name = params.get(PARAM_NAME);
+		if (name == null) {
+			throw new IllegalArgumentException("params[" + PARAM_NAME + "]");
+		}
+		if (!SimpleScalar.class.isInstance(name)) {
+			throw new IllegalArgumentException("params[" + PARAM_NAME + "]");
+		}
+		Object rootModel = params.get(PARAM_ROOT_MODEL);
+		if (rootModel == null) {
+			throw new IllegalArgumentException("params[" + PARAM_ROOT_MODEL + "]");
+		}
+		Template template = env.getTemplateForInclusion(((SimpleScalar) name).getAsString(), null, true);
+		template.process(rootModel, env.getOut());
+		if (body != null) {
+			body.render(env.getOut());
+		}
+	}
+}


Property changes on: leto/jiemamy-entity-io/trunk/src/main/java/org/jiemamy/entity/io/generator/IncludeDirective.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Added: leto/jiemamy-entity-io/trunk/src/main/java/org/jiemamy/entity/io/generator/OnDemandDateModel.java
===================================================================
--- leto/jiemamy-entity-io/trunk/src/main/java/org/jiemamy/entity/io/generator/OnDemandDateModel.java	                        (rev 0)
+++ leto/jiemamy-entity-io/trunk/src/main/java/org/jiemamy/entity/io/generator/OnDemandDateModel.java	2009-04-13 09:50:11 UTC (rev 3249)
@@ -0,0 +1,37 @@
+/*
+ * Copyright 2004-2009 the Seasar Foundation and the Others.
+ *
+ * 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.entity.io.generator;
+
+import java.util.Date;
+
+import freemarker.template.TemplateDateModel;
+import freemarker.template.TemplateModelException;
+
+/**
+ * 必要とされるたびに{@link Date}を生成する{@link TemplateDateModel}の実装。
+ * 
+ * @author j5ik2o
+ */
+public class OnDemandDateModel implements TemplateDateModel {
+	
+	public Date getAsDate() throws TemplateModelException {
+		return new Date();
+	}
+	
+	public int getDateType() {
+		return UNKNOWN;
+	}
+}


Property changes on: leto/jiemamy-entity-io/trunk/src/main/java/org/jiemamy/entity/io/generator/OnDemandDateModel.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Added: leto/jiemamy-entity-io/trunk/src/main/java/org/jiemamy/entity/io/generator/ResourceTemplateLoader.java
===================================================================
--- leto/jiemamy-entity-io/trunk/src/main/java/org/jiemamy/entity/io/generator/ResourceTemplateLoader.java	                        (rev 0)
+++ leto/jiemamy-entity-io/trunk/src/main/java/org/jiemamy/entity/io/generator/ResourceTemplateLoader.java	2009-04-13 09:50:11 UTC (rev 3249)
@@ -0,0 +1,58 @@
+/*
+ * Copyright 2004-2009 the Seasar Foundation and the Others.
+ *
+ * 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.entity.io.generator;
+
+import java.net.URL;
+
+import freemarker.cache.TemplateLoader;
+import freemarker.cache.URLTemplateLoader;
+
+import org.apache.commons.lang.Validate;
+
+import org.jiemamy.utils.ResourceUtil;
+
+/**
+ * リソースを扱う{@link TemplateLoader}の実装クラス。
+ * <p>
+ * JARファイルに含まれたリソースを扱う。
+ * </p>
+ * 
+ * @author j5ik2o
+ */
+public class ResourceTemplateLoader extends URLTemplateLoader {
+	
+	/** ベースとなるパス */
+	protected String basePath;
+	
+
+	/**
+	 * インスタンスを生成する。
+	 * 
+	 * @param basePath ベースとなるパス
+	 */
+	public ResourceTemplateLoader(String basePath) {
+		Validate.notNull(basePath);
+		this.basePath = basePath;
+	}
+	
+	@Override
+	protected URL getURL(String name) {
+		Validate.notNull(name);
+		String path = basePath + "/" + name;
+		return ResourceUtil.getResourceNoException(path);
+	}
+	
+}


Property changes on: leto/jiemamy-entity-io/trunk/src/main/java/org/jiemamy/entity/io/generator/ResourceTemplateLoader.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Added: leto/jiemamy-entity-io/trunk/src/main/java/org/jiemamy/entity/io/meta/DbColumnMeta.java
===================================================================
--- leto/jiemamy-entity-io/trunk/src/main/java/org/jiemamy/entity/io/meta/DbColumnMeta.java	                        (rev 0)
+++ leto/jiemamy-entity-io/trunk/src/main/java/org/jiemamy/entity/io/meta/DbColumnMeta.java	2009-04-13 09:50:11 UTC (rev 3249)
@@ -0,0 +1,258 @@
+/*
+ * Copyright 2004-2009 the Seasar Foundation and the Others.
+ *
+ * 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.entity.io.meta;
+
+/**
+ * データベースのカラムメタデータです。
+ * 
+ * @author taedium
+ */
+public class DbColumnMeta {
+	
+	/** 名前 */
+	protected String name;
+	
+	/** SQL型 */
+	protected int sqlType;
+	
+	/** 型名 */
+	protected String typeName;
+	
+	/** 長さ */
+	protected int length;
+	
+	/** スケール */
+	protected int scale;
+	
+	/** デフォルト値 */
+	protected String defaultValue;
+	
+	/** NULL可能の場合{@code true} */
+	protected boolean nullable;
+	
+	/** 主キーの場合{@code true} */
+	protected boolean primaryKey;
+	
+	/** 値が自動的に増分される場合{@code true} */
+	protected boolean autoIncrement;
+	
+	/** 一意の場合{@code true} */
+	protected boolean unique;
+	
+	/** コメント */
+	protected String comment;
+	
+
+	/**
+	 * コメントを返します。
+	 * 
+	 * @return コメント
+	 */
+	public String getComment() {
+		return comment;
+	}
+	
+	/**
+	 * デフォルト値を返します。
+	 * 
+	 * @return デフォルト値
+	 */
+	public String getDefaultValue() {
+		return defaultValue;
+	}
+	
+	/**
+	 * 長さを返します。
+	 * 
+	 * @return 長さ
+	 */
+	public int getLength() {
+		return length;
+	}
+	
+	/**
+	 * 名前を返します。
+	 * 
+	 * @return 名前
+	 */
+	public String getName() {
+		return name;
+	}
+	
+	/**
+	 * スケールを返します。
+	 * 
+	 * @return スケール
+	 */
+	public int getScale() {
+		return scale;
+	}
+	
+	/**
+	 * SQL型を返します。
+	 * 
+	 * @return SQL型
+	 */
+	public int getSqlType() {
+		return sqlType;
+	}
+	
+	/**
+	 * 型名を返します。
+	 * 
+	 * @return 型名
+	 */
+	public String getTypeName() {
+		return typeName;
+	}
+	
+	/**
+	 * 値が自動的に増分される場合{@code true}を返します。
+	 * 
+	 * @return 値が自動的に増分される場合{@code true}、そうでない場合{@code false}
+	 */
+	public boolean isAutoIncrement() {
+		return autoIncrement;
+	}
+	
+	/**
+	 * NULL可能の場合{@code true}を返します。
+	 * 
+	 * @return NULL可能の場合{@code true}、そうでない場合{@code false}
+	 */
+	public boolean isNullable() {
+		return nullable;
+	}
+	
+	/**
+	 * 主キーの場合{@code true}を返します。
+	 * 
+	 * @return 主キーの場合{@code true}、そうでない場合{@code false}
+	 */
+	public boolean isPrimaryKey() {
+		return primaryKey;
+	}
+	
+	/**
+	 * 一意の場合{@code true}、そうでない場合{@code false}を返します。
+	 * 
+	 * @return 一意の場合{@code true}、そうでない場合{@code false}
+	 */
+	public boolean isUnique() {
+		return unique;
+	}
+	
+	/**
+	 * 値が自動的に増分される場合{@code true}を設定します。
+	 * 
+	 * @param autoIncrement 値が自動的に増分される場合{@code true}、そうでない場合{@code false}
+	 */
+	public void setAutoIncrement(boolean autoIncrement) {
+		this.autoIncrement = autoIncrement;
+	}
+	
+	/**
+	 * コメントを設定します。
+	 * 
+	 * @param comment コメント
+	 */
+	public void setComment(String comment) {
+		this.comment = comment;
+	}
+	
+	/**
+	 * デフォルト値を設定します
+	 * 
+	 * @param defaultValue デフォルト値
+	 */
+	public void setDefaultValue(String defaultValue) {
+		this.defaultValue = defaultValue;
+	}
+	
+	/**
+	 * 長さを設定します。
+	 * 
+	 * @param length 長さ
+	 */
+	public void setLength(int length) {
+		this.length = length;
+	}
+	
+	/**
+	 * 名前を設定します。
+	 * 
+	 * @param name 名前
+	 */
+	public void setName(String name) {
+		this.name = name;
+	}
+	
+	/**
+	 * NULL可能の場合{@code true}を設定します。
+	 * 
+	 * @param nullable NULL可能の場合{@code true}
+	 */
+	public void setNullable(boolean nullable) {
+		this.nullable = nullable;
+	}
+	
+	/**
+	 * 主キーの場合 {@code true}を設定します。
+	 * 
+	 * @param primaryKey 主キーの場合 {@code true}
+	 * 
+	 */
+	public void setPrimaryKey(boolean primaryKey) {
+		this.primaryKey = primaryKey;
+	}
+	
+	/**
+	 * スケールを設定します。
+	 * 
+	 * @param scale スケール
+	 */
+	public void setScale(int scale) {
+		this.scale = scale;
+	}
+	
+	/**
+	 * SQL型をセットします。
+	 * 
+	 * @param sqlType SQL型
+	 */
+	public void setSqlType(int sqlType) {
+		this.sqlType = sqlType;
+	}
+	
+	/**
+	 * SQL型の名前を設定します。
+	 * 
+	 * @param typeName SQL型の名前
+	 */
+	public void setTypeName(String typeName) {
+		this.typeName = typeName;
+	}
+	
+	/**
+	 * 一意の場合{@code true}、そうでない場合{@code false}を設定します。
+	 * 
+	 * @param unique 一意の場合{@code true}
+	 */
+	public void setUnique(boolean unique) {
+		this.unique = unique;
+	}
+	
+}


Property changes on: leto/jiemamy-entity-io/trunk/src/main/java/org/jiemamy/entity/io/meta/DbColumnMeta.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Added: leto/jiemamy-entity-io/trunk/src/main/java/org/jiemamy/entity/io/meta/DbForeignKeyMeta.java
===================================================================
--- leto/jiemamy-entity-io/trunk/src/main/java/org/jiemamy/entity/io/meta/DbForeignKeyMeta.java	                        (rev 0)
+++ leto/jiemamy-entity-io/trunk/src/main/java/org/jiemamy/entity/io/meta/DbForeignKeyMeta.java	2009-04-13 09:50:11 UTC (rev 3249)
@@ -0,0 +1,201 @@
+/*
+ * Copyright 2004-2009 the Seasar Foundation and the Others.
+ *
+ * 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.entity.io.meta;
+
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+
+/**
+ * データベースの外部キーメタデータです。
+ * 
+ * @author j5ik2o
+ */
+public class DbForeignKeyMeta {
+	
+	/** 名前 */
+	protected String name;
+	
+	/** 主キー側のカタログ名 */
+	protected String primaryKeyCatalogName;
+	
+	/** 主キー側のスキーマ名 */
+	protected String primaryKeySchemaName;
+	
+	/** 主キー側のテーブル名 */
+	protected String primaryKeyTableName;
+	
+	/** 主キーのカラム名のリスト */
+	protected List<String> primaryKeyColumnNameList = new ArrayList<String>();
+	
+	/** 外部キーのカラム名のリスト */
+	protected List<String> foreignKeyColumnNameList = new ArrayList<String>();
+	
+	/** 一意の場合{@code true} */
+	protected boolean unique;
+	
+
+	/**
+	 * 外部キーのカラム名を追加します。
+	 * 
+	 * @param foreignKeyColumnName 外部キーのカラム名
+	 */
+	public void addForeignKeyColumnName(String foreignKeyColumnName) {
+		foreignKeyColumnNameList.add(foreignKeyColumnName);
+	}
+	
+	/**
+	 * 主キーのカラム名を追加します。
+	 * 
+	 * @param primaryKeyColumnName 主キーのカラム名
+	 */
+	public void addPrimaryKeyColumnName(String primaryKeyColumnName) {
+		primaryKeyColumnNameList.add(primaryKeyColumnName);
+	}
+	
+	/**
+	 * 外部キーのカラム名のリストを返します。
+	 * 
+	 * @return 外部キーのカラム名のリスト
+	 */
+	public List<String> getForeignKeyColumnNameList() {
+		return Collections.unmodifiableList(foreignKeyColumnNameList);
+	}
+	
+	/**
+	 * 名前を返します。
+	 * 
+	 * @return 名前
+	 */
+	public String getName() {
+		return name;
+	}
+	
+	/**
+	 * 主キー側のカタログ名を返します。
+	 * 
+	 * @return 主キー側のカタログ名
+	 */
+	public String getPrimaryKeyCatalogName() {
+		return primaryKeyCatalogName;
+	}
+	
+	/**
+	 * 主キーのカラム名のリストを返します。
+	 * 
+	 * @return 主キーのカラム名のリスト
+	 */
+	public List<String> getPrimaryKeyColumnNameList() {
+		return Collections.unmodifiableList(primaryKeyColumnNameList);
+	}
+	
+	/**
+	 * 完全なテーブル名を返します。
+	 * 
+	 * @return 完全なテーブル名
+	 */
+	public String getPrimaryKeyFullTableName() {
+		StringBuilder buf = new StringBuilder();
+		if (primaryKeyCatalogName != null) {
+			buf.append(primaryKeyCatalogName).append(".");
+		}
+		if (primaryKeySchemaName != null) {
+			buf.append(primaryKeySchemaName).append(".");
+		}
+		return buf.append(primaryKeyTableName).toString();
+	}
+	
+	/**
+	 * 主キー側のスキーマ名を返します。
+	 * 
+	 * @return 主キー側のスキーマ名
+	 */
+	public String getPrimaryKeySchemaName() {
+		return primaryKeySchemaName;
+	}
+	
+	/**
+	 * 主キー側のテーブル名を返します。
+	 * 
+	 * @return 主キー側のテーブル名
+	 */
+	public String getPrimaryKeyTableName() {
+		return primaryKeyTableName;
+	}
+	
+	/**
+	 * 複合外部キーの場合{@code true}、そうでない場合{@code false}を返します。
+	 * 
+	 * @return 複合外部キーの場合{@code true}、そうでない場合{@code false}
+	 */
+	public boolean isComposite() {
+		return foreignKeyColumnNameList.size() > 1;
+	}
+	
+	/**
+	 * 一意の場合{@code true}、そうでない場合{@code false}を返します。
+	 * 
+	 * @return 一意の場合{@code true}、そうでない場合{@code false}
+	 */
+	public boolean isUnique() {
+		return unique;
+	}
+	
+	/**
+	 * 名前を設定します。
+	 * 
+	 * @param name 名前
+	 */
+	public void setName(String name) {
+		this.name = name;
+	}
+	
+	/**
+	 * 主キー側のカタログ名を設定します。
+	 * 
+	 * @param primaryKeyCatalogName 主キー側のカタログ名
+	 */
+	public void setPrimaryKeyCatalogName(String primaryKeyCatalogName) {
+		this.primaryKeyCatalogName = primaryKeyCatalogName;
+	}
+	
+	/**
+	 * 主キー側のスキーマ名を設定します。
+	 * 
+	 * @param primaryKeySchemaName 主キー側のスキーマ名
+	 */
+	public void setPrimaryKeySchemaName(String primaryKeySchemaName) {
+		this.primaryKeySchemaName = primaryKeySchemaName;
+	}
+	
+	/**
+	 * 主キー側のテーブル名を設定します。
+	 * 
+	 * @param primaryKeyTableName 主キー側のテーブル名
+	 */
+	public void setPrimaryKeyTableName(String primaryKeyTableName) {
+		this.primaryKeyTableName = primaryKeyTableName;
+	}
+	
+	/**
+	 * 一意の場合{@code true}、そうでない場合{@code false}を設定します。
+	 * 
+	 * @param unique 一意の場合{@code true}
+	 */
+	public void setUnique(boolean unique) {
+		this.unique = unique;
+	}
+}


Property changes on: leto/jiemamy-entity-io/trunk/src/main/java/org/jiemamy/entity/io/meta/DbForeignKeyMeta.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Added: leto/jiemamy-entity-io/trunk/src/main/java/org/jiemamy/entity/io/meta/DbTableMeta.java
===================================================================
--- leto/jiemamy-entity-io/trunk/src/main/java/org/jiemamy/entity/io/meta/DbTableMeta.java	                        (rev 0)
+++ leto/jiemamy-entity-io/trunk/src/main/java/org/jiemamy/entity/io/meta/DbTableMeta.java	2009-04-13 09:50:11 UTC (rev 3249)
@@ -0,0 +1,221 @@
+/*
+ * Copyright 2004-2009 the Seasar Foundation and the Others.
+ *
+ * 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.entity.io.meta;
+
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+
+/**
+ * データベースのテーブルメタデータ。
+ * 
+ * @author j5ik2o
+ */
+public class DbTableMeta {
+	
+	/** カタログ名 */
+	protected String catalogName;
+	
+	/** スキーマ名 */
+	protected String schemaName;
+	
+	/** 名前 */
+	protected String name;
+	
+	/** 完全な名前 */
+	protected String fullName;
+	
+	/** コメント */
+	protected String comment;
+	
+	/** カラムメタデータのリスト */
+	protected List<DbColumnMeta> columnMetaList = new ArrayList<DbColumnMeta>();
+	
+	/** 主キーのカラムメタデータのリスト */
+	protected List<DbColumnMeta> primaryKeyColumnMetaList = new ArrayList<DbColumnMeta>();
+	
+	/** 外部キーメタデータのリスト */
+	protected List<DbForeignKeyMeta> foreignKeyMetaList = new ArrayList<DbForeignKeyMeta>();
+	
+	/** 一意キーメタデータのリスト */
+	protected List<DbUniqueKeyMeta> uniqueKeyMetaList = new ArrayList<DbUniqueKeyMeta>();
+	
+
+	/**
+	 * カラムのメタデータを追加する。
+	 * 
+	 * @param columnDesc カラム記述
+	 */
+	public void addColumnMeta(DbColumnMeta columnDesc) {
+		columnMetaList.add(columnDesc);
+		if (columnDesc.isPrimaryKey()) {
+			primaryKeyColumnMetaList.add(columnDesc);
+		}
+	}
+	
+	/**
+	 * 外部キーメタデータを追加する。
+	 * 
+	 * @param foreignKeyMeta 外部キーメタデータ
+	 */
+	public void addForeignKeyMeta(DbForeignKeyMeta foreignKeyMeta) {
+		foreignKeyMetaList.add(foreignKeyMeta);
+	}
+	
+	/**
+	 * 一意キーメタデータを追加する。
+	 * 
+	 * @param uniqueKeyMeta 一意キーメタデータ
+	 */
+	public void addUniqueKeyMeta(DbUniqueKeyMeta uniqueKeyMeta) {
+		uniqueKeyMetaList.add(uniqueKeyMeta);
+	}
+	
+	/**
+	 * カタログ名を返します。
+	 * 
+	 * @return カタログ名
+	 */
+	public String getCatalogName() {
+		return catalogName;
+	}
+	
+	/**
+	 * カラムのメタデータのリストを返します。
+	 * 
+	 * @return カラムのメタデータのリスト
+	 */
+	public List<DbColumnMeta> getColumnMetaList() {
+		return Collections.unmodifiableList(columnMetaList);
+	}
+	
+	/**
+	 * コメントを取得する。
+	 * 
+	 * @return コメント
+	 */
+	public String getComment() {
+		return comment;
+	}
+	
+	/**
+	 * 外部キーメタデータのリストを取得する。
+	 * 
+	 * @return 外部キーメタデータのリスト
+	 */
+	public List<DbForeignKeyMeta> getForeignKeyMetaList() {
+		return Collections.unmodifiableList(foreignKeyMetaList);
+	}
+	
+	/**
+	 * 完全なテーブル名を取得する。
+	 * 
+	 * @return 完全なテーブル名
+	 */
+	public String getFullName() {
+		return fullName;
+	}
+	
+	/**
+	 * 名前を取得する。
+	 * 
+	 * @return 名前
+	 */
+	public String getName() {
+		return name;
+	}
+	
+	/**
+	 * 主キーのカラムメタデータのリストを取得する。
+	 * 
+	 * @return 主キーのカラムメタデータのリスト
+	 */
+	public List<DbColumnMeta> getPrimaryKeyColumnMetaList() {
+		return Collections.unmodifiableList(primaryKeyColumnMetaList);
+	}
+	
+	/**
+	 * スキーマ名を取得する。
+	 * 
+	 * @return スキーマ名
+	 */
+	public String getSchemaName() {
+		return schemaName;
+	}
+	
+	/**
+	 * 一意キーメタデータのリストを取得する。
+	 * 
+	 * @return 一意キーメタデータのリスト
+	 */
+	public List<DbUniqueKeyMeta> getUniqueKeyMetaList() {
+		return Collections.unmodifiableList(uniqueKeyMetaList);
+	}
+	
+	/**
+	 * 複合主キーを持つ場合{@code true}を取得する。
+	 * 
+	 * @return 複合主キーを持つ場合{@code true}、そうでない場合{@code false}
+	 */
+	public boolean hasCompositePrimaryKey() {
+		return primaryKeyColumnMetaList.size() > 1;
+	}
+	
+	/**
+	 * カタログ名を設定する。
+	 * 
+	 * @param catalogName カタログ名
+	 */
+	public void setCatalogName(String catalogName) {
+		this.catalogName = catalogName;
+	}
+	
+	/**
+	 * コメントを設定する。
+	 * 
+	 * @param comment コメント
+	 */
+	public void setComment(String comment) {
+		this.comment = comment;
+	}
+	
+	/**
+	 * 完全な名前を設定する。
+	 * 
+	 * @param fullName 完全な名前
+	 */
+	public void setFullName(String fullName) {
+		this.fullName = fullName;
+	}
+	
+	/**
+	 * 名前を設定する。
+	 * 
+	 * @param name 名前
+	 */
+	public void setName(String name) {
+		this.name = name;
+	}
+	
+	/**
+	 * スキーマ名を設定する。
+	 * 
+	 * @param schemaName スキーマ名
+	 */
+	public void setSchemaName(String schemaName) {
+		this.schemaName = schemaName;
+	}
+}


Property changes on: leto/jiemamy-entity-io/trunk/src/main/java/org/jiemamy/entity/io/meta/DbTableMeta.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Added: leto/jiemamy-entity-io/trunk/src/main/java/org/jiemamy/entity/io/meta/DbTableMetaReader.java
===================================================================
--- leto/jiemamy-entity-io/trunk/src/main/java/org/jiemamy/entity/io/meta/DbTableMetaReader.java	                        (rev 0)
+++ leto/jiemamy-entity-io/trunk/src/main/java/org/jiemamy/entity/io/meta/DbTableMetaReader.java	2009-04-13 09:50:11 UTC (rev 3249)
@@ -0,0 +1,33 @@
+/*
+ * Copyright 2004-2009 the Seasar Foundation and the Others.
+ *
+ * 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.entity.io.meta;
+
+import java.util.List;
+
+/**
+ * {@link DbTableMeta データベースのテーブルメタデータ}を読み取るインタフェースです。
+ * 
+ * @author taedium
+ */
+public interface DbTableMetaReader {
+
+    /**
+     * データベースのテーブルメタデータを読み取ります。
+     * 
+     * @return テーブルメタデータのリスト
+     */
+    List<DbTableMeta> read();
+}


Property changes on: leto/jiemamy-entity-io/trunk/src/main/java/org/jiemamy/entity/io/meta/DbTableMetaReader.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Added: leto/jiemamy-entity-io/trunk/src/main/java/org/jiemamy/entity/io/meta/DbUniqueKeyMeta.java
===================================================================
--- leto/jiemamy-entity-io/trunk/src/main/java/org/jiemamy/entity/io/meta/DbUniqueKeyMeta.java	                        (rev 0)
+++ leto/jiemamy-entity-io/trunk/src/main/java/org/jiemamy/entity/io/meta/DbUniqueKeyMeta.java	2009-04-13 09:50:11 UTC (rev 3249)
@@ -0,0 +1,102 @@
+/*
+ * Copyright 2004-2009 the Seasar Foundation and the Others.
+ *
+ * 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.entity.io.meta;
+
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+
+/**
+ * データベースの一意キーメタデータです。
+ * 
+ * @author j5ik2o
+ */
+public class DbUniqueKeyMeta {
+	
+	/** 名前 */
+	protected String name;
+	
+	/** 主キーの場合{@code true} */
+	protected boolean primaryKey;
+	
+	/** カラム名 */
+	protected List<String> columnNameList = new ArrayList<String>();
+	
+
+	/**
+	 * カラム名を追加します。
+	 * 
+	 * @param columnName カラム名
+	 */
+	public void addColumnName(String columnName) {
+		columnNameList.add(columnName);
+	}
+	
+	/**
+	 * カラム名のリストを返します。
+	 * 
+	 * @return カラム名のリスト
+	 */
+	public List<String> getColumnNameList() {
+		return Collections.unmodifiableList(columnNameList);
+	}
+	
+	/**
+	 * 名前を返します。
+	 * 
+	 * @return 名前
+	 */
+	public String getName() {
+		return name;
+	}
+	
+	/**
+	 * 複合一意キーの場合{@code true}、そうでない場合{@code false}を返します。
+	 * 
+	 * @return 複合一意キーの場合{@code true}、そうでない場合{@code false}
+	 */
+	public boolean isComposite() {
+		return columnNameList.size() > 1;
+	}
+	
+	/**
+	 * 主キーの場合{@code true}、そうでない場合{@code false}を返します。
+	 * 
+	 * @return 主キーの場合{@code true}、そうでない場合{@code false}
+	 */
+	public boolean isPrimaryKey() {
+		return primaryKey;
+	}
+	
+	/**
+	 * 名前を設定します。
+	 * 
+	 * @param name 名前
+	 */
+	public void setName(String name) {
+		this.name = name;
+	}
+	
+	/**
+	 * 主キーの場合{@code true}、そうでない場合{@code false}を設定します。
+	 * 
+	 * @param primaryKey 主キーの場合{@code true}、そうでない場合{@code false}
+	 */
+	public void setPrimaryKey(boolean primaryKey) {
+		this.primaryKey = primaryKey;
+	}
+	
+}


Property changes on: leto/jiemamy-entity-io/trunk/src/main/java/org/jiemamy/entity/io/meta/DbUniqueKeyMeta.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Deleted: leto/jiemamy-entity-io/trunk/src/main/java/org/jiemamy/entity/io/meta/Generator.java
===================================================================
--- leto/jiemamy-entity-io/trunk/src/main/java/org/jiemamy/entity/io/meta/Generator.java	2009-04-13 09:46:41 UTC (rev 3248)
+++ leto/jiemamy-entity-io/trunk/src/main/java/org/jiemamy/entity/io/meta/Generator.java	2009-04-13 09:50:11 UTC (rev 3249)
@@ -1,35 +0,0 @@
-/*
- * Copyright 2007-2009 Jiemamy Project and the Others.
- * Created on Apr 13, 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.entity.io.meta;
-
-/**
- * ファイルを生成するインタフェース。
- * 
- * @author j5ik2o
- */
-public interface Generator {
-	
-	/**
-	 * ファイルを生成する。
-	 * 
-	 * @param context コンテキスト
-	 */
-	void generate(GeneratorContext context);
-	
-}

Deleted: leto/jiemamy-entity-io/trunk/src/main/java/org/jiemamy/entity/io/meta/GeneratorContext.java
===================================================================
--- leto/jiemamy-entity-io/trunk/src/main/java/org/jiemamy/entity/io/meta/GeneratorContext.java	2009-04-13 09:46:41 UTC (rev 3248)
+++ leto/jiemamy-entity-io/trunk/src/main/java/org/jiemamy/entity/io/meta/GeneratorContext.java	2009-04-13 09:50:11 UTC (rev 3249)
@@ -1,64 +0,0 @@
-/*
- * Copyright 2007-2009 Jiemamy Project and the Others.
- * Created on Apr 13, 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.entity.io.meta;
-
-import java.io.File;
-
-/**
- * {@link Generator}のためのコンテキストインターフェイス。
- * 
- * @author j5ik2o
- */
-public interface GeneratorContext {
-	
-	/**
-	 * エンコーディングを取得する。
-	 * 
-	 * @return エンコーディング
-	 */
-	String getEncoding();
-	
-	/**
-	 * 生成するファイルを取得する。
-	 * 
-	 * @return 生成するファイル
-	 */
-	File getFile();
-	
-	/**
-	 * データモデルを取得する。
-	 * 
-	 * @return データモデル
-	 */
-	Object getModel();
-	
-	/**
-	 * テンプレート名を取得する。
-	 * 
-	 * @return テンプレート名
-	 */
-	String getTemplateName();
-	
-	/**
-	 * 上書きフラグを取得する。
-	 * 
-	 * @return 上書きする場合は{@code true}、しない場合は{@code false}
-	 */
-	boolean isOverwrite();
-}

Deleted: leto/jiemamy-entity-io/trunk/src/main/java/org/jiemamy/entity/io/meta/impl/EntityGenerator.java
===================================================================
--- leto/jiemamy-entity-io/trunk/src/main/java/org/jiemamy/entity/io/meta/impl/EntityGenerator.java	2009-04-13 09:46:41 UTC (rev 3248)
+++ leto/jiemamy-entity-io/trunk/src/main/java/org/jiemamy/entity/io/meta/impl/EntityGenerator.java	2009-04-13 09:50:11 UTC (rev 3249)
@@ -1,35 +0,0 @@
-/*
- * Copyright 2007-2009 Jiemamy Project and the Others.
- * Created on Apr 13, 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.entity.io.meta.impl;
-
-import org.jiemamy.entity.io.meta.Generator;
-import org.jiemamy.entity.io.meta.GeneratorContext;
-
-/**
- * エンティティを生成するためのジェネレータクラス。
- * 
- * @author j5ik2o
- */
-public class EntityGenerator implements Generator {
-	
-	public void generate(GeneratorContext context) {
-		// TODO Auto-generated method stub
-	}
-	
-}

Modified: leto/jiemamy-entity-io/trunk/src/main/java/org/jiemamy/entity/io/meta/impl/EntityMetaWriterImpl.java
===================================================================
--- leto/jiemamy-entity-io/trunk/src/main/java/org/jiemamy/entity/io/meta/impl/EntityMetaWriterImpl.java	2009-04-13 09:46:41 UTC (rev 3248)
+++ leto/jiemamy-entity-io/trunk/src/main/java/org/jiemamy/entity/io/meta/impl/EntityMetaWriterImpl.java	2009-04-13 09:50:11 UTC (rev 3249)
@@ -24,10 +24,14 @@
 
 import org.apache.commons.lang.Validate;
 
+import org.jiemamy.entity.io.generator.EntitySrcFileGenerator;
+import org.jiemamy.entity.io.generator.GenerateException;
+import org.jiemamy.entity.io.generator.Generator;
+import org.jiemamy.entity.io.generator.GeneratorContextImpl;
 import org.jiemamy.entity.io.meta.EntityMeta;
 import org.jiemamy.entity.io.meta.EntityMetaWriter;
 import org.jiemamy.entity.io.meta.EntityMetaWriterContext;
-import org.jiemamy.entity.io.meta.Generator;
+import org.jiemamy.entity.io.model.EntityModel;
 import org.jiemamy.utils.StringUtil;
 
 /**
@@ -37,7 +41,7 @@
  */
 public class EntityMetaWriterImpl implements EntityMetaWriter {
 	
-	private Generator generator = new EntityGenerator();
+	private Generator generator;
 	
 	private EntityMetaWriterContext entityMetaWriterContext;
 	
@@ -54,8 +58,19 @@
 		this.entityMetaWriterContext = entityMetaWriterContext;
 	}
 	
+	private EntityModel convertModel(EntityMeta entityMeta) {
+		EntityModel entityModel = new EntityModel();
+		entityModel.setTableName(entityMeta.getTableMeta().getName());
+		entityModel.setCatalogName(entityMeta.getTableMeta().getCatalog());
+		entityModel.setSchemaName(entityMeta.getTableMeta().getSchema());
+		entityModel.setPackageName(entityMeta.getEntityClass().getPackage().getName());
+		entityModel.setShortClassName(entityMeta.getEntityClass().getSimpleName());
+		return null;
+	}
+	
 	public void write(List<EntityMeta> entityMetaList) throws IOException {
 		Validate.notNull(entityMetaList);
+		generator = new EntitySrcFileGenerator("UTF-8", null);
 		GeneratorContextImpl context = new GeneratorContextImpl();
 		context.setEncoding(entityMetaWriterContext.getJavaFileEncoding());
 		context.setOverwrite(entityMetaWriterContext.getOverwrite());
@@ -63,8 +78,13 @@
 		for (EntityMeta entityMeta : entityMetaList) {
 			String fileName = String.format("%s.java", StringUtil.capitalize(entityMeta.getName()));
 			context.setFile(new File(fileName));
-			context.setModel(entityMeta);
-			generator.generate(context);
+			Object model = convertModel(entityMeta);
+			context.setModel(model);
+			try {
+				generator.generate(context);
+			} catch (GenerateException e) {
+				throw new IOException();
+			}
 		}
 	}
 }

Deleted: leto/jiemamy-entity-io/trunk/src/main/java/org/jiemamy/entity/io/meta/impl/GeneratorContextImpl.java
===================================================================
--- leto/jiemamy-entity-io/trunk/src/main/java/org/jiemamy/entity/io/meta/impl/GeneratorContextImpl.java	2009-04-13 09:46:41 UTC (rev 3248)
+++ leto/jiemamy-entity-io/trunk/src/main/java/org/jiemamy/entity/io/meta/impl/GeneratorContextImpl.java	2009-04-13 09:50:11 UTC (rev 3249)
@@ -1,108 +0,0 @@
-/*
- * Copyright 2007-2009 Jiemamy Project and the Others.
- * Created on Apr 13, 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.entity.io.meta.impl;
-
-import java.io.File;
-
-import org.jiemamy.entity.io.meta.GeneratorContext;
-
-/**
- * {@link GeneratorContext}の実装クラス。
- * 
- * @author j5ik2o
- */
-public class GeneratorContextImpl implements GeneratorContext {
-	
-	private String encoding;
-	
-	private File file;
-	
-	private Object model;
-	
-	private String templateName;
-	
-	private boolean overwrite;
-	
-
-	public String getEncoding() {
-		return encoding;
-	}
-	
-	public File getFile() {
-		return file;
-	}
-	
-	public Object getModel() {
-		return model;
-	}
-	
-	public String getTemplateName() {
-		return templateName;
-	}
-	
-	public boolean isOverwrite() {
-		return overwrite;
-	}
-	
-	/**
-	 * エンコーディングを設定する。
-	 * 
-	 * @param encoding エンコーディング
-	 */
-	public void setEncoding(String encoding) {
-		this.encoding = encoding;
-	}
-	
-	/**
-	 * 生成するファイルを設定する。
-	 * 
-	 * @param file 生成するファイル
-	 */
-	public void setFile(File file) {
-		this.file = file;
-	}
-	
-	/**
-	 * データモデルを設定する。
-	 * 
-	 * @param model データモデル
-	 */
-	public void setModel(Object model) {
-		this.model = model;
-	}
-	
-	/**
-	 * 上書きフラグを設定する。
-	 * 
-	 * @param overwrite 上書きフラグ
-	 */
-	public void setOverwrite(boolean overwrite) {
-		this.overwrite = overwrite;
-	}
-	
-	/**
-	 * テンプレート名を設定する。
-	 * 
-	 * @param templateName テンプレート名
-	 */
-	public void setTemplateName(String templateName) {
-		this.templateName = templateName;
-	}
-	
-}

Added: leto/jiemamy-entity-io/trunk/src/main/java/org/jiemamy/entity/io/utils/AnnotationUtil.java
===================================================================
--- leto/jiemamy-entity-io/trunk/src/main/java/org/jiemamy/entity/io/utils/AnnotationUtil.java	                        (rev 0)
+++ leto/jiemamy-entity-io/trunk/src/main/java/org/jiemamy/entity/io/utils/AnnotationUtil.java	2009-04-13 09:50:11 UTC (rev 3249)
@@ -0,0 +1,116 @@
+/*
+ * Copyright 2004-2009 the Seasar Foundation and the Others.
+ *
+ * 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.entity.io.utils;
+
+import javax.persistence.Column;
+import javax.persistence.SequenceGenerator;
+import javax.persistence.Table;
+import javax.persistence.TableGenerator;
+
+import org.jiemamy.utils.ReflectionUtil;
+
+/**
+ * アノテーションに関するユーティリティクラスです。
+ * 
+ * @author taedium
+ */
+public class AnnotationUtil {
+	
+	/** デフォルトの{@link Table}を取得するためのクラス */
+	@Table
+	protected static class TableAnnotated {
+	}
+	
+
+	/** デフォルトの{@link Table} */
+	protected static final Table DEFAULT_TABLE = TableAnnotated.class.getAnnotation(Table.class);
+	
+	/** デフォルトの{@link Column} */
+	@Column(length = 255, precision = 19, scale = 2)
+	protected static final Column DEFAULT_COLUMN =
+			ReflectionUtil.getDeclaredFieldNoException(AnnotationUtil.class, "DEFAULT_COLUMN").getAnnotation(
+					Column.class);
+	
+	/** デフォルトの{@link SequenceGenerator} */
+	@SequenceGenerator(name = "default")
+	protected static final SequenceGenerator DEFAULT_SEQUENCE_GENERATOR =
+			ReflectionUtil.getDeclaredFieldNoException(AnnotationUtil.class, "DEFAULT_SEQUENCE_GENERATOR")
+				.getAnnotation(SequenceGenerator.class);
+	
+	/** デフォルトの{@link TableGenerator} */
+	@TableGenerator(name = "default")
+	protected static final TableGenerator DEFAULT_TABLE_GENERATOR =
+			ReflectionUtil.getDeclaredFieldNoException(AnnotationUtil.class, "DEFAULT_TABLE_GENERATOR").getAnnotation(
+					TableGenerator.class);
+	
+	/** デフォルトの{@link ReferentialConstraint} */
+	@ReferentialConstraint
+	protected static final ReferentialConstraint DEFAULT_REFERENTIAL_CONSTRAINT =
+			ReflectionUtil.getDeclaredFieldNoException(AnnotationUtil.class, "DEFAULT_REFERENTIAL_CONSTRAINT")
+				.getAnnotation(ReferentialConstraint.class);
+	
+
+	/**
+	 * デフォルトの{@link Column}を返します。
+	 * 
+	 * @return デフォルトの{@link Column}
+	 */
+	public static Column getDefaultColumn() {
+		return DEFAULT_COLUMN;
+	}
+	
+	/**
+	 * デフォルトの{@link ReferentialConstraint}を返します。
+	 * 
+	 * @return デフォルトの{@link ReferentialConstraint}
+	 */
+	public static ReferentialConstraint getDefaultReferentialConstraint() {
+		return DEFAULT_REFERENTIAL_CONSTRAINT;
+	}
+	
+	/**
+	 * デフォルトの{@link SequenceGenerator}を返します。
+	 * 
+	 * @return デフォルトの{@link SequenceGenerator}
+	 */
+	public static SequenceGenerator getDefaultSequenceGenerator() {
+		return DEFAULT_SEQUENCE_GENERATOR;
+	}
+	
+	/**
+	 * デフォルトの{@link Table}を返します。
+	 * 
+	 * @return デフォルトの{@link Table}
+	 */
+	public static Table getDefaultTable() {
+		return DEFAULT_TABLE;
+	}
+	
+	/**
+	 * デフォルトの{@link TableGenerator}を返します。
+	 * 
+	 * @return デフォルトの{@link TableGenerator}
+	 */
+	public static TableGenerator getDefaultTableGenerator() {
+		return DEFAULT_TABLE_GENERATOR;
+	}
+	
+	/**
+	 * 
+	 */
+	protected AnnotationUtil() {
+	}
+}


Property changes on: leto/jiemamy-entity-io/trunk/src/main/java/org/jiemamy/entity/io/utils/AnnotationUtil.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Added: leto/jiemamy-entity-io/trunk/src/main/java/org/jiemamy/entity/io/utils/CaseInsensitiveMap.java
===================================================================
--- leto/jiemamy-entity-io/trunk/src/main/java/org/jiemamy/entity/io/utils/CaseInsensitiveMap.java	                        (rev 0)
+++ leto/jiemamy-entity-io/trunk/src/main/java/org/jiemamy/entity/io/utils/CaseInsensitiveMap.java	2009-04-13 09:50:11 UTC (rev 3249)
@@ -0,0 +1,91 @@
+/*
+ * Copyright 2004-2009 the Seasar Foundation and the Others.
+ *
+ * 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.entity.io.utils;
+
+import java.util.Map;
+
+import org.jiemamy.utils.ArrayMap;
+
+/**
+ * キーで大文字小文字を気にしない {@link ArrayMap}です。
+ * 
+ * @author higa
+ * 
+ */
+public class CaseInsensitiveMap<K, V> extends ArrayMap<K, V> {
+	
+	private static final long serialVersionUID = 1L;
+	
+
+	private static String convertKey(String key) {
+		return key.toLowerCase();
+	}
+	
+	/**
+	 * {@link CaseInsensitiveMap}を作成します。
+	 */
+	public CaseInsensitiveMap() {
+		super();
+	}
+	
+	/**
+	 * {@link CaseInsensitiveMap}を作成します。
+	 * 
+	 * @param capacity
+	 */
+	public CaseInsensitiveMap(int capacity) {
+		super(capacity);
+	}
+	
+	@Override
+	public boolean containsKey(Object key) {
+		return super.containsKey(convertKey(key.toString()));
+	}
+	
+	/**
+	 * キーが含まれているかどうかを返します。
+	 * 
+	 * @param key
+	 * @return キーが含まれているかどうか
+	 */
+	public final boolean containsKey(String key) {
+		return super.containsKey(convertKey(key));
+	}
+	
+	@Override
+	public V get(Object key) {
+		return super.get(convertKey(key.toString()));
+	}
+	
+	@Override
+	public V put(Object key, Object value) {
+		return super.put((K) convertKey(key.toString()), (V) value);
+	}
+	
+	@Override
+	public final void putAll(Map map) {
+		for (Object element : map.entrySet()) {
+			Map.Entry entry = (Map.Entry) element;
+			put(convertKey(entry.getKey().toString()), entry.getValue());
+		}
+	}
+	
+	@Override
+	public final V remove(Object key) {
+		return super.remove(convertKey(key.toString()));
+	}
+	
+}


Property changes on: leto/jiemamy-entity-io/trunk/src/main/java/org/jiemamy/entity/io/utils/CaseInsensitiveMap.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Added: leto/jiemamy-entity-io/trunk/src/main/java/org/jiemamy/entity/io/utils/CaseInsensitiveSet.java
===================================================================
--- leto/jiemamy-entity-io/trunk/src/main/java/org/jiemamy/entity/io/utils/CaseInsensitiveSet.java	                        (rev 0)
+++ leto/jiemamy-entity-io/trunk/src/main/java/org/jiemamy/entity/io/utils/CaseInsensitiveSet.java	2009-04-13 09:50:11 UTC (rev 3249)
@@ -0,0 +1,101 @@
+/*
+ * Copyright 2004-2009 the Seasar Foundation and the Others.
+ *
+ * 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.entity.io.utils;
+
+import java.io.Serializable;
+import java.util.AbstractSet;
+import java.util.Collection;
+import java.util.Iterator;
+import java.util.Map;
+import java.util.Set;
+
+/**
+ * 大文字小文字を気にしない {@link Set}です。
+ * 
+ * @author higa
+ * 
+ */
+ @ SuppressWarnings("unchecked")
+public class CaseInsensitiveSet extends AbstractSet implements Set, Serializable {
+	
+	static final long serialVersionUID = 0L;
+	
+	private transient Map map;
+	
+	private static final Object PRESENT = new Object();
+	
+
+	/**
+	 * {@link CaseInsensitiveSet}を作成します。
+	 */
+	public CaseInsensitiveSet() {
+		map = new CaseInsensitiveMap();
+	}
+	
+	/**
+	 * {@link CaseInsensitiveSet}を作成します。
+	 * 
+	 * @param c
+	 */
+	public CaseInsensitiveSet(Collection c) {
+		map = new CaseInsensitiveMap(Math.max((int) (c.size() / .75f) + 1, 16));
+		addAll(c);
+	}
+	
+	/**
+	 * {@link CaseInsensitiveSet}を作成します。
+	 * 
+	 * @param initialCapacity
+	 */
+	public CaseInsensitiveSet(int initialCapacity) {
+		map = new CaseInsensitiveMap(initialCapacity);
+	}
+	
+	@Override
+	public boolean add(Object o) {
+		return map.put(o, PRESENT) == null;
+	}
+	
+	@Override
+	public void clear() {
+		map.clear();
+	}
+	
+	@Override
+	public boolean contains(Object o) {
+		return map.containsKey(o);
+	}
+	
+	@Override
+	public boolean isEmpty() {
+		return map.isEmpty();
+	}
+	
+	@Override
+	public Iterator iterator() {
+		return map.keySet().iterator();
+	}
+	
+	@Override
+	public boolean remove(Object o) {
+		return map.remove(o) == PRESENT;
+	}
+	
+	@Override
+	public int size() {
+		return map.size();
+	}
+}


Property changes on: leto/jiemamy-entity-io/trunk/src/main/java/org/jiemamy/entity/io/utils/CaseInsensitiveSet.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Added: leto/jiemamy-entity-io/trunk/src/main/java/org/jiemamy/entity/io/utils/ReferentialActionType.java
===================================================================
--- leto/jiemamy-entity-io/trunk/src/main/java/org/jiemamy/entity/io/utils/ReferentialActionType.java	                        (rev 0)
+++ leto/jiemamy-entity-io/trunk/src/main/java/org/jiemamy/entity/io/utils/ReferentialActionType.java	2009-04-13 09:50:11 UTC (rev 3249)
@@ -0,0 +1,38 @@
+/*
+ * Copyright 2004-2009 the Seasar Foundation and the Others.
+ *
+ * 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.entity.io.utils;
+
+/**
+ * 参照動作の列挙型。
+ * 
+ * @author j5ik2o
+ */
+public enum ReferentialActionType {
+	/** 波及 */
+	CASCADE,
+
+	/** NULL値の設定 */
+	SET_NULL,
+
+	/** デフォルト値の設定 */
+	SET_DEFAULT,
+
+	/** 制限 */
+	RESTRICT,
+
+	/** 動作なし */
+	NO_ACTION
+}


Property changes on: leto/jiemamy-entity-io/trunk/src/main/java/org/jiemamy/entity/io/utils/ReferentialActionType.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Added: leto/jiemamy-entity-io/trunk/src/main/java/org/jiemamy/entity/io/utils/ReferentialConstraint.java
===================================================================
--- leto/jiemamy-entity-io/trunk/src/main/java/org/jiemamy/entity/io/utils/ReferentialConstraint.java	                        (rev 0)
+++ leto/jiemamy-entity-io/trunk/src/main/java/org/jiemamy/entity/io/utils/ReferentialConstraint.java	2009-04-13 09:50:11 UTC (rev 3249)
@@ -0,0 +1,45 @@
+/*
+ * Copyright 2004-2009 the Seasar Foundation and the Others.
+ *
+ * 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.entity.io.utils;
+
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+/**
+ * 参照整合性制約。
+ * <p>
+ * S2JDBC-Genなど、スキーマ生成のツールにより参照されるアノテーションです。 S2JDBCの実行時には利用されません。
+ * </p>
+ * 
+ * @author taedium
+ */
+ @ Retention(RetentionPolicy.RUNTIME)
+ @ Target( {
+	ElementType.FIELD
+})
+public @interface ReferentialConstraint {
+	
+	/** 制約を有効にする場合{@code true}、しない場合{@code false} */
+	boolean enable() default true;
+	
+	/** 削除規則 */
+	ReferentialActionType onDelete() default ReferentialActionType.NO_ACTION;
+	
+	/** 更新規則 */
+	ReferentialActionType onUpdate() default ReferentialActionType.NO_ACTION;
+}


Property changes on: leto/jiemamy-entity-io/trunk/src/main/java/org/jiemamy/entity/io/utils/ReferentialConstraint.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain



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