[Jiemamy-notify] commit [1980] 仕様追加のインターフェイスを整理して、テストを通した。

アーカイブの一覧に戻る

svnno****@sourc***** svnno****@sourc*****
2008年 10月 2日 (木) 19:55:54 JST


Revision: 1980
          http://svn.sourceforge.jp/cgi-bin/viewcvs.cgi?root=jiemamy&view=rev&rev=1980
Author:   daisuke_m
Date:     2008-10-02 19:55:54 +0900 (Thu, 02 Oct 2008)

Log Message:
-----------
仕様追加のインターフェイスを整理して、テストを通した。

Modified Paths:
--------------
    artemis/trunk/org.jiemamy.core/src/main/java/org/jiemamy/core/interpreter/JiemamyInterpreterStab.java
    artemis/trunk/org.jiemamy.core/src/main/java/org/jiemamy/core/model/AbstractModel.java
    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/utils/processor/root/CreateNewModelProcessor.java
    artemis/trunk/org.jiemamy.core/src/main/resources/jiemamy-core.dicon
    artemis/trunk/org.jiemamy.event/src/main/java/org/jiemamy/event/ObservableImpl.java
    artemis/trunk/org.jiemamy.event/src/main/resources/jiemamy-event.dicon
    artemis/trunk/org.jiemamy.event/src/test/java/org/jiemamy/core/event/SetterInterceptorTest.java
    artemis/trunk/org.jiemamy.serializer/src/main/java/org/jiemamy/serializer/model/AbstractSerializeModel.java
    artemis/trunk/org.jiemamy.view/src/main/java/org/jiemamy/view/DiagramPresentationModelImpl.java
    artemis/trunk/org.jiemamy.view/src/main/resources/jiemamy-view.dicon
    artemis/trunk/org.jiemamy.view/src/test/java/org/jiemamy/core/utils/processor/root/presentation/SetColorProcessorTest.java
    zeus/trunk/org.jiemamy.spec.core/src/main/java/org/jiemamy/spec/JiemamyModelFactory.java
    zeus/trunk/org.jiemamy.spec.core/src/main/java/org/jiemamy/spec/model/RootModel.java

Added Paths:
-----------
    artemis/trunk/org.jiemamy.core/src/main/java/org/jiemamy/core/appender/
    artemis/trunk/org.jiemamy.core/src/main/java/org/jiemamy/core/appender/ConnectionAppender.java
    artemis/trunk/org.jiemamy.core/src/main/java/org/jiemamy/core/appender/NodeAppender.java
    artemis/trunk/org.jiemamy.core/src/main/java/org/jiemamy/core/model/JiemamyModelAppender.java
    artemis/trunk/org.jiemamy.view/src/main/java/org/jiemamy/view/DiagramPresentationModelAppender.java
    zeus/trunk/org.jiemamy.spec.core/src/main/java/org/jiemamy/spec/exception/CannotAppendException.java

Removed Paths:
-------------
    zeus/trunk/org.jiemamy.spec.core/src/main/java/org/jiemamy/spec/exception/MappingValueNotFoundException.java


-------------- next part --------------
Added: artemis/trunk/org.jiemamy.core/src/main/java/org/jiemamy/core/appender/ConnectionAppender.java
===================================================================
--- artemis/trunk/org.jiemamy.core/src/main/java/org/jiemamy/core/appender/ConnectionAppender.java	                        (rev 0)
+++ artemis/trunk/org.jiemamy.core/src/main/java/org/jiemamy/core/appender/ConnectionAppender.java	2008-10-02 10:55:54 UTC (rev 1980)
@@ -0,0 +1,58 @@
+/*
+ * Copyright 2007-2008 MIYAMOTO Daisuke, jiemamy.org and the Others.
+ * Created on 2008/10/02
+ *
+ * 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.appender;
+
+import org.jiemamy.core.model.JiemamyModelAppender;
+import org.jiemamy.spec.model.JiemamyModel;
+import org.jiemamy.spec.model.RootModel;
+import org.jiemamy.spec.model.connection.AbstractConnectionModel;
+
+/**
+ * TODO for daisuke
+ * @author daisuke
+ */
+public class ConnectionAppender implements JiemamyModelAppender {
+	
+	/**
+	 * {@inheritDoc}
+	 */
+	public boolean append(JiemamyModel parent, JiemamyModel child) {
+		if (parent instanceof RootModel && child instanceof AbstractConnectionModel) {
+			AbstractConnectionModel connection = (AbstractConnectionModel) child;
+			connection.getSource().getSourceConnections().add(connection);
+			connection.getTarget().getTargetConnections().add(connection);
+			return true;
+		}
+		return false;
+	}
+	
+	/**
+	 * {@inheritDoc}
+	 */
+	public boolean remove(JiemamyModel parent, JiemamyModel child) {
+		if (parent instanceof RootModel && child instanceof AbstractConnectionModel) {
+			AbstractConnectionModel connection = (AbstractConnectionModel) child;
+			connection.getSource().getSourceConnections().remove(connection);
+			connection.getTarget().getTargetConnections().remove(connection);
+			return true;
+		}
+		return false;
+	}
+	
+}


Property changes on: artemis/trunk/org.jiemamy.core/src/main/java/org/jiemamy/core/appender/ConnectionAppender.java
___________________________________________________________________
Name: svn:mime-type
   + text/plain

Added: artemis/trunk/org.jiemamy.core/src/main/java/org/jiemamy/core/appender/NodeAppender.java
===================================================================
--- artemis/trunk/org.jiemamy.core/src/main/java/org/jiemamy/core/appender/NodeAppender.java	                        (rev 0)
+++ artemis/trunk/org.jiemamy.core/src/main/java/org/jiemamy/core/appender/NodeAppender.java	2008-10-02 10:55:54 UTC (rev 1980)
@@ -0,0 +1,58 @@
+/*
+ * Copyright 2007-2008 MIYAMOTO Daisuke, jiemamy.org and the Others.
+ * Created on 2008/10/02
+ *
+ * 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.appender;
+
+import org.jiemamy.core.model.JiemamyModelAppender;
+import org.jiemamy.spec.model.JiemamyModel;
+import org.jiemamy.spec.model.RootModel;
+import org.jiemamy.spec.model.node.AbstractNodeModel;
+
+/**
+ * TODO for daisuke
+ * @author daisuke
+ */
+public class NodeAppender implements JiemamyModelAppender {
+	
+	/**
+	 * {@inheritDoc}
+	 */
+	public boolean append(JiemamyModel parent, JiemamyModel child) {
+		if (parent instanceof RootModel && child instanceof AbstractNodeModel) {
+			RootModel rootModel = (RootModel) parent;
+			AbstractNodeModel node = (AbstractNodeModel) child;
+			rootModel.getNodes().add(node);
+			return true;
+		}
+		return false;
+	}
+	
+	/**
+	 * {@inheritDoc}
+	 */
+	public boolean remove(JiemamyModel parent, JiemamyModel child) {
+		if (parent instanceof RootModel && child instanceof AbstractNodeModel) {
+			RootModel rootModel = (RootModel) parent;
+			AbstractNodeModel node = (AbstractNodeModel) child;
+			rootModel.getNodes().remove(node);
+			return true;
+		}
+		return false;
+	}
+	
+}


Property changes on: artemis/trunk/org.jiemamy.core/src/main/java/org/jiemamy/core/appender/NodeAppender.java
___________________________________________________________________
Name: svn:mime-type
   + text/plain

Modified: artemis/trunk/org.jiemamy.core/src/main/java/org/jiemamy/core/interpreter/JiemamyInterpreterStab.java
===================================================================
--- artemis/trunk/org.jiemamy.core/src/main/java/org/jiemamy/core/interpreter/JiemamyInterpreterStab.java	2008-10-01 16:19:38 UTC (rev 1979)
+++ artemis/trunk/org.jiemamy.core/src/main/java/org/jiemamy/core/interpreter/JiemamyInterpreterStab.java	2008-10-02 10:55:54 UTC (rev 1980)
@@ -165,7 +165,7 @@
 			ViewModel viewModel = (ViewModel) entity;
 			createDDL(sb, viewModel);
 		} else {
-			throw new JiemamyRuntimeException();
+			throw new JiemamyRuntimeException("unknown entity");
 		}
 		
 		createEndScript(sb, entity.getName(), entity.getEndScript());

Modified: artemis/trunk/org.jiemamy.core/src/main/java/org/jiemamy/core/model/AbstractModel.java
===================================================================
--- artemis/trunk/org.jiemamy.core/src/main/java/org/jiemamy/core/model/AbstractModel.java	2008-10-01 16:19:38 UTC (rev 1979)
+++ artemis/trunk/org.jiemamy.core/src/main/java/org/jiemamy/core/model/AbstractModel.java	2008-10-02 10:55:54 UTC (rev 1980)
@@ -88,7 +88,7 @@
 	@SuppressWarnings("unchecked")
 	public <T>T getAdapter(Class<T> adapter) {
 		for (Object myAdapter : adapters) {
-			if (myAdapter.getClass().isAssignableFrom(adapter)) {
+			if (adapter.isAssignableFrom(myAdapter.getClass())) {
 				return (T) myAdapter;
 			}
 		}
@@ -142,6 +142,14 @@
 	}
 	
 	/**
+	 * TODO for daisuke
+	 * @param adapter 
+	 */
+	public void registerAdapter(Object adapter) {
+		adapters.add(adapter);
+	}
+	
+	/**
 	 * モデルIDを設定する。
 	 * 
 	 * <p>モデルIDは、このモデルのライフサイクル(生成から削除まで)を通して一貫しているべきであり、通常このメソッドは

Added: artemis/trunk/org.jiemamy.core/src/main/java/org/jiemamy/core/model/JiemamyModelAppender.java
===================================================================
--- artemis/trunk/org.jiemamy.core/src/main/java/org/jiemamy/core/model/JiemamyModelAppender.java	                        (rev 0)
+++ artemis/trunk/org.jiemamy.core/src/main/java/org/jiemamy/core/model/JiemamyModelAppender.java	2008-10-02 10:55:54 UTC (rev 1980)
@@ -0,0 +1,45 @@
+/*
+ * Copyright 2007-2008 MIYAMOTO Daisuke, jiemamy.org and the Others.
+ * Created on 2008/10/02
+ *
+ * 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.jiemamy.spec.model.JiemamyModel;
+
+/**
+ * TODO for daisuke
+ * @author daisuke
+ */
+public interface JiemamyModelAppender {
+	
+	/**
+	 * TODO for daisuke
+	 * @param parent
+	 * @param child 
+	 * @return
+	 */
+	public boolean append(JiemamyModel parent, JiemamyModel child);
+	
+	/**
+	 * TODO for daisuke
+	 * @param parent 
+	 * @param child 
+	 * @return
+	 */
+	public boolean remove(JiemamyModel parent, JiemamyModel child);
+	
+}


Property changes on: artemis/trunk/org.jiemamy.core/src/main/java/org/jiemamy/core/model/JiemamyModelAppender.java
___________________________________________________________________
Name: svn:mime-type
   + text/plain

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-10-01 16:19:38 UTC (rev 1979)
+++ artemis/trunk/org.jiemamy.core/src/main/java/org/jiemamy/core/model/RootModelImpl.java	2008-10-02 10:55:54 UTC (rev 1980)
@@ -28,7 +28,7 @@
 import org.jiemamy.core.utils.processor.root.GetEntityProcessor;
 import org.jiemamy.core.utils.processor.root.GetNodesProcessor;
 import org.jiemamy.core.utils.processor.root.ProvideEntityNameProcessor;
-import org.jiemamy.spec.exception.JiemamyRuntimeException;
+import org.jiemamy.spec.exception.CannotAppendException;
 import org.jiemamy.spec.exception.TooManyElementsException;
 import org.jiemamy.spec.extension.dialect.IdentifierValidator;
 import org.jiemamy.spec.model.DomainModel;
@@ -80,20 +80,21 @@
 	@Binding("list")
 	private List<InsertDataSetModel> insertDataSets;
 	
+	/** TODO for daisuke */
+	@Binding("list")
+	private List<JiemamyModelAppender> appenders;
+	
 
 	/**
 	 * {@inheritDoc}
 	 */
 	public void appendModel(JiemamyModel jiemamyModel) {
-		if (jiemamyModel instanceof AbstractNodeModel) {
-			nodes.add((AbstractNodeModel) jiemamyModel);
-		} else if (jiemamyModel instanceof AbstractConnectionModel) {
-			AbstractConnectionModel connection = (AbstractConnectionModel) jiemamyModel;
-			connection.getSource().getSourceConnections().add(connection);
-			connection.getTarget().getTargetConnections().add(connection);
-		} else {
-			throw new JiemamyRuntimeException();
+		for (JiemamyModelAppender appender : appenders) {
+			if (appender.append(this, jiemamyModel)) {
+				return;
+			}
 		}
+		throw new CannotAppendException();
 	}
 	
 	/**
@@ -216,6 +217,13 @@
 		process(new ProvideEntityNameProcessor(entityModel, validator));
 	}
 	
+	/**
+	 * {@inheritDoc}
+	 */
+	public void provideValidName(ForeignKeyModel relationModel, IdentifierValidator validator) {
+		process(new ProvideForeignKeyNameProcessor(relationModel, validator));
+	}
+	
 //	/**
 //	 * {@inheritDoc}
 //	 */
@@ -225,25 +233,23 @@
 //	}
 	
 	/**
-	 * {@inheritDoc}
+	 * TODO for daisuke
+	 * @param appender 
 	 */
-	public void provideValidName(ForeignKeyModel relationModel, IdentifierValidator validator) {
-		process(new ProvideForeignKeyNameProcessor(relationModel, validator));
+	public void registerAppender(JiemamyModelAppender appender) {
+		appenders.add(appender);
 	}
 	
 	/**
 	 * {@inheritDoc}
 	 */
 	public void removeModel(JiemamyModel jiemamyModel) {
-		if (jiemamyModel instanceof AbstractNodeModel) {
-			nodes.remove(jiemamyModel);
-		} else if (jiemamyModel instanceof AbstractConnectionModel) {
-			AbstractConnectionModel connection = (AbstractConnectionModel) jiemamyModel;
-			connection.getSource().getSourceConnections().remove(connection);
-			connection.getTarget().getTargetConnections().remove(connection);
-		} else {
-			throw new JiemamyRuntimeException();
+		for (JiemamyModelAppender appender : appenders) {
+			if (appender.remove(this, jiemamyModel)) {
+				return;
+			}
 		}
+		throw new CannotAppendException();
 	}
 	
 	/**

Modified: 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	2008-10-01 16:19:38 UTC (rev 1979)
+++ artemis/trunk/org.jiemamy.core/src/main/java/org/jiemamy/core/utils/processor/root/CreateNewModelProcessor.java	2008-10-02 10:55:54 UTC (rev 1980)
@@ -18,9 +18,7 @@
  */
 package org.jiemamy.core.utils.processor.root;
 
-import org.seasar.framework.container.S2Container;
-import org.seasar.framework.container.factory.SingletonS2ContainerFactory;
-
+import org.jiemamy.spec.JiemamyModelFactory;
 import org.jiemamy.spec.exception.JiemamyRuntimeException;
 import org.jiemamy.spec.model.JiemamyModel;
 import org.jiemamy.spec.model.RootModel;
@@ -35,8 +33,6 @@
 	
 	private Class<?> clazz;
 	
-	private S2Container container;
-	
 
 	/**
 	 * コンストラクタ。
@@ -45,8 +41,6 @@
 	 * @category instance creation
 	 */
 	public CreateNewModelProcessor(RootModel rootModel, Class<T> clazz) {
-		SingletonS2ContainerFactory.init();
-		container = SingletonS2ContainerFactory.getContainer();
 		this.clazz = clazz;
 	}
 	
@@ -56,7 +50,8 @@
 	@SuppressWarnings("unchecked")
 	public T process(RootModel target) {
 		try {
-			return (T) container.getComponent(clazz);
+			
+			return (T) JiemamyModelFactory.getInstance(clazz);
 		} catch (Exception e) {
 			throw new JiemamyRuntimeException(e);
 		}

Modified: artemis/trunk/org.jiemamy.core/src/main/resources/jiemamy-core.dicon
===================================================================
--- artemis/trunk/org.jiemamy.core/src/main/resources/jiemamy-core.dicon	2008-10-01 16:19:38 UTC (rev 1979)
+++ artemis/trunk/org.jiemamy.core/src/main/resources/jiemamy-core.dicon	2008-10-02 10:55:54 UTC (rev 1980)
@@ -4,9 +4,17 @@
 <components namespace="org.jiemamy">
 	<component name="list" class="java.util.ArrayList" instance="prototype"/>
 	<component name="set" class="java.util.HashSet" instance="prototype"/>
+	<component name="map" class="java.util.HashMap" instance="prototype"/>
 	
 	<!-- Jiemamy Model -->
-	<component class="org.jiemamy.core.model.RootModelImpl" instance="prototype"/>
+	<component class="org.jiemamy.core.model.RootModelImpl" instance="prototype">
+		<initMethod name="registerAppender">
+			<arg><component class="org.jiemamy.core.appender.NodeAppender" /></arg>
+		</initMethod>
+		<initMethod name="registerAppender">
+			<arg><component class="org.jiemamy.core.appender.ConnectionAppender" /></arg>
+		</initMethod>
+	</component>
 	<component class="org.jiemamy.core.model.node.ViewModelImpl" instance="prototype"/>
 	<component class="org.jiemamy.core.model.node.StickyModelImpl" instance="prototype"/>
 	<component class="org.jiemamy.core.model.connection.ForeignKeyModelImpl" instance="prototype" autoBinding="none"/>

Modified: artemis/trunk/org.jiemamy.event/src/main/java/org/jiemamy/event/ObservableImpl.java
===================================================================
--- artemis/trunk/org.jiemamy.event/src/main/java/org/jiemamy/event/ObservableImpl.java	2008-10-01 16:19:38 UTC (rev 1979)
+++ artemis/trunk/org.jiemamy.event/src/main/java/org/jiemamy/event/ObservableImpl.java	2008-10-02 10:55:54 UTC (rev 1980)
@@ -18,40 +18,10 @@
  */
 package org.jiemamy.event;
 
-import java.lang.reflect.Field;
-
-import org.jiemamy.spec.event.ModelChangeListener;
-import org.jiemamy.spec.event.Observable;
-
-
 /**
  * TODO for daisuke
  * @author daisuke
  */
-public class ObservableImpl implements Observable {
+public class ObservableImpl extends AbstractObservable {
 	
-	/**
-	 * {@inheritDoc}
-	 */
-	public void addModelChangeListener(ModelChangeListener listener) {
-		// TODO Auto-generated method stub
-		
-	}
-	
-	/**
-	 * {@inheritDoc}
-	 */
-	public void fireModelChange(Field field) {
-		// TODO Auto-generated method stub
-		
-	}
-	
-	/**
-	 * {@inheritDoc}
-	 */
-	public void removeModelChangeListener(ModelChangeListener listener) {
-		// TODO Auto-generated method stub
-		
-	}
-	
 }

Modified: artemis/trunk/org.jiemamy.event/src/main/resources/jiemamy-event.dicon
===================================================================
--- artemis/trunk/org.jiemamy.event/src/main/resources/jiemamy-event.dicon	2008-10-01 16:19:38 UTC (rev 1979)
+++ artemis/trunk/org.jiemamy.event/src/main/resources/jiemamy-event.dicon	2008-10-02 10:55:54 UTC (rev 1980)
@@ -8,19 +8,47 @@
 	<component name="set" class="org.jiemamy.spec.event.collectionimpl.ObservableSet" instance="prototype"/>
 	<component name="observableImpl" class="org.jiemamy.event.ObservableImpl" instance="prototype"/>
 	
+	<component class="org.jiemamy.core.model.RootModelImpl" instance="prototype">
+		<initMethod name="registerAdapter">
+			<arg>observableImpl</arg>
+		</initMethod>
+		<initMethod name="registerAppender">
+			<arg>
+				<component class="org.jiemamy.core.appender.NodeAppender" />
+			</arg>
+		</initMethod>
+		<initMethod name="registerAppender">
+			<arg>
+				<component class="org.jiemamy.core.appender.ConnectionAppender" />
+			</arg>
+		</initMethod>
+	</component>
+	
 	<!-- ChangeEventを自動的に発火させるためのsetterInterceptor -->
 	<component name="setterInterceptor" class="org.jiemamy.event.SetterInterceptor"/>
 	<component class="org.jiemamy.core.model.node.TableModelImpl" instance="prototype">
 		<aspect pointcut="set.*">setterInterceptor</aspect> 
+		<initMethod name="registerAdapter">
+			<arg>observableImpl</arg>
+		</initMethod>
 	</component>
 	<component class="org.jiemamy.core.model.ColumnModelImpl" instance="prototype" autoBinding="none">
 		<aspect pointcut="set.*">setterInterceptor</aspect> 
+		<initMethod name="registerAdapter">
+			<arg>observableImpl</arg>
+		</initMethod>
 	</component>
 	<component class="org.jiemamy.core.model.index.IndexModelImpl" instance="prototype">
 		<aspect pointcut="set.*">setterInterceptor</aspect> 
+		<initMethod name="registerAdapter">
+			<arg>observableImpl</arg>
+		</initMethod>
 	</component>
 	<component class="org.jiemamy.core.model.constraint.CheckConstraintModelImpl" instance="prototype">
 		<aspect pointcut="set.*">setterInterceptor</aspect> 
+		<initMethod name="registerAdapter">
+			<arg>observableImpl</arg>
+		</initMethod>
 	</component>
 	
 	<!-- 自動登録されたModelへのsetterInterceptorの自動登録 -->

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-10-01 16:19:38 UTC (rev 1979)
+++ artemis/trunk/org.jiemamy.event/src/test/java/org/jiemamy/core/event/SetterInterceptorTest.java	2008-10-02 10:55:54 UTC (rev 1980)
@@ -26,8 +26,10 @@
 import org.junit.Before;
 import org.junit.BeforeClass;
 import org.junit.Test;
+import org.junit.runner.RunWith;
 import org.seasar.framework.container.S2Container;
 import org.seasar.framework.container.factory.S2ContainerFactory;
+import org.seasar.framework.unit.Seasar2;
 import org.seasar.framework.util.tiger.CollectionsUtil;
 
 import org.jiemamy.core.S2FactoryStrategy;
@@ -43,6 +45,7 @@
  * {@link SetterInterceptor}のテストクラス。
  * @author shin1ogawa
  */
+ @ RunWith(Seasar2.class)
 public class SetterInterceptorTest {
 	
 	/** S2Container */
@@ -71,7 +74,7 @@
 	 */
 	@Before
 	public void setUp() {
-		JiemamyModelFactory.init(new S2FactoryStrategy("jiemamy-core.dicon"));
+		JiemamyModelFactory.init(new S2FactoryStrategy("jiemamy-event.dicon"));
 		
 		tableModel = (TableModel) s2container.getComponent(TableModel.class);
 		listener = (new ModelChangeListenerImpl());

Modified: artemis/trunk/org.jiemamy.serializer/src/main/java/org/jiemamy/serializer/model/AbstractSerializeModel.java
===================================================================
--- artemis/trunk/org.jiemamy.serializer/src/main/java/org/jiemamy/serializer/model/AbstractSerializeModel.java	2008-10-01 16:19:38 UTC (rev 1979)
+++ artemis/trunk/org.jiemamy.serializer/src/main/java/org/jiemamy/serializer/model/AbstractSerializeModel.java	2008-10-02 10:55:54 UTC (rev 1980)
@@ -46,6 +46,10 @@
 		return id;
 	}
 	
+	public void registerAdapter(Object adapter) {
+		
+	}
+	
 	/**
 	 * ID属性を設定する。
 	 * @param id ID属性

Added: artemis/trunk/org.jiemamy.view/src/main/java/org/jiemamy/view/DiagramPresentationModelAppender.java
===================================================================
--- artemis/trunk/org.jiemamy.view/src/main/java/org/jiemamy/view/DiagramPresentationModelAppender.java	                        (rev 0)
+++ artemis/trunk/org.jiemamy.view/src/main/java/org/jiemamy/view/DiagramPresentationModelAppender.java	2008-10-02 10:55:54 UTC (rev 1980)
@@ -0,0 +1,59 @@
+/*
+ * Copyright 2007-2008 MIYAMOTO Daisuke, jiemamy.org and the Others.
+ * Created on 2008/10/02
+ *
+ * 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.view;
+
+import org.jiemamy.core.model.JiemamyModelAppender;
+import org.jiemamy.spec.model.JiemamyModel;
+import org.jiemamy.spec.model.RootModel;
+import org.jiemamy.spec.model.presentation.DiagramPresentationModel;
+import org.jiemamy.spec.view.DiagramPresentations;
+
+/**
+ * TODO for daisuke
+ * @author daisuke
+ */
+public class DiagramPresentationModelAppender implements JiemamyModelAppender {
+	
+	/**
+	 * {@inheritDoc}
+	 */
+	public boolean append(JiemamyModel parent, JiemamyModel child) {
+		if (parent instanceof RootModel && child instanceof DiagramPresentationModel) {
+			RootModel rootModel = (RootModel) parent;
+			DiagramPresentationModel diagramPresentationModel = (DiagramPresentationModel) child;
+			rootModel.getAdapter(DiagramPresentations.class).add(diagramPresentationModel);
+			return true;
+		}
+		return false;
+	}
+	
+	/**
+	 * {@inheritDoc}
+	 */
+	public boolean remove(JiemamyModel parent, JiemamyModel child) {
+		if (parent instanceof RootModel && child instanceof DiagramPresentationModel) {
+			RootModel rootModel = (RootModel) parent;
+			DiagramPresentationModel diagramPresentationModel = (DiagramPresentationModel) child;
+			rootModel.getAdapter(DiagramPresentations.class).remove(diagramPresentationModel);
+			return true;
+		}
+		return false;
+	}
+	
+}


Property changes on: artemis/trunk/org.jiemamy.view/src/main/java/org/jiemamy/view/DiagramPresentationModelAppender.java
___________________________________________________________________
Name: svn:mime-type
   + text/plain

Modified: artemis/trunk/org.jiemamy.view/src/main/java/org/jiemamy/view/DiagramPresentationModelImpl.java
===================================================================
--- artemis/trunk/org.jiemamy.view/src/main/java/org/jiemamy/view/DiagramPresentationModelImpl.java	2008-10-01 16:19:38 UTC (rev 1979)
+++ artemis/trunk/org.jiemamy.view/src/main/java/org/jiemamy/view/DiagramPresentationModelImpl.java	2008-10-02 10:55:54 UTC (rev 1980)
@@ -22,6 +22,8 @@
 import java.util.Map;
 import java.util.Set;
 
+import org.seasar.framework.container.annotation.tiger.Binding;
+
 import org.jiemamy.core.model.AbstractModel;
 import org.jiemamy.spec.geometory.JmColor;
 import org.jiemamy.spec.geometory.JmPoint;
@@ -42,6 +44,7 @@
 	private String name;
 	
 	/** 表示モード */
+	@Binding("set")
 	private Set<DisplayItem> displayTargetSet;
 	
 	/**
@@ -49,6 +52,7 @@
 	 * 
 	 * 表示されるノードであれば矩形情報を持ち、非表示であればエントリを持たない。
 	 */
+	@Binding("map")
 	private Map<AbstractNodeModel, JmRectangle> nodeLayouts;
 	
 	/**
@@ -57,6 +61,7 @@
 	 * デフォルト色のノードであれば、エントリを持たない。
 	 * THINK JiemamyRectangleに持たせてしまうべき? ColorとRectangleは分離しているべき?
 	 */
+	@Binding("map")
 	private Map<AbstractNodeModel, JmColor> nodeColors;
 	
 	/**
@@ -64,6 +69,7 @@
 	 * 
 	 * ベンドポイントがあれば座標のリストを持ち、なければエントリを持たない。
 	 */
+	@Binding("map")
 	private Map<AbstractConnectionModel, List<JmPoint>> connectionLayouts;
 	
 

Modified: artemis/trunk/org.jiemamy.view/src/main/resources/jiemamy-view.dicon
===================================================================
--- artemis/trunk/org.jiemamy.view/src/main/resources/jiemamy-view.dicon	2008-10-01 16:19:38 UTC (rev 1979)
+++ artemis/trunk/org.jiemamy.view/src/main/resources/jiemamy-view.dicon	2008-10-02 10:55:54 UTC (rev 1980)
@@ -3,6 +3,21 @@
 	"http://www.seasar.org/dtd/components24.dtd">
 <components>
 	<include path="jiemamy-core.dicon"/>
-	<component class="org.jiemamy.view.DiagramPresentationsImpl" instance="prototype"/>
 	<component class="org.jiemamy.view.DiagramPresentationModelImpl" instance="prototype"/>
+	
+	<component class="org.jiemamy.core.model.RootModelImpl" instance="prototype">
+		<initMethod name="registerAdapter">
+			<arg><component class="org.jiemamy.view.DiagramPresentationsImpl"/></arg>
+		</initMethod>
+		<initMethod name="registerAppender">
+			<arg><component class="org.jiemamy.core.appender.NodeAppender" /></arg>
+		</initMethod>
+		<initMethod name="registerAppender">
+			<arg><component class="org.jiemamy.core.appender.ConnectionAppender" /></arg>
+		</initMethod>
+		<initMethod name="registerAppender">
+			<arg><component class="org.jiemamy.view.DiagramPresentationModelAppender" /></arg>
+		</initMethod>
+	</component>
+	
 </components>

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-10-01 16:19:38 UTC (rev 1979)
+++ artemis/trunk/org.jiemamy.view/src/test/java/org/jiemamy/core/utils/processor/root/presentation/SetColorProcessorTest.java	2008-10-02 10:55:54 UTC (rev 1980)
@@ -25,8 +25,6 @@
 import org.junit.After;
 import org.junit.Before;
 import org.junit.Test;
-import org.junit.runner.RunWith;
-import org.seasar.framework.unit.Seasar2;
 
 import org.jiemamy.core.MustBeMulti;
 import org.jiemamy.core.S2FactoryStrategy;
@@ -42,7 +40,6 @@
  * {@link SetColorProcessor}のテストクラス。
  * @author daisuke
  */
- @ RunWith(Seasar2.class)
 public class SetColorProcessorTest {
 	
 	private RootModel rootModel;
@@ -61,7 +58,6 @@
 		DiagramPresentationModel presentation = rootModel.createJiemamyModel(DiagramPresentationModel.class);
 		rootModel.appendModel(presentation);
 		presentation.setName("テスト");
-		rootModel.appendModel(presentation);
 		
 		TableModel table = rootModel.createJiemamyModel(TableModel.class);
 		table.setName("T_TEST");

Modified: zeus/trunk/org.jiemamy.spec.core/src/main/java/org/jiemamy/spec/JiemamyModelFactory.java
===================================================================
--- zeus/trunk/org.jiemamy.spec.core/src/main/java/org/jiemamy/spec/JiemamyModelFactory.java	2008-10-01 16:19:38 UTC (rev 1979)
+++ zeus/trunk/org.jiemamy.spec.core/src/main/java/org/jiemamy/spec/JiemamyModelFactory.java	2008-10-02 10:55:54 UTC (rev 1980)
@@ -96,6 +96,15 @@
 	}
 	
 	/**
+	 * TODO for daisuke
+	 * @param clazz 
+	 * @return
+	 */
+	public static <T>T getInstance(Class<T> clazz) {
+		return instance.strategy.create(clazz);
+	}
+	
+	/**
 	 * ファクトリを初期化する。
 	 * @param strategy インスタンス生成戦略
 	 */

Added: zeus/trunk/org.jiemamy.spec.core/src/main/java/org/jiemamy/spec/exception/CannotAppendException.java
===================================================================
--- zeus/trunk/org.jiemamy.spec.core/src/main/java/org/jiemamy/spec/exception/CannotAppendException.java	                        (rev 0)
+++ zeus/trunk/org.jiemamy.spec.core/src/main/java/org/jiemamy/spec/exception/CannotAppendException.java	2008-10-02 10:55:54 UTC (rev 1980)
@@ -0,0 +1,28 @@
+/*
+ * Copyright 2007-2008 MIYAMOTO Daisuke, jiemamy.org and the Others.
+ * Created on 2008/10/02
+ *
+ * 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.exception;
+
+/**
+ * TODO for daisuke
+ * @author daisuke
+ */
+ @ SuppressWarnings("serial")
+public class CannotAppendException extends JiemamyRuntimeException {
+	
+}


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

Deleted: zeus/trunk/org.jiemamy.spec.core/src/main/java/org/jiemamy/spec/exception/MappingValueNotFoundException.java
===================================================================
--- zeus/trunk/org.jiemamy.spec.core/src/main/java/org/jiemamy/spec/exception/MappingValueNotFoundException.java	2008-10-01 16:19:38 UTC (rev 1979)
+++ zeus/trunk/org.jiemamy.spec.core/src/main/java/org/jiemamy/spec/exception/MappingValueNotFoundException.java	2008-10-02 10:55:54 UTC (rev 1980)
@@ -1,30 +0,0 @@
-/*
- * Copyright 2007-2008 MIYAMOTO Daisuke, jiemamy.org and the Others.
- * Created on 2008/06/22
- *
- * This file is part of Jiemamy-core.
- *
- * 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.exception;
-
-import org.jiemamy.spec.model.dataset.RecordModel;
-
-/**
- * {@link RecordModel}に対して問い合わせた値が「特定されない状態」である場合にスローされる例外。
- * @author daisuke
- */
- @ SuppressWarnings("serial")
-public class MappingValueNotFoundException extends JiemamyException {
-	
-}

Modified: zeus/trunk/org.jiemamy.spec.core/src/main/java/org/jiemamy/spec/model/RootModel.java
===================================================================
--- zeus/trunk/org.jiemamy.spec.core/src/main/java/org/jiemamy/spec/model/RootModel.java	2008-10-01 16:19:38 UTC (rev 1979)
+++ zeus/trunk/org.jiemamy.spec.core/src/main/java/org/jiemamy/spec/model/RootModel.java	2008-10-02 10:55:54 UTC (rev 1980)
@@ -75,6 +75,12 @@
 	 */
 	String getDialectClassName();
 	
+	/**
+	 * ドメインのリストを取得する。
+	 * @return ドメインのリスト
+	 */
+	List<DomainModel> getDomains();
+	
 //	/**
 //	 * 特定の種類のコネクション{@link Set}を取得する。
 //	 * @param <T> 取得したいコネクションのクラス
@@ -85,12 +91,6 @@
 //	<T extends AbstractConnectionModel>Set<T> getConnections(Class<T> clazz);
 	
 	/**
-	 * ドメインのリストを取得する。
-	 * @return ドメインのリスト
-	 */
-	List<DomainModel> getDomains();
-	
-	/**
 	 * 終了スクリプトを取得する。
 	 * @return 終了スクリプト
 	 */


Jiemamy-notify メーリングリストの案内
アーカイブの一覧に戻る