svnno****@sourc*****
svnno****@sourc*****
2008年 11月 6日 (木) 18:34:02 JST
Revision: 2095 http://svn.sourceforge.jp/cgi-bin/viewcvs.cgi?root=jiemamy&view=rev&rev=2095 Author: daisuke_m Date: 2008-11-06 18:34:02 +0900 (Thu, 06 Nov 2008) Log Message: ----------- Eclipse用のDialectInstanceCreationStrategyを実装。なんか微妙だな。 Modified Paths: -------------- artemis/trunk/org.jiemamy.serializer/src/main/java/org/jiemamy/serializer/DefaultDialectInstanceCreationStrategy.java artemis/trunk/org.jiemamy.serializer/src/main/java/org/jiemamy/serializer/JiemamySerializerFactory.java artemis/trunk/org.jiemamy.serializer/src/main/java/org/jiemamy/serializer/JiemamySerializerImpl.java artemis/trunk/org.jiemamy.serializer/src/main/java/org/jiemamy/serializer/sax/JiemamyHandler.java artemis/trunk/org.jiemamy.serializer/src/main/java/org/jiemamy/serializer/sax/JiemamySaxReader.java artemis/trunk/org.jiemamy.serializer/src/main/java/org/jiemamy/serializer/sax/ModelInfo.java artemis/trunk/org.jiemamy.serializer/src/test/java/org/jiemamy/serializer/sax/JiemamySaxReaderTest.java vesta/trunk/org.jiemamy.eclipse/src/main/java/org/jiemamy/eclipse/editor/DiagramEditor.java vesta/trunk/org.jiemamy.eclipse/src/main/java/org/jiemamy/eclipse/editor/MultiDiagramEditor.java vesta/trunk/org.jiemamy.eclipse/src/main/java/org/jiemamy/eclipse/wizard/NewDiagramWizard.java Added Paths: ----------- artemis/trunk/org.jiemamy.serializer/src/main/java/org/jiemamy/serializer/DialectInstanceCreationStrategy.java vesta/trunk/org.jiemamy.eclipse/src/main/java/org/jiemamy/eclipse/EclipseDialectInstanceCreationStrategy.java Removed Paths: ------------- artemis/trunk/org.jiemamy.serializer/src/main/java/org/jiemamy/serializer/sax/DialectInstanceCreationStrategy.java -------------- next part -------------- Modified: artemis/trunk/org.jiemamy.serializer/src/main/java/org/jiemamy/serializer/DefaultDialectInstanceCreationStrategy.java =================================================================== --- artemis/trunk/org.jiemamy.serializer/src/main/java/org/jiemamy/serializer/DefaultDialectInstanceCreationStrategy.java 2008-11-06 09:14:44 UTC (rev 2094) +++ artemis/trunk/org.jiemamy.serializer/src/main/java/org/jiemamy/serializer/DefaultDialectInstanceCreationStrategy.java 2008-11-06 09:34:02 UTC (rev 2095) @@ -18,7 +18,6 @@ */ package org.jiemamy.serializer; -import org.jiemamy.serializer.sax.DialectInstanceCreationStrategy; import org.jiemamy.spec.exception.JiemamyRuntimeException; import org.jiemamy.spec.extension.dialect.Dialect; Copied: artemis/trunk/org.jiemamy.serializer/src/main/java/org/jiemamy/serializer/DialectInstanceCreationStrategy.java (from rev 2094, artemis/trunk/org.jiemamy.serializer/src/main/java/org/jiemamy/serializer/sax/DialectInstanceCreationStrategy.java) =================================================================== --- artemis/trunk/org.jiemamy.serializer/src/main/java/org/jiemamy/serializer/DialectInstanceCreationStrategy.java (rev 0) +++ artemis/trunk/org.jiemamy.serializer/src/main/java/org/jiemamy/serializer/DialectInstanceCreationStrategy.java 2008-11-06 09:34:02 UTC (rev 2095) @@ -0,0 +1,37 @@ +/* + * Copyright 2007-2008 MIYAMOTO Daisuke, jiemamy.org and the Others. + * Created on 2008/11/05 + * + * 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.serializer; + +import org.jiemamy.spec.extension.dialect.Dialect; + +/** + * TODO for ykhr + * @author ykhr + */ +public interface DialectInstanceCreationStrategy { + + /** + * TODO for ykhr + * @param fqcn + * @return + * @throws ClassNotFoundException + */ + Dialect create(String fqcn) throws ClassNotFoundException; + +} Property changes on: artemis/trunk/org.jiemamy.serializer/src/main/java/org/jiemamy/serializer/DialectInstanceCreationStrategy.java ___________________________________________________________________ Name: svn:mime-type + text/plain Modified: artemis/trunk/org.jiemamy.serializer/src/main/java/org/jiemamy/serializer/JiemamySerializerFactory.java =================================================================== --- artemis/trunk/org.jiemamy.serializer/src/main/java/org/jiemamy/serializer/JiemamySerializerFactory.java 2008-11-06 09:14:44 UTC (rev 2094) +++ artemis/trunk/org.jiemamy.serializer/src/main/java/org/jiemamy/serializer/JiemamySerializerFactory.java 2008-11-06 09:34:02 UTC (rev 2095) @@ -22,7 +22,7 @@ * JiemamySerializerのインスタンスを生成するためのファクトリ。 * @author daisuke */ -public class JiemamySerializerFactory { +public final class JiemamySerializerFactory { private static volatile JiemamySerializer singleton; @@ -39,6 +39,18 @@ } /** + * 新しい {@link JiemamySerializer} のインスタンスを取得する。 + * @param strategy + * @return {@link JiemamySerializer}のインスタンス。 + */ + public static JiemamySerializer getInstance(DialectInstanceCreationStrategy strategy) { + if (singleton == null) { + singleton = new JiemamySerializerImpl(strategy); + } + return singleton; + } + + /** * privateコンストラクタ。 * @category instance creation */ Modified: artemis/trunk/org.jiemamy.serializer/src/main/java/org/jiemamy/serializer/JiemamySerializerImpl.java =================================================================== --- artemis/trunk/org.jiemamy.serializer/src/main/java/org/jiemamy/serializer/JiemamySerializerImpl.java 2008-11-06 09:14:44 UTC (rev 2094) +++ artemis/trunk/org.jiemamy.serializer/src/main/java/org/jiemamy/serializer/JiemamySerializerImpl.java 2008-11-06 09:34:02 UTC (rev 2095) @@ -22,7 +22,6 @@ import org.apache.commons.lang.SerializationException; -import org.jiemamy.serializer.sax.DialectInstanceCreationStrategy; import org.jiemamy.serializer.sax.JiemamySaxReader; import org.jiemamy.spec.model.RootModel; Deleted: artemis/trunk/org.jiemamy.serializer/src/main/java/org/jiemamy/serializer/sax/DialectInstanceCreationStrategy.java =================================================================== --- artemis/trunk/org.jiemamy.serializer/src/main/java/org/jiemamy/serializer/sax/DialectInstanceCreationStrategy.java 2008-11-06 09:14:44 UTC (rev 2094) +++ artemis/trunk/org.jiemamy.serializer/src/main/java/org/jiemamy/serializer/sax/DialectInstanceCreationStrategy.java 2008-11-06 09:34:02 UTC (rev 2095) @@ -1,37 +0,0 @@ -/* - * Copyright 2007-2008 MIYAMOTO Daisuke, jiemamy.org and the Others. - * Created on 2008/11/05 - * - * 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.serializer.sax; - -import org.jiemamy.spec.extension.dialect.Dialect; - -/** - * TODO for ykhr - * @author ykhr - */ -public interface DialectInstanceCreationStrategy { - - /** - * TODO for ykhr - * @param fqcn - * @return - * @throws ClassNotFoundException - */ - Dialect create(String fqcn) throws ClassNotFoundException; - -} Modified: artemis/trunk/org.jiemamy.serializer/src/main/java/org/jiemamy/serializer/sax/JiemamyHandler.java =================================================================== --- artemis/trunk/org.jiemamy.serializer/src/main/java/org/jiemamy/serializer/sax/JiemamyHandler.java 2008-11-06 09:14:44 UTC (rev 2094) +++ artemis/trunk/org.jiemamy.serializer/src/main/java/org/jiemamy/serializer/sax/JiemamyHandler.java 2008-11-06 09:34:02 UTC (rev 2095) @@ -25,6 +25,7 @@ import org.jiemamy.core.S2FactoryStrategy; import org.jiemamy.creator.JiemamyModelFactory; +import org.jiemamy.serializer.DialectInstanceCreationStrategy; import org.jiemamy.spec.model.RootModel; /** Modified: artemis/trunk/org.jiemamy.serializer/src/main/java/org/jiemamy/serializer/sax/JiemamySaxReader.java =================================================================== --- artemis/trunk/org.jiemamy.serializer/src/main/java/org/jiemamy/serializer/sax/JiemamySaxReader.java 2008-11-06 09:14:44 UTC (rev 2094) +++ artemis/trunk/org.jiemamy.serializer/src/main/java/org/jiemamy/serializer/sax/JiemamySaxReader.java 2008-11-06 09:34:02 UTC (rev 2095) @@ -29,6 +29,7 @@ import org.xml.sax.SAXException; import org.jiemamy.serializer.DefaultDialectInstanceCreationStrategy; +import org.jiemamy.serializer.DialectInstanceCreationStrategy; import org.jiemamy.spec.model.RootModel; /** Modified: artemis/trunk/org.jiemamy.serializer/src/main/java/org/jiemamy/serializer/sax/ModelInfo.java =================================================================== --- artemis/trunk/org.jiemamy.serializer/src/main/java/org/jiemamy/serializer/sax/ModelInfo.java 2008-11-06 09:14:44 UTC (rev 2094) +++ artemis/trunk/org.jiemamy.serializer/src/main/java/org/jiemamy/serializer/sax/ModelInfo.java 2008-11-06 09:34:02 UTC (rev 2095) @@ -18,6 +18,7 @@ */ package org.jiemamy.serializer.sax; +import org.jiemamy.serializer.DialectInstanceCreationStrategy; import org.jiemamy.spec.model.ColumnModel; import org.jiemamy.spec.model.RootModel; import org.jiemamy.spec.model.node.TableModel; Modified: artemis/trunk/org.jiemamy.serializer/src/test/java/org/jiemamy/serializer/sax/JiemamySaxReaderTest.java =================================================================== --- artemis/trunk/org.jiemamy.serializer/src/test/java/org/jiemamy/serializer/sax/JiemamySaxReaderTest.java 2008-11-06 09:14:44 UTC (rev 2094) +++ artemis/trunk/org.jiemamy.serializer/src/test/java/org/jiemamy/serializer/sax/JiemamySaxReaderTest.java 2008-11-06 09:34:02 UTC (rev 2095) @@ -28,6 +28,7 @@ import org.junit.Before; import org.junit.Test; +import org.jiemamy.serializer.DialectInstanceCreationStrategy; import org.jiemamy.spec.extension.dialect.Dialect; import org.jiemamy.spec.model.ColumnModel; import org.jiemamy.spec.model.RootModel; Added: vesta/trunk/org.jiemamy.eclipse/src/main/java/org/jiemamy/eclipse/EclipseDialectInstanceCreationStrategy.java =================================================================== --- vesta/trunk/org.jiemamy.eclipse/src/main/java/org/jiemamy/eclipse/EclipseDialectInstanceCreationStrategy.java (rev 0) +++ vesta/trunk/org.jiemamy.eclipse/src/main/java/org/jiemamy/eclipse/EclipseDialectInstanceCreationStrategy.java 2008-11-06 09:34:02 UTC (rev 2095) @@ -0,0 +1,44 @@ +/* + * Copyright 2007-2008 MIYAMOTO Daisuke, jiemamy.org and the Others. + * Created on 2008/11/06 + * + * 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 org.eclipse.core.runtime.CoreException; + +import org.jiemamy.serializer.DialectInstanceCreationStrategy; +import org.jiemamy.spec.exception.JiemamyRuntimeException; +import org.jiemamy.spec.extension.dialect.Dialect; + +/** + * TODO for daisuke + * @author daisuke + */ +public class EclipseDialectInstanceCreationStrategy implements DialectInstanceCreationStrategy { + + /** + * {@inheritDoc} + */ + public Dialect create(String fqcn) { + try { + return JiemamyPlugin.getDialectResolver().getInstance(fqcn); + } catch (CoreException e) { + throw new JiemamyRuntimeException(e); + } + } + +} Property changes on: vesta/trunk/org.jiemamy.eclipse/src/main/java/org/jiemamy/eclipse/EclipseDialectInstanceCreationStrategy.java ___________________________________________________________________ Name: svn:mime-type + text/plain Modified: vesta/trunk/org.jiemamy.eclipse/src/main/java/org/jiemamy/eclipse/editor/DiagramEditor.java =================================================================== --- vesta/trunk/org.jiemamy.eclipse/src/main/java/org/jiemamy/eclipse/editor/DiagramEditor.java 2008-11-06 09:14:44 UTC (rev 2094) +++ vesta/trunk/org.jiemamy.eclipse/src/main/java/org/jiemamy/eclipse/editor/DiagramEditor.java 2008-11-06 09:34:02 UTC (rev 2095) @@ -87,6 +87,7 @@ import org.eclipse.ui.views.contentoutline.IContentOutlinePage; import org.jiemamy.creator.JiemamyModelFactory; +import org.jiemamy.eclipse.EclipseDialectInstanceCreationStrategy; import org.jiemamy.eclipse.editor.editpart.DiagramEditPartFactory; import org.jiemamy.eclipse.editor.editpart.DoubleClickSupport; import org.jiemamy.eclipse.editor.editpart.OutlineTreeEditPartFactory; @@ -159,7 +160,8 @@ try { IFile file = ((IFileEditorInput) getEditorInput()).getFile(); RootModel rootModel = (RootModel) getGraphicalViewer().getContents().getModel(); - JiemamySerializer serializer = JiemamySerializerFactory.getInstance(); + JiemamySerializer serializer = + JiemamySerializerFactory.getInstance(new EclipseDialectInstanceCreationStrategy()); InputStream stream = serializer.serialize(rootModel); file.setContents(stream, true, true, monitor); getCommandStack().markSaveLocation(); @@ -191,7 +193,9 @@ public void execute(IProgressMonitor monitor) { try { RootModel rootModel = (RootModel) getGraphicalViewer().getContents().getModel(); - JiemamySerializer serializer = JiemamySerializerFactory.getInstance(); + JiemamySerializer serializer = + JiemamySerializerFactory + .getInstance(new EclipseDialectInstanceCreationStrategy()); InputStream stream = serializer.serialize(rootModel); file.create(stream, true, monitor); } catch (Exception e) { @@ -439,7 +443,8 @@ // 最上位モデルの設定 IFile file = ((IFileEditorInput) getEditorInput()).getFile(); - JiemamySerializer serializer = JiemamySerializerFactory.getInstance(); + JiemamySerializer serializer = + JiemamySerializerFactory.getInstance(new EclipseDialectInstanceCreationStrategy()); try { rootModel = serializer.deserialize(file.getContents()); // rootModel.setDisplayMode(DatabaseModel.MODE_PHYSICAL_ATTRTYPE); Modified: vesta/trunk/org.jiemamy.eclipse/src/main/java/org/jiemamy/eclipse/editor/MultiDiagramEditor.java =================================================================== --- vesta/trunk/org.jiemamy.eclipse/src/main/java/org/jiemamy/eclipse/editor/MultiDiagramEditor.java 2008-11-06 09:14:44 UTC (rev 2094) +++ vesta/trunk/org.jiemamy.eclipse/src/main/java/org/jiemamy/eclipse/editor/MultiDiagramEditor.java 2008-11-06 09:34:02 UTC (rev 2095) @@ -43,6 +43,7 @@ import org.seasar.framework.util.tiger.CollectionsUtil; import org.jiemamy.creator.JiemamyModelFactory; +import org.jiemamy.eclipse.EclipseDialectInstanceCreationStrategy; import org.jiemamy.eclipse.utils.ExceptionHandler; import org.jiemamy.serializer.JiemamySerializer; import org.jiemamy.serializer.JiemamySerializerFactory; @@ -86,7 +87,8 @@ public void doSave(IProgressMonitor monitor) { try { IFile file = ((IFileEditorInput) getEditorInput()).getFile(); - JiemamySerializer serializer = JiemamySerializerFactory.getInstance(); + JiemamySerializer serializer = + JiemamySerializerFactory.getInstance(new EclipseDialectInstanceCreationStrategy()); InputStream stream = serializer.serialize(rootModel); file.setContents(stream, true, true, monitor); for (DiagramEditor2 editor : editors) { @@ -119,7 +121,9 @@ @Override public void execute(IProgressMonitor monitor) { try { - JiemamySerializer serializer = JiemamySerializerFactory.getInstance(); + JiemamySerializer serializer = + JiemamySerializerFactory + .getInstance(new EclipseDialectInstanceCreationStrategy()); InputStream stream = serializer.serialize(rootModel); file.create(stream, true, monitor); } catch (Exception e) { @@ -158,7 +162,8 @@ // 最上位モデルの設定 IFile file = ((IFileEditorInput) input).getFile(); - JiemamySerializer serializer = JiemamySerializerFactory.getInstance(); + JiemamySerializer serializer = + JiemamySerializerFactory.getInstance(new EclipseDialectInstanceCreationStrategy()); try { rootModel = serializer.deserialize(file.getContents()); // rootModel.setDisplayMode(DatabaseModel.MODE_PHYSICAL_ATTRTYPE); 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 2008-11-06 09:14:44 UTC (rev 2094) +++ vesta/trunk/org.jiemamy.eclipse/src/main/java/org/jiemamy/eclipse/wizard/NewDiagramWizard.java 2008-11-06 09:34:02 UTC (rev 2095) @@ -32,9 +32,10 @@ import org.jiemamy.core.S2FactoryStrategy; import org.jiemamy.creator.JiemamyModelFactory; +import org.jiemamy.eclipse.EclipseDialectInstanceCreationStrategy; import org.jiemamy.eclipse.utils.ExceptionHandler; import org.jiemamy.serializer.JiemamySerializer; -import org.jiemamy.serializer.JiemamySerializerImpl; +import org.jiemamy.serializer.JiemamySerializerFactory; import org.jiemamy.spec.model.RootModel; /** @@ -124,7 +125,7 @@ setTitle(Messages.Wizard_Title); setMessage(Messages.Wizard_Message); // setFileName("jiemamy.jer"); - serializer = (new JiemamySerializerImpl()); // FIXME serializer完成し次第、Implに切り替え。 + serializer = JiemamySerializerFactory.getInstance(new EclipseDialectInstanceCreationStrategy()); } /**