svnno****@sourc*****
svnno****@sourc*****
2009年 4月 13日 (月) 18:54:34 JST
Revision: 3252 http://svn.sourceforge.jp/view?root=jiemamy&view=rev&rev=3252 Author: j5ik2o Date: 2009-04-13 18:54:34 +0900 (Mon, 13 Apr 2009) Log Message: ----------- リファクタリング Modified Paths: -------------- leto/jiemamy-entity-io/trunk/src/main/java/org/jiemamy/entity/io/gen/generator/GeneratorContext.java leto/jiemamy-entity-io/trunk/src/main/java/org/jiemamy/entity/io/gen/model/AttributeModel.java leto/jiemamy-entity-io/trunk/src/main/java/org/jiemamy/entity/io/gen/model/ClassModel.java leto/jiemamy-entity-io/trunk/src/main/java/org/jiemamy/entity/io/gen/model/CompositeUniqueConstraintModel.java leto/jiemamy-entity-io/trunk/src/main/java/org/jiemamy/entity/io/gen/model/ConditionAssociationModel.java leto/jiemamy-entity-io/trunk/src/main/java/org/jiemamy/entity/io/gen/model/ConditionAttributeModel.java leto/jiemamy-entity-io/trunk/src/main/java/org/jiemamy/entity/io/gen/model/ConditionModel.java leto/jiemamy-entity-io/trunk/src/main/java/org/jiemamy/entity/io/gen/model/EntityModel.java leto/jiemamy-entity-io/trunk/src/main/java/org/jiemamy/entity/io/gen/model/GeneratedModel.java leto/jiemamy-entity-io/trunk/src/main/java/org/jiemamy/entity/io/gen/model/JoinColumnModel.java leto/jiemamy-entity-io/trunk/src/main/java/org/jiemamy/entity/io/gen/model/JoinColumnsModel.java leto/jiemamy-entity-io/trunk/src/main/java/org/jiemamy/entity/io/gen/model/UniqueKeyModel.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/gen/generator/ leto/jiemamy-entity-io/trunk/src/main/java/org/jiemamy/entity/io/gen/generator/DeleteEmptyFileWriter.java leto/jiemamy-entity-io/trunk/src/main/java/org/jiemamy/entity/io/gen/generator/EntitySrcFileGenerator.java leto/jiemamy-entity-io/trunk/src/main/java/org/jiemamy/entity/io/gen/generator/GenerateException.java leto/jiemamy-entity-io/trunk/src/main/java/org/jiemamy/entity/io/gen/generator/Generator.java leto/jiemamy-entity-io/trunk/src/main/java/org/jiemamy/entity/io/gen/generator/GeneratorContextImpl.java leto/jiemamy-entity-io/trunk/src/main/java/org/jiemamy/entity/io/gen/generator/IncludeDirective.java leto/jiemamy-entity-io/trunk/src/main/java/org/jiemamy/entity/io/gen/generator/OnDemandDateModel.java leto/jiemamy-entity-io/trunk/src/main/java/org/jiemamy/entity/io/gen/generator/ResourceTemplateLoader.java leto/jiemamy-entity-io/trunk/src/main/java/org/jiemamy/entity/io/gen/model/ leto/jiemamy-entity-io/trunk/src/main/java/org/jiemamy/entity/io/gen/model/AssociationModel.java leto/jiemamy-entity-io/trunk/src/main/java/org/jiemamy/entity/io/gen/model/AssociationModelFactory.java leto/jiemamy-entity-io/trunk/src/main/java/org/jiemamy/entity/io/gen/model/AttributeModelFactory.java leto/jiemamy-entity-io/trunk/src/main/java/org/jiemamy/entity/io/gen/model/CompositeUniqueConstraintModelFactory.java leto/jiemamy-entity-io/trunk/src/main/java/org/jiemamy/entity/io/gen/model/EntityModelFactory.java Removed 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/gen/generator/Generator.java leto/jiemamy-entity-io/trunk/src/main/java/org/jiemamy/entity/io/gen/model/AssociationModel.java leto/jiemamy-entity-io/trunk/src/main/java/org/jiemamy/entity/io/gen/model/AssociationModelFactory.java leto/jiemamy-entity-io/trunk/src/main/java/org/jiemamy/entity/io/gen/model/AttributeModelFactory.java leto/jiemamy-entity-io/trunk/src/main/java/org/jiemamy/entity/io/gen/model/CompositeUniqueConstraintModelFactory.java leto/jiemamy-entity-io/trunk/src/main/java/org/jiemamy/entity/io/gen/model/EntityModelFactory.java leto/jiemamy-entity-io/trunk/src/main/java/org/jiemamy/entity/io/generator/ leto/jiemamy-entity-io/trunk/src/main/java/org/jiemamy/entity/io/model/ -------------- next part -------------- Copied: leto/jiemamy-entity-io/trunk/src/main/java/org/jiemamy/entity/io/gen/generator/DeleteEmptyFileWriter.java (from rev 3249, 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/gen/generator/DeleteEmptyFileWriter.java (rev 0) +++ leto/jiemamy-entity-io/trunk/src/main/java/org/jiemamy/entity/io/gen/generator/DeleteEmptyFileWriter.java 2009-04-13 09:54:34 UTC (rev 3252) @@ -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.gen.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); + } + +} Copied: leto/jiemamy-entity-io/trunk/src/main/java/org/jiemamy/entity/io/gen/generator/EntitySrcFileGenerator.java (from rev 3249, 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/gen/generator/EntitySrcFileGenerator.java (rev 0) +++ leto/jiemamy-entity-io/trunk/src/main/java/org/jiemamy/entity/io/gen/generator/EntitySrcFileGenerator.java 2009-04-13 09:54:34 UTC (rev 3252) @@ -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.gen.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); + } +} Copied: leto/jiemamy-entity-io/trunk/src/main/java/org/jiemamy/entity/io/gen/generator/GenerateException.java (from rev 3249, 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/gen/generator/GenerateException.java (rev 0) +++ leto/jiemamy-entity-io/trunk/src/main/java/org/jiemamy/entity/io/gen/generator/GenerateException.java 2009-04-13 09:54:34 UTC (rev 3252) @@ -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.gen.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); + } + +} Deleted: leto/jiemamy-entity-io/trunk/src/main/java/org/jiemamy/entity/io/gen/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/gen/generator/Generator.java 2009-04-13 09:54:34 UTC (rev 3252) @@ -1,40 +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.generator; - -import java.io.IOException; - -import org.jiemamy.entity.io.generator.impl.GenerateException; - -/** - * ファイルを生成するインタフェース。 - * - * @author j5ik2o - */ -public interface Generator { - - /** - * ファイルを生成する。 - * - * @param context コンテキスト - * @throws IOException 入出力が失敗した場合 - */ - void generate(GeneratorContext context) throws GenerateException; - -} Copied: leto/jiemamy-entity-io/trunk/src/main/java/org/jiemamy/entity/io/gen/generator/Generator.java (from rev 3249, 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/gen/generator/Generator.java (rev 0) +++ leto/jiemamy-entity-io/trunk/src/main/java/org/jiemamy/entity/io/gen/generator/Generator.java 2009-04-13 09:54:34 UTC (rev 3252) @@ -0,0 +1,36 @@ +/* + * 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.gen.generator; + +/** + * ファイルを生成するインタフェース。 + * + * @author j5ik2o + */ +public interface Generator { + + /** + * ファイルを生成する。 + * + * @param context コンテキスト + * @throws GenerateException 入出力が失敗した場合 + */ + void generate(GeneratorContext context) throws GenerateException; + +} Modified: leto/jiemamy-entity-io/trunk/src/main/java/org/jiemamy/entity/io/gen/generator/GeneratorContext.java =================================================================== --- leto/jiemamy-entity-io/trunk/src/main/java/org/jiemamy/entity/io/generator/GeneratorContext.java 2009-04-13 09:46:41 UTC (rev 3248) +++ leto/jiemamy-entity-io/trunk/src/main/java/org/jiemamy/entity/io/gen/generator/GeneratorContext.java 2009-04-13 09:54:34 UTC (rev 3252) @@ -16,7 +16,7 @@ * either express or implied. See the License for the specific language * governing permissions and limitations under the License. */ -package org.jiemamy.entity.io.generator; +package org.jiemamy.entity.io.gen.generator; import java.io.File; Copied: leto/jiemamy-entity-io/trunk/src/main/java/org/jiemamy/entity/io/gen/generator/GeneratorContextImpl.java (from rev 3249, 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/gen/generator/GeneratorContextImpl.java (rev 0) +++ leto/jiemamy-entity-io/trunk/src/main/java/org/jiemamy/entity/io/gen/generator/GeneratorContextImpl.java 2009-04-13 09:54:34 UTC (rev 3252) @@ -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.gen.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; + } + +} Copied: leto/jiemamy-entity-io/trunk/src/main/java/org/jiemamy/entity/io/gen/generator/IncludeDirective.java (from rev 3249, 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/gen/generator/IncludeDirective.java (rev 0) +++ leto/jiemamy-entity-io/trunk/src/main/java/org/jiemamy/entity/io/gen/generator/IncludeDirective.java 2009-04-13 09:54:34 UTC (rev 3252) @@ -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.gen.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()); + } + } +} Copied: leto/jiemamy-entity-io/trunk/src/main/java/org/jiemamy/entity/io/gen/generator/OnDemandDateModel.java (from rev 3249, 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/gen/generator/OnDemandDateModel.java (rev 0) +++ leto/jiemamy-entity-io/trunk/src/main/java/org/jiemamy/entity/io/gen/generator/OnDemandDateModel.java 2009-04-13 09:54:34 UTC (rev 3252) @@ -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.gen.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; + } +} Copied: leto/jiemamy-entity-io/trunk/src/main/java/org/jiemamy/entity/io/gen/generator/ResourceTemplateLoader.java (from rev 3249, 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/gen/generator/ResourceTemplateLoader.java (rev 0) +++ leto/jiemamy-entity-io/trunk/src/main/java/org/jiemamy/entity/io/gen/generator/ResourceTemplateLoader.java 2009-04-13 09:54:34 UTC (rev 3252) @@ -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.gen.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); + } + +} Deleted: leto/jiemamy-entity-io/trunk/src/main/java/org/jiemamy/entity/io/gen/model/AssociationModel.java =================================================================== --- leto/jiemamy-entity-io/trunk/src/main/java/org/jiemamy/entity/io/model/AssociationModel.java 2009-04-13 09:46:41 UTC (rev 3248) +++ leto/jiemamy-entity-io/trunk/src/main/java/org/jiemamy/entity/io/gen/model/AssociationModel.java 2009-04-13 09:54:34 UTC (rev 3252) @@ -1,163 +0,0 @@ -/* - * Copyright 2007-2009 Jiemamy Project and the Others. - * - * This file is part of Jiemamy. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, - * either express or implied. See the License for the specific language - * governing permissions and limitations under the License. - */ -package org.jiemamy.entity.io.model; - -import org.jiemamy.entity.io.desc.AssociationType; - -/** - * 関連モデル。 - * - * @author j5ik2o - */ -public class AssociationModel { - - /** 名前 */ - protected String name; - - /** クラスの単純名 */ - protected String shortClassName; - - /** 関連タイプ */ - protected AssociationType associationType; - - /** 関連の所有者側のプロパティの名前 */ - protected String mappedBy; - - /** 結合カラムモデル */ - protected JoinColumnModel joinColumnModel; - - /** 複合結合カラムモデル */ - protected JoinColumnsModel joinColumnsModel; - - - /** - * 関連タイプを返します。 - * - * @return 関連タイプ - */ - public AssociationType getAssociationType() { - return associationType; - } - - /** - * 結合カラムモデルを取得する。 - * - * @return 結合カラムモデル - */ - public JoinColumnModel getJoinColumnModel() { - return joinColumnModel; - } - - /** - * 複合結合カラムモデルを取得する。 - * - * @return 複合結合カラムモデル - */ - public JoinColumnsModel getJoinColumnsModel() { - return joinColumnsModel; - } - - /** - * 関連の所有者側のプロパティの名前を取得する。 - * - * @return 関連の所有者側のプロパティの名前 - */ - public String getMappedBy() { - return mappedBy; - } - - /** - * 名前を取得する。 - * - * @return 名前 - */ - public String getName() { - return name; - } - - /** - * クラスの単純名を取得する。 - * - * @return クラスの単純名 - */ - public String getShortClassName() { - return shortClassName; - } - - /** - * 関連タイプを設定する。 - * - * @param associationType 関連タイプ - */ - public void setAssociationType(AssociationType associationType) { - this.associationType = associationType; - } - - /** - * 結合カラムモデルを設定する。 - * - * @param joinColumnModel 結合カラムモデル - * - */ - public void setJoinColumnModel(JoinColumnModel joinColumnModel) { - if (joinColumnsModel != null) { - throw new IllegalStateException("joinColumnsModel"); - } - this.joinColumnModel = joinColumnModel; - } - - /** - * 複合結合カラムモデルを設定する。 - * - * @param joinColumnsModel 複合結合カラムモデル - */ - public void setJoinColumnsModel(JoinColumnsModel joinColumnsModel) { - if (joinColumnModel != null) { - throw new IllegalStateException("joinColumnModel"); - } - this.joinColumnsModel = joinColumnsModel; - } - - /** - * 関連の所有者側のプロパティの名前を設定する。 - * - * @param mappedBy 関連の所有者側のプロパティの名前 - */ - public void setMappedBy(String mappedBy) { - this.mappedBy = mappedBy; - } - - /** - * 名前を設定する。 - * - * @param name 名前 - */ - public void setName(String name) { - this.name = name; - } - - /** - * クラスの単純名を設定する。 - * - * @param shortClassName クラスの単純名 - */ - public void setShortClassName(String shortClassName) { - this.shortClassName = shortClassName; - } - -} Copied: leto/jiemamy-entity-io/trunk/src/main/java/org/jiemamy/entity/io/gen/model/AssociationModel.java (from rev 3251, leto/jiemamy-entity-io/trunk/src/main/java/org/jiemamy/entity/io/model/AssociationModel.java) =================================================================== --- leto/jiemamy-entity-io/trunk/src/main/java/org/jiemamy/entity/io/gen/model/AssociationModel.java (rev 0) +++ leto/jiemamy-entity-io/trunk/src/main/java/org/jiemamy/entity/io/gen/model/AssociationModel.java 2009-04-13 09:54:34 UTC (rev 3252) @@ -0,0 +1,163 @@ +/* + * Copyright 2007-2009 Jiemamy Project and the Others. + * + * This file is part of Jiemamy. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, + * either express or implied. See the License for the specific language + * governing permissions and limitations under the License. + */ +package org.jiemamy.entity.io.gen.model; + +import org.jiemamy.entity.io.gen.desc.AssociationType; + +/** + * 関連モデル。 + * + * @author j5ik2o + */ +public class AssociationModel { + + /** 名前 */ + protected String name; + + /** クラスの単純名 */ + protected String shortClassName; + + /** 関連タイプ */ + protected AssociationType associationType; + + /** 関連の所有者側のプロパティの名前 */ + protected String mappedBy; + + /** 結合カラムモデル */ + protected JoinColumnModel joinColumnModel; + + /** 複合結合カラムモデル */ + protected JoinColumnsModel joinColumnsModel; + + + /** + * 関連タイプを返します。 + * + * @return 関連タイプ + */ + public AssociationType getAssociationType() { + return associationType; + } + + /** + * 結合カラムモデルを取得する。 + * + * @return 結合カラムモデル + */ + public JoinColumnModel getJoinColumnModel() { + return joinColumnModel; + } + + /** + * 複合結合カラムモデルを取得する。 + * + * @return 複合結合カラムモデル + */ + public JoinColumnsModel getJoinColumnsModel() { + return joinColumnsModel; + } + + /** + * 関連の所有者側のプロパティの名前を取得する。 + * + * @return 関連の所有者側のプロパティの名前 + */ + public String getMappedBy() { + return mappedBy; + } + + /** + * 名前を取得する。 + * + * @return 名前 + */ + public String getName() { + return name; + } + + /** + * クラスの単純名を取得する。 + * + * @return クラスの単純名 + */ + public String getShortClassName() { + return shortClassName; + } + + /** + * 関連タイプを設定する。 + * + * @param associationType 関連タイプ + */ + public void setAssociationType(AssociationType associationType) { + this.associationType = associationType; + } + + /** + * 結合カラムモデルを設定する。 + * + * @param joinColumnModel 結合カラムモデル + * + */ + public void setJoinColumnModel(JoinColumnModel joinColumnModel) { + if (joinColumnsModel != null) { + throw new IllegalStateException("joinColumnsModel"); + } + this.joinColumnModel = joinColumnModel; + } + + /** + * 複合結合カラムモデルを設定する。 + * + * @param joinColumnsModel 複合結合カラムモデル + */ + public void setJoinColumnsModel(JoinColumnsModel joinColumnsModel) { + if (joinColumnModel != null) { + throw new IllegalStateException("joinColumnModel"); + } + this.joinColumnsModel = joinColumnsModel; + } + + /** + * 関連の所有者側のプロパティの名前を設定する。 + * + * @param mappedBy 関連の所有者側のプロパティの名前 + */ + public void setMappedBy(String mappedBy) { + this.mappedBy = mappedBy; + } + + /** + * 名前を設定する。 + * + * @param name 名前 + */ + public void setName(String name) { + this.name = name; + } + + /** + * クラスの単純名を設定する。 + * + * @param shortClassName クラスの単純名 + */ + public void setShortClassName(String shortClassName) { + this.shortClassName = shortClassName; + } + +} Deleted: leto/jiemamy-entity-io/trunk/src/main/java/org/jiemamy/entity/io/gen/model/AssociationModelFactory.java =================================================================== --- leto/jiemamy-entity-io/trunk/src/main/java/org/jiemamy/entity/io/model/AssociationModelFactory.java 2009-04-13 09:46:41 UTC (rev 3248) +++ leto/jiemamy-entity-io/trunk/src/main/java/org/jiemamy/entity/io/gen/model/AssociationModelFactory.java 2009-04-13 09:54:34 UTC (rev 3252) @@ -1,36 +0,0 @@ -/* - * Copyright 2007-2009 Jiemamy Project and the Others. - * - * This file is part of Jiemamy. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, - * either express or implied. See the License for the specific language - * governing permissions and limitations under the License. - */ -package org.jiemamy.entity.io.model; - -import org.jiemamy.entity.io.desc.AssociationDesc; - -/** - * {@link AssociationModel}のファクトリインターフェイス。 - * - * @author j5ik2o - */ -public interface AssociationModelFactory { - - /** - * 関連モデルを取得する。 - * - * @param associationDesc 関連記述 - * @return 関連モデル - */ - AssociationModel getAssociationModel(AssociationDesc associationDesc); -} Copied: leto/jiemamy-entity-io/trunk/src/main/java/org/jiemamy/entity/io/gen/model/AssociationModelFactory.java (from rev 3251, leto/jiemamy-entity-io/trunk/src/main/java/org/jiemamy/entity/io/model/AssociationModelFactory.java) =================================================================== --- leto/jiemamy-entity-io/trunk/src/main/java/org/jiemamy/entity/io/gen/model/AssociationModelFactory.java (rev 0) +++ leto/jiemamy-entity-io/trunk/src/main/java/org/jiemamy/entity/io/gen/model/AssociationModelFactory.java 2009-04-13 09:54:34 UTC (rev 3252) @@ -0,0 +1,36 @@ +/* + * Copyright 2007-2009 Jiemamy Project and the Others. + * + * This file is part of Jiemamy. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, + * either express or implied. See the License for the specific language + * governing permissions and limitations under the License. + */ +package org.jiemamy.entity.io.gen.model; + +import org.jiemamy.entity.io.gen.desc.AssociationDesc; + +/** + * {@link AssociationModel}のファクトリインターフェイス。 + * + * @author j5ik2o + */ +public interface AssociationModelFactory { + + /** + * 関連モデルを取得する。 + * + * @param associationDesc 関連記述 + * @return 関連モデル + */ + AssociationModel getAssociationModel(AssociationDesc associationDesc); +} Modified: leto/jiemamy-entity-io/trunk/src/main/java/org/jiemamy/entity/io/gen/model/AttributeModel.java =================================================================== --- leto/jiemamy-entity-io/trunk/src/main/java/org/jiemamy/entity/io/model/AttributeModel.java 2009-04-13 09:46:41 UTC (rev 3248) +++ leto/jiemamy-entity-io/trunk/src/main/java/org/jiemamy/entity/io/gen/model/AttributeModel.java 2009-04-13 09:54:34 UTC (rev 3252) @@ -15,7 +15,7 @@ * either express or implied. See the License for the specific language * governing permissions and limitations under the License. */ -package org.jiemamy.entity.io.model; +package org.jiemamy.entity.io.gen.model; import javax.persistence.GenerationType; import javax.persistence.TemporalType; Deleted: leto/jiemamy-entity-io/trunk/src/main/java/org/jiemamy/entity/io/gen/model/AttributeModelFactory.java =================================================================== --- leto/jiemamy-entity-io/trunk/src/main/java/org/jiemamy/entity/io/model/AttributeModelFactory.java 2009-04-13 09:46:41 UTC (rev 3248) +++ leto/jiemamy-entity-io/trunk/src/main/java/org/jiemamy/entity/io/gen/model/AttributeModelFactory.java 2009-04-13 09:54:34 UTC (rev 3252) @@ -1,34 +0,0 @@ -/* - * 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.model; - -import org.jiemamy.entity.io.desc.AttributeDesc; - -/** - * {@link AttributeModel 属性モデル}のファクトリインターフェイス。 - * - * @author j5ik2o - */ -public interface AttributeModelFactory { - - /** - * 属性モデルを取得する。 - * - * @param attributeDesc 属性記述 - * @return 属性モデル - */ - AttributeModel getAttributeModel(AttributeDesc attributeDesc); -} Copied: leto/jiemamy-entity-io/trunk/src/main/java/org/jiemamy/entity/io/gen/model/AttributeModelFactory.java (from rev 3251, leto/jiemamy-entity-io/trunk/src/main/java/org/jiemamy/entity/io/model/AttributeModelFactory.java) =================================================================== --- leto/jiemamy-entity-io/trunk/src/main/java/org/jiemamy/entity/io/gen/model/AttributeModelFactory.java (rev 0) +++ leto/jiemamy-entity-io/trunk/src/main/java/org/jiemamy/entity/io/gen/model/AttributeModelFactory.java 2009-04-13 09:54:34 UTC (rev 3252) @@ -0,0 +1,34 @@ +/* + * 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.gen.model; + +import org.jiemamy.entity.io.gen.desc.AttributeDesc; + +/** + * {@link AttributeModel 属性モデル}のファクトリインターフェイス。 + * + * @author j5ik2o + */ +public interface AttributeModelFactory { + + /** + * 属性モデルを取得する。 + * + * @param attributeDesc 属性記述 + * @return 属性モデル + */ + AttributeModel getAttributeModel(AttributeDesc attributeDesc); +} Modified: leto/jiemamy-entity-io/trunk/src/main/java/org/jiemamy/entity/io/gen/model/ClassModel.java =================================================================== --- leto/jiemamy-entity-io/trunk/src/main/java/org/jiemamy/entity/io/model/ClassModel.java 2009-04-13 09:46:41 UTC (rev 3248) +++ leto/jiemamy-entity-io/trunk/src/main/java/org/jiemamy/entity/io/gen/model/ClassModel.java 2009-04-13 09:54:34 UTC (rev 3252) @@ -15,7 +15,7 @@ * either express or implied. See the License for the specific language * governing permissions and limitations under the License. */ -package org.jiemamy.entity.io.model; +package org.jiemamy.entity.io.gen.model; import java.util.Collections; import java.util.SortedSet; Modified: leto/jiemamy-entity-io/trunk/src/main/java/org/jiemamy/entity/io/gen/model/CompositeUniqueConstraintModel.java =================================================================== --- leto/jiemamy-entity-io/trunk/src/main/java/org/jiemamy/entity/io/model/CompositeUniqueConstraintModel.java 2009-04-13 09:46:41 UTC (rev 3248) +++ leto/jiemamy-entity-io/trunk/src/main/java/org/jiemamy/entity/io/gen/model/CompositeUniqueConstraintModel.java 2009-04-13 09:54:34 UTC (rev 3252) @@ -15,7 +15,7 @@ * either express or implied. See the License for the specific language * governing permissions and limitations under the License. */ -package org.jiemamy.entity.io.model; +package org.jiemamy.entity.io.gen.model; import java.util.ArrayList; import java.util.Collections; Deleted: leto/jiemamy-entity-io/trunk/src/main/java/org/jiemamy/entity/io/gen/model/CompositeUniqueConstraintModelFactory.java =================================================================== --- leto/jiemamy-entity-io/trunk/src/main/java/org/jiemamy/entity/io/model/CompositeUniqueConstraintModelFactory.java 2009-04-13 09:46:41 UTC (rev 3248) +++ leto/jiemamy-entity-io/trunk/src/main/java/org/jiemamy/entity/io/gen/model/CompositeUniqueConstraintModelFactory.java 2009-04-13 09:54:34 UTC (rev 3252) @@ -1,36 +0,0 @@ -/* - * Copyright 2007-2009 Jiemamy Project and the Others. - * - * This file is part of Jiemamy. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, - * either express or implied. See the License for the specific language - * governing permissions and limitations under the License. - */ -package org.jiemamy.entity.io.model; - -import org.jiemamy.entity.io.desc.CompositeUniqueConstraintDesc; - -/** - * {@link CompositeUniqueConstraintModel}のファクトリインターフェイス。 - * - * @author j5ik2o - */ -public interface CompositeUniqueConstraintModelFactory { - - /** - * 複合一意制約モデルを取得する。 - * - * @param compositeUniqueConstraintDesc 複合一意制約記述 - * @return 複合一意制約モデル - */ - CompositeUniqueConstraintModel getUniqueConstraintModel(CompositeUniqueConstraintDesc compositeUniqueConstraintDesc); -} Copied: leto/jiemamy-entity-io/trunk/src/main/java/org/jiemamy/entity/io/gen/model/CompositeUniqueConstraintModelFactory.java (from rev 3251, leto/jiemamy-entity-io/trunk/src/main/java/org/jiemamy/entity/io/model/CompositeUniqueConstraintModelFactory.java) =================================================================== --- leto/jiemamy-entity-io/trunk/src/main/java/org/jiemamy/entity/io/gen/model/CompositeUniqueConstraintModelFactory.java (rev 0) +++ leto/jiemamy-entity-io/trunk/src/main/java/org/jiemamy/entity/io/gen/model/CompositeUniqueConstraintModelFactory.java 2009-04-13 09:54:34 UTC (rev 3252) @@ -0,0 +1,36 @@ +/* + * Copyright 2007-2009 Jiemamy Project and the Others. + * + * This file is part of Jiemamy. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, + * either express or implied. See the License for the specific language + * governing permissions and limitations under the License. + */ +package org.jiemamy.entity.io.gen.model; + +import org.jiemamy.entity.io.gen.desc.CompositeUniqueConstraintDesc; + +/** + * {@link CompositeUniqueConstraintModel}のファクトリインターフェイス。 + * + * @author j5ik2o + */ +public interface CompositeUniqueConstraintModelFactory { + + /** + * 複合一意制約モデルを取得する。 + * + * @param compositeUniqueConstraintDesc 複合一意制約記述 + * @return 複合一意制約モデル + */ + CompositeUniqueConstraintModel getUniqueConstraintModel(CompositeUniqueConstraintDesc compositeUniqueConstraintDesc); +} Modified: leto/jiemamy-entity-io/trunk/src/main/java/org/jiemamy/entity/io/gen/model/ConditionAssociationModel.java =================================================================== --- leto/jiemamy-entity-io/trunk/src/main/java/org/jiemamy/entity/io/model/ConditionAssociationModel.java 2009-04-13 09:46:41 UTC (rev 3248) +++ leto/jiemamy-entity-io/trunk/src/main/java/org/jiemamy/entity/io/gen/model/ConditionAssociationModel.java 2009-04-13 09:54:34 UTC (rev 3252) @@ -15,7 +15,7 @@ * either express or implied. See the License for the specific language * governing permissions and limitations under the License. */ -package org.jiemamy.entity.io.model; +package org.jiemamy.entity.io.gen.model; /** * 条件クラスの関連モデル。 Modified: leto/jiemamy-entity-io/trunk/src/main/java/org/jiemamy/entity/io/gen/model/ConditionAttributeModel.java =================================================================== --- leto/jiemamy-entity-io/trunk/src/main/java/org/jiemamy/entity/io/model/ConditionAttributeModel.java 2009-04-13 09:46:41 UTC (rev 3248) +++ leto/jiemamy-entity-io/trunk/src/main/java/org/jiemamy/entity/io/gen/model/ConditionAttributeModel.java 2009-04-13 09:54:34 UTC (rev 3252) @@ -15,7 +15,7 @@ * either express or implied. See the License for the specific language * governing permissions and limitations under the License. */ -package org.jiemamy.entity.io.model; +package org.jiemamy.entity.io.gen.model; /** * 条件クラスの属性モデル。 Modified: leto/jiemamy-entity-io/trunk/src/main/java/org/jiemamy/entity/io/gen/model/ConditionModel.java =================================================================== --- leto/jiemamy-entity-io/trunk/src/main/java/org/jiemamy/entity/io/model/ConditionModel.java 2009-04-13 09:46:41 UTC (rev 3248) +++ leto/jiemamy-entity-io/trunk/src/main/java/org/jiemamy/entity/io/gen/model/ConditionModel.java 2009-04-13 09:54:34 UTC (rev 3252) @@ -15,7 +15,7 @@ * either express or implied. See the License for the specific language * governing permissions and limitations under the License. */ -package org.jiemamy.entity.io.model; +package org.jiemamy.entity.io.gen.model; import java.util.ArrayList; import java.util.Collections; Modified: leto/jiemamy-entity-io/trunk/src/main/java/org/jiemamy/entity/io/gen/model/EntityModel.java =================================================================== --- leto/jiemamy-entity-io/trunk/src/main/java/org/jiemamy/entity/io/model/EntityModel.java 2009-04-13 09:46:41 UTC (rev 3248) +++ leto/jiemamy-entity-io/trunk/src/main/java/org/jiemamy/entity/io/gen/model/EntityModel.java 2009-04-13 09:54:34 UTC (rev 3252) @@ -15,7 +15,7 @@ * either express or implied. See the License for the specific language * governing permissions and limitations under the License. */ -package org.jiemamy.entity.io.model; +package org.jiemamy.entity.io.gen.model; import java.util.Collections; import java.util.List; Deleted: leto/jiemamy-entity-io/trunk/src/main/java/org/jiemamy/entity/io/gen/model/EntityModelFactory.java =================================================================== --- leto/jiemamy-entity-io/trunk/src/main/java/org/jiemamy/entity/io/model/EntityModelFactory.java 2009-04-13 09:46:41 UTC (rev 3248) +++ leto/jiemamy-entity-io/trunk/src/main/java/org/jiemamy/entity/io/gen/model/EntityModelFactory.java 2009-04-13 09:54:34 UTC (rev 3252) @@ -1,36 +0,0 @@ -/* - * Copyright 2007-2009 Jiemamy Project and the Others. - * - * This file is part of Jiemamy. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, - * either express or implied. See the License for the specific language - * governing permissions and limitations under the License. - */ -package org.jiemamy.entity.io.model; - -import org.jiemamy.entity.io.desc.EntityDesc; - -/** - * {@link EntityModel エンティティクラスのモデル}のファクトリインターフェイス。 - * - * @author j5ik2o - */ -public interface EntityModelFactory { - - /** - * エンティティクラスのモデルを取得する。 - * - * @param entityDesc エンティティ記述 - * @return エンティティクラスのモデル - */ - EntityModel getEntityModel(EntityDesc entityDesc); -} Copied: leto/jiemamy-entity-io/trunk/src/main/java/org/jiemamy/entity/io/gen/model/EntityModelFactory.java (from rev 3251, leto/jiemamy-entity-io/trunk/src/main/java/org/jiemamy/entity/io/model/EntityModelFactory.java) =================================================================== --- leto/jiemamy-entity-io/trunk/src/main/java/org/jiemamy/entity/io/gen/model/EntityModelFactory.java (rev 0) +++ leto/jiemamy-entity-io/trunk/src/main/java/org/jiemamy/entity/io/gen/model/EntityModelFactory.java 2009-04-13 09:54:34 UTC (rev 3252) @@ -0,0 +1,36 @@ +/* + * Copyright 2007-2009 Jiemamy Project and the Others. + * + * This file is part of Jiemamy. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, + * either express or implied. See the License for the specific language + * governing permissions and limitations under the License. + */ +package org.jiemamy.entity.io.gen.model; + +import org.jiemamy.entity.io.gen.desc.EntityDesc; + +/** + * {@link EntityModel エンティティクラスのモデル}のファクトリインターフェイス。 + * + * @author j5ik2o + */ +public interface EntityModelFactory { + + /** + * エンティティクラスのモデルを取得する。 + * + * @param entityDesc エンティティ記述 + * @return エンティティクラスのモデル + */ + EntityModel getEntityModel(EntityDesc entityDesc); +} Modified: leto/jiemamy-entity-io/trunk/src/main/java/org/jiemamy/entity/io/gen/model/GeneratedModel.java =================================================================== --- leto/jiemamy-entity-io/trunk/src/main/java/org/jiemamy/entity/io/model/GeneratedModel.java 2009-04-13 09:46:41 UTC (rev 3248) +++ leto/jiemamy-entity-io/trunk/src/main/java/org/jiemamy/entity/io/gen/model/GeneratedModel.java 2009-04-13 09:54:34 UTC (rev 3252) @@ -15,7 +15,7 @@ * either express or implied. See the License for the specific language * governing permissions and limitations under the License. */ -package org.jiemamy.entity.io.model; +package org.jiemamy.entity.io.gen.model; import java.util.ArrayList; import java.util.Collections; Modified: leto/jiemamy-entity-io/trunk/src/main/java/org/jiemamy/entity/io/gen/model/JoinColumnModel.java =================================================================== --- leto/jiemamy-entity-io/trunk/src/main/java/org/jiemamy/entity/io/model/JoinColumnModel.java 2009-04-13 09:46:41 UTC (rev 3248) +++ leto/jiemamy-entity-io/trunk/src/main/java/org/jiemamy/entity/io/gen/model/JoinColumnModel.java 2009-04-13 09:54:34 UTC (rev 3252) @@ -15,7 +15,7 @@ * either express or implied. See the License for the specific language * governing permissions and limitations under the License. */ -package org.jiemamy.entity.io.model; +package org.jiemamy.entity.io.gen.model; /** * 結合カラムモデル。 Modified: leto/jiemamy-entity-io/trunk/src/main/java/org/jiemamy/entity/io/gen/model/JoinColumnsModel.java =================================================================== --- leto/jiemamy-entity-io/trunk/src/main/java/org/jiemamy/entity/io/model/JoinColumnsModel.java 2009-04-13 09:46:41 UTC (rev 3248) +++ leto/jiemamy-entity-io/trunk/src/main/java/org/jiemamy/entity/io/gen/model/JoinColumnsModel.java 2009-04-13 09:54:34 UTC (rev 3252) @@ -15,7 +15,7 @@ * either express or implied. See the License for the specific language * governing permissions and limitations under the License. */ -package org.jiemamy.entity.io.model; +package org.jiemamy.entity.io.gen.model; import java.util.ArrayList; import java.util.Collections; Modified: leto/jiemamy-entity-io/trunk/src/main/java/org/jiemamy/entity/io/gen/model/UniqueKeyModel.java =================================================================== --- leto/jiemamy-entity-io/trunk/src/main/java/org/jiemamy/entity/io/model/UniqueKeyModel.java 2009-04-13 09:46:41 UTC (rev 3248) +++ leto/jiemamy-entity-io/trunk/src/main/java/org/jiemamy/entity/io/gen/model/UniqueKeyModel.java 2009-04-13 09:54:34 UTC (rev 3252) @@ -15,7 +15,7 @@ * either express or implied. See the License for the specific language * governing permissions and limitations under the License. */ -package org.jiemamy.entity.io.model; +package org.jiemamy.entity.io.gen.model; import java.util.ArrayList; import java.util.Collections; 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:53:04 UTC (rev 3251) +++ leto/jiemamy-entity-io/trunk/src/main/java/org/jiemamy/entity/io/meta/impl/EntityMetaWriterImpl.java 2009-04-13 09:54:34 UTC (rev 3252) @@ -24,14 +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.gen.generator.EntitySrcFileGenerator; +import org.jiemamy.entity.io.gen.generator.GenerateException; +import org.jiemamy.entity.io.gen.generator.Generator; +import org.jiemamy.entity.io.gen.generator.GeneratorContextImpl; +import org.jiemamy.entity.io.gen.model.EntityModel; 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.model.EntityModel; import org.jiemamy.utils.StringUtil; /**