[Jiemamy-notify] commit [2194] refactor

Back to archive index

svnno****@sourc***** svnno****@sourc*****
2008年 11月 30日 (日) 23:23:04 JST


Revision: 2194
          http://svn.sourceforge.jp/view?root=jiemamy&view=rev&rev=2194
Author:   daisuke_m
Date:     2008-11-30 23:23:04 +0900 (Sun, 30 Nov 2008)

Log Message:
-----------
refactor

Modified Paths:
--------------
    artemis/trunk/org.jiemamy.serializer/src/main/java/org/jiemamy/core/model/ColumnCommand.java
    artemis/trunk/org.jiemamy.serializer/src/main/java/org/jiemamy/core/model/ConstraintCommand.java
    artemis/trunk/org.jiemamy.serializer/src/main/java/org/jiemamy/core/model/DataSetCommand.java
    artemis/trunk/org.jiemamy.serializer/src/main/java/org/jiemamy/core/model/DomainCommand.java
    artemis/trunk/org.jiemamy.serializer/src/main/java/org/jiemamy/core/model/EntityModelCommand.java
    artemis/trunk/org.jiemamy.serializer/src/main/java/org/jiemamy/core/model/ForeignKeyCommand.java
    artemis/trunk/org.jiemamy.serializer/src/main/java/org/jiemamy/core/model/ForeignKeyMappingCommand.java
    artemis/trunk/org.jiemamy.serializer/src/main/java/org/jiemamy/core/model/JiemamyHandler.java
    artemis/trunk/org.jiemamy.serializer/src/main/java/org/jiemamy/core/model/JiemamyModelCommand.java
    artemis/trunk/org.jiemamy.serializer/src/main/java/org/jiemamy/core/model/NodesCommand.java
    artemis/trunk/org.jiemamy.serializer/src/main/java/org/jiemamy/core/model/RootCommand.java
    artemis/trunk/org.jiemamy.serializer/src/main/java/org/jiemamy/core/model/StickyCommand.java
    artemis/trunk/org.jiemamy.serializer/src/main/java/org/jiemamy/core/model/TableCommand.java
    artemis/trunk/org.jiemamy.serializer/src/main/java/org/jiemamy/core/model/ViewCommand.java
    artemis/trunk/org.jiemamy.serializer/src/main/java/org/jiemamy/core/model/XmlElementCommand.java

Added Paths:
-----------
    artemis/trunk/org.jiemamy.serializer/src/main/java/org/jiemamy/core/model/XmlElementCommandAdapter.java

Removed Paths:
-------------
    artemis/trunk/org.jiemamy.serializer/src/main/java/org/jiemamy/core/model/AbstractXmlElementCommand.java


-------------- next part --------------
Deleted: artemis/trunk/org.jiemamy.serializer/src/main/java/org/jiemamy/core/model/AbstractXmlElementCommand.java
===================================================================
--- artemis/trunk/org.jiemamy.serializer/src/main/java/org/jiemamy/core/model/AbstractXmlElementCommand.java	2008-11-30 14:08:17 UTC (rev 2193)
+++ artemis/trunk/org.jiemamy.serializer/src/main/java/org/jiemamy/core/model/AbstractXmlElementCommand.java	2008-11-30 14:23:04 UTC (rev 2194)
@@ -1,55 +0,0 @@
-/*
- * Copyright 2007-2008 MIYAMOTO Daisuke, jiemamy.org and the Others.
- * Created on 2008/11/07
- *
- * 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.xml.sax.Attributes;
-
-
-/**
- * 空実装のXmlElementCommand。
- * @author ykhr
- */
-class AbstractXmlElementCommand implements XmlElementCommand {
-	
-	/**
-	 * {@inheritDoc}
-	 */
-	public void end(ModelInfo model, XmlElement element, String text) {
-	}
-	
-	/**
-	 * {@inheritDoc}
-	 */
-	public void endChild(XmlElement element, ModelInfo model, String text) {
-	}
-	
-	/**
-	 * {@inheritDoc}
-	 */
-	public void start(XmlElement element, ModelInfo model, Attributes attributes) {
-	}
-	
-	/**
-	 * {@inheritDoc}
-	 */
-	public XmlElementCommand startChild(XmlElement element, ModelInfo model, Attributes attributes) {
-		return null;
-	}
-	
-}

Modified: artemis/trunk/org.jiemamy.serializer/src/main/java/org/jiemamy/core/model/ColumnCommand.java
===================================================================
--- artemis/trunk/org.jiemamy.serializer/src/main/java/org/jiemamy/core/model/ColumnCommand.java	2008-11-30 14:08:17 UTC (rev 2193)
+++ artemis/trunk/org.jiemamy.serializer/src/main/java/org/jiemamy/core/model/ColumnCommand.java	2008-11-30 14:23:04 UTC (rev 2194)
@@ -35,19 +35,19 @@
 	 * {@inheritDoc}
 	 */
 	@Override
-	public void end(ModelInfo model, XmlElement element, String text) {
-		ColumnModel columnModel = model.getColumnModel();
+	public void end(ModelInfo modelInfo, XmlElement element, String text) {
+		ColumnModel columnModel = modelInfo.getColumnModel();
 		columnModel.setName(columnModel.getName());
 		columnModel.setDataType(columnModel.getDataType());
-		model.getTableModel().appendModel(columnModel);
+		modelInfo.getTableModel().appendModel(columnModel);
 	}
 	
 	/**
 	 * {@inheritDoc}
 	 */
 	@Override
-	public void endChild(XmlElement element, ModelInfo model, String text) {
-		ColumnModel columnModel = model.getColumnModel();
+	public void endChild(XmlElement element, ModelInfo modelInfo, String text) {
+		ColumnModel columnModel = modelInfo.getColumnModel();
 		String elementName = element.getName();
 		
 		if (elementName.equals("name")) {
@@ -71,33 +71,33 @@
 	 * {@inheritDoc}
 	 */
 	@Override
-	public void start(XmlElement element, ModelInfo model, Attributes attributes) {
-		ColumnModel columnModel = model.getRootModel().newModel(ColumnModel.class);
-		model.setColumnModel(columnModel);
-		model.initConstraints();
-		super.start(element, model, attributes);
+	public void start(XmlElement element, ModelInfo modelInfo, Attributes attributes) {
+		ColumnModel columnModel = modelInfo.getRootModel().newModel(ColumnModel.class);
+		modelInfo.setColumnModel(columnModel);
+		modelInfo.initConstraints();
+		super.start(element, modelInfo, attributes);
 	}
 	
 	/**
 	 * {@inheritDoc}
 	 */
 	@Override
-	public XmlElementCommand startChild(XmlElement element, ModelInfo model, Attributes attributes) {
+	public XmlElementCommand startChild(XmlElement element, ModelInfo modelInfo, Attributes attributes) {
 		String elementName = element.getName();
 		
 		if (elementName.equals("constraints")) {
-			return new AbstractXmlElementCommand() {
+			return new XmlElementCommandAdapter() {
 				
 				@Override
-				public void end(ModelInfo model, XmlElement element, String text) {
-					ColumnModel columnModel = model.getColumnModel();
-					for (Constraint constraint : model.getConstraints()) {
+				public void end(ModelInfo modelInfo, XmlElement element, String text) {
+					ColumnModel columnModel = modelInfo.getColumnModel();
+					for (Constraint constraint : modelInfo.getConstraints()) {
 						columnModel.addConstraint(constraint);
 					}
 				}
 				
 				@Override
-				public XmlElementCommand startChild(XmlElement element, ModelInfo model, Attributes attributes) {
+				public XmlElementCommand startChild(XmlElement element, ModelInfo modelInfo, Attributes attributes) {
 					if (!element.getName().equals("constraint")) {
 						throw new IllegalStateException();
 					}
@@ -127,18 +127,18 @@
 				// TODO DataTypeのIDは登録するのか
 			}
 			
-			model.getColumnModel().setDataType(DataType.class.cast(dataType));
+			modelInfo.getColumnModel().setDataType(DataType.class.cast(dataType));
 		}
 		
-		return super.startChild(element, model, attributes);
+		return super.startChild(element, modelInfo, attributes);
 	}
 	
 	/**
 	 * {@inheritDoc}
 	 */
 	@Override
-	protected ColumnModel getTargetModel(ModelInfo model) {
-		return model.getColumnModel();
+	protected ColumnModel getTargetModel(ModelInfo modelInfo) {
+		return modelInfo.getColumnModel();
 	}
 	
 }

Modified: artemis/trunk/org.jiemamy.serializer/src/main/java/org/jiemamy/core/model/ConstraintCommand.java
===================================================================
--- artemis/trunk/org.jiemamy.serializer/src/main/java/org/jiemamy/core/model/ConstraintCommand.java	2008-11-30 14:08:17 UTC (rev 2193)
+++ artemis/trunk/org.jiemamy.serializer/src/main/java/org/jiemamy/core/model/ConstraintCommand.java	2008-11-30 14:23:04 UTC (rev 2194)
@@ -37,15 +37,15 @@
 	 * {@inheritDoc}
 	 */
 	@Override
-	public void end(ModelInfo model, XmlElement element, String text) {
-		model.addConstraints(constraint);
+	public void end(ModelInfo modelInfo, XmlElement element, String text) {
+		modelInfo.addConstraints(constraint);
 	}
 	
 	/**
 	 * {@inheritDoc}
 	 */
 	@Override
-	public void endChild(XmlElement element, ModelInfo model, String text) {
+	public void endChild(XmlElement element, ModelInfo modelInfo, String text) {
 		if (element.getName().equals("name")) {
 			constraint.setName(text);
 		}
@@ -55,21 +55,21 @@
 	 * {@inheritDoc}
 	 */
 	@Override
-	public void start(XmlElement element, ModelInfo model, Attributes attributes) {
+	public void start(XmlElement element, ModelInfo modelInfo, Attributes attributes) {
 		String className = attributes.getValue("class");
 		try {
 			constraint = Constraint.class.cast(Class.forName(className).newInstance());
 		} catch (Exception e) {
 			throw new JiemamyRuntimeException(e);
 		}
-		super.start(element, model, attributes);
+		super.start(element, modelInfo, attributes);
 	}
 	
 	/**
 	 * {@inheritDoc}
 	 */
 	@Override
-	protected Constraint getTargetModel(ModelInfo model) {
+	protected Constraint getTargetModel(ModelInfo modelInfo) {
 		return constraint;
 	}
 	

Modified: artemis/trunk/org.jiemamy.serializer/src/main/java/org/jiemamy/core/model/DataSetCommand.java
===================================================================
--- artemis/trunk/org.jiemamy.serializer/src/main/java/org/jiemamy/core/model/DataSetCommand.java	2008-11-30 14:08:17 UTC (rev 2193)
+++ artemis/trunk/org.jiemamy.serializer/src/main/java/org/jiemamy/core/model/DataSetCommand.java	2008-11-30 14:23:04 UTC (rev 2194)
@@ -30,7 +30,7 @@
 	 * {@inheritDoc}
 	 */
 	@Override
-	protected AbstractEntityModel getTargetEntityModel(ModelInfo model) {
+	protected AbstractEntityModel getTargetEntityModel(ModelInfo modelInfo) {
 		// TODO Auto-generated method stub
 		return null;
 	}

Modified: artemis/trunk/org.jiemamy.serializer/src/main/java/org/jiemamy/core/model/DomainCommand.java
===================================================================
--- artemis/trunk/org.jiemamy.serializer/src/main/java/org/jiemamy/core/model/DomainCommand.java	2008-11-30 14:08:17 UTC (rev 2193)
+++ artemis/trunk/org.jiemamy.serializer/src/main/java/org/jiemamy/core/model/DomainCommand.java	2008-11-30 14:23:04 UTC (rev 2194)
@@ -35,8 +35,8 @@
 	 * {@inheritDoc}
 	 */
 	@Override
-	public void endChild(XmlElement element, ModelInfo model, String text) {
-		DomainModel domainModel = model.getDomainModel();
+	public void endChild(XmlElement element, ModelInfo modelInfo, String text) {
+		DomainModel domainModel = modelInfo.getDomainModel();
 		String elementName = element.getName();
 		
 		if (elementName.equals("name")) {
@@ -52,7 +52,7 @@
 		} else if (elementName.equals("description")) {
 			domainModel.setDescription(text);
 		} else {
-			super.endChild(element, model, text);
+			super.endChild(element, modelInfo, text);
 		}
 		// TODO options??
 	}
@@ -61,33 +61,33 @@
 	 * {@inheritDoc}
 	 */
 	@Override
-	public void start(XmlElement element, ModelInfo model, Attributes attributes) {
-		DomainModel domainModel = model.getRootModel().newModel(DomainModel.class);
-		model.setDomainModel(domainModel);
-		model.initConstraints();
-		super.start(element, model, attributes);
+	public void start(XmlElement element, ModelInfo modelInfo, Attributes attributes) {
+		DomainModel domainModel = modelInfo.getRootModel().newModel(DomainModel.class);
+		modelInfo.setDomainModel(domainModel);
+		modelInfo.initConstraints();
+		super.start(element, modelInfo, attributes);
 	}
 	
 	/**
 	 * {@inheritDoc}
 	 */
 	@Override
-	public XmlElementCommand startChild(XmlElement element, ModelInfo model, Attributes attributes) {
+	public XmlElementCommand startChild(XmlElement element, ModelInfo modelInfo, Attributes attributes) {
 		String elementName = element.getName();
 		
 		if (elementName.equals("constraints")) {
-			return new AbstractXmlElementCommand() {
+			return new XmlElementCommandAdapter() {
 				
 				@Override
-				public void end(ModelInfo model, XmlElement element, String text) {
-					DomainModel domainModel = model.getDomainModel();
-					for (Constraint constraint : model.getConstraints()) {
+				public void end(ModelInfo modelInfo, XmlElement element, String text) {
+					DomainModel domainModel = modelInfo.getDomainModel();
+					for (Constraint constraint : modelInfo.getConstraints()) {
 						domainModel.addConstraint(constraint);
 					}
 				}
 				
 				@Override
-				public XmlElementCommand startChild(XmlElement element, ModelInfo model, Attributes attributes) {
+				public XmlElementCommand startChild(XmlElement element, ModelInfo modelInfo, Attributes attributes) {
 					if (!element.getName().equals("constraint")) {
 						throw new IllegalStateException();
 					}
@@ -100,7 +100,7 @@
 			String className = attributes.getValue("class");
 			try {
 				DataType dataType = DataType.class.cast(Class.forName(className).newInstance());
-				model.getDomainModel().setDataType(DataType.class.cast(dataType));
+				modelInfo.getDomainModel().setDataType(DataType.class.cast(dataType));
 			} catch (Exception e) {
 				throw new JiemamyRuntimeException(e);
 			}
@@ -113,8 +113,8 @@
 	 * {@inheritDoc}
 	 */
 	@Override
-	protected DomainModel getTargetModel(ModelInfo model) {
-		return model.getDomainModel();
+	protected DomainModel getTargetModel(ModelInfo modelInfo) {
+		return modelInfo.getDomainModel();
 	}
 	
 }

Modified: artemis/trunk/org.jiemamy.serializer/src/main/java/org/jiemamy/core/model/EntityModelCommand.java
===================================================================
--- artemis/trunk/org.jiemamy.serializer/src/main/java/org/jiemamy/core/model/EntityModelCommand.java	2008-11-30 14:08:17 UTC (rev 2193)
+++ artemis/trunk/org.jiemamy.serializer/src/main/java/org/jiemamy/core/model/EntityModelCommand.java	2008-11-30 14:23:04 UTC (rev 2194)
@@ -25,40 +25,40 @@
  * AbstractEntityModelが持つプロパティに値を設定する。
  * @author ykhr
  */
-abstract class EntityModelCommand extends JiemamyModelCommand {
+abstract class EntityModelCommand extends JiemamyModelCommand<AbstractEntityModel> {
 	
 	/**
 	 * {@inheritDoc}
 	 */
 	@Override
-	public void endChild(XmlElement element, ModelInfo model, String text) {
+	public void endChild(XmlElement element, ModelInfo modelInfo, String text) {
 		String elementName = element.getName();
 		if (elementName.equals("name")) {
-			getTargetEntityModel(model).setName(text);
+			getTargetEntityModel(modelInfo).setName(text);
 		} else if (elementName.equals("logicalName")) {
-			getTargetEntityModel(model).setLogicalName(text);
+			getTargetEntityModel(modelInfo).setLogicalName(text);
 		} else if (elementName.equals("beginScript")) {
-			getTargetEntityModel(model).setBeginScript(text);
+			getTargetEntityModel(modelInfo).setBeginScript(text);
 		} else if (elementName.equals("endScript")) {
-			getTargetEntityModel(model).setEndScript(text);
+			getTargetEntityModel(modelInfo).setEndScript(text);
 		} else if (elementName.equals("description")) {
-			getTargetEntityModel(model).setDescription(text);
+			getTargetEntityModel(modelInfo).setDescription(text);
 		}
 	}
 	
 	/**
 	 * 処理対象のモデルを取得する。
-	 * @param model ModelInfo
+	 * @param modelInfo ModelInfo
 	 * @return AbstractEntityModel
 	 */
-	protected abstract AbstractEntityModel getTargetEntityModel(ModelInfo model);
+	protected abstract AbstractEntityModel getTargetEntityModel(ModelInfo modelInfo);
 	
 	/**
 	 * {@inheritDoc}
 	 */
 	@Override
-	protected Object getTargetModel(ModelInfo model) {
-		return getTargetEntityModel(model);
+	protected AbstractEntityModel getTargetModel(ModelInfo modelInfo) {
+		return getTargetEntityModel(modelInfo);
 	}
 	
 }

Modified: artemis/trunk/org.jiemamy.serializer/src/main/java/org/jiemamy/core/model/ForeignKeyCommand.java
===================================================================
--- artemis/trunk/org.jiemamy.serializer/src/main/java/org/jiemamy/core/model/ForeignKeyCommand.java	2008-11-30 14:08:17 UTC (rev 2193)
+++ artemis/trunk/org.jiemamy.serializer/src/main/java/org/jiemamy/core/model/ForeignKeyCommand.java	2008-11-30 14:23:04 UTC (rev 2194)
@@ -30,14 +30,14 @@
  * foreignKey要素のコマンドクラス。
  * @author ykhr
  */
-class ForeignKeyCommand extends JiemamyModelCommand {
+class ForeignKeyCommand extends JiemamyModelCommand<ForeignKeyModel> {
 	
 	/**
 	 * {@inheritDoc}
 	 */
 	@Override
-	public void end(ModelInfo model, XmlElement element, String text) {
-		ForeignKeyModel foreignKeyModel = model.getForeignKeyModel();
+	public void end(ModelInfo modelInfo, XmlElement element, String text) {
+		ForeignKeyModel foreignKeyModel = modelInfo.getForeignKeyModel();
 		// TODO ModelIdManagerが完成しないとぬるぽで落ちるので、コメントアウト
 //		foreignKeyModel.init(model.getRootModel(), (TableModel) foreignKeyModel.getSource(),
 //				(TableModel) foreignKeyModel.getTarget());
@@ -48,8 +48,8 @@
 	 * {@inheritDoc}
 	 */
 	@Override
-	public void endChild(XmlElement element, ModelInfo model, String text) {
-		ForeignKeyModel foreignKeyModel = model.getForeignKeyModel();
+	public void endChild(XmlElement element, ModelInfo modelInfo, String text) {
+		ForeignKeyModel foreignKeyModel = modelInfo.getForeignKeyModel();
 		String elementName = element.getName();
 		
 		if (elementName.equals("name")) {
@@ -84,25 +84,25 @@
 	 * {@inheritDoc}
 	 */
 	@Override
-	public void start(XmlElement element, ModelInfo model, Attributes attributes) {
-		ForeignKeyModel foreignKeyModel = model.getRootModel().newModel(ForeignKeyModel.class);
-		model.setForeignKeyModel(foreignKeyModel);
-		super.start(element, model, attributes);
+	public void start(XmlElement element, ModelInfo modelInfo, Attributes attributes) {
+		ForeignKeyModel foreignKeyModel = modelInfo.getRootModel().newModel(ForeignKeyModel.class);
+		modelInfo.setForeignKeyModel(foreignKeyModel);
+		super.start(element, modelInfo, attributes);
 	}
 	
 	/**
 	 * {@inheritDoc}
 	 */
 	@Override
-	public XmlElementCommand startChild(XmlElement element, ModelInfo model, Attributes attributes) {
-		ForeignKeyModel foreignKeyModel = model.getForeignKeyModel();
+	public XmlElementCommand startChild(XmlElement element, ModelInfo modelInfo, Attributes attributes) {
+		ForeignKeyModel foreignKeyModel = modelInfo.getForeignKeyModel();
 		String elementName = element.getName();
 		
 		if (elementName.equals("mappings")) {
-			return new AbstractXmlElementCommand() {
+			return new XmlElementCommandAdapter() {
 				
 				@Override
-				public XmlElementCommand startChild(XmlElement element, ModelInfo model, Attributes attributes) {
+				public XmlElementCommand startChild(XmlElement element, ModelInfo modelInfo, Attributes attributes) {
 					if (element.getName().equals("mapping")) {
 						return new ForeignKeyMappingCommand();
 					}
@@ -126,8 +126,8 @@
 	 * {@inheritDoc}
 	 */
 	@Override
-	protected Object getTargetModel(ModelInfo model) {
-		return model.getForeignKeyModel();
+	protected ForeignKeyModel getTargetModel(ModelInfo modelInfo) {
+		return modelInfo.getForeignKeyModel();
 	}
 	
 }

Modified: artemis/trunk/org.jiemamy.serializer/src/main/java/org/jiemamy/core/model/ForeignKeyMappingCommand.java
===================================================================
--- artemis/trunk/org.jiemamy.serializer/src/main/java/org/jiemamy/core/model/ForeignKeyMappingCommand.java	2008-11-30 14:08:17 UTC (rev 2193)
+++ artemis/trunk/org.jiemamy.serializer/src/main/java/org/jiemamy/core/model/ForeignKeyMappingCommand.java	2008-11-30 14:23:04 UTC (rev 2194)
@@ -37,25 +37,25 @@
 	 * {@inheritDoc}
 	 */
 	@Override
-	public void end(ModelInfo model, XmlElement element, String text) {
+	public void end(ModelInfo modelInfo, XmlElement element, String text) {
 		foreignKeyMapping.setReferenceColumn(foreignKeyMapping.getReferenceColumn());
-		model.getForeignKeyModel().getMappings().add(foreignKeyMapping);
+		modelInfo.getForeignKeyModel().getMappings().add(foreignKeyMapping);
 	}
 	
 	/**
 	 * {@inheritDoc}
 	 */
 	@Override
-	public void start(XmlElement element, ModelInfo model, Attributes attributes) {
-		foreignKeyMapping = model.getRootModel().newModel(ForeignKeyMapping.class);
-		super.start(element, model, attributes);
+	public void start(XmlElement element, ModelInfo modelInfo, Attributes attributes) {
+		foreignKeyMapping = modelInfo.getRootModel().newModel(ForeignKeyMapping.class);
+		super.start(element, modelInfo, attributes);
 	}
 	
 	/**
 	 * {@inheritDoc}
 	 */
 	@Override
-	public XmlElementCommand startChild(XmlElement element, ModelInfo model, Attributes attributes) {
+	public XmlElementCommand startChild(XmlElement element, ModelInfo modelInfo, Attributes attributes) {
 		String elementName = element.getName();
 		if (elementName.equals("constraintColumn")) {
 			ColumnModel referenceModel = (ColumnModel) getReferenceModel(attributes);
@@ -74,7 +74,7 @@
 	 * {@inheritDoc}
 	 */
 	@Override
-	protected ForeignKeyMapping getTargetModel(ModelInfo model) {
+	protected ForeignKeyMapping getTargetModel(ModelInfo modelInfo) {
 		return foreignKeyMapping;
 	}
 	

Modified: artemis/trunk/org.jiemamy.serializer/src/main/java/org/jiemamy/core/model/JiemamyHandler.java
===================================================================
--- artemis/trunk/org.jiemamy.serializer/src/main/java/org/jiemamy/core/model/JiemamyHandler.java	2008-11-30 14:08:17 UTC (rev 2193)
+++ artemis/trunk/org.jiemamy.serializer/src/main/java/org/jiemamy/core/model/JiemamyHandler.java	2008-11-30 14:23:04 UTC (rev 2194)
@@ -26,7 +26,6 @@
 import org.xml.sax.Attributes;
 import org.xml.sax.helpers.DefaultHandler;
 
-import org.jiemamy.core.model.FactoryStrategy;
 import org.jiemamy.serializer.DialectInstanceCreationStrategy;
 import org.jiemamy.spec.model.RootModel;
 
@@ -50,7 +49,7 @@
 	private XmlElementStack xmlElementStack = new XmlElementStack();
 	
 	/** モデル */
-	private ModelInfo model = null;
+	private ModelInfo modelInfo = null;
 	
 	/** コマンドのスタック */
 	private Stack<CommandInfo> commandStack = CollectionsUtil.newStack();
@@ -90,13 +89,13 @@
 		XmlElementCommand command = commandInfo.getCommand();
 		
 		if (commandInfo.getStackAtCommandStarted().equals(xmlElementStack)) {
-			command.end(model, element, buffer.toString());
+			command.end(modelInfo, element, buffer.toString());
 			commandStack.pop();
 			
 			// TODO
 			logger.trace("***end command: " + command);
 		} else {
-			command.endChild(element, model, buffer.toString());
+			command.endChild(element, modelInfo, buffer.toString());
 		}
 		
 		// TODO debug
@@ -112,7 +111,7 @@
 	 * @return 読み込んだRootModel
 	 */
 	public RootModel getResult() {
-		return model.getRootModel();
+		return modelInfo.getRootModel();
 	}
 	
 	/**
@@ -120,7 +119,7 @@
 	 */
 	@Override
 	public void startDocument() {
-		model = new ModelInfo(dialectStrategy, modelStrategy);
+		modelInfo = new ModelInfo(dialectStrategy, modelStrategy);
 		commandStack.push(new CommandInfo(new FirstCommand(), xmlElementStack.snapshot()));
 	}
 	
@@ -133,11 +132,11 @@
 		xmlElementStack.push(element);
 		
 		XmlElementCommand command = commandStack.peek().getCommand();
-		XmlElementCommand nextCommand = command.startChild(element, model, attributes);
+		XmlElementCommand nextCommand = command.startChild(element, modelInfo, attributes);
 		
 		if (nextCommand != null) {
 			commandStack.push(new CommandInfo(nextCommand, xmlElementStack.snapshot()));
-			nextCommand.start(element, model, attributes);
+			nextCommand.start(element, modelInfo, attributes);
 		}
 		
 		// TODO debug
@@ -206,13 +205,13 @@
 	 * 最初のXmlElementCommandクラス。
 	 * @author ykhr
 	 */
-	private static class FirstCommand extends AbstractXmlElementCommand {
+	private static class FirstCommand extends XmlElementCommandAdapter {
 		
 		/**
 		 * {@inheritDoc}
 		 */
 		@Override
-		public XmlElementCommand startChild(XmlElement element, ModelInfo model, Attributes attributes) {
+		public XmlElementCommand startChild(XmlElement element, ModelInfo modelInfo, Attributes attributes) {
 			return new RootCommand();
 		}
 		

Modified: artemis/trunk/org.jiemamy.serializer/src/main/java/org/jiemamy/core/model/JiemamyModelCommand.java
===================================================================
--- artemis/trunk/org.jiemamy.serializer/src/main/java/org/jiemamy/core/model/JiemamyModelCommand.java	2008-11-30 14:08:17 UTC (rev 2193)
+++ artemis/trunk/org.jiemamy.serializer/src/main/java/org/jiemamy/core/model/JiemamyModelCommand.java	2008-11-30 14:23:04 UTC (rev 2194)
@@ -31,15 +31,15 @@
  * IDを持つJiemamyModelのXmlElementCommand。
  * @author ykhr
  */
-abstract class JiemamyModelCommand<T> extends AbstractXmlElementCommand {
+abstract class JiemamyModelCommand<T> extends XmlElementCommandAdapter {
 	
 	/**
 	 * {@inheritDoc}
 	 */
 	@Override
-	public void end(ModelInfo model, XmlElement element, String text) {
-		Object child = getTargetModel(model);
-		RootModel rootModel = model.getRootModel();
+	public void end(ModelInfo modelInfo, XmlElement element, String text) {
+		Object child = getTargetModel(modelInfo);
+		RootModel rootModel = modelInfo.getRootModel();
 		if (child instanceof DomainModel) {
 			rootModel.appendModel((DomainModel) child);
 		} else if (child instanceof AbstractConnectionModel) {
@@ -53,9 +53,9 @@
 	 * {@inheritDoc}
 	 */
 	@Override
-	public void start(XmlElement element, ModelInfo model, Attributes attributes) {
+	public void start(XmlElement element, ModelInfo modelInfo, Attributes attributes) {
 		String id = attributes.getValue("id");
-		T targetModel = getTargetModel(model);
+		T targetModel = getTargetModel(modelInfo);
 		if (id != null && targetModel instanceof Identifiable2) {
 			Identifiable2 identifiableModel = (Identifiable2) targetModel;
 			UUID uuid = UUID.fromString(id);
@@ -78,10 +78,10 @@
 	
 	/**
 	 * 処理対象のJiemamyModel。
-	 * @param model Model情報
+	 * @param modelInfo Model情報
 	 * @return JiemamyModel
 	 */
-	protected abstract T getTargetModel(ModelInfo model);
+	protected abstract T getTargetModel(ModelInfo modelInfo);
 	
 	/**
 	 * 属性があるかどうか。

Modified: artemis/trunk/org.jiemamy.serializer/src/main/java/org/jiemamy/core/model/NodesCommand.java
===================================================================
--- artemis/trunk/org.jiemamy.serializer/src/main/java/org/jiemamy/core/model/NodesCommand.java	2008-11-30 14:08:17 UTC (rev 2193)
+++ artemis/trunk/org.jiemamy.serializer/src/main/java/org/jiemamy/core/model/NodesCommand.java	2008-11-30 14:23:04 UTC (rev 2194)
@@ -20,18 +20,17 @@
 
 import org.xml.sax.Attributes;
 
-
 /**
  * nodes要素を読み込むクラス。
  * @author ykhr
  */
-class NodesCommand extends AbstractXmlElementCommand {
+class NodesCommand extends XmlElementCommandAdapter {
 	
 	/**
 	 * {@inheritDoc}
 	 */
 	@Override
-	public XmlElementCommand startChild(XmlElement element, ModelInfo model, Attributes attributes) {
+	public XmlElementCommand startChild(XmlElement element, ModelInfo modelInfo, Attributes attributes) {
 		String elementName = element.getName();
 		
 		if (elementName.equals("table")) {

Modified: artemis/trunk/org.jiemamy.serializer/src/main/java/org/jiemamy/core/model/RootCommand.java
===================================================================
--- artemis/trunk/org.jiemamy.serializer/src/main/java/org/jiemamy/core/model/RootCommand.java	2008-11-30 14:08:17 UTC (rev 2193)
+++ artemis/trunk/org.jiemamy.serializer/src/main/java/org/jiemamy/core/model/RootCommand.java	2008-11-30 14:23:04 UTC (rev 2194)
@@ -37,16 +37,16 @@
 	 * {@inheritDoc}
 	 */
 	@Override
-	public void end(ModelInfo model, XmlElement element, String text) {
+	public void end(ModelInfo modelInfo, XmlElement element, String text) {
 	}
 	
 	/**
 	 * {@inheritDoc}
 	 */
 	@Override
-	public void endChild(XmlElement element, ModelInfo model, String text) {
+	public void endChild(XmlElement element, ModelInfo modelInfo, String text) {
 		String elementName = element.getName();
-		RootModel rootModel = model.getRootModel();
+		RootModel rootModel = modelInfo.getRootModel();
 		
 		if (elementName.equals("beginScript")) {
 			rootModel.setBeginScript(text);
@@ -63,8 +63,8 @@
 	 * {@inheritDoc}
 	 */
 	@Override
-	public void start(XmlElement element, ModelInfo model, Attributes attributes) {
-		JiemamyModelFactory.init(model.getModelStrategy());
+	public void start(XmlElement element, ModelInfo modelInfo, Attributes attributes) {
+		JiemamyModelFactory.init(modelInfo.getModelStrategy());
 		String id = attributes.getValue("id");
 		RootModel rootModel;
 		if (id == null) {
@@ -73,21 +73,21 @@
 			UUID uuid = UUID.fromString(id);
 			rootModel = JiemamyModelFactory.createRoot(uuid);
 		}
-		model.setRootModel(rootModel);
-		super.start(element, model, attributes);
+		modelInfo.setRootModel(rootModel);
+		super.start(element, modelInfo, attributes);
 	}
 	
 	/**
 	 * {@inheritDoc}
 	 */
 	@Override
-	public XmlElementCommand startChild(XmlElement element, ModelInfo model, Attributes attributes) {
+	public XmlElementCommand startChild(XmlElement element, ModelInfo modelInfo, Attributes attributes) {
 		String elementName = element.getName();
 		if (elementName.equals("domains")) {
-			return new AbstractXmlElementCommand() {
+			return new XmlElementCommandAdapter() {
 				
 				@Override
-				public XmlElementCommand startChild(XmlElement element, ModelInfo model, Attributes attributes) {
+				public XmlElementCommand startChild(XmlElement element, ModelInfo modelInfo, Attributes attributes) {
 					if (!element.getName().equals("domain")) {
 						throw new IllegalStateException();
 					}
@@ -98,10 +98,10 @@
 		} else if (elementName.equals("nodes")) {
 			return new NodesCommand();
 		} else if (elementName.equals("connections")) {
-			return new AbstractXmlElementCommand() {
+			return new XmlElementCommandAdapter() {
 				
 				@Override
-				public XmlElementCommand startChild(XmlElement element, ModelInfo model, Attributes attributes) {
+				public XmlElementCommand startChild(XmlElement element, ModelInfo modelInfo, Attributes attributes) {
 					if (!element.getName().equals("foreignKey")) {
 						throw new IllegalStateException();
 					}
@@ -110,13 +110,13 @@
 			};
 			
 		} else if (elementName.equals("insertDataSetModels")) {
-			return new AbstractXmlElementCommand() {
+			return new XmlElementCommandAdapter() {
 				
 				/**
 				 * {@inheritDoc}
 				 */
 				@Override
-				public XmlElementCommand startChild(XmlElement element, ModelInfo model, Attributes attributes) {
+				public XmlElementCommand startChild(XmlElement element, ModelInfo modelInfo, Attributes attributes) {
 					if (!element.getName().equals("dataSet")) {
 						throw new IllegalStateException();
 					}
@@ -132,12 +132,12 @@
 			String className = attributes.getValue("class");
 			Dialect dialect;
 			try {
-				dialect = model.getDialectInstanceCreationStrategy().create(className);
+				dialect = modelInfo.getDialectInstanceCreationStrategy().create(className);
 			} catch (ClassNotFoundException e) {
 				// TODO
 				throw new SerializationException(e);
 			}
-			model.getRootModel().setDialect(dialect);
+			modelInfo.getRootModel().setDialect(dialect);
 		}
 		
 		return null;
@@ -147,13 +147,13 @@
 	 * {@inheritDoc}
 	 */
 	@Override
-	protected RootModel getTargetModel(ModelInfo model) {
-		return model.getRootModel();
+	protected RootModel getTargetModel(ModelInfo modelInfo) {
+		return modelInfo.getRootModel();
 	}
 	
 
 	// TODO 仮実装Command
-	private static class NullCommand extends AbstractXmlElementCommand {
+	private static class NullCommand extends XmlElementCommandAdapter {
 	}
 	
 }

Modified: artemis/trunk/org.jiemamy.serializer/src/main/java/org/jiemamy/core/model/StickyCommand.java
===================================================================
--- artemis/trunk/org.jiemamy.serializer/src/main/java/org/jiemamy/core/model/StickyCommand.java	2008-11-30 14:08:17 UTC (rev 2193)
+++ artemis/trunk/org.jiemamy.serializer/src/main/java/org/jiemamy/core/model/StickyCommand.java	2008-11-30 14:23:04 UTC (rev 2194)
@@ -36,7 +36,7 @@
 	 * {@inheritDoc}
 	 */
 	@Override
-	public void endChild(XmlElement element, ModelInfo model, String text) {
+	public void endChild(XmlElement element, ModelInfo modelInfo, String text) {
 		if (element.getName().equals("contents")) {
 			stickyModel.setContents(text);
 		}
@@ -46,16 +46,16 @@
 	 * {@inheritDoc}
 	 */
 	@Override
-	public void start(XmlElement element, ModelInfo model, Attributes attributes) {
-		stickyModel = model.getRootModel().newModel(StickyModel.class);
-		super.start(element, model, attributes);
+	public void start(XmlElement element, ModelInfo modelInfo, Attributes attributes) {
+		stickyModel = modelInfo.getRootModel().newModel(StickyModel.class);
+		super.start(element, modelInfo, attributes);
 	}
 	
 	/**
 	 * {@inheritDoc}
 	 */
 	@Override
-	protected StickyModel getTargetModel(ModelInfo model) {
+	protected StickyModel getTargetModel(ModelInfo modelInfo) {
 		return stickyModel;
 	}
 	

Modified: artemis/trunk/org.jiemamy.serializer/src/main/java/org/jiemamy/core/model/TableCommand.java
===================================================================
--- artemis/trunk/org.jiemamy.serializer/src/main/java/org/jiemamy/core/model/TableCommand.java	2008-11-30 14:08:17 UTC (rev 2193)
+++ artemis/trunk/org.jiemamy.serializer/src/main/java/org/jiemamy/core/model/TableCommand.java	2008-11-30 14:23:04 UTC (rev 2194)
@@ -33,25 +33,25 @@
 	 * {@inheritDoc}
 	 */
 	@Override
-	public void start(XmlElement element, ModelInfo model, Attributes attributes) {
-		TableModel tableModel = model.getRootModel().newModel(TableModel.class);
-		tableModel.autoDenominate(model.getRootModel());
-		model.setTableModel(tableModel);
-		super.start(element, model, attributes);
+	public void start(XmlElement element, ModelInfo modelInfo, Attributes attributes) {
+		TableModel tableModel = modelInfo.getRootModel().newModel(TableModel.class);
+		tableModel.autoDenominate(modelInfo.getRootModel());
+		modelInfo.setTableModel(tableModel);
+		super.start(element, modelInfo, attributes);
 	}
 	
 	/**
 	 * {@inheritDoc}
 	 */
 	@Override
-	public XmlElementCommand startChild(XmlElement element, ModelInfo model, Attributes attributes) {
+	public XmlElementCommand startChild(XmlElement element, ModelInfo modelInfo, Attributes attributes) {
 		String elementName = element.getName();
 		
 		if (elementName.equals("columns")) {
-			return new AbstractXmlElementCommand() {
+			return new XmlElementCommandAdapter() {
 				
 				@Override
-				public XmlElementCommand startChild(XmlElement element, ModelInfo model, Attributes attributes) {
+				public XmlElementCommand startChild(XmlElement element, ModelInfo modelInfo, Attributes attributes) {
 					if (!element.getName().equals("column")) {
 						throw new IllegalStateException();
 					}
@@ -60,7 +60,7 @@
 			};
 		} else if (elementName.equals("sourceConnections") || elementName.equals("targetConnections")) {
 			// 外部キー部分は、あとで読み込む
-			return new AbstractXmlElementCommand() {
+			return new XmlElementCommandAdapter() {
 			};
 		}
 		
@@ -71,8 +71,8 @@
 	 * {@inheritDoc}
 	 */
 	@Override
-	protected AbstractEntityModel getTargetEntityModel(ModelInfo model) {
-		return model.getTableModel();
+	protected AbstractEntityModel getTargetEntityModel(ModelInfo modelInfo) {
+		return modelInfo.getTableModel();
 	}
 	
 }

Modified: artemis/trunk/org.jiemamy.serializer/src/main/java/org/jiemamy/core/model/ViewCommand.java
===================================================================
--- artemis/trunk/org.jiemamy.serializer/src/main/java/org/jiemamy/core/model/ViewCommand.java	2008-11-30 14:08:17 UTC (rev 2193)
+++ artemis/trunk/org.jiemamy.serializer/src/main/java/org/jiemamy/core/model/ViewCommand.java	2008-11-30 14:23:04 UTC (rev 2194)
@@ -37,11 +37,11 @@
 	 * {@inheritDoc}
 	 */
 	@Override
-	public void endChild(XmlElement element, ModelInfo model, String text) {
+	public void endChild(XmlElement element, ModelInfo modelInfo, String text) {
 		if (element.getName().equals("definition")) {
 			viewModel.setDefinition(text);
 		} else {
-			super.endChild(element, model, text);
+			super.endChild(element, modelInfo, text);
 		}
 	}
 	
@@ -49,17 +49,17 @@
 	 * {@inheritDoc}
 	 */
 	@Override
-	public void start(XmlElement element, ModelInfo model, Attributes attributes) {
-		viewModel = model.getRootModel().newModel(ViewModel.class);
-		viewModel.autoDenominate(model.getRootModel());
-		super.start(element, model, attributes);
+	public void start(XmlElement element, ModelInfo modelInfo, Attributes attributes) {
+		viewModel = modelInfo.getRootModel().newModel(ViewModel.class);
+		viewModel.autoDenominate(modelInfo.getRootModel());
+		super.start(element, modelInfo, attributes);
 	}
 	
 	/**
 	 * {@inheritDoc}
 	 */
 	@Override
-	protected AbstractEntityModel getTargetEntityModel(ModelInfo model) {
+	protected AbstractEntityModel getTargetEntityModel(ModelInfo modelInfo) {
 		return viewModel;
 	}
 	

Modified: artemis/trunk/org.jiemamy.serializer/src/main/java/org/jiemamy/core/model/XmlElementCommand.java
===================================================================
--- artemis/trunk/org.jiemamy.serializer/src/main/java/org/jiemamy/core/model/XmlElementCommand.java	2008-11-30 14:08:17 UTC (rev 2193)
+++ artemis/trunk/org.jiemamy.serializer/src/main/java/org/jiemamy/core/model/XmlElementCommand.java	2008-11-30 14:23:04 UTC (rev 2194)
@@ -20,7 +20,6 @@
 
 import org.xml.sax.Attributes;
 
-
 /**
  * XMLの1要素に紐付くコマンドのインタフェース。
  * @author ykhr
@@ -30,38 +29,38 @@
 	/**
 	 * 終了処理。<br />
 	 * このコマンドに関連付いた要素の終了時に呼ばれる。
-	 * @param model
+	 * @param modelInfo
 	 * @param element
 	 * @param text
 	 */
-	void end(ModelInfo model, XmlElement element, String text);
+	void end(ModelInfo modelInfo, XmlElement element, String text);
 	
 	/**
 	 * 子要素の終了処理。<br />
 	 * 配下の要素の終了時に呼ばれる。
 	 * @param element
-	 * @param model
+	 * @param modelInfo
 	 * @param text
 	 */
-	void endChild(XmlElement element, ModelInfo model, String text);
+	void endChild(XmlElement element, ModelInfo modelInfo, String text);
 	
 	/**
 	 * 開始処理。<br />
 	 * このコマンドに関連付いた要素の最初に呼ばれる。
 	 * @param element
-	 * @param model
+	 * @param modelInfo
 	 * @param attributes
 	 */
-	void start(XmlElement element, ModelInfo model, Attributes attributes);
+	void start(XmlElement element, ModelInfo modelInfo, Attributes attributes);
 	
 	/**
 	 * 子要素の開始処理。<br />
 	 * 配下の要素の開始時に呼ばれる。
 	 * @param element
-	 * @param model
+	 * @param modelInfo
 	 * @param attributes
 	 * @return XmlElementCommand 
 	 */
-	XmlElementCommand startChild(XmlElement element, ModelInfo model, Attributes attributes);
+	XmlElementCommand startChild(XmlElement element, ModelInfo modelInfo, Attributes attributes);
 	
 }

Copied: artemis/trunk/org.jiemamy.serializer/src/main/java/org/jiemamy/core/model/XmlElementCommandAdapter.java (from rev 2193, artemis/trunk/org.jiemamy.serializer/src/main/java/org/jiemamy/core/model/AbstractXmlElementCommand.java)
===================================================================
--- artemis/trunk/org.jiemamy.serializer/src/main/java/org/jiemamy/core/model/XmlElementCommandAdapter.java	                        (rev 0)
+++ artemis/trunk/org.jiemamy.serializer/src/main/java/org/jiemamy/core/model/XmlElementCommandAdapter.java	2008-11-30 14:23:04 UTC (rev 2194)
@@ -0,0 +1,54 @@
+/*
+ * Copyright 2007-2008 MIYAMOTO Daisuke, jiemamy.org and the Others.
+ * Created on 2008/11/07
+ *
+ * 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.xml.sax.Attributes;
+
+/**
+ * 空実装のXmlElementCommand。
+ * @author ykhr
+ */
+class XmlElementCommandAdapter implements XmlElementCommand {
+	
+	/**
+	 * {@inheritDoc}
+	 */
+	public void end(ModelInfo modelInfo, XmlElement element, String text) {
+	}
+	
+	/**
+	 * {@inheritDoc}
+	 */
+	public void endChild(XmlElement element, ModelInfo modelInfo, String text) {
+	}
+	
+	/**
+	 * {@inheritDoc}
+	 */
+	public void start(XmlElement element, ModelInfo modelInfo, Attributes attributes) {
+	}
+	
+	/**
+	 * {@inheritDoc}
+	 */
+	public XmlElementCommand startChild(XmlElement element, ModelInfo modelInfo, Attributes attributes) {
+		return null;
+	}
+	
+}


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


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