svnno****@sourc*****
svnno****@sourc*****
2009年 3月 4日 (水) 19:33:52 JST
Revision: 2810 http://svn.sourceforge.jp/view?root=jiemamy&view=rev&rev=2810 Author: daisuke_m Date: 2009-03-04 19:33:52 +0900 (Wed, 04 Mar 2009) Log Message: ----------- ビルダ系の整備。 / coreプラグインへの拡張を、uiプラグインで読んでいたアンバランスを解消。 / Dialectテスト拡充。 / SavePoint機構の実装。 / LogMarkerを enumにリファクタリング。 / refactor / javadoc Modified Paths: -------------- artemis/trunk/jiemamy-core/src/main/java/org/jiemamy/ArtemisJiemamyFactory.java artemis/trunk/jiemamy-core/src/main/java/org/jiemamy/dialect/AbstractDialect.java artemis/trunk/jiemamy-core/src/main/java/org/jiemamy/dialect/generic/GenericDialect.java artemis/trunk/jiemamy-core/src/main/java/org/jiemamy/editcommand/impl/AbstractDeleteFromCollectionCommand.java artemis/trunk/jiemamy-core/src/main/java/org/jiemamy/editcommand/impl/ModifyModelPropertyCommand.java artemis/trunk/jiemamy-core/src/main/java/org/jiemamy/facade/JiemamyFacadeImpl.java artemis/trunk/jiemamy-core/src/main/java/org/jiemamy/facade/SavePointImpl.java artemis/trunk/jiemamy-core/src/main/java/org/jiemamy/test/TestModelBuilder.java artemis/trunk/jiemamy-core/src/main/java/org/jiemamy/test/TestModelBuilder2.java artemis/trunk/jiemamy-core/src/main/java/org/jiemamy/utils/ArrayEssentialStack.java artemis/trunk/jiemamy-core/src/main/java/org/jiemamy/utils/EssentialStack.java artemis/trunk/jiemamy-core/src/main/java/org/jiemamy/utils/LogMarker.java artemis/trunk/jiemamy-core/src/test/java/org/jiemamy/facade/JiemamyFacadeImplTest.java artemis/trunk/jiemamy-core/src/test/java/org/jiemamy/internal/processor/GetNodesProcessorTest.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 artemis/trunk/jiemamy-dialect-mysql/src/main/java/org/jiemamy/dialect/mysql/MySqlDialect.java artemis/trunk/jiemamy-dialect-mysql/src/test/java/org/jiemamy/dialect/mysql/MySqlDialectTest.java artemis/trunk/jiemamy-dialect-postgresql/src/main/java/org/jiemamy/dialect/postgresql/PostgresqlDialect.java artemis/trunk/jiemamy-dialect-postgresql/src/test/java/org/jiemamy/dialect/postgresql/PostgresqlDialectTest.java artemis/trunk/jiemamy-dialect-sql99/src/main/java/org/jiemamy/dialect/sql99/Sql99Dialect.java vesta/trunk/org.jiemamy.eclipse/.classpath vesta/trunk/org.jiemamy.eclipse/META-INF/MANIFEST.MF vesta/trunk/org.jiemamy.eclipse/src/main/java/org/jiemamy/eclipse/EclipseDialectProvider.java vesta/trunk/org.jiemamy.eclipse/src/main/java/org/jiemamy/eclipse/EclipseExporterProvider.java vesta/trunk/org.jiemamy.eclipse/src/main/java/org/jiemamy/eclipse/EclipseImporterProvider.java 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/editor/DiagramEditorContextMenuProvider.java vesta/trunk/org.jiemamy.eclipse/src/main/java/org/jiemamy/eclipse/editor/DiagramEditorPaletteFactory.java vesta/trunk/org.jiemamy.eclipse/src/main/java/org/jiemamy/eclipse/editor/JmContributor.java vesta/trunk/org.jiemamy.eclipse/src/main/java/org/jiemamy/eclipse/editor/command/CreateConnectionCommand.java vesta/trunk/org.jiemamy.eclipse/src/main/java/org/jiemamy/eclipse/editor/command/DirectEditNodeCommand.java vesta/trunk/org.jiemamy.eclipse/src/main/java/org/jiemamy/eclipse/editor/dialog/root/RootEditDialog.java vesta/trunk/org.jiemamy.eclipse/src/main/java/org/jiemamy/eclipse/editor/dialog/root/RootEditDialogDomainTab.java vesta/trunk/org.jiemamy.eclipse/src/main/java/org/jiemamy/eclipse/editor/dialog/sticky/StickyEditDialog.java vesta/trunk/org.jiemamy.eclipse/src/main/java/org/jiemamy/eclipse/editor/dialog/table/TableEditDialog.java vesta/trunk/org.jiemamy.eclipse/src/main/java/org/jiemamy/eclipse/editor/dialog/table/TableEditDialogColumnTab.java vesta/trunk/org.jiemamy.eclipse/src/main/java/org/jiemamy/eclipse/editor/dialog/table/TableEditDialogLocalKeyTab.java vesta/trunk/org.jiemamy.eclipse/src/main/java/org/jiemamy/eclipse/editor/dialog/view/ViewEditDialog.java vesta/trunk/org.jiemamy.eclipse/src/main/java/org/jiemamy/eclipse/editor/editpart/DiagramEditPartFactory.java vesta/trunk/org.jiemamy.eclipse/src/main/java/org/jiemamy/eclipse/editor/editpart/OutlineTreeEditPartFactory.java vesta/trunk/org.jiemamy.eclipse/src/main/java/org/jiemamy/eclipse/editor/editpart/diagram/RootEditPart.java vesta/trunk/org.jiemamy.eclipse/src/main/java/org/jiemamy/eclipse/editor/editpart/outlinetree/AttributeTreeEditPart.java vesta/trunk/org.jiemamy.eclipse/src/main/java/org/jiemamy/eclipse/editor/editpart/outlinetree/DomainTreeEditPart.java vesta/trunk/org.jiemamy.eclipse/src/main/java/org/jiemamy/eclipse/editor/editpart/outlinetree/ModelContainerEditPart.java vesta/trunk/org.jiemamy.eclipse/src/main/java/org/jiemamy/eclipse/editor/editpart/outlinetree/TableTreeEditPart.java vesta/trunk/org.jiemamy.eclipse/src/main/java/org/jiemamy/eclipse/editor/editpart/outlinetree/ViewTreeEditPart.java vesta/trunk/org.jiemamy.eclipse/src/main/java/org/jiemamy/eclipse/editor/figure/TableFigure.java vesta/trunk/org.jiemamy.eclipse/src/main/java/org/jiemamy/eclipse/editor/figure/ViewFigure.java vesta/trunk/org.jiemamy.eclipse/src/main/java/org/jiemamy/eclipse/preference/JiemamyPreferenceImpl.java vesta/trunk/org.jiemamy.eclipse/src/main/java/org/jiemamy/eclipse/preference/JiemamyPreferenceInitializer.java vesta/trunk/org.jiemamy.eclipse/src/main/java/org/jiemamy/eclipse/preference/JiemamyPreferencePage.java vesta/trunk/org.jiemamy.eclipse/src/main/java/org/jiemamy/eclipse/ui/JiemamyEditDialog.java vesta/trunk/org.jiemamy.eclipse/src/main/java/org/jiemamy/eclipse/utils/ExceptionHandler.java vesta/trunk/org.jiemamy.eclipse/src/main/java/org/jiemamy/eclipse/wizard/NewDiagramWizard.java vesta/trunk/org.jiemamy.eclipse.core/.classpath vesta/trunk/org.jiemamy.eclipse.core/META-INF/MANIFEST.MF vesta/trunk/org.jiemamy.eclipse.core/build.properties zeus/trunk/jiemamy-spec-core/src/main/java/org/jiemamy/JiemamyFactory.java zeus/trunk/jiemamy-spec-core/src/main/java/org/jiemamy/dialect/Dialect.java zeus/trunk/jiemamy-spec-core/src/main/java/org/jiemamy/facade/JiemamyFacade.java zeus/trunk/jiemamy-spec-core/src/main/java/org/jiemamy/facade/SavePoint.java Added Paths: ----------- artemis/trunk/jiemamy-core/src/main/java/org/jiemamy/utils/EssentialStacks.java artemis/trunk/jiemamy-core/src/main/java/org/jiemamy/utils/builder/AbstractJiemamyBuilder.java artemis/trunk/jiemamy-core/src/main/java/org/jiemamy/utils/builder/ColumnBuilderImpl.java artemis/trunk/jiemamy-core/src/main/java/org/jiemamy/utils/builder/DataTypeBuilderImpl.java artemis/trunk/jiemamy-core/src/main/java/org/jiemamy/utils/builder/ForeignKeyBuilderImpl.java artemis/trunk/jiemamy-core/src/main/java/org/jiemamy/utils/builder/TableBuilderImpl.java artemis/trunk/jiemamy-core/src/main/java/org/jiemamy/utils/builder/ViewBuilderImpl.java artemis/trunk/jiemamy-core/src/test/java/org/jiemamy/utils/ArrayEssentialStackTest.java artemis/trunk/jiemamy-core/src/test/java/org/jiemamy/utils/builder/TableBuilderTest.java artemis/trunk/jiemamy-dialect-sql99/src/test/java/org/ artemis/trunk/jiemamy-dialect-sql99/src/test/java/org/jiemamy/ artemis/trunk/jiemamy-dialect-sql99/src/test/java/org/jiemamy/dialect/ artemis/trunk/jiemamy-dialect-sql99/src/test/java/org/jiemamy/dialect/sql99/ artemis/trunk/jiemamy-dialect-sql99/src/test/java/org/jiemamy/dialect/sql99/Sql99DialectTest.java vesta/trunk/jiemamy-vesta/platform_info.target vesta/trunk/org.jiemamy.eclipse/src/main/java/org/jiemamy/eclipse/JiemamyUIPlugin.java vesta/trunk/org.jiemamy.eclipse.core/about.ini vesta/trunk/org.jiemamy.eclipse.core/images/ vesta/trunk/org.jiemamy.eclipse.core/images/jiemamy16.png vesta/trunk/org.jiemamy.eclipse.core/images/jiemamy32.png vesta/trunk/org.jiemamy.eclipse.core/images/jiemamy_about.png vesta/trunk/org.jiemamy.eclipse.core/src/main/java/org/ vesta/trunk/org.jiemamy.eclipse.core/src/main/java/org/jiemamy/ vesta/trunk/org.jiemamy.eclipse.core/src/main/java/org/jiemamy/eclipse/ vesta/trunk/org.jiemamy.eclipse.core/src/main/java/org/jiemamy/eclipse/JiemamyCorePlugin.java vesta/trunk/org.jiemamy.eclipse.core/src/main/java/org/jiemamy/eclipse/extension/ vesta/trunk/org.jiemamy.eclipse.core/src/main/java/org/jiemamy/eclipse/extension/ExtensionResolver.java vesta/trunk/org.jiemamy.eclipse.core/src/main/java/org/jiemamy/eclipse/extension/validator/ vesta/trunk/org.jiemamy.eclipse.core/src/main/java/org/jiemamy/eclipse/extension/validator/ModelValidator.java zeus/trunk/jiemamy-spec-core/src/main/java/org/jiemamy/utils/builder/ColumnBuilder.java zeus/trunk/jiemamy-spec-core/src/main/java/org/jiemamy/utils/builder/DataTypeBuilder.java zeus/trunk/jiemamy-spec-core/src/main/java/org/jiemamy/utils/builder/ForeignKeyBuilder.java zeus/trunk/jiemamy-spec-core/src/main/java/org/jiemamy/utils/builder/JiemamyBuilder.java zeus/trunk/jiemamy-spec-core/src/main/java/org/jiemamy/utils/builder/TableBuilder.java zeus/trunk/jiemamy-spec-core/src/main/java/org/jiemamy/utils/builder/ViewBuilder.java Removed Paths: ------------- artemis/trunk/jiemamy-artemis-test/src/test/java/org/jiemamy/artemis/ artemis/trunk/jiemamy-core/src/main/java/org/jiemamy/utils/TokorotenStack.java artemis/trunk/jiemamy-core/src/main/java/org/jiemamy/utils/builder/ColumnBuilder.java artemis/trunk/jiemamy-core/src/main/java/org/jiemamy/utils/builder/DataTypeBuilder.java artemis/trunk/jiemamy-core/src/main/java/org/jiemamy/utils/builder/ForeignKeyBuilder.java artemis/trunk/jiemamy-core/src/main/java/org/jiemamy/utils/builder/ModelBuilder.java artemis/trunk/jiemamy-core/src/main/java/org/jiemamy/utils/builder/TableBuilder.java artemis/trunk/jiemamy-core/src/main/java/org/jiemamy/utils/builder/ViewBuilder.java artemis/trunk/jiemamy-core/src/test/java/org/jiemamy/builder/ vesta/trunk/org.jiemamy.eclipse/license/LICENSE.stax.txt vesta/trunk/org.jiemamy.eclipse/license/LICENSE.woodstox.txt vesta/trunk/org.jiemamy.eclipse/license/LICENSE.xstream.txt vesta/trunk/org.jiemamy.eclipse/src/main/java/org/jiemamy/eclipse/JiemamyPlugin.java vesta/trunk/org.jiemamy.eclipse/src/main/java/org/jiemamy/eclipse/extension/ExtensionResolver.java vesta/trunk/org.jiemamy.eclipse/src/main/java/org/jiemamy/eclipse/extension/validator/ vesta/trunk/org.jiemamy.eclipse.core/license/LICENSE.eclipse-common.txt vesta/trunk/org.jiemamy.eclipse.core/license/LICENSE.stax.txt vesta/trunk/org.jiemamy.eclipse.core/license/LICENSE.woodstox.txt vesta/trunk/org.jiemamy.eclipse.core/license/LICENSE.xstream.txt vesta/trunk/org.jiemamy.eclipse.core/platform_info.target zeus/trunk/jiemamy-spec-core/src/main/java/org/jiemamy/utils/builder/MaturedBuilder.java zeus/trunk/jiemamy-spec-core/src/main/java/org/jiemamy/utils/builder/MaturedTableBuilder.java zeus/trunk/jiemamy-spec-core/src/main/java/org/jiemamy/utils/builder/PrematureBuilder.java zeus/trunk/jiemamy-spec-core/src/main/java/org/jiemamy/utils/builder/PrematureTableBuilder.java -------------- next part -------------- Modified: artemis/trunk/jiemamy-core/src/main/java/org/jiemamy/ArtemisJiemamyFactory.java =================================================================== --- artemis/trunk/jiemamy-core/src/main/java/org/jiemamy/ArtemisJiemamyFactory.java 2009-03-03 18:33:18 UTC (rev 2809) +++ artemis/trunk/jiemamy-core/src/main/java/org/jiemamy/ArtemisJiemamyFactory.java 2009-03-04 10:33:52 UTC (rev 2810) @@ -39,7 +39,7 @@ import org.jiemamy.serializer.JiemamyDomSerializer; import org.jiemamy.serializer.JiemamySerializer; import org.jiemamy.utils.ValidateUtil; -import org.jiemamy.utils.builder.PrematureBuilder; +import org.jiemamy.utils.builder.JiemamyBuilder; /** * {@link JiemamyFactory}のArtemis用実装。 @@ -101,7 +101,7 @@ return rootModel != null; } - public <M, T extends PrematureBuilder<M>>T newBuilder(Class<T> clazz) { + public <M extends JiemamyElement, T extends JiemamyBuilder<M>>T newBuilder(Class<T> clazz) { checkInitialized(); T builder = new FactoryExtension<T>().newInstance(clazz, jiemamy); if (builder == null) { Modified: artemis/trunk/jiemamy-core/src/main/java/org/jiemamy/dialect/AbstractDialect.java =================================================================== --- artemis/trunk/jiemamy-core/src/main/java/org/jiemamy/dialect/AbstractDialect.java 2009-03-03 18:33:18 UTC (rev 2809) +++ artemis/trunk/jiemamy-core/src/main/java/org/jiemamy/dialect/AbstractDialect.java 2009-03-04 10:33:52 UTC (rev 2810) @@ -103,6 +103,10 @@ return emitter.emit(rootModel, config); } + public BuiltinDataTypeMold findDataTypeMold(DataTypeCategory category) { + return findDataTypeMold(category, category.name()); + } + public BuiltinDataTypeMold findDataTypeMold(DataTypeCategory category, String typeName) { Validate.notNull(category); Validate.notNull(typeName); @@ -121,8 +125,7 @@ return mold; } } - // TODO 適当null返し - return null; + return BuiltinDataTypeMold.UNKNOWN; } public ConnectionAdvisor getAdvisor() { Modified: artemis/trunk/jiemamy-core/src/main/java/org/jiemamy/dialect/generic/GenericDialect.java =================================================================== --- artemis/trunk/jiemamy-core/src/main/java/org/jiemamy/dialect/generic/GenericDialect.java 2009-03-03 18:33:18 UTC (rev 2809) +++ artemis/trunk/jiemamy-core/src/main/java/org/jiemamy/dialect/generic/GenericDialect.java 2009-03-04 10:33:52 UTC (rev 2810) @@ -87,6 +87,10 @@ throw new UnsupportedOperationException(); } + public BuiltinDataTypeMold findDataTypeMold(DataTypeCategory category) { + return findDataTypeMold(category, category.name()); + } + public BuiltinDataTypeMold findDataTypeMold(DataTypeCategory category, String typeName) { for (BuiltinDataTypeMold mold : typeList) { if (mold.getCategory() == category && mold.getTypeName().equals(typeName)) { @@ -103,8 +107,7 @@ return mold; } } - // TODO 適当null返し - return null; + return BuiltinDataTypeMold.UNKNOWN; } public ConnectionAdvisor getAdvisor() { Modified: artemis/trunk/jiemamy-core/src/main/java/org/jiemamy/editcommand/impl/AbstractDeleteFromCollectionCommand.java =================================================================== --- artemis/trunk/jiemamy-core/src/main/java/org/jiemamy/editcommand/impl/AbstractDeleteFromCollectionCommand.java 2009-03-03 18:33:18 UTC (rev 2809) +++ artemis/trunk/jiemamy-core/src/main/java/org/jiemamy/editcommand/impl/AbstractDeleteFromCollectionCommand.java 2009-03-04 10:33:52 UTC (rev 2810) @@ -110,4 +110,10 @@ * @return 親モデルが保持する、子モデルの集合 */ public abstract Collection<? super C> getTargetCollection(); + + @Override + public String toString() { + return "DeleteCommand(" + element + " from " + target + ")"; + } + } Modified: artemis/trunk/jiemamy-core/src/main/java/org/jiemamy/editcommand/impl/ModifyModelPropertyCommand.java =================================================================== --- artemis/trunk/jiemamy-core/src/main/java/org/jiemamy/editcommand/impl/ModifyModelPropertyCommand.java 2009-03-03 18:33:18 UTC (rev 2809) +++ artemis/trunk/jiemamy-core/src/main/java/org/jiemamy/editcommand/impl/ModifyModelPropertyCommand.java 2009-03-04 10:33:52 UTC (rev 2810) @@ -105,4 +105,9 @@ public JiemamyElement getTarget() { return target; } + + @Override + public String toString() { + return "ModifyModelPropertyCommand(" + target + "." + property + "=" + oldValue + " to " + newValue + ")"; + } } Modified: artemis/trunk/jiemamy-core/src/main/java/org/jiemamy/facade/JiemamyFacadeImpl.java =================================================================== --- artemis/trunk/jiemamy-core/src/main/java/org/jiemamy/facade/JiemamyFacadeImpl.java 2009-03-03 18:33:18 UTC (rev 2809) +++ artemis/trunk/jiemamy-core/src/main/java/org/jiemamy/facade/JiemamyFacadeImpl.java 2009-03-04 10:33:52 UTC (rev 2810) @@ -18,7 +18,7 @@ */ package org.jiemamy.facade; -import java.util.Stack; +import java.util.Collection; import org.apache.commons.lang.Validate; @@ -38,6 +38,10 @@ import org.jiemamy.model.attribute.constraint.ForeignKeyModel; import org.jiemamy.model.entity.EntityModel; import org.jiemamy.model.entity.TableModel; +import org.jiemamy.utils.ArrayEssentialStack; +import org.jiemamy.utils.CollectionsUtil; +import org.jiemamy.utils.EssentialStack; +import org.jiemamy.utils.EssentialStacks; /** * Jiemamyに対するファサードの実装クラス。 @@ -49,12 +53,19 @@ /** ファサード内のコアとなるJiemamyインスタンス */ protected final Jiemamy jiemamy; - /** TODO for daisuke */ - protected final Stack<Command> undoStack = new Stack<Command>(); + private Collection<SavePointImpl> publishedSavePoints = CollectionsUtil.newArrayList(); /** TODO for daisuke */ - protected final Stack<Command> redoStack = new Stack<Command>(); + protected EssentialStack<Command> undoStack = new ArrayEssentialStack<Command>(); + /** + * TODO for daisuke + * + * @deprecated save/rollback機構で不要になる + */ + @Deprecated + protected final EssentialStack<Command> redoStack = new ArrayEssentialStack<Command>(); + private final CommandProcessor commandProcessor; @@ -128,6 +139,7 @@ * @deprecated use {@link #rollback(SavePoint)} */ @Deprecated + @SuppressWarnings("deprecation") public void redo() { if (redoStack.isEmpty()) { return; @@ -163,29 +175,37 @@ redoStack.clear(); } - /** - * モデルの状態をセーブポイントまでロールバックする。 - * - * @param savePoint セーブポイント - */ public void rollback(SavePoint savePoint) { - // TODO Auto-generated method stub + if (publishedSavePoints.contains(savePoint) == false) { + throw new IllegalArgumentException(); + } + EssentialStack<Command> savePointStack = ((SavePointImpl) savePoint).getUndoStackSnapshot(); + EssentialStack<Command> intersect = EssentialStacks.intersection(undoStack, savePointStack); + + EssentialStack<Command> undoStackMinus = EssentialStacks.minus(undoStack, intersect); + for (Command command : undoStackMinus) { + command.execute(getCommandProcessor()); + } + + EssentialStack<Command> savePointStackMinus = EssentialStacks.minus(savePointStack, intersect); + for (Command command : savePointStackMinus) { + command.getNegateCommand().execute(getCommandProcessor()); + } + undoStack = savePointStack; } - /** - * 現在のモデルの状態にロールバックするためのセーブポイントを取得する。 - * - * @return セーブポイント - */ public SavePoint save() { - // TODO Auto-generated method stub - return null; + EssentialStack<Command> undoCopy = new ArrayEssentialStack<Command>(undoStack); + SavePointImpl sp = new SavePointImpl(undoCopy); + publishedSavePoints.add(sp); + return sp; } /** * @deprecated use {@link #rollback(SavePoint)} */ @Deprecated + @SuppressWarnings("deprecation") public void undo() { if (undoStack.isEmpty()) { return; Modified: artemis/trunk/jiemamy-core/src/main/java/org/jiemamy/facade/SavePointImpl.java =================================================================== --- artemis/trunk/jiemamy-core/src/main/java/org/jiemamy/facade/SavePointImpl.java 2009-03-03 18:33:18 UTC (rev 2809) +++ artemis/trunk/jiemamy-core/src/main/java/org/jiemamy/facade/SavePointImpl.java 2009-03-04 10:33:52 UTC (rev 2810) @@ -18,12 +18,39 @@ */ package org.jiemamy.facade; +import org.jiemamy.editcommand.Command; +import org.jiemamy.utils.ArrayEssentialStack; +import org.jiemamy.utils.EssentialStack; + /** * セーブポイント情報を保持するクラス。 * + * <p>イミュータブルなクラスである。</p> + * * @see JiemamyFacadeImpl#rollback(SavePoint) * @author daisuke */ public class SavePointImpl implements SavePoint { - // UNDONE + + private final EssentialStack<Command> undoStackSnapShot; + + + /** + * インスタンスを生成する。 + * + * @param undoStack + */ + public SavePointImpl(EssentialStack<Command> undoStack) { + undoStackSnapShot = new ArrayEssentialStack<Command>(undoStack); + } + + /** + * スナップショット取得時点のundoスタックを取得する。 + * + * @return スナップショット取得時点のundoスタック + */ + public EssentialStack<Command> getUndoStackSnapshot() { + // イミュータブルにする為、防御コピーを返す + return new ArrayEssentialStack<Command>(undoStackSnapShot); + } } Modified: artemis/trunk/jiemamy-core/src/main/java/org/jiemamy/test/TestModelBuilder.java =================================================================== --- artemis/trunk/jiemamy-core/src/main/java/org/jiemamy/test/TestModelBuilder.java 2009-03-03 18:33:18 UTC (rev 2809) +++ artemis/trunk/jiemamy-core/src/main/java/org/jiemamy/test/TestModelBuilder.java 2009-03-04 10:33:52 UTC (rev 2810) @@ -49,7 +49,7 @@ import org.jiemamy.model.entity.ViewModel; import org.jiemamy.utils.CollectionsUtil; import org.jiemamy.utils.Disablable; -import org.jiemamy.utils.builder.DataTypeBuilder; +import org.jiemamy.utils.builder.DataTypeBuilderImpl; import org.jiemamy.utils.model.ColumnUtil; import org.jiemamy.utils.model.DataSetUtil; import org.jiemamy.utils.model.ForeignKeyUtil; @@ -302,7 +302,7 @@ domainId = factory.newModel(DomainModel.class, uuid.get("2eec0aa0-5122-4eb7-833d-9f5a43e7abe9")); domainId.setName("ID"); - domainId.setDataType(new DataTypeBuilder(factory, DataTypeCategory.INTEGER).build()); + domainId.setDataType(new DataTypeBuilderImpl(factory, DataTypeCategory.INTEGER).build()); NotNullConstraintModel notNull = factory.newModel(NotNullConstraintModel.class, uuid.get("af4845dc-7f3a-434d-b5ac-2f25b74d7e76")); domainId.setNotNull(notNull); @@ -316,7 +316,7 @@ domainName = factory.newModel(DomainModel.class, uuid.get("62f1e6ec-e6aa-4d52-a6c3-27dac086f2d7")); domainName.setName("NAME"); - domainName.setDataType(new DataTypeBuilder(factory, DataTypeCategory.VARCHAR).setSize(32).build()); + domainName.setDataType(new DataTypeBuilderImpl(factory, DataTypeCategory.VARCHAR).setSize(32).build()); domainName.setDescription("人名用の型です。"); rootModel.getDomains().add(domainName); } @@ -611,7 +611,7 @@ deptId = factory.newModel(ColumnModel.class, uuid.get("c7ed225d-92a6-4cc2-90de-60531804464e")); deptId.setName("ID"); if (instruction.supressUseDomain) { - deptId.setDataType(new DataTypeBuilder(factory, DataTypeCategory.INTEGER).build()); + deptId.setDataType(new DataTypeBuilderImpl(factory, DataTypeCategory.INTEGER).build()); } else { ColumnUtil.setDataType(deptId, domainId); } @@ -624,20 +624,20 @@ deptDeptNo = factory.newModel(ColumnModel.class, uuid.get("2d951389-6bc7-49d7-8631-1d26fe17047e")); deptDeptNo.setName("DEPT_NO"); - deptDeptNo.setDataType(new DataTypeBuilder(factory, DataTypeCategory.INTEGER).build()); + deptDeptNo.setDataType(new DataTypeBuilderImpl(factory, DataTypeCategory.INTEGER).build()); deptDeptNo.setLogicalName("部署番号"); tableDept.getAttributes().add(deptDeptNo); deptDeptName = factory.newModel(ColumnModel.class, uuid.get("1fcd63d3-974e-4d2e-a0d8-3b9c233104d9")); deptDeptName.setName("DEPT_NAME"); - deptDeptName.setDataType(new DataTypeBuilder(factory, DataTypeCategory.VARCHAR).setSize(20).build()); + deptDeptName.setDataType(new DataTypeBuilderImpl(factory, DataTypeCategory.VARCHAR).setSize(20).build()); deptDeptName.setLogicalName("部署名"); deptDeptName.getAdapter(RepresentationAdapter.class).setRepresentation(true); tableDept.getAttributes().add(deptDeptName); deptLoc = factory.newModel(ColumnModel.class, uuid.get("7bf79e76-07b8-43b6-a993-b8ef374a31f5")); deptLoc.setName("LOC"); - deptLoc.setDataType(new DataTypeBuilder(factory, DataTypeCategory.VARCHAR).setSize(20).build()); + deptLoc.setDataType(new DataTypeBuilderImpl(factory, DataTypeCategory.VARCHAR).setSize(20).build()); deptLoc.setLogicalName("ロケーション"); deptLoc.setDefaultValue("secret"); tableDept.getAttributes().add(deptLoc); @@ -663,7 +663,7 @@ empId = factory.newModel(ColumnModel.class, uuid.get("44c8e93d-b7ad-46cc-9b29-88c3a7d6c33e")); empId.setName("ID"); if (instruction.supressUseDomain) { - empId.setDataType(new DataTypeBuilder(factory, DataTypeCategory.INTEGER).build()); + empId.setDataType(new DataTypeBuilderImpl(factory, DataTypeCategory.INTEGER).build()); } else { ColumnUtil.setDataType(empId, domainId); } @@ -672,7 +672,7 @@ empEmpNo = factory.newModel(ColumnModel.class, uuid.get("248a429b-2159-4ebd-a791-eee42a059374")); empEmpNo.setName("EMP_NO"); - empEmpNo.setDataType(new DataTypeBuilder(factory, DataTypeCategory.INTEGER).build()); + empEmpNo.setDataType(new DataTypeBuilderImpl(factory, DataTypeCategory.INTEGER).build()); empEmpNo.setLogicalName("従業員番号"); NotNullConstraintModel notNullEmpEmpNo = factory.newModel(NotNullConstraintModel.class, uuid.get("05ee4c06-d8b5-4599-a7e9-1cda036ea2c7")); @@ -683,7 +683,7 @@ empEmpName = factory.newModel(ColumnModel.class, uuid.get("0e51b6df-43ab-408c-90ef-de13c6aab881")); empEmpName.setName("EMP_NAME"); if (instruction.supressUseDomain) { - empEmpName.setDataType(new DataTypeBuilder(factory, DataTypeCategory.VARCHAR).setSize(32).build()); + empEmpName.setDataType(new DataTypeBuilderImpl(factory, DataTypeCategory.VARCHAR).setSize(32).build()); } else { ColumnUtil.setDataType(empEmpName, domainName); } @@ -694,23 +694,24 @@ empMgrId = factory.newModel(ColumnModel.class, uuid.get("3d21a85a-72de-41b3-99dd-f4cb94e58d84")); empMgrId.setName("MGR_ID"); - empMgrId.setDataType(new DataTypeBuilder(factory, DataTypeCategory.INTEGER).build()); + empMgrId.setDataType(new DataTypeBuilderImpl(factory, DataTypeCategory.INTEGER).build()); empMgrId.setLogicalName("上司ID"); tableEmp.getAttributes().add(empMgrId); empHiredate = factory.newModel(ColumnModel.class, uuid.get("f0b57eed-98ab-4c21-9855-218c592814dc")); empHiredate.setName("HIREDATE"); - empHiredate.setDataType(new DataTypeBuilder(factory, DataTypeCategory.DATE).build()); + empHiredate.setDataType(new DataTypeBuilderImpl(factory, DataTypeCategory.DATE).build()); tableEmp.getAttributes().add(empHiredate); empSal = factory.newModel(ColumnModel.class, uuid.get("80786549-dc2c-4c1c-bcbd-9f6fdec911d2")); empSal.setName("SAL"); - empSal.setDataType(new DataTypeBuilder(factory, DataTypeCategory.NUMERIC).setPrecision(7).setScale(2).build()); + empSal.setDataType(new DataTypeBuilderImpl(factory, DataTypeCategory.NUMERIC).setPrecision(7).setScale(2) + .build()); tableEmp.getAttributes().add(empSal); empDeptId = factory.newModel(ColumnModel.class, uuid.get("4ae69b7a-7a0e-422a-89dc-0f0cff77565b")); empDeptId.setName("DEPT_ID"); - empDeptId.setDataType(new DataTypeBuilder(factory, DataTypeCategory.INTEGER).build()); + empDeptId.setDataType(new DataTypeBuilderImpl(factory, DataTypeCategory.INTEGER).build()); tableEmp.getAttributes().add(empDeptId); empPk = factory.newModel(PrimaryKeyModel.class, uuid.get("6145e6a0-9ff7-4033-999d-99d80392a48f")); Modified: artemis/trunk/jiemamy-core/src/main/java/org/jiemamy/test/TestModelBuilder2.java =================================================================== --- artemis/trunk/jiemamy-core/src/main/java/org/jiemamy/test/TestModelBuilder2.java 2009-03-03 18:33:18 UTC (rev 2809) +++ artemis/trunk/jiemamy-core/src/main/java/org/jiemamy/test/TestModelBuilder2.java 2009-03-04 10:33:52 UTC (rev 2810) @@ -40,7 +40,7 @@ import org.jiemamy.model.datatype.DomainModel; import org.jiemamy.model.datatype.adapter.SerialDataTypeAdapter; import org.jiemamy.model.entity.TableModel; -import org.jiemamy.utils.builder.DataTypeBuilder; +import org.jiemamy.utils.builder.DataTypeBuilderImpl; import org.jiemamy.utils.model.ColumnUtil; import org.jiemamy.utils.model.DataSetUtil; import org.jiemamy.utils.model.ForeignKeyUtil; @@ -305,14 +305,14 @@ idDomain = factory.newModel(DomainModel.class, uuid.get("9a3ba23c-b328-4c70-a32d-3e4be3ee3f08")); idDomain.setName("ID"); - idDomain.setDataType(new DataTypeBuilder(factory, DataTypeCategory.INTEGER).build()); + idDomain.setDataType(new DataTypeBuilderImpl(factory, DataTypeCategory.INTEGER).build()); idDomain.setNotNull(factory.newModel(NotNullConstraintModel.class)); idDomain.getAdapter(SerialDataTypeAdapter.class).setSerial(true); rootModel.getDomains().add(idDomain); nameDomain = factory.newModel(DomainModel.class, uuid.get("e2ebf8a7-90d8-48d4-9b5d-8d2e2601b193")); nameDomain.setName("NAME"); - nameDomain.setDataType(new DataTypeBuilder(factory, DataTypeCategory.VARCHAR).setSize(32).build()); + nameDomain.setDataType(new DataTypeBuilderImpl(factory, DataTypeCategory.VARCHAR).setSize(32).build()); nameDomain.setDescription("人名用の型です。"); rootModel.getDomains().add(nameDomain); } @@ -671,7 +671,7 @@ detailId = factory.newModel(ColumnModel.class, uuid.get("d3571020-4e1b-4158-958d-b5460fa6c32c")); detailId.setName("ID"); if (instruction.supressUseDomain) { - detailId.setDataType(new DataTypeBuilder(factory, DataTypeCategory.INTEGER).build()); + detailId.setDataType(new DataTypeBuilderImpl(factory, DataTypeCategory.INTEGER).build()); } else { ColumnUtil.setDataType(detailId, idDomain); } @@ -680,17 +680,17 @@ detailOrderId = factory.newModel(ColumnModel.class, uuid.get("a28c64c6-b379-41a4-9563-b774f5bce165")); detailOrderId.setName("ORDER_ID"); - detailOrderId.setDataType(new DataTypeBuilder(factory, DataTypeCategory.INTEGER).build()); + detailOrderId.setDataType(new DataTypeBuilderImpl(factory, DataTypeCategory.INTEGER).build()); tableDetail.getAttributes().add(detailOrderId); detailItemId = factory.newModel(ColumnModel.class, uuid.get("b4d50786-3b3e-4557-baa3-b739159f0530")); detailItemId.setName("ITEM_ID"); - detailItemId.setDataType(new DataTypeBuilder(factory, DataTypeCategory.INTEGER).build()); + detailItemId.setDataType(new DataTypeBuilderImpl(factory, DataTypeCategory.INTEGER).build()); tableDetail.getAttributes().add(detailItemId); detailQuantity = factory.newModel(ColumnModel.class, uuid.get("77bb21f4-e793-4198-a695-42363dac2216")); detailQuantity.setName("QUANTITY"); - detailQuantity.setDataType(new DataTypeBuilder(factory, DataTypeCategory.INTEGER).build()); + detailQuantity.setDataType(new DataTypeBuilderImpl(factory, DataTypeCategory.INTEGER).build()); tableDetail.getAttributes().add(detailQuantity); detailPk = factory.newModel(PrimaryKeyModel.class, uuid.get("90243681-19af-4bc0-9e6f-f814fbc58f85")); @@ -713,7 +713,7 @@ itemId = factory.newModel(ColumnModel.class, uuid.get("5a9585be-4b0d-4675-99aa-97b0417c816c")); itemId.setName("ID"); if (instruction.supressUseDomain) { - itemId.setDataType(new DataTypeBuilder(factory, DataTypeCategory.INTEGER).build()); + itemId.setDataType(new DataTypeBuilderImpl(factory, DataTypeCategory.INTEGER).build()); } else { ColumnUtil.setDataType(itemId, idDomain); } @@ -722,14 +722,14 @@ itemName = factory.newModel(ColumnModel.class, uuid.get("5c9b38e1-2cc9-45f9-ad3f-20b02471cc40")); itemName.setName("NAME"); - itemName.setDataType(new DataTypeBuilder(factory, DataTypeCategory.VARCHAR).setSize(20).build()); + itemName.setDataType(new DataTypeBuilderImpl(factory, DataTypeCategory.VARCHAR).setSize(20).build()); itemName.setLogicalName("商品名"); itemName.getAdapter(RepresentationAdapter.class).setRepresentation(true); tableItem.getAttributes().add(itemName); itemPrice = factory.newModel(ColumnModel.class, uuid.get("7a0cabe3-d382-4e5d-845b-dadd1b637a5f")); itemPrice.setName("PRICE"); - itemPrice.setDataType(new DataTypeBuilder(factory, DataTypeCategory.VARCHAR).setSize(20).build()); + itemPrice.setDataType(new DataTypeBuilderImpl(factory, DataTypeCategory.VARCHAR).setSize(20).build()); itemPrice.setLogicalName("価格"); tableItem.getAttributes().add(itemPrice); @@ -752,7 +752,7 @@ orderId = factory.newModel(ColumnModel.class, uuid.get("b647212a-4d8f-4d18-88e4-5397e54ebe67")); orderId.setName("ID"); if (instruction.supressUseDomain) { - orderId.setDataType(new DataTypeBuilder(factory, DataTypeCategory.INTEGER).build()); + orderId.setDataType(new DataTypeBuilderImpl(factory, DataTypeCategory.INTEGER).build()); } else { ColumnUtil.setDataType(orderId, idDomain); } @@ -761,13 +761,13 @@ orderUserId = factory.newModel(ColumnModel.class, uuid.get("db7a2f62-9658-406a-9dc1-8b90ae2da47c")); orderUserId.setName("USER_ID"); - orderUserId.setDataType(new DataTypeBuilder(factory, DataTypeCategory.INTEGER).build()); + orderUserId.setDataType(new DataTypeBuilderImpl(factory, DataTypeCategory.INTEGER).build()); orderUserId.setLogicalName("オーダーユーザID"); tableOrder.getAttributes().add(orderUserId); orderDate = factory.newModel(ColumnModel.class, uuid.get("4ce761b0-137b-4105-ad2a-2efcba5e6bc4")); orderDate.setName("ORDER_DATE"); - orderDate.setDataType(new DataTypeBuilder(factory, DataTypeCategory.TIMESTAMP).build()); + orderDate.setDataType(new DataTypeBuilderImpl(factory, DataTypeCategory.TIMESTAMP).build()); tableOrder.getAttributes().add(orderDate); orderPk = factory.newModel(PrimaryKeyModel.class, uuid.get("b204ff42-537b-4e14-bf61-e9baf1b119dc")); @@ -789,7 +789,7 @@ userId = factory.newModel(ColumnModel.class, uuid.get("6b022a79-45a6-4be4-9d3d-cfb27042a08e")); userId.setName("ID"); if (instruction.supressUseDomain) { - userId.setDataType(new DataTypeBuilder(factory, DataTypeCategory.INTEGER).build()); + userId.setDataType(new DataTypeBuilderImpl(factory, DataTypeCategory.INTEGER).build()); } else { ColumnUtil.setDataType(userId, idDomain); } @@ -799,7 +799,7 @@ userName = factory.newModel(ColumnModel.class, uuid.get("dacc68d2-fe32-4f4b-8082-9d55232ba7da")); userName.setName("NAME"); if (instruction.supressUseDomain) { - userName.setDataType(new DataTypeBuilder(factory, DataTypeCategory.VARCHAR).setSize(32).build()); + userName.setDataType(new DataTypeBuilderImpl(factory, DataTypeCategory.VARCHAR).setSize(32).build()); } else { ColumnUtil.setDataType(userName, nameDomain); } Modified: artemis/trunk/jiemamy-core/src/main/java/org/jiemamy/utils/ArrayEssentialStack.java =================================================================== --- artemis/trunk/jiemamy-core/src/main/java/org/jiemamy/utils/ArrayEssentialStack.java 2009-03-03 18:33:18 UTC (rev 2809) +++ artemis/trunk/jiemamy-core/src/main/java/org/jiemamy/utils/ArrayEssentialStack.java 2009-03-04 10:33:52 UTC (rev 2810) @@ -18,6 +18,7 @@ */ package org.jiemamy.utils; +import java.util.Collection; import java.util.Iterator; import org.apache.commons.collections15.ArrayStack; @@ -30,13 +31,60 @@ */ public class ArrayEssentialStack<E> implements EssentialStack<E> { - private ArrayStack<E> stack = new ArrayStack<E>(); + private final ArrayStack<E> stack; + /** + * インスタンスを生成する。 + */ + public ArrayEssentialStack() { + stack = new ArrayStack<E>(); + } + + /** + * インスタンスを生成する。 + * + * @param collection + */ + public ArrayEssentialStack(Collection<? extends E> collection) { + int size = collection.size(); + int capacity = (int) Math.min((size * 110L) / 100, Integer.MAX_VALUE); + + stack = new ArrayStack<E>(capacity); + for (E element : collection) { + stack.push(element); + } + } + + /** + * インスタンスを生成する。 + * + * @param source + */ + public ArrayEssentialStack(EssentialStack<? extends E> source) { + stack = new ArrayStack<E>(source.size()); + for (E element : source) { + stack.push(element); + } + } + + /** + * インスタンスを生成する。 + * + * @param initialSize + */ + public ArrayEssentialStack(int initialSize) { + stack = new ArrayStack<E>(initialSize); + } + public void clear() { stack.clear(); } + public void insert(int index, E element) { + stack.add(index, element); + } + public boolean isEmpty() { return stack.isEmpty(); } @@ -61,6 +109,22 @@ stack.push(element); } + public boolean remove(E element) { + return stack.remove(element); + } + + public E remove(int n) { + return stack.remove(n); + } + + public EssentialStack<E> reverse() { + EssentialStack<E> result = new ArrayEssentialStack<E>(stack.size()); + for (E element : stack) { + result.insert(0, element); + } + return result; + } + public int size() { return stack.size(); } Modified: artemis/trunk/jiemamy-core/src/main/java/org/jiemamy/utils/EssentialStack.java =================================================================== --- artemis/trunk/jiemamy-core/src/main/java/org/jiemamy/utils/EssentialStack.java 2009-03-03 18:33:18 UTC (rev 2809) +++ artemis/trunk/jiemamy-core/src/main/java/org/jiemamy/utils/EssentialStack.java 2009-03-04 10:33:52 UTC (rev 2810) @@ -18,6 +18,7 @@ */ package org.jiemamy.utils; +import java.util.EmptyStackException; import java.util.NoSuchElementException; /** @@ -26,7 +27,7 @@ * <p>{@link java.util.Stack}は実装型である上に、不適切な継承を行っている為、 * Jiemamy Projectでは、こちらのインターフェイスを優先的に使用する。</p> * - * @param <E> + * @param <E> 要素の型 * @author daisuke */ public interface EssentialStack<E> extends Iterable<E> { @@ -37,6 +38,14 @@ void clear(); /** + * スタックの下からn番目に要素を挿入する。 + * + * @param n インデックス + * @param element 挿入する要素 + */ + void insert(int n, E element); + + /** * 取り出す要素があるかどうか調べる。 * * @return スタックが空の場合は{@code true}、そうでない場合は{@code false} @@ -46,16 +55,20 @@ /** * 次の{@link #pop()}でスタックから取り出される要素を取得する。スタックから削除は行わない。 * + * <p>{@code peek(0)}と等価である。</p> + * * @return 要素 * @throws NoSuchElementException 取り出す要素が無い場合 */ E peek(); /** - * n番目の{@link #pop()}でスタックから取り出される要素を取得する。スタックから削除は行わない。 + * n番目に{@link #pop()}でスタックから取り出される要素を取得する。スタックから削除は行わない。 * - * @param n + * @param n インデックス * @return 要素 + * @throws EmptyStackException if there are not enough items on the + * stack to satisfy this request */ E peek(int n); @@ -75,6 +88,29 @@ void push(E element); /** + * 下から検索し、初めて見つかった要素を削除する。 + * + * @param element 削除する要素 + * @return 削除が行われた場合は{@code true}、そうでない場合は{@code false} + */ + boolean remove(E element); + + /** + * n番目の要素を削除する。 + * + * @param n インデックス + * @return 削除された要素 + */ + E remove(int n); + + /** + * 逆順のスタックを返す。 + * + * @return 逆順のスタック + */ + EssentialStack<E> reverse(); + + /** * スタックから取り出せる要素の数を取得する。 * * @return 要素の数 Added: artemis/trunk/jiemamy-core/src/main/java/org/jiemamy/utils/EssentialStacks.java =================================================================== --- artemis/trunk/jiemamy-core/src/main/java/org/jiemamy/utils/EssentialStacks.java (rev 0) +++ artemis/trunk/jiemamy-core/src/main/java/org/jiemamy/utils/EssentialStacks.java 2009-03-04 10:33:52 UTC (rev 2810) @@ -0,0 +1,89 @@ +/* + * Copyright 2007-2009 Jiemamy Project and the Others. + * Created on 2009/03/04 + * + * 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; + +/** + * {@link EssentialStack}のユーティリティクラス。 + * + * @author daisuke + */ +public final class EssentialStacks { + + /** + * 左右の要素を下から調べ、初めて異なる要素が現れる所までの部分スタックを返す。 + * + * <p>ABCDEFG と ABCXYZ の場合は ABC を返し、ABCDEFG と ABXDXXG の場合は AB を返す。</p> + * + * @param <E> 要素の型 + * @param left 左辺スタック + * @param right 右辺スタック + * @return 部分スタック + */ + public static <E>EssentialStack<E> intersection(EssentialStack<? extends E> left, EssentialStack<? extends E> right) { + EssentialStack<E> result = new ArrayEssentialStack<E>(); + EssentialStack<? extends E> small; + EssentialStack<? extends E> large; + if (left.size() > right.size()) { + small = right; + large = left; + } else { + small = left; + large = right; + } + if (small.isEmpty()) { + return new ArrayEssentialStack<E>(0); + } + + int i = 0; + for (E element : small) { + if (large.peek(i) == element) { + result.push(element); + } else { + break; + } + i++; + } + + return result; + } + + /** + * 左の要素から、右の要素を取り除いた部分スタックを返す。 + * + * @param <E> 要素の型 + * @param left 左辺スタック + * @param right 右辺スタック + * @return 部分スタック + */ + public static <E>EssentialStack<E> minus(EssentialStack<? extends E> left, EssentialStack<? extends E> right) { + EssentialStack<E> result = new ArrayEssentialStack<E>(left); + for (E er : right) { + for (E el : left) { + if (el == er) { + result.remove(el); + } + } + } + + return result; + } + + private EssentialStacks() { + } +} Property changes on: artemis/trunk/jiemamy-core/src/main/java/org/jiemamy/utils/EssentialStacks.java ___________________________________________________________________ Added: svn:mime-type + text/plain Modified: artemis/trunk/jiemamy-core/src/main/java/org/jiemamy/utils/LogMarker.java =================================================================== --- artemis/trunk/jiemamy-core/src/main/java/org/jiemamy/utils/LogMarker.java 2009-03-03 18:33:18 UTC (rev 2809) +++ artemis/trunk/jiemamy-core/src/main/java/org/jiemamy/utils/LogMarker.java 2009-03-04 10:33:52 UTC (rev 2810) @@ -18,8 +18,13 @@ */ package org.jiemamy.utils; +import java.util.Collections; +import java.util.Iterator; +import java.util.List; +import java.util.Vector; + import org.slf4j.Marker; -import org.slf4j.MarkerFactory; +import org.slf4j.helpers.BasicMarker; /** * SLF4Jのログマーカーを提供する定数クラス。 @@ -27,44 +32,174 @@ * <p>cf. <a * href="http://d.hatena.ne.jp/taichitaichi/20090220/1235124140">http://d.hatena.ne.jp/taichitaichi/20090220/1235124140</a></p> * + * @see BasicMarker * @author daisuke */ -public class LogMarker { +public enum LogMarker implements Marker { - private static final String PREFIX_PKG = "org.jiemamy"; - /** Jiemamy用 SLF4Jのルートログマーカー */ - public static final Marker MARKER_ROOT = MarkerFactory.getMarker(PREFIX_PKG); - + MARKER_ROOT("org.jiemamy"), + /** 設計判断を伴う処理に関連する項目。アドインやプラグインに関連する部分など */ - public static final Marker DESIGN = MarkerFactory.getMarker(PREFIX_PKG + ".design"); - + DESIGN("org.jiemamy.design"), + /** ファイルやネットワーク、他の依存ライブラリに対するインターフェースに関連する項目 */ - public static final Marker BOUNDARY = MarkerFactory.getMarker(PREFIX_PKG + ".boundary"); - + BOUNDARY("org.jiemamy.boundary"), + /** ライブラリ内に定義されているオブジェクトのライフサイクルに関連する項目 */ - public static final Marker LIFECYCLE = MarkerFactory.getMarker(PREFIX_PKG + ".lifecycle"); - + LIFECYCLE("org.jiemamy.lifecycle"), + /** * 処理の中で、詳細な情報を出力する為の項目 * * <p>このマーカは、主にライブリやフレームワークの実装者が、バグの調査を目的として使う</p> */ - public static final Marker DETAIL = MarkerFactory.getMarker(PREFIX_PKG + ".detail"); + DETAIL("org.jiemamy" + ".detail"); + private static String OPEN = "[ "; + + private static String CLOSE = " ]"; + + private static String SEP = ", "; + static { - Marker[] markers = { - DESIGN, - BOUNDARY, - LIFECYCLE, - DETAIL - }; - for (Marker m : markers) { + for (Marker m : values()) { + if (m == MARKER_ROOT) { + continue; + } MARKER_ROOT.add(m); } } + private final String name; + + private List<Marker> refereceList; + - private LogMarker() { + LogMarker(String name) { + this.name = name; } + + public void add(Marker reference) { + if (reference == null) { + throw new IllegalArgumentException("A null value cannot be added to a Marker as reference."); + } + + // no point in adding the reference multiple times + if (this.contains(reference)) { + return; + + } else if (reference.contains(this)) { // avoid recursion + // a potential reference should not its future "parent" as a reference + return; + } else { + // let's add the reference + if (refereceList == null) { + refereceList = new Vector<Marker>(); + } + refereceList.add(reference); + } + } + + public boolean contains(Marker other) { + if (other == null) { + throw new IllegalArgumentException("Other cannot be null"); + } + + if (equals(other)) { + return true; + } + + if (hasReferences()) { + for (int i = 0; i < refereceList.size(); i++) { + Marker ref = refereceList.get(i); + if (ref.contains(other)) { + return true; + } + } + } + return false; + } + + public boolean contains(String name) { + if (name == null) { + throw new IllegalArgumentException("Other cannot be null"); + } + + if (this.name.equals(name)) { + return true; + } + + if (hasReferences()) { + for (int i = 0; i < refereceList.size(); i++) { + Marker ref = refereceList.get(i); + if (ref.contains(name)) { + return true; + } + } + } + return false; + } + + public String getName() { + return name; + } + + @Deprecated + @SuppressWarnings("deprecation") + public boolean hasChildren() { + return hasReferences(); + } + + public boolean hasReferences() { + return ((refereceList != null) && (refereceList.size() > 0)); + } + + public Iterator<Marker> iterator() { + if (refereceList != null) { + return refereceList.iterator(); + } else { + @SuppressWarnings("unchecked") + Iterator<Marker> result = Collections.EMPTY_LIST.iterator(); + return result; + } + } + + public boolean remove(Marker referenceToRemove) { + if (refereceList == null) { + return false; + } + + int size = refereceList.size(); + for (int i = 0; i < size; i++) { + Marker m = refereceList.get(i); + if (referenceToRemove.equals(m)) { + refereceList.remove(i); + return true; + } + } + return false; + } + + @Override + public String toString() { + if (!hasReferences()) { + return getName(); + } + Iterator<Marker> it = iterator(); + Marker reference; + StringBuffer sb = new StringBuffer(getName()); + sb.append(' ').append(OPEN); + while (it.hasNext()) { + reference = it.next(); + sb.append(reference.getName()); + if (it.hasNext()) { + sb.append(SEP); + } + } + sb.append(CLOSE); + + return sb.toString(); + } + } Deleted: artemis/trunk/jiemamy-core/src/main/java/org/jiemamy/utils/TokorotenStack.java =================================================================== --- artemis/trunk/jiemamy-core/src/main/java/org/jiemamy/utils/TokorotenStack.java 2009-03-03 18:33:18 UTC (rev 2809) +++ artemis/trunk/jiemamy-core/src/main/java/org/jiemamy/utils/TokorotenStack.java 2009-03-04 10:33:52 UTC (rev 2810) @@ -1,88 +0,0 @@ -/* - * Copyright 2007-2009 Jiemamy Project and the Others. - * Created on 2009/02/26 - * - * 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.Iterator; -import java.util.LinkedList; - -/** - * 一定サイズを超えないよう、下の要素を捨てていくスタック。 - * - * <p>スレッドアンセーフである。</p> - * - * @param <E> - * @author daisuke - */ -public class TokorotenStack<E> implements EssentialStack<E> { - - private LinkedList<E> stack = new LinkedList<E>(); - - private final int size; - - - /** - * インスタンスを生成する。 - * - * @param size - */ - public TokorotenStack(int size) { - this.size = size; - } - - public void clear() { - stack.clear(); - } - - public boolean isEmpty() { - return stack.isEmpty(); - } - - public Iterator<E> iterator() { - return stack.iterator(); - } - - public E peek() { - return stack.peek(); - } - - public E peek(int n) { - return stack.get(n); - } - - public E pop() { - return stack.getLast(); - } - - public void push(E element) { - while (size() >= size) { - stack.removeFirst(); - } - stack.add(element); - } - - public int size() { - return stack.size(); - } - - @Override - public String toString() { - return stack.toString(); - } - -} Copied: artemis/trunk/jiemamy-core/src/main/java/org/jiemamy/utils/builder/AbstractJiemamyBuilder.java (from rev 2809, artemis/trunk/jiemamy-core/src/main/java/org/jiemamy/utils/builder/ModelBuilder.java) =================================================================== --- artemis/trunk/jiemamy-core/src/main/java/org/jiemamy/utils/builder/AbstractJiemamyBuilder.java (rev 0) +++ artemis/trunk/jiemamy-core/src/main/java/org/jiemamy/utils/builder/AbstractJiemamyBuilder.java 2009-03-04 10:33:52 UTC (rev 2810) @@ -0,0 +1,65 @@ +/* + * Copyright 2007-2009 Jiemamy Project and the Others. + * Created on 2008/12/24 + * + * 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.builder; + +import org.apache.commons.lang.Validate; + +import org.jiemamy.JiemamyFactory; +import org.jiemamy.exception.JiemamyRuntimeException; +import org.jiemamy.model.JiemamyElement; +import org.jiemamy.model.RootModel; + +/** + * モデルオブジェクトを構築するためのビルダークラス。 + * + * @param <T> 構築するモデルの型 + * @author daisuke + */ +public abstract class AbstractJiemamyBuilder<T extends JiemamyElement> implements JiemamyBuilder<T> { + + /** 構築元となる{@link JiemamyFactory} */ + JiemamyFactory factory; + + /** 構築対象モデル */ + T model; + + + /** + * インスタンスを生成する。 + * + * @param factory 構築元となる{@link RootModel} + * @param clazz 構築するオブジェクトを表す型 + * @throws IllegalArgumentException 引数に{@code null}を与えた場合 + */ + public AbstractJiemamyBuilder(JiemamyFactory factory, Class<T> clazz) { + Validate.notNull(factory); + Validate.notNull(clazz); + this.factory = factory; + model = factory.newModel(clazz); + } + + public T build() { + if (isComplete() == false) { + throw new JiemamyRuntimeException(); // TODO 適切な例外に + } + return model; + } + + abstract boolean isComplete(); +} Property changes on: artemis/trunk/jiemamy-core/src/main/java/org/jiemamy/utils/builder/AbstractJiemamyBuilder.java ___________________________________________________________________ Added: svn:mime-type + text/plain Deleted: artemis/trunk/jiemamy-core/src/main/java/org/jiemamy/utils/builder/ColumnBuilder.java =================================================================== --- artemis/trunk/jiemamy-core/src/main/java/org/jiemamy/utils/builder/ColumnBuilder.java 2009-03-03 18:33:18 UTC (rev 2809) +++ artemis/trunk/jiemamy-core/src/main/java/org/jiemamy/utils/builder/ColumnBuilder.java 2009-03-04 10:33:52 UTC (rev 2810) @@ -1,61 +0,0 @@ -/* - * Copyright 2007-2009 Jiemamy Project and the Others. - * Created on 2008/12/24 - * - * 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.builder; - -import org.apache.commons.lang.Validate; - -import org.jiemamy.JiemamyFactory; -import org.jiemamy.model.attribute.ColumnModel; -import org.jiemamy.model.attribute.constraint.ColumnConstraint; -import org.jiemamy.model.attribute.constraint.ConstraintModel; -import org.jiemamy.model.datatype.DataType; - -/** - * {@link ColumnModel}を構築するためのビルダークラス。 - * - * @author daisuke - */ -public class ColumnBuilder extends ModelBuilder<ColumnModel> { - - /** - * インスタンスを生成する。 - * - * @param factory - * @param name カラム名 - * @param type 型記述子 - * @throws IllegalArgumentException 引数に{@code null}を与えた場合 - */ - public ColumnBuilder(JiemamyFactory factory, String name, DataType type) { - super(factory, ColumnModel.class); - Validate.notNull(name); - Validate.notNull(type); - model.setName(name); - model.setDataType(type); - } - - /** - * 制約モデルを生成する。 - * - * @param clazz 制約モデルの型 - * @return 制約モデル - */ - protected ConstraintModel newConstraint(Class<? extends ColumnConstraint> clazz) { - return factory.newModel(clazz); - } -} Copied: artemis/trunk/jiemamy-core/src/main/java/org/jiemamy/utils/builder/ColumnBuilderImpl.java (from rev 2809, artemis/trunk/jiemamy-core/src/main/java/org/jiemamy/utils/builder/ColumnBuilder.java) =================================================================== --- artemis/trunk/jiemamy-core/src/main/java/org/jiemamy/utils/builder/ColumnBuilderImpl.java (rev 0) +++ artemis/trunk/jiemamy-core/src/main/java/org/jiemamy/utils/builder/ColumnBuilderImpl.java 2009-03-04 10:33:52 UTC (rev 2810) @@ -0,0 +1,66 @@ +/* + * Copyright 2007-2009 Jiemamy Project and the Others. + * Created on 2008/12/24 + * + * 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.builder; + +import org.apache.commons.lang.Validate; + +import org.jiemamy.JiemamyFactory; +import org.jiemamy.model.attribute.ColumnModel; +import org.jiemamy.model.attribute.constraint.ColumnConstraint; +import org.jiemamy.model.attribute.constraint.ConstraintModel; +import org.jiemamy.model.datatype.DataType; + +/** + * {@link ColumnModel}を構築するためのビルダークラス。 + * + * @author daisuke + */ +public class ColumnBuilderImpl extends AbstractJiemamyBuilder<ColumnModel> implements ColumnBuilder { + + /** + * インスタンスを生成する。 + * + * @param factory + * @param name カラム名 + * @param type 型記述子 + * @throws IllegalArgumentException 引数に{@code null}を与えた場合 + */ + public ColumnBuilderImpl(JiemamyFactory factory, String name, DataType type) { + super(factory, ColumnModel.class); + Validate.notNull(name); + Validate.notNull(type); + model.setName(name); + model.setDataType(type); + } + + /** + * 制約モデルを生成する。 + * + * @param clazz 制約モデルの型 + * @return 制約モデル + */ + protected ConstraintModel newConstraint(Class<? extends ColumnConstraint> clazz) { + return factory.newModel(clazz); + } + + @Override + boolean isComplete() { + return model.getName() != null && model.getDataType() != null; + } +} Property changes on: artemis/trunk/jiemamy-core/src/main/java/org/jiemamy/utils/builder/ColumnBuilderImpl.java ___________________________________________________________________ Added: svn:mime-type + text/plain Deleted: artemis/trunk/jiemamy-core/src/main/java/org/jiemamy/utils/builder/DataTypeBuilder.java =================================================================== --- artemis/trunk/jiemamy-core/src/main/java/org/jiemamy/utils/builder/DataTypeBuilder.java 2009-03-03 18:33:18 UTC (rev 2809) +++ artemis/trunk/jiemamy-core/src/main/java/org/jiemamy/utils/builder/DataTypeBuilder.java 2009-03-04 10:33:52 UTC (rev 2810) @@ -1,146 +0,0 @@ -/* - * Copyright 2007-2009 Jiemamy Project and the Others. - * Created on 2008/12/30 - * - * 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.builder; - -import org.apache.commons.lang.Validate; - -import org.jiemamy.JiemamyFactory; -import org.jiemamy.dialect.BuiltinDataTypeMoldImpl; -import org.jiemamy.dialect.Dialect; -import org.jiemamy.dialect.Dialect.BuiltinDataTypeMold; -import org.jiemamy.model.RootModel; -import org.jiemamy.model.datatype.BuiltinDataType; -import org.jiemamy.model.datatype.DataTypeCategory; -import org.jiemamy.model.datatype.adapter.PrecisionedDataTypeAdapter; -import org.jiemamy.model.datatype.adapter.SerialDataTypeAdapter; -import org.jiemamy.model.datatype.adapter.SizedDataTypeAdapter; -import org.jiemamy.utils.model.RootModelUtil; - -/** - * {@link BuiltinDataType}を生成するビルダ。 - * - * @author daisuke - */ -public class DataTypeBuilder { - - private BuiltinDataTypeMold mold; - - private BuiltinDataType dataType; - - - /** - * インスタンスを生成する。 - * - * @param factory - * @param typeCategory - */ - public DataTypeBuilder(JiemamyFactory factory, DataTypeCategory typeCategory) { - this(factory, typeCategory, typeCategory.name()); - } - - /** - * インスタンスを生成する。 - * - * @param factory - * @param typeCategory - * @param typeName - */ - public DataTypeBuilder(JiemamyFactory factory, DataTypeCategory typeCategory, String typeName) { - RootModel rootModel = factory.getRootModel(); - Dialect dialect; - try { - dialect = RootModelUtil.getDialect(rootModel); - } catch (ClassNotFoundException e) { - dialect = null; - } - if (dialect == null) { - mold = new BuiltinDataTypeMoldImpl(typeCategory, typeName); - } else { - mold = dialect.findDataTypeMold(typeCategory, typeName); - } - Validate.notNull(typeName); - dataType = factory.newBuiltinDataType(mold); - } - - /** - * モデルを構築する。 - * - * @return model 構築されたモデル - */ - public BuiltinDataType build() { - return dataType; - } - - /** - * 精度を設定する。 - * - * @param precision 精度 - * @return {@code this} - */ - public DataTypeBuilder setPrecision(int precision) { - if (dataType.hasAdapter(PrecisionedDataTypeAdapter.class) == false) { - dataType.registerAdapter(new PrecisionedDataTypeAdapter()); - } - dataType.getAdapter(PrecisionedDataTypeAdapter.class).setPrecision(precision); - return this; - } - - /** - * スケールを設定する。 - * - * @param scale スケール - * @return {@code this} - */ - public DataTypeBuilder setScale(int scale) { - if (dataType.hasAdapter(PrecisionedDataTypeAdapter.class) == false) { - dataType.registerAdapter(new PrecisionedDataTypeAdapter()); - } - dataType.getAdapter(PrecisionedDataTypeAdapter.class).setScale(scale); - return this; - } - - /** - * 自動採番型かどうかを設定する。 - * - * @param serial 自動採番であれば{@code true} - * @return {@code this} - */ - public DataTypeBuilder setSerial(boolean serial) { - if (dataType.hasAdapter(SerialDataTypeAdapter.class) == false) { - dataType.registerAdapter(new SerialDataTypeAdapter()); - } - dataType.getAdapter(SerialDataTypeAdapter.class).setSerial(serial); - return this; - } - - /** - * サイズを設定する。 - * - * @param size サイズ - * @return {@code this} - */ - public DataTypeBuilder setSize(int size) { - if (dataType.hasAdapter(SizedDataTypeAdapter.class) == false) { - dataType.registerAdapter(new SizedDataTypeAdapter()); - } - dataType.getAdapter(SizedDataTypeAdapter.class).setSize(size); - return this; - } - -} Added: artemis/trunk/jiemamy-core/src/main/java/org/jiemamy/utils/builder/DataTypeBuilderImpl.java =================================================================== --- artemis/trunk/jiemamy-core/src/main/java/org/jiemamy/utils/builder/DataTypeBuilderImpl.java (rev 0) +++ artemis/trunk/jiemamy-core/src/main/java/org/jiemamy/utils/builder/DataTypeBuilderImpl.java 2009-03-04 10:33:52 UTC (rev 2810) @@ -0,0 +1,96 @@ +/* + * Copyright 2007-2009 Jiemamy Project and the Others. + * Created on 2009/03/04 + * + * 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.builder; + +import org.apache.commons.lang.Validate; + +import org.jiemamy.JiemamyFactory; +import org.jiemamy.dialect.Dialect; +import org.jiemamy.dialect.Dialect.BuiltinDataTypeMold; +import org.jiemamy.model.RootModel; +import org.jiemamy.model.datatype.BuiltinDataType; +import org.jiemamy.model.datatype.DataTypeCategory; +import org.jiemamy.model.datatype.adapter.PrecisionedDataTypeAdapter; +import org.jiemamy.model.datatype.adapter.SizedDataTypeAdapter; +import org.jiemamy.utils.model.RootModelUtil; + +/** + * TODO for daisuke + * + * @author daisuke + */ +public class DataTypeBuilderImpl implements DataTypeBuilder { + + private JiemamyFactory factory; + + private Dialect dialect; + + private BuiltinDataType model; + + + /** + * インスタンスを生成する。 + * + * @param factory + */ + public DataTypeBuilderImpl(JiemamyFactory factory) { + Validate.notNull(factory); + this.factory = factory; + } + + /** + * インスタンスを生成する。 + * + * @param factory + * @param category + */ + public DataTypeBuilderImpl(JiemamyFactory factory, DataTypeCategory category) { + Validate.notNull(factory); + this.factory = factory; + RootModel rootModel = factory.getRootModel(); + try { + dialect = RootModelUtil.getDialect(rootModel); + } catch (ClassNotFoundException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + BuiltinDataTypeMold mold = dialect.findDataTypeMold(category); + model = factory.newBuiltinDataType(mold); + } + + public BuiltinDataType build() { + return model; + } + + public DataTypeBuilder setPrecision(int precision) { + model.getAdapter(PrecisionedDataTypeAdapter.class).setPrecision(precision); + return this; + } + + public DataTypeBuilder setScale(int scale) { + model.getAdapter(PrecisionedDataTypeAdapter.class).setScale(scale); + return this; + } + + public DataTypeBuilder setSize(int size) { + model.getAdapter(SizedDataTypeAdapter.class).setSize(size); + return this; + } + +} Property changes on: artemis/trunk/jiemamy-core/src/main/java/org/jiemamy/utils/builder/DataTypeBuilderImpl.java ___________________________________________________________________ Added: svn:mime-type + text/plain Deleted: artemis/trunk/jiemamy-core/src/main/java/org/jiemamy/utils/builder/ForeignKeyBuilder.java =================================================================== --- artemis/trunk/jiemamy-core/src/main/java/org/jiemamy/utils/builder/ForeignKeyBuilder.java 2009-03-03 18:33:18 UTC (rev 2809) +++ artemis/trunk/jiemamy-core/src/main/java/org/jiemamy/utils/builder/ForeignKeyBuilder.java 2009-03-04 10:33:52 UTC (rev 2810) @@ -1,113 +0,0 @@ -/* - * Copyright 2007-2009 Jiemamy Project and the Others. - * Created on 2008/12/24 - * - * 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.builder; - -import java.util.List; - -import org.apache.commons.lang.Validate; - -import org.jiemamy.JiemamyFactory; -import org.jiemamy.ReferenceResolver; -import org.jiemamy.exception.ElementNotFoundException; -import org.jiemamy.exception.ModelConsistenceException; -import org.jiemamy.model.attribute.ColumnModel; -import org.jiemamy.model.attribute.ColumnRef; -import org.jiemamy.model.attribute.constraint.ForeignKeyModel; -import org.jiemamy.model.attribute.constraint.UniqueKeyModel; -import org.jiemamy.model.entity.TableModel; -import org.jiemamy.utils.model.TableUtil; - -/** - * {@link ForeignKeyModel}を構築するためのビルダークラス。 - * - * @author daisuke - */ -public class ForeignKeyBuilder extends ModelBuilder<ForeignKeyModel> { - - private final TableModel constraintTable; - - private final TableModel referenceTable; - - private List<UniqueKeyModel> uniqueConstraints; - - - /** - * インスタンスを生成する。 - * - * @param factory - * @param source 参照元テーブル - * @param target 参照先テーブル - * @throws IllegalArgumentException 引数に{@code null}を与えた場合 - */ - public ForeignKeyBuilder(JiemamyFactory factory, TableModel source, TableModel target) { - super(factory, ForeignKeyModel.class); - constraintTable = source; - referenceTable = target; - Validate.notNull(source); - Validate.notNull(target); - - uniqueConstraints = TableUtil.getAttributes(referenceTable, UniqueKeyModel.class); - } - - // - - /** - * カラム同士のマッピングを設定する。 - * - * @param foreignKeyColumn 参照元テーブルの「制約を受けるカラム」の一つ - * @param keyColumn 参照先テーブルの主キーカラムの一つ - * @return this - * @throws ElementNotFoundException referenceColumnが、所属テーブルにおいてキー指定されていない場合 - * @throws IllegalArgumentException 引数に{@code null}を与えた場合 - * @throws ModelConsistenceException foreignKeyColumnがconstraintTableに所属していない場合 - * @throws ModelConsistenceException keyColumnがreferenceTableに所属していない場合 - */ - public ForeignKeyBuilder mapping(ColumnModel foreignKeyColumn, ColumnModel keyColumn) { - return mapping(factory.newReference(foreignKeyColumn), factory.newReference(keyColumn)); - } - - /** - * カラム同士のマッピングを設定する。 - * - * @param foreignKeyColumn 参照元テーブルの「制約を受けるカラム」の一つ - * @param keyColumn 参照先テーブルの主キーカラムの一つ - * @return this - * @throws ElementNotFoundException referenceColumnが、所属テーブルにおいて主キー指定されていない場合 - * @throws IllegalArgumentException 引数に{@code null}を与えた場合 - */ - public ForeignKeyBuilder mapping(ColumnRef foreignKeyColumn, ColumnRef keyColumn) { - Validate.notNull(keyColumn); - Validate.notNull(foreignKeyColumn); - - ReferenceResolver resolver = constraintTable.getJiemamy().getReferenceResolver(); - - if (referenceTable.getAttributes().contains(resolver.resolve(keyColumn)) == false) { - throw new ModelConsistenceException(); - } - if (constraintTable.getAttributes().contains(resolver.resolve(foreignKeyColumn)) == false) { - throw new ModelConsistenceException(); - } - - // TODO ユニークキーを使ってごにょごにょバリデーション - - model.getReferenceColumns().add(keyColumn); - model.getKeyColumns().add(foreignKeyColumn); - return this; - } -} Copied: artemis/trunk/jiemamy-core/src/main/java/org/jiemamy/utils/builder/ForeignKeyBuilderImpl.java (from rev 2809, artemis/trunk/jiemamy-core/src/main/java/org/jiemamy/utils/builder/ForeignKeyBuilder.java) =================================================================== --- artemis/trunk/jiemamy-core/src/main/java/org/jiemamy/utils/builder/ForeignKeyBuilderImpl.java (rev 0) +++ artemis/trunk/jiemamy-core/src/main/java/org/jiemamy/utils/builder/ForeignKeyBuilderImpl.java 2009-03-04 10:33:52 UTC (rev 2810) @@ -0,0 +1,96 @@ +/* + * Copyright 2007-2009 Jiemamy Project and the Others. + * Created on 2008/12/24 + * + * 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.builder; + +import java.util.List; + +import org.apache.commons.lang.Validate; + +import org.jiemamy.JiemamyFactory; +import org.jiemamy.ReferenceResolver; +import org.jiemamy.exception.ModelConsistenceException; +import org.jiemamy.model.attribute.ColumnModel; +import org.jiemamy.model.attribute.ColumnRef; +import org.jiemamy.model.attribute.constraint.ForeignKeyModel; +import org.jiemamy.model.attribute.constraint.LocalKeyModel; +import org.jiemamy.model.entity.TableModel; +import org.jiemamy.utils.model.ForeignKeyUtil; +import org.jiemamy.utils.model.TableUtil; + +/** + * {@link ForeignKeyModel}を構築するためのビルダークラス。 + * + * @author daisuke + */ +public class ForeignKeyBuilderImpl extends AbstractJiemamyBuilder<ForeignKeyModel> implements ForeignKeyBuilder { + + private final TableModel constraintTable; + + private final TableModel referenceTable; + + private List<LocalKeyModel> localKeys; + + + /** + * インスタンスを生成する。 + * + * @param factory + * @param source 参照元テーブル + * @param target 参照先テーブル + * @throws IllegalArgumentException 引数に{@code null}を与えた場合 + */ + public ForeignKeyBuilderImpl(JiemamyFactory factory, TableModel source, TableModel target) { + super(factory, ForeignKeyModel.class); + constraintTable = source; + referenceTable = target; + Validate.notNull(source); + Validate.notNull(target); + + localKeys = TableUtil.getAttributes(referenceTable, LocalKeyModel.class); + } + + public ForeignKeyBuilder mapping(ColumnModel keyColumn, ColumnModel referenceColumn) { + return mapping(factory.newReference(keyColumn), factory.newReference(referenceColumn)); + } + + public ForeignKeyBuilder mapping(ColumnRef keyColumn, ColumnRef referenceColumn) { + Validate.notNull(referenceColumn); + Validate.notNull(keyColumn); + + ReferenceResolver resolver = constraintTable.getJiemamy().getReferenceResolver(); + + if (referenceTable.getAttributes().contains(resolver.resolve(referenceColumn)) == false) { + throw new ModelConsistenceException(); + } + if (constraintTable.getAttributes().contains(resolver.resolve(keyColumn)) == false) { + throw new ModelConsistenceException(); + } + + // TODO ユニークキーを使ってごにょごにょバリデーション + + ForeignKeyUtil.addMapping(model, keyColumn, referenceColumn); + return this; + } + + @Override + boolean isComplete() { + // TODO Auto-generated method stub + return false; + } +} Property changes on: artemis/trunk/jiemamy-core/src/main/java/org/jiemamy/utils/builder/ForeignKeyBuilderImpl.java ___________________________________________________________________ Added: svn:mime-type + text/plain Deleted: artemis/trunk/jiemamy-core/src/main/java/org/jiemamy/utils/builder/ModelBuilder.java =================================================================== --- artemis/trunk/jiemamy-core/src/main/java/org/jiemamy/utils/builder/ModelBuilder.java 2009-03-03 18:33:18 UTC (rev 2809) +++ artemis/trunk/jiemamy-core/src/main/java/org/jiemamy/utils/builder/ModelBuilder.java 2009-03-04 10:33:52 UTC (rev 2810) @@ -1,64 +0,0 @@ -/* - * Copyright 2007-2009 Jiemamy Project and the Others. - * Created on 2008/12/24 - * - * 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.builder; - -import org.apache.commons.lang.Validate; - -import org.jiemamy.JiemamyFactory; -import org.jiemamy.model.JiemamyElement; -import org.jiemamy.model.RootModel; - -/** - * モデルオブジェクトを構築するためのビルダークラス。 - * - * @param <T> 構築するモデルの型 - * @author daisuke - */ -public abstract class ModelBuilder<T extends JiemamyElement> { - - /** 構築元となる{@link JiemamyFactory} */ - JiemamyFactory factory; - - /** 構築対象モデル */ - T model; - - - /** - * インスタンスを生成する。 - * - * @param factory 構築元となる{@link RootModel} - * @param clazz 構築するオブジェクトを表す型 - * @throws IllegalArgumentException 引数に{@code null}を与えた場合 - */ - public ModelBuilder(JiemamyFactory factory, Class<T> clazz) { - Validate.notNull(factory); - Validate.notNull(clazz); - this.factory = factory; - model = factory.newModel(clazz); - } - - /** - * モデルを構築する。 - * - * @return model 構築されたモデル - */ - public T build() { - return model; - } -} Deleted: artemis/trunk/jiemamy-core/src/main/java/org/jiemamy/utils/builder/TableBuilder.java =================================================================== --- artemis/trunk/jiemamy-core/src/main/java/org/jiemamy/utils/builder/TableBuilder.java 2009-03-03 18:33:18 UTC (rev 2809) +++ artemis/trunk/jiemamy-core/src/main/java/org/jiemamy/utils/builder/TableBuilder.java 2009-03-04 10:33:52 UTC (rev 2810) @@ -1,83 +0,0 @@ -/* - * Copyright 2007-2009 Jiemamy Project and the Others. - * Created on 2008/12/24 - * - * 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.builder; - -import org.apache.commons.lang.Validate; - -import org.jiemamy.JiemamyFactory; -import org.jiemamy.model.attribute.ColumnModel; -import org.jiemamy.model.attribute.constraint.PrimaryKeyModel; -import org.jiemamy.model.entity.TableModel; -import org.jiemamy.utils.model.TableUtil; - -/** - * {@link TableModel}を構築するためのビルダークラス。 - * - * @author daisuke - */ -public class TableBuilder extends ModelBuilder<TableModel> { - - /** - * インスタンスを生成する。 - * - * @param factory - * @param name - * @throws IllegalArgumentException 引数に{@code null}を与えた場合 - */ - public TableBuilder(JiemamyFactory factory, String name) { - super(factory, TableModel.class); - Validate.notNull(name); - model.setName(name); - } - - /** - * カラムを追加する。 - * - * @param column 追加するカラム - * @return this - */ - public TableBuilder column(ColumnModel column) { - model.getAttributes().add(column); - return this; - } - - /** - * 主キーをカラムのインデックスで指定する。 - * - * @param index - * @param otherIndexes - * @return this - * @throws IndexOutOfBoundsException 指定したインデックスのカラムが存在しない場合。 - */ - public TableBuilder primaryKey(int index, int... otherIndexes) { - PrimaryKeyModel pk = factory.newModel(PrimaryKeyModel.class); - ColumnModel pkColumn = TableUtil.getAttributes(model, ColumnModel.class).get(index); - pk.getKeyColumns().add(factory.newReference(pkColumn)); - - for (int otherIndex : otherIndexes) { - pkColumn = TableUtil.getAttributes(model, ColumnModel.class).get(otherIndex); - if (pk.getKeyColumns().contains(pkColumn) == false) { - pk.getKeyColumns().add(factory.newReference(pkColumn)); - } - } - - model.getAttributes().add(pk); - return this; - } -} Copied: artemis/trunk/jiemamy-core/src/main/java/org/jiemamy/utils/builder/TableBuilderImpl.java (from rev 2809, artemis/trunk/jiemamy-core/src/main/java/org/jiemamy/utils/builder/TableBuilder.java) =================================================================== --- artemis/trunk/jiemamy-core/src/main/java/org/jiemamy/utils/builder/TableBuilderImpl.java (rev 0) +++ artemis/trunk/jiemamy-core/src/main/java/org/jiemamy/utils/builder/TableBuilderImpl.java 2009-03-04 10:33:52 UTC (rev 2810) @@ -0,0 +1,87 @@ +/* + * Copyright 2007-2009 Jiemamy Project and the Others. + * Created on 2008/12/24 + * + * 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.builder; + +import org.apache.commons.lang.Validate; + +import org.jiemamy.JiemamyFactory; +import org.jiemamy.model.attribute.ColumnModel; +import org.jiemamy.model.attribute.constraint.PrimaryKeyModel; +import org.jiemamy.model.entity.TableModel; +import org.jiemamy.utils.model.TableUtil; + +/** + * {@link TableModel}を構築するためのビルダークラス。 + * + * @author daisuke + */ +public class TableBuilderImpl extends AbstractJiemamyBuilder<TableModel> implements TableBuilder { + + /** + * インスタンスを生成する。 + * + * @param factory + * @param name + * @throws IllegalArgumentException 引数に{@code null}を与えた場合 + */ + public TableBuilderImpl(JiemamyFactory factory, String name) { + super(factory, TableModel.class); + Validate.notNull(name); + model.setName(name); + } + + public TableBuilder addColumn(ColumnModel column) { + model.getAttributes().add(column); + return this; + } + + /** + * 主キーをカラムのインデックスで指定する。 + * + * @param index + * @param otherIndexes + * @return this + * @throws IndexOutOfBoundsException 指定したインデックスのカラムが存在しない場合。 + */ + public TableBuilder primaryKey(int index, int... otherIndexes) { + PrimaryKeyModel pk = factory.newModel(PrimaryKeyModel.class); + ColumnModel pkColumn = TableUtil.getColumns(model).get(index); + pk.getKeyColumns().add(factory.newReference(pkColumn)); + + for (int otherIndex : otherIndexes) { + pkColumn = TableUtil.getAttributes(model, ColumnModel.class).get(otherIndex); + if (pk.getKeyColumns().contains(pkColumn) == false) { + pk.getKeyColumns().add(factory.newReference(pkColumn)); + } + } + + model.getAttributes().add(pk); + return this; + } + + public TableBuilder setName(String name) { + model.setName(name); + return this; + } + + @Override + boolean isComplete() { + return model.getName() != null; + } +} Property changes on: artemis/trunk/jiemamy-core/src/main/java/org/jiemamy/utils/builder/TableBuilderImpl.java ___________________________________________________________________ Added: svn:mime-type + text/plain Deleted: artemis/trunk/jiemamy-core/src/main/java/org/jiemamy/utils/builder/ViewBuilder.java =================================================================== --- artemis/trunk/jiemamy-core/src/main/java/org/jiemamy/utils/builder/ViewBuilder.java 2009-03-03 18:33:18 UTC (rev 2809) +++ artemis/trunk/jiemamy-core/src/main/java/org/jiemamy/utils/builder/ViewBuilder.java 2009-03-04 10:33:52 UTC (rev 2810) @@ -1,57 +0,0 @@ -/* - * Copyright 2007-2009 Jiemamy Project and the Others. - * Created on 2008/12/24 - * - * 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.builder; - -import org.apache.commons.lang.Validate; - -import org.jiemamy.JiemamyFactory; -import org.jiemamy.model.entity.TableModel; -import org.jiemamy.model.entity.ViewModel; - -/** - * {@link TableModel}を構築するためのビルダークラス。 - * - * @author daisuke - */ -public class ViewBuilder extends ModelBuilder<ViewModel> { - - /** - * インスタンスを生成する。 - * - * @param factory - * @param name - * @throws IllegalArgumentException 引数に{@code null}を与えた場合 - */ - public ViewBuilder(JiemamyFactory factory, String name) { - super(factory, ViewModel.class); - Validate.notNull(name); - model.setName(name); - } - - /** - * VIEW定義SELECT文を設定する。 - * - * @param definition VIEW定義SELECT文 - * @return this - */ - public ViewBuilder definition(String definition) { - model.setDefinition(definition); - return this; - } -} Copied: artemis/trunk/jiemamy-core/src/main/java/org/jiemamy/utils/builder/ViewBuilderImpl.java (from rev 2809, artemis/trunk/jiemamy-core/src/main/java/org/jiemamy/utils/builder/ViewBuilder.java) =================================================================== --- artemis/trunk/jiemamy-core/src/main/java/org/jiemamy/utils/builder/ViewBuilderImpl.java (rev 0) +++ artemis/trunk/jiemamy-core/src/main/java/org/jiemamy/utils/builder/ViewBuilderImpl.java 2009-03-04 10:33:52 UTC (rev 2810) @@ -0,0 +1,61 @@ +/* + * Copyright 2007-2009 Jiemamy Project and the Others. + * Created on 2008/12/24 + * + * 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.builder; + +import org.apache.commons.lang.Validate; + +import org.jiemamy.JiemamyFactory; +import org.jiemamy.model.entity.TableModel; +import org.jiemamy.model.entity.ViewModel; + +/** + * {@link TableModel}を構築するためのビルダークラス。 + * + * @author daisuke + */ +public class ViewBuilderImpl extends AbstractJiemamyBuilder<ViewModel> implements ViewBuilder { + + /** + * インスタンスを生成する。 + * + * @param factory + * @param name + * @throws IllegalArgumentException 引数に{@code null}を与えた場合 + */ + public ViewBuilderImpl(JiemamyFactory factory, String name) { + super(factory, ViewModel.class); + Validate.notNull(name); + model.setName(name); + } + + public ViewBuilder definition(String definition) { + model.setDefinition(definition); + return this; + } + + public ViewBuilder setName(String name) { + model.setName(name); + return this; + } + + @Override + boolean isComplete() { + return model.getName() != null; + } +} Property changes on: artemis/trunk/jiemamy-core/src/main/java/org/jiemamy/utils/builder/ViewBuilderImpl.java ___________________________________________________________________ Added: svn:mime-type + text/plain Modified: artemis/trunk/jiemamy-core/src/test/java/org/jiemamy/facade/JiemamyFacadeImplTest.java =================================================================== --- artemis/trunk/jiemamy-core/src/test/java/org/jiemamy/facade/JiemamyFacadeImplTest.java 2009-03-03 18:33:18 UTC (rev 2809) +++ artemis/trunk/jiemamy-core/src/test/java/org/jiemamy/facade/JiemamyFacadeImplTest.java 2009-03-04 10:33:52 UTC (rev 2810) @@ -18,12 +18,13 @@ */ package org.jiemamy.facade; +import static org.hamcrest.CoreMatchers.sameInstance; import static org.hamcrest.Matchers.is; import static org.junit.Assert.assertThat; +import org.apache.commons.collections15.CollectionUtils; import org.junit.After; import org.junit.Before; -import org.junit.Ignore; import org.junit.Test; import org.jiemamy.Jiemamy; @@ -133,7 +134,6 @@ * @throws Exception 例外が発生した場合 */ @Test - @Ignore("まだ実装されていないから動かない~。テストドリヴ~ン") public void test01_save_rollbackのテスト_縦横無尽() throws Exception { JiemamyFactory factory = jiemamy.getFactory(); RootModel rootModel = factory.getRootModel(); @@ -180,11 +180,11 @@ coreFacade.rollback(sp1); assertThat(rootModel.getEntities().size(), is(0)); - TableModel tableModel = factory.newModel(TableModel.class); - coreFacade.changeModelProperty(tableModel, EntityProperty.name, "baz"); - coreFacade.addEntity(tableModel); + TableModel table2 = factory.newModel(TableModel.class); + coreFacade.changeModelProperty(table2, EntityProperty.name, "baz"); + coreFacade.addEntity(table2); assertThat(rootModel.getEntities().size(), is(1)); - assertThat(table1.getName(), is("baz")); + assertThat(table2.getName(), is("baz")); SavePoint sp4 = coreFacade.save(); @@ -193,46 +193,56 @@ coreFacade.rollback(sp4); assertThat(rootModel.getEntities().size(), is(1)); - assertThat(table1.getName(), is("baz")); + assertThat(CollectionUtils.get(rootModel.getEntities(), 0), is(sameInstance((Object) table2))); + assertThat(table2.getName(), is("baz")); coreFacade.rollback(sp2); assertThat(rootModel.getEntities().size(), is(1)); + assertThat(CollectionUtils.get(rootModel.getEntities(), 0), is(sameInstance((Object) table1))); assertThat(table1.getName(), is("foo")); coreFacade.rollback(sp4); assertThat(rootModel.getEntities().size(), is(1)); - assertThat(table1.getName(), is("baz")); + assertThat(CollectionUtils.get(rootModel.getEntities(), 0), is(sameInstance((Object) table2))); + assertThat(table2.getName(), is("baz")); coreFacade.rollback(sp3); assertThat(rootModel.getEntities().size(), is(1)); + assertThat(CollectionUtils.get(rootModel.getEntities(), 0), is(sameInstance((Object) table1))); assertThat(table1.getName(), is("bar")); coreFacade.rollback(sp4); assertThat(rootModel.getEntities().size(), is(1)); - assertThat(table1.getName(), is("baz")); + assertThat(CollectionUtils.get(rootModel.getEntities(), 0), is(sameInstance((Object) table2))); + assertThat(table2.getName(), is("baz")); coreFacade.rollback(sp2); assertThat(rootModel.getEntities().size(), is(1)); + assertThat(CollectionUtils.get(rootModel.getEntities(), 0), is(sameInstance((Object) table1))); assertThat(table1.getName(), is("foo")); coreFacade.rollback(sp4); assertThat(rootModel.getEntities().size(), is(1)); - assertThat(table1.getName(), is("baz")); + assertThat(CollectionUtils.get(rootModel.getEntities(), 0), is(sameInstance((Object) table2))); + assertThat(table2.getName(), is("baz")); coreFacade.rollback(sp1); assertThat(rootModel.getEntities().size(), is(0)); coreFacade.rollback(sp4); assertThat(rootModel.getEntities().size(), is(1)); - assertThat(table1.getName(), is("baz")); + assertThat(CollectionUtils.get(rootModel.getEntities(), 0), is(sameInstance((Object) table2))); + assertThat(table2.getName(), is("baz")); coreFacade.rollback(sp3); assertThat(rootModel.getEntities().size(), is(1)); + assertThat(CollectionUtils.get(rootModel.getEntities(), 0), is(sameInstance((Object) table1))); assertThat(table1.getName(), is("bar")); coreFacade.rollback(sp4); assertThat(rootModel.getEntities().size(), is(1)); - assertThat(table1.getName(), is("baz")); + assertThat(CollectionUtils.get(rootModel.getEntities(), 0), is(sameInstance((Object) table2))); + assertThat(table2.getName(), is("baz")); coreFacade.rollback(sp1); assertThat(rootModel.getEntities().size(), is(0)); Modified: artemis/trunk/jiemamy-core/src/test/java/org/jiemamy/internal/processor/GetNodesProcessorTest.java =================================================================== --- artemis/trunk/jiemamy-core/src/test/java/org/jiemamy/internal/processor/GetNodesProcessorTest.java 2009-03-03 18:33:18 UTC (rev 2809) +++ artemis/trunk/jiemamy-core/src/test/java/org/jiemamy/internal/processor/GetNodesProcessorTest.java 2009-03-04 10:33:52 UTC (rev 2810) @@ -30,8 +30,8 @@ import org.jiemamy.model.RootModel; import org.jiemamy.model.entity.TableModel; import org.jiemamy.model.entity.ViewModel; -import org.jiemamy.utils.builder.TableBuilder; -import org.jiemamy.utils.builder.ViewBuilder; +import org.jiemamy.utils.builder.TableBuilderImpl; +import org.jiemamy.utils.builder.ViewBuilderImpl; import org.jiemamy.utils.model.RootModelUtil; /** @@ -81,11 +81,11 @@ public void test01_rootModelから特定のエンティティを抽出するテスト() throws Exception { JiemamyFactory factory = rootModel.getJiemamy().getFactory(); - rootModel.getEntities().add(new TableBuilder(factory, "table1").build()); - rootModel.getEntities().add(new TableBuilder(factory, "table2").build()); - rootModel.getEntities().add(new TableBuilder(factory, "table3").build()); - rootModel.getEntities().add(new ViewBuilder(factory, "view1").build()); - rootModel.getEntities().add(new ViewBuilder(factory, "view2").build()); + rootModel.getEntities().add(new TableBuilderImpl(factory, "table1").build()); + rootModel.getEntities().add(new TableBuilderImpl(factory, "table2").build()); + rootModel.getEntities().add(new TableBuilderImpl(factory, "table3").build()); + rootModel.getEntities().add(new ViewBuilderImpl(factory, "view1").build()); + rootModel.getEntities().add(new ViewBuilderImpl(factory, "view2").build()); assertThat(RootModelUtil.getEntities(rootModel, TableModel.class).size(), is(3)); assertThat(RootModelUtil.getEntities(rootModel, ViewModel.class).size(), is(2)); 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-03-03 18:33:18 UTC (rev 2809) +++ artemis/trunk/jiemamy-core/src/test/java/org/jiemamy/model/RootModelImplTest.java 2009-03-04 10:33:52 UTC (rev 2810) @@ -35,7 +35,7 @@ import org.jiemamy.model.datatype.DataTypeCategory; import org.jiemamy.model.datatype.DomainModel; import org.jiemamy.model.entity.TableModel; -import org.jiemamy.utils.builder.DataTypeBuilder; +import org.jiemamy.utils.builder.DataTypeBuilderImpl; import org.jiemamy.utils.model.AttributeUtil; /** @@ -112,10 +112,10 @@ // モデル構築 DomainModel domain1 = factory.newModel(DomainModel.class); domain1.setName("domain1"); - domain1.setDataType(new DataTypeBuilder(factory, DataTypeCategory.INTEGER).build()); + domain1.setDataType(new DataTypeBuilderImpl(factory, DataTypeCategory.INTEGER).build()); DomainModel domain2 = factory.newModel(DomainModel.class); domain2.setName("domain2"); - domain2.setDataType(new DataTypeBuilder(factory, DataTypeCategory.INTEGER).build()); + domain2.setDataType(new DataTypeBuilderImpl(factory, DataTypeCategory.INTEGER).build()); rootModel.getDomains().add(domain1); 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-03-03 18:33:18 UTC (rev 2809) +++ artemis/trunk/jiemamy-core/src/test/java/org/jiemamy/model/node/TableModelImplTest.java 2009-03-04 10:33:52 UTC (rev 2810) @@ -36,7 +36,7 @@ import org.jiemamy.model.datatype.DataTypeCategory; import org.jiemamy.model.entity.TableModel; import org.jiemamy.model.entity.TableModelImpl; -import org.jiemamy.utils.builder.DataTypeBuilder; +import org.jiemamy.utils.builder.DataTypeBuilderImpl; import org.jiemamy.utils.model.TableUtil; /** @@ -116,10 +116,10 @@ public void test08_RootModelからのクローニングが適切に行われること() throws Exception { ColumnModel column1 = factory.newModel(ColumnModel.class); column1.setName("column1"); - column1.setDataType(new DataTypeBuilder(factory, DataTypeCategory.INTEGER).build()); + column1.setDataType(new DataTypeBuilderImpl(factory, DataTypeCategory.INTEGER).build()); ColumnModel column2 = factory.newModel(ColumnModel.class); column2.setName("column2"); - column2.setDataType(new DataTypeBuilder(factory, DataTypeCategory.INTEGER).build()); + column2.setDataType(new DataTypeBuilderImpl(factory, DataTypeCategory.INTEGER).build()); tableModel.getAttributes().add(column1); Added: artemis/trunk/jiemamy-core/src/test/java/org/jiemamy/utils/ArrayEssentialStackTest.java =================================================================== --- artemis/trunk/jiemamy-core/src/test/java/org/jiemamy/utils/ArrayEssentialStackTest.java (rev 0) +++ artemis/trunk/jiemamy-core/src/test/java/org/jiemamy/utils/ArrayEssentialStackTest.java 2009-03-04 10:33:52 UTC (rev 2810) @@ -0,0 +1,268 @@ +/* + * Copyright 2007-2009 Jiemamy Project and the Others. + * Created on 2009/03/04 + * + * 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 static org.hamcrest.CoreMatchers.is; +import static org.junit.Assert.assertThat; +import static org.junit.Assert.fail; + +import java.util.ArrayList; +import java.util.EmptyStackException; +import java.util.List; + +import org.junit.After; +import org.junit.Before; +import org.junit.Test; + +/** + * {@link ArrayEssentialStack}のテストクラス。 + * + * @author daisuke + */ +public class ArrayEssentialStackTest { + + private ArrayEssentialStack<Element> stack; + + + /** + * テストを初期化する。 + * + * @throws Exception 例外が発生した場合 + */ + @Before + public void setUp() throws Exception { + stack = new ArrayEssentialStack<Element>(); + } + + /** + * テストの情報を破棄する。 + * + * @throws Exception 例外が発生した場合 + */ + @After + public void tearDown() throws Exception { + stack = null; + } + + /** + * 基本スタック機能のテスト。 + * + * @throws Exception 例外が発生した場合 + */ + @Test + public void test01_基本スタック機能のテスト() throws Exception { + stack.push(new Element(0)); + stack.push(new Element(1)); + stack.push(new Element(2)); + + assertThat(stack.pop().num, is(2)); + assertThat(stack.pop().num, is(1)); + assertThat(stack.pop().num, is(0)); + } + + /** + * {@link EssentialStack#iterator()}のテスト。 + * + * @throws Exception 例外が発生した場合 + */ + @Test + public void test02_iteratorのテスト() throws Exception { + stack.push(new Element(0)); + stack.push(new Element(1)); + stack.push(new Element(2)); + + int i = 0; + for (Element e : stack) { + assertThat(e.num, is(i++)); + } + } + + /** + * {@link EssentialStack#reverse()}のテスト + * + * @throws Exception + */ + @Test + public void test03_reverseのテスト() throws Exception { + stack.push(new Element(0)); + stack.push(new Element(1)); + stack.push(new Element(2)); + + EssentialStack<Element> reverse = stack.reverse(); + + int i = stack.size() - 1; + for (Element e : reverse) { + assertThat(e.num, is(i--)); + } + } + + /** + * {@link EssentialStack#clear()}のテスト + * + * @throws Exception + */ + @Test + public void test04_clearのテスト() throws Exception { + stack.push(new Element(0)); + stack.push(new Element(1)); + stack.push(new Element(2)); + + assertThat(stack.size(), is(3)); + stack.clear(); + assertThat(stack.size(), is(0)); + } + + /** + * {@link EssentialStack#insert(int, Object)}のテスト + * + * @throws Exception + */ + @Test + public void test05_insertのテスト() throws Exception { + stack.push(new Element(0)); + stack.push(new Element(2)); + stack.insert(1, new Element(1)); + + assertThat(stack.pop().num, is(2)); + assertThat(stack.pop().num, is(1)); + assertThat(stack.pop().num, is(0)); + } + + /** + * {@link EssentialStack#isEmpty()}のテスト + * + * @throws Exception + */ + @Test + public void test06_isEmptyのテスト() throws Exception { + assertThat(stack.size(), is(0)); + assertThat(stack.isEmpty(), is(true)); + + try { + stack.pop(); + fail(); + } catch (EmptyStackException e) { + // success + } + + stack.push(new Element(0)); + + assertThat(stack.size(), is(1)); + assertThat(stack.isEmpty(), is(false)); + } + + /** + * {@link EssentialStack#peek()}, {@link EssentialStack#peek(int)}のテスト + * + * @throws Exception 例外が発生した場合 + */ + @Test + public void test07_peekのテスト() throws Exception { + stack.push(new Element(0)); + stack.push(new Element(1)); + stack.push(new Element(2)); + + assertThat(stack.peek().num, is(2)); + assertThat(stack.peek(2).num, is(0)); + assertThat(stack.peek(1).num, is(1)); + assertThat(stack.peek(0).num, is(2)); + + try { + stack.peek(100); + fail(); + } catch (EmptyStackException e) { + // sucess + } + + } + + /** + * {@link EssentialStack#remove(int)}, {@link EssentialStack#remove(Object)}のテスト + * + * @throws Exception + */ + @Test + public void test08_deleteのテスト() throws Exception { + Element three = new Element(3); + stack.push(new Element(0)); + stack.push(new Element(1)); + stack.push(new Element(2)); + stack.push(three); + stack.push(new Element(4)); + + stack.remove(1); + stack.remove(three); + + assertThat(stack.pop().num, is(4)); + assertThat(stack.pop().num, is(2)); + assertThat(stack.pop().num, is(0)); + } + + /** + * コンストラクタにコレクションを与えたスタックのテスト。 + * + * @throws Exception 例外が発生した場合 + */ + @Test + public void test10_コンストラクタにコレクションを与えたスタックのテスト() throws Exception { + List<Element> list = new ArrayList<Element>(); + list.add(new Element(0)); + list.add(new Element(1)); + list.add(new Element(2)); + stack = new ArrayEssentialStack<Element>(list); + + assertThat(stack.pop().num, is(2)); + assertThat(stack.pop().num, is(1)); + assertThat(stack.pop().num, is(0)); + } + + /** + * コンストラクタにスタックを与えたスタックのテスト。 + * + * @throws Exception + */ + public void test11_コンストラクタにスタックを与えたスタックのテスト() throws Exception { + EssentialStack<Element> source = new ArrayEssentialStack<Element>(); + source.push(new Element(0)); + source.push(new Element(1)); + source.push(new Element(2)); + stack = new ArrayEssentialStack<Element>(source); // 同要素スタックのコピーを作る + + assertThat(stack.size(), is(3)); + assertThat(source.size(), is(3)); + + assertThat(stack.pop().num, is(2)); + assertThat(stack.pop().num, is(1)); + assertThat(stack.pop().num, is(0)); + + assertThat(stack.size(), is(0)); + assertThat(source.size(), is(3)); // sourceに影響しない + } + + + private static class Element { + + final int num; + + + Element(int num) { + this.num = num; + } + } +} Property changes on: artemis/trunk/jiemamy-core/src/test/java/org/jiemamy/utils/ArrayEssentialStackTest.java ___________________________________________________________________ Added: svn:mime-type + text/plain Copied: artemis/trunk/jiemamy-core/src/test/java/org/jiemamy/utils/builder/TableBuilderTest.java (from rev 2809, artemis/trunk/jiemamy-core/src/test/java/org/jiemamy/builder/TableBuilderTest.java) =================================================================== --- artemis/trunk/jiemamy-core/src/test/java/org/jiemamy/utils/builder/TableBuilderTest.java (rev 0) +++ artemis/trunk/jiemamy-core/src/test/java/org/jiemamy/utils/builder/TableBuilderTest.java 2009-03-04 10:33:52 UTC (rev 2810) @@ -0,0 +1,101 @@ +/* + * Copyright 2007-2009 MIYAMOTO Daisuke, jiemamy.org and the Others. + * Created on 2009/01/01 + * + * 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.builder; + +import org.junit.After; +import org.junit.Before; +import org.junit.Test; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import org.jiemamy.Jiemamy; +import org.jiemamy.JiemamyFactory; +import org.jiemamy.model.RootModel; +import org.jiemamy.model.attribute.ColumnModel; +import org.jiemamy.model.datatype.DataType; +import org.jiemamy.model.datatype.DataTypeCategory; + +/** + * {@link TableBuilderImpl}のテストクラス。 + * + * @author daisuke + */ +public class TableBuilderTest { + + private static Logger logger = LoggerFactory.getLogger(TableBuilderTest.class); + + private Jiemamy jiemamy; + + private RootModel rootModel; + + private JiemamyFactory factory; + + private ColumnModel col1; + + private ColumnModel col2; + + private ColumnModel col3; + + + /** + * テストを初期化する。 + * + * @throws Exception 例外が発生した場合 + */ + @Before + public void setUp() throws Exception { + jiemamy = Jiemamy.newInstance(); + factory = jiemamy.getFactory(); + rootModel = factory.getRootModel(); + DataType dataType1 = new DataTypeBuilderImpl(factory, DataTypeCategory.INTEGER).build(); + DataType dataType2 = new DataTypeBuilderImpl(factory, DataTypeCategory.INTEGER).build(); + DataType dataType3 = new DataTypeBuilderImpl(factory, DataTypeCategory.INTEGER).build(); + col1 = new ColumnBuilderImpl(factory, "column1", dataType1).build(); + col2 = new ColumnBuilderImpl(factory, "column2", dataType2).build(); + col3 = new ColumnBuilderImpl(factory, "column3", dataType3).build(); + } + + /** + * テストの情報を破棄する。 + * + * @throws Exception 例外が発生した場合 + */ + @After + public void tearDown() throws Exception { + col1 = null; + col2 = null; + col3 = null; + rootModel = null; + jiemamy = null; + } + + /** + * ビルダのオートマトンっぷりを見てみる。 + * + * @throws Exception + */ + @Test + public void test01_ビルダのオートマトンっぷりを見てみる() throws Exception { +// TableModel table1 = factory.newBuilder(PrematureTableBuilder.class).setName("T_USER").addColumn(col1).build(); +// TableModel table2 = factory.newBuilder(PrematureTableBuilder.class).addColumn(col2).setName("T_USER").build(); +//// TableModel table3 = factory.newBuilder(PrematureTableBuilder.class).addColumn(col3).build(); // コンパイルエラー +// logger.info(table1.toString()); +// logger.info(table2.toString()); + } +} Property changes on: artemis/trunk/jiemamy-core/src/test/java/org/jiemamy/utils/builder/TableBuilderTest.java ___________________________________________________________________ Added: svn:mime-type + text/plain Modified: artemis/trunk/jiemamy-dialect-mysql/src/main/java/org/jiemamy/dialect/mysql/MySqlDialect.java =================================================================== --- artemis/trunk/jiemamy-dialect-mysql/src/main/java/org/jiemamy/dialect/mysql/MySqlDialect.java 2009-03-03 18:33:18 UTC (rev 2809) +++ artemis/trunk/jiemamy-dialect-mysql/src/main/java/org/jiemamy/dialect/mysql/MySqlDialect.java 2009-03-04 10:33:52 UTC (rev 2810) @@ -73,16 +73,31 @@ list.add(new BuiltinDataTypeMoldImpl(BIT, SizedDataTypeAdapter.class)); list.add(new BuiltinDataTypeMoldImpl(NUMERIC, PrecisionedDataTypeAdapter.class, Unsigned.class)); list.add(new BuiltinDataTypeMoldImpl(DECIMAL, PrecisionedDataTypeAdapter.class, Unsigned.class)); - list.add(new BuiltinDataTypeMoldImpl(INTEGER, SizedDataTypeAdapter.class, SerialDataTypeAdapter.class, - Unsigned.class)); - list.add(new BuiltinDataTypeMoldImpl(INTEGER, "MEDIUMINT", SizedDataTypeAdapter.class, - SerialDataTypeAdapter.class, Unsigned.class)); - list.add(new BuiltinDataTypeMoldImpl(INTEGER, "BIGINT", SizedDataTypeAdapter.class, - SerialDataTypeAdapter.class, Unsigned.class)); - list.add(new BuiltinDataTypeMoldImpl(SMALLINT, SizedDataTypeAdapter.class, SerialDataTypeAdapter.class, - Unsigned.class)); - list.add(new BuiltinDataTypeMoldImpl(SMALLINT, "TINYINT", SizedDataTypeAdapter.class, - SerialDataTypeAdapter.class, Unsigned.class)); + list.add(new BuiltinDataTypeMoldImpl(INTEGER, new Class[] { + SizedDataTypeAdapter.class, + SerialDataTypeAdapter.class, + Unsigned.class + })); + list.add(new BuiltinDataTypeMoldImpl(INTEGER, "MEDIUMINT", new Class[] { + SizedDataTypeAdapter.class, + SerialDataTypeAdapter.class, + Unsigned.class + })); + list.add(new BuiltinDataTypeMoldImpl(INTEGER, "BIGINT", new Class[] { + SizedDataTypeAdapter.class, + SerialDataTypeAdapter.class, + Unsigned.class + })); + list.add(new BuiltinDataTypeMoldImpl(SMALLINT, new Class[] { + SizedDataTypeAdapter.class, + SerialDataTypeAdapter.class, + Unsigned.class + })); + list.add(new BuiltinDataTypeMoldImpl(SMALLINT, "TINYINT", new Class[] { + SizedDataTypeAdapter.class, + SerialDataTypeAdapter.class, + Unsigned.class + })); list.add(new BuiltinDataTypeMoldImpl(FLOAT, PrecisionedDataTypeAdapter.class, Unsigned.class)); list.add(new BuiltinDataTypeMoldImpl(REAL, PrecisionedDataTypeAdapter.class, Unsigned.class)); list.add(new BuiltinDataTypeMoldImpl(DOUBLE, PrecisionedDataTypeAdapter.class, Unsigned.class)); Modified: artemis/trunk/jiemamy-dialect-mysql/src/test/java/org/jiemamy/dialect/mysql/MySqlDialectTest.java =================================================================== --- artemis/trunk/jiemamy-dialect-mysql/src/test/java/org/jiemamy/dialect/mysql/MySqlDialectTest.java 2009-03-03 18:33:18 UTC (rev 2809) +++ artemis/trunk/jiemamy-dialect-mysql/src/test/java/org/jiemamy/dialect/mysql/MySqlDialectTest.java 2009-03-04 10:33:52 UTC (rev 2810) @@ -19,12 +19,18 @@ package org.jiemamy.dialect.mysql; import static org.hamcrest.CoreMatchers.is; +import static org.hamcrest.CoreMatchers.notNullValue; import static org.junit.Assert.assertThat; +import static org.junit.Assert.fail; import org.junit.After; import org.junit.Before; import org.junit.Test; +import org.jiemamy.dialect.Dialect; +import org.jiemamy.dialect.Dialect.BuiltinDataTypeMold; +import org.jiemamy.model.datatype.DataTypeCategory; + /** * {@link MySqlDialect}のテストクラス。 * @@ -64,4 +70,57 @@ public void test01_toStringがFQCNを返す() throws Exception { assertThat(dialect.toString(), is("org.jiemamy.dialect.mysql.MySqlDialect")); } + + /** + * {@code null}を返してはいけないメソッドは{@code null}を返さない。 + * + * @throws Exception 例外が発生した場合 + */ + @Test + public void test02_nullを返してはいけないメソッドはnullを返さない() throws Exception { + assertThat(dialect.getAdvisor(), is(notNullValue())); + assertThat(dialect.getAllDataTypes(), is(notNullValue())); + assertThat(dialect.getDataTypeResolver(), is(notNullValue())); + assertThat(dialect.getValidator(), is(notNullValue())); + } + + /** + * {@link Dialect#findDataTypeMold(DataTypeCategory, String)}のテスト。 + * + * @throws Exception 例外が発生した場合 + */ + @Test + public void test03_findDataTypeMoldのテスト() throws Exception { + // 完全一致な情報を与えると、そのままのモールドが得られる。 + BuiltinDataTypeMold mold = dialect.findDataTypeMold(DataTypeCategory.INTEGER, "INTEGER"); + assertThat(mold.getCategory(), is(DataTypeCategory.INTEGER)); + assertThat(mold.getTypeName(), is("INTEGER")); + + // 適当な情報を与えた場合、型名が一致したモールドが得られる。 + mold = dialect.findDataTypeMold(DataTypeCategory.VARBIT, "INTEGER"); + assertThat(mold.getCategory(), is(DataTypeCategory.INTEGER)); + assertThat(mold.getTypeName(), is("INTEGER")); + + // Oracleっぽい情報を与えても、Postgres用のモールドが得られる。 + mold = dialect.findDataTypeMold(DataTypeCategory.VARCHAR, "VARCHAR2"); + assertThat(mold.getCategory(), is(DataTypeCategory.VARCHAR)); + assertThat(mold.getTypeName(), is("VARCHAR")); + + // 意味不明な情報を与えた場合、カテゴリ内で最初に定義したモールドが得られる。 + mold = dialect.findDataTypeMold(DataTypeCategory.OTHER, "WONDERFUL"); + assertThat(mold.getCategory(), is(DataTypeCategory.OTHER)); + assertThat(mold.getTypeName(), is("DATETIME")); + + mold = dialect.findDataTypeMold(DataTypeCategory.INTEGER, "WONDERFUL"); + assertThat(mold.getCategory(), is(DataTypeCategory.INTEGER)); + assertThat(mold.getTypeName(), is("INTEGER")); + + try { + dialect.findDataTypeMold(null, null); + fail(); + } catch (IllegalArgumentException e) { + // success + } + } + } Modified: artemis/trunk/jiemamy-dialect-postgresql/src/main/java/org/jiemamy/dialect/postgresql/PostgresqlDialect.java =================================================================== --- artemis/trunk/jiemamy-dialect-postgresql/src/main/java/org/jiemamy/dialect/postgresql/PostgresqlDialect.java 2009-03-03 18:33:18 UTC (rev 2809) +++ artemis/trunk/jiemamy-dialect-postgresql/src/main/java/org/jiemamy/dialect/postgresql/PostgresqlDialect.java 2009-03-04 10:33:52 UTC (rev 2810) @@ -14,13 +14,32 @@ */ package org.jiemamy.dialect.postgresql; +import static org.jiemamy.model.datatype.DataTypeCategory.BIT; +import static org.jiemamy.model.datatype.DataTypeCategory.BLOB; +import static org.jiemamy.model.datatype.DataTypeCategory.BOOLEAN; +import static org.jiemamy.model.datatype.DataTypeCategory.CHARACTER; +import static org.jiemamy.model.datatype.DataTypeCategory.CLOB; +import static org.jiemamy.model.datatype.DataTypeCategory.DATE; +import static org.jiemamy.model.datatype.DataTypeCategory.DECIMAL; +import static org.jiemamy.model.datatype.DataTypeCategory.DOUBLE; +import static org.jiemamy.model.datatype.DataTypeCategory.FLOAT; +import static org.jiemamy.model.datatype.DataTypeCategory.INTEGER; +import static org.jiemamy.model.datatype.DataTypeCategory.INTERVAL; +import static org.jiemamy.model.datatype.DataTypeCategory.NUMERIC; +import static org.jiemamy.model.datatype.DataTypeCategory.OTHER; +import static org.jiemamy.model.datatype.DataTypeCategory.REAL; +import static org.jiemamy.model.datatype.DataTypeCategory.SMALLINT; +import static org.jiemamy.model.datatype.DataTypeCategory.TIME; +import static org.jiemamy.model.datatype.DataTypeCategory.TIMESTAMP; +import static org.jiemamy.model.datatype.DataTypeCategory.VARBIT; +import static org.jiemamy.model.datatype.DataTypeCategory.VARCHAR; + import java.util.List; import org.apache.commons.collections15.list.UnmodifiableList; import org.jiemamy.dialect.AbstractDialect; import org.jiemamy.dialect.BuiltinDataTypeMoldImpl; -import org.jiemamy.model.datatype.DataTypeCategory; import org.jiemamy.model.datatype.adapter.PrecisionedDataTypeAdapter; import org.jiemamy.model.datatype.adapter.SizedDataTypeAdapter; import org.jiemamy.model.datatype.adapter.TimezonedDataTypeAdapter; @@ -39,40 +58,40 @@ static { List<BuiltinDataTypeMold> list = CollectionsUtil.newArrayList(); - list.add(new BuiltinDataTypeMoldImpl(DataTypeCategory.CHARACTER, SizedDataTypeAdapter.class)); - list.add(new BuiltinDataTypeMoldImpl(DataTypeCategory.VARCHAR, SizedDataTypeAdapter.class)); - list.add(new BuiltinDataTypeMoldImpl(DataTypeCategory.CLOB, "TEXT")); - list.add(new BuiltinDataTypeMoldImpl(DataTypeCategory.BLOB, "BYTEA")); - list.add(new BuiltinDataTypeMoldImpl(DataTypeCategory.BIT, SizedDataTypeAdapter.class)); - list.add(new BuiltinDataTypeMoldImpl(DataTypeCategory.VARBIT, SizedDataTypeAdapter.class)); - list.add(new BuiltinDataTypeMoldImpl(DataTypeCategory.NUMERIC, PrecisionedDataTypeAdapter.class)); - list.add(new BuiltinDataTypeMoldImpl(DataTypeCategory.DECIMAL, PrecisionedDataTypeAdapter.class)); - list.add(new BuiltinDataTypeMoldImpl(DataTypeCategory.INTEGER)); - list.add(new BuiltinDataTypeMoldImpl(DataTypeCategory.INTEGER, "SERIAL")); - list.add(new BuiltinDataTypeMoldImpl(DataTypeCategory.INTEGER, "BIGINT")); - list.add(new BuiltinDataTypeMoldImpl(DataTypeCategory.INTEGER, "BIGSERIAL")); - list.add(new BuiltinDataTypeMoldImpl(DataTypeCategory.SMALLINT)); - list.add(new BuiltinDataTypeMoldImpl(DataTypeCategory.FLOAT, "REAL")); - list.add(new BuiltinDataTypeMoldImpl(DataTypeCategory.REAL)); - list.add(new BuiltinDataTypeMoldImpl(DataTypeCategory.DOUBLE, "DOUBLE PRECISION")); - list.add(new BuiltinDataTypeMoldImpl(DataTypeCategory.BOOLEAN)); - list.add(new BuiltinDataTypeMoldImpl(DataTypeCategory.DATE)); - list.add(new BuiltinDataTypeMoldImpl(DataTypeCategory.TIME, TimezonedDataTypeAdapter.class)); - list.add(new BuiltinDataTypeMoldImpl(DataTypeCategory.TIMESTAMP, TimezonedDataTypeAdapter.class)); - list.add(new BuiltinDataTypeMoldImpl(DataTypeCategory.INTERVAL)); - list.add(new BuiltinDataTypeMoldImpl(DataTypeCategory.OTHER, "UUID")); - list.add(new BuiltinDataTypeMoldImpl(DataTypeCategory.OTHER, "MACADDR")); - list.add(new BuiltinDataTypeMoldImpl(DataTypeCategory.OTHER, "MONEY")); - list.add(new BuiltinDataTypeMoldImpl(DataTypeCategory.OTHER, "INET")); - list.add(new BuiltinDataTypeMoldImpl(DataTypeCategory.OTHER, "CIDR")); - list.add(new BuiltinDataTypeMoldImpl(DataTypeCategory.OTHER, "XML")); - list.add(new BuiltinDataTypeMoldImpl(DataTypeCategory.OTHER, "LINE")); - list.add(new BuiltinDataTypeMoldImpl(DataTypeCategory.OTHER, "LSEG")); - list.add(new BuiltinDataTypeMoldImpl(DataTypeCategory.OTHER, "CIRCLE")); - list.add(new BuiltinDataTypeMoldImpl(DataTypeCategory.OTHER, "BOX")); - list.add(new BuiltinDataTypeMoldImpl(DataTypeCategory.OTHER, "PATH")); - list.add(new BuiltinDataTypeMoldImpl(DataTypeCategory.OTHER, "POINT")); - list.add(new BuiltinDataTypeMoldImpl(DataTypeCategory.OTHER, "POLYGON")); + list.add(new BuiltinDataTypeMoldImpl(INTEGER)); + list.add(new BuiltinDataTypeMoldImpl(INTEGER, "SERIAL")); + list.add(new BuiltinDataTypeMoldImpl(INTEGER, "BIGINT")); + list.add(new BuiltinDataTypeMoldImpl(INTEGER, "BIGSERIAL")); + list.add(new BuiltinDataTypeMoldImpl(SMALLINT)); + list.add(new BuiltinDataTypeMoldImpl(NUMERIC, PrecisionedDataTypeAdapter.class)); + list.add(new BuiltinDataTypeMoldImpl(DECIMAL, PrecisionedDataTypeAdapter.class)); + list.add(new BuiltinDataTypeMoldImpl(FLOAT, "REAL")); + list.add(new BuiltinDataTypeMoldImpl(REAL)); + list.add(new BuiltinDataTypeMoldImpl(DOUBLE, "DOUBLE PRECISION")); + list.add(new BuiltinDataTypeMoldImpl(CHARACTER, SizedDataTypeAdapter.class)); + list.add(new BuiltinDataTypeMoldImpl(VARCHAR, SizedDataTypeAdapter.class)); + list.add(new BuiltinDataTypeMoldImpl(CLOB, "TEXT")); + list.add(new BuiltinDataTypeMoldImpl(BLOB, "BYTEA")); + list.add(new BuiltinDataTypeMoldImpl(BIT, SizedDataTypeAdapter.class)); + list.add(new BuiltinDataTypeMoldImpl(VARBIT, SizedDataTypeAdapter.class)); + list.add(new BuiltinDataTypeMoldImpl(BOOLEAN)); + list.add(new BuiltinDataTypeMoldImpl(DATE)); + list.add(new BuiltinDataTypeMoldImpl(TIME, TimezonedDataTypeAdapter.class)); + list.add(new BuiltinDataTypeMoldImpl(TIMESTAMP, TimezonedDataTypeAdapter.class)); + list.add(new BuiltinDataTypeMoldImpl(INTERVAL)); + list.add(new BuiltinDataTypeMoldImpl(OTHER, "UUID")); + list.add(new BuiltinDataTypeMoldImpl(OTHER, "MACADDR")); + list.add(new BuiltinDataTypeMoldImpl(OTHER, "MONEY")); + list.add(new BuiltinDataTypeMoldImpl(OTHER, "INET")); + list.add(new BuiltinDataTypeMoldImpl(OTHER, "CIDR")); + list.add(new BuiltinDataTypeMoldImpl(OTHER, "XML")); + list.add(new BuiltinDataTypeMoldImpl(OTHER, "LINE")); + list.add(new BuiltinDataTypeMoldImpl(OTHER, "LSEG")); + list.add(new BuiltinDataTypeMoldImpl(OTHER, "CIRCLE")); + list.add(new BuiltinDataTypeMoldImpl(OTHER, "BOX")); + list.add(new BuiltinDataTypeMoldImpl(OTHER, "PATH")); + list.add(new BuiltinDataTypeMoldImpl(OTHER, "POINT")); + list.add(new BuiltinDataTypeMoldImpl(OTHER, "POLYGON")); PostgresqlDialect.typeList = UnmodifiableList.decorate(list); } Modified: artemis/trunk/jiemamy-dialect-postgresql/src/test/java/org/jiemamy/dialect/postgresql/PostgresqlDialectTest.java =================================================================== --- artemis/trunk/jiemamy-dialect-postgresql/src/test/java/org/jiemamy/dialect/postgresql/PostgresqlDialectTest.java 2009-03-03 18:33:18 UTC (rev 2809) +++ artemis/trunk/jiemamy-dialect-postgresql/src/test/java/org/jiemamy/dialect/postgresql/PostgresqlDialectTest.java 2009-03-04 10:33:52 UTC (rev 2810) @@ -18,6 +18,11 @@ */ package org.jiemamy.dialect.postgresql; +import static org.hamcrest.CoreMatchers.is; +import static org.hamcrest.CoreMatchers.notNullValue; +import static org.junit.Assert.assertThat; +import static org.junit.Assert.fail; + import java.net.URL; import java.net.URLClassLoader; import java.security.AccessController; @@ -39,7 +44,9 @@ import org.jiemamy.Jiemamy; import org.jiemamy.JiemamyFactory; import org.jiemamy.dialect.Dialect; +import org.jiemamy.dialect.Dialect.BuiltinDataTypeMold; import org.jiemamy.model.RootModel; +import org.jiemamy.model.datatype.DataTypeCategory; import org.jiemamy.test.ReflectionDialectProvider; /** @@ -111,15 +118,67 @@ } /** - * dummy + * toStringがFQCNを返す。 * * @throws Exception 例外が発生した場合 */ @Test - public void testname() throws Exception { - // dummy + public void test01_toStringがFQCNを返す() throws Exception { + assertThat(dialect.toString(), is("org.jiemamy.dialect.postgresql.PostgresqlDialect")); } + /** + * {@code null}を返してはいけないメソッドは{@code null}を返さない。 + * + * @throws Exception 例外が発生した場合 + */ + @Test + public void test02_nullを返してはいけないメソッドはnullを返さない() throws Exception { + assertThat(dialect.getAdvisor(), is(notNullValue())); + assertThat(dialect.getAllDataTypes(), is(notNullValue())); + assertThat(dialect.getDataTypeResolver(), is(notNullValue())); + assertThat(dialect.getValidator(), is(notNullValue())); + } + + /** + * {@link Dialect#findDataTypeMold(DataTypeCategory, String)}のテスト。 + * + * @throws Exception 例外が発生した場合 + */ + @Test + public void test03_findDataTypeMoldのテスト() throws Exception { + // 完全一致な情報を与えると、そのままのモールドが得られる。 + BuiltinDataTypeMold mold = dialect.findDataTypeMold(DataTypeCategory.INTEGER, "INTEGER"); + assertThat(mold.getCategory(), is(DataTypeCategory.INTEGER)); + assertThat(mold.getTypeName(), is("INTEGER")); + + // 適当な情報を与えた場合、型名が一致したモールドが得られる。 + mold = dialect.findDataTypeMold(DataTypeCategory.VARBIT, "INTEGER"); + assertThat(mold.getCategory(), is(DataTypeCategory.INTEGER)); + assertThat(mold.getTypeName(), is("INTEGER")); + + // Oracleっぽい情報を与えても、Postgres用のモールドが得られる。 + mold = dialect.findDataTypeMold(DataTypeCategory.VARCHAR, "VARCHAR2"); + assertThat(mold.getCategory(), is(DataTypeCategory.VARCHAR)); + assertThat(mold.getTypeName(), is("VARCHAR")); + + // 意味不明な情報を与えた場合、カテゴリ内で最初に定義したモールドが得られる。 + mold = dialect.findDataTypeMold(DataTypeCategory.OTHER, "WONDERFUL"); + assertThat(mold.getCategory(), is(DataTypeCategory.OTHER)); + assertThat(mold.getTypeName(), is("UUID")); + + mold = dialect.findDataTypeMold(DataTypeCategory.INTEGER, "WONDERFUL"); + assertThat(mold.getCategory(), is(DataTypeCategory.INTEGER)); + assertThat(mold.getTypeName(), is("INTEGER")); + + try { + dialect.findDataTypeMold(null, null); + fail(); + } catch (IllegalArgumentException e) { + // success + } + } + /** * JDBC Driverのラッパークラス。 Modified: artemis/trunk/jiemamy-dialect-sql99/src/main/java/org/jiemamy/dialect/sql99/Sql99Dialect.java =================================================================== --- artemis/trunk/jiemamy-dialect-sql99/src/main/java/org/jiemamy/dialect/sql99/Sql99Dialect.java 2009-03-03 18:33:18 UTC (rev 2809) +++ artemis/trunk/jiemamy-dialect-sql99/src/main/java/org/jiemamy/dialect/sql99/Sql99Dialect.java 2009-03-04 10:33:52 UTC (rev 2810) @@ -18,13 +18,31 @@ */ package org.jiemamy.dialect.sql99; +import static org.jiemamy.model.datatype.DataTypeCategory.BIT; +import static org.jiemamy.model.datatype.DataTypeCategory.BLOB; +import static org.jiemamy.model.datatype.DataTypeCategory.BOOLEAN; +import static org.jiemamy.model.datatype.DataTypeCategory.CHARACTER; +import static org.jiemamy.model.datatype.DataTypeCategory.CLOB; +import static org.jiemamy.model.datatype.DataTypeCategory.DATE; +import static org.jiemamy.model.datatype.DataTypeCategory.DECIMAL; +import static org.jiemamy.model.datatype.DataTypeCategory.DOUBLE; +import static org.jiemamy.model.datatype.DataTypeCategory.FLOAT; +import static org.jiemamy.model.datatype.DataTypeCategory.INTEGER; +import static org.jiemamy.model.datatype.DataTypeCategory.INTERVAL; +import static org.jiemamy.model.datatype.DataTypeCategory.NUMERIC; +import static org.jiemamy.model.datatype.DataTypeCategory.REAL; +import static org.jiemamy.model.datatype.DataTypeCategory.SMALLINT; +import static org.jiemamy.model.datatype.DataTypeCategory.TIME; +import static org.jiemamy.model.datatype.DataTypeCategory.TIMESTAMP; +import static org.jiemamy.model.datatype.DataTypeCategory.VARBIT; +import static org.jiemamy.model.datatype.DataTypeCategory.VARCHAR; + import java.util.List; import org.apache.commons.collections15.list.UnmodifiableList; import org.jiemamy.dialect.AbstractDialect; import org.jiemamy.dialect.BuiltinDataTypeMoldImpl; -import org.jiemamy.model.datatype.DataTypeCategory; import org.jiemamy.model.datatype.adapter.PrecisionedDataTypeAdapter; import org.jiemamy.model.datatype.adapter.SizedDataTypeAdapter; import org.jiemamy.model.datatype.adapter.TimezonedDataTypeAdapter; @@ -43,26 +61,25 @@ static { List<BuiltinDataTypeMold> list = CollectionsUtil.newArrayList(); - list.add(new BuiltinDataTypeMoldImpl(DataTypeCategory.CHARACTER, SizedDataTypeAdapter.class)); - list.add(new BuiltinDataTypeMoldImpl(DataTypeCategory.VARCHAR, SizedDataTypeAdapter.class)); - list.add(new BuiltinDataTypeMoldImpl(DataTypeCategory.CLOB, SizedDataTypeAdapter.class)); - list.add(new BuiltinDataTypeMoldImpl(DataTypeCategory.BLOB, SizedDataTypeAdapter.class)); - list.add(new BuiltinDataTypeMoldImpl(DataTypeCategory.BIT, SizedDataTypeAdapter.class)); - list.add(new BuiltinDataTypeMoldImpl(DataTypeCategory.VARBIT, SizedDataTypeAdapter.class)); - list.add(new BuiltinDataTypeMoldImpl(DataTypeCategory.NUMERIC, PrecisionedDataTypeAdapter.class)); - list.add(new BuiltinDataTypeMoldImpl(DataTypeCategory.DECIMAL, PrecisionedDataTypeAdapter.class)); - list.add(new BuiltinDataTypeMoldImpl(DataTypeCategory.INTEGER)); - list.add(new BuiltinDataTypeMoldImpl(DataTypeCategory.SMALLINT)); - list.add(new BuiltinDataTypeMoldImpl(DataTypeCategory.FLOAT, PrecisionedDataTypeAdapter.class)); - list.add(new BuiltinDataTypeMoldImpl(DataTypeCategory.REAL, PrecisionedDataTypeAdapter.class)); - list.add(new BuiltinDataTypeMoldImpl(DataTypeCategory.DOUBLE, PrecisionedDataTypeAdapter.class)); - list.add(new BuiltinDataTypeMoldImpl(DataTypeCategory.BOOLEAN)); - list.add(new BuiltinDataTypeMoldImpl(DataTypeCategory.DATE)); - list.add(new BuiltinDataTypeMoldImpl(DataTypeCategory.TIME, TimezonedDataTypeAdapter.class)); - list.add(new BuiltinDataTypeMoldImpl(DataTypeCategory.TIMESTAMP, TimezonedDataTypeAdapter.class)); - list.add(new BuiltinDataTypeMoldImpl(DataTypeCategory.INTERVAL)); + list.add(new BuiltinDataTypeMoldImpl(CHARACTER, SizedDataTypeAdapter.class)); + list.add(new BuiltinDataTypeMoldImpl(VARCHAR, SizedDataTypeAdapter.class)); + list.add(new BuiltinDataTypeMoldImpl(CLOB, SizedDataTypeAdapter.class)); + list.add(new BuiltinDataTypeMoldImpl(BLOB, SizedDataTypeAdapter.class)); + list.add(new BuiltinDataTypeMoldImpl(BIT, SizedDataTypeAdapter.class)); + list.add(new BuiltinDataTypeMoldImpl(VARBIT, SizedDataTypeAdapter.class)); + list.add(new BuiltinDataTypeMoldImpl(NUMERIC, PrecisionedDataTypeAdapter.class)); + list.add(new BuiltinDataTypeMoldImpl(DECIMAL, PrecisionedDataTypeAdapter.class)); + list.add(new BuiltinDataTypeMoldImpl(INTEGER)); + list.add(new BuiltinDataTypeMoldImpl(SMALLINT)); + list.add(new BuiltinDataTypeMoldImpl(FLOAT, PrecisionedDataTypeAdapter.class)); + list.add(new BuiltinDataTypeMoldImpl(REAL, PrecisionedDataTypeAdapter.class)); + list.add(new BuiltinDataTypeMoldImpl(DOUBLE, PrecisionedDataTypeAdapter.class)); + list.add(new BuiltinDataTypeMoldImpl(BOOLEAN)); + list.add(new BuiltinDataTypeMoldImpl(DATE)); + list.add(new BuiltinDataTypeMoldImpl(TIME, TimezonedDataTypeAdapter.class)); + list.add(new BuiltinDataTypeMoldImpl(TIMESTAMP, TimezonedDataTypeAdapter.class)); + list.add(new BuiltinDataTypeMoldImpl(INTERVAL)); Sql99Dialect.typeList = UnmodifiableList.decorate(list); - // FIXME 適当 } Added: artemis/trunk/jiemamy-dialect-sql99/src/test/java/org/jiemamy/dialect/sql99/Sql99DialectTest.java =================================================================== --- artemis/trunk/jiemamy-dialect-sql99/src/test/java/org/jiemamy/dialect/sql99/Sql99DialectTest.java (rev 0) +++ artemis/trunk/jiemamy-dialect-sql99/src/test/java/org/jiemamy/dialect/sql99/Sql99DialectTest.java 2009-03-04 10:33:52 UTC (rev 2810) @@ -0,0 +1,126 @@ +/* + * Copyright 2007-2009 Jiemamy Project and the Others. + * Created on 2009/03/04 + * + * 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.dialect.sql99; + +import static org.hamcrest.CoreMatchers.is; +import static org.hamcrest.CoreMatchers.notNullValue; +import static org.junit.Assert.assertThat; +import static org.junit.Assert.fail; + +import org.junit.After; +import org.junit.Before; +import org.junit.Test; + +import org.jiemamy.dialect.Dialect; +import org.jiemamy.dialect.Dialect.BuiltinDataTypeMold; +import org.jiemamy.model.datatype.DataTypeCategory; + +/** + * {@link Sql99Dialect}のテストクラス。 + * + * @author daisuke + */ +public class Sql99DialectTest { + + private Sql99Dialect dialect; + + + /** + * テストを初期化する。 + * + * @throws Exception 例外が発生した場合 + */ + @Before + public void setUp() throws Exception { + dialect = new Sql99Dialect(); + } + + /** + * テストの情報を破棄する。 + * + * @throws Exception 例外が発生した場合 + */ + @After + public void tearDown() throws Exception { + dialect = null; + } + + /** + * toStringがFQCNを返す。 + * + * @throws Exception 例外が発生した場合 + */ + @Test + public void test01_toStringがFQCNを返す() throws Exception { + assertThat(dialect.toString(), is("org.jiemamy.dialect.sql99.Sql99Dialect")); + } + + /** + * {@code null}を返してはいけないメソッドは{@code null}を返さない。 + * + * @throws Exception 例外が発生した場合 + */ + @Test + public void test02_nullを返してはいけないメソッドはnullを返さない() throws Exception { + assertThat(dialect.getAdvisor(), is(notNullValue())); + assertThat(dialect.getAllDataTypes(), is(notNullValue())); + assertThat(dialect.getDataTypeResolver(), is(notNullValue())); + assertThat(dialect.getValidator(), is(notNullValue())); + } + + /** + * {@link Dialect#findDataTypeMold(DataTypeCategory, String)}のテスト。 + * + * @throws Exception 例外が発生した場合 + */ + @Test + public void test03_findDataTypeMoldのテスト() throws Exception { + // 完全一致な情報を与えると、そのままのモールドが得られる。 + BuiltinDataTypeMold mold = dialect.findDataTypeMold(DataTypeCategory.INTEGER, "INTEGER"); + assertThat(mold.getCategory(), is(DataTypeCategory.INTEGER)); + assertThat(mold.getTypeName(), is("INTEGER")); + + // 適当な情報を与えた場合、型名が一致したモールドが得られる。 + mold = dialect.findDataTypeMold(DataTypeCategory.VARBIT, "INTEGER"); + assertThat(mold.getCategory(), is(DataTypeCategory.INTEGER)); + assertThat(mold.getTypeName(), is("INTEGER")); + + // Oracleっぽい情報を与えても、Postgres用のモールドが得られる。 + mold = dialect.findDataTypeMold(DataTypeCategory.VARCHAR, "VARCHAR2"); + assertThat(mold.getCategory(), is(DataTypeCategory.VARCHAR)); + assertThat(mold.getTypeName(), is("VARCHAR")); + + // 意味不明な情報を与えた場合、カテゴリ内で最初に定義したモールドが得られる。 + mold = dialect.findDataTypeMold(DataTypeCategory.INTEGER, "WONDERFUL"); + assertThat(mold.getCategory(), is(DataTypeCategory.INTEGER)); + assertThat(mold.getTypeName(), is("INTEGER")); + + // 一致するものがまったく見つからない場合、UNKNOWNが得られる。 + mold = dialect.findDataTypeMold(DataTypeCategory.OTHER, "WONDERFUL"); + assertThat(mold, is(BuiltinDataTypeMold.UNKNOWN)); + + try { + dialect.findDataTypeMold(null, null); + fail(); + } catch (IllegalArgumentException e) { + // success + } + } + +} Property changes on: artemis/trunk/jiemamy-dialect-sql99/src/test/java/org/jiemamy/dialect/sql99/Sql99DialectTest.java ___________________________________________________________________ Added: svn:mime-type + text/plain Added: vesta/trunk/jiemamy-vesta/platform_info.target =================================================================== --- vesta/trunk/jiemamy-vesta/platform_info.target (rev 0) +++ vesta/trunk/jiemamy-vesta/platform_info.target 2009-03-04 10:33:52 UTC (rev 2810) @@ -0,0 +1,19 @@ +<?xml version="1.0" encoding="UTF-8"?> +<?pde version="3.2"?> + +<target name="Jiemamy Target Platform"> + + <targetJRE> + <execEnv>J2SE-1.5</execEnv> + </targetJRE> + + <location path="${eclipse_home}../eclipse-jiemamy-target"/> + + <content useAllPlugins="true"> + <plugins> + </plugins> + <features> + </features> + </content> + +</target> Modified: vesta/trunk/org.jiemamy.eclipse/.classpath =================================================================== --- vesta/trunk/org.jiemamy.eclipse/.classpath 2009-03-03 18:33:18 UTC (rev 2809) +++ vesta/trunk/org.jiemamy.eclipse/.classpath 2009-03-04 10:33:52 UTC (rev 2810) @@ -4,7 +4,6 @@ <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 exported="true" kind="lib" path="lib/eclipse-common-0.0.4.jar" sourcepath="lib/sources/eclipse-common-0.0.4-sources.jar"/> <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/> <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"/> Modified: vesta/trunk/org.jiemamy.eclipse/META-INF/MANIFEST.MF =================================================================== --- vesta/trunk/org.jiemamy.eclipse/META-INF/MANIFEST.MF 2009-03-03 18:33:18 UTC (rev 2809) +++ vesta/trunk/org.jiemamy.eclipse/META-INF/MANIFEST.MF 2009-03-04 10:33:52 UTC (rev 2810) @@ -6,7 +6,7 @@ Bundle-Vendor: Jiemamy Project Bundle-RequiredExecutionEnvironment: J2SE-1.5 Bundle-ActivationPolicy: lazy -Bundle-Activator: org.jiemamy.eclipse.JiemamyPlugin +Bundle-Activator: org.jiemamy.eclipse.JiemamyUIPlugin Bundle-ClassPath: ., lib/eclipse-common-0.0.4.jar Require-Bundle: org.eclipse.core.runtime, @@ -32,8 +32,6 @@ org.jiemamy.eclipse.editor.editpolicy, org.jiemamy.eclipse.editor.figure, org.jiemamy.eclipse.editor.utils, - org.jiemamy.eclipse.extension, - org.jiemamy.eclipse.extension.validator, org.jiemamy.eclipse.preference, org.jiemamy.eclipse.ui, org.jiemamy.eclipse.ui.helper, Deleted: vesta/trunk/org.jiemamy.eclipse/license/LICENSE.stax.txt =================================================================== --- vesta/trunk/org.jiemamy.eclipse/license/LICENSE.stax.txt 2009-03-03 18:33:18 UTC (rev 2809) +++ vesta/trunk/org.jiemamy.eclipse/license/LICENSE.stax.txt 2009-03-04 10:33:52 UTC (rev 2810) @@ -1,201 +0,0 @@ - Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - - TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - - 1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - - 2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - - 3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - - 4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - - 5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - - 6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - - 7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - - 8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - - 9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - - END OF TERMS AND CONDITIONS - - APPENDIX: How to apply the Apache License to your work. - - To apply the Apache License to your work, attach the following - boilerplate notice, with the fields enclosed by brackets "[]" - replaced with your own identifying information. (Don't include - the brackets!) The text should be enclosed in the appropriate - comment syntax for the file format. We also recommend that a - file or class name and description of purpose be included on the - same "printed page" as the copyright notice for easier - identification within third-party archives. - - Copyright [yyyy] [name of copyright owner] - - 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. Deleted: vesta/trunk/org.jiemamy.eclipse/license/LICENSE.woodstox.txt =================================================================== --- vesta/trunk/org.jiemamy.eclipse/license/LICENSE.woodstox.txt 2009-03-03 18:33:18 UTC (rev 2809) +++ vesta/trunk/org.jiemamy.eclipse/license/LICENSE.woodstox.txt 2009-03-04 10:33:52 UTC (rev 2810) @@ -1,14 +0,0 @@ -This copy of Woodstox XML processor is licensed under the -Apache (Software) License, version 2.0 ("the License"). -See the License for details about distribution rights, and the -specific rights regarding derivate works. - -You may obtain a copy of the License at: - -http://www.apache.org/licenses/ - -A copy is also included with both the the downloadable source code package -and jar that contains class bytecodes, as file "ASL 2.0". In both cases, -that file should be located next to this file: in source distribution -the location should be "release-notes/asl"; and in jar "META-INF/" - Deleted: vesta/trunk/org.jiemamy.eclipse/license/LICENSE.xstream.txt =================================================================== --- vesta/trunk/org.jiemamy.eclipse/license/LICENSE.xstream.txt 2009-03-03 18:33:18 UTC (rev 2809) +++ vesta/trunk/org.jiemamy.eclipse/license/LICENSE.xstream.txt 2009-03-04 10:33:52 UTC (rev 2810) @@ -1,28 +0,0 @@ -(BSD Style License) - -Copyright (c) 2003-2006, Joe Walnes -Copyright (c) 2006-2007, XStream Committers -All rights reserved. - -Redistribution and use in source and binary forms, with or without -modification, are permitted provided that the following conditions are met: - -Redistributions of source code must retain the above copyright notice, this list of -conditions and the following disclaimer. Redistributions in binary form must reproduce -the above copyright notice, this list of conditions and the following disclaimer in -the documentation and/or other materials provided with the distribution. - -Neither the name of XStream nor the names of its contributors may be used to endorse -or promote products derived from this software without specific prior written -permission. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY -EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES -OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT -SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED -TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR -BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN -CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY -WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH -DAMAGE. Modified: vesta/trunk/org.jiemamy.eclipse/src/main/java/org/jiemamy/eclipse/EclipseDialectProvider.java =================================================================== --- vesta/trunk/org.jiemamy.eclipse/src/main/java/org/jiemamy/eclipse/EclipseDialectProvider.java 2009-03-03 18:33:18 UTC (rev 2809) +++ vesta/trunk/org.jiemamy.eclipse/src/main/java/org/jiemamy/eclipse/EclipseDialectProvider.java 2009-03-04 10:33:52 UTC (rev 2810) @@ -32,9 +32,9 @@ public Dialect getInstance(String fqcn) { try { - return JiemamyPlugin.getDialectResolver().getInstance(fqcn); + return JiemamyCorePlugin.getDialectResolver().getInstance(fqcn); } catch (CoreException e) { - JiemamyPlugin.log(e); + JiemamyUIPlugin.log(e); } return null; } Modified: vesta/trunk/org.jiemamy.eclipse/src/main/java/org/jiemamy/eclipse/EclipseExporterProvider.java =================================================================== --- vesta/trunk/org.jiemamy.eclipse/src/main/java/org/jiemamy/eclipse/EclipseExporterProvider.java 2009-03-03 18:33:18 UTC (rev 2809) +++ vesta/trunk/org.jiemamy.eclipse/src/main/java/org/jiemamy/eclipse/EclipseExporterProvider.java 2009-03-04 10:33:52 UTC (rev 2810) @@ -33,9 +33,9 @@ public Exporter<ExportConfig> getInstance(String fqcn) { try { - return JiemamyPlugin.getExporterResolver().getInstance(fqcn); + return JiemamyCorePlugin.getExporterResolver().getInstance(fqcn); } catch (CoreException e) { - JiemamyPlugin.log(e); + JiemamyUIPlugin.log(e); } return null; } Modified: vesta/trunk/org.jiemamy.eclipse/src/main/java/org/jiemamy/eclipse/EclipseImporterProvider.java =================================================================== --- vesta/trunk/org.jiemamy.eclipse/src/main/java/org/jiemamy/eclipse/EclipseImporterProvider.java 2009-03-03 18:33:18 UTC (rev 2809) +++ vesta/trunk/org.jiemamy.eclipse/src/main/java/org/jiemamy/eclipse/EclipseImporterProvider.java 2009-03-04 10:33:52 UTC (rev 2810) @@ -33,9 +33,9 @@ public Importer<ImportConfig> getInstance(String fqcn) { try { - return JiemamyPlugin.getImporterResolver().getInstance(fqcn); + return JiemamyCorePlugin.getImporterResolver().getInstance(fqcn); } catch (CoreException e) { - JiemamyPlugin.log(e); + JiemamyUIPlugin.log(e); } return null; } Deleted: 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-03-03 18:33:18 UTC (rev 2809) +++ vesta/trunk/org.jiemamy.eclipse/src/main/java/org/jiemamy/eclipse/JiemamyPlugin.java 2009-03-04 10:33:52 UTC (rev 2810) @@ -1,288 +0,0 @@ -/* - * Copyright 2007-2009 Jiemamy Project and the Others. - * Created on 2008/07/15 - * - * 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; - -import java.net.URL; -import java.util.ResourceBundle; - -import org.apache.commons.lang.Validate; -import org.eclipse.core.runtime.CoreException; -import org.eclipse.core.runtime.FileLocator; -import org.eclipse.core.runtime.IPath; -import org.eclipse.core.runtime.IStatus; -import org.eclipse.core.runtime.Path; -import org.eclipse.core.runtime.Status; -import org.eclipse.jface.resource.ImageDescriptor; -import org.eclipse.jface.resource.ImageRegistry; -import org.eclipse.swt.widgets.Display; -import org.eclipse.ui.plugin.AbstractUIPlugin; -import org.osgi.framework.BundleContext; -import org.seasar.eclipse.common.util.ImageManager; -import org.seasar.eclipse.common.util.StatusUtil; - -import org.jiemamy.composer.ExportConfig; -import org.jiemamy.composer.Exporter; -import org.jiemamy.composer.ImportConfig; -import org.jiemamy.composer.Importer; -import org.jiemamy.dialect.Dialect; -import org.jiemamy.eclipse.extension.ExtensionResolver; -import org.jiemamy.eclipse.extension.validator.ModelValidator; -import org.jiemamy.eclipse.preference.JiemamyPreference; -import org.jiemamy.eclipse.preference.JiemamyPreferenceImpl; - -/** - * Jiemamy Eclipse Pluginクラス。 - * - * @author daisuke - */ -public class JiemamyPlugin extends AbstractUIPlugin { - - /** The plug-in ID */ - public static final String PLUGIN_ID = "org.jiemamy.eclipse.ui"; - - /** The plug-in ID */ - public static final String PLUGIN_CORE_ID = "org.jiemamy.eclipse.core"; - - /** アイコンファイルの配置パス */ - private static final String ICONS_PATH = "icons/"; - - /** プラグインクラスのシングルトンインスタンス */ - private static JiemamyPlugin plugin; - - /** 設定 */ - private static JiemamyPreference pref; - - /** 拡張ポイントに設定されたDialectのリゾルバ */ - private static ExtensionResolver<Dialect> dialectResolver; - - /** 拡張ポイントに設定されたImporterのリゾルバ */ - private static ExtensionResolver<Importer<ImportConfig>> importerResolver; - - /** 拡張ポイントに設定されたExporterのリゾルバ */ - private static ExtensionResolver<Exporter<ExportConfig>> exporterResolver; - - /** 拡張ポイントに設定されたModelValidatorのリゾルバ */ - private static ExtensionResolver<ModelValidator> validatorResolver; - - - /** - * Returns the shared instance - * - * @return the shared instance - */ - public static JiemamyPlugin getDefault() { - assert plugin != null; - return plugin; - } - - /** - * 拡張ポイントに設定されたDialectのリゾルバを取得する。 - * @return 拡張ポイントに設定されたDialectのリゾルバ - */ - public static ExtensionResolver<Dialect> getDialectResolver() { - assert dialectResolver != null; - return dialectResolver; - } - - /** - * 拡張ポイントに設定されたExporterのリゾルバを取得する。 - * @return 拡張ポイントに設定されたExporterのリゾルバ - */ - public static ExtensionResolver<Exporter<ExportConfig>> getExporterResolver() { - assert exporterResolver != null; - return exporterResolver; - } - - /** - * Returns an image descriptor for the image file at the given plug-in relative path - * - * @param path the path - * @return the image descriptor - * @throws IllegalArgumentException 引数に{@code null}を与えた場合 - */ - public static ImageDescriptor getImageDescriptor(String path) { - Validate.notNull(path); - return imageDescriptorFromPlugin(PLUGIN_ID, path); - } - - /** - * 拡張ポイントに設定されたImporterのリゾルバを取得する。 - * @return 拡張ポイントに設定されたImporterのリゾルバ - */ - public static ExtensionResolver<Importer<ImportConfig>> getImporterResolver() { - assert importerResolver != null; - return importerResolver; - } - - /** - * 設定を取得する。 - * - * @return 設定 - */ - public static JiemamyPreference getPreference() { - assert pref != null; - return pref; - } - - /** - * 拡張ポイントに設定されたサービスViewのリゾルバを取得する。 - * - * @return 拡張ポイントに設定されたサービスViewのリゾルバ - */ - public static ExtensionResolver<Exporter<ExportConfig>> getServiceViewResolver() { - assert exporterResolver != null; - return exporterResolver; - } - - /** - * 拡張ポイントに設定されたModelValidatorのリゾルバを取得する。 - * @return 拡張ポイントに設定されたModelValidatorのリゾルバ - */ - public static ExtensionResolver<ModelValidator> getValidatorResolver() { - assert validatorResolver != null; - return validatorResolver; - } - - /** - * ログを記録する。ログレベルはINFOとなる。 - * - * @param msg ログメッセージ - */ - public static void log(String msg) { - log(msg, Status.INFO); - } - - /** - * ログを記録する。 - * - * @param msg ログメッセージ - * @param intStatus ステータスコード - */ - public static void log(String msg, int intStatus) { - IStatus status = StatusUtil.create(plugin, intStatus, 0, msg, null); - plugin.getLog().log(status); - } - - /** - * ログを記録する。 - * - * @param throwable 発生した例外等 - */ - public static void log(Throwable throwable) { - IStatus status = null; - if (throwable instanceof CoreException) { - CoreException e = (CoreException) throwable; - status = e.getStatus(); - } else { - status = StatusUtil.createError(plugin, Status.ERROR, throwable); - } - plugin.getLog().log(status); - } - - @Override - public void start(BundleContext context) throws Exception { - super.start(context); - plugin = this; - pref = new JiemamyPreferenceImpl(); - dialectResolver = new ExtensionResolver<Dialect>(PLUGIN_CORE_ID, "dialects", "dialect", "class"); - importerResolver = - new ExtensionResolver<Importer<ImportConfig>>(PLUGIN_CORE_ID, "importers", "importer", "class"); - exporterResolver = - new ExtensionResolver<Exporter<ExportConfig>>(PLUGIN_CORE_ID, "exporters", "exporter", "class"); - validatorResolver = new ExtensionResolver<ModelValidator>(PLUGIN_CORE_ID, "validators", "dialect", "class"); - } - - @Override - public void stop(BundleContext context) throws Exception { - dialectResolver = null; - importerResolver = null; - exporterResolver = null; - validatorResolver = null; - pref = null; - plugin = null; - super.stop(context); - } - - @Override - protected void initializeImageRegistry(ImageRegistry registry) { - // TODO ImageManagerを使用する。 -// Display display = Display.getCurrent(); -// if (display == null) { -// display = new Display(); -// setupImageManager(display); -// } - registerImage(registry, Images.BUTTON_TABLE, "table.gif"); - registerImage(registry, Images.BUTTON_VIEW, "view.gif"); - registerImage(registry, Images.BUTTON_FK, "reference.gif"); - registerImage(registry, Images.BUTTON_INH, "reference.gif"); - - registerImage(registry, Images.LABEL_TABLE, "circledT.gif"); - registerImage(registry, Images.LABEL_VIEW, "circledV.gif"); - - registerImage(registry, Images.ICON_JIEMAMY, "jiemamy.gif"); - registerImage(registry, Images.ICON_TABLE, "table.gif"); - registerImage(registry, Images.ICON_VIEW, "view.gif"); - registerImage(registry, Images.ICON_COLUMN, "column.gif"); -// registerImage(registry, Images.ICON_CONTAINER, ""); - registerImage(registry, Images.ICON_DOMAIN, "circledD.gif"); - registerImage(registry, Images.ICON_PK, "primaryKey.gif"); - registerImage(registry, Images.ICON_FK, "fk.gif"); - registerImage(registry, Images.ICON_INH, "inheritance.gif"); - registerImage(registry, Images.ICON_NULL_DATA, "exclamation.gif"); - registerImage(registry, Images.ICON_COLOR_PALETTE, "palette.gif"); - - registerImage(registry, Images.CHECK_ON, "check_on.gif"); - registerImage(registry, Images.CHECK_OFF, "check_off.gif"); - registerImage(registry, Images.CHECK_DISABLED_ON, "check_disabled_on.gif"); - registerImage(registry, Images.CHECK_DISABLED_OFF, "check_disabled_off.gif"); - registerImage(registry, Images.CHECK_HOVER_ON, "check_hover_on.gif"); - registerImage(registry, Images.CHECK_HOVER_OFF, "check_hover_off.gif"); - } - - /** - * ImageRegistryに指定したファイルの画像を設定する。 - * - * 画像ファイルは icons/ 内に配置する必要がある。 - * - * @param registry 追加対象のImageRegistry - * @param key キー - * @param fileName ファイル名 - */ - private void registerImage(ImageRegistry registry, String key, String fileName) { - IPath path = new Path(ICONS_PATH + fileName); - URL url = FileLocator.find(getBundle(), path, null); - - if (url != null) { - registry.put(key, ImageDescriptor.createFromURL(url)); - } - } - - /** - * TODO for daisuke - * - * @param display - */ - @SuppressWarnings("unused") - private void setupImageManager(Display display) { - ImageManager.init(display); - ResourceBundle imageBundle = ResourceBundle.getBundle("org.jiemamy.eclipse.images"); - ImageManager.loadImages(imageBundle); - // TODO ImageManagerのdispose - } -} Copied: vesta/trunk/org.jiemamy.eclipse/src/main/java/org/jiemamy/eclipse/JiemamyUIPlugin.java (from rev 2809, vesta/trunk/org.jiemamy.eclipse/src/main/java/org/jiemamy/eclipse/JiemamyPlugin.java) =================================================================== --- vesta/trunk/org.jiemamy.eclipse/src/main/java/org/jiemamy/eclipse/JiemamyUIPlugin.java (rev 0) +++ vesta/trunk/org.jiemamy.eclipse/src/main/java/org/jiemamy/eclipse/JiemamyUIPlugin.java 2009-03-04 10:33:52 UTC (rev 2810) @@ -0,0 +1,210 @@ +/* + * Copyright 2007-2009 Jiemamy Project and the Others. + * Created on 2008/07/15 + * + * 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; + +import java.net.URL; +import java.util.ResourceBundle; + +import org.apache.commons.lang.Validate; +import org.eclipse.core.runtime.CoreException; +import org.eclipse.core.runtime.FileLocator; +import org.eclipse.core.runtime.IPath; +import org.eclipse.core.runtime.IStatus; +import org.eclipse.core.runtime.Path; +import org.eclipse.core.runtime.Status; +import org.eclipse.jface.resource.ImageDescriptor; +import org.eclipse.jface.resource.ImageRegistry; +import org.eclipse.swt.widgets.Display; +import org.eclipse.ui.plugin.AbstractUIPlugin; +import org.osgi.framework.BundleContext; +import org.seasar.eclipse.common.util.ImageManager; +import org.seasar.eclipse.common.util.StatusUtil; + +import org.jiemamy.eclipse.preference.JiemamyPreference; +import org.jiemamy.eclipse.preference.JiemamyPreferenceImpl; + +/** + * Jiemamy Eclipse Core PluginのActivatorクラス。 + * + * @author daisuke + */ +public class JiemamyUIPlugin extends AbstractUIPlugin { + + /** The plug-in ID */ + public static final String PLUGIN_ID = "org.jiemamy.eclipse.ui"; + + /** アイコンファイルの配置パス */ + private static final String ICONS_PATH = "icons/"; + + /** プラグインクラスのシングルトンインスタンス */ + private static JiemamyUIPlugin plugin; + + /** 設定 */ + private static JiemamyPreference pref; + + + /** + * Returns the shared instance + * + * @return the shared instance + */ + public static JiemamyUIPlugin getDefault() { + assert plugin != null; + return plugin; + } + + /** + * Returns an image descriptor for the image file at the given plug-in relative path + * + * @param path the path + * @return the image descriptor + * @throws IllegalArgumentException 引数に{@code null}を与えた場合 + */ + public static ImageDescriptor getImageDescriptor(String path) { + Validate.notNull(path); + return imageDescriptorFromPlugin(PLUGIN_ID, path); + } + + /** + * 設定を取得する。 + * + * @return 設定 + */ + public static JiemamyPreference getPreference() { + assert pref != null; + return pref; + } + + /** + * ログを記録する。ログレベルはINFOとなる。 + * + * @param msg ログメッセージ + */ + public static void log(String msg) { + log(msg, Status.INFO); + } + + /** + * ログを記録する。 + * + * @param msg ログメッセージ + * @param intStatus ステータスコード + */ + public static void log(String msg, int intStatus) { + IStatus status = StatusUtil.create(plugin, intStatus, 0, msg, null); + plugin.getLog().log(status); + } + + /** + * ログを記録する。 + * + * @param throwable 発生した例外等 + */ + public static void log(Throwable throwable) { + IStatus status = null; + if (throwable instanceof CoreException) { + CoreException e = (CoreException) throwable; + status = e.getStatus(); + } else { + status = StatusUtil.createError(plugin, Status.ERROR, throwable); + } + plugin.getLog().log(status); + } + + @Override + public void start(BundleContext context) throws Exception { + super.start(context); + plugin = this; + pref = new JiemamyPreferenceImpl(); + } + + @Override + public void stop(BundleContext context) throws Exception { + pref = null; + plugin = null; + super.stop(context); + } + + @Override + protected void initializeImageRegistry(ImageRegistry registry) { + // TODO ImageManagerを使用する。 +// Display display = Display.getCurrent(); +// if (display == null) { +// display = new Display(); +// setupImageManager(display); +// } + registerImage(registry, Images.BUTTON_TABLE, "table.gif"); + registerImage(registry, Images.BUTTON_VIEW, "view.gif"); + registerImage(registry, Images.BUTTON_FK, "reference.gif"); + registerImage(registry, Images.BUTTON_INH, "reference.gif"); + + registerImage(registry, Images.LABEL_TABLE, "circledT.gif"); + registerImage(registry, Images.LABEL_VIEW, "circledV.gif"); + + registerImage(registry, Images.ICON_JIEMAMY, "jiemamy.gif"); + registerImage(registry, Images.ICON_TABLE, "table.gif"); + registerImage(registry, Images.ICON_VIEW, "view.gif"); + registerImage(registry, Images.ICON_COLUMN, "column.gif"); +// registerImage(registry, Images.ICON_CONTAINER, ""); + registerImage(registry, Images.ICON_DOMAIN, "circledD.gif"); + registerImage(registry, Images.ICON_PK, "primaryKey.gif"); + registerImage(registry, Images.ICON_FK, "fk.gif"); + registerImage(registry, Images.ICON_INH, "inheritance.gif"); + registerImage(registry, Images.ICON_NULL_DATA, "exclamation.gif"); + registerImage(registry, Images.ICON_COLOR_PALETTE, "palette.gif"); + + registerImage(registry, Images.CHECK_ON, "check_on.gif"); + registerImage(registry, Images.CHECK_OFF, "check_off.gif"); + registerImage(registry, Images.CHECK_DISABLED_ON, "check_disabled_on.gif"); + registerImage(registry, Images.CHECK_DISABLED_OFF, "check_disabled_off.gif"); + registerImage(registry, Images.CHECK_HOVER_ON, "check_hover_on.gif"); + registerImage(registry, Images.CHECK_HOVER_OFF, "check_hover_off.gif"); + } + + /** + * ImageRegistryに指定したファイルの画像を設定する。 + * + * 画像ファイルは icons/ 内に配置する必要がある。 + * + * @param registry 追加対象のImageRegistry + * @param key キー + * @param fileName ファイル名 + */ + private void registerImage(ImageRegistry registry, String key, String fileName) { + IPath path = new Path(ICONS_PATH + fileName); + URL url = FileLocator.find(getBundle(), path, null); + + if (url != null) { + registry.put(key, ImageDescriptor.createFromURL(url)); + } + } + + /** + * TODO for daisuke + * + * @param display + */ + @SuppressWarnings("unused") + private void setupImageManager(Display display) { + ImageManager.init(display); + ResourceBundle imageBundle = ResourceBundle.getBundle("org.jiemamy.eclipse.images"); + ImageManager.loadImages(imageBundle); + // TODO ImageManagerのdispose + } +} Property changes on: vesta/trunk/org.jiemamy.eclipse/src/main/java/org/jiemamy/eclipse/JiemamyUIPlugin.java ___________________________________________________________________ Added: svn:mime-type + text/plain Modified: 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/composer/SqlExportWizard.java 2009-03-03 18:33:18 UTC (rev 2809) +++ vesta/trunk/org.jiemamy.eclipse/src/main/java/org/jiemamy/eclipse/composer/SqlExportWizard.java 2009-03-04 10:33:52 UTC (rev 2810) @@ -30,7 +30,7 @@ import org.jiemamy.composer.exporter.DefaultSqlExportConfig; import org.jiemamy.composer.exporter.SqlExportConfig; import org.jiemamy.composer.exporter.SqlExporter; -import org.jiemamy.eclipse.JiemamyPlugin; +import org.jiemamy.eclipse.JiemamyUIPlugin; import org.jiemamy.eclipse.ui.ExporterWizard; /** @@ -51,7 +51,7 @@ * Creates a wizard for exporting SQL to the local file system. */ public SqlExportWizard() { - IDialogSettings workbenchSettings = JiemamyPlugin.getDefault().getDialogSettings(); + IDialogSettings workbenchSettings = JiemamyUIPlugin.getDefault().getDialogSettings(); IDialogSettings section = workbenchSettings.getSection("ExportWizard"); // $NON-NLS-1$ if (section == null) { section = workbenchSettings.addNewSection("ExportWizard"); // $NON-NLS-1$ 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-03-03 18:33:18 UTC (rev 2809) +++ vesta/trunk/org.jiemamy.eclipse/src/main/java/org/jiemamy/eclipse/editor/DiagramEditorContextMenuProvider.java 2009-03-04 10:33:52 UTC (rev 2810) @@ -37,7 +37,8 @@ import org.jiemamy.composer.Exporter; import org.jiemamy.composer.ImportConfig; import org.jiemamy.composer.Importer; -import org.jiemamy.eclipse.JiemamyPlugin; +import org.jiemamy.eclipse.JiemamyCorePlugin; +import org.jiemamy.eclipse.JiemamyUIPlugin; import org.jiemamy.eclipse.action.AutoLayoutAction; import org.jiemamy.eclipse.action.ChangeNodeBackgroundColorAction; import org.jiemamy.eclipse.action.ExportAction; @@ -113,7 +114,7 @@ menu.appendToGroup(GEFActionConstants.GROUP_EDIT, new AutoLayoutAction(viewer)); Collection<IConfigurationElement> importerElements = - JiemamyPlugin.getImporterResolver().getExtensionConfigurationElements().values(); + JiemamyCorePlugin.getImporterResolver().getExtensionConfigurationElements().values(); if (importerElements.size() > 0) { MenuManager importMenu = new MenuManager("インポート(&I)"); // RESOURCE for (IConfigurationElement importerElement : importerElements) { @@ -127,14 +128,14 @@ .createExecutableExtension("wizard"); importMenu.add(new ImportAction(importer, wizard, viewer, editorPart)); } catch (CoreException e) { - JiemamyPlugin.log(e); + JiemamyUIPlugin.log(e); } } menu.add(importMenu); } Collection<IConfigurationElement> exporterElements = - JiemamyPlugin.getExporterResolver().getExtensionConfigurationElements().values(); + JiemamyCorePlugin.getExporterResolver().getExtensionConfigurationElements().values(); if (exporterElements.size() > 0) { MenuManager exportMenu = new MenuManager("エクスポート(&E)"); // RESOURCE for (IConfigurationElement exporterElement : exporterElements) { @@ -148,7 +149,7 @@ .createExecutableExtension("wizard"); exportMenu.add(new ExportAction(exporter, wizard, viewer, editorPart)); } catch (CoreException e) { - JiemamyPlugin.log(e); + JiemamyUIPlugin.log(e); } } menu.add(exportMenu); Modified: vesta/trunk/org.jiemamy.eclipse/src/main/java/org/jiemamy/eclipse/editor/DiagramEditorPaletteFactory.java =================================================================== --- vesta/trunk/org.jiemamy.eclipse/src/main/java/org/jiemamy/eclipse/editor/DiagramEditorPaletteFactory.java 2009-03-03 18:33:18 UTC (rev 2809) +++ vesta/trunk/org.jiemamy.eclipse/src/main/java/org/jiemamy/eclipse/editor/DiagramEditorPaletteFactory.java 2009-03-04 10:33:52 UTC (rev 2810) @@ -32,7 +32,7 @@ import org.eclipse.jface.resource.ImageRegistry; import org.jiemamy.eclipse.Images; -import org.jiemamy.eclipse.JiemamyPlugin; +import org.jiemamy.eclipse.JiemamyUIPlugin; import org.jiemamy.eclipse.utils.EditorUtil; import org.jiemamy.model.JiemamyElement; import org.jiemamy.model.RootModel; @@ -48,7 +48,7 @@ */ public final class DiagramEditorPaletteFactory { - private static ImageRegistry imageRegistry = JiemamyPlugin.getDefault().getImageRegistry(); + private static ImageRegistry imageRegistry = JiemamyUIPlugin.getDefault().getImageRegistry(); /** Modified: vesta/trunk/org.jiemamy.eclipse/src/main/java/org/jiemamy/eclipse/editor/JmContributor.java =================================================================== --- vesta/trunk/org.jiemamy.eclipse/src/main/java/org/jiemamy/eclipse/editor/JmContributor.java 2009-03-03 18:33:18 UTC (rev 2809) +++ vesta/trunk/org.jiemamy.eclipse/src/main/java/org/jiemamy/eclipse/editor/JmContributor.java 2009-03-04 10:33:52 UTC (rev 2810) @@ -55,7 +55,7 @@ import org.slf4j.LoggerFactory; import org.jiemamy.Migration; -import org.jiemamy.eclipse.JiemamyPlugin; +import org.jiemamy.eclipse.JiemamyUIPlugin; import org.jiemamy.eclipse.utils.EditorUtil; import org.jiemamy.eclipse.utils.ExceptionHandler; import org.jiemamy.model.DiagramPresentationModel; @@ -181,7 +181,7 @@ VersionedIdentifier frsVi = frs[frs.length - 1].getVersionedIdentifier(); org.eclipse.core.runtime.PluginVersionIdentifier latestVer = frsVi.getVersion(); - Bundle bundle = JiemamyPlugin.getDefault().getBundle(); + Bundle bundle = JiemamyUIPlugin.getDefault().getBundle(); String version = (String) bundle.getHeaders().get(org.osgi.framework.Constants.BUNDLE_VERSION); org.eclipse.core.runtime.PluginVersionIdentifier currentVer = new org.eclipse.core.runtime.PluginVersionIdentifier(version); @@ -191,7 +191,7 @@ label.setText("New version is available."); // RESOURCE } } catch (CoreException e) { - LogUtil.log(JiemamyPlugin.getDefault(), "Network is not connected."); + LogUtil.log(JiemamyUIPlugin.getDefault(), "Network is not connected."); } catch (MalformedURLException e) { ExceptionHandler.handleException(e); } Modified: vesta/trunk/org.jiemamy.eclipse/src/main/java/org/jiemamy/eclipse/editor/command/CreateConnectionCommand.java =================================================================== --- vesta/trunk/org.jiemamy.eclipse/src/main/java/org/jiemamy/eclipse/editor/command/CreateConnectionCommand.java 2009-03-03 18:33:18 UTC (rev 2809) +++ vesta/trunk/org.jiemamy.eclipse/src/main/java/org/jiemamy/eclipse/editor/command/CreateConnectionCommand.java 2009-03-04 10:33:52 UTC (rev 2810) @@ -28,7 +28,7 @@ import org.jiemamy.JiemamyFactory; import org.jiemamy.Migration; import org.jiemamy.ReferenceResolver; -import org.jiemamy.eclipse.JiemamyPlugin; +import org.jiemamy.eclipse.JiemamyUIPlugin; import org.jiemamy.exception.ElementNotFoundException; import org.jiemamy.facade.JiemamyViewFacadeImpl; import org.jiemamy.model.ConnectionProfile; @@ -87,25 +87,25 @@ // Viewとはコネクションが貼れない if (source.unwrap() instanceof ViewModel || target.unwrap() instanceof ViewModel) { - LogUtil.log(JiemamyPlugin.getDefault(), "attempt to connect with VIEW"); // RESOURCE + LogUtil.log(JiemamyUIPlugin.getDefault(), "attempt to connect with VIEW"); // RESOURCE return false; } // 現状、付箋とはコネクションが貼れない if (source.unwrap() instanceof StickyModel || target.unwrap() instanceof StickyModel) { - LogUtil.log(JiemamyPlugin.getDefault(), "attempt to connect with STICKY"); // RESOURCE + LogUtil.log(JiemamyUIPlugin.getDefault(), "attempt to connect with STICKY"); // RESOURCE return false; } // カラムが1つもないテーブルからは外部キーが貼れない if (TableUtil.getColumns((TableModel) source.unwrap()).size() < 1) { - LogUtil.log(JiemamyPlugin.getDefault(), "attempt to connect from TABLE without columns"); // RESOURCE + LogUtil.log(JiemamyUIPlugin.getDefault(), "attempt to connect from TABLE without columns"); // RESOURCE return false; } // ローカルキーが1つもないテーブルへは外部キーが貼れない if (getKey((TableModel) target.unwrap()) == null) { - LogUtil.log(JiemamyPlugin.getDefault(), "attempt to connect to TABLE without local keys"); // RESOURCE + LogUtil.log(JiemamyUIPlugin.getDefault(), "attempt to connect to TABLE without local keys"); // RESOURCE return false; } Modified: vesta/trunk/org.jiemamy.eclipse/src/main/java/org/jiemamy/eclipse/editor/command/DirectEditNodeCommand.java =================================================================== --- vesta/trunk/org.jiemamy.eclipse/src/main/java/org/jiemamy/eclipse/editor/command/DirectEditNodeCommand.java 2009-03-03 18:33:18 UTC (rev 2809) +++ vesta/trunk/org.jiemamy.eclipse/src/main/java/org/jiemamy/eclipse/editor/command/DirectEditNodeCommand.java 2009-03-04 10:33:52 UTC (rev 2810) @@ -25,7 +25,7 @@ import org.jiemamy.JiemamyProperty.EntityProperty; import org.jiemamy.JiemamyViewProperty.StickyProperty; -import org.jiemamy.eclipse.JiemamyPlugin; +import org.jiemamy.eclipse.JiemamyUIPlugin; import org.jiemamy.eclipse.editor.DisplayStatus; import org.jiemamy.exception.IllegalImplementationException; import org.jiemamy.facade.JiemamyViewFacadeImpl; @@ -71,7 +71,7 @@ } else if (displayStatus.getMode() == Mode.LOGICAL) { jiemamyFacade.changeModelProperty(entityModel, EntityProperty.logicalName, newValue); } else { - JiemamyPlugin.log("想定外のenum要素", Status.ERROR); + JiemamyUIPlugin.log("想定外のenum要素", Status.ERROR); } } else if (nodeAdapter instanceof StickyModel) { StickyModel stickyModel = (StickyModel) nodeAdapter; @@ -118,7 +118,7 @@ } else if (displayStatus.getMode() == Mode.LOGICAL) { jiemamyFacade.undo(); } else { - JiemamyPlugin.log("想定外のenum要素", Status.ERROR); + JiemamyUIPlugin.log("想定外のenum要素", Status.ERROR); } } else if (nodeAdapter instanceof StickyModel) { jiemamyFacade.undo(); Modified: vesta/trunk/org.jiemamy.eclipse/src/main/java/org/jiemamy/eclipse/editor/dialog/root/RootEditDialog.java =================================================================== --- vesta/trunk/org.jiemamy.eclipse/src/main/java/org/jiemamy/eclipse/editor/dialog/root/RootEditDialog.java 2009-03-03 18:33:18 UTC (rev 2809) +++ vesta/trunk/org.jiemamy.eclipse/src/main/java/org/jiemamy/eclipse/editor/dialog/root/RootEditDialog.java 2009-03-04 10:33:52 UTC (rev 2810) @@ -35,7 +35,7 @@ import org.slf4j.LoggerFactory; import org.jiemamy.dialect.Dialect; -import org.jiemamy.eclipse.JiemamyPlugin; +import org.jiemamy.eclipse.JiemamyCorePlugin; import org.jiemamy.eclipse.ui.JiemamyEditDialog; import org.jiemamy.eclipse.ui.helper.TextSelectionAdapter; import org.jiemamy.eclipse.ui.tab.TextEditTab; @@ -115,7 +115,7 @@ cmbDialect = new Combo(composite, SWT.BORDER | SWT.READ_ONLY); cmbDialect.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); - List<Dialect> dialects = JiemamyPlugin.getDialectResolver().getAllInstance(); + List<Dialect> dialects = JiemamyCorePlugin.getDialectResolver().getAllInstance(); for (Dialect dialect : dialects) { cmbDialect.add(dialect.toString()); logger.debug("installed Dialect: " + dialect.toString()); Modified: vesta/trunk/org.jiemamy.eclipse/src/main/java/org/jiemamy/eclipse/editor/dialog/root/RootEditDialogDomainTab.java =================================================================== --- vesta/trunk/org.jiemamy.eclipse/src/main/java/org/jiemamy/eclipse/editor/dialog/root/RootEditDialogDomainTab.java 2009-03-03 18:33:18 UTC (rev 2809) +++ vesta/trunk/org.jiemamy.eclipse/src/main/java/org/jiemamy/eclipse/editor/dialog/root/RootEditDialogDomainTab.java 2009-03-04 10:33:52 UTC (rev 2810) @@ -55,7 +55,8 @@ import org.jiemamy.dialect.Dialect; import org.jiemamy.dialect.Dialect.BuiltinDataTypeMold; import org.jiemamy.eclipse.Images; -import org.jiemamy.eclipse.JiemamyPlugin; +import org.jiemamy.eclipse.JiemamyCorePlugin; +import org.jiemamy.eclipse.JiemamyUIPlugin; import org.jiemamy.eclipse.editor.DisplayPlace; import org.jiemamy.eclipse.editor.utils.LabelStringUtil; import org.jiemamy.eclipse.ui.AbstractTableEditor; @@ -111,7 +112,7 @@ dialect = RootModelUtil.getDialect(rootModel); } catch (ClassNotFoundException e) { // TODO DefaultDialectをセットするように変更。 - dialect = JiemamyPlugin.getDialectResolver().getAllInstance().get(0); + dialect = JiemamyCorePlugin.getDialectResolver().getAllInstance().get(0); } allTypes = CollectionsUtil.newArrayList(rootModel.getDomains().size() + dialect.getAllDataTypes().size()); @@ -210,7 +211,7 @@ private class DomainLabelProvider extends BaseLabelProvider implements ITableLabelProvider { public Image getColumnImage(Object element, int columnIndex) { - ImageRegistry ir = JiemamyPlugin.getDefault().getImageRegistry(); + ImageRegistry ir = JiemamyUIPlugin.getDefault().getImageRegistry(); DomainModel domain = (DomainModel) element; if (columnIndex == 2) { @@ -274,7 +275,7 @@ dialect = RootModelUtil.getDialect(rootModel.getJiemamy().getFactory().getRootModel()); } catch (ClassNotFoundException e) { // THINK どうにか。。。w - dialect = JiemamyPlugin.getDialectResolver().getAllInstance().get(0); + dialect = JiemamyCorePlugin.getDialectResolver().getAllInstance().get(0); } assert jiemamy != null; Modified: vesta/trunk/org.jiemamy.eclipse/src/main/java/org/jiemamy/eclipse/editor/dialog/sticky/StickyEditDialog.java =================================================================== --- vesta/trunk/org.jiemamy.eclipse/src/main/java/org/jiemamy/eclipse/editor/dialog/sticky/StickyEditDialog.java 2009-03-03 18:33:18 UTC (rev 2809) +++ vesta/trunk/org.jiemamy.eclipse/src/main/java/org/jiemamy/eclipse/editor/dialog/sticky/StickyEditDialog.java 2009-03-04 10:33:52 UTC (rev 2810) @@ -34,7 +34,7 @@ import org.eclipse.swt.widgets.TabFolder; import org.jiemamy.eclipse.Images; -import org.jiemamy.eclipse.JiemamyPlugin; +import org.jiemamy.eclipse.JiemamyUIPlugin; import org.jiemamy.eclipse.ui.JiemamyEditDialog; import org.jiemamy.eclipse.ui.tab.TextEditTab; import org.jiemamy.model.node.StickyModel; @@ -77,7 +77,7 @@ composite.setLayout(new GridLayout(6, false)); // ---- A-1. 色 - ImageRegistry ir = JiemamyPlugin.getDefault().getImageRegistry(); + ImageRegistry ir = JiemamyUIPlugin.getDefault().getImageRegistry(); Button btnColor = new Button(composite, SWT.PUSH); btnColor.setImage(ir.get(Images.ICON_COLOR_PALETTE)); Modified: vesta/trunk/org.jiemamy.eclipse/src/main/java/org/jiemamy/eclipse/editor/dialog/table/TableEditDialog.java =================================================================== --- vesta/trunk/org.jiemamy.eclipse/src/main/java/org/jiemamy/eclipse/editor/dialog/table/TableEditDialog.java 2009-03-03 18:33:18 UTC (rev 2809) +++ vesta/trunk/org.jiemamy.eclipse/src/main/java/org/jiemamy/eclipse/editor/dialog/table/TableEditDialog.java 2009-03-04 10:33:52 UTC (rev 2810) @@ -41,7 +41,7 @@ import org.eclipse.swt.widgets.Text; import org.jiemamy.eclipse.Images; -import org.jiemamy.eclipse.JiemamyPlugin; +import org.jiemamy.eclipse.JiemamyUIPlugin; import org.jiemamy.eclipse.ui.JiemamyEditDialog; import org.jiemamy.eclipse.ui.helper.TextSelectionAdapter; import org.jiemamy.eclipse.ui.tab.TextEditTab; @@ -154,7 +154,7 @@ txtLogicalName.addFocusListener(new TextSelectionAdapter(txtLogicalName)); // ---- A-3. 色 - ImageRegistry ir = JiemamyPlugin.getDefault().getImageRegistry(); + ImageRegistry ir = JiemamyUIPlugin.getDefault().getImageRegistry(); Button btnColor = new Button(composite, SWT.PUSH); btnColor.setImage(ir.get(Images.ICON_COLOR_PALETTE)); Modified: vesta/trunk/org.jiemamy.eclipse/src/main/java/org/jiemamy/eclipse/editor/dialog/table/TableEditDialogColumnTab.java =================================================================== --- vesta/trunk/org.jiemamy.eclipse/src/main/java/org/jiemamy/eclipse/editor/dialog/table/TableEditDialogColumnTab.java 2009-03-03 18:33:18 UTC (rev 2809) +++ vesta/trunk/org.jiemamy.eclipse/src/main/java/org/jiemamy/eclipse/editor/dialog/table/TableEditDialogColumnTab.java 2009-03-04 10:33:52 UTC (rev 2810) @@ -56,7 +56,8 @@ import org.jiemamy.dialect.Dialect; import org.jiemamy.dialect.Dialect.BuiltinDataTypeMold; import org.jiemamy.eclipse.Images; -import org.jiemamy.eclipse.JiemamyPlugin; +import org.jiemamy.eclipse.JiemamyCorePlugin; +import org.jiemamy.eclipse.JiemamyUIPlugin; import org.jiemamy.eclipse.editor.DisplayPlace; import org.jiemamy.eclipse.editor.utils.LabelStringUtil; import org.jiemamy.eclipse.ui.AbstractTableEditor; @@ -122,7 +123,7 @@ dialect = RootModelUtil.getDialect(rootModel); } catch (ClassNotFoundException e) { // TODO DefaultDialectをセットするように変更。 - dialect = JiemamyPlugin.getDialectResolver().getAllInstance().get(0); + dialect = JiemamyCorePlugin.getDialectResolver().getAllInstance().get(0); } allTypes = CollectionsUtil.newArrayList(rootModel.getDomains().size() + dialect.getAllDataTypes().size()); @@ -222,7 +223,7 @@ private class ColumnLabelProvider extends BaseLabelProvider implements ITableLabelProvider { public Image getColumnImage(Object element, int columnIndex) { - ImageRegistry ir = JiemamyPlugin.getDefault().getImageRegistry(); + ImageRegistry ir = JiemamyUIPlugin.getDefault().getImageRegistry(); ColumnModel column = (ColumnModel) element; switch (columnIndex) { @@ -313,7 +314,7 @@ dialect = RootModelUtil.getDialect(rootModel.getJiemamy().getFactory().getRootModel()); } catch (ClassNotFoundException e) { // THINK どうにか。。。w - dialect = JiemamyPlugin.getDialectResolver().getAllInstance().get(0); + dialect = JiemamyCorePlugin.getDialectResolver().getAllInstance().get(0); } assert jiemamy != null; Modified: vesta/trunk/org.jiemamy.eclipse/src/main/java/org/jiemamy/eclipse/editor/dialog/table/TableEditDialogLocalKeyTab.java =================================================================== --- vesta/trunk/org.jiemamy.eclipse/src/main/java/org/jiemamy/eclipse/editor/dialog/table/TableEditDialogLocalKeyTab.java 2009-03-03 18:33:18 UTC (rev 2809) +++ vesta/trunk/org.jiemamy.eclipse/src/main/java/org/jiemamy/eclipse/editor/dialog/table/TableEditDialogLocalKeyTab.java 2009-03-04 10:33:52 UTC (rev 2810) @@ -52,7 +52,7 @@ import org.jiemamy.JiemamyFactory; import org.jiemamy.ReferenceResolver; import org.jiemamy.eclipse.Images; -import org.jiemamy.eclipse.JiemamyPlugin; +import org.jiemamy.eclipse.JiemamyUIPlugin; import org.jiemamy.eclipse.ui.AbstractTableEditor; import org.jiemamy.eclipse.ui.DefaultTableEditorConfigurator; import org.jiemamy.eclipse.ui.helper.TextSelectionAdapter; @@ -202,7 +202,7 @@ public Image getColumnImage(Object element, int columnIndex) { LocalKeyModel localKeyModel = (LocalKeyModel) element; if (columnIndex == 0 && localKeyModel instanceof PrimaryKeyModel) { - ImageRegistry ir = JiemamyPlugin.getDefault().getImageRegistry(); + ImageRegistry ir = JiemamyUIPlugin.getDefault().getImageRegistry(); return ir.get(Images.ICON_PK); } else { return null; Modified: vesta/trunk/org.jiemamy.eclipse/src/main/java/org/jiemamy/eclipse/editor/dialog/view/ViewEditDialog.java =================================================================== --- vesta/trunk/org.jiemamy.eclipse/src/main/java/org/jiemamy/eclipse/editor/dialog/view/ViewEditDialog.java 2009-03-03 18:33:18 UTC (rev 2809) +++ vesta/trunk/org.jiemamy.eclipse/src/main/java/org/jiemamy/eclipse/editor/dialog/view/ViewEditDialog.java 2009-03-04 10:33:52 UTC (rev 2810) @@ -36,7 +36,7 @@ import org.eclipse.swt.widgets.Text; import org.jiemamy.eclipse.Images; -import org.jiemamy.eclipse.JiemamyPlugin; +import org.jiemamy.eclipse.JiemamyUIPlugin; import org.jiemamy.eclipse.ui.JiemamyEditDialog; import org.jiemamy.eclipse.ui.helper.TextSelectionAdapter; import org.jiemamy.eclipse.ui.tab.TextEditTab; @@ -119,7 +119,7 @@ txtLogicalName.addFocusListener(new TextSelectionAdapter(txtLogicalName)); // ---- A-3. 色 - ImageRegistry ir = JiemamyPlugin.getDefault().getImageRegistry(); + ImageRegistry ir = JiemamyUIPlugin.getDefault().getImageRegistry(); Button btnColor = new Button(composite, SWT.PUSH); btnColor.setImage(ir.get(Images.ICON_COLOR_PALETTE)); Modified: vesta/trunk/org.jiemamy.eclipse/src/main/java/org/jiemamy/eclipse/editor/editpart/DiagramEditPartFactory.java =================================================================== --- vesta/trunk/org.jiemamy.eclipse/src/main/java/org/jiemamy/eclipse/editor/editpart/DiagramEditPartFactory.java 2009-03-03 18:33:18 UTC (rev 2809) +++ vesta/trunk/org.jiemamy.eclipse/src/main/java/org/jiemamy/eclipse/editor/editpart/DiagramEditPartFactory.java 2009-03-04 10:33:52 UTC (rev 2810) @@ -24,7 +24,7 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import org.jiemamy.eclipse.JiemamyPlugin; +import org.jiemamy.eclipse.JiemamyUIPlugin; import org.jiemamy.eclipse.editor.editpart.diagram.ForeignKeyEditPart; import org.jiemamy.eclipse.editor.editpart.diagram.RootEditPart; import org.jiemamy.eclipse.editor.editpart.diagram.StickyEditPart; @@ -67,10 +67,10 @@ if (nodeAdapter instanceof StickyModel) { part = new StickyEditPart((StickyModel) nodeAdapter); } else { - JiemamyPlugin.log("unknown node: " + model.getClass().getName(), Status.ERROR); + JiemamyUIPlugin.log("unknown node: " + model.getClass().getName(), Status.ERROR); } } else { - JiemamyPlugin.log("unknown entity: " + model.getClass().getName(), Status.ERROR); + JiemamyUIPlugin.log("unknown entity: " + model.getClass().getName(), Status.ERROR); } } else if (model instanceof ConnectionAdapter) { ConnectionAdapter connectionAdapter = (ConnectionAdapter) model; @@ -78,14 +78,14 @@ if (foreignKeyModel != null) { part = new ForeignKeyEditPart(connectionAdapter); } else { - JiemamyPlugin.log("unknown connection: " + model.getClass().getName(), Status.ERROR); + JiemamyUIPlugin.log("unknown connection: " + model.getClass().getName(), Status.ERROR); } } else { - JiemamyPlugin.log("unknown model: " + model.getClass().getName(), Status.ERROR); + JiemamyUIPlugin.log("unknown model: " + model.getClass().getName(), Status.ERROR); } if (part == null) { - JiemamyPlugin.log("Cannot create EditPart for unknown model.", Status.ERROR); + JiemamyUIPlugin.log("Cannot create EditPart for unknown model.", Status.ERROR); } return part; Modified: vesta/trunk/org.jiemamy.eclipse/src/main/java/org/jiemamy/eclipse/editor/editpart/OutlineTreeEditPartFactory.java =================================================================== --- vesta/trunk/org.jiemamy.eclipse/src/main/java/org/jiemamy/eclipse/editor/editpart/OutlineTreeEditPartFactory.java 2009-03-03 18:33:18 UTC (rev 2809) +++ vesta/trunk/org.jiemamy.eclipse/src/main/java/org/jiemamy/eclipse/editor/editpart/OutlineTreeEditPartFactory.java 2009-03-04 10:33:52 UTC (rev 2810) @@ -22,7 +22,7 @@ import org.eclipse.gef.EditPart; import org.eclipse.gef.EditPartFactory; -import org.jiemamy.eclipse.JiemamyPlugin; +import org.jiemamy.eclipse.JiemamyUIPlugin; import org.jiemamy.eclipse.editor.ModelContainer; import org.jiemamy.eclipse.editor.editpart.outlinetree.AttributeTreeEditPart; import org.jiemamy.eclipse.editor.editpart.outlinetree.DomainTreeEditPart; @@ -65,7 +65,7 @@ ViewModel viewModel = (ViewModel) model; part = new ViewTreeEditPart(viewModel); } else { - JiemamyPlugin.log("unknown model: " + model.getClass().getName(), Status.ERROR); + JiemamyUIPlugin.log("unknown model: " + model.getClass().getName(), Status.ERROR); } return part; Modified: vesta/trunk/org.jiemamy.eclipse/src/main/java/org/jiemamy/eclipse/editor/editpart/diagram/RootEditPart.java =================================================================== --- vesta/trunk/org.jiemamy.eclipse/src/main/java/org/jiemamy/eclipse/editor/editpart/diagram/RootEditPart.java 2009-03-03 18:33:18 UTC (rev 2809) +++ vesta/trunk/org.jiemamy.eclipse/src/main/java/org/jiemamy/eclipse/editor/editpart/diagram/RootEditPart.java 2009-03-04 10:33:52 UTC (rev 2810) @@ -37,7 +37,7 @@ import org.slf4j.LoggerFactory; import org.jiemamy.Migration; -import org.jiemamy.eclipse.JiemamyPlugin; +import org.jiemamy.eclipse.JiemamyUIPlugin; import org.jiemamy.eclipse.editor.command.DialogEditCommand; import org.jiemamy.eclipse.editor.dialog.root.RootEditDialog; import org.jiemamy.eclipse.editor.editpart.EditDialogSupport; @@ -81,7 +81,7 @@ logger.debug(LogMarker.LIFECYCLE, "activated"); super.activate(); - IPreferenceStore ps = JiemamyPlugin.getDefault().getPreferenceStore(); + IPreferenceStore ps = JiemamyUIPlugin.getDefault().getPreferenceStore(); ps.addPropertyChangeListener(this); RootModel rootModel = getModel(); @@ -100,7 +100,7 @@ RootModel rootModel = getModel(); rootModel.getJiemamy().getEventBroker().removeListener(this); - IPreferenceStore ps = JiemamyPlugin.getDefault().getPreferenceStore(); + IPreferenceStore ps = JiemamyUIPlugin.getDefault().getPreferenceStore(); ps.removePropertyChangeListener(this); super.deactivate(); @@ -183,7 +183,7 @@ } private void setConnectionRouter(IFigure figure) { - JiemamyPreference ps = JiemamyPlugin.getPreference(); + JiemamyPreference ps = JiemamyUIPlugin.getPreference(); ConnectionRouter router = ps.getConnectionRouter().getRouter(figure); ConnectionLayer connLayer = (ConnectionLayer) getLayer(LayerConstants.CONNECTION_LAYER); connLayer.setConnectionRouter(router); Modified: vesta/trunk/org.jiemamy.eclipse/src/main/java/org/jiemamy/eclipse/editor/editpart/outlinetree/AttributeTreeEditPart.java =================================================================== --- vesta/trunk/org.jiemamy.eclipse/src/main/java/org/jiemamy/eclipse/editor/editpart/outlinetree/AttributeTreeEditPart.java 2009-03-03 18:33:18 UTC (rev 2809) +++ vesta/trunk/org.jiemamy.eclipse/src/main/java/org/jiemamy/eclipse/editor/editpart/outlinetree/AttributeTreeEditPart.java 2009-03-04 10:33:52 UTC (rev 2810) @@ -22,7 +22,7 @@ import org.eclipse.jface.resource.ImageRegistry; import org.jiemamy.eclipse.Images; -import org.jiemamy.eclipse.JiemamyPlugin; +import org.jiemamy.eclipse.JiemamyUIPlugin; import org.jiemamy.eclipse.editor.DisplayPlace; import org.jiemamy.eclipse.editor.editpolicy.JmTreeComponentEditPolicy; import org.jiemamy.eclipse.editor.utils.LabelStringUtil; @@ -76,7 +76,7 @@ // ツリー・アイテムのテキストとしてモデルのテキストを設定 setWidgetText(LabelStringUtil.getString(rootModel, model, DisplayPlace.OUTLINE_TREE)); - ImageRegistry ir = JiemamyPlugin.getDefault().getImageRegistry(); + ImageRegistry ir = JiemamyUIPlugin.getDefault().getImageRegistry(); setWidgetImage(ir.get(Images.ICON_COLUMN)); } } Modified: vesta/trunk/org.jiemamy.eclipse/src/main/java/org/jiemamy/eclipse/editor/editpart/outlinetree/DomainTreeEditPart.java =================================================================== --- vesta/trunk/org.jiemamy.eclipse/src/main/java/org/jiemamy/eclipse/editor/editpart/outlinetree/DomainTreeEditPart.java 2009-03-03 18:33:18 UTC (rev 2809) +++ vesta/trunk/org.jiemamy.eclipse/src/main/java/org/jiemamy/eclipse/editor/editpart/outlinetree/DomainTreeEditPart.java 2009-03-04 10:33:52 UTC (rev 2810) @@ -22,7 +22,7 @@ import org.eclipse.jface.resource.ImageRegistry; import org.jiemamy.eclipse.Images; -import org.jiemamy.eclipse.JiemamyPlugin; +import org.jiemamy.eclipse.JiemamyUIPlugin; import org.jiemamy.eclipse.editor.DisplayPlace; import org.jiemamy.eclipse.editor.editpolicy.JmTreeComponentEditPolicy; import org.jiemamy.eclipse.editor.utils.LabelStringUtil; @@ -77,7 +77,7 @@ // ツリー・アイテムのテキストとしてモデルのテキストを設定 setWidgetText(LabelStringUtil.getString(rootModel, model, DisplayPlace.OUTLINE_TREE)); - ImageRegistry ir = JiemamyPlugin.getDefault().getImageRegistry(); + ImageRegistry ir = JiemamyUIPlugin.getDefault().getImageRegistry(); setWidgetImage(ir.get(Images.ICON_COLUMN)); } } Modified: vesta/trunk/org.jiemamy.eclipse/src/main/java/org/jiemamy/eclipse/editor/editpart/outlinetree/ModelContainerEditPart.java =================================================================== --- vesta/trunk/org.jiemamy.eclipse/src/main/java/org/jiemamy/eclipse/editor/editpart/outlinetree/ModelContainerEditPart.java 2009-03-03 18:33:18 UTC (rev 2809) +++ vesta/trunk/org.jiemamy.eclipse/src/main/java/org/jiemamy/eclipse/editor/editpart/outlinetree/ModelContainerEditPart.java 2009-03-04 10:33:52 UTC (rev 2810) @@ -26,7 +26,7 @@ import org.slf4j.LoggerFactory; import org.jiemamy.eclipse.Images; -import org.jiemamy.eclipse.JiemamyPlugin; +import org.jiemamy.eclipse.JiemamyUIPlugin; import org.jiemamy.eclipse.editor.ModelContainer; import org.jiemamy.model.JiemamyElement; @@ -83,7 +83,7 @@ // ツリー・アイテムのテキストとしてモデルのテキストを設定 setWidgetText(modelContainer.getName()); - ImageRegistry ir = JiemamyPlugin.getDefault().getImageRegistry(); + ImageRegistry ir = JiemamyUIPlugin.getDefault().getImageRegistry(); if (modelContainer.getContainerId().equals(RootTreeEditPart.CONTAINER_TABLE)) { setWidgetImage(ir.get(Images.ICON_TABLE)); } else if (modelContainer.getContainerId().equals(RootTreeEditPart.CONTAINER_VIEW)) { Modified: vesta/trunk/org.jiemamy.eclipse/src/main/java/org/jiemamy/eclipse/editor/editpart/outlinetree/TableTreeEditPart.java =================================================================== --- vesta/trunk/org.jiemamy.eclipse/src/main/java/org/jiemamy/eclipse/editor/editpart/outlinetree/TableTreeEditPart.java 2009-03-03 18:33:18 UTC (rev 2809) +++ vesta/trunk/org.jiemamy.eclipse/src/main/java/org/jiemamy/eclipse/editor/editpart/outlinetree/TableTreeEditPart.java 2009-03-04 10:33:52 UTC (rev 2810) @@ -29,7 +29,7 @@ import org.slf4j.LoggerFactory; import org.jiemamy.eclipse.Images; -import org.jiemamy.eclipse.JiemamyPlugin; +import org.jiemamy.eclipse.JiemamyUIPlugin; import org.jiemamy.eclipse.editor.DisplayPlace; import org.jiemamy.eclipse.editor.command.DialogEditCommand; import org.jiemamy.eclipse.editor.dialog.table.TableEditDialog; @@ -125,7 +125,7 @@ // ツリー・アイテムのテキストとしてモデルのテキストを設定 setWidgetText(LabelStringUtil.getString(rootModel, model, DisplayPlace.OUTLINE_TREE)); - ImageRegistry ir = JiemamyPlugin.getDefault().getImageRegistry(); + ImageRegistry ir = JiemamyUIPlugin.getDefault().getImageRegistry(); setWidgetImage(ir.get(Images.ICON_TABLE)); } } Modified: vesta/trunk/org.jiemamy.eclipse/src/main/java/org/jiemamy/eclipse/editor/editpart/outlinetree/ViewTreeEditPart.java =================================================================== --- vesta/trunk/org.jiemamy.eclipse/src/main/java/org/jiemamy/eclipse/editor/editpart/outlinetree/ViewTreeEditPart.java 2009-03-03 18:33:18 UTC (rev 2809) +++ vesta/trunk/org.jiemamy.eclipse/src/main/java/org/jiemamy/eclipse/editor/editpart/outlinetree/ViewTreeEditPart.java 2009-03-04 10:33:52 UTC (rev 2810) @@ -27,7 +27,7 @@ import org.slf4j.LoggerFactory; import org.jiemamy.eclipse.Images; -import org.jiemamy.eclipse.JiemamyPlugin; +import org.jiemamy.eclipse.JiemamyUIPlugin; import org.jiemamy.eclipse.editor.DisplayPlace; import org.jiemamy.eclipse.editor.command.DialogEditCommand; import org.jiemamy.eclipse.editor.dialog.view.ViewEditDialog; @@ -116,7 +116,7 @@ // ツリー・アイテムのテキストとしてモデルのテキストを設定 setWidgetText(LabelStringUtil.getString(rootModel, model, DisplayPlace.OUTLINE_TREE)); - ImageRegistry ir = JiemamyPlugin.getDefault().getImageRegistry(); + ImageRegistry ir = JiemamyUIPlugin.getDefault().getImageRegistry(); setWidgetImage(ir.get(Images.ICON_VIEW)); } } Modified: vesta/trunk/org.jiemamy.eclipse/src/main/java/org/jiemamy/eclipse/editor/figure/TableFigure.java =================================================================== --- vesta/trunk/org.jiemamy.eclipse/src/main/java/org/jiemamy/eclipse/editor/figure/TableFigure.java 2009-03-03 18:33:18 UTC (rev 2809) +++ vesta/trunk/org.jiemamy.eclipse/src/main/java/org/jiemamy/eclipse/editor/figure/TableFigure.java 2009-03-04 10:33:52 UTC (rev 2810) @@ -28,7 +28,7 @@ import org.eclipse.swt.graphics.Color; import org.jiemamy.eclipse.Images; -import org.jiemamy.eclipse.JiemamyPlugin; +import org.jiemamy.eclipse.JiemamyUIPlugin; import org.jiemamy.eclipse.utils.SwtColorUtil; import org.jiemamy.model.entity.TableModel; @@ -53,7 +53,7 @@ super(ColorConstants.tooltipBackground); Label entityNameLabel = getEntityNameLabel(); - ImageRegistry ir = JiemamyPlugin.getDefault().getImageRegistry(); + ImageRegistry ir = JiemamyUIPlugin.getDefault().getImageRegistry(); entityNameLabel.setIcon(ir.get(Images.LABEL_TABLE)); Modified: vesta/trunk/org.jiemamy.eclipse/src/main/java/org/jiemamy/eclipse/editor/figure/ViewFigure.java =================================================================== --- vesta/trunk/org.jiemamy.eclipse/src/main/java/org/jiemamy/eclipse/editor/figure/ViewFigure.java 2009-03-03 18:33:18 UTC (rev 2809) +++ vesta/trunk/org.jiemamy.eclipse/src/main/java/org/jiemamy/eclipse/editor/figure/ViewFigure.java 2009-03-04 10:33:52 UTC (rev 2810) @@ -26,7 +26,7 @@ import org.eclipse.swt.graphics.Color; import org.jiemamy.eclipse.Images; -import org.jiemamy.eclipse.JiemamyPlugin; +import org.jiemamy.eclipse.JiemamyUIPlugin; import org.jiemamy.eclipse.utils.SwtColorUtil; /** @@ -45,7 +45,7 @@ public ViewFigure() { super(DEFAULT); - ImageRegistry ir = JiemamyPlugin.getDefault().getImageRegistry(); + ImageRegistry ir = JiemamyUIPlugin.getDefault().getImageRegistry(); getEntityNameLabel().setIcon(ir.get(Images.LABEL_VIEW)); setLayoutManager(new ToolbarLayout()); Deleted: vesta/trunk/org.jiemamy.eclipse/src/main/java/org/jiemamy/eclipse/extension/ExtensionResolver.java =================================================================== --- vesta/trunk/org.jiemamy.eclipse/src/main/java/org/jiemamy/eclipse/extension/ExtensionResolver.java 2009-03-03 18:33:18 UTC (rev 2809) +++ vesta/trunk/org.jiemamy.eclipse/src/main/java/org/jiemamy/eclipse/extension/ExtensionResolver.java 2009-03-04 10:33:52 UTC (rev 2810) @@ -1,147 +0,0 @@ -/* - * Copyright 2007-2009 Jiemamy Project and the Others. - * Created on 2008/08/03 - * - * 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.extension; - -import java.util.ArrayList; -import java.util.List; -import java.util.Map; - -import org.apache.commons.collections15.list.UnmodifiableList; -import org.eclipse.core.runtime.CoreException; -import org.eclipse.core.runtime.IConfigurationElement; -import org.seasar.eclipse.common.util.ExtensionAcceptor; - -import org.jiemamy.eclipse.utils.ExceptionHandler; -import org.jiemamy.utils.CollectionsUtil; - -/** - * 拡張ポイントに設定された項目の読み出しを行うクラス。 - * - * @param <T> 拡張クラスが実装すべきインターフェイス - * @author daisuke - */ -public class ExtensionResolver<T> { - - /** 拡張のMap */ - private Map<String, IConfigurationElement> extensionConfigurationElements; - - private List<T> allInstance; - - - /** - * リゾルバを初期化する。 以前読み込んだ情報を全て破棄し、拡張ポイントを読み込み直す。 - * - * <p>識別子には id 属性を使用する。</p> - * - * @param pluginId プラグインID - * @param extensionPointName 拡張ポイント名 - * @param extensionElementName 要素名 - */ - public ExtensionResolver(String pluginId, String extensionPointName, final String extensionElementName) { - this(pluginId, extensionPointName, extensionElementName, "id"); - } - - /** - * リゾルバを初期化する。 以前読み込んだ情報を全て破棄し、拡張ポイントを読み込み直す。 - * - * @param pluginId プラグインID - * @param extensionPointName 拡張ポイント名 - * @param extensionElementName 要素名 - * @param identifierAttributeName 識別子として扱う属性名 - */ - public ExtensionResolver(String pluginId, String extensionPointName, final String extensionElementName, - final String identifierAttributeName) { - extensionConfigurationElements = CollectionsUtil.newHashMap(); - - ExtensionAcceptor.accept(pluginId, extensionPointName, new ExtensionAcceptor.ExtensionVisitor() { - - public void visit(IConfigurationElement element) { - if (extensionElementName.equals(element.getName())) { - extensionConfigurationElements.put(element.getAttribute(identifierAttributeName), element); - } - } - }); - } - - /** - * 拡張ポイントのclass属性に設定された全ての実装クラスのインスタンスをリストで取得する。 - * - * @return 実装クラスのインスタンスリスト - */ - public List<T> getAllInstance() { - return getAllInstance("class"); - } - - /** - * 拡張ポイントに設定された全ての実装クラスのインスタンスをリストで取得する。 - * - * @param classAttributeName 拡張ポイント定義の属性名 - * @return 実装クラスのインスタンスリスト - */ - public List<T> getAllInstance(String classAttributeName) { - if (allInstance == null) { - List<T> result = new ArrayList<T>(); - for (String key : extensionConfigurationElements.keySet()) { - try { - result.add(getInstance(key, classAttributeName)); - } catch (CoreException e) { - ExceptionHandler.handleException(e, ExceptionHandler.LOG | ExceptionHandler.STACKTRACE); - // ignore - } - } - allInstance = UnmodifiableList.decorate(result); - } - return allInstance; - } - - /** - * 拡張のMapを取得する。 - * - * @return フィルタのファクトリ - */ - public Map<String, IConfigurationElement> getExtensionConfigurationElements() { - return extensionConfigurationElements; - } - - /** - * 拡張定義のclass属性に設定されたクラスのインスタンスを取得する。 - * - * @param identifier 拡張識別子 - * @return インスタンス - * @throws CoreException - */ - public T getInstance(String identifier) throws CoreException { - return getInstance(identifier, "class"); - } - - /** - * 拡張定義に設定されたクラスのインスタンスを取得する。 - * - * @param identifier 拡張識別子 - * @param classAttributeName クラス名が記述されている属性名 - * @return インスタンス - * @throws CoreException - */ - public T getInstance(String identifier, String classAttributeName) throws CoreException { - @SuppressWarnings("unchecked") - // TODO キャスト安全性の根拠提示 - T instance = (T) extensionConfigurationElements.get(identifier).createExecutableExtension(classAttributeName); - return instance; - } -} Modified: vesta/trunk/org.jiemamy.eclipse/src/main/java/org/jiemamy/eclipse/preference/JiemamyPreferenceImpl.java =================================================================== --- vesta/trunk/org.jiemamy.eclipse/src/main/java/org/jiemamy/eclipse/preference/JiemamyPreferenceImpl.java 2009-03-03 18:33:18 UTC (rev 2809) +++ vesta/trunk/org.jiemamy.eclipse/src/main/java/org/jiemamy/eclipse/preference/JiemamyPreferenceImpl.java 2009-03-04 10:33:52 UTC (rev 2810) @@ -21,7 +21,7 @@ import org.apache.commons.lang.text.StrBuilder; import org.eclipse.jface.preference.IPreferenceStore; -import org.jiemamy.eclipse.JiemamyPlugin; +import org.jiemamy.eclipse.JiemamyUIPlugin; /** * 設定の読み書き実装クラス。 @@ -30,7 +30,7 @@ */ public class JiemamyPreferenceImpl implements JiemamyPreference { - private IPreferenceStore ps = JiemamyPlugin.getDefault().getPreferenceStore(); + private IPreferenceStore ps = JiemamyUIPlugin.getDefault().getPreferenceStore(); public ConnectionRouters getConnectionRouter() { Modified: vesta/trunk/org.jiemamy.eclipse/src/main/java/org/jiemamy/eclipse/preference/JiemamyPreferenceInitializer.java =================================================================== --- vesta/trunk/org.jiemamy.eclipse/src/main/java/org/jiemamy/eclipse/preference/JiemamyPreferenceInitializer.java 2009-03-03 18:33:18 UTC (rev 2809) +++ vesta/trunk/org.jiemamy.eclipse/src/main/java/org/jiemamy/eclipse/preference/JiemamyPreferenceInitializer.java 2009-03-04 10:33:52 UTC (rev 2810) @@ -21,7 +21,7 @@ import org.eclipse.core.runtime.Preferences; import org.eclipse.core.runtime.preferences.AbstractPreferenceInitializer; -import org.jiemamy.eclipse.JiemamyPlugin; +import org.jiemamy.eclipse.JiemamyUIPlugin; /** * Jiemamy Eclipse Plugin のプリファレンス値に対するデフォルト情報を与える。 @@ -33,7 +33,7 @@ @Override public void initializeDefaultPreferences() { // String workspacePath = ResourcesPlugin.getWorkspace().getRoot().getRawLocation().toOSString(); - Preferences preferences = JiemamyPlugin.getDefault().getPluginPreferences(); + Preferences preferences = JiemamyUIPlugin.getDefault().getPluginPreferences(); preferences.setDefault(PreferenceKey.CREATE_COLUMNS_WITH_FK.toString(), PreferenceKey.CREATE_COLUMNS_WITH_FK .getDefaultBoolean()); Modified: vesta/trunk/org.jiemamy.eclipse/src/main/java/org/jiemamy/eclipse/preference/JiemamyPreferencePage.java =================================================================== --- vesta/trunk/org.jiemamy.eclipse/src/main/java/org/jiemamy/eclipse/preference/JiemamyPreferencePage.java 2009-03-03 18:33:18 UTC (rev 2809) +++ vesta/trunk/org.jiemamy.eclipse/src/main/java/org/jiemamy/eclipse/preference/JiemamyPreferencePage.java 2009-03-04 10:33:52 UTC (rev 2810) @@ -32,7 +32,7 @@ import org.eclipse.ui.IWorkbench; import org.eclipse.ui.IWorkbenchPreferencePage; -import org.jiemamy.eclipse.JiemamyPlugin; +import org.jiemamy.eclipse.JiemamyUIPlugin; /** * 設定ページクラス。 @@ -48,7 +48,7 @@ private Combo cmbConnectionRouter; /** プリファレンス */ - private JiemamyPreference pref = JiemamyPlugin.getPreference(); + private JiemamyPreference pref = JiemamyUIPlugin.getPreference(); public void init(IWorkbench workbench) { @@ -58,7 +58,7 @@ @Override public boolean performOk() { storeValues(); - JiemamyPlugin.getDefault().savePluginPreferences(); + JiemamyUIPlugin.getDefault().savePluginPreferences(); return true; } @@ -110,7 +110,7 @@ */ private void storeValues() { // store new value - IPreferenceStore ps = JiemamyPlugin.getDefault().getPreferenceStore(); + IPreferenceStore ps = JiemamyUIPlugin.getDefault().getPreferenceStore(); ps.setValue(PreferenceKey.CREATE_COLUMNS_WITH_FK.toString(), chkCreateColumnWithFk.getSelection()); ps.setValue(PreferenceKey.CONNECTION_ROUTER.toString(), ConnectionRouters.get(cmbConnectionRouter.getText()) .name()); Modified: vesta/trunk/org.jiemamy.eclipse/src/main/java/org/jiemamy/eclipse/ui/JiemamyEditDialog.java =================================================================== --- vesta/trunk/org.jiemamy.eclipse/src/main/java/org/jiemamy/eclipse/ui/JiemamyEditDialog.java 2009-03-03 18:33:18 UTC (rev 2809) +++ vesta/trunk/org.jiemamy.eclipse/src/main/java/org/jiemamy/eclipse/ui/JiemamyEditDialog.java 2009-03-04 10:33:52 UTC (rev 2810) @@ -34,7 +34,8 @@ import org.eclipse.swt.widgets.TabFolder; import org.jiemamy.dialect.Dialect; -import org.jiemamy.eclipse.JiemamyPlugin; +import org.jiemamy.eclipse.JiemamyCorePlugin; +import org.jiemamy.eclipse.JiemamyUIPlugin; import org.jiemamy.eclipse.extension.ExtensionResolver; import org.jiemamy.eclipse.ui.tab.AbstractTab; import org.jiemamy.model.JiemamyElement; @@ -85,7 +86,7 @@ this.targetModel = targetModel; this.type = type; - IDialogSettings pluginSettings = JiemamyPlugin.getDefault().getDialogSettings(); + IDialogSettings pluginSettings = JiemamyUIPlugin.getDefault().getDialogSettings(); settings = pluginSettings.getSection("JiemamyEditDialog$" + type.getName()); // $NON-NLS-1$ if (settings == null) { settings = pluginSettings.addNewSection("JiemamyEditDialog$" + type.getName()); // $NON-NLS-1$ @@ -139,7 +140,7 @@ Constructor<?> constructor = tabClass.getConstructor(TabFolder.class, int.class, type); tab = (AbstractTab) constructor.newInstance(tabFolder, SWT.NULL, targetModel); } catch (Exception e) { - JiemamyPlugin.log(e); + JiemamyUIPlugin.log(e); } return tab; } @@ -152,7 +153,7 @@ */ protected List<AbstractTab> createAdditionalTabs(TabFolder tabFolder) { List<AbstractTab> result = CollectionsUtil.newArrayList(); - ExtensionResolver<Dialect> dialectResolver = JiemamyPlugin.getDialectResolver(); + ExtensionResolver<Dialect> dialectResolver = JiemamyCorePlugin.getDialectResolver(); RootModel rootModel = targetModel.getJiemamy().getFactory().getRootModel(); Modified: vesta/trunk/org.jiemamy.eclipse/src/main/java/org/jiemamy/eclipse/utils/ExceptionHandler.java =================================================================== --- vesta/trunk/org.jiemamy.eclipse/src/main/java/org/jiemamy/eclipse/utils/ExceptionHandler.java 2009-03-03 18:33:18 UTC (rev 2809) +++ vesta/trunk/org.jiemamy.eclipse/src/main/java/org/jiemamy/eclipse/utils/ExceptionHandler.java 2009-03-04 10:33:52 UTC (rev 2810) @@ -27,7 +27,7 @@ import org.seasar.eclipse.common.util.LogUtil; import org.seasar.eclipse.common.util.StatusUtil; -import org.jiemamy.eclipse.JiemamyPlugin; +import org.jiemamy.eclipse.JiemamyUIPlugin; /** * 例外処理ユーティリティクラス。 @@ -56,7 +56,7 @@ public static final int ALL = LOG | DIALOG | STACKTRACE; /** ロギング対象プラグイン */ - private static Plugin plugin = JiemamyPlugin.getDefault(); + private static Plugin plugin = JiemamyUIPlugin.getDefault(); /** Modified: vesta/trunk/org.jiemamy.eclipse/src/main/java/org/jiemamy/eclipse/wizard/NewDiagramWizard.java =================================================================== --- vesta/trunk/org.jiemamy.eclipse/src/main/java/org/jiemamy/eclipse/wizard/NewDiagramWizard.java 2009-03-03 18:33:18 UTC (rev 2809) +++ vesta/trunk/org.jiemamy.eclipse/src/main/java/org/jiemamy/eclipse/wizard/NewDiagramWizard.java 2009-03-04 10:33:52 UTC (rev 2810) @@ -36,7 +36,7 @@ import org.jiemamy.Artemis; import org.jiemamy.ArtemisView; import org.jiemamy.Jiemamy; -import org.jiemamy.eclipse.JiemamyPlugin; +import org.jiemamy.eclipse.JiemamyUIPlugin; import org.jiemamy.eclipse.utils.ExceptionHandler; import org.jiemamy.model.RootModel; @@ -61,7 +61,7 @@ setNeedsProgressMonitor(true); setWindowTitle("New Jiemamy Database Diagram"); // RESOURCE - IDialogSettings workbenchSettings = JiemamyPlugin.getDefault().getDialogSettings(); + IDialogSettings workbenchSettings = JiemamyUIPlugin.getDefault().getDialogSettings(); IDialogSettings section = workbenchSettings.getSection("NewDiagramWizard"); // $NON-NLS-1$ if (section == null) { section = workbenchSettings.addNewSection("NewDiagramWizard"); // $NON-NLS-1$ Modified: vesta/trunk/org.jiemamy.eclipse.core/.classpath =================================================================== --- vesta/trunk/org.jiemamy.eclipse.core/.classpath 2009-03-03 18:33:18 UTC (rev 2809) +++ vesta/trunk/org.jiemamy.eclipse.core/.classpath 2009-03-04 10:33:52 UTC (rev 2810) @@ -4,6 +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 exported="true" kind="lib" path="lib/eclipse-common-0.0.4.jar"/> <classpathentry exported="true" kind="lib" path="lib/collections-generic-4.01.jar" sourcepath="lib/sources/collections-generic-4.01-sources.jar"/> <classpathentry exported="true" kind="lib" path="lib/commons-beanutils-1.8.0.jar" sourcepath="lib/sources/commons-beanutils-1.8.0-sources.jar"/> <classpathentry exported="true" kind="lib" path="lib/commons-io-1.3.2.jar" sourcepath="lib/sources/commons-io-1.3.2-sources.jar"/> Modified: vesta/trunk/org.jiemamy.eclipse.core/META-INF/MANIFEST.MF =================================================================== --- vesta/trunk/org.jiemamy.eclipse.core/META-INF/MANIFEST.MF 2009-03-03 18:33:18 UTC (rev 2809) +++ vesta/trunk/org.jiemamy.eclipse.core/META-INF/MANIFEST.MF 2009-03-04 10:33:52 UTC (rev 2810) @@ -23,7 +23,8 @@ lib/logback-classic-0.9.9.jar, lib/logback-core-0.9.9.jar, lib/osgi_R4_core-1.0.jar, - lib/slf4j-api-1.5.5.jar + lib/slf4j-api-1.5.5.jar, + lib/eclipse-common-0.0.4.jar Export-Package: ch.qos.logback.classic, ch.qos.logback.classic.boolex, ch.qos.logback.classic.db, @@ -136,6 +137,9 @@ org.jiemamy.dialect, org.jiemamy.dialect.generic, org.jiemamy.dialect.validator, + org.jiemamy.eclipse, + org.jiemamy.eclipse.extension, + org.jiemamy.eclipse.extension.validator, org.jiemamy.editcommand, org.jiemamy.editcommand.impl, org.jiemamy.exception, @@ -179,8 +183,20 @@ org.osgi.service.permissionadmin, org.osgi.service.startlevel, org.osgi.service.url, + org.seasar.eclipse.common, + org.seasar.eclipse.common.action, + org.seasar.eclipse.common.launch, + org.seasar.eclipse.common.preference, + org.seasar.eclipse.common.util, + org.seasar.eclipse.common.variable, + org.seasar.eclipse.common.viewer, + org.seasar.eclipse.common.wiget, org.slf4j, org.slf4j.helpers, org.slf4j.impl, org.slf4j.spi Eclipse-BuddyPolicy: registered +Bundle-Activator: org.jiemamy.eclipse.JiemamyCorePlugin +Require-Bundle: org.eclipse.core.runtime, + org.eclipse.core.resources +Eclipse-LazyStart: true Added: vesta/trunk/org.jiemamy.eclipse.core/about.ini =================================================================== --- vesta/trunk/org.jiemamy.eclipse.core/about.ini (rev 0) +++ vesta/trunk/org.jiemamy.eclipse.core/about.ini 2009-03-04 10:33:52 UTC (rev 2810) @@ -0,0 +1,36 @@ +# about.ini +# contains information about a feature +# java.io.Properties file (ISO 8859-1 with "\" escapes) +# "%key" are externalized strings defined in about.properties +# This file does not need to be translated. + +# Property "aboutText" contains blurb for "About" dialog (translated) +aboutText=Jiemamy Eclipse Plugins - Database Modeling/Refactoring Project\n\ +\n\Copyright 2007-2009 Jiemamy Project and Others. All rights reserved.\n\ +Visit http://jiemamy.org/ + +# Property "windowImage" contains path to window icon (16x16) +# needed for primary features only +windowImage=images/jiemamy16.png + +# Property "featureImage" contains path to feature image (32x32) +featureImage=images/jiemamy32.png + +# Property "aboutImage" contains path to product image (500x330 or 115x164) +# needed for primary features only +aboutImage=images/jiemamy_about.png + +# Property "appName" contains name of the application (translated) +# needed for primary features only + +# Property "welcomePage" contains path to welcome page (special XML-based format) +# ($nl$/ prefix to permit locale-specific translations of entire file) +#welcomePage=welcome/$nl$.xml + +# Property "welcomePerspective" contains the id of the perspective in which the +# welcome page is to be opened. +# optional + +# Property "tipsAndTricksHref" contains the Help topic href to a tips and tricks page +# optional +#tipsAndTricksHref=/org.jiemamy.eclipse.ui/tips/jiemamy_tips.html Property changes on: vesta/trunk/org.jiemamy.eclipse.core/about.ini ___________________________________________________________________ Added: svn:mime-type + text/plain Modified: vesta/trunk/org.jiemamy.eclipse.core/build.properties =================================================================== --- vesta/trunk/org.jiemamy.eclipse.core/build.properties 2009-03-03 18:33:18 UTC (rev 2809) +++ vesta/trunk/org.jiemamy.eclipse.core/build.properties 2009-03-04 10:33:52 UTC (rev 2810) @@ -25,7 +25,8 @@ lib/osgi_R4_core-1.0.jar,\ lib/slf4j-api-1.5.5.jar,\ license/,\ - plugin.xml + plugin.xml,\ + lib/eclipse-common-0.0.4.jar output..=target/classes/ source..=src/main/java/,src/main/resources/,src/test/java/,src/test/resources/ bin.excludes=lib/sources/ Added: vesta/trunk/org.jiemamy.eclipse.core/images/jiemamy16.png =================================================================== (Binary files differ) Property changes on: vesta/trunk/org.jiemamy.eclipse.core/images/jiemamy16.png ___________________________________________________________________ Added: svn:mime-type + application/octet-stream Added: vesta/trunk/org.jiemamy.eclipse.core/images/jiemamy32.png =================================================================== (Binary files differ) Property changes on: vesta/trunk/org.jiemamy.eclipse.core/images/jiemamy32.png ___________________________________________________________________ Added: svn:mime-type + application/octet-stream Added: vesta/trunk/org.jiemamy.eclipse.core/images/jiemamy_about.png =================================================================== (Binary files differ) Property changes on: vesta/trunk/org.jiemamy.eclipse.core/images/jiemamy_about.png ___________________________________________________________________ Added: svn:mime-type + application/octet-stream Deleted: vesta/trunk/org.jiemamy.eclipse.core/license/LICENSE.eclipse-common.txt =================================================================== --- vesta/trunk/org.jiemamy.eclipse.core/license/LICENSE.eclipse-common.txt 2009-03-03 18:33:18 UTC (rev 2809) +++ vesta/trunk/org.jiemamy.eclipse.core/license/LICENSE.eclipse-common.txt 2009-03-04 10:33:52 UTC (rev 2810) @@ -1,202 +0,0 @@ - - Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - - TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - - 1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - - 2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - - 3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - - 4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - - 5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - - 6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - - 7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - - 8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - - 9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - - END OF TERMS AND CONDITIONS - - APPENDIX: How to apply the Apache License to your work. - - To apply the Apache License to your work, attach the following - boilerplate notice, with the fields enclosed by brackets "[]" - replaced with your own identifying information. (Don't include - the brackets!) The text should be enclosed in the appropriate - comment syntax for the file format. We also recommend that a - file or class name and description of purpose be included on the - same "printed page" as the copyright notice for easier - identification within third-party archives. - - Copyright [yyyy] [name of copyright owner] - - 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. Deleted: vesta/trunk/org.jiemamy.eclipse.core/license/LICENSE.stax.txt =================================================================== --- vesta/trunk/org.jiemamy.eclipse.core/license/LICENSE.stax.txt 2009-03-03 18:33:18 UTC (rev 2809) +++ vesta/trunk/org.jiemamy.eclipse.core/license/LICENSE.stax.txt 2009-03-04 10:33:52 UTC (rev 2810) @@ -1,201 +0,0 @@ - Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - - TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - - 1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - - 2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - - 3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - - 4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - - 5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - - 6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - - 7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - - 8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - - 9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - - END OF TERMS AND CONDITIONS - - APPENDIX: How to apply the Apache License to your work. - - To apply the Apache License to your work, attach the following - boilerplate notice, with the fields enclosed by brackets "[]" - replaced with your own identifying information. (Don't include - the brackets!) The text should be enclosed in the appropriate - comment syntax for the file format. We also recommend that a - file or class name and description of purpose be included on the - same "printed page" as the copyright notice for easier - identification within third-party archives. - - Copyright [yyyy] [name of copyright owner] - - 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. Deleted: vesta/trunk/org.jiemamy.eclipse.core/license/LICENSE.woodstox.txt =================================================================== --- vesta/trunk/org.jiemamy.eclipse.core/license/LICENSE.woodstox.txt 2009-03-03 18:33:18 UTC (rev 2809) +++ vesta/trunk/org.jiemamy.eclipse.core/license/LICENSE.woodstox.txt 2009-03-04 10:33:52 UTC (rev 2810) @@ -1,14 +0,0 @@ -This copy of Woodstox XML processor is licensed under the -Apache (Software) License, version 2.0 ("the License"). -See the License for details about distribution rights, and the -specific rights regarding derivate works. - -You may obtain a copy of the License at: - -http://www.apache.org/licenses/ - -A copy is also included with both the the downloadable source code package -and jar that contains class bytecodes, as file "ASL 2.0". In both cases, -that file should be located next to this file: in source distribution -the location should be "release-notes/asl"; and in jar "META-INF/" - Deleted: vesta/trunk/org.jiemamy.eclipse.core/license/LICENSE.xstream.txt =================================================================== --- vesta/trunk/org.jiemamy.eclipse.core/license/LICENSE.xstream.txt 2009-03-03 18:33:18 UTC (rev 2809) +++ vesta/trunk/org.jiemamy.eclipse.core/license/LICENSE.xstream.txt 2009-03-04 10:33:52 UTC (rev 2810) @@ -1,28 +0,0 @@ -(BSD Style License) - -Copyright (c) 2003-2006, Joe Walnes -Copyright (c) 2006-2007, XStream Committers -All rights reserved. - -Redistribution and use in source and binary forms, with or without -modification, are permitted provided that the following conditions are met: - -Redistributions of source code must retain the above copyright notice, this list of -conditions and the following disclaimer. Redistributions in binary form must reproduce -the above copyright notice, this list of conditions and the following disclaimer in -the documentation and/or other materials provided with the distribution. - -Neither the name of XStream nor the names of its contributors may be used to endorse -or promote products derived from this software without specific prior written -permission. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY -EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES -OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT -SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED -TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR -BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN -CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY -WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH -DAMAGE. Deleted: vesta/trunk/org.jiemamy.eclipse.core/platform_info.target =================================================================== --- vesta/trunk/org.jiemamy.eclipse.core/platform_info.target 2009-03-03 18:33:18 UTC (rev 2809) +++ vesta/trunk/org.jiemamy.eclipse.core/platform_info.target 2009-03-04 10:33:52 UTC (rev 2810) @@ -1,19 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<?pde version="3.2"?> - -<target name="Jiemamy Target Platform"> - - <targetJRE> - <execEnv>J2SE-1.5</execEnv> - </targetJRE> - - <location path="${eclipse_home}../eclipse-jiemamy-target"/> - - <content useAllPlugins="true"> - <plugins> - </plugins> - <features> - </features> - </content> - -</target> Added: vesta/trunk/org.jiemamy.eclipse.core/src/main/java/org/jiemamy/eclipse/JiemamyCorePlugin.java =================================================================== --- vesta/trunk/org.jiemamy.eclipse.core/src/main/java/org/jiemamy/eclipse/JiemamyCorePlugin.java (rev 0) +++ vesta/trunk/org.jiemamy.eclipse.core/src/main/java/org/jiemamy/eclipse/JiemamyCorePlugin.java 2009-03-04 10:33:52 UTC (rev 2810) @@ -0,0 +1,121 @@ +package org.jiemamy.eclipse; + +import org.eclipse.core.runtime.Plugin; +import org.osgi.framework.BundleContext; + +import org.jiemamy.composer.ExportConfig; +import org.jiemamy.composer.Exporter; +import org.jiemamy.composer.ImportConfig; +import org.jiemamy.composer.Importer; +import org.jiemamy.dialect.Dialect; +import org.jiemamy.eclipse.extension.ExtensionResolver; +import org.jiemamy.eclipse.extension.validator.ModelValidator; + +/** + * Jiemamy Eclipse Core PluginのActivatorクラス。 + * + * @author daisuke + */ +public class JiemamyCorePlugin extends Plugin { + + /** The plug-in ID */ + public static final String PLUGIN_ID = "org.jiemamy.eclipse.core"; + + /** プラグインクラスのシングルトンインスタンス */ + private static JiemamyCorePlugin plugin; + + /** 拡張ポイントに設定されたDialectのリゾルバ */ + private static ExtensionResolver<Dialect> dialectResolver; + + /** 拡張ポイントに設定されたImporterのリゾルバ */ + private static ExtensionResolver<Importer<ImportConfig>> importerResolver; + + /** 拡張ポイントに設定されたExporterのリゾルバ */ + private static ExtensionResolver<Exporter<ExportConfig>> exporterResolver; + + /** 拡張ポイントに設定されたModelValidatorのリゾルバ */ + private static ExtensionResolver<ModelValidator> validatorResolver; + + + /** + * Returns the shared instance + * + * @return the shared instance + */ + public static JiemamyCorePlugin getDefault() { + return plugin; + } + + /** + * 拡張ポイントに設定されたDialectのリゾルバを取得する。 + * + * @return 拡張ポイントに設定されたDialectのリゾルバ + */ + public static ExtensionResolver<Dialect> getDialectResolver() { + assert dialectResolver != null; + return dialectResolver; + } + + /** + * 拡張ポイントに設定されたExporterのリゾルバを取得する。 + * + * @return 拡張ポイントに設定されたExporterのリゾルバ + */ + public static ExtensionResolver<Exporter<ExportConfig>> getExporterResolver() { + assert exporterResolver != null; + return exporterResolver; + } + + /** + * 拡張ポイントに設定されたImporterのリゾルバを取得する。 + * + * @return 拡張ポイントに設定されたImporterのリゾルバ + */ + public static ExtensionResolver<Importer<ImportConfig>> getImporterResolver() { + assert importerResolver != null; + return importerResolver; + } + + /** + * 拡張ポイントに設定されたサービスViewのリゾルバを取得する。 + * + * @return 拡張ポイントに設定されたサービスViewのリゾルバ + */ + public static ExtensionResolver<Exporter<ExportConfig>> getServiceViewResolver() { + assert exporterResolver != null; + return exporterResolver; + } + + /** + * 拡張ポイントに設定されたModelValidatorのリゾルバを取得する。 + * + * @return 拡張ポイントに設定されたModelValidatorのリゾルバ + */ + public static ExtensionResolver<ModelValidator> getValidatorResolver() { + assert validatorResolver != null; + return validatorResolver; + } + + @Override + public void start(BundleContext context) throws Exception { + super.start(context); + + plugin = this; + dialectResolver = new ExtensionResolver<Dialect>(PLUGIN_ID, "dialects", "dialect", "class"); + importerResolver = new ExtensionResolver<Importer<ImportConfig>>(PLUGIN_ID, "importers", "importer", "class"); + exporterResolver = new ExtensionResolver<Exporter<ExportConfig>>(PLUGIN_ID, "exporters", "exporter", "class"); + validatorResolver = new ExtensionResolver<ModelValidator>(PLUGIN_ID, "validators", "dialect", "class"); + } + + @Override + public void stop(BundleContext context) throws Exception { + dialectResolver = null; + importerResolver = null; + exporterResolver = null; + validatorResolver = null; + plugin = null; + + super.stop(context); + } + +} Property changes on: vesta/trunk/org.jiemamy.eclipse.core/src/main/java/org/jiemamy/eclipse/JiemamyCorePlugin.java ___________________________________________________________________ Added: svn:mime-type + text/plain Added: vesta/trunk/org.jiemamy.eclipse.core/src/main/java/org/jiemamy/eclipse/extension/ExtensionResolver.java =================================================================== --- vesta/trunk/org.jiemamy.eclipse.core/src/main/java/org/jiemamy/eclipse/extension/ExtensionResolver.java (rev 0) +++ vesta/trunk/org.jiemamy.eclipse.core/src/main/java/org/jiemamy/eclipse/extension/ExtensionResolver.java 2009-03-04 10:33:52 UTC (rev 2810) @@ -0,0 +1,154 @@ +/* + * Copyright 2007-2009 Jiemamy Project and the Others. + * Created on 2008/08/03 + * + * 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.extension; + +import java.util.ArrayList; +import java.util.List; +import java.util.Map; + +import org.apache.commons.collections15.list.UnmodifiableList; +import org.eclipse.core.runtime.CoreException; +import org.eclipse.core.runtime.IConfigurationElement; +import org.eclipse.core.runtime.ILog; +import org.eclipse.core.runtime.IStatus; +import org.eclipse.core.runtime.Plugin; +import org.eclipse.core.runtime.Status; +import org.seasar.eclipse.common.util.ExtensionAcceptor; + +import org.jiemamy.eclipse.JiemamyCorePlugin; +import org.jiemamy.utils.CollectionsUtil; + +/** + * 拡張ポイントに設定された項目の読み出しを行うクラス。 + * + * @param <T> 拡張クラスが実装すべきインターフェイス + * @author daisuke + */ +public class ExtensionResolver<T> { + + /** 拡張のMap */ + private Map<String, IConfigurationElement> extensionConfigurationElements; + + private List<T> allInstance; + + + /** + * リゾルバを初期化する。 以前読み込んだ情報を全て破棄し、拡張ポイントを読み込み直す。 + * + * <p>識別子には id 属性を使用する。</p> + * + * @param pluginId プラグインID + * @param extensionPointName 拡張ポイント名 + * @param extensionElementName 要素名 + */ + public ExtensionResolver(String pluginId, String extensionPointName, final String extensionElementName) { + this(pluginId, extensionPointName, extensionElementName, "id"); + } + + /** + * リゾルバを初期化する。 以前読み込んだ情報を全て破棄し、拡張ポイントを読み込み直す。 + * + * @param pluginId プラグインID + * @param extensionPointName 拡張ポイント名 + * @param extensionElementName 要素名 + * @param identifierAttributeName 識別子として扱う属性名 + */ + public ExtensionResolver(String pluginId, String extensionPointName, final String extensionElementName, + final String identifierAttributeName) { + extensionConfigurationElements = CollectionsUtil.newHashMap(); + + ExtensionAcceptor.accept(pluginId, extensionPointName, new ExtensionAcceptor.ExtensionVisitor() { + + public void visit(IConfigurationElement element) { + if (extensionElementName.equals(element.getName())) { + extensionConfigurationElements.put(element.getAttribute(identifierAttributeName), element); + } + } + }); + } + + /** + * 拡張ポイントのclass属性に設定された全ての実装クラスのインスタンスをリストで取得する。 + * + * @return 実装クラスのインスタンスリスト + */ + public List<T> getAllInstance() { + return getAllInstance("class"); + } + + /** + * 拡張ポイントに設定された全ての実装クラスのインスタンスをリストで取得する。 + * + * @param classAttributeName 拡張ポイント定義の属性名 + * @return 実装クラスのインスタンスリスト + */ + public List<T> getAllInstance(String classAttributeName) { + if (allInstance == null) { + List<T> result = new ArrayList<T>(); + for (String key : extensionConfigurationElements.keySet()) { + try { + result.add(getInstance(key, classAttributeName)); + } catch (CoreException e) { + Plugin plugin = JiemamyCorePlugin.getDefault(); + String symbolicName = plugin.getBundle().getSymbolicName(); + IStatus status = new Status(IStatus.ERROR, symbolicName, 0, "extension instantiation error.", e); + ILog log = plugin.getLog(); + log.log(status); + } + } + allInstance = UnmodifiableList.decorate(result); + } + return allInstance; + } + + /** + * 拡張のMapを取得する。 + * + * @return フィルタのファクトリ + */ + public Map<String, IConfigurationElement> getExtensionConfigurationElements() { + return extensionConfigurationElements; + } + + /** + * 拡張定義のclass属性に設定されたクラスのインスタンスを取得する。 + * + * @param identifier 拡張識別子 + * @return インスタンス + * @throws CoreException + */ + public T getInstance(String identifier) throws CoreException { + return getInstance(identifier, "class"); + } + + /** + * 拡張定義に設定されたクラスのインスタンスを取得する。 + * + * @param identifier 拡張識別子 + * @param classAttributeName クラス名が記述されている属性名 + * @return インスタンス + * @throws CoreException + */ + public T getInstance(String identifier, String classAttributeName) throws CoreException { + @SuppressWarnings("unchecked") + // TODO キャスト安全性の根拠提示 + T instance = (T) extensionConfigurationElements.get(identifier).createExecutableExtension(classAttributeName); + return instance; + } +} Added: vesta/trunk/org.jiemamy.eclipse.core/src/main/java/org/jiemamy/eclipse/extension/validator/ModelValidator.java =================================================================== --- vesta/trunk/org.jiemamy.eclipse.core/src/main/java/org/jiemamy/eclipse/extension/validator/ModelValidator.java (rev 0) +++ vesta/trunk/org.jiemamy.eclipse.core/src/main/java/org/jiemamy/eclipse/extension/validator/ModelValidator.java 2009-03-04 10:33:52 UTC (rev 2810) @@ -0,0 +1,40 @@ +/* + * Copyright 2007-2009 Jiemamy Project and the Others. + * Created on 2008/07/15 + * + * 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.extension.validator; + +import org.eclipse.core.resources.IResource; + +import org.jiemamy.model.RootModel; + +/** + * 検証ロジックインターフェイス。 + * + * @author daisuke + */ +public interface ModelValidator { + + /** + * モデルの検証を行う。 + * + * @param resource + * @param rootModel + */ + void validate(IResource resource, RootModel rootModel); + +} Modified: zeus/trunk/jiemamy-spec-core/src/main/java/org/jiemamy/JiemamyFactory.java =================================================================== --- zeus/trunk/jiemamy-spec-core/src/main/java/org/jiemamy/JiemamyFactory.java 2009-03-03 18:33:18 UTC (rev 2809) +++ zeus/trunk/jiemamy-spec-core/src/main/java/org/jiemamy/JiemamyFactory.java 2009-03-04 10:33:52 UTC (rev 2810) @@ -33,7 +33,7 @@ import org.jiemamy.model.entity.TableModel; import org.jiemamy.model.entity.TableRef; import org.jiemamy.serializer.JiemamySerializer; -import org.jiemamy.utils.builder.PrematureBuilder; +import org.jiemamy.utils.builder.JiemamyBuilder; /** * Jiemamy関連のインスタンスを生成するファクトリインターフェイス。 @@ -96,7 +96,7 @@ * @param clazz 生成したいモデルの型 * @return モデルビルダ */ - <M, B extends PrematureBuilder<M>>B newBuilder(Class<B> clazz); + <M extends JiemamyElement, B extends JiemamyBuilder<M>>B newBuilder(Class<B> clazz); /** * 鋳型情報から、 {@link BuiltinDataType}のインスタンスを生成する。 Modified: zeus/trunk/jiemamy-spec-core/src/main/java/org/jiemamy/dialect/Dialect.java =================================================================== --- zeus/trunk/jiemamy-spec-core/src/main/java/org/jiemamy/dialect/Dialect.java 2009-03-03 18:33:18 UTC (rev 2809) +++ zeus/trunk/jiemamy-spec-core/src/main/java/org/jiemamy/dialect/Dialect.java 2009-03-04 10:33:52 UTC (rev 2810) @@ -21,6 +21,7 @@ import java.sql.DatabaseMetaData; import java.sql.ResultSet; import java.sql.SQLException; +import java.util.ArrayList; import java.util.Collection; import java.util.List; @@ -68,9 +69,20 @@ */ List<SqlStatement> emitStatements(RootModel rootModel, EmitConfig config); + BuiltinDataTypeMold findDataTypeMold(DataTypeCategory category); + /** * 指定したカテゴリ、型名に最も適したモールドを取得する。 * + * <p><ol> + * <li>カテゴリと型名が完全一致するモールドがあれば、それを返す。</li> + * <li>見つからなければ、次に、型名が完全一致するモールドがあれば、それを返す。</li> + * <li>さらに見つからなければ、カテゴリが一致する中で、先に定義されているモールドを返す。</li> + * <li>与えられたカテゴリに該当する型がひとつもマッピングされていない場合は、 {@link BuiltinDataTypeMold#UNKNOWN}を返す。</li> + * </ol></p> + * + * <p>{@code null}を返してはならない。</p> + * * @param category 型カテゴリ * @param typeName 型名 * @return モールド @@ -108,6 +120,8 @@ /** * モデルのバリデータを取得する。 * + * <p>{@code null}を返してはならない。</p> + * * @return モデルのバリデータ */ Validator getValidator(); @@ -140,6 +154,24 @@ */ public interface BuiltinDataTypeMold { + /** 不明なモールド */ + BuiltinDataTypeMold UNKNOWN = new BuiltinDataTypeMold() { + + public DataTypeCategory getCategory() { + return DataTypeCategory.OTHER; + } + + public Collection<Class<?>> getSupportedAdapterClasses() { + return new ArrayList<Class<?>>(); + } + + public String getTypeName() { + return "UNKNOWN"; + } + + }; + + /** * データ型カテゴリを取得する。 * Modified: zeus/trunk/jiemamy-spec-core/src/main/java/org/jiemamy/facade/JiemamyFacade.java =================================================================== --- zeus/trunk/jiemamy-spec-core/src/main/java/org/jiemamy/facade/JiemamyFacade.java 2009-03-03 18:33:18 UTC (rev 2809) +++ zeus/trunk/jiemamy-spec-core/src/main/java/org/jiemamy/facade/JiemamyFacade.java 2009-03-04 10:33:52 UTC (rev 2810) @@ -90,6 +90,7 @@ * モデルの状態をセーブポイントまでロールバックする。 * * @param savePoint セーブポイント + * @throws IllegalArgumentException このファサードが発行したs{@link SavePoint}でない場合 */ void rollback(SavePoint savePoint); Modified: zeus/trunk/jiemamy-spec-core/src/main/java/org/jiemamy/facade/SavePoint.java =================================================================== --- zeus/trunk/jiemamy-spec-core/src/main/java/org/jiemamy/facade/SavePoint.java 2009-03-03 18:33:18 UTC (rev 2809) +++ zeus/trunk/jiemamy-spec-core/src/main/java/org/jiemamy/facade/SavePoint.java 2009-03-04 10:33:52 UTC (rev 2810) @@ -19,8 +19,10 @@ package org.jiemamy.facade; /** - * TODO for daisuke + * セーブポイント情報を保持するインターフェイス。 * + * <p>実装はイミュータブルでなければならない。</p> + * * @author daisuke */ public interface SavePoint { Added: zeus/trunk/jiemamy-spec-core/src/main/java/org/jiemamy/utils/builder/ColumnBuilder.java =================================================================== --- zeus/trunk/jiemamy-spec-core/src/main/java/org/jiemamy/utils/builder/ColumnBuilder.java (rev 0) +++ zeus/trunk/jiemamy-spec-core/src/main/java/org/jiemamy/utils/builder/ColumnBuilder.java 2009-03-04 10:33:52 UTC (rev 2810) @@ -0,0 +1,28 @@ +/* + * Copyright 2007-2009 Jiemamy Project and the Others. + * Created on 2009/03/04 + * + * 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.builder; + +/** + * TODO for daisuke + * + * @author daisuke + */ +public interface ColumnBuilder { + +} Added: zeus/trunk/jiemamy-spec-core/src/main/java/org/jiemamy/utils/builder/DataTypeBuilder.java =================================================================== --- zeus/trunk/jiemamy-spec-core/src/main/java/org/jiemamy/utils/builder/DataTypeBuilder.java (rev 0) +++ zeus/trunk/jiemamy-spec-core/src/main/java/org/jiemamy/utils/builder/DataTypeBuilder.java 2009-03-04 10:33:52 UTC (rev 2810) @@ -0,0 +1,63 @@ +/* + * Copyright 2007-2009 Jiemamy Project and the Others. + * Created on 2009/03/04 + * + * 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.builder; + +import org.jiemamy.exception.JiemamyRuntimeException; +import org.jiemamy.model.datatype.BuiltinDataType; + +/** + * TODO for daisuke + * + * @author daisuke + */ +public interface DataTypeBuilder { + + /** + * モデルを構築する。 + * + * @return model 構築されたモデル + * @throws JiemamyRuntimeException + */ + BuiltinDataType build(); + + /** + * TODO for daisuke + * + * @param precision + * @return + */ + DataTypeBuilder setPrecision(int precision); + + /** + * TODO for daisuke + * + * @param scale + * @return + */ + DataTypeBuilder setScale(int scale); + + /** + * TODO for daisuke + * + * @param size + * @return + */ + DataTypeBuilder setSize(int size); + +} Property changes on: zeus/trunk/jiemamy-spec-core/src/main/java/org/jiemamy/utils/builder/DataTypeBuilder.java ___________________________________________________________________ Added: svn:mime-type + text/plain Added: zeus/trunk/jiemamy-spec-core/src/main/java/org/jiemamy/utils/builder/ForeignKeyBuilder.java =================================================================== --- zeus/trunk/jiemamy-spec-core/src/main/java/org/jiemamy/utils/builder/ForeignKeyBuilder.java (rev 0) +++ zeus/trunk/jiemamy-spec-core/src/main/java/org/jiemamy/utils/builder/ForeignKeyBuilder.java 2009-03-04 10:33:52 UTC (rev 2810) @@ -0,0 +1,58 @@ +/* + * Copyright 2007-2009 Jiemamy Project and the Others. + * Created on 2009/03/04 + * + * 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.builder; + +import org.jiemamy.exception.ElementNotFoundException; +import org.jiemamy.exception.ModelConsistenceException; +import org.jiemamy.model.attribute.ColumnModel; +import org.jiemamy.model.attribute.ColumnRef; +import org.jiemamy.model.attribute.constraint.ForeignKeyModel; + +/** + * TODO for daisuke + * + * @author daisuke + */ +public interface ForeignKeyBuilder extends JiemamyBuilder<ForeignKeyModel> { + + /** + * カラム同士のマッピングを設定する。 + * + * @param keyColumn 参照元テーブルの「制約を受けるカラム」の一つ + * @param referenceColumn 参照先テーブルの主キーカラムの一つ + * @return {@code this} + * @throws ElementNotFoundException referenceColumnが、所属テーブルにおいてキー指定されていない場合 + * @throws IllegalArgumentException 引数に{@code null}を与えた場合 + * @throws ModelConsistenceException foreignKeyColumnがconstraintTableに所属していない場合 + * @throws ModelConsistenceException keyColumnがreferenceTableに所属していない場合 + */ + ForeignKeyBuilder mapping(ColumnModel keyColumn, ColumnModel referenceColumn); + + /** + * カラム同士のマッピングを設定する。 + * + * @param keyColumn 参照元テーブルの「制約を受けるカラム」の一つ + * @param referenceColumn 参照先テーブルの主キーカラムの一つ + * @return {@code this} + * @throws ElementNotFoundException referenceColumnが、所属テーブルにおいて主キー指定されていない場合 + * @throws IllegalArgumentException 引数に{@code null}を与えた場合 + */ + ForeignKeyBuilder mapping(ColumnRef keyColumn, ColumnRef referenceColumn); + +} Copied: zeus/trunk/jiemamy-spec-core/src/main/java/org/jiemamy/utils/builder/JiemamyBuilder.java (from rev 2809, zeus/trunk/jiemamy-spec-core/src/main/java/org/jiemamy/utils/builder/MaturedBuilder.java) =================================================================== --- zeus/trunk/jiemamy-spec-core/src/main/java/org/jiemamy/utils/builder/JiemamyBuilder.java (rev 0) +++ zeus/trunk/jiemamy-spec-core/src/main/java/org/jiemamy/utils/builder/JiemamyBuilder.java 2009-03-04 10:33:52 UTC (rev 2810) @@ -0,0 +1,40 @@ +/* + * Copyright 2007-2009 MIYAMOTO Daisuke, jiemamy.org and the Others. + * Created on 2009/01/01 + * + * 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.builder; + +import org.jiemamy.exception.JiemamyRuntimeException; +import org.jiemamy.model.JiemamyElement; + +/** + * TODO for daisuke + * + * @param <T> + * @author daisuke + */ +public interface JiemamyBuilder<T extends JiemamyElement> { + + /** + * モデルを構築する。 + * + * @return model 構築されたモデル + * @throws JiemamyRuntimeException + */ + T build(); + +} Property changes on: zeus/trunk/jiemamy-spec-core/src/main/java/org/jiemamy/utils/builder/JiemamyBuilder.java ___________________________________________________________________ Added: svn:mime-type + text/plain Deleted: zeus/trunk/jiemamy-spec-core/src/main/java/org/jiemamy/utils/builder/MaturedBuilder.java =================================================================== --- zeus/trunk/jiemamy-spec-core/src/main/java/org/jiemamy/utils/builder/MaturedBuilder.java 2009-03-03 18:33:18 UTC (rev 2809) +++ zeus/trunk/jiemamy-spec-core/src/main/java/org/jiemamy/utils/builder/MaturedBuilder.java 2009-03-04 10:33:52 UTC (rev 2810) @@ -1,35 +0,0 @@ -/* - * Copyright 2007-2009 MIYAMOTO Daisuke, jiemamy.org and the Others. - * Created on 2009/01/01 - * - * 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.builder; - -/** - * TODO for daisuke - * - * @param <T> - * @author daisuke - */ -public interface MaturedBuilder<T> extends PrematureBuilder<T> { - - /** - * モデルを構築する。 - * - * @return model 構築されたモデル - */ - T build(); -} Deleted: zeus/trunk/jiemamy-spec-core/src/main/java/org/jiemamy/utils/builder/MaturedTableBuilder.java =================================================================== --- zeus/trunk/jiemamy-spec-core/src/main/java/org/jiemamy/utils/builder/MaturedTableBuilder.java 2009-03-03 18:33:18 UTC (rev 2809) +++ zeus/trunk/jiemamy-spec-core/src/main/java/org/jiemamy/utils/builder/MaturedTableBuilder.java 2009-03-04 10:33:52 UTC (rev 2810) @@ -1,35 +0,0 @@ -/* - * Copyright 2007-2009 MIYAMOTO Daisuke, jiemamy.org and the Others. - * Created on 2009/01/01 - * - * 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.builder; - -import org.jiemamy.model.attribute.ColumnModel; -import org.jiemamy.model.entity.TableModel; - -/** - * TODO for daisuke - * - * @author daisuke - */ -public interface MaturedTableBuilder extends MaturedBuilder<TableModel> { - - MaturedTableBuilder addColumn(ColumnModel column); - - MaturedTableBuilder setName(String name); - -} Deleted: zeus/trunk/jiemamy-spec-core/src/main/java/org/jiemamy/utils/builder/PrematureBuilder.java =================================================================== --- zeus/trunk/jiemamy-spec-core/src/main/java/org/jiemamy/utils/builder/PrematureBuilder.java 2009-03-03 18:33:18 UTC (rev 2809) +++ zeus/trunk/jiemamy-spec-core/src/main/java/org/jiemamy/utils/builder/PrematureBuilder.java 2009-03-04 10:33:52 UTC (rev 2810) @@ -1,37 +0,0 @@ -/* - * Copyright 2007-2009 MIYAMOTO Daisuke, jiemamy.org and the Others. - * Created on 2009/01/01 - * - * 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.builder; - -import org.jiemamy.JiemamyFactory; - -/** - * TODO for daisuke - * - * @param <T> - * @author daisuke - */ -public interface PrematureBuilder<T> { - - /** - * TODO for daisuke - * - * @param factory - */ - void setFactory(JiemamyFactory factory); -} Deleted: zeus/trunk/jiemamy-spec-core/src/main/java/org/jiemamy/utils/builder/PrematureTableBuilder.java =================================================================== --- zeus/trunk/jiemamy-spec-core/src/main/java/org/jiemamy/utils/builder/PrematureTableBuilder.java 2009-03-03 18:33:18 UTC (rev 2809) +++ zeus/trunk/jiemamy-spec-core/src/main/java/org/jiemamy/utils/builder/PrematureTableBuilder.java 2009-03-04 10:33:52 UTC (rev 2810) @@ -1,35 +0,0 @@ -/* - * Copyright 2007-2009 MIYAMOTO Daisuke, jiemamy.org and the Others. - * Created on 2009/01/01 - * - * 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.builder; - -import org.jiemamy.model.attribute.ColumnModel; -import org.jiemamy.model.entity.TableModel; - -/** - * TODO for daisuke - * - * @author daisuke - */ -public interface PrematureTableBuilder extends PrematureBuilder<TableModel> { - - PrematureTableBuilder addColumn(ColumnModel column); - - MaturedTableBuilder setName(String name); - -} Copied: zeus/trunk/jiemamy-spec-core/src/main/java/org/jiemamy/utils/builder/TableBuilder.java (from rev 2809, zeus/trunk/jiemamy-spec-core/src/main/java/org/jiemamy/utils/builder/MaturedTableBuilder.java) =================================================================== --- zeus/trunk/jiemamy-spec-core/src/main/java/org/jiemamy/utils/builder/TableBuilder.java (rev 0) +++ zeus/trunk/jiemamy-spec-core/src/main/java/org/jiemamy/utils/builder/TableBuilder.java 2009-03-04 10:33:52 UTC (rev 2810) @@ -0,0 +1,57 @@ +/* + * Copyright 2007-2009 MIYAMOTO Daisuke, jiemamy.org and the Others. + * Created on 2009/01/01 + * + * 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.builder; + +import org.jiemamy.model.attribute.ColumnModel; +import org.jiemamy.model.entity.TableModel; + +/** + * TODO for daisuke + * + * @author daisuke + */ +public interface TableBuilder extends JiemamyBuilder<TableModel> { + + /** + * カラムを追加する。 + * + * @param column 追加するカラム + * @return {@code this} + */ + TableBuilder addColumn(ColumnModel column); + + /** + * 主キーをカラムのインデックスで指定する。 + * + * @param index + * @param otherIndexes + * @return this + * @throws IndexOutOfBoundsException 指定したインデックスのカラムが存在しない場合。 + */ + TableBuilder primaryKey(int index, int... otherIndexes); + + /** + * テーブル名を設定する。 + * + * @param name テーブル名 + * @return {@code this} + */ + TableBuilder setName(String name); + +} Property changes on: zeus/trunk/jiemamy-spec-core/src/main/java/org/jiemamy/utils/builder/TableBuilder.java ___________________________________________________________________ Added: svn:mime-type + text/plain Added: zeus/trunk/jiemamy-spec-core/src/main/java/org/jiemamy/utils/builder/ViewBuilder.java =================================================================== --- zeus/trunk/jiemamy-spec-core/src/main/java/org/jiemamy/utils/builder/ViewBuilder.java (rev 0) +++ zeus/trunk/jiemamy-spec-core/src/main/java/org/jiemamy/utils/builder/ViewBuilder.java 2009-03-04 10:33:52 UTC (rev 2810) @@ -0,0 +1,46 @@ +/* + * Copyright 2007-2009 MIYAMOTO Daisuke, jiemamy.org and the Others. + * Created on 2009/01/01 + * + * 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.builder; + +import org.jiemamy.model.entity.ViewModel; + +/** + * TODO for daisuke + * + * @author daisuke + */ +public interface ViewBuilder extends JiemamyBuilder<ViewModel> { + + /** + * VIEW定義SELECT文を設定する。 + * + * @param definition VIEW定義SELECT文 + * @return {@code this} + */ + ViewBuilder definition(String definition); + + /** + * ビュー名を設定する。 + * + * @param name ビュー名 + * @return {@code this} + */ + ViewBuilder setName(String name); + +} Property changes on: zeus/trunk/jiemamy-spec-core/src/main/java/org/jiemamy/utils/builder/ViewBuilder.java ___________________________________________________________________ Added: svn:mime-type + text/plain