svnno****@sourc*****
svnno****@sourc*****
2009年 2月 25日 (水) 19:34:06 JST
Revision: 2735 http://svn.sourceforge.jp/view?root=jiemamy&view=rev&rev=2735 Author: daisuke_m Date: 2009-02-25 19:34:06 +0900 (Wed, 25 Feb 2009) Log Message: ----------- ExporterとContextまわりのタイプセーフをジェネリクスで確保。 / ContextをConfigにリネーム。 / 独自拡張ポイント(dialect/importer/exporter)の整備。 / Eclipse上でのImport/Exportにウィザードを使うための拡張ポイント項目追加。 / テスト拡充。 Modified Paths: -------------- artemis/trunk/jiemamy-artemis-test/src/test/java/org/jiemamy/JiemamyTest.java artemis/trunk/jiemamy-composer/src/main/java/org/jiemamy/composer/exporter/HtmlExporter.java artemis/trunk/jiemamy-composer/src/main/java/org/jiemamy/composer/exporter/SqlExporter.java artemis/trunk/jiemamy-composer/src/main/java/org/jiemamy/composer/importer/DatabaseImporter.java artemis/trunk/jiemamy-composer/src/main/java/org/jiemamy/composer/importer/DatabaseReadingContext.java artemis/trunk/jiemamy-composer/src/test/java/org/jiemamy/composer/exporter/SqlExporterTest.java artemis/trunk/jiemamy-composer/src/test/java/org/jiemamy/composer/importer/DatabaseImporterTest.java artemis/trunk/jiemamy-core/.classpath artemis/trunk/jiemamy-core/src/main/java/org/jiemamy/model/RootModelImpl.java artemis/trunk/jiemamy-core/src/main/java/org/jiemamy/serializer/JiemamyDomSerializer.java artemis/trunk/jiemamy-core/src/test/java/org/jiemamy/ArtemisJiemamyFactoryTest.java artemis/trunk/jiemamy-core/src/test/java/org/jiemamy/ArtemisTest.java artemis/trunk/jiemamy-core/src/test/java/org/jiemamy/model/RootModelImplTest.java artemis/trunk/jiemamy-core/src/test/java/org/jiemamy/model/node/TableModelImplTest.java vesta/trunk/org.jiemamy.eclipse/plugin.xml vesta/trunk/org.jiemamy.eclipse/schema/dialects.exsd vesta/trunk/org.jiemamy.eclipse/src/main/java/org/jiemamy/eclipse/JiemamyPlugin.java vesta/trunk/org.jiemamy.eclipse/src/main/java/org/jiemamy/eclipse/action/ExportAction.java vesta/trunk/org.jiemamy.eclipse/src/main/java/org/jiemamy/eclipse/action/ImportAction.java vesta/trunk/org.jiemamy.eclipse/src/main/java/org/jiemamy/eclipse/action/SaveDiagramImageAction.java vesta/trunk/org.jiemamy.eclipse/src/main/java/org/jiemamy/eclipse/editor/DiagramEditorContextMenuProvider.java vesta/trunk/org.jiemamy.eclipse/src/main/java/org/jiemamy/eclipse/editor/JiemamyEditor.java zeus/trunk/jiemamy-spec-core/src/main/java/org/jiemamy/composer/Exporter.java zeus/trunk/jiemamy-spec-core/src/main/java/org/jiemamy/composer/Importer.java zeus/trunk/jiemamy-spec-core/src/main/java/org/jiemamy/model/RootModel.java zeus/trunk/jiemamy-spec-core/src/test/java/org/jiemamy/test/SampleXmlTest.java Added Paths: ----------- artemis/trunk/jiemamy-composer/src/main/java/org/jiemamy/composer/exporter/DefaultHtmlExportConfig.java artemis/trunk/jiemamy-composer/src/main/java/org/jiemamy/composer/exporter/DefaultSqlExportConfig.java artemis/trunk/jiemamy-composer/src/main/java/org/jiemamy/composer/exporter/HtmlExportConfig.java artemis/trunk/jiemamy-composer/src/main/java/org/jiemamy/composer/exporter/SqlExportConfig.java artemis/trunk/jiemamy-composer/src/main/java/org/jiemamy/composer/importer/DatabaseImportConfig.java artemis/trunk/jiemamy-composer/src/main/java/org/jiemamy/composer/importer/DefaultDatabaseImportContext.java vesta/trunk/org.jiemamy.eclipse/schema/exporters.exsd vesta/trunk/org.jiemamy.eclipse/schema/importers.exsd vesta/trunk/org.jiemamy.eclipse/src/main/java/org/jiemamy/eclipse/composer/SqlExportWizard.java vesta/trunk/org.jiemamy.eclipse/src/main/java/org/jiemamy/eclipse/ui/ExporterWizard.java vesta/trunk/org.jiemamy.eclipse/src/main/java/org/jiemamy/eclipse/ui/ImporterWizard.java zeus/trunk/jiemamy-spec-core/src/main/java/org/jiemamy/composer/ExportConfig.java zeus/trunk/jiemamy-spec-core/src/main/java/org/jiemamy/composer/ImportConfig.java Removed Paths: ------------- artemis/trunk/jiemamy-composer/src/main/java/org/jiemamy/composer/exporter/ExportContextImpl.java artemis/trunk/jiemamy-composer/src/main/java/org/jiemamy/composer/importer/ImportContextImpl.java artemis/trunk/jiemamy-core/src/main/java/org/jiemamy/utils/AbstractContext.java vesta/trunk/org.jiemamy.eclipse/schema/composers.exsd vesta/trunk/org.jiemamy.eclipse/src/main/java/org/jiemamy/eclipse/composer/SqlExporterDialog.java vesta/trunk/org.jiemamy.eclipse/src/main/java/org/jiemamy/eclipse/ui/ComposerSettingDialog.java zeus/trunk/jiemamy-spec-core/src/main/java/org/jiemamy/composer/ExportContext.java zeus/trunk/jiemamy-spec-core/src/main/java/org/jiemamy/composer/ImportContext.java zeus/trunk/jiemamy-spec-core/src/main/java/org/jiemamy/utils/Context.java -------------- next part -------------- Modified: artemis/trunk/jiemamy-artemis-test/src/test/java/org/jiemamy/JiemamyTest.java =================================================================== --- artemis/trunk/jiemamy-artemis-test/src/test/java/org/jiemamy/JiemamyTest.java 2009-02-25 04:01:11 UTC (rev 2734) +++ artemis/trunk/jiemamy-artemis-test/src/test/java/org/jiemamy/JiemamyTest.java 2009-02-25 10:34:06 UTC (rev 2735) @@ -38,7 +38,7 @@ */ public class JiemamyTest { - private Jiemamy jiemamy; + Jiemamy jiemamy; /** @@ -71,6 +71,7 @@ assertThat(jiemamy.getFactory(), is(notNullValue())); assertThat(jiemamy.getReferenceResolver(), is(not(nullValue()))); assertThat(jiemamy.getSerializer(), is(notNullValue())); + assertThat(jiemamy.getEventBroker(), is(notNullValue())); } /** @@ -95,5 +96,4 @@ assertThat(rootModel12, is(not(sameInstance(rootModel21)))); assertThat(rootModel12, is(not(sameInstance(rootModel22)))); } - } Added: artemis/trunk/jiemamy-composer/src/main/java/org/jiemamy/composer/exporter/DefaultHtmlExportConfig.java =================================================================== --- artemis/trunk/jiemamy-composer/src/main/java/org/jiemamy/composer/exporter/DefaultHtmlExportConfig.java (rev 0) +++ artemis/trunk/jiemamy-composer/src/main/java/org/jiemamy/composer/exporter/DefaultHtmlExportConfig.java 2009-02-25 10:34:06 UTC (rev 2735) @@ -0,0 +1,61 @@ +/* + * Copyright 2007-2009 Jiemamy Project and the Others. + * Created on 2009/02/25 + * + * This file is part of Jiemamy. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, + * either express or implied. See the License for the specific language + * governing permissions and limitations under the License. + */ +package org.jiemamy.composer.exporter; + +import java.io.File; + +/** + * {@link HtmlExporter}に関する設定情報保持クラス。 + * + * @author daisuke + */ +public class DefaultHtmlExportConfig implements HtmlExportConfig { + + private File outputDir; + + private boolean overwrite; + + + public File getOutputDir() { + return outputDir; + } + + public boolean isOverwirte() { + return overwrite; + } + + /** + * TODO for daisuke + * + * @param outputDir + */ + public void setOutputDir(File outputDir) { + this.outputDir = outputDir; + } + + /** + * TODO for daisuke + * + * @param overwrite + */ + public void setOverwrite(boolean overwrite) { + this.overwrite = overwrite; + } + +} Property changes on: artemis/trunk/jiemamy-composer/src/main/java/org/jiemamy/composer/exporter/DefaultHtmlExportConfig.java ___________________________________________________________________ Added: svn:mime-type + text/plain Added: artemis/trunk/jiemamy-composer/src/main/java/org/jiemamy/composer/exporter/DefaultSqlExportConfig.java =================================================================== --- artemis/trunk/jiemamy-composer/src/main/java/org/jiemamy/composer/exporter/DefaultSqlExportConfig.java (rev 0) +++ artemis/trunk/jiemamy-composer/src/main/java/org/jiemamy/composer/exporter/DefaultSqlExportConfig.java 2009-02-25 10:34:06 UTC (rev 2735) @@ -0,0 +1,61 @@ +/* + * Copyright 2007-2009 Jiemamy Project and the Others. + * Created on 2009/02/25 + * + * This file is part of Jiemamy. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, + * either express or implied. See the License for the specific language + * governing permissions and limitations under the License. + */ +package org.jiemamy.composer.exporter; + +import java.io.File; + +/** + * {@link SqlExporter}に関する設定情報保持クラス。 + * + * @author daisuke + */ +public class DefaultSqlExportConfig implements SqlExportConfig { + + private File outputFile; + + private boolean overwrite; + + + public File getOutputFile() { + return outputFile; + } + + public boolean isOverwrite() { + return overwrite; + } + + /** + * TODO for daisuke + * + * @param outputFile + */ + public void setOutputFile(File outputFile) { + this.outputFile = outputFile; + } + + /** + * TODO for daisuke + * + * @param overwrite + */ + public void setOverwrite(boolean overwrite) { + this.overwrite = overwrite; + } + +} Property changes on: artemis/trunk/jiemamy-composer/src/main/java/org/jiemamy/composer/exporter/DefaultSqlExportConfig.java ___________________________________________________________________ Added: svn:mime-type + text/plain Deleted: artemis/trunk/jiemamy-composer/src/main/java/org/jiemamy/composer/exporter/ExportContextImpl.java =================================================================== --- artemis/trunk/jiemamy-composer/src/main/java/org/jiemamy/composer/exporter/ExportContextImpl.java 2009-02-25 04:01:11 UTC (rev 2734) +++ artemis/trunk/jiemamy-composer/src/main/java/org/jiemamy/composer/exporter/ExportContextImpl.java 2009-02-25 10:34:06 UTC (rev 2735) @@ -1,30 +0,0 @@ -/* - * Copyright 2007-2009 Jiemamy Project and the Others. - * Created on 2008/07/12 - * - * This file is part of Jiemamy. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, - * either express or implied. See the License for the specific language - * governing permissions and limitations under the License. - */ -package org.jiemamy.composer.exporter; - -import org.jiemamy.composer.ExportContext; -import org.jiemamy.utils.AbstractContext; - -/** - * エクスポートに関するコンテキスト情報。 - * @author daisuke - */ -public class ExportContextImpl extends AbstractContext implements ExportContext { - -} Added: artemis/trunk/jiemamy-composer/src/main/java/org/jiemamy/composer/exporter/HtmlExportConfig.java =================================================================== --- artemis/trunk/jiemamy-composer/src/main/java/org/jiemamy/composer/exporter/HtmlExportConfig.java (rev 0) +++ artemis/trunk/jiemamy-composer/src/main/java/org/jiemamy/composer/exporter/HtmlExportConfig.java 2009-02-25 10:34:06 UTC (rev 2735) @@ -0,0 +1,46 @@ +/* + * Copyright 2007-2009 Jiemamy Project and the Others. + * Created on 2009/02/25 + * + * This file is part of Jiemamy. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, + * either express or implied. See the License for the specific language + * governing permissions and limitations under the License. + */ +package org.jiemamy.composer.exporter; + +import java.io.File; + +import org.jiemamy.composer.ExportConfig; + +/** + * {@link HtmlExporter}に関する設定情報インターフェイス。 + * + * @author daisuke + */ +public interface HtmlExportConfig extends ExportConfig { + + /** + * TODO for daisuke + * + * @return + */ + File getOutputDir(); + + /** + * TODO for daisuke + * + * @return + */ + boolean isOverwirte(); + +} Property changes on: artemis/trunk/jiemamy-composer/src/main/java/org/jiemamy/composer/exporter/HtmlExportConfig.java ___________________________________________________________________ Added: svn:mime-type + text/plain Modified: artemis/trunk/jiemamy-composer/src/main/java/org/jiemamy/composer/exporter/HtmlExporter.java =================================================================== --- artemis/trunk/jiemamy-composer/src/main/java/org/jiemamy/composer/exporter/HtmlExporter.java 2009-02-25 04:01:11 UTC (rev 2734) +++ artemis/trunk/jiemamy-composer/src/main/java/org/jiemamy/composer/exporter/HtmlExporter.java 2009-02-25 10:34:06 UTC (rev 2735) @@ -16,12 +16,10 @@ import java.io.File; -import org.apache.commons.lang.ObjectUtils; import org.apache.commons.lang.Validate; import org.apache.commons.lang.builder.ToStringBuilder; import org.apache.commons.lang.builder.ToStringStyle; -import org.jiemamy.composer.ExportContext; import org.jiemamy.composer.ExportException; import org.jiemamy.composer.Exporter; import org.jiemamy.model.RootModel; @@ -31,7 +29,7 @@ * * @author Keisuke.K */ -public class HtmlExporter implements Exporter { +public class HtmlExporter implements Exporter<HtmlExportConfig> { /** ContextKey: オーバーライトするかどうか (Boolean) */ public static final String OVERWRITE = "overwrite"; @@ -43,18 +41,14 @@ public static final String DIALECT = "dialect"; - public boolean exportModel(RootModel rootModel, ExportContext ctx) throws ExportException { + public boolean exportModel(RootModel rootModel, HtmlExportConfig ctx) throws ExportException { Validate.notNull(rootModel); Validate.notNull(ctx); - Validate.notNull(ctx.getValue(OUTPUT_DIR)); - if (ctx.getValue(OVERWRITE) != null && (ctx.getValue(OVERWRITE) instanceof Boolean) == false) { - throw new IllegalArgumentException("The validated object is not Boolean"); - } + Validate.notNull(ctx.getOutputDir()); - File outputDir = ctx.getValue(OUTPUT_DIR); + File outputDir = ctx.getOutputDir(); if (outputDir.exists()) { - boolean overwrite = (Boolean) ObjectUtils.defaultIfNull(ctx.getValue(OVERWRITE), false); - if (overwrite == false) { + if (ctx.isOverwirte() == false) { return false; } Added: artemis/trunk/jiemamy-composer/src/main/java/org/jiemamy/composer/exporter/SqlExportConfig.java =================================================================== --- artemis/trunk/jiemamy-composer/src/main/java/org/jiemamy/composer/exporter/SqlExportConfig.java (rev 0) +++ artemis/trunk/jiemamy-composer/src/main/java/org/jiemamy/composer/exporter/SqlExportConfig.java 2009-02-25 10:34:06 UTC (rev 2735) @@ -0,0 +1,46 @@ +/* + * Copyright 2007-2009 Jiemamy Project and the Others. + * Created on 2009/02/25 + * + * This file is part of Jiemamy. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, + * either express or implied. See the License for the specific language + * governing permissions and limitations under the License. + */ +package org.jiemamy.composer.exporter; + +import java.io.File; + +import org.jiemamy.composer.ExportConfig; + +/** + * {@link SqlExporter}に関する設定情報インターフェイス。 + * + * @author daisuke + */ +public interface SqlExportConfig extends ExportConfig { + + /** + * TODO for daisuke + * + * @return + */ + File getOutputFile(); + + /** + * TODO for daisuke + * + * @return + */ + boolean isOverwrite(); + +} Property changes on: artemis/trunk/jiemamy-composer/src/main/java/org/jiemamy/composer/exporter/SqlExportConfig.java ___________________________________________________________________ Added: svn:mime-type + text/plain Modified: artemis/trunk/jiemamy-composer/src/main/java/org/jiemamy/composer/exporter/SqlExporter.java =================================================================== --- artemis/trunk/jiemamy-composer/src/main/java/org/jiemamy/composer/exporter/SqlExporter.java 2009-02-25 04:01:11 UTC (rev 2734) +++ artemis/trunk/jiemamy-composer/src/main/java/org/jiemamy/composer/exporter/SqlExporter.java 2009-02-25 10:34:06 UTC (rev 2735) @@ -27,14 +27,12 @@ import org.apache.commons.io.IOUtils; import org.apache.commons.lang.CharEncoding; -import org.apache.commons.lang.ObjectUtils; import org.apache.commons.lang.SystemUtils; import org.apache.commons.lang.Validate; import org.apache.commons.lang.builder.ToStringBuilder; import org.apache.commons.lang.builder.ToStringStyle; import org.jiemamy.Jiemamy; -import org.jiemamy.composer.ExportContext; import org.jiemamy.composer.ExportException; import org.jiemamy.composer.Exporter; import org.jiemamy.dialect.Dialect; @@ -47,7 +45,7 @@ * * @author daisuke */ -public class SqlExporter implements Exporter { +public class SqlExporter implements Exporter<SqlExportConfig> { /** ContextKey: オーバーライトするかどうか (Boolean) */ public static final String OVERWRITE = "overwrite"; @@ -56,13 +54,10 @@ public static final String OUTPUT_FILE = "outputFile"; - public boolean exportModel(RootModel rootModel, ExportContext ctx) throws ExportException { + public boolean exportModel(RootModel rootModel, SqlExportConfig ctx) throws ExportException { Validate.notNull(rootModel); Validate.notNull(ctx); - Validate.notNull(ctx.getValue(OUTPUT_FILE)); - if (ctx.getValue(OVERWRITE) != null && (ctx.getValue(OVERWRITE) instanceof Boolean) == false) { - throw new IllegalArgumentException("The validated object is not Boolean"); - } + Validate.notNull(ctx.getOutputFile()); Jiemamy jiemamy = rootModel.getJiemamy(); @@ -72,10 +67,9 @@ EmitConfig config = null; // FIXME ctxより生成 List<SqlStatement> statements = dialect.emitStatements(rootModel, config); - File outputFile = ctx.getValue(OUTPUT_FILE); + File outputFile = ctx.getOutputFile(); if (outputFile.exists()) { - boolean overwrite = (Boolean) ObjectUtils.defaultIfNull(ctx.getValue(OVERWRITE), false); - if (overwrite == false) { + if (ctx.isOverwrite() == false) { return false; } if (outputFile.delete() == false) { Added: artemis/trunk/jiemamy-composer/src/main/java/org/jiemamy/composer/importer/DatabaseImportConfig.java =================================================================== --- artemis/trunk/jiemamy-composer/src/main/java/org/jiemamy/composer/importer/DatabaseImportConfig.java (rev 0) +++ artemis/trunk/jiemamy-composer/src/main/java/org/jiemamy/composer/importer/DatabaseImportConfig.java 2009-02-25 10:34:06 UTC (rev 2735) @@ -0,0 +1,89 @@ +/* + * Copyright 2007-2009 Jiemamy Project and the Others. + * Created on 2009/02/25 + * + * This file is part of Jiemamy. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, + * either express or implied. See the License for the specific language + * governing permissions and limitations under the License. + */ +package org.jiemamy.composer.importer; + +import java.net.URL; + +import org.jiemamy.composer.ImportConfig; +import org.jiemamy.dialect.Dialect; + +/** + * {@link DatabaseImporter}に関する設定情報インターフェイス。 + * + * @author daisuke + */ +public interface DatabaseImportConfig extends ImportConfig { + + /** + * TODO for daisuke + * + * @return + */ + Dialect getDialect(); + + /** + * TODO for daisuke + * + * @return + */ + String getDriverClassName(); + + /** + * TODO for daisuke + * + * @return + */ + URL[] getDriverJarPath(); + + /** + * TODO for daisuke + * + * @return + */ + String[] getEntityTypes(); + + /** + * TODO for daisuke + * + * @return + */ + String getPassword(); + + /** + * TODO for daisuke + * + * @return + */ + String[] getSelectedEntities(); + + /** + * TODO for daisuke + * + * @return + */ + String getUri(); + + /** + * TODO for daisuke + * + * @return + */ + String getUsername(); + +} Property changes on: artemis/trunk/jiemamy-composer/src/main/java/org/jiemamy/composer/importer/DatabaseImportConfig.java ___________________________________________________________________ Added: svn:mime-type + text/plain Modified: artemis/trunk/jiemamy-composer/src/main/java/org/jiemamy/composer/importer/DatabaseImporter.java =================================================================== --- artemis/trunk/jiemamy-composer/src/main/java/org/jiemamy/composer/importer/DatabaseImporter.java 2009-02-25 04:01:11 UTC (rev 2734) +++ artemis/trunk/jiemamy-composer/src/main/java/org/jiemamy/composer/importer/DatabaseImporter.java 2009-02-25 10:34:06 UTC (rev 2735) @@ -35,7 +35,7 @@ import org.apache.commons.lang.builder.ToStringStyle; import org.jiemamy.JiemamyFactory; -import org.jiemamy.composer.ImportContext; +import org.jiemamy.composer.ImportConfig; import org.jiemamy.composer.ImportException; import org.jiemamy.composer.Importer; import org.jiemamy.dialect.Dialect; @@ -59,7 +59,7 @@ * * @author daisuke */ -public class DatabaseImporter implements Importer { +public class DatabaseImporter implements Importer<DefaultDatabaseImportContext> { /** ContextKey: SQL方言 (Dialect) */ public static final String DIALECT = "dialect"; @@ -99,11 +99,11 @@ return "Database Importer"; } - public boolean importModel(RootModel rootModel, ImportContext ctx) throws ImportException { + public boolean importModel(RootModel rootModel, DefaultDatabaseImportContext ctx) throws ImportException { Validate.notNull(rootModel); Validate.notNull(ctx); - dialect = ctx.getValue(DIALECT); + dialect = ctx.getDialect(); Connection connection = null; try { @@ -112,13 +112,13 @@ } Properties props = new Properties(); - props.setProperty("user", (String) ctx.getValue(USERNAME)); - props.setProperty("password", (String) ctx.getValue(PASSWORD)); + props.setProperty("user", ctx.getUsername()); + props.setProperty("password", ctx.getPassword()); - URL[] paths = ctx.getValue(DRIVER_JAR_PATH); - String className = ctx.getValue(DRIVER_CLASS_NAME); + URL[] paths = ctx.getDriverJarPath(); + String className = ctx.getDriverClassName(); Driver driver = DriverUtil.getDriverInstance(paths, className); - connection = driver.connect((String) ctx.getValue(URI), props); + connection = driver.connect(ctx.getUri(), props); DatabaseMetaData meta = connection.getMetaData(); // 詰め替え @@ -186,10 +186,10 @@ * @param rootModel 書き込み先モデル * @param ctx インポートに関するコンテキスト情報 */ - public EntityImportVisitor(DatabaseMetaData meta, RootModel rootModel, ImportContext ctx) { + public EntityImportVisitor(DatabaseMetaData meta, RootModel rootModel, DatabaseImportConfig ctx) { this.meta = meta; this.rootModel = rootModel; - String[] entityTypesValue = ctx.getValue(ENTITY_TYPES); + String[] entityTypesValue = ctx.getEntityTypes(); if (entityTypesValue == null) { entityTypesValue = new String[] { "TABLE", @@ -197,7 +197,7 @@ }; } entityTypes = Arrays.asList(entityTypesValue); - String[] selectedEntitiesValue = ctx.getValue(SELECTED_ENTITIES); + String[] selectedEntitiesValue = ctx.getSelectedEntities(); selectedEntities = selectedEntitiesValue == null ? null : Arrays.asList(selectedEntitiesValue); } @@ -235,7 +235,7 @@ * @param rootModel 書き込み先モデル * @param ctx */ - public RelationImportVisitor(DatabaseMetaData meta, RootModel rootModel, ImportContext ctx) { + public RelationImportVisitor(DatabaseMetaData meta, RootModel rootModel, ImportConfig ctx) { this.rootModel = rootModel; } Modified: artemis/trunk/jiemamy-composer/src/main/java/org/jiemamy/composer/importer/DatabaseReadingContext.java =================================================================== --- artemis/trunk/jiemamy-composer/src/main/java/org/jiemamy/composer/importer/DatabaseReadingContext.java 2009-02-25 04:01:11 UTC (rev 2734) +++ artemis/trunk/jiemamy-composer/src/main/java/org/jiemamy/composer/importer/DatabaseReadingContext.java 2009-02-25 10:34:06 UTC (rev 2735) @@ -18,13 +18,65 @@ */ package org.jiemamy.composer.importer; -import org.jiemamy.utils.AbstractContext; +import java.util.Map; +import org.jiemamy.utils.CollectionsUtil; + /** * データベースからモデルにインポートを行う際のコンテキスト情報。 * * @author daisuke */ -class DatabaseReadingContext extends AbstractContext { +class DatabaseReadingContext { + /** コンテキスト値のマップ */ + private Map<String, Object> properties = CollectionsUtil.newHashMap(); + + + /** + * コンテキスト値のマップを取得する。 + * + * @return コンテキスト値のマップ + */ + public Map<String, Object> getProperties() { + assert properties != null; + return properties; + } + + /** + * コンテキスト値を取得する。 + * + * @param <T> コンテキスト値の型 + * @param key キー + * @return コンテキスト値 + */ + @SuppressWarnings("unchecked") + // TODO キャスト安全性の根拠提示 + public <T>T getValue(String key) { + assert properties != null; + return (T) properties.get(key); + } + + /** + * コンテキスト値のマップを設定する。 + * + * @param properties コンテキスト値のマップ + */ + public void setProperties(Map<String, Object> properties) { + assert properties != null; + this.properties = properties; + } + + /** + * コンテキスト値を設定する。 + * + * @param <T> コンテキスト値の型 + * @param key キー + * @param value コンテキスト値 + */ + public <T>void setValue(String key, T value) { + assert properties != null; + properties.put(key, value); + } + } Copied: artemis/trunk/jiemamy-composer/src/main/java/org/jiemamy/composer/importer/DefaultDatabaseImportContext.java (from rev 2733, artemis/trunk/jiemamy-composer/src/main/java/org/jiemamy/composer/importer/ImportContextImpl.java) =================================================================== --- artemis/trunk/jiemamy-composer/src/main/java/org/jiemamy/composer/importer/DefaultDatabaseImportContext.java (rev 0) +++ artemis/trunk/jiemamy-composer/src/main/java/org/jiemamy/composer/importer/DefaultDatabaseImportContext.java 2009-02-25 10:34:06 UTC (rev 2735) @@ -0,0 +1,228 @@ +/* + * Copyright 2007-2009 Jiemamy Project and the Others. + * Created on 2008/07/12 + * + * This file is part of Jiemamy. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, + * either express or implied. See the License for the specific language + * governing permissions and limitations under the License. + */ +package org.jiemamy.composer.importer; + +import java.net.URL; + +import org.jiemamy.dialect.Dialect; + +/** + * {@link DatabaseImporter}に関する設定情報保持クラス。 + * + * @author daisuke + */ +public class DefaultDatabaseImportContext implements DatabaseImportConfig { + + private Dialect dialect; + + private String driverClassName; + + private URL[] driverJarPath; + + private String[] entityTypes; + + private String password; + + private String[] selectedEntities; + + private String uri; + + private String username; + + private String databaseName; + + private String schema; + + + /** + * TODO for daisuke + * + * @return + */ + public String getDatabaseName() { + return databaseName; + } + + /** + * TODO for daisuke + * + * @return + */ + public Dialect getDialect() { + return dialect; + } + + /** + * TODO for daisuke + * + * @return + */ + public String getDriverClassName() { + return driverClassName; + } + + /** + * TODO for daisuke + * + * @return + */ + public URL[] getDriverJarPath() { + return driverJarPath; + } + + /** + * TODO for daisuke + * + * @return + */ + public String[] getEntityTypes() { + return entityTypes; + } + + /** + * TODO for daisuke + * + * @return + */ + public String getPassword() { + return password; + } + + public String getSchema() { + return schema; + } + + /** + * TODO for daisuke + * + * @return + */ + public String[] getSelectedEntities() { + return selectedEntities; + } + + /** + * TODO for daisuke + * + * @return + */ + public String getUri() { + return uri; + } + + /** + * TODO for daisuke + * + * @return + */ + public String getUsername() { + return username; + } + + /** + * TODO for daisuke + * + * @param databaseName + */ + public void setDatabaseName(String databaseName) { + this.databaseName = databaseName; + } + + /** + * TODO for daisuke + * + * @param dialect + */ + public void setDialect(Dialect dialect) { + this.dialect = dialect; + } + + /** + * TODO for daisuke + * + * @param driverClassName + */ + public void setDriverClassName(String driverClassName) { + this.driverClassName = driverClassName; + } + + /** + * TODO for daisuke + * + * @param driverJarPath + */ + public void setDriverJarPath(URL[] driverJarPath) { + this.driverJarPath = driverJarPath; + } + + /** + * TODO for daisuke + * + * @param entityTypes + */ + public void setEntityTypes(String[] entityTypes) { + this.entityTypes = entityTypes; + } + + /** + * TODO for daisuke + * + * @param password + */ + public void setPassword(String password) { + this.password = password; + } + + /** + * TODO for daisuke + * + * @param schema + */ + public void setSchema(String schema) { + this.schema = schema; + } + + /** + * TODO for daisuke + * + * @param selectedEntities + */ + public void setSelectedEntities(String[] selectedEntities) { + this.selectedEntities = selectedEntities; + } + + /** + * TODO for daisuke + * + * @param uri + */ + public void setUri(String uri) { + this.uri = uri; + } + + /** + * TODO for daisuke + * + * @param username + */ + public void setUsername(String username) { + this.username = username; + } + +} Deleted: artemis/trunk/jiemamy-composer/src/main/java/org/jiemamy/composer/importer/ImportContextImpl.java =================================================================== --- artemis/trunk/jiemamy-composer/src/main/java/org/jiemamy/composer/importer/ImportContextImpl.java 2009-02-25 04:01:11 UTC (rev 2734) +++ artemis/trunk/jiemamy-composer/src/main/java/org/jiemamy/composer/importer/ImportContextImpl.java 2009-02-25 10:34:06 UTC (rev 2735) @@ -1,31 +0,0 @@ -/* - * Copyright 2007-2009 Jiemamy Project and the Others. - * Created on 2008/07/12 - * - * This file is part of Jiemamy. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, - * either express or implied. See the License for the specific language - * governing permissions and limitations under the License. - */ -package org.jiemamy.composer.importer; - -import org.jiemamy.composer.ImportContext; -import org.jiemamy.utils.AbstractContext; - -/** - * インポートに関するコンテキスト情報。 - * - * @author daisuke - */ -public class ImportContextImpl extends AbstractContext implements ImportContext { - -} Modified: artemis/trunk/jiemamy-composer/src/test/java/org/jiemamy/composer/exporter/SqlExporterTest.java =================================================================== --- artemis/trunk/jiemamy-composer/src/test/java/org/jiemamy/composer/exporter/SqlExporterTest.java 2009-02-25 04:01:11 UTC (rev 2734) +++ artemis/trunk/jiemamy-composer/src/test/java/org/jiemamy/composer/exporter/SqlExporterTest.java 2009-02-25 10:34:06 UTC (rev 2735) @@ -36,7 +36,6 @@ import org.jiemamy.Artemis; import org.jiemamy.Jiemamy; import org.jiemamy.JiemamyFactory; -import org.jiemamy.composer.ExportContext; import org.jiemamy.composer.Exporter; import org.jiemamy.model.RootModel; import org.jiemamy.test.ReflectionDialectProvider; @@ -54,7 +53,7 @@ private static final String FILENAME = "./target/sqlExporterTest1.sql"; /** テスト対象のエクスポータ */ - private Exporter exporter = new SqlExporter(); + private Exporter<SqlExportConfig> exporter = new SqlExporter(); private JiemamyFactory factory; @@ -98,9 +97,9 @@ BufferedReader reader = null; try { - ExportContext ctx = new ExportContextImpl(); - ctx.setValue(SqlExporter.OUTPUT_FILE, outputFile); - ctx.setValue(SqlExporter.OVERWRITE, true); + DefaultSqlExportConfig ctx = new DefaultSqlExportConfig(); + ctx.setOutputFile(outputFile); + ctx.setOverwrite(true); exporter.exportModel(model, ctx); assertThat(outputFile.exists(), is(true)); Modified: artemis/trunk/jiemamy-composer/src/test/java/org/jiemamy/composer/importer/DatabaseImporterTest.java =================================================================== --- artemis/trunk/jiemamy-composer/src/test/java/org/jiemamy/composer/importer/DatabaseImporterTest.java 2009-02-25 04:01:11 UTC (rev 2734) +++ artemis/trunk/jiemamy-composer/src/test/java/org/jiemamy/composer/importer/DatabaseImporterTest.java 2009-02-25 10:34:06 UTC (rev 2735) @@ -41,7 +41,6 @@ import org.jiemamy.Artemis; import org.jiemamy.Jiemamy; import org.jiemamy.JiemamyFactory; -import org.jiemamy.composer.ImportContext; import org.jiemamy.composer.Importer; import org.jiemamy.dialect.Dialect; import org.jiemamy.model.RootModel; @@ -78,7 +77,7 @@ private static Logger logger = LoggerFactory.getLogger(DatabaseImporterTest.class); /** {@link DatabaseImporter} */ - public Importer importer = new DatabaseImporter(); + public Importer<DefaultDatabaseImportContext> importer = new DatabaseImporter(); /** SQL方言 */ private Dialect dialect; @@ -127,7 +126,7 @@ @Test @Ignore("H2Dialectが無いとテストできない") public void test01_DBからのインポートテスト() throws Exception { - ImportContext ctx = createContext(); + DefaultDatabaseImportContext ctx = createContext(); logger.info("START import..."); importer.importModel(rootModel, ctx); logger.info("FINISH import."); @@ -203,20 +202,21 @@ * @return インポートコンテキスト情報 * @throws MalformedURLException */ - private ImportContext createContext() throws MalformedURLException { - ImportContext ctx = new ImportContextImpl(); - ctx.setValue(DatabaseImporter.DIALECT, dialect); - ctx.setValue(DatabaseImporter.DATABASE_NAME, "jpoll"); - ctx.setValue(DatabaseImporter.DRIVER_JAR_PATH, new URL[] { + private DefaultDatabaseImportContext createContext() throws MalformedURLException { + DefaultDatabaseImportContext ctx = new DefaultDatabaseImportContext(); + ctx.setDialect(dialect); + ctx.setDatabaseName("jpoll"); + ctx.setDriverJarPath(new URL[] { new File("./src/test/resources/h2-1.1.102.jar").toURL() }); - ctx.setValue(DatabaseImporter.DRIVER_CLASS_NAME, "org.h2.Driver"); - ctx.setValue(DatabaseImporter.URI, "jdbc:h2:./src/test/resources/database/testdb"); - ctx.setValue(DatabaseImporter.SCHEMA, ""); - ctx.setValue(DatabaseImporter.USERNAME, "sa"); - ctx.setValue(DatabaseImporter.PASSWORD, ""); - ctx.setValue(DatabaseImporter.SELECTED_ENTITIES, null); - ctx.setValue(DatabaseImporter.ENTITY_TYPES, null); + ctx.setDriverClassName("org.h2.Driver"); + ctx.setUri("jdbc:h2:./src/test/resources/database/testdb"); + ctx.setSchema(""); + ctx.setUsername("sa"); + ctx.setPassword(""); + ctx.setSelectedEntities(null); + ctx.setEntityTypes(null); + return ctx; } Modified: artemis/trunk/jiemamy-core/.classpath =================================================================== --- artemis/trunk/jiemamy-core/.classpath 2009-02-25 04:01:11 UTC (rev 2734) +++ artemis/trunk/jiemamy-core/.classpath 2009-02-25 10:34:06 UTC (rev 2735) @@ -4,7 +4,7 @@ <classpathentry kind="src" path="src/main/resources"/> <classpathentry kind="src" output="target/test-classes" path="src/test/java"/> <classpathentry kind="src" output="target/test-classes" path="src/test/resources"/> + <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/J2SE-1.5"/> <classpathentry kind="con" path="org.devzuz.q.maven.jdt.core.mavenClasspathContainer"/> - <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/J2SE-1.5"/> <classpathentry kind="output" path="target/classes"/> </classpath> Modified: artemis/trunk/jiemamy-core/src/main/java/org/jiemamy/model/RootModelImpl.java =================================================================== --- artemis/trunk/jiemamy-core/src/main/java/org/jiemamy/model/RootModelImpl.java 2009-02-25 04:01:11 UTC (rev 2734) +++ artemis/trunk/jiemamy-core/src/main/java/org/jiemamy/model/RootModelImpl.java 2009-02-25 10:34:06 UTC (rev 2735) @@ -28,7 +28,6 @@ import org.jiemamy.Jiemamy; import org.jiemamy.dialect.generic.GenericDialect; -import org.jiemamy.exception.UnexpectedConditionError; import org.jiemamy.model.dataset.DataSetModel; import org.jiemamy.model.datatype.DomainModel; import org.jiemamy.model.entity.EntityModel; @@ -82,14 +81,14 @@ super(jiemamy, id); } - @Override - public RootModel clone() { - try { - return (RootModel) super.clone(); - } catch (CloneNotSupportedException e) { - throw new UnexpectedConditionError("RootModel does not implement Cloneable interface."); - } - } +// @Override +// public RootModel clone() { +// try { +// return (RootModel) super.clone(); +// } catch (CloneNotSupportedException e) { +// throw new UnexpectedConditionError("RootModel does not implement Cloneable interface."); +// } +// } public String getBeginScript() { return beginScript; Modified: artemis/trunk/jiemamy-core/src/main/java/org/jiemamy/serializer/JiemamyDomSerializer.java =================================================================== --- artemis/trunk/jiemamy-core/src/main/java/org/jiemamy/serializer/JiemamyDomSerializer.java 2009-02-25 04:01:11 UTC (rev 2734) +++ artemis/trunk/jiemamy-core/src/main/java/org/jiemamy/serializer/JiemamyDomSerializer.java 2009-02-25 10:34:06 UTC (rev 2735) @@ -23,9 +23,11 @@ import java.io.InputStream; import java.io.OutputStream; +import javax.xml.XMLConstants; import javax.xml.parsers.DocumentBuilder; import javax.xml.parsers.DocumentBuilderFactory; import javax.xml.parsers.ParserConfigurationException; +import javax.xml.transform.Source; import javax.xml.transform.Transformer; import javax.xml.transform.TransformerConfigurationException; import javax.xml.transform.TransformerException; @@ -33,6 +35,9 @@ import javax.xml.transform.dom.DOMSource; import javax.xml.transform.stream.StreamResult; import javax.xml.transform.stream.StreamSource; +import javax.xml.validation.Schema; +import javax.xml.validation.SchemaFactory; +import javax.xml.validation.Validator; import org.apache.commons.lang.Validate; import org.slf4j.Logger; @@ -141,6 +146,24 @@ protected Document toDom(InputStream in) throws ParserConfigurationException, SAXException, IOException { DocumentBuilder documentBuilder = DOCUMENT_BUILDER_FACTORY.newDocumentBuilder(); Document document = documentBuilder.parse(in); + + // XML SchemaのDOMを作る + DocumentBuilderFactory factory0 = DocumentBuilderFactory.newInstance(); + DocumentBuilder builder0 = factory0.newDocumentBuilder(); + Document coreXsd = builder0.parse(JiemamySerializer.class.getResourceAsStream("/jiemamy-core.xsd")); + Document viewXsd = builder0.parse(JiemamySerializer.class.getResourceAsStream("/jiemamy-view.xsd")); + + // XML Schemaオブジェクトを作る + SchemaFactory schemaFactory = SchemaFactory.newInstance(XMLConstants.W3C_XML_SCHEMA_NS_URI); + Schema schema = schemaFactory.newSchema(new Source[] { + new DOMSource(coreXsd), + new DOMSource(viewXsd) + }); + + // 妥当性検証 + Validator validator = schema.newValidator(); + validator.validate(new DOMSource(document)); + return document; } Deleted: artemis/trunk/jiemamy-core/src/main/java/org/jiemamy/utils/AbstractContext.java =================================================================== --- artemis/trunk/jiemamy-core/src/main/java/org/jiemamy/utils/AbstractContext.java 2009-02-25 04:01:11 UTC (rev 2734) +++ artemis/trunk/jiemamy-core/src/main/java/org/jiemamy/utils/AbstractContext.java 2009-02-25 10:34:06 UTC (rev 2735) @@ -1,79 +0,0 @@ -/* - * Copyright 2007-2009 Jiemamy Project and the Others. - * Created on 2008/07/12 - * - * 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.utils; - -import java.util.Map; - -/** - * コンテキスト情報。 - * - * @author daisuke - */ -public abstract class AbstractContext implements Context { - - /** コンテキスト値のマップ */ - private Map<String, Object> properties = CollectionsUtil.newHashMap(); - - - /** - * コンテキスト値のマップを取得する。 - * - * @return コンテキスト値のマップ - */ - public Map<String, Object> getProperties() { - assert properties != null; - return properties; - } - - /** - * コンテキスト値を取得する。 - * - * @param <T> コンテキスト値の型 - * @param key キー - * @return コンテキスト値 - */ - @SuppressWarnings("unchecked") - // TODO キャスト安全性の根拠提示 - public <T>T getValue(String key) { - assert properties != null; - return (T) properties.get(key); - } - - /** - * コンテキスト値のマップを設定する。 - * - * @param properties コンテキスト値のマップ - */ - public void setProperties(Map<String, Object> properties) { - assert properties != null; - this.properties = properties; - } - - /** - * コンテキスト値を設定する。 - * - * @param <T> コンテキスト値の型 - * @param key キー - * @param value コンテキスト値 - */ - public <T>void setValue(String key, T value) { - assert properties != null; - properties.put(key, value); - } -} Modified: artemis/trunk/jiemamy-core/src/test/java/org/jiemamy/ArtemisJiemamyFactoryTest.java =================================================================== --- artemis/trunk/jiemamy-core/src/test/java/org/jiemamy/ArtemisJiemamyFactoryTest.java 2009-02-25 04:01:11 UTC (rev 2734) +++ artemis/trunk/jiemamy-core/src/test/java/org/jiemamy/ArtemisJiemamyFactoryTest.java 2009-02-25 10:34:06 UTC (rev 2735) @@ -54,7 +54,6 @@ import org.jiemamy.model.entity.ViewModel; import org.jiemamy.model.index.IndexColumnModel; import org.jiemamy.model.index.IndexModel; -import org.jiemamy.serializer.JiemamySerializer; /** * {@link ArtemisJiemamyFactoryTest}のテストクラス。 @@ -93,12 +92,55 @@ } /** + * 各取得メソッドはnullを返さない。 + * + * @throws Exception 例外が発生した場合Xt + */ + @Test + public void test01_各取得メソッドはnullを返さない() throws Exception { + assertThat(factory.getImplementation(), is(notNullValue())); + assertThat(factory.getSerializer(), is(notNullValue())); + assertThat(factory.getSupportedSpecs(), is(notNullValue())); + } + + /** + * {@link JiemamyFactory#hasRootModel()}が正常に機能する。 + * + * @throws Exception 例外が発生した場合 + */ + @Test + public void test02_hasRootModelが正常に機能する() throws Exception { + assertThat(factory.hasRootModel(), is(false)); + factory.getRootModel(); + assertThat(factory.hasRootModel(), is(true)); + } + + /** + * setImplementation, setJiemamyは呼び出せない。 + * + * @throws Exception 例外が発生した場合 + */ + @Test + public void test03_setImplementation_setJiemamyは呼び出せない() throws Exception { + try { + factory.setImplementation(new Artemis()); + fail(); + } catch (IllegalStateException e) { + } + try { + factory.setJiemamy(jiemamy); + fail(); + } catch (IllegalStateException e) { + } + } + + /** * Jiemamyクラスは生成でき_その他クラスは生成できない。 * * @throws Exception 例外が発生した場合 */ @Test - public void test01_Jiemamyクラスは生成でき_その他クラスは生成できない() throws Exception { + public void test04_Jiemamyクラスは生成でき_その他クラスは生成できない() throws Exception { RootModel rootModel = factory.newModel(RootModel.class); assertThat(rootModel, is(notNullValue())); @@ -116,7 +158,7 @@ * @throws Exception 例外が発生した場合 */ @Test - public void test02_各種COREモデルが問題なく生成できる() throws Exception { + public void test05_各種COREモデルが問題なく生成できる() throws Exception { assertThat(factory.newModel(TableModel.class), is(notNullValue())); assertThat(factory.newModel(ViewModel.class), is(notNullValue())); assertThat(factory.newModel(ColumnModel.class), is(notNullValue())); @@ -152,7 +194,7 @@ * @throws Exception 例外が発生した場合 */ @Test - public void test03_IDを指定することにより_そのIDを持つモデルが生成できる() throws Exception { + public void test06_IDを指定することにより_そのIDを持つモデルが生成できる() throws Exception { UUID id = UUID.fromString("ffffffff-ffff-ffff-ffff-ffffffffffff"); ColumnModel[] c = new ColumnModel[] { @@ -193,7 +235,7 @@ * @throws Exception 例外が発生した場合 */ @Test - public void test04_リファレンスを生成し_解決してみる() throws Exception { + public void test07_リファレンスを生成し_解決してみる() throws Exception { ColumnModel columnModel = factory.newModel(ColumnModel.class); ColumnRef columnRef = factory.newReference(columnModel); @@ -207,23 +249,12 @@ } /** - * シリアライザが取得できる。 - * - * @throws Exception 例外が発生した場合 - */ - @Test - public void test05_シリアライザが取得できる() throws Exception { - JiemamySerializer serializer = factory.getSerializer(); - assertThat(serializer, is(notNullValue())); - } - - /** * ファクトリは複数のRootModelを生成できない。 * * @throws Exception 例外が発生した場合 */ @Test - public void test06_ファクトリは複数のRootModelを生成できない() throws Exception { + public void test08_ファクトリは複数のRootModelを生成できない() throws Exception { // RootModelを1つ生成する。 RootModel rootModel1 = factory.newModel(RootModel.class, UUID.fromString("ffffffff-ffff-ffff-ffff-ffffffffffff")); Modified: artemis/trunk/jiemamy-core/src/test/java/org/jiemamy/ArtemisTest.java =================================================================== --- artemis/trunk/jiemamy-core/src/test/java/org/jiemamy/ArtemisTest.java 2009-02-25 04:01:11 UTC (rev 2734) +++ artemis/trunk/jiemamy-core/src/test/java/org/jiemamy/ArtemisTest.java 2009-02-25 10:34:06 UTC (rev 2735) @@ -19,6 +19,7 @@ package org.jiemamy; import static org.hamcrest.CoreMatchers.is; +import static org.hamcrest.CoreMatchers.notNullValue; import static org.junit.Assert.assertThat; import java.util.Set; @@ -69,4 +70,15 @@ assertThat(coreSupportedSpecs.contains(OfficialSpecs.VIEW), is(false)); assertThat(coreSupportedSpecs.contains(OfficialSpecs.DIFF), is(false)); } + + /** + * 各取得メソッドはnullを返さない。 + * + * @throws Exception 例外が発生した場合 + */ + @Test + public void test02_各取得メソッドはnullを返さない() throws Exception { + assertThat(core.getEventBroker(), is(notNullValue())); + assertThat(core.getReferenceResolver(), is(notNullValue())); + } } Modified: artemis/trunk/jiemamy-core/src/test/java/org/jiemamy/model/RootModelImplTest.java =================================================================== --- artemis/trunk/jiemamy-core/src/test/java/org/jiemamy/model/RootModelImplTest.java 2009-02-25 04:01:11 UTC (rev 2734) +++ artemis/trunk/jiemamy-core/src/test/java/org/jiemamy/model/RootModelImplTest.java 2009-02-25 10:34:06 UTC (rev 2735) @@ -19,7 +19,6 @@ package org.jiemamy.model; import static org.hamcrest.CoreMatchers.is; -import static org.hamcrest.CoreMatchers.not; import static org.hamcrest.CoreMatchers.notNullValue; import static org.hamcrest.CoreMatchers.nullValue; import static org.hamcrest.CoreMatchers.sameInstance; @@ -38,7 +37,6 @@ import org.jiemamy.model.entity.TableModel; import org.jiemamy.utils.builder.DataTypeBuilder; import org.jiemamy.utils.model.AttributeUtil; -import org.jiemamy.utils.model.RootModelUtil; /** * {@link RootModelImpl}のテストクラス。 @@ -125,30 +123,30 @@ assertThat(rootModel.getDomains().get(0), is(sameInstance(domain1))); // RootModelをクローニングする - RootModel clone = rootModel.clone(); - - // 各RootModelのIDは同一、インスタンスは別 - assertThat(rootModel.getId(), is(clone.getId())); - assertThat(clone, is(not(sameInstance(rootModel)))); - - // オリジナルとクローンで、domain数は同じ - assertThat(rootModel.getDomains().size(), is(1)); - assertThat(clone.getDomains().size(), is(1)); - - // 各DomainModelのIDは同一、インスタンスは別 - assertThat(rootModel.getDomains().get(0).getId(), is(clone.getDomains().get(0).getId())); - assertThat(rootModel.getDomains().get(1).getId(), is(clone.getDomains().get(1).getId())); - assertThat(rootModel.getDomains().get(0), is(not(sameInstance(clone.getDomains().get(0))))); - assertThat(rootModel.getDomains().get(1), is(not(sameInstance(clone.getDomains().get(1))))); - - // ここでオリジナルにドメインを追加する - rootModel.getDomains().add(domain2); - - assertThat(rootModel.getDomains().get(1), is(sameInstance(domain2))); - - // 追加分はクローンに影響しない - assertThat(rootModel.getDomains().size(), is(2)); - assertThat(clone.getDomains().size(), is(1)); +// RootModel clone = rootModel.clone(); +// +// // 各RootModelのIDは同一、インスタンスは別 +// assertThat(rootModel.getId(), is(clone.getId())); +// assertThat(clone, is(not(sameInstance(rootModel)))); +// +// // オリジナルとクローンで、domain数は同じ +// assertThat(rootModel.getDomains().size(), is(1)); +// assertThat(clone.getDomains().size(), is(1)); +// +// // 各DomainModelのIDは同一、インスタンスは別 +// assertThat(rootModel.getDomains().get(0).getId(), is(clone.getDomains().get(0).getId())); +// assertThat(rootModel.getDomains().get(1).getId(), is(clone.getDomains().get(1).getId())); +// assertThat(rootModel.getDomains().get(0), is(not(sameInstance(clone.getDomains().get(0))))); +// assertThat(rootModel.getDomains().get(1), is(not(sameInstance(clone.getDomains().get(1))))); +// +// // ここでオリジナルにドメインを追加する +// rootModel.getDomains().add(domain2); +// +// assertThat(rootModel.getDomains().get(1), is(sameInstance(domain2))); +// +// // 追加分はクローンに影響しない +// assertThat(rootModel.getDomains().size(), is(2)); +// assertThat(clone.getDomains().size(), is(1)); } /** @@ -172,30 +170,30 @@ table1.getAttributes().add(fk); // RootModelをクローニングする - RootModel cloneRoot = rootModel.clone(); - TableModel cloneTable1 = RootModelUtil.getEntity(cloneRoot, TableModel.class, "table1"); - TableModel cloneTable2 = RootModelUtil.getEntity(cloneRoot, TableModel.class, "table2"); - ForeignKeyModel cloneFk = RootModelUtil.getAllForeignKeys(cloneRoot).iterator().next(); - - // RootModelのIDは同一、インスタンスは別 - assertThat(cloneRoot.getId(), is(rootModel.getId())); - assertThat(cloneRoot, is(not(sameInstance(rootModel)))); - - // オリジナルとクローンで、node, connectionの数は同じ - assertThat(rootModel.getEntities().size(), is(2)); - assertThat(cloneRoot.getEntities().size(), is(2)); - assertThat(RootModelUtil.getAllForeignKeys(rootModel).size(), is(1)); - assertThat(RootModelUtil.getAllForeignKeys(cloneRoot).size(), is(1)); - - // node, connectionのIDは同一 - assertThat(table1.getId(), is(cloneTable1.getId())); - assertThat(table2.getId(), is(cloneTable1.getId())); - assertThat(cloneFk.getId(), is(fk.getId())); - - // node, connectionのインスタンスは別 - assertThat(table1, is(not(sameInstance(cloneTable1)))); - assertThat(table2, is(not(sameInstance(cloneTable2)))); - assertThat(cloneFk, is(not(sameInstance(fk)))); +// RootModel cloneRoot = rootModel.clone(); +// TableModel cloneTable1 = RootModelUtil.getEntity(cloneRoot, TableModel.class, "table1"); +// TableModel cloneTable2 = RootModelUtil.getEntity(cloneRoot, TableModel.class, "table2"); +// ForeignKeyModel cloneFk = RootModelUtil.getAllForeignKeys(cloneRoot).iterator().next(); +// +// // RootModelのIDは同一、インスタンスは別 +// assertThat(cloneRoot.getId(), is(rootModel.getId())); +// assertThat(cloneRoot, is(not(sameInstance(rootModel)))); +// +// // オリジナルとクローンで、node, connectionの数は同じ +// assertThat(rootModel.getEntities().size(), is(2)); +// assertThat(cloneRoot.getEntities().size(), is(2)); +// assertThat(RootModelUtil.getAllForeignKeys(rootModel).size(), is(1)); +// assertThat(RootModelUtil.getAllForeignKeys(cloneRoot).size(), is(1)); +// +// // node, connectionのIDは同一 +// assertThat(table1.getId(), is(cloneTable1.getId())); +// assertThat(table2.getId(), is(cloneTable1.getId())); +// assertThat(cloneFk.getId(), is(fk.getId())); +// +// // node, connectionのインスタンスは別 +// assertThat(table1, is(not(sameInstance(cloneTable1)))); +// assertThat(table2, is(not(sameInstance(cloneTable2)))); +// assertThat(cloneFk, is(not(sameInstance(fk)))); } } Modified: artemis/trunk/jiemamy-core/src/test/java/org/jiemamy/model/node/TableModelImplTest.java =================================================================== --- artemis/trunk/jiemamy-core/src/test/java/org/jiemamy/model/node/TableModelImplTest.java 2009-02-25 04:01:11 UTC (rev 2734) +++ artemis/trunk/jiemamy-core/src/test/java/org/jiemamy/model/node/TableModelImplTest.java 2009-02-25 10:34:06 UTC (rev 2735) @@ -37,7 +37,6 @@ import org.jiemamy.model.entity.TableModel; import org.jiemamy.model.entity.TableModelImpl; import org.jiemamy.utils.builder.DataTypeBuilder; -import org.jiemamy.utils.model.RootModelUtil; import org.jiemamy.utils.model.TableUtil; /** @@ -128,28 +127,28 @@ assertThat(TableUtil.getColumns(tableModel).get(0), is(sameInstance(column1))); // RootModelをクローニングする - RootModel cloneRoot = rootModel.clone(); - TableModel cloneTable = RootModelUtil.getEntity(cloneRoot, TableModel.class, "table"); - - // IDは同一、インスタンスは別 - assertThat(cloneTable.getId(), is(tableModel.getId())); - assertThat(cloneTable, is(sameInstance(tableModel))); - - // オリジナルとクローンで、カラム数は同じ - assertThat(tableModel.getAttributes().size(), is(1)); - assertThat(cloneTable.getAttributes().size(), is(1)); - - // カラムのIDは同一、インスタンスは別 - assertThat(cloneTable.getAttributes().get(0).getId(), is(tableModel.getAttributes().get(0).getId())); - assertThat(cloneTable.getAttributes().get(0), is(sameInstance(tableModel.getAttributes().get(0)))); - - tableModel.getAttributes().add(column2); - - // オリジナルにモデルがセットされている - assertThat(TableUtil.getColumns(tableModel).get(1), is(sameInstance(column2))); - - // 追加分はクローンに影響しない - assertThat(tableModel.getAttributes().size(), is(2)); - assertThat(cloneTable.getAttributes().size(), is(1)); +// RootModel cloneRoot = rootModel.clone(); +// TableModel cloneTable = RootModelUtil.getEntity(cloneRoot, TableModel.class, "table"); +// +// // IDは同一、インスタンスは別 +// assertThat(cloneTable.getId(), is(tableModel.getId())); +// assertThat(cloneTable, is(sameInstance(tableModel))); +// +// // オリジナルとクローンで、カラム数は同じ +// assertThat(tableModel.getAttributes().size(), is(1)); +// assertThat(cloneTable.getAttributes().size(), is(1)); +// +// // カラムのIDは同一、インスタンスは別 +// assertThat(cloneTable.getAttributes().get(0).getId(), is(tableModel.getAttributes().get(0).getId())); +// assertThat(cloneTable.getAttributes().get(0), is(sameInstance(tableModel.getAttributes().get(0)))); +// +// tableModel.getAttributes().add(column2); +// +// // オリジナルにモデルがセットされている +// assertThat(TableUtil.getColumns(tableModel).get(1), is(sameInstance(column2))); +// +// // 追加分はクローンに影響しない +// assertThat(tableModel.getAttributes().size(), is(2)); +// assertThat(cloneTable.getAttributes().size(), is(1)); } } Modified: vesta/trunk/org.jiemamy.eclipse/plugin.xml =================================================================== --- vesta/trunk/org.jiemamy.eclipse/plugin.xml 2009-02-25 04:01:11 UTC (rev 2734) +++ vesta/trunk/org.jiemamy.eclipse/plugin.xml 2009-02-25 10:34:06 UTC (rev 2735) @@ -2,7 +2,8 @@ <?eclipse version="3.2"?> <plugin> <extension-point id="dialects" name="%plugin.extension.dialects" schema="schema/dialects.exsd"/> - <extension-point id="composers" name="%plugin.extension.porters" schema="schema/composers.exsd"/> + <extension-point id="importers" name="%plugin.extension.importers" schema="schema/importers.exsd"/> + <extension-point id="exporters" name="%plugin.extension.exporters" schema="schema/exporters.exsd"/> <extension-point id="validators" name="%plugin.extension.validators" schema="schema/validators.exsd"/> <extension @@ -12,11 +13,11 @@ </extension> <extension - point="org.jiemamy.eclipse.composers"> + point="org.jiemamy.eclipse.exporters"> <exporter name="SQL" class="org.jiemamy.composer.exporter.SqlExporter" - dialog="org.jiemamy.eclipse.composer.SqlExporterDialog"/> + wizard="org.jiemamy.eclipse.composer.SqlExportWizard"/> </extension> Deleted: vesta/trunk/org.jiemamy.eclipse/schema/composers.exsd =================================================================== --- vesta/trunk/org.jiemamy.eclipse/schema/composers.exsd 2009-02-25 04:01:11 UTC (rev 2734) +++ vesta/trunk/org.jiemamy.eclipse/schema/composers.exsd 2009-02-25 10:34:06 UTC (rev 2735) @@ -1,149 +0,0 @@ -<?xml version='1.0' encoding='UTF-8'?> -<!-- Schema file written by PDE --> -<schema targetNamespace="org.jiemamy.core"> -<annotation> - <appInfo> - <meta.schema plugin="org.jiemamy.core" id="composers" name="%plugin.extension.porters"/> - </appInfo> - <documentation> - </documentation> - </annotation> - - <element name="extension"> - <complexType> - <sequence> - <element ref="importer" minOccurs="0" maxOccurs="unbounded"/> - <element ref="exporter" minOccurs="0" maxOccurs="unbounded"/> - </sequence> - <attribute name="point" type="string" use="required"> - <annotation> - <documentation> - - </documentation> - </annotation> - </attribute> - <attribute name="id" type="string"> - <annotation> - <documentation> - - </documentation> - </annotation> - </attribute> - <attribute name="name" type="string"> - <annotation> - <documentation> - - </documentation> - <appInfo> - <meta.attribute translatable="true"/> - </appInfo> - </annotation> - </attribute> - </complexType> - </element> - - <element name="importer"> - <complexType> - <attribute name="name" type="string" use="required"> - <annotation> - <documentation> - - </documentation> - </annotation> - </attribute> - <attribute name="class" type="string" use="required"> - <annotation> - <documentation> - - </documentation> - <appInfo> - <meta.attribute kind="java" basedOn="org.jiemamy.core.extension.composer.importer.Importer"/> - </appInfo> - </annotation> - </attribute> - <attribute name="uiScript" type="string" use="required"> - <annotation> - <documentation> - - </documentation> - </annotation> - </attribute> - </complexType> - </element> - - <element name="exporter"> - <complexType> - <attribute name="name" type="string" use="required"> - <annotation> - <documentation> - - </documentation> - </annotation> - </attribute> - <attribute name="class" type="string" use="required"> - <annotation> - <documentation> - - </documentation> - <appInfo> - <meta.attribute kind="java" basedOn="org.jiemamy.core.extension.composer.exporter.Exporter"/> - </appInfo> - </annotation> - </attribute> - <attribute name="dialog" type="string" use="required"> - <annotation> - <documentation> - - </documentation> - <appInfo> - <meta.attribute kind="java" basedOn="org.jiemamy.eclipse.ui.ComposerSettingDialog"/> - </appInfo> - </annotation> - </attribute> - </complexType> - </element> - - <annotation> - <appInfo> - <meta.section type="since"/> - </appInfo> - <documentation> - 0.2.0 - </documentation> - </annotation> - - <annotation> - <appInfo> - <meta.section type="examples"/> - </appInfo> - <documentation> - </documentation> - </annotation> - - <annotation> - <appInfo> - <meta.section type="apiInfo"/> - </appInfo> - <documentation> - Plug-ins that want to extend this extension point must implement the <samp>org.jiemamy.core.extension.importer.Importer</samp> interface. - </documentation> - </annotation> - - <annotation> - <appInfo> - <meta.section type="implementation"/> - </appInfo> - <documentation> - </documentation> - </annotation> - - <annotation> - <appInfo> - <meta.section type="copyright"/> - </appInfo> - <documentation> - Copyright (c) 2007-2008, Jiemamy Project. All rights reserved. - </documentation> - </annotation> - -</schema> Modified: vesta/trunk/org.jiemamy.eclipse/schema/dialects.exsd =================================================================== --- vesta/trunk/org.jiemamy.eclipse/schema/dialects.exsd 2009-02-25 04:01:11 UTC (rev 2734) +++ vesta/trunk/org.jiemamy.eclipse/schema/dialects.exsd 2009-02-25 10:34:06 UTC (rev 2735) @@ -1,9 +1,9 @@ <?xml version='1.0' encoding='UTF-8'?> <!-- Schema file written by PDE --> -<schema targetNamespace="org.jiemamy.core" xmlns="http://www.w3.org/2001/XMLSchema"> +<schema targetNamespace="org.jiemamy.eclipse" xmlns="http://www.w3.org/2001/XMLSchema"> <annotation> <appinfo> - <meta.schema plugin="org.jiemamy.core" id="dialects" name="%plugin.extension.dialects"/> + <meta.schema plugin="org.jiemamy.eclipse" id="dialects" name="%plugin.extension.dialects"/> </appinfo> <documentation> This extension point is used to plug in additional SQL dialects. An SQL dialect is an object that knows about the restrictions and data types of a Relational Database Management System (RDBMS). Also, a dialect knows how to generate SQL for a given RDBMS. @@ -112,22 +112,13 @@ <p> <pre> <extension - point="org.jiemamy.core.dialects"> + point="org.jiemamy.eclipse.dialects"> <dialect - class="org.jiemamy.dialect.impl.HsqldbDialect" - name="HSQLDB"/> - <dialect - class="org.jiemamy.dialect.impl.DerbyDialect" - name="Derby"/> - <dialect - class="org.jiemamy.dialect.impl.PostgresDialect" + class="org.jiemamy.eclipse.dialect.postgresql.PostgresDialect" name="PostgreSQL"/> - <dialect - class="org.jiemamy.dialect.impl.MysqlDialect" + <dialect + class="org.jiemamy.eclipse.dialect.mysql.MysqlDialect" name="MySQL"/> - <dialect - class="org.jiemamy.dialect.impl.OracleDialect" - name="Oracle"/> </extension> </pre> </p> @@ -151,10 +142,7 @@ The Jiemamy Database Modelling Plugin provides several default SQL dialect implementations: (In alphabetic order:) <ul> - <li>Derby</li> - <li>HSQLDB</li> <li>MySQL</li> - <li>Oracle</li> <li>Postgre SQL</li> </ul> </documentation> @@ -165,7 +153,7 @@ <meta.section type="copyright"/> </appinfo> <documentation> - Copyright (c) 2007-2008, Jiemamy Project. All rights reserved. + Copyright (c) 2007-2009, Jiemamy Project. All rights reserved. </documentation> </annotation> Added: vesta/trunk/org.jiemamy.eclipse/schema/exporters.exsd =================================================================== --- vesta/trunk/org.jiemamy.eclipse/schema/exporters.exsd (rev 0) +++ vesta/trunk/org.jiemamy.eclipse/schema/exporters.exsd 2009-02-25 10:34:06 UTC (rev 2735) @@ -0,0 +1,111 @@ +<?xml version='1.0' encoding='UTF-8'?> +<!-- Schema file written by PDE --> +<schema targetNamespace="org.jiemamy.eclipse" xmlns="http://www.w3.org/2001/XMLSchema"> +<annotation> + <appinfo> + <meta.schema plugin="org.jiemamy.eclipse" id="exporters" name="%plugin.extension.porters"/> + </appinfo> + <documentation> + + </documentation> + </annotation> + + <element name="extension"> + <annotation> + <appinfo> + <meta.element /> + </appinfo> + </annotation> + <complexType> + <sequence> + <element ref="exporter" minOccurs="0" maxOccurs="unbounded"/> + </sequence> + <attribute name="point" type="string" use="required"> + <annotation> + <documentation> + + </documentation> + </annotation> + </attribute> + <attribute name="id" type="string"> + <annotation> + <documentation> + + </documentation> + </annotation> + </attribute> + <attribute name="name" type="string"> + <annotation> + <documentation> + + </documentation> + <appinfo> + <meta.attribute translatable="true"/> + </appinfo> + </annotation> + </attribute> + </complexType> + </element> + + <element name="exporter"> + <complexType> + <attribute name="name" type="string" use="required"> + <annotation> + <documentation> + + </documentation> + </annotation> + </attribute> + <attribute name="class" type="string" use="required"> + <annotation> + <documentation> + + </documentation> + <appinfo> + <meta.attribute kind="java" basedOn="org.jiemamy.core.extension.composer.exporter.Exporter"/> + </appinfo> + </annotation> + </attribute> + <attribute name="wizard" type="string" use="required"> + <annotation> + <documentation> + + </documentation> + <appinfo> + <meta.attribute kind="java" basedOn="org.jiemamy.eclipse.ui.ExporterWizard"/> + </appinfo> + </annotation> + </attribute> + </complexType> + </element> + + <annotation> + <appinfo> + <meta.section type="since"/> + </appinfo> + <documentation> + 0.2.0 + </documentation> + </annotation> + + <annotation> + <appinfo> + <meta.section type="apiInfo"/> + </appinfo> + <documentation> + Plug-ins that want to extend this extension point must implement the <samp>org.jiemamy.core.extension.composer.exporter.Exporter</samp> interface. + </documentation> + </annotation> + + + + <annotation> + <appinfo> + <meta.section type="copyright"/> + </appinfo> + <documentation> + Copyright (c) 2007-2009, Jiemamy Project. All rights reserved. + </documentation> + </annotation> + +</schema> Property changes on: vesta/trunk/org.jiemamy.eclipse/schema/exporters.exsd ___________________________________________________________________ Added: svn:mime-type + text/plain Copied: vesta/trunk/org.jiemamy.eclipse/schema/importers.exsd (from rev 2734, vesta/trunk/org.jiemamy.eclipse/schema/composers.exsd) =================================================================== --- vesta/trunk/org.jiemamy.eclipse/schema/importers.exsd (rev 0) +++ vesta/trunk/org.jiemamy.eclipse/schema/importers.exsd 2009-02-25 10:34:06 UTC (rev 2735) @@ -0,0 +1,111 @@ +<?xml version='1.0' encoding='UTF-8'?> +<!-- Schema file written by PDE --> +<schema targetNamespace="org.jiemamy.eclipse" xmlns="http://www.w3.org/2001/XMLSchema"> +<annotation> + <appinfo> + <meta.schema plugin="org.jiemamy.eclipse" id="importers" name="%plugin.extension.porters"/> + </appinfo> + <documentation> + + </documentation> + </annotation> + + <element name="extension"> + <annotation> + <appinfo> + <meta.element /> + </appinfo> + </annotation> + <complexType> + <sequence> + <element ref="importer" minOccurs="0" maxOccurs="unbounded"/> + </sequence> + <attribute name="point" type="string" use="required"> + <annotation> + <documentation> + + </documentation> + </annotation> + </attribute> + <attribute name="id" type="string"> + <annotation> + <documentation> + + </documentation> + </annotation> + </attribute> + <attribute name="name" type="string"> + <annotation> + <documentation> + + </documentation> + <appinfo> + <meta.attribute translatable="true"/> + </appinfo> + </annotation> + </attribute> + </complexType> + </element> + + <element name="importer"> + <complexType> + <attribute name="name" type="string" use="required"> + <annotation> + <documentation> + + </documentation> + </annotation> + </attribute> + <attribute name="class" type="string" use="required"> + <annotation> + <documentation> + + </documentation> + <appinfo> + <meta.attribute kind="java" basedOn="org.jiemamy.core.extension.composer.importer.Importer"/> + </appinfo> + </annotation> + </attribute> + <attribute name="wizard" type="string" use="required"> + <annotation> + <documentation> + + </documentation> + <appinfo> + <meta.attribute kind="java" basedOn="org.jiemamy.eclipse.ui.ImporterWizard"/> + </appinfo> + </annotation> + </attribute> + </complexType> + </element> + + <annotation> + <appinfo> + <meta.section type="since"/> + </appinfo> + <documentation> + 0.2.0 + </documentation> + </annotation> + + + <annotation> + <appinfo> + <meta.section type="apiInfo"/> + </appinfo> + <documentation> + Plug-ins that want to extend this extension point must implement the <samp>org.jiemamy.core.extension.composer.importer.Importer</samp> interface. + </documentation> + </annotation> + + + <annotation> + <appinfo> + <meta.section type="copyright"/> + </appinfo> + <documentation> + Copyright (c) 2007-2009, Jiemamy Project. All rights reserved. + </documentation> + </annotation> + +</schema> Modified: vesta/trunk/org.jiemamy.eclipse/src/main/java/org/jiemamy/eclipse/JiemamyPlugin.java =================================================================== --- vesta/trunk/org.jiemamy.eclipse/src/main/java/org/jiemamy/eclipse/JiemamyPlugin.java 2009-02-25 04:01:11 UTC (rev 2734) +++ vesta/trunk/org.jiemamy.eclipse/src/main/java/org/jiemamy/eclipse/JiemamyPlugin.java 2009-02-25 10:34:06 UTC (rev 2735) @@ -196,8 +196,8 @@ plugin = this; pref = new JiemamyPreferenceImpl(); dialectResolver = new ExtensionResolver<Dialect>(PLUGIN_ID, "dialects", "dialect", "class"); - importerResolver = new ExtensionResolver<Importer>(PLUGIN_ID, "composers", "importer", "class"); - exporterResolver = new ExtensionResolver<Exporter>(PLUGIN_ID, "composers", "exporter", "class"); + importerResolver = new ExtensionResolver<Importer>(PLUGIN_ID, "importers", "importer", "class"); + exporterResolver = new ExtensionResolver<Exporter>(PLUGIN_ID, "exporters", "exporter", "class"); validatorResolver = new ExtensionResolver<ModelValidator>(PLUGIN_ID, "validators", "dialect", "class"); } Modified: vesta/trunk/org.jiemamy.eclipse/src/main/java/org/jiemamy/eclipse/action/ExportAction.java =================================================================== --- vesta/trunk/org.jiemamy.eclipse/src/main/java/org/jiemamy/eclipse/action/ExportAction.java 2009-02-25 04:01:11 UTC (rev 2734) +++ vesta/trunk/org.jiemamy.eclipse/src/main/java/org/jiemamy/eclipse/action/ExportAction.java 2009-02-25 10:34:06 UTC (rev 2735) @@ -21,6 +21,7 @@ import java.util.ArrayList; import java.util.List; +import org.apache.commons.lang.Validate; import org.eclipse.core.resources.IResource; import org.eclipse.core.resources.ResourcesPlugin; import org.eclipse.core.runtime.CoreException; @@ -28,68 +29,97 @@ import org.eclipse.gef.EditPart; import org.eclipse.gef.GraphicalViewer; import org.eclipse.jface.viewers.IStructuredSelection; +import org.eclipse.jface.window.Window; +import org.eclipse.jface.wizard.WizardDialog; +import org.eclipse.swt.widgets.Shell; import org.eclipse.ui.IFileEditorInput; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.jiemamy.composer.ExportContext; import org.jiemamy.composer.ExportException; import org.jiemamy.composer.Exporter; -import org.jiemamy.eclipse.editor.DiagramEditor; +import org.jiemamy.eclipse.editor.JiemamyEditor; +import org.jiemamy.eclipse.ui.ExporterWizard; import org.jiemamy.eclipse.utils.ExceptionHandler; import org.jiemamy.model.RootModel; +import org.jiemamy.utils.LogMarker; /** - * UI付きPortアクション(import/export)クラス。 + * UI付きexportアクションクラス。 * * @author daisuke */ public class ExportAction extends AbstractJiemamyAction { -// private PorterParameterCreator paramCreator; + private static Logger logger = LoggerFactory.getLogger(ExportAction.class); - private Exporter exporter; + private final Exporter<ExportContext> exporter; - private DiagramEditor editor; + private final ExporterWizard<Exporter<ExportContext>, ExportContext> wizard; + private final JiemamyEditor editor; + /** * インスタンスを生成する。 - * @param exporter - * @param viewer - * @param editor + * + * @param exporter このアクションで実行されるエクスポータ + * @param wizard 実行前にパラメータを設定するためのウィザード + * @param viewer ビューア + * @param editor エディタ + * @throws NullPointerException 引数importerに{@code null}を与えた場合 + * @throws IllegalArgumentException その他引数に{@code null}を与えた場合 */ - public ExportAction(Exporter exporter, GraphicalViewer viewer, DiagramEditor editor) { + public ExportAction(Exporter<ExportContext> exporter, + ExporterWizard<Exporter<ExportContext>, ExportContext> wizard, GraphicalViewer viewer, JiemamyEditor editor) { super(exporter.getName(), viewer); -// paramCreator = porterDto.getParamCreator(); + Validate.notNull(wizard); + Validate.notNull(viewer); + Validate.notNull(editor); + this.exporter = exporter; + this.wizard = wizard; this.editor = editor; + logger.debug(LogMarker.LIFECYCLE, "instanciated" + exporter.getName()); } @Override public void run() { + logger.debug(LogMarker.LIFECYCLE, "run " + exporter.getName()); RootModel rootModel = (RootModel) getViewer().getContents().getModel(); IFileEditorInput input = (IFileEditorInput) editor.getEditorInput(); + wizard.setInput(input); IStructuredSelection selection = (IStructuredSelection) getViewer().getSelection(); List<Object> selectedModels = new ArrayList<Object>(); - for (Object epObj : selection.toList()) { - if (epObj instanceof EditPart) { - selectedModels.add(((EditPart) epObj).getModel()); + for (Object selectedObject : selection.toList()) { + if (selectedObject instanceof EditPart) { + EditPart editPart = (EditPart) selectedObject; + selectedModels.add(editPart.getModel()); } } + + Shell shell = getViewer().getControl().getShell(); try { // パラメータを取得 - ExportContext ctx = null; // paramCreator.execute(input.getFile().getProject(), rootModel, selectedIds); + WizardDialog dialog = new WizardDialog(shell, wizard); + if (dialog.open() != Window.OK) { + logger.debug(LogMarker.LIFECYCLE, "canceled " + exporter.getName()); + return; + } + ExportContext ctx = wizard.getConfig(); + // 実行 exporter.exportModel(rootModel, ctx); + // リフレッシュ ResourcesPlugin.getWorkspace().getRoot().refreshLocal(IResource.DEPTH_INFINITE, new NullProgressMonitor()); } catch (ExportException e) { ExceptionHandler.handleException(e); } catch (CoreException e) { ExceptionHandler.handleException(e); -// } catch (CanceledException e) { -// // nothing to do } } } Modified: vesta/trunk/org.jiemamy.eclipse/src/main/java/org/jiemamy/eclipse/action/ImportAction.java =================================================================== --- vesta/trunk/org.jiemamy.eclipse/src/main/java/org/jiemamy/eclipse/action/ImportAction.java 2009-02-25 04:01:11 UTC (rev 2734) +++ vesta/trunk/org.jiemamy.eclipse/src/main/java/org/jiemamy/eclipse/action/ImportAction.java 2009-02-25 10:34:06 UTC (rev 2735) @@ -21,6 +21,7 @@ import java.util.ArrayList; import java.util.List; +import org.apache.commons.lang.Validate; import org.eclipse.core.resources.IResource; import org.eclipse.core.resources.ResourcesPlugin; import org.eclipse.core.runtime.CoreException; @@ -28,68 +29,95 @@ import org.eclipse.gef.EditPart; import org.eclipse.gef.GraphicalViewer; import org.eclipse.jface.viewers.IStructuredSelection; +import org.eclipse.jface.window.Window; +import org.eclipse.jface.wizard.WizardDialog; +import org.eclipse.swt.widgets.Shell; import org.eclipse.ui.IFileEditorInput; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.jiemamy.composer.ImportContext; import org.jiemamy.composer.ImportException; import org.jiemamy.composer.Importer; -import org.jiemamy.eclipse.editor.DiagramEditor; +import org.jiemamy.eclipse.editor.JiemamyEditor; +import org.jiemamy.eclipse.ui.ImporterWizard; import org.jiemamy.eclipse.utils.ExceptionHandler; import org.jiemamy.model.RootModel; +import org.jiemamy.utils.LogMarker; /** - * UI付きPortアクション(import/export)クラス。 + * UI付きimportアクションクラス。 * * @author daisuke */ public class ImportAction extends AbstractJiemamyAction { -// private PorterParameterCreator paramCreator; + private static Logger logger = LoggerFactory.getLogger(ImportAction.class); - private Importer importer; + private final Importer importer; - private DiagramEditor editor; + private final ImporterWizard wizard; + private final JiemamyEditor editor; + /** * インスタンスを生成する。 - * @param importer - * @param viewer - * @param editor + * + * @param importer このアクションで実行されるインポータ + * @param wizard 実行前にパラメータを設定するためのウィザード + * @param viewer ビューア + * @param editor エディタ + * @throws NullPointerException 引数importerに{@code null}を与えた場合 + * @throws IllegalArgumentException その他引数に{@code null}を与えた場合 */ - public ImportAction(Importer importer, GraphicalViewer viewer, DiagramEditor editor) { + public ImportAction(Importer importer, ImporterWizard wizard, GraphicalViewer viewer, JiemamyEditor editor) { super(importer.getName(), viewer); -// paramCreator = porterDto.getParamCreator(); + Validate.notNull(wizard); + Validate.notNull(viewer); + Validate.notNull(editor); + this.importer = importer; + this.wizard = wizard; this.editor = editor; + logger.debug(LogMarker.LIFECYCLE, "instanciated" + importer.getName()); } @Override public void run() { + logger.debug(LogMarker.LIFECYCLE, "run " + importer.getName()); RootModel rootModel = (RootModel) getViewer().getContents().getModel(); IFileEditorInput input = (IFileEditorInput) editor.getEditorInput(); IStructuredSelection selection = (IStructuredSelection) getViewer().getSelection(); List<Object> selectedModels = new ArrayList<Object>(); - for (Object epObj : selection.toList()) { - if (epObj instanceof EditPart) { - selectedModels.add(((EditPart) epObj).getModel()); + for (Object selectedObject : selection.toList()) { + if (selectedObject instanceof EditPart) { + EditPart editPart = (EditPart) selectedObject; + selectedModels.add(editPart.getModel()); } } + + Shell shell = getViewer().getControl().getShell(); try { // パラメータを取得 - ImportContext ctx = null; // paramCreator.execute(input.getFile().getProject(), rootModel, selectedIds); + WizardDialog dialog = new WizardDialog(shell, wizard); + if (dialog.open() != Window.OK) { + logger.debug(LogMarker.LIFECYCLE, "canceled " + importer.getName()); + return; + } + ImportContext ctx = wizard.getConfig(); + // 実行 importer.importModel(rootModel, ctx); + // リフレッシュ ResourcesPlugin.getWorkspace().getRoot().refreshLocal(IResource.DEPTH_INFINITE, new NullProgressMonitor()); } catch (ImportException e) { ExceptionHandler.handleException(e); } catch (CoreException e) { ExceptionHandler.handleException(e); -// } catch (CanceledException e) { -// // nothing to do } } } Modified: vesta/trunk/org.jiemamy.eclipse/src/main/java/org/jiemamy/eclipse/action/SaveDiagramImageAction.java =================================================================== --- vesta/trunk/org.jiemamy.eclipse/src/main/java/org/jiemamy/eclipse/action/SaveDiagramImageAction.java 2009-02-25 04:01:11 UTC (rev 2734) +++ vesta/trunk/org.jiemamy.eclipse/src/main/java/org/jiemamy/eclipse/action/SaveDiagramImageAction.java 2009-02-25 10:34:06 UTC (rev 2735) @@ -107,7 +107,6 @@ } private void export(GraphicalViewer viewer, String location, int format, boolean overwrite) throws IOException { - IFigure figure = ((AbstractGraphicalEditPart) viewer.getRootEditPart()).getFigure(); File file = new File(location); @@ -212,8 +211,8 @@ * @param project */ public GraphicWizardPage(IProject project) { - super(project, "wizard.export.graphic.title"); // RESOURCE - setDescription("wizard.export.graphic.description"); // RESOURCE + super(project, "画像ファイルのエクスポート"); // RESOURCE + setDescription("ダイアグラムを画像ファイルとしてエクスポートします。"); // RESOURCE formatList.add(new ImageFileFormat("JPEG file format", "jpeg", SWT.IMAGE_JPEG)); // THINK GIF は org.eclipse.swt.SWTException: Unsupported color depth が飛ぶ。何故? Copied: vesta/trunk/org.jiemamy.eclipse/src/main/java/org/jiemamy/eclipse/composer/SqlExportWizard.java (from rev 2734, vesta/trunk/org.jiemamy.eclipse/src/main/java/org/jiemamy/eclipse/composer/SqlExporterDialog.java) =================================================================== --- vesta/trunk/org.jiemamy.eclipse/src/main/java/org/jiemamy/eclipse/composer/SqlExportWizard.java (rev 0) +++ vesta/trunk/org.jiemamy.eclipse/src/main/java/org/jiemamy/eclipse/composer/SqlExportWizard.java 2009-02-25 10:34:06 UTC (rev 2735) @@ -0,0 +1,90 @@ +/* + * Copyright 2007-2009 Jiemamy Project and the Others. + * Created on 2009/02/25 + * + * 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.eclipse.composer; + +import org.eclipse.core.resources.IProject; +import org.eclipse.jface.dialogs.IDialogSettings; +import org.eclipse.jface.viewers.IStructuredSelection; +import org.eclipse.jface.wizard.Wizard; +import org.eclipse.ui.IFileEditorInput; +import org.eclipse.ui.IWorkbench; +import org.eclipse.ui.IWorkbenchWizard; +import org.eclipse.ui.internal.ide.IDEWorkbenchPlugin; + +import org.jiemamy.composer.exporter.SqlExportContext; +import org.jiemamy.composer.exporter.SqlExporter; +import org.jiemamy.eclipse.JiemamyPlugin; +import org.jiemamy.eclipse.ui.ExporterWizard; +import org.jiemamy.eclipse.ui.FolderSelectWizardPage; + +/** + * TODO for daisuke + * + * @author daisuke + */ +public class SqlExportWizard extends Wizard implements ExporterWizard<SqlExporter, SqlExportContext>, IWorkbenchWizard { + + private FolderSelectWizardPage mainPage; + + IFileEditorInput input; + + String defaultFolder = "/"; + + + /** + * Creates a wizard for exporting SQL to the local file system. + */ + public SqlExportWizard() { + IDialogSettings workbenchSettings = JiemamyPlugin.getDefault().getDialogSettings(); + IDialogSettings section = workbenchSettings.getSection("ExportWizard");//$NON-NLS-1$ + if (section == null) { + section = workbenchSettings.addNewSection("ExportWizard");//$NON-NLS-1$ + } + setDialogSettings(section); + } + + @Override + public void addPages() { + super.addPages(); + IProject project = input.getFile().getProject(); + mainPage = new FolderSelectWizardPage(project, "出力先選択", defaultFolder); + addPage(mainPage); + } + + public SqlExportContext getConfig() { + // TODO Auto-generated method stub + return null; + } + + public void init(IWorkbench workbench, IStructuredSelection currentSelection) { + setWindowTitle("SQLにエクスポート"); // RESOURCE + setDefaultPageImageDescriptor(IDEWorkbenchPlugin.getIDEImageDescriptor("wizban/exportdir_wiz.png"));//$NON-NLS-1$ + setNeedsProgressMonitor(true); + } + + @Override + public boolean performFinish() { + return true; + } + + public void setInput(IFileEditorInput input) { + this.input = input; + } + +} Property changes on: vesta/trunk/org.jiemamy.eclipse/src/main/java/org/jiemamy/eclipse/composer/SqlExportWizard.java ___________________________________________________________________ Added: svn:mime-type + text/plain Deleted: vesta/trunk/org.jiemamy.eclipse/src/main/java/org/jiemamy/eclipse/composer/SqlExporterDialog.java =================================================================== --- vesta/trunk/org.jiemamy.eclipse/src/main/java/org/jiemamy/eclipse/composer/SqlExporterDialog.java 2009-02-25 04:01:11 UTC (rev 2734) +++ vesta/trunk/org.jiemamy.eclipse/src/main/java/org/jiemamy/eclipse/composer/SqlExporterDialog.java 2009-02-25 10:34:06 UTC (rev 2735) @@ -1,31 +0,0 @@ -/* - * Copyright 2007-2009 Jiemamy Project and the Others. - * Created on 2009/02/25 - * - * 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.eclipse.composer; - -import org.jiemamy.eclipse.ui.ComposerSettingDialog; - - -/** - * TODO for daisuke - * - * @author daisuke - */ -public class SqlExporterDialog extends ComposerSettingDialog { - -} Modified: vesta/trunk/org.jiemamy.eclipse/src/main/java/org/jiemamy/eclipse/editor/DiagramEditorContextMenuProvider.java =================================================================== --- vesta/trunk/org.jiemamy.eclipse/src/main/java/org/jiemamy/eclipse/editor/DiagramEditorContextMenuProvider.java 2009-02-25 04:01:11 UTC (rev 2734) +++ vesta/trunk/org.jiemamy.eclipse/src/main/java/org/jiemamy/eclipse/editor/DiagramEditorContextMenuProvider.java 2009-02-25 10:34:06 UTC (rev 2735) @@ -18,8 +18,10 @@ */ package org.jiemamy.eclipse.editor; -import java.util.List; +import java.util.Collection; +import org.eclipse.core.runtime.CoreException; +import org.eclipse.core.runtime.IConfigurationElement; import org.eclipse.gef.ContextMenuProvider; import org.eclipse.gef.EditPartViewer; import org.eclipse.gef.GraphicalViewer; @@ -41,6 +43,8 @@ import org.jiemamy.eclipse.action.ImportAction; import org.jiemamy.eclipse.action.PropertyAction; import org.jiemamy.eclipse.action.SaveDiagramImageAction; +import org.jiemamy.eclipse.ui.ExporterWizard; +import org.jiemamy.eclipse.ui.ImporterWizard; /** * コンテキストメニュープロバイダ。 @@ -106,20 +110,34 @@ menu.appendToGroup(GEFActionConstants.GROUP_EDIT, new SaveDiagramImageAction(viewer, editorPart)); menu.appendToGroup(GEFActionConstants.GROUP_EDIT, new AutoLayoutAction(viewer)); - List<Importer> importers = JiemamyPlugin.getImporterResolver().getAllInstance(); - if (importers.size() > 0) { + Collection<IConfigurationElement> importerElements = + JiemamyPlugin.getImporterResolver().getExtensionConfigurationElements().values(); + if (importerElements.size() > 0) { MenuManager importMenu = new MenuManager("インポート(&I)"); // RESOURCE - for (Importer importer : importers) { - importMenu.add(new ImportAction(importer, viewer, editorPart)); + for (IConfigurationElement importerElement : importerElements) { + try { + Importer importer = (Importer) importerElement.createExecutableExtension("class"); + ImporterWizard wizard = (ImporterWizard) importerElement.createExecutableExtension("wizard"); + importMenu.add(new ImportAction(importer, wizard, viewer, editorPart)); + } catch (CoreException e) { + e.printStackTrace(); + } } menu.add(importMenu); } - List<Exporter> exporters = JiemamyPlugin.getExporterResolver().getAllInstance(); - if (exporters.size() > 0) { + Collection<IConfigurationElement> exporterElements = + JiemamyPlugin.getExporterResolver().getExtensionConfigurationElements().values(); + if (exporterElements.size() > 0) { MenuManager exportMenu = new MenuManager("エクスポート(&E)"); // RESOURCE - for (Exporter exporter : exporters) { - exportMenu.add(new ExportAction(exporter, viewer, editorPart)); + for (IConfigurationElement exporterElement : exporterElements) { + try { + Exporter exporter = (Exporter) exporterElement.createExecutableExtension("class"); + ExporterWizard wizard = (ExporterWizard) exporterElement.createExecutableExtension("wizard"); + exportMenu.add(new ExportAction(exporter, wizard, viewer, editorPart)); + } catch (CoreException e) { + e.printStackTrace(); + } } menu.add(exportMenu); } Modified: vesta/trunk/org.jiemamy.eclipse/src/main/java/org/jiemamy/eclipse/editor/JiemamyEditor.java =================================================================== --- vesta/trunk/org.jiemamy.eclipse/src/main/java/org/jiemamy/eclipse/editor/JiemamyEditor.java 2009-02-25 04:01:11 UTC (rev 2734) +++ vesta/trunk/org.jiemamy.eclipse/src/main/java/org/jiemamy/eclipse/editor/JiemamyEditor.java 2009-02-25 10:34:06 UTC (rev 2735) @@ -18,18 +18,21 @@ */ package org.jiemamy.eclipse.editor; +import org.eclipse.ui.IEditorPart; + import org.jiemamy.model.RootModel; /** - * TODO for daisuke + * Jiemamyのモデルエディタをあらわすインターフェイス。 * * @author daisuke */ -public interface JiemamyEditor { +public interface JiemamyEditor extends IEditorPart { /** * {@link RootModel}を取得する。 * @return エディタのルートモデル */ RootModel getRootModel(); + } Deleted: vesta/trunk/org.jiemamy.eclipse/src/main/java/org/jiemamy/eclipse/ui/ComposerSettingDialog.java =================================================================== --- vesta/trunk/org.jiemamy.eclipse/src/main/java/org/jiemamy/eclipse/ui/ComposerSettingDialog.java 2009-02-25 04:01:11 UTC (rev 2734) +++ vesta/trunk/org.jiemamy.eclipse/src/main/java/org/jiemamy/eclipse/ui/ComposerSettingDialog.java 2009-02-25 10:34:06 UTC (rev 2735) @@ -1,29 +0,0 @@ -/* - * Copyright 2007-2009 Jiemamy Project and the Others. - * Created on 2009/02/25 - * - * 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.eclipse.ui; - - -/** - * TODO for daisuke - * - * @author daisuke - */ -public class ComposerSettingDialog { - -} Copied: vesta/trunk/org.jiemamy.eclipse/src/main/java/org/jiemamy/eclipse/ui/ExporterWizard.java (from rev 2734, vesta/trunk/org.jiemamy.eclipse/src/main/java/org/jiemamy/eclipse/ui/ComposerSettingDialog.java) =================================================================== --- vesta/trunk/org.jiemamy.eclipse/src/main/java/org/jiemamy/eclipse/ui/ExporterWizard.java (rev 0) +++ vesta/trunk/org.jiemamy.eclipse/src/main/java/org/jiemamy/eclipse/ui/ExporterWizard.java 2009-02-25 10:34:06 UTC (rev 2735) @@ -0,0 +1,42 @@ +/* + * Copyright 2007-2009 Jiemamy Project and the Others. + * Created on 2009/02/25 + * + * 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.eclipse.ui; + +import org.eclipse.jface.wizard.IWizard; +import org.eclipse.ui.IFileEditorInput; + +import org.jiemamy.composer.ExportContext; +import org.jiemamy.composer.Exporter; + +/** + * TODO for daisuke + * + * @author daisuke + */ +public interface ExporterWizard<T extends Exporter<C>, C extends ExportContext> extends IWizard { + + /** + * TODO for daisuke + * + * @return + */ + C getConfig(); + + void setInput(IFileEditorInput input); +} Property changes on: vesta/trunk/org.jiemamy.eclipse/src/main/java/org/jiemamy/eclipse/ui/ExporterWizard.java ___________________________________________________________________ Added: svn:mime-type + text/plain Added: vesta/trunk/org.jiemamy.eclipse/src/main/java/org/jiemamy/eclipse/ui/ImporterWizard.java =================================================================== --- vesta/trunk/org.jiemamy.eclipse/src/main/java/org/jiemamy/eclipse/ui/ImporterWizard.java (rev 0) +++ vesta/trunk/org.jiemamy.eclipse/src/main/java/org/jiemamy/eclipse/ui/ImporterWizard.java 2009-02-25 10:34:06 UTC (rev 2735) @@ -0,0 +1,39 @@ +/* + * Copyright 2007-2009 Jiemamy Project and the Others. + * Created on 2009/02/25 + * + * 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.eclipse.ui; + +import org.eclipse.jface.wizard.IWizard; + +import org.jiemamy.composer.ImportContext; + +/** + * TODO for daisuke + * + * @author daisuke + */ +public interface ImporterWizard extends IWizard { + + /** + * TODO for daisuke + * + * @return + */ + ImportContext getConfig(); + +} Property changes on: vesta/trunk/org.jiemamy.eclipse/src/main/java/org/jiemamy/eclipse/ui/ImporterWizard.java ___________________________________________________________________ Added: svn:mime-type + text/plain Copied: zeus/trunk/jiemamy-spec-core/src/main/java/org/jiemamy/composer/ExportConfig.java (from rev 2734, zeus/trunk/jiemamy-spec-core/src/main/java/org/jiemamy/composer/ExportContext.java) =================================================================== --- zeus/trunk/jiemamy-spec-core/src/main/java/org/jiemamy/composer/ExportConfig.java (rev 0) +++ zeus/trunk/jiemamy-spec-core/src/main/java/org/jiemamy/composer/ExportConfig.java 2009-02-25 10:34:06 UTC (rev 2735) @@ -0,0 +1,28 @@ +/* + * Copyright 2007-2009 Jiemamy Project and the Others. + * Created on 2008/09/17 + * + * This file is part of Jiemamy. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, + * either express or implied. See the License for the specific language + * governing permissions and limitations under the License. + */ +package org.jiemamy.composer; + +/** + * エクスポートに関する設定情報インターフェイス。 + * + * @author daisuke + */ +public interface ExportConfig { + +} Property changes on: zeus/trunk/jiemamy-spec-core/src/main/java/org/jiemamy/composer/ExportConfig.java ___________________________________________________________________ Added: svn:mime-type + text/plain Deleted: zeus/trunk/jiemamy-spec-core/src/main/java/org/jiemamy/composer/ExportContext.java =================================================================== --- zeus/trunk/jiemamy-spec-core/src/main/java/org/jiemamy/composer/ExportContext.java 2009-02-25 04:01:11 UTC (rev 2734) +++ zeus/trunk/jiemamy-spec-core/src/main/java/org/jiemamy/composer/ExportContext.java 2009-02-25 10:34:06 UTC (rev 2735) @@ -1,30 +0,0 @@ -/* - * Copyright 2007-2009 Jiemamy Project and the Others. - * Created on 2008/09/17 - * - * This file is part of Jiemamy. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, - * either express or implied. See the License for the specific language - * governing permissions and limitations under the License. - */ -package org.jiemamy.composer; - -import org.jiemamy.utils.Context; - -/** - * エクスポートに関するコンテキスト情報。 - * - * @author daisuke - */ -public interface ExportContext extends Context { - -} Modified: zeus/trunk/jiemamy-spec-core/src/main/java/org/jiemamy/composer/Exporter.java =================================================================== --- zeus/trunk/jiemamy-spec-core/src/main/java/org/jiemamy/composer/Exporter.java 2009-02-25 04:01:11 UTC (rev 2734) +++ zeus/trunk/jiemamy-spec-core/src/main/java/org/jiemamy/composer/Exporter.java 2009-02-25 10:34:06 UTC (rev 2735) @@ -23,9 +23,10 @@ /** * Jiemamyモデルから外部リソースに出力を行うインターフェイス。 * + * @param <T> エクスポート作業に必要な設定情報を保持する型 * @author daisuke */ -public interface Exporter { +public interface Exporter<T extends ExportConfig> { /** * モデルを外部リソースにエクスポートする。 @@ -39,7 +40,7 @@ * @throws IllegalArgumentException 引数に{@code null}を与えた場合 * @throws IllegalArgumentException 必須コンテキスト情報が{@code null}または、型が異なる場合 */ - boolean exportModel(RootModel rootModel, ExportContext ctx) throws ExportException; + boolean exportModel(RootModel rootModel, T ctx) throws ExportException; /** * Exporterの名称を取得する。 Copied: zeus/trunk/jiemamy-spec-core/src/main/java/org/jiemamy/composer/ImportConfig.java (from rev 2734, zeus/trunk/jiemamy-spec-core/src/main/java/org/jiemamy/composer/ImportContext.java) =================================================================== --- zeus/trunk/jiemamy-spec-core/src/main/java/org/jiemamy/composer/ImportConfig.java (rev 0) +++ zeus/trunk/jiemamy-spec-core/src/main/java/org/jiemamy/composer/ImportConfig.java 2009-02-25 10:34:06 UTC (rev 2735) @@ -0,0 +1,28 @@ +/* + * Copyright 2007-2009 Jiemamy Project and the Others. + * Created on 2008/09/17 + * + * This file is part of Jiemamy. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, + * either express or implied. See the License for the specific language + * governing permissions and limitations under the License. + */ +package org.jiemamy.composer; + +/** + * インポートに関する設定情報インターフェイス。 + * + * @author daisuke + */ +public interface ImportConfig { + +} Property changes on: zeus/trunk/jiemamy-spec-core/src/main/java/org/jiemamy/composer/ImportConfig.java ___________________________________________________________________ Added: svn:mime-type + text/plain Deleted: zeus/trunk/jiemamy-spec-core/src/main/java/org/jiemamy/composer/ImportContext.java =================================================================== --- zeus/trunk/jiemamy-spec-core/src/main/java/org/jiemamy/composer/ImportContext.java 2009-02-25 04:01:11 UTC (rev 2734) +++ zeus/trunk/jiemamy-spec-core/src/main/java/org/jiemamy/composer/ImportContext.java 2009-02-25 10:34:06 UTC (rev 2735) @@ -1,30 +0,0 @@ -/* - * Copyright 2007-2009 Jiemamy Project and the Others. - * Created on 2008/09/17 - * - * This file is part of Jiemamy. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, - * either express or implied. See the License for the specific language - * governing permissions and limitations under the License. - */ -package org.jiemamy.composer; - -import org.jiemamy.utils.Context; - -/** - * インポートに関するコンテキスト情報インターフェイス。 - * - * @author daisuke - */ -public interface ImportContext extends Context { - -} Modified: zeus/trunk/jiemamy-spec-core/src/main/java/org/jiemamy/composer/Importer.java =================================================================== --- zeus/trunk/jiemamy-spec-core/src/main/java/org/jiemamy/composer/Importer.java 2009-02-25 04:01:11 UTC (rev 2734) +++ zeus/trunk/jiemamy-spec-core/src/main/java/org/jiemamy/composer/Importer.java 2009-02-25 10:34:06 UTC (rev 2735) @@ -23,9 +23,10 @@ /** * 外部リソースからJiemamyモデルに入力を行うインターフェイス。 * + * @param <T> インポート作業に必要な設定情報を保持する型 * @author daisuke */ -public interface Importer { +public interface Importer<T extends ImportConfig> { /** * Importerの名称を取得する。 @@ -45,6 +46,6 @@ * @throws IllegalArgumentException 引数に{@code null}を与えた場合 * @throws ImportException インポートに失敗した時 */ - boolean importModel(RootModel rootModel, ImportContext ctx) throws ImportException; + boolean importModel(RootModel rootModel, T ctx) throws ImportException; } Modified: zeus/trunk/jiemamy-spec-core/src/main/java/org/jiemamy/model/RootModel.java =================================================================== --- zeus/trunk/jiemamy-spec-core/src/main/java/org/jiemamy/model/RootModel.java 2009-02-25 04:01:11 UTC (rev 2734) +++ zeus/trunk/jiemamy-spec-core/src/main/java/org/jiemamy/model/RootModel.java 2009-02-25 10:34:06 UTC (rev 2735) @@ -32,14 +32,15 @@ * * @author daisuke */ -public interface RootModel extends JiemamyElement, Cloneable { +public interface RootModel extends JiemamyElement/*, Cloneable*/{ - /** - * モデルのクローンを生成する。 - * - * @return モデルのクローン - */ - RootModel clone(); + // THINK cloneの検討 +// /** +// * モデルのクローンを生成する。 +// * +// * @return モデルのクローン +// */ +// RootModel clone(); /** * 開始スクリプトを取得する。 Deleted: zeus/trunk/jiemamy-spec-core/src/main/java/org/jiemamy/utils/Context.java =================================================================== --- zeus/trunk/jiemamy-spec-core/src/main/java/org/jiemamy/utils/Context.java 2009-02-25 04:01:11 UTC (rev 2734) +++ zeus/trunk/jiemamy-spec-core/src/main/java/org/jiemamy/utils/Context.java 2009-02-25 10:34:06 UTC (rev 2735) @@ -1,61 +0,0 @@ -/* - * Copyright 2007-2009 Jiemamy Project and the Others. - * Created on 2008/09/17 - * - * 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.utils; - -import java.util.Map; - -/** - * コンテキスト情報インターフェイス。 - * - * @author daisuke - */ -public interface Context { - - /** - * コンテキスト値のマップを取得する。 - * - * @return コンテキスト値のマップ - */ - Map<String, Object> getProperties(); - - /** - * コンテキスト値を取得する。 - * - * @param <T> コンテキスト値の型 - * @param key キー - * @return コンテキスト値 - */ - <T>T getValue(String key); - - /** - * コンテキスト値のマップを設定する。 - * - * @param properties コンテキスト値のマップ - */ - void setProperties(Map<String, Object> properties); - - /** - * コンテキスト値を設定する。 - * - * @param <T> コンテキスト値の型 - * @param key キー - * @param value コンテキスト値 - */ - <T>void setValue(String key, T value); -} Modified: zeus/trunk/jiemamy-spec-core/src/test/java/org/jiemamy/test/SampleXmlTest.java =================================================================== --- zeus/trunk/jiemamy-spec-core/src/test/java/org/jiemamy/test/SampleXmlTest.java 2009-02-25 04:01:11 UTC (rev 2734) +++ zeus/trunk/jiemamy-spec-core/src/test/java/org/jiemamy/test/SampleXmlTest.java 2009-02-25 10:34:06 UTC (rev 2735) @@ -69,10 +69,10 @@ factory.setNamespaceAware(true); factory.setSchema(schema); DocumentBuilder builder = factory.newDocumentBuilder(); - Document xml = builder.parse(SampleXmlTest.class.getResourceAsStream("/sample.xml")); + Document document = builder.parse(SampleXmlTest.class.getResourceAsStream("/sample.xml")); // 妥当性検証 Validator validator = schema.newValidator(); - validator.validate(new DOMSource(xml)); + validator.validate(new DOMSource(document)); } }