[Jiemamy-notify] commit [1976] インスタンス生成メカニズムを整理。

Back to archive index

svnno****@sourc***** svnno****@sourc*****
2008年 9月 30日 (火) 02:37:16 JST


Revision: 1976
          http://svn.sourceforge.jp/cgi-bin/viewcvs.cgi?root=jiemamy&view=rev&rev=1976
Author:   daisuke_m
Date:     2008-09-30 02:37:16 +0900 (Tue, 30 Sep 2008)

Log Message:
-----------
インスタンス生成メカニズムを整理。

Modified Paths:
--------------
    artemis/trunk/org.jiemamy.composer/src/test/java/org/jiemamy/composer/importer/DatabaseImporterTest.java
    artemis/trunk/org.jiemamy.composer/src/test/resources/test.dicon
    artemis/trunk/org.jiemamy.core/src/main/java/org/jiemamy/core/S2FactoryStrategy.java
    artemis/trunk/org.jiemamy.core/src/main/java/org/jiemamy/core/model/RootModelImpl.java
    artemis/trunk/org.jiemamy.core/src/test/java/org/jiemamy/core/model/RootModelImplTest.java
    artemis/trunk/org.jiemamy.core/src/test/java/org/jiemamy/core/utils/processor/base/ForeignKeyTestBase.java
    artemis/trunk/org.jiemamy.core/src/test/java/org/jiemamy/core/utils/processor/root/GenerateEntityNameProcessorTest.java
    artemis/trunk/org.jiemamy.core/src/test/java/org/jiemamy/core/utils/processor/root/GetNodesProcessorTest.java
    artemis/trunk/org.jiemamy.event/src/test/java/org/jiemamy/core/event/SetterInterceptorTest.java
    artemis/trunk/org.jiemamy.event/src/test/java/org/jiemamy/core/event/collectionimpl/ObservableMapTest.java
    artemis/trunk/org.jiemamy.project/mvn_package.bat
    artemis/trunk/org.jiemamy.view/src/test/java/org/jiemamy/core/utils/processor/root/presentation/ResetBendpointProcessorTest.java
    artemis/trunk/org.jiemamy.view/src/test/java/org/jiemamy/core/utils/processor/root/presentation/SetColorProcessorTest.java
    artemis/trunk/org.jiemamy.view/src/test/java/org/jiemamy/core/utils/processor/root/presentation/SetConstraintProcessorTest.java
    vesta/trunk/org.jiemamy.eclipse/src/main/java/org/jiemamy/eclipse/wizard/NewDiagramWizard.java
    zeus/trunk/org.jiemamy.spec.core/src/main/java/org/jiemamy/spec/FactoryStrategy.java

Added Paths:
-----------
    artemis/trunk/org.jiemamy.core/src/main/java/org/jiemamy/core/utils/processor/root/CreateNewModelProcessor.java
    zeus/trunk/org.jiemamy.spec.core/src/main/java/org/jiemamy/spec/JiemamyModelFactory.java

Removed Paths:
-------------
    artemis/trunk/org.jiemamy.core/src/main/java/org/jiemamy/core/model/JiemamyModelFactory.java
    zeus/trunk/org.jiemamy.spec.core/src/main/java/org/jiemamy/spec/DefaultFactoryStrategy.java
    zeus/trunk/org.jiemamy.spec.core/src/main/java/org/jiemamy/spec/RootModelFactory.java


-------------- next part --------------
Modified: artemis/trunk/org.jiemamy.composer/src/test/java/org/jiemamy/composer/importer/DatabaseImporterTest.java
===================================================================
--- artemis/trunk/org.jiemamy.composer/src/test/java/org/jiemamy/composer/importer/DatabaseImporterTest.java	2008-09-29 15:52:39 UTC (rev 1975)
+++ artemis/trunk/org.jiemamy.composer/src/test/java/org/jiemamy/composer/importer/DatabaseImporterTest.java	2008-09-29 17:37:16 UTC (rev 1976)
@@ -19,7 +19,6 @@
 package org.jiemamy.composer.importer;
 
 import static org.hamcrest.core.Is.is;
-import static org.hamcrest.core.IsInstanceOf.instanceOf;
 import static org.junit.Assert.assertThat;
 
 import java.io.File;
@@ -34,11 +33,12 @@
 
 import org.jiemamy.core.S2FactoryStrategy;
 import org.jiemamy.core.extension.composer.ImportContextImpl;
-import org.jiemamy.spec.RootModelFactory;
+import org.jiemamy.spec.JiemamyModelFactory;
 import org.jiemamy.spec.extension.composer.ImportContext;
 import org.jiemamy.spec.extension.composer.Importer;
 import org.jiemamy.spec.extension.dialect.Dialect;
 import org.jiemamy.spec.model.RootModel;
+import org.jiemamy.spec.model.datatype.DataType;
 import org.jiemamy.spec.model.node.TableModel;
 
 /**
@@ -53,7 +53,7 @@
 	
 	private Dialect dialect;
 	
-	private Class<?> serialTypeClass;
+	private DataType serialTypeClass;
 	
 
 	/**
@@ -63,7 +63,7 @@
 	@Before
 	@SuppressWarnings("unchecked")
 	public void setUp() throws Exception {
-		RootModelFactory.init(new S2FactoryStrategy("jiemamy-composer.dicon"));
+		JiemamyModelFactory.init(new S2FactoryStrategy("jiemamy-composer.dicon"));
 		
 		URLClassLoader classLoader = new URLClassLoader(new URL[] {
 			new File("../org.jiemamy.dialect/target/classes").toURL(),
@@ -72,10 +72,10 @@
 		
 		// FIXME 前者はComponentNotFoundRuntimeExceptionが飛ぶ。
 //		Dialect dialect = (Dialect) container.getComponent(Class.forName(model.getDialectClassName(), true, classLoader));
-		dialect =
-				(Dialect) Class.forName("org.jiemamy.dialect.postgresql.PostgresqlDialect", true, classLoader)
-					.newInstance();
-		serialTypeClass = Class.forName("org.jiemamy.dialect.postgresql.datatype.SerialDataType", true, classLoader);
+		dialect = JiemamyModelFactory.createDialect("org.jiemamy.dialect.postgresql.PostgresqlDialect", classLoader);
+		serialTypeClass =
+				JiemamyModelFactory.createDataType("org.jiemamy.dialect.postgresql.datatype.SerialDataType",
+						classLoader);
 	}
 	
 	/**
@@ -93,7 +93,7 @@
 	 */
 	@Test
 	public void test01_DBからのインポートテスト() throws Exception {
-		RootModel rootModel = RootModelFactory.createInstance();
+		RootModel rootModel = JiemamyModelFactory.createRoot();
 		ImportContext ctx = new ImportContextImpl();
 		ctx.setValue(DatabaseImporter.DIALECT, dialect);
 		ctx.setValue(DatabaseImporter.DATABASE_NAME, "jpoll");
@@ -116,7 +116,7 @@
 		assertThat(pollTable.getName(), is("t_poll"));
 		assertThat(pollTable.getColumns().size(), is(11));
 		assertThat(pollTable.getColumns().get(0).getName(), is("poll_id"));
-		assertThat(pollTable.getColumns().get(0).getDataType(), instanceOf(serialTypeClass));
+		assertThat(pollTable.getColumns().get(0).getDataType(), is(serialTypeClass));
 		System.out.println(pollTable.getColumns().get(0).getConstraints());
 		
 		// UNDONE DatabaseImporter.java:185 を実装したら

Modified: artemis/trunk/org.jiemamy.composer/src/test/resources/test.dicon
===================================================================
--- artemis/trunk/org.jiemamy.composer/src/test/resources/test.dicon	2008-09-29 15:52:39 UTC (rev 1975)
+++ artemis/trunk/org.jiemamy.composer/src/test/resources/test.dicon	2008-09-29 17:37:16 UTC (rev 1976)
@@ -5,4 +5,5 @@
 	<include path="aop.dicon"/>
 	<include path="jiemamy-core.dicon"/>
 	<include path="jiemamy-dialect.dicon"/>
+	<!-- <include path="jiemamy-dialect-postgresql.dicon"/> -->
 </components>

Modified: artemis/trunk/org.jiemamy.core/src/main/java/org/jiemamy/core/S2FactoryStrategy.java
===================================================================
--- artemis/trunk/org.jiemamy.core/src/main/java/org/jiemamy/core/S2FactoryStrategy.java	2008-09-29 15:52:39 UTC (rev 1975)
+++ artemis/trunk/org.jiemamy.core/src/main/java/org/jiemamy/core/S2FactoryStrategy.java	2008-09-29 17:37:16 UTC (rev 1976)
@@ -23,7 +23,6 @@
 
 import org.jiemamy.spec.FactoryStrategy;
 import org.jiemamy.spec.exception.JiemamyRuntimeException;
-import org.jiemamy.spec.model.RootModel;
 
 /**
  * TODO for daisuke
@@ -48,9 +47,10 @@
 	/**
 	 * {@inheritDoc}
 	 */
-	public RootModel createInstance() {
+	@SuppressWarnings("unchecked")
+	public <T>T create(Class<T> clazz) {
 		try {
-			return (RootModel) container.getComponent(RootModel.class);
+			return (T) container.getComponent(clazz);
 		} catch (Exception e) {
 			throw new JiemamyRuntimeException(e);
 		}

Deleted: artemis/trunk/org.jiemamy.core/src/main/java/org/jiemamy/core/model/JiemamyModelFactory.java
===================================================================
--- artemis/trunk/org.jiemamy.core/src/main/java/org/jiemamy/core/model/JiemamyModelFactory.java	2008-09-29 15:52:39 UTC (rev 1975)
+++ artemis/trunk/org.jiemamy.core/src/main/java/org/jiemamy/core/model/JiemamyModelFactory.java	2008-09-29 17:37:16 UTC (rev 1976)
@@ -1,58 +0,0 @@
-/*
- * Copyright 2007-2008 MIYAMOTO Daisuke, jiemamy.org and the Others.
- * Created on 2008/09/25
- *
- * This file is part of Jiemamy.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
- * either express or implied. See the License for the specific language
- * governing permissions and limitations under the License.
- */
-package org.jiemamy.core.model;
-
-import org.seasar.framework.container.S2Container;
-import org.seasar.framework.container.factory.SingletonS2ContainerFactory;
-
-import org.jiemamy.spec.exception.JiemamyRuntimeException;
-import org.jiemamy.spec.model.JiemamyModel;
-import org.jiemamy.spec.model.RootModel;
-
-/**
- * TODO for daisuke
- * @author daisuke
- */
-public class JiemamyModelFactory {
-	
-	static S2Container container;
-	
-	private static String diconPath = "jiemamy-core.dicon";
-	
-
-	public static void init() {
-		SingletonS2ContainerFactory.setConfigPath(diconPath);
-		SingletonS2ContainerFactory.init();
-		container = SingletonS2ContainerFactory.getContainer();
-	}
-	
-	public static void setConfigPath(String path) {
-		diconPath = path;
-		init();
-	}
-	
-	@SuppressWarnings("unchecked")
-	static <T extends JiemamyModel>T createNewInstance(RootModel rootModel, Class<T> clazz) {
-		try {
-			return (T) container.getComponent(clazz);
-		} catch (Exception e) {
-			throw new JiemamyRuntimeException(e);
-		}
-	}
-}

Modified: artemis/trunk/org.jiemamy.core/src/main/java/org/jiemamy/core/model/RootModelImpl.java
===================================================================
--- artemis/trunk/org.jiemamy.core/src/main/java/org/jiemamy/core/model/RootModelImpl.java	2008-09-29 15:52:39 UTC (rev 1975)
+++ artemis/trunk/org.jiemamy.core/src/main/java/org/jiemamy/core/model/RootModelImpl.java	2008-09-29 17:37:16 UTC (rev 1976)
@@ -23,6 +23,7 @@
 import org.seasar.framework.container.annotation.tiger.Binding;
 
 import org.jiemamy.core.utils.processor.connection.foreignkey.ProvideForeignKeyNameProcessor;
+import org.jiemamy.core.utils.processor.root.CreateNewModelProcessor;
 import org.jiemamy.core.utils.processor.root.GetConnectionsProcessor;
 import org.jiemamy.core.utils.processor.root.GetEntityProcessor;
 import org.jiemamy.core.utils.processor.root.GetNodesProcessor;
@@ -81,14 +82,6 @@
 	
 
 	/**
-	 * コンストラクタ。
-	 * @category instance creation
-	 */
-	public RootModelImpl() {
-		JiemamyModelFactory.init();
-	}
-	
-	/**
 	 * {@inheritDoc}
 	 */
 	public void appendModel(JiemamyModel jiemamyModel) {
@@ -106,8 +99,9 @@
 	/**
 	 * {@inheritDoc}
 	 */
+	@SuppressWarnings("unchecked")
 	public <T extends JiemamyModel>T createJiemamyModel(Class<T> clazz) {
-		return JiemamyModelFactory.createNewInstance(this, clazz);
+		return process(new CreateNewModelProcessor<T>(this, clazz));
 	}
 	
 	/**

Added: artemis/trunk/org.jiemamy.core/src/main/java/org/jiemamy/core/utils/processor/root/CreateNewModelProcessor.java
===================================================================
--- artemis/trunk/org.jiemamy.core/src/main/java/org/jiemamy/core/utils/processor/root/CreateNewModelProcessor.java	                        (rev 0)
+++ artemis/trunk/org.jiemamy.core/src/main/java/org/jiemamy/core/utils/processor/root/CreateNewModelProcessor.java	2008-09-29 17:37:16 UTC (rev 1976)
@@ -0,0 +1,64 @@
+/*
+ * Copyright 2007-2008 MIYAMOTO Daisuke, jiemamy.org and the Others.
+ * Created on 2008/09/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.core.utils.processor.root;
+
+import org.seasar.framework.container.S2Container;
+import org.seasar.framework.container.factory.SingletonS2ContainerFactory;
+
+import org.jiemamy.spec.exception.JiemamyRuntimeException;
+import org.jiemamy.spec.model.JiemamyModel;
+import org.jiemamy.spec.model.RootModel;
+import org.jiemamy.spec.util.Processor;
+
+/**
+ * TODO for daisuke
+ * @param <T> 
+ * @author daisuke
+ */
+public class CreateNewModelProcessor<T extends JiemamyModel> implements Processor<RootModel, T, RuntimeException> {
+	
+	private Class<?> clazz;
+	
+	private S2Container container;
+	
+
+	/**
+	 * コンストラクタ。
+	 * @param rootModel
+	 * @param clazz
+	 * @category instance creation
+	 */
+	public CreateNewModelProcessor(RootModel rootModel, Class<T> clazz) {
+		SingletonS2ContainerFactory.init();
+		container = SingletonS2ContainerFactory.getContainer();
+		this.clazz = clazz;
+	}
+	
+	/**
+	 * {@inheritDoc}
+	 */
+	@SuppressWarnings("unchecked")
+	public T process(RootModel target) {
+		try {
+			return (T) container.getComponent(clazz);
+		} catch (Exception e) {
+			throw new JiemamyRuntimeException(e);
+		}
+	}
+}


Property changes on: artemis/trunk/org.jiemamy.core/src/main/java/org/jiemamy/core/utils/processor/root/CreateNewModelProcessor.java
___________________________________________________________________
Name: svn:mime-type
   + text/plain

Modified: artemis/trunk/org.jiemamy.core/src/test/java/org/jiemamy/core/model/RootModelImplTest.java
===================================================================
--- artemis/trunk/org.jiemamy.core/src/test/java/org/jiemamy/core/model/RootModelImplTest.java	2008-09-29 15:52:39 UTC (rev 1975)
+++ artemis/trunk/org.jiemamy.core/src/test/java/org/jiemamy/core/model/RootModelImplTest.java	2008-09-29 17:37:16 UTC (rev 1976)
@@ -28,7 +28,7 @@
 import org.junit.Test;
 
 import org.jiemamy.core.S2FactoryStrategy;
-import org.jiemamy.spec.RootModelFactory;
+import org.jiemamy.spec.JiemamyModelFactory;
 import org.jiemamy.spec.model.RootModel;
 
 /**
@@ -46,8 +46,8 @@
 	 */
 	@Before
 	public void setUp() throws Exception {
-		RootModelFactory.init(new S2FactoryStrategy("jiemamy-core.dicon"));
-		rootModel = RootModelFactory.createInstance();
+		JiemamyModelFactory.init(new S2FactoryStrategy("jiemamy-core.dicon"));
+		rootModel = JiemamyModelFactory.createRoot();
 	}
 	
 	/**

Modified: artemis/trunk/org.jiemamy.core/src/test/java/org/jiemamy/core/utils/processor/base/ForeignKeyTestBase.java
===================================================================
--- artemis/trunk/org.jiemamy.core/src/test/java/org/jiemamy/core/utils/processor/base/ForeignKeyTestBase.java	2008-09-29 15:52:39 UTC (rev 1975)
+++ artemis/trunk/org.jiemamy.core/src/test/java/org/jiemamy/core/utils/processor/base/ForeignKeyTestBase.java	2008-09-29 17:37:16 UTC (rev 1976)
@@ -22,7 +22,7 @@
 import org.junit.Before;
 
 import org.jiemamy.core.S2FactoryStrategy;
-import org.jiemamy.spec.RootModelFactory;
+import org.jiemamy.spec.JiemamyModelFactory;
 import org.jiemamy.spec.model.RootModel;
 import org.jiemamy.spec.model.connection.ForeignKeyModel;
 import org.jiemamy.spec.model.node.TableModel;
@@ -50,8 +50,8 @@
 	 */
 	@Before
 	public void setUp() throws Exception {
-		RootModelFactory.init(new S2FactoryStrategy("jiemamy-core.dicon"));
-		rootModel = RootModelFactory.createInstance();
+		JiemamyModelFactory.init(new S2FactoryStrategy("jiemamy-core.dicon"));
+		rootModel = JiemamyModelFactory.createRoot();
 		
 		empTableModel = rootModel.createJiemamyModel(TableModel.class).init("T_EMP");
 		rootModel.appendModel(empTableModel);

Modified: artemis/trunk/org.jiemamy.core/src/test/java/org/jiemamy/core/utils/processor/root/GenerateEntityNameProcessorTest.java
===================================================================
--- artemis/trunk/org.jiemamy.core/src/test/java/org/jiemamy/core/utils/processor/root/GenerateEntityNameProcessorTest.java	2008-09-29 15:52:39 UTC (rev 1975)
+++ artemis/trunk/org.jiemamy.core/src/test/java/org/jiemamy/core/utils/processor/root/GenerateEntityNameProcessorTest.java	2008-09-29 17:37:16 UTC (rev 1976)
@@ -28,7 +28,7 @@
 import org.seasar.framework.unit.Seasar2;
 
 import org.jiemamy.core.S2FactoryStrategy;
-import org.jiemamy.spec.RootModelFactory;
+import org.jiemamy.spec.JiemamyModelFactory;
 import org.jiemamy.spec.model.RootModel;
 import org.jiemamy.spec.model.node.TableModel;
 import org.jiemamy.spec.model.node.ViewModel;
@@ -49,8 +49,8 @@
 	 */
 	@Before
 	public void setUp() throws Exception {
-		RootModelFactory.init(new S2FactoryStrategy("jiemamy-core.dicon"));
-		rootModel = RootModelFactory.createInstance();
+		JiemamyModelFactory.init(new S2FactoryStrategy("jiemamy-core.dicon"));
+		rootModel = JiemamyModelFactory.createRoot();
 	}
 	
 	/**

Modified: artemis/trunk/org.jiemamy.core/src/test/java/org/jiemamy/core/utils/processor/root/GetNodesProcessorTest.java
===================================================================
--- artemis/trunk/org.jiemamy.core/src/test/java/org/jiemamy/core/utils/processor/root/GetNodesProcessorTest.java	2008-09-29 15:52:39 UTC (rev 1975)
+++ artemis/trunk/org.jiemamy.core/src/test/java/org/jiemamy/core/utils/processor/root/GetNodesProcessorTest.java	2008-09-29 17:37:16 UTC (rev 1976)
@@ -28,7 +28,7 @@
 import org.seasar.framework.unit.Seasar2;
 
 import org.jiemamy.core.S2FactoryStrategy;
-import org.jiemamy.spec.RootModelFactory;
+import org.jiemamy.spec.JiemamyModelFactory;
 import org.jiemamy.spec.model.RootModel;
 import org.jiemamy.spec.model.node.TableModel;
 import org.jiemamy.spec.model.node.ViewModel;
@@ -49,8 +49,8 @@
 	 */
 	@Before
 	public void setUp() throws Exception {
-		RootModelFactory.init(new S2FactoryStrategy("jiemamy-core.dicon"));
-		rootModel = RootModelFactory.createInstance();
+		JiemamyModelFactory.init(new S2FactoryStrategy("jiemamy-core.dicon"));
+		rootModel = JiemamyModelFactory.createRoot();
 	}
 	
 	/**

Modified: artemis/trunk/org.jiemamy.event/src/test/java/org/jiemamy/core/event/SetterInterceptorTest.java
===================================================================
--- artemis/trunk/org.jiemamy.event/src/test/java/org/jiemamy/core/event/SetterInterceptorTest.java	2008-09-29 15:52:39 UTC (rev 1975)
+++ artemis/trunk/org.jiemamy.event/src/test/java/org/jiemamy/core/event/SetterInterceptorTest.java	2008-09-29 17:37:16 UTC (rev 1976)
@@ -32,7 +32,7 @@
 
 import org.jiemamy.core.S2FactoryStrategy;
 import org.jiemamy.event.SetterInterceptor;
-import org.jiemamy.spec.RootModelFactory;
+import org.jiemamy.spec.JiemamyModelFactory;
 import org.jiemamy.spec.model.RootModel;
 import org.jiemamy.spec.model.node.TableModel;
 import org.jiemamy.spec.util.ModelChangeEvent;
@@ -71,7 +71,7 @@
 	 */
 	@Before
 	public void setUp() {
-		RootModelFactory.init(new S2FactoryStrategy("jiemamy-core.dicon"));
+		JiemamyModelFactory.init(new S2FactoryStrategy("jiemamy-core.dicon"));
 		
 		tableModel = (TableModel) s2container.getComponent(TableModel.class);
 		listener = (new ModelChangeListenerImpl());
@@ -103,7 +103,7 @@
 	 */
 	@Test
 	public void test_S2管理下ではないインスタンスには反応しない() {
-		RootModel rootModel = RootModelFactory.createInstance();
+		RootModel rootModel = JiemamyModelFactory.createRoot();
 		TableModel tableModel2 = rootModel.createJiemamyModel(TableModel.class).init("T_USER");
 		tableModel2.getAdapter(Observable.class).addModelChangeListener(listener);
 		tableModel2.setBeginScript("abc");

Modified: artemis/trunk/org.jiemamy.event/src/test/java/org/jiemamy/core/event/collectionimpl/ObservableMapTest.java
===================================================================
--- artemis/trunk/org.jiemamy.event/src/test/java/org/jiemamy/core/event/collectionimpl/ObservableMapTest.java	2008-09-29 15:52:39 UTC (rev 1975)
+++ artemis/trunk/org.jiemamy.event/src/test/java/org/jiemamy/core/event/collectionimpl/ObservableMapTest.java	2008-09-29 17:37:16 UTC (rev 1976)
@@ -37,7 +37,7 @@
 import org.jiemamy.core.model.typedef.datatype.impl.IntegerDataTypeMock;
 import org.jiemamy.core.model.typedef.datatype.impl.TimestampDataTypeMock;
 import org.jiemamy.core.model.typedef.datatype.impl.VarcharDataTypeMock;
-import org.jiemamy.spec.RootModelFactory;
+import org.jiemamy.spec.JiemamyModelFactory;
 import org.jiemamy.spec.event.ObservableCollectionChangeEvent;
 import org.jiemamy.spec.event.ObservableCollectionChangeListener;
 import org.jiemamy.spec.event.ObservableCollectionChangeEvent.Timing;
@@ -57,8 +57,8 @@
 	static RootModel rootModel;
 	
 	static {
-		RootModelFactory.init(new S2FactoryStrategy("jiemamy-event.dicon"));
-		rootModel = RootModelFactory.createInstance();
+		JiemamyModelFactory.init(new S2FactoryStrategy("jiemamy-event.dicon"));
+		rootModel = JiemamyModelFactory.createRoot();
 	}
 	
 

Modified: artemis/trunk/org.jiemamy.project/mvn_package.bat
===================================================================
--- artemis/trunk/org.jiemamy.project/mvn_package.bat	2008-09-29 15:52:39 UTC (rev 1975)
+++ artemis/trunk/org.jiemamy.project/mvn_package.bat	2008-09-29 17:37:16 UTC (rev 1976)
@@ -1,5 +1,6 @@
 cd %~p0
 
-call mvn package -Dmaven.test.failure.ignore=true
+set JAVA_HOME=C:\Program Files\Java\jdk1.6.0_07
+call mvn clean package -Dmaven.test.failure.ignore=true
 
 pause
\ No newline at end of file

Modified: artemis/trunk/org.jiemamy.view/src/test/java/org/jiemamy/core/utils/processor/root/presentation/ResetBendpointProcessorTest.java
===================================================================
--- artemis/trunk/org.jiemamy.view/src/test/java/org/jiemamy/core/utils/processor/root/presentation/ResetBendpointProcessorTest.java	2008-09-29 15:52:39 UTC (rev 1975)
+++ artemis/trunk/org.jiemamy.view/src/test/java/org/jiemamy/core/utils/processor/root/presentation/ResetBendpointProcessorTest.java	2008-09-29 17:37:16 UTC (rev 1976)
@@ -30,7 +30,7 @@
 
 import org.jiemamy.core.MustBeMulti;
 import org.jiemamy.core.S2FactoryStrategy;
-import org.jiemamy.spec.RootModelFactory;
+import org.jiemamy.spec.JiemamyModelFactory;
 import org.jiemamy.spec.geometory.JmPoint;
 import org.jiemamy.spec.model.RootModel;
 import org.jiemamy.spec.model.connection.ForeignKeyModel;
@@ -61,8 +61,8 @@
 	 */
 	@Before
 	public void setUp() throws Exception {
-		RootModelFactory.init(new S2FactoryStrategy("jiemamy-view.dicon"));
-		rootModel = RootModelFactory.createInstance();
+		JiemamyModelFactory.init(new S2FactoryStrategy("jiemamy-view.dicon"));
+		rootModel = JiemamyModelFactory.createRoot();
 		
 		empTableModel = rootModel.createJiemamyModel(TableModel.class);
 		empTableModel.setName("T_EMP");

Modified: artemis/trunk/org.jiemamy.view/src/test/java/org/jiemamy/core/utils/processor/root/presentation/SetColorProcessorTest.java
===================================================================
--- artemis/trunk/org.jiemamy.view/src/test/java/org/jiemamy/core/utils/processor/root/presentation/SetColorProcessorTest.java	2008-09-29 15:52:39 UTC (rev 1975)
+++ artemis/trunk/org.jiemamy.view/src/test/java/org/jiemamy/core/utils/processor/root/presentation/SetColorProcessorTest.java	2008-09-29 17:37:16 UTC (rev 1976)
@@ -30,7 +30,7 @@
 
 import org.jiemamy.core.MustBeMulti;
 import org.jiemamy.core.S2FactoryStrategy;
-import org.jiemamy.spec.RootModelFactory;
+import org.jiemamy.spec.JiemamyModelFactory;
 import org.jiemamy.spec.geometory.JmColor;
 import org.jiemamy.spec.model.RootModel;
 import org.jiemamy.spec.model.node.TableModel;
@@ -56,8 +56,8 @@
 	 */
 	@Before
 	public void setUp() throws Exception {
-		RootModelFactory.init(new S2FactoryStrategy("jiemamy-view.dicon"));
-		rootModel = RootModelFactory.createInstance();
+		JiemamyModelFactory.init(new S2FactoryStrategy("jiemamy-view.dicon"));
+		rootModel = JiemamyModelFactory.createRoot();
 		DiagramPresentationModel presentation = rootModel.createJiemamyModel(DiagramPresentationModel.class);
 		rootModel.appendModel(presentation);
 		presentation.setName("テスト");

Modified: artemis/trunk/org.jiemamy.view/src/test/java/org/jiemamy/core/utils/processor/root/presentation/SetConstraintProcessorTest.java
===================================================================
--- artemis/trunk/org.jiemamy.view/src/test/java/org/jiemamy/core/utils/processor/root/presentation/SetConstraintProcessorTest.java	2008-09-29 15:52:39 UTC (rev 1975)
+++ artemis/trunk/org.jiemamy.view/src/test/java/org/jiemamy/core/utils/processor/root/presentation/SetConstraintProcessorTest.java	2008-09-29 17:37:16 UTC (rev 1976)
@@ -30,7 +30,7 @@
 
 import org.jiemamy.core.MustBeMulti;
 import org.jiemamy.core.S2FactoryStrategy;
-import org.jiemamy.spec.RootModelFactory;
+import org.jiemamy.spec.JiemamyModelFactory;
 import org.jiemamy.spec.geometory.JmRectangle;
 import org.jiemamy.spec.model.RootModel;
 import org.jiemamy.spec.model.node.TableModel;
@@ -56,8 +56,8 @@
 	 */
 	@Before
 	public void setUp() throws Exception {
-		RootModelFactory.init(new S2FactoryStrategy("jiemamy-view.dicon"));
-		rootModel = RootModelFactory.createInstance();
+		JiemamyModelFactory.init(new S2FactoryStrategy("jiemamy-view.dicon"));
+		rootModel = JiemamyModelFactory.createRoot();
 		DiagramPresentationModel presentation = rootModel.createJiemamyModel(DiagramPresentationModel.class);
 		presentation.setName("テスト");
 		rootModel.appendModel(presentation);

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-09-29 15:52:39 UTC (rev 1975)
+++ vesta/trunk/org.jiemamy.eclipse/src/main/java/org/jiemamy/eclipse/wizard/NewDiagramWizard.java	2008-09-29 17:37:16 UTC (rev 1976)
@@ -34,7 +34,7 @@
 import org.jiemamy.eclipse.JiemamyPlugin;
 import org.jiemamy.eclipse.utils.ExceptionHandler;
 import org.jiemamy.serializer.JiemamySerializer;
-import org.jiemamy.spec.RootModelFactory;
+import org.jiemamy.spec.JiemamyModelFactory;
 import org.jiemamy.spec.model.RootModel;
 
 /**
@@ -142,7 +142,7 @@
 		 */
 		@Override
 		protected InputStream getInitialContents() {
-			RootModel rootModel = RootModelFactory.createInstance();
+			RootModel rootModel = JiemamyModelFactory.createRoot();
 			
 			try {
 				return serializer.serialize(rootModel);

Deleted: zeus/trunk/org.jiemamy.spec.core/src/main/java/org/jiemamy/spec/DefaultFactoryStrategy.java
===================================================================
--- zeus/trunk/org.jiemamy.spec.core/src/main/java/org/jiemamy/spec/DefaultFactoryStrategy.java	2008-09-29 15:52:39 UTC (rev 1975)
+++ zeus/trunk/org.jiemamy.spec.core/src/main/java/org/jiemamy/spec/DefaultFactoryStrategy.java	2008-09-29 17:37:16 UTC (rev 1976)
@@ -1,42 +0,0 @@
-/*
- * Copyright 2007-2008 MIYAMOTO Daisuke, jiemamy.org and the Others.
- * Created on 2008/09/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.spec;
-
-import org.jiemamy.spec.exception.JiemamyRuntimeException;
-import org.jiemamy.spec.model.RootModel;
-
-/**
- * TODO for daisuke
- * @author daisuke
- */
-public class DefaultFactoryStrategy implements FactoryStrategy {
-	
-	/**
-	 * {@inheritDoc}
-	 */
-	public RootModel createInstance() {
-		try {
-			Class<?> clazz = Class.forName("org.jiemamy.core.model.RootModelImpl");
-			return (RootModel) clazz.newInstance();
-		} catch (Exception e) {
-			throw new JiemamyRuntimeException(e);
-		}
-	}
-	
-}

Modified: zeus/trunk/org.jiemamy.spec.core/src/main/java/org/jiemamy/spec/FactoryStrategy.java
===================================================================
--- zeus/trunk/org.jiemamy.spec.core/src/main/java/org/jiemamy/spec/FactoryStrategy.java	2008-09-29 15:52:39 UTC (rev 1975)
+++ zeus/trunk/org.jiemamy.spec.core/src/main/java/org/jiemamy/spec/FactoryStrategy.java	2008-09-29 17:37:16 UTC (rev 1976)
@@ -18,7 +18,6 @@
  */
 package org.jiemamy.spec;
 
-import org.jiemamy.spec.model.RootModel;
 
 /**
  * インスタンス生成戦略インターフェイス。
@@ -27,9 +26,11 @@
 public interface FactoryStrategy {
 	
 	/**
-	 * {@link RootModel}のインスタンスを生成する。
-	 * @return {@link RootModel}のインスタンス
+	 * Jiemamy関連のインスタンスを生成する。
+	 * @param <T> 
+	 * @param clazz 
+	 * @return Jiemamy関連のインスタンス
 	 */
-	RootModel createInstance();
+	<T>T create(Class<T> clazz);
 	
 }

Copied: zeus/trunk/org.jiemamy.spec.core/src/main/java/org/jiemamy/spec/JiemamyModelFactory.java (from rev 1975, zeus/trunk/org.jiemamy.spec.core/src/main/java/org/jiemamy/spec/RootModelFactory.java)
===================================================================
--- zeus/trunk/org.jiemamy.spec.core/src/main/java/org/jiemamy/spec/JiemamyModelFactory.java	                        (rev 0)
+++ zeus/trunk/org.jiemamy.spec.core/src/main/java/org/jiemamy/spec/JiemamyModelFactory.java	2008-09-29 17:37:16 UTC (rev 1976)
@@ -0,0 +1,123 @@
+/*
+ * Copyright 2007-2008 MIYAMOTO Daisuke, jiemamy.org and the Others.
+ * Created on 2008/09/25
+ *
+ * This file is part of Jiemamy.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
+ * either express or implied. See the License for the specific language
+ * governing permissions and limitations under the License.
+ */
+package org.jiemamy.spec;
+
+import org.jiemamy.spec.exception.JiemamyRuntimeException;
+import org.jiemamy.spec.extension.dialect.Dialect;
+import org.jiemamy.spec.model.RootModel;
+import org.jiemamy.spec.model.datatype.DataType;
+
+/**
+ * 新しい {@link RootModel}を生成するためのファクトリ。
+ * @author daisuke
+ */
+public class JiemamyModelFactory {
+	
+	private static JiemamyModelFactory instance;
+	
+
+	/**
+	 * TODO for daisuke
+	 * @param fqcn 
+	 * @return
+	 */
+	public static DataType createDataType(String fqcn) {
+		return createDataType(fqcn, JiemamyModelFactory.class.getClassLoader());
+	}
+	
+	/**
+	 * TODO for daisuke
+	 * @param fqcn 
+	 * @param classLoader 
+	 * @return
+	 */
+	public static DataType createDataType(String fqcn, ClassLoader classLoader) {
+		if (instance == null) {
+			throw new JiemamyRuntimeException("createInstance()呼び出し前に、init()が必要です。");
+		}
+		try {
+			return (DataType) instance.strategy.create(Class.forName(fqcn, true, classLoader));
+		} catch (ClassNotFoundException e) {
+			throw new JiemamyRuntimeException(e);
+		}
+	}
+	
+	/**
+	 * TODO for daisuke
+	 * @param fqcn 
+	 * @return
+	 */
+	public static Dialect createDialect(String fqcn) {
+		return createDialect(fqcn, JiemamyModelFactory.class.getClassLoader());
+	}
+	
+	/**
+	 * TODO for daisuke
+	 * @param fqcn 
+	 * @param classLoader 
+	 * @return
+	 */
+	public static Dialect createDialect(String fqcn, ClassLoader classLoader) {
+		if (instance == null) {
+			throw new JiemamyRuntimeException("createInstance()呼び出し前に、init()が必要です。");
+		}
+		try {
+			return (Dialect) instance.strategy.create(Class.forName(fqcn, true, classLoader));
+		} catch (ClassNotFoundException e) {
+			throw new JiemamyRuntimeException(e);
+		}
+	}
+	
+	/**
+	 * 新しい {@link RootModel} のインスタンスを取得する。
+	 * @return {@link RootModel}のインスタンス。
+	 */
+	public static RootModel createRoot() {
+		if (instance == null) {
+			throw new JiemamyRuntimeException("createInstance()呼び出し前に、init()が必要です。");
+		}
+		return instance.strategy.create(RootModel.class);
+	}
+	
+	/**
+	 * ファクトリを初期化する。
+	 * @param strategy インスタンス生成戦略
+	 */
+	public static void init(FactoryStrategy strategy) {
+		if (instance != null) {
+			return;
+//			throw new JiemamyRuntimeException("ファクトリは既に初期化済みです。");
+		}
+		instance = (new JiemamyModelFactory(strategy));
+	}
+	
+
+	/** インスタンス生成戦略 */
+	private FactoryStrategy strategy;
+	
+
+	/**
+	 * privateコンストラクタ。
+	 * @param strategy インスタンス生成戦略
+	 * @category instance creation
+	 */
+	private JiemamyModelFactory(FactoryStrategy strategy) {
+		this.strategy = strategy;
+	}
+}


Property changes on: zeus/trunk/org.jiemamy.spec.core/src/main/java/org/jiemamy/spec/JiemamyModelFactory.java
___________________________________________________________________
Name: svn:mime-type
   + text/plain

Deleted: zeus/trunk/org.jiemamy.spec.core/src/main/java/org/jiemamy/spec/RootModelFactory.java
===================================================================
--- zeus/trunk/org.jiemamy.spec.core/src/main/java/org/jiemamy/spec/RootModelFactory.java	2008-09-29 15:52:39 UTC (rev 1975)
+++ zeus/trunk/org.jiemamy.spec.core/src/main/java/org/jiemamy/spec/RootModelFactory.java	2008-09-29 17:37:16 UTC (rev 1976)
@@ -1,69 +0,0 @@
-/*
- * Copyright 2007-2008 MIYAMOTO Daisuke, jiemamy.org and the Others.
- * Created on 2008/09/25
- *
- * This file is part of Jiemamy.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
- * either express or implied. See the License for the specific language
- * governing permissions and limitations under the License.
- */
-package org.jiemamy.spec;
-
-import org.jiemamy.spec.exception.JiemamyRuntimeException;
-import org.jiemamy.spec.model.RootModel;
-
-/**
- * 新しい {@link RootModel}を生成するためのファクトリ。
- * @author daisuke
- */
-public class RootModelFactory {
-	
-	private static RootModelFactory instance;
-	
-
-	/**
-	 * 新しい {@link RootModel} のインスタンスを取得する。
-	 * @return {@link RootModel}のインスタンス。
-	 */
-	public static RootModel createInstance() {
-		if (instance == null) {
-			throw new JiemamyRuntimeException("createInstance()呼び出し前に、init()が必要です。");
-		}
-		return instance.strategy.createInstance();
-	}
-	
-	/**
-	 * ファクトリを初期化する。
-	 * @param strategy インスタンス生成戦略
-	 */
-	public static void init(FactoryStrategy strategy) {
-		if (instance != null) {
-			return;
-//			throw new JiemamyRuntimeException("ファクトリは既に初期化済みです。");
-		}
-		instance = (new RootModelFactory(strategy));
-	}
-	
-
-	/** インスタンス生成戦略 */
-	private FactoryStrategy strategy;
-	
-
-	/**
-	 * privateコンストラクタ。
-	 * @param strategy インスタンス生成戦略
-	 * @category instance creation
-	 */
-	private RootModelFactory(FactoryStrategy strategy) {
-		this.strategy = strategy;
-	}
-}


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