svnno****@sourc*****
svnno****@sourc*****
2008年 12月 29日 (月) 14:37:47 JST
Revision: 2327 http://svn.sourceforge.jp/view?root=jiemamy&view=rev&rev=2327 Author: daisuke_m Date: 2008-12-29 14:37:47 +0900 (Mon, 29 Dec 2008) Log Message: ----------- [CORE-94] J-serializerをJ-coreに吸収。 Modified Paths: -------------- artemis/trunk/org.jiemamy.artemis.test/.classpath artemis/trunk/org.jiemamy.artemis.test/.project artemis/trunk/org.jiemamy.artemis.test/pom.xml artemis/trunk/org.jiemamy.composer/.project artemis/trunk/org.jiemamy.composer/META-INF/MANIFEST.MF artemis/trunk/org.jiemamy.composer/pom.xml artemis/trunk/org.jiemamy.core/.classpath artemis/trunk/org.jiemamy.core/META-INF/MANIFEST.MF artemis/trunk/org.jiemamy.core/pom.xml artemis/trunk/org.jiemamy.dialect.mysql/.project artemis/trunk/org.jiemamy.dialect.postgresql/.project artemis/trunk/org.jiemamy.dialect.sql99/.project artemis/trunk/org.jiemamy.project/pom.xml artemis/trunk/org.jiemamy.serializer/META-INF/MANIFEST.MF artemis/trunk/org.jiemamy.serializer/pom.xml vesta/trunk/org.jiemamy.eclipse/.project vesta/trunk/org.jiemamy.eclipse/META-INF/MANIFEST.MF vesta/trunk/org.jiemamy.eclipse/pom.xml Added Paths: ----------- artemis/trunk/org.jiemamy.artemis.test/src/test/java/org/jiemamy/artemis/ApplicationModelCreator.java artemis/trunk/org.jiemamy.core/src/main/java/com/ artemis/trunk/org.jiemamy.core/src/main/java/com/megginson/ artemis/trunk/org.jiemamy.core/src/main/java/com/megginson/sax/ artemis/trunk/org.jiemamy.core/src/main/java/com/megginson/sax/DataWriter.java artemis/trunk/org.jiemamy.core/src/main/java/com/megginson/sax/XMLWriter.java artemis/trunk/org.jiemamy.core/src/main/java/javanet/ artemis/trunk/org.jiemamy.core/src/main/java/javanet/staxutils/ artemis/trunk/org.jiemamy.core/src/main/java/javanet/staxutils/IndentingXMLEventWriter.java artemis/trunk/org.jiemamy.core/src/main/java/org/jiemamy/internal/serializer/ artemis/trunk/org.jiemamy.core/src/main/java/org/jiemamy/internal/serializer/stax/ artemis/trunk/org.jiemamy.core/src/main/java/org/jiemamy/internal/serializer/stax/JiemamyCommandInputStreamImpl.java artemis/trunk/org.jiemamy.core/src/main/java/org/jiemamy/internal/serializer/stax/JiemamyCommandOutputStreamImpl.java artemis/trunk/org.jiemamy.core/src/main/java/org/jiemamy/internal/serializer/stax/XmlEventReaderAdapter.java artemis/trunk/org.jiemamy.core/src/main/java/org/jiemamy/internal/serializer/stax/XmlEventWriterAdapter.java artemis/trunk/org.jiemamy.core/src/main/java/org/jiemamy/serializer/ artemis/trunk/org.jiemamy.core/src/main/java/org/jiemamy/serializer/InvalidClassException.java artemis/trunk/org.jiemamy.core/src/main/java/org/jiemamy/serializer/JiemamyStaxSerializer.java artemis/trunk/org.jiemamy.core/src/test/java/com/ artemis/trunk/org.jiemamy.core/src/test/java/com/megginson/ artemis/trunk/org.jiemamy.core/src/test/java/com/megginson/sax/ artemis/trunk/org.jiemamy.core/src/test/java/com/megginson/sax/DataWriterTest.java artemis/trunk/org.jiemamy.core/src/test/java/org/jiemamy/internal/serializer/ artemis/trunk/org.jiemamy.core/src/test/java/org/jiemamy/internal/serializer/stax/ artemis/trunk/org.jiemamy.core/src/test/java/org/jiemamy/internal/serializer/stax/JiemamyCommandInputStreamTest.java artemis/trunk/org.jiemamy.core/src/test/java/org/jiemamy/internal/serializer/stax/JiemamyCommandOutputStreamTest.java artemis/trunk/org.jiemamy.core/src/test/java/org/jiemamy/internal/serializer/stax/StaxTest.java artemis/trunk/org.jiemamy.core/src/test/java/org/jiemamy/serializer/ artemis/trunk/org.jiemamy.core/src/test/java/org/jiemamy/serializer/SerializationTest.java artemis/trunk/org.jiemamy.core/src/test/resources/minimal.jiemamy-core.xml artemis/trunk/org.jiemamy.core/src/test/resources/minimal.xml artemis/trunk/org.jiemamy.core/src/test/resources/sample.xml Removed Paths: ------------- artemis/trunk/org.jiemamy.serializer/src/main/java/com/ artemis/trunk/org.jiemamy.serializer/src/main/java/javanet/ artemis/trunk/org.jiemamy.serializer/src/main/java/org/jiemamy/ artemis/trunk/org.jiemamy.serializer/src/test/java/com/ artemis/trunk/org.jiemamy.serializer/src/test/java/org/ artemis/trunk/org.jiemamy.serializer/src/test/resources/logback.xml artemis/trunk/org.jiemamy.serializer/src/test/resources/minimal.jiemamy-core.xml artemis/trunk/org.jiemamy.serializer/src/test/resources/minimal.xml artemis/trunk/org.jiemamy.serializer/src/test/resources/sample.xml -------------- next part -------------- Modified: artemis/trunk/org.jiemamy.artemis.test/.classpath =================================================================== --- artemis/trunk/org.jiemamy.artemis.test/.classpath 2008-12-27 17:43:07 UTC (rev 2326) +++ artemis/trunk/org.jiemamy.artemis.test/.classpath 2008-12-29 05:37:47 UTC (rev 2327) @@ -18,7 +18,6 @@ <classpathentry combineaccessrules="false" kind="src" path="/org.jiemamy.dialect.postgresql"/> <classpathentry combineaccessrules="false" kind="src" path="/org.jiemamy.dialect.sql99"/> <classpathentry combineaccessrules="false" kind="src" path="/org.jiemamy.event"/> - <classpathentry combineaccessrules="false" kind="src" path="/org.jiemamy.serializer"/> <classpathentry combineaccessrules="false" kind="src" path="/org.jiemamy.view"/> <classpathentry combineaccessrules="false" kind="src" path="/org.jiemamy.irenka"/> <classpathentry kind="output" path="target/classes"/> Modified: artemis/trunk/org.jiemamy.artemis.test/.project =================================================================== --- artemis/trunk/org.jiemamy.artemis.test/.project 2008-12-27 17:43:07 UTC (rev 2326) +++ artemis/trunk/org.jiemamy.artemis.test/.project 2008-12-29 05:37:47 UTC (rev 2327) @@ -39,14 +39,14 @@ </natures> <linkedResources> <link> - <name>.fbprefs</name> + <name>findbugs.xml</name> <type>1</type> - <locationURI>DOCUMENTS/org.jiemamy.project/.fbprefs</locationURI> + <locationURI>DOCUMENTS/org.jiemamy.project/findbugs.xml</locationURI> </link> <link> - <name>findbugs.xml</name> + <name>.fbprefs</name> <type>1</type> - <locationURI>DOCUMENTS/org.jiemamy.project/findbugs.xml</locationURI> + <locationURI>DOCUMENTS/org.jiemamy.project/.fbprefs</locationURI> </link> <link> <name>.checkstyle</name> Modified: artemis/trunk/org.jiemamy.artemis.test/pom.xml =================================================================== --- artemis/trunk/org.jiemamy.artemis.test/pom.xml 2008-12-27 17:43:07 UTC (rev 2326) +++ artemis/trunk/org.jiemamy.artemis.test/pom.xml 2008-12-29 05:37:47 UTC (rev 2327) @@ -152,11 +152,6 @@ </dependency> <dependency> <groupId>${project.groupId}</groupId> - <artifactId>org.jiemamy.serializer</artifactId> - <version>${project.version}</version> - </dependency> - <dependency> - <groupId>${project.groupId}</groupId> <artifactId>org.jiemamy.dialect.postgresql</artifactId> <version>${project.version}</version> </dependency> Added: artemis/trunk/org.jiemamy.artemis.test/src/test/java/org/jiemamy/artemis/ApplicationModelCreator.java =================================================================== --- artemis/trunk/org.jiemamy.artemis.test/src/test/java/org/jiemamy/artemis/ApplicationModelCreator.java (rev 0) +++ artemis/trunk/org.jiemamy.artemis.test/src/test/java/org/jiemamy/artemis/ApplicationModelCreator.java 2008-12-29 05:37:47 UTC (rev 2327) @@ -0,0 +1,559 @@ +package org.jiemamy.artemis; + +import java.util.ArrayList; +import java.util.List; + +import org.jiemamy.Artemis; +import org.jiemamy.ArtemisView; +import org.jiemamy.exception.ElementNotFoundException; +import org.jiemamy.exception.TooManyElementsException; +import org.jiemamy.exception.UnexpectedConditionError; +import org.jiemamy.model.DiagramPresentationModel; +import org.jiemamy.model.DiagramPresentations; +import org.jiemamy.model.Jiemamy; +import org.jiemamy.model.RootModel; +import org.jiemamy.model.attribute.ColumnModel; +import org.jiemamy.model.connection.ForeignKeyModel; +import org.jiemamy.model.connection.ForeignKeyModel.InitiallyCheckTime; +import org.jiemamy.model.connection.ForeignKeyModel.ReferentialAction; +import org.jiemamy.model.constraint.PrimaryKeyConstraintModel; +import org.jiemamy.model.constraint.UniqueConstraintModel; +import org.jiemamy.model.dataset.InsertDataSetModel; +import org.jiemamy.model.dataset.RecordModel; +import org.jiemamy.model.datatype.DomainModel; +import org.jiemamy.model.datatype.IntegerDesc; +import org.jiemamy.model.datatype.NumericDesc; +import org.jiemamy.model.datatype.TimestampDesc; +import org.jiemamy.model.datatype.VarcharDesc; +import org.jiemamy.model.datatype.adapter.SerialDataTypeAdapter; +import org.jiemamy.model.geometory.JmPoint; +import org.jiemamy.model.geometory.JmRectangle; +import org.jiemamy.model.node.StickyModel; +import org.jiemamy.model.node.TableModel; +import org.jiemamy.model.node.ViewModel; + +/** + * アプリケーション用のモデルを生成するクラス。 + * + * @author j5ik2o + */ +public class ApplicationModelCreator { + + private static final String DIALECT_CLASS_NAME = "org.jiemamy.dialect.mysql.MySqlDialect"; + + + /** + * モデル生成処理が正常に終わるかどうかチェックするためのmainメソッド。 + * @param args + */ + public static void main(String[] args) { + Jiemamy.init(new Artemis(new ArtemisView())); + RootModel rootModel = new ApplicationModelCreator().createModel(); + System.out.println(rootModel); + Jiemamy.dispose(); + } + + + private RootModel rootModel; + + + /** + * テスト用モデルを生成する。 + * @return モデル + */ + public RootModel createModel() { + int offset = 50; + + rootModel = Jiemamy.newRootModel(); + rootModel.setDialectId(DIALECT_CLASS_NAME); + rootModel.setBeginScript("BEGIN;"); + rootModel.setEndScript("COMMIT;"); + rootModel.setDescription("シリアライゼーションイメージ"); + rootModel.setSchemaName("FOO"); + + // ドメインの生成 + DomainModel idDomain = rootModel.newModel(DomainModel.class); + idDomain.setName("ID"); + idDomain.setDataTypeDescriptor(new IntegerDesc()); + idDomain.setNotNull(true); + idDomain.addConstraint(rootModel.newModel(UniqueConstraintModel.class)); + idDomain.registerAdapter(new SerialDataTypeAdapter()); + rootModel.appendModel(idDomain); + + DomainModel nameDomain = rootModel.newModel(DomainModel.class); + nameDomain.setName("NAME"); + nameDomain.setDataTypeDescriptor(new VarcharDesc(32)); + nameDomain.setDescription("人名用の型です。"); + rootModel.appendModel(nameDomain); + + // ノードの生成 + TableModel deptTable = createDeptTable(idDomain, nameDomain); + rootModel.appendModel(deptTable); + TableModel empTable = createEmpTable(idDomain, nameDomain); + rootModel.appendModel(empTable); + + ViewModel highSalView = rootModel.newModel(ViewModel.class); + highSalView.setName("V_HIGH_SAL_EMP"); + highSalView.setDefinition("SELECT * FROM T_EMP WHERE SAL > 2000;"); + highSalView.setLogicalName("高給取り"); + rootModel.appendModel(highSalView); + + StickyModel sticky = rootModel.newModel(StickyModel.class); + sticky.setContents("メモーー"); + rootModel.appendModel(sticky); + + // コネクションの生成・追加 + ForeignKeyModel fkEmpEmp = createForeignKey(empTable, empTable, "MGR_ID"); + fkEmpEmp.setOnDelete(ReferentialAction.SET_NULL); + fkEmpEmp.setDeferrable(true); + fkEmpEmp.setInitiallyCheckTime(InitiallyCheckTime.DEFERRED); + rootModel.appendModel(fkEmpEmp); + + ForeignKeyModel fkEmpDept = createForeignKey(deptTable, empTable, "DEPT_ID"); + rootModel.appendModel(fkEmpDept); + + // ダイアグラム表現の生成・追加(1) + DiagramPresentationModel presentation = rootModel.newModel(DiagramPresentationModel.class); + presentation.setName("全部表示する"); + presentation.getNodeLayouts().put(empTable, new JmRectangle(360, 60)); + presentation.getNodeLayouts().put(deptTable, new JmRectangle(60, 60)); + presentation.getNodeLayouts().put(highSalView, new JmRectangle(60, 270)); + presentation.getNodeLayouts().put(sticky, new JmRectangle(360, 270)); + + List<JmPoint> bendpoints = new ArrayList<JmPoint>(); + JmRectangle rect = presentation.getNodeLayouts().get(empTable); + bendpoints.add(0, new JmPoint(Math.max(rect.x - offset, 0), rect.y)); + bendpoints.add(1, new JmPoint(rect.x, Math.max(rect.y - offset, 0))); + presentation.getConnectionLayouts().put(fkEmpEmp, bendpoints); + presentation.getConnectionLayouts().put(fkEmpDept, new ArrayList<JmPoint>()); // bendpount無し + rootModel.getAdapter(DiagramPresentations.class).appendModel(presentation); + + // ダイアグラム表現の生成・追加(2) + presentation = rootModel.newModel(DiagramPresentationModel.class); + presentation.setName("一部表示する"); + presentation.getNodeLayouts().put(empTable, new JmRectangle(60, 60)); + presentation.getNodeLayouts().put(highSalView, new JmRectangle(270, 270)); + presentation.getConnectionLayouts().put(fkEmpDept, new ArrayList<JmPoint>()); // bendpount無し + rootModel.getAdapter(DiagramPresentations.class).appendModel(presentation); + + // データセットの生成・追加(1) + InsertDataSetModel dataSetEn = rootModel.newModel(InsertDataSetModel.class); + dataSetEn.setName("データ群en"); + dataSetEn.getRecords().put(deptTable, createDeptDataSetEn(deptTable)); + dataSetEn.getRecords().put(empTable, createEmpDataSetEn(empTable)); + rootModel.appendModel(dataSetEn); + + // データセットの生成・追加(2) + InsertDataSetModel dataSetJa = rootModel.newModel(InsertDataSetModel.class); + dataSetJa.setName("データ群ja"); + dataSetJa.getRecords().put(deptTable, createDeptDataSetJa(deptTable)); + dataSetJa.getRecords().put(empTable, createEmpDataSetJa(empTable)); + rootModel.appendModel(dataSetJa); + + return rootModel; + } + + private List<RecordModel> createDeptDataSetEn(TableModel deptTable) { + List<RecordModel> result = new ArrayList<RecordModel>(); + + try { + RecordModel record = rootModel.newModel(RecordModel.class); + + record.getValues().put(deptTable.getColumn("ID"), "1"); + record.getValues().put(deptTable.getColumn("DEPT_NO"), "10"); + record.getValues().put(deptTable.getColumn("DEPT_NAME"), "ACCOUNTING"); + record.getValues().put(deptTable.getColumn("LOC"), "NEW YORK"); + result.add(record); + + record = rootModel.newModel(RecordModel.class); + record.getValues().put(deptTable.getColumn("ID"), "2"); + record.getValues().put(deptTable.getColumn("DEPT_NO"), "20"); + record.getValues().put(deptTable.getColumn("DEPT_NAME"), "RESEARCH"); + record.getValues().put(deptTable.getColumn("LOC"), "DALLAS"); + result.add(record); + + record = rootModel.newModel(RecordModel.class); + record.getValues().put(deptTable.getColumn("ID"), "3"); + record.getValues().put(deptTable.getColumn("DEPT_NO"), "30"); + record.getValues().put(deptTable.getColumn("DEPT_NAME"), "SALES"); + record.getValues().put(deptTable.getColumn("LOC"), "CHICAGO"); + result.add(record); + + record = rootModel.newModel(RecordModel.class); + record.getValues().put(deptTable.getColumn("ID"), "4"); + record.getValues().put(deptTable.getColumn("DEPT_NO"), "40"); + record.getValues().put(deptTable.getColumn("DEPT_NAME"), "OPERATIONS"); + record.getValues().put(deptTable.getColumn("LOC"), "BOSTON"); + result.add(record); + } catch (TooManyElementsException e) { + throw new UnexpectedConditionError("test code error", e); + } + + return result; + } + + private List<RecordModel> createDeptDataSetJa(TableModel deptTable) { + List<RecordModel> result = new ArrayList<RecordModel>(); + + try { + RecordModel record = rootModel.newModel(RecordModel.class); + + record.getValues().put(deptTable.getColumn("ID"), "1"); + record.getValues().put(deptTable.getColumn("DEPT_NO"), "10"); + record.getValues().put(deptTable.getColumn("DEPT_NAME"), "経理部"); + record.getValues().put(deptTable.getColumn("LOC"), "広島"); + result.add(record); + + record = rootModel.newModel(RecordModel.class); + record.getValues().put(deptTable.getColumn("ID"), "2"); + record.getValues().put(deptTable.getColumn("DEPT_NO"), "20"); + record.getValues().put(deptTable.getColumn("DEPT_NAME"), "研究開発部"); + record.getValues().put(deptTable.getColumn("LOC"), "京都"); + result.add(record); + + record = rootModel.newModel(RecordModel.class); + record.getValues().put(deptTable.getColumn("ID"), "3"); + record.getValues().put(deptTable.getColumn("DEPT_NO"), "30"); + record.getValues().put(deptTable.getColumn("DEPT_NAME"), "営業部"); + record.getValues().put(deptTable.getColumn("LOC"), "東京"); + result.add(record); + + record = rootModel.newModel(RecordModel.class); + record.getValues().put(deptTable.getColumn("ID"), "4"); + record.getValues().put(deptTable.getColumn("DEPT_NO"), "40"); + record.getValues().put(deptTable.getColumn("DEPT_NAME"), "経営本部"); + // locは指定せず、特定しない状態 + result.add(record); + } catch (TooManyElementsException e) { + throw new UnexpectedConditionError("test code error", e); + } + + return result; + } + + /** + * DEPTテーブルの生成。 + * @param idDomain IDの型として使用するドメイン + * @param nameDomain 名称として使用するドメイン + * @return DEPTテーブル + */ + private TableModel createDeptTable(DomainModel idDomain, DomainModel nameDomain) { + TableModel deptTable = rootModel.newModel(TableModel.class); + deptTable.setName("T_DEPT"); + deptTable.setBeginScript("/* test begin script */"); + deptTable.setDescription("部署マスタです。"); + + ColumnModel idColumn = rootModel.newModel(ColumnModel.class); + idColumn.setName("ID"); + idColumn.setDataTypeDescriptor(idDomain); + idColumn.setLogicalName("部署ID"); + deptTable.appendModel(idColumn); + + PrimaryKeyConstraintModel primaryKey = rootModel.newModel(PrimaryKeyConstraintModel.class); + primaryKey.getColumns().add(idColumn); + deptTable.setPrimaryKey(primaryKey); + + ColumnModel noColumn = rootModel.newModel(ColumnModel.class); + noColumn.setName("DEPT_NO"); + noColumn.setDataTypeDescriptor(new IntegerDesc()); + noColumn.setLogicalName("部署番号"); + deptTable.appendModel(noColumn); + + ColumnModel deptNameColumn = rootModel.newModel(ColumnModel.class); + deptNameColumn.setName("DEPT_NAME"); + deptNameColumn.setDataTypeDescriptor(new VarcharDesc(20)); + deptNameColumn.setLogicalName("部署名"); + deptNameColumn.setRepresentation(true); + deptTable.appendModel(deptNameColumn); + + ColumnModel locColumn = rootModel.newModel(ColumnModel.class); + locColumn.setName("LOC"); + locColumn.setDataTypeDescriptor(new VarcharDesc(20)); + locColumn.setLogicalName("ロケーション"); + locColumn.setDefaultValue("secret"); + deptTable.appendModel(locColumn); + + return deptTable; + } + + private List<RecordModel> createEmpDataSetEn(TableModel empTable) { + List<RecordModel> result = new ArrayList<RecordModel>(); + + try { + RecordModel record = rootModel.newModel(RecordModel.class); + + record.getValues().put(empTable.getColumn("ID"), "1"); + record.getValues().put(empTable.getColumn("EMP_NO"), "10"); + record.getValues().put(empTable.getColumn("EMP_NAME"), "SMITH"); + record.getValues().put(empTable.getColumn("MGR_ID"), "3"); + record.getValues().put(empTable.getColumn("HIREDATE"), "2003-02-01"); + record.getValues().put(empTable.getColumn("SAL"), "40"); + record.getValues().put(empTable.getColumn("DEPT_ID"), "3"); + result.add(record); + + record = rootModel.newModel(RecordModel.class); + record.getValues().put(empTable.getColumn("ID"), "2"); + record.getValues().put(empTable.getColumn("EMP_NO"), "20"); + record.getValues().put(empTable.getColumn("EMP_NAME"), "ALLEN"); + record.getValues().put(empTable.getColumn("MGR_ID"), "3"); + record.getValues().put(empTable.getColumn("HIREDATE"), "2000-03-04"); + record.getValues().put(empTable.getColumn("SAL"), "50"); + record.getValues().put(empTable.getColumn("DEPT_ID"), "4"); + result.add(record); + + record = rootModel.newModel(RecordModel.class); + record.getValues().put(empTable.getColumn("ID"), "3"); + record.getValues().put(empTable.getColumn("EMP_NO"), "30"); + record.getValues().put(empTable.getColumn("EMP_NAME"), "WARD"); + record.getValues().put(empTable.getColumn("MGR_ID"), null); + record.getValues().put(empTable.getColumn("HIREDATE"), "1993-12-05"); + record.getValues().put(empTable.getColumn("SAL"), "60"); + record.getValues().put(empTable.getColumn("DEPT_ID"), "4"); + result.add(record); + + record = rootModel.newModel(RecordModel.class); + record.getValues().put(empTable.getColumn("ID"), "4"); + record.getValues().put(empTable.getColumn("EMP_NO"), "40"); + record.getValues().put(empTable.getColumn("EMP_NAME"), "JONES"); + record.getValues().put(empTable.getColumn("MGR_ID"), "2"); + record.getValues().put(empTable.getColumn("HIREDATE"), "2007-04-01"); + record.getValues().put(empTable.getColumn("SAL"), "36"); + record.getValues().put(empTable.getColumn("DEPT_ID"), "2"); + result.add(record); + + record = rootModel.newModel(RecordModel.class); + record.getValues().put(empTable.getColumn("ID"), "5"); + record.getValues().put(empTable.getColumn("EMP_NO"), "50"); + record.getValues().put(empTable.getColumn("EMP_NAME"), "MARTIN"); + record.getValues().put(empTable.getColumn("MGR_ID"), "1"); + record.getValues().put(empTable.getColumn("HIREDATE"), "2002-05-30"); + record.getValues().put(empTable.getColumn("SAL"), "30"); + record.getValues().put(empTable.getColumn("DEPT_ID"), "3"); + result.add(record); + + record = rootModel.newModel(RecordModel.class); + record.getValues().put(empTable.getColumn("ID"), "6"); + record.getValues().put(empTable.getColumn("EMP_NO"), "60"); + record.getValues().put(empTable.getColumn("EMP_NAME"), "BLAKE"); + record.getValues().put(empTable.getColumn("MGR_ID"), "3"); + record.getValues().put(empTable.getColumn("HIREDATE"), "2007-04-01"); + record.getValues().put(empTable.getColumn("SAL"), "25"); + record.getValues().put(empTable.getColumn("DEPT_ID"), "2"); + result.add(record); + + record = rootModel.newModel(RecordModel.class); + record.getValues().put(empTable.getColumn("ID"), "7"); + record.getValues().put(empTable.getColumn("EMP_NO"), "70"); + record.getValues().put(empTable.getColumn("EMP_NAME"), "CLARK"); + record.getValues().put(empTable.getColumn("MGR_ID"), "1"); + record.getValues().put(empTable.getColumn("HIREDATE"), "2004-09-01"); + record.getValues().put(empTable.getColumn("SAL"), "30"); + record.getValues().put(empTable.getColumn("DEPT_ID"), "1"); + result.add(record); + + record = rootModel.newModel(RecordModel.class); + record.getValues().put(empTable.getColumn("ID"), "8"); + record.getValues().put(empTable.getColumn("EMP_NO"), "80"); + record.getValues().put(empTable.getColumn("EMP_NAME"), "SCOTT"); + record.getValues().put(empTable.getColumn("MGR_ID"), "4"); + record.getValues().put(empTable.getColumn("HIREDATE"), "2008-03-01"); + record.getValues().put(empTable.getColumn("SAL"), "25"); + record.getValues().put(empTable.getColumn("DEPT_ID"), "2"); + result.add(record); + } catch (TooManyElementsException e) { + throw new UnexpectedConditionError("test code error", e); + } + + return result; + } + + private List<RecordModel> createEmpDataSetJa(TableModel empTable) { + List<RecordModel> result = new ArrayList<RecordModel>(); + + try { + RecordModel record = rootModel.newModel(RecordModel.class); + + record.getValues().put(empTable.getColumn("ID"), "1"); + record.getValues().put(empTable.getColumn("EMP_NO"), "10"); + record.getValues().put(empTable.getColumn("EMP_NAME"), "山本"); + record.getValues().put(empTable.getColumn("MGR_ID"), "3"); + record.getValues().put(empTable.getColumn("HIREDATE"), "2003-02-01"); + record.getValues().put(empTable.getColumn("SAL"), "40"); + record.getValues().put(empTable.getColumn("DEPT_ID"), "3"); + result.add(record); + + record = rootModel.newModel(RecordModel.class); + record.getValues().put(empTable.getColumn("ID"), "2"); + record.getValues().put(empTable.getColumn("EMP_NO"), "20"); + record.getValues().put(empTable.getColumn("EMP_NAME"), "内海"); + record.getValues().put(empTable.getColumn("MGR_ID"), "3"); + record.getValues().put(empTable.getColumn("HIREDATE"), "2000-03-04"); + record.getValues().put(empTable.getColumn("SAL"), "50"); + record.getValues().put(empTable.getColumn("DEPT_ID"), "4"); + result.add(record); + + record = rootModel.newModel(RecordModel.class); + record.getValues().put(empTable.getColumn("ID"), "3"); + record.getValues().put(empTable.getColumn("EMP_NO"), "30"); + record.getValues().put(empTable.getColumn("EMP_NAME"), "村瀬"); + record.getValues().put(empTable.getColumn("MGR_ID"), null); + record.getValues().put(empTable.getColumn("HIREDATE"), "1993-12-05"); + record.getValues().put(empTable.getColumn("SAL"), "60"); + record.getValues().put(empTable.getColumn("DEPT_ID"), "4"); + result.add(record); + + record = rootModel.newModel(RecordModel.class); + record.getValues().put(empTable.getColumn("ID"), "4"); + record.getValues().put(empTable.getColumn("EMP_NO"), "40"); + record.getValues().put(empTable.getColumn("EMP_NAME"), "近藤"); + record.getValues().put(empTable.getColumn("MGR_ID"), "2"); + record.getValues().put(empTable.getColumn("HIREDATE"), "2007-04-01"); + record.getValues().put(empTable.getColumn("SAL"), "36"); + record.getValues().put(empTable.getColumn("DEPT_ID"), "2"); + result.add(record); + + record = rootModel.newModel(RecordModel.class); + record.getValues().put(empTable.getColumn("ID"), "5"); + record.getValues().put(empTable.getColumn("EMP_NO"), "50"); + record.getValues().put(empTable.getColumn("EMP_NAME"), "小峰"); + record.getValues().put(empTable.getColumn("MGR_ID"), "1"); + record.getValues().put(empTable.getColumn("HIREDATE"), "2002-05-30"); + record.getValues().put(empTable.getColumn("SAL"), "30"); + record.getValues().put(empTable.getColumn("DEPT_ID"), "3"); + result.add(record); + + record = rootModel.newModel(RecordModel.class); + record.getValues().put(empTable.getColumn("ID"), "6"); + record.getValues().put(empTable.getColumn("EMP_NO"), "60"); + record.getValues().put(empTable.getColumn("EMP_NAME"), "三浦"); + record.getValues().put(empTable.getColumn("MGR_ID"), "3"); + record.getValues().put(empTable.getColumn("HIREDATE"), "2007-04-01"); + record.getValues().put(empTable.getColumn("SAL"), "25"); + record.getValues().put(empTable.getColumn("DEPT_ID"), "2"); + result.add(record); + + record = rootModel.newModel(RecordModel.class); + record.getValues().put(empTable.getColumn("ID"), "7"); + record.getValues().put(empTable.getColumn("EMP_NO"), "70"); + record.getValues().put(empTable.getColumn("EMP_NAME"), "前島"); + record.getValues().put(empTable.getColumn("MGR_ID"), "1"); + record.getValues().put(empTable.getColumn("HIREDATE"), "2004-09-01"); + record.getValues().put(empTable.getColumn("SAL"), "30"); + record.getValues().put(empTable.getColumn("DEPT_ID"), "1"); + result.add(record); + + record = rootModel.newModel(RecordModel.class); + record.getValues().put(empTable.getColumn("ID"), "8"); + record.getValues().put(empTable.getColumn("EMP_NO"), "80"); + record.getValues().put(empTable.getColumn("EMP_NAME"), "島崎"); + record.getValues().put(empTable.getColumn("MGR_ID"), "4"); + record.getValues().put(empTable.getColumn("HIREDATE"), "2008-03-01"); + record.getValues().put(empTable.getColumn("SAL"), "25"); + record.getValues().put(empTable.getColumn("DEPT_ID"), "2"); + result.add(record); + } catch (TooManyElementsException e) { + throw new UnexpectedConditionError("test code error", e); + } + + return result; + } + + /** + * EMPテーブルの生成 + * @param idDomain IDの型として使用するドメイン + * @param nameDomain 名称として使用するドメイン + * @return EMPテーブル + */ + private TableModel createEmpTable(DomainModel idDomain, DomainModel nameDomain) { + TableModel empTable = rootModel.newModel(TableModel.class); + empTable.setName("T_EMP"); + empTable.setLogicalName("従業員"); + empTable.setBeginScript("/* test end script */"); + empTable.setDescription("従業員マスタです。"); + + ColumnModel idColumn = rootModel.newModel(ColumnModel.class); + idColumn.setName("ID"); + idColumn.setDataTypeDescriptor(idDomain); + idColumn.setLogicalName("従業員ID"); + empTable.appendModel(idColumn); + + PrimaryKeyConstraintModel primaryKey = rootModel.newModel(PrimaryKeyConstraintModel.class); + primaryKey.getColumns().add(idColumn); + empTable.setPrimaryKey(primaryKey); + + ColumnModel noColumn = rootModel.newModel(ColumnModel.class); + noColumn.setName("EMP_NO"); + noColumn.setDataTypeDescriptor(new IntegerDesc()); + noColumn.setNotNull(true); + noColumn.setLogicalName("従業員番号"); + empTable.appendModel(noColumn); + + ColumnModel nameColumn = rootModel.newModel(ColumnModel.class); + nameColumn.setName("EMP_NAME"); + nameColumn.setDataTypeDescriptor(nameDomain); + nameColumn.setNotNull(true); + nameColumn.setLogicalName("従業員名"); + nameColumn.setDefaultValue("no name"); + nameColumn.setRepresentation(true); + empTable.appendModel(nameColumn); + + ColumnModel mgrColumn = rootModel.newModel(ColumnModel.class); + mgrColumn.setName("MGR_ID"); + mgrColumn.setDataTypeDescriptor(new IntegerDesc()); + nameColumn.setLogicalName("上司ID"); + empTable.appendModel(mgrColumn); + + ColumnModel hireColumn = rootModel.newModel(ColumnModel.class); + hireColumn.setName("HIREDATE"); + hireColumn.setDataTypeDescriptor(new TimestampDesc()); + hireColumn.setNotNull(true); + empTable.appendModel(hireColumn); + + ColumnModel salColumn = rootModel.newModel(ColumnModel.class); + salColumn.setName("SAL"); + salColumn.setDataTypeDescriptor(new NumericDesc(7, 2)); + salColumn.setNotNull(true); + empTable.appendModel(salColumn); + + ColumnModel deptColumn = rootModel.newModel(ColumnModel.class); + deptColumn.setName("DEPT_ID"); + deptColumn.setDataTypeDescriptor(new IntegerDesc()); + deptColumn.setNotNull(true); + empTable.appendModel(deptColumn); + + return empTable; + } + + /** + * 外部キーを生成する。 + * このメソッドは、複合キーテーブルを参照する外部キーは生成できない。 + * @param target 参照先テーブル + * @param source 制約を受けるテーブル + * @param sourceColumnName 制約を受けるカラムのカラム名 + * @return 外部キー + */ + private ForeignKeyModel createForeignKey(TableModel target, TableModel source, String sourceColumnName) { + String[] sourceColumnNames = { + sourceColumnName + }; + + ForeignKeyModel fk = rootModel.newModel(ForeignKeyModel.class); + fk.setSource(source); + fk.setTarget(target); + fk.autoDenominate(rootModel); + fk.createMappings(rootModel, false); + for (int i = 0; i < sourceColumnNames.length; i++) { + try { + ColumnModel constraintColumn = source.getColumn(sourceColumnNames[i]); + fk.getMappings().get(i).setConstraintColumn(constraintColumn); + break; + } catch (TooManyElementsException e) { + throw new UnexpectedConditionError("test code error", e); + } catch (ElementNotFoundException e) { + // ignore + } + } + + return fk; + } +} Modified: artemis/trunk/org.jiemamy.composer/.project =================================================================== --- artemis/trunk/org.jiemamy.composer/.project 2008-12-27 17:43:07 UTC (rev 2326) +++ artemis/trunk/org.jiemamy.composer/.project 2008-12-29 05:37:47 UTC (rev 2327) @@ -50,14 +50,14 @@ </natures> <linkedResources> <link> - <name>.fbprefs</name> + <name>findbugs.xml</name> <type>1</type> - <locationURI>DOCUMENTS/org.jiemamy.project/.fbprefs</locationURI> + <locationURI>DOCUMENTS/org.jiemamy.project/findbugs.xml</locationURI> </link> <link> - <name>findbugs.xml</name> + <name>.fbprefs</name> <type>1</type> - <locationURI>DOCUMENTS/org.jiemamy.project/findbugs.xml</locationURI> + <locationURI>DOCUMENTS/org.jiemamy.project/.fbprefs</locationURI> </link> <link> <name>.checkstyle</name> Modified: artemis/trunk/org.jiemamy.composer/META-INF/MANIFEST.MF =================================================================== --- artemis/trunk/org.jiemamy.composer/META-INF/MANIFEST.MF 2008-12-27 17:43:07 UTC (rev 2326) +++ artemis/trunk/org.jiemamy.composer/META-INF/MANIFEST.MF 2008-12-29 05:37:47 UTC (rev 2327) @@ -9,10 +9,8 @@ Export-Package: org.jiemamy.composer.exporter, org.jiemamy.composer.importer Require-Bundle: org.jiemamy.spec.core, - org.jiemamy.core, - org.jiemamy.serializer + org.jiemamy.core Eclipse-BuddyPolicy: registered Eclipse-RegisterBuddy: org.jiemamy.spec.core, org.jiemamy.core, - org.jiemamy.serializer, org.jiemamy.dialect Modified: artemis/trunk/org.jiemamy.composer/pom.xml =================================================================== --- artemis/trunk/org.jiemamy.composer/pom.xml 2008-12-27 17:43:07 UTC (rev 2326) +++ artemis/trunk/org.jiemamy.composer/pom.xml 2008-12-29 05:37:47 UTC (rev 2327) @@ -201,11 +201,6 @@ <type>test-jar</type> <scope>test</scope> </dependency> - <dependency> - <groupId>${project.groupId}</groupId> - <artifactId>org.jiemamy.serializer</artifactId> - <version>${project.version}</version> - </dependency> </dependencies> <reporting> <plugins> Modified: artemis/trunk/org.jiemamy.core/.classpath =================================================================== --- artemis/trunk/org.jiemamy.core/.classpath 2008-12-27 17:43:07 UTC (rev 2326) +++ artemis/trunk/org.jiemamy.core/.classpath 2008-12-29 05:37:47 UTC (rev 2327) @@ -15,6 +15,8 @@ <classpathentry kind="lib" path="lib/logback-classic-0.9.9.jar" sourcepath="lib/sources/logback-classic-0.9.9-sources.jar"/> <classpathentry kind="lib" path="lib/logback-core-0.9.9.jar" sourcepath="lib/sources/logback-core-0.9.9-sources.jar"/> <classpathentry exported="true" kind="lib" path="lib/stax-api-1.0.1.jar" sourcepath="lib/sources/stax-api-1.0.1-sources.jar"/> + <classpathentry exported="true" kind="lib" path="lib/stax-1.2.0.jar" sourcepath="lib/sources/stax-1.2.0-sources.jar"/> + <classpathentry exported="true" kind="lib" path="lib/wstx-asl-3.2.7.jar" sourcepath="lib/sources/wstx-asl-3.2.7-sources.jar"/> <classpathentry exported="true" kind="lib" path="lib/s2-framework-2.4.27.jar" sourcepath="lib/sources/s2-framework-2.4.27-sources.jar"/> <classpathentry exported="true" kind="lib" path="lib/s2-extension-2.4.27.jar" sourcepath="lib/sources/s2-extension-2.4.27-sources.jar"/> <classpathentry exported="true" kind="lib" path="lib/s2-tiger-2.4.27.jar" sourcepath="lib/sources/s2-tiger-2.4.27-sources.jar"/> Modified: artemis/trunk/org.jiemamy.core/META-INF/MANIFEST.MF =================================================================== --- artemis/trunk/org.jiemamy.core/META-INF/MANIFEST.MF 2008-12-27 17:43:07 UTC (rev 2326) +++ artemis/trunk/org.jiemamy.core/META-INF/MANIFEST.MF 2008-12-29 05:37:47 UTC (rev 2327) @@ -191,6 +191,7 @@ org.jiemamy.model.index, org.jiemamy.model.node, org.jiemamy.model.sql, + org.jiemamy.serializer, org.jiemamy.utils, org.jiemamy.utils.debug, org.jiemamy.utils.swap, Modified: artemis/trunk/org.jiemamy.core/pom.xml =================================================================== --- artemis/trunk/org.jiemamy.core/pom.xml 2008-12-27 17:43:07 UTC (rev 2326) +++ artemis/trunk/org.jiemamy.core/pom.xml 2008-12-29 05:37:47 UTC (rev 2327) @@ -229,6 +229,16 @@ <version>1.0.1</version> </dependency> <dependency> + <groupId>stax</groupId> + <artifactId>stax</artifactId> + <version>1.2.0</version> + </dependency> + <dependency> + <groupId>org.codehaus.woodstox</groupId> + <artifactId>wstx-asl</artifactId> + <version>3.2.7</version> + </dependency> + <dependency> <groupId>commons-lang</groupId> <artifactId>commons-lang</artifactId> <version>2.3</version> Added: artemis/trunk/org.jiemamy.core/src/main/java/com/megginson/sax/DataWriter.java =================================================================== --- artemis/trunk/org.jiemamy.core/src/main/java/com/megginson/sax/DataWriter.java (rev 0) +++ artemis/trunk/org.jiemamy.core/src/main/java/com/megginson/sax/DataWriter.java 2008-12-29 05:37:47 UTC (rev 2327) @@ -0,0 +1,296 @@ +// DataWriter.java - XML writer for data-oriented files. + +package com.megginson.sax; + +import java.io.Writer; +import java.util.Stack; + +import org.apache.commons.lang.StringUtils; +import org.xml.sax.Attributes; +import org.xml.sax.SAXException; +import org.xml.sax.XMLReader; + +/** + * Write data- or field-oriented XML. + * + * <p>This filter pretty-prints field-oriented XML without mixed content. + * all added indentation and newlines will be passed on down + * the filter chain (if any).</p> + * + * <p>In general, all whitespace in an XML document is potentially + * significant, so a general-purpose XML writing tool like the + * {@link com.megginson.sax.XMLWriter XMLWriter} class cannot + * add newlines or indentation.</p> + * + * <p>There is, however, a large class of XML documents where information + * is strictly fielded: each element contains either character data + * or other elements, but not both. For this special case, it is possible + * for a writing tool to provide automatic indentation and newlines + * without requiring extra work from the user. Note that this class + * will likely not yield appropriate results for document-oriented + * XML like XHTML pages, which mix character data and elements together.</p> + * + * <p>This writer will automatically place each start tag on a new line, + * optionally indented if an indent step is provided (by default, there + * is no indentation). If an element contains other elements, the end + * tag will also appear on a new line with leading indentation. Consider, + * for example, the following code:</p> + * + * <pre> + * DataWriter w = new DataWriter(); + * + * w.setIndentStep(2); + * w.startDocument(); + * w.startElement("Person"); + * w.dataElement("name", "Jane Smith"); + * w.dataElement("date-of-birth", "1965-05-23"); + * w.dataElement("citizenship", "US"); + * w.endElement("Person"); + * w.endDocument(); + * </pre> + * + * <p>This code will produce the following document:</p> + * + * <pre> + * <?xml version="1.0" standalone="yes"?> + * <Person> + * <name>Jane Smith</name> + * <date-of-birth>1965-05-23</date-of-birth> + * <citizenship>US</citizenship> + * </Person> + * </pre> + * + * <p>This class inherits from {@link com.megginson.sax.XMLWriter + * XMLWriter}, and provides all of the same support for Namespaces.</p> + * + * @author David Megginson, david****@meggi***** + * @version 0.2 + * @see com.megginson.sax.XMLWriter + */ +public class DataWriter extends XMLWriter { + + private SeenState state = SeenState.NOTHING; + + private Stack<SeenState> stateStack = new Stack<SeenState>(); + + /** インデントに使用するスペースの数 */ + private int indentStep = 0; + + + /** + * Create a new data writer for standard output. + */ + public DataWriter() { + } + + /** + * Create a new data writer for the specified output. + * + * @param writer The character stream where the XML document + * will be written. + */ + public DataWriter(Writer writer) { + super(writer); + } + + /** + * Create a new data writer for standard output. + * + * <p>Use the XMLReader provided as the source of events.</p> + * + * @param xmlreader The parent in the filter chain. + */ + public DataWriter(XMLReader xmlreader) { + super(xmlreader); + } + + /** + * Create a new data writer for the specified output. + * <p>Use the XMLReader provided as the source of events.</p> + * + * @param xmlreader The parent in the filter chain. + * @param writer The character stream where the XML document + * will be written. + */ + public DataWriter(XMLReader xmlreader, Writer writer) { + super(xmlreader, writer); + } + + /** + * Write a sequence of characters. + * + * @param ch The characters to write. + * @param start The starting position in the array. + * @param length The number of characters to use. + * @exception org.xml.sax.SAXException If there is an error + * writing the characters, or if a filter further + * down the chain raises an exception. + * @see XMLWriter#characters(char[], int, int) + */ + @Override + public void characters(char[] ch, int start, int length) throws SAXException { + state = SeenState.DATA; + super.characters(ch, start, length); + } + + /** + * Write a empty element tag. + * + * <p>Each tag will appear on a new line, and will be + * indented by the current indent step times the number + * of ancestors that the element has.</p> + * + * <p>The newline and indentation will be passed on down + * the filter chain through regular characters events.</p> + * + * @param uri The element's Namespace URI. + * @param localName The element's local name. + * @param qName The element's qualified (prefixed) name. + * @param atts The element's attribute list. + * @exception org.xml.sax.SAXException If there is an error + * writing the empty tag, or if a filter further + * down the chain raises an exception. + * @see XMLWriter#emptyElement(String, String, String, Attributes) + */ + @Override + public void emptyElement(String uri, String localName, String qName, Attributes atts) throws SAXException { + stateStack.push(state); + state = SeenState.ELEMENT; + if (getDepth() > 0) { + super.characters(getLineSeparator()); + } + doIndent(); + super.emptyElement(uri, localName, qName, atts); + state = stateStack.pop(); + } + + /** + * Write an end tag. + * + * <p>If the element has contained other elements, the tag + * will appear indented on a new line; otherwise, it will + * appear immediately following whatever came before.</p> + * + * <p>The newline and indentation will be passed on down + * the filter chain through regular characters events.</p> + * + * @param uri The element's Namespace URI. + * @param localName The element's local name. + * @param qName The element's qualified (prefixed) name. + * @exception org.xml.sax.SAXException If there is an error + * writing the end tag, or if a filter further + * down the chain raises an exception. + * @see XMLWriter#endElement(String, String, String) + */ + @Override + public void endElement(String uri, String localName, String qName) throws SAXException { + if (state == SeenState.ELEMENT) { + super.characters(getLineSeparator()); + doIndent(); + } + super.endElement(uri, localName, qName); + state = stateStack.pop(); + } + + /** + * Return the current indent step. + * + * <p>Return the current indent step: each start tag will be + * indented by this number of spaces times the number of + * ancestors that the element has.</p> + * + * @return The number of spaces in each indentation step, + * or 0 or less for no indentation. + * @see #setIndentStep + */ + public int getIndentStep() { + return indentStep; + } + + /** + * Reset the writer so that it can be reused. + * + * <p>This method is especially useful if the writer failed + * with an exception the last time through.</p> + * + * @see com.megginson.sax.XMLWriter#reset + */ + @Override + public void reset() { + state = SeenState.NOTHING; + stateStack = new Stack<SeenState>(); + super.reset(); + } + + /** + * Set the current indent step. + * + * @param indentStep The new indent step (0 or less for no + * indentation). + * @see #getIndentStep + */ + public void setIndentStep(int indentStep) { + this.indentStep = indentStep; + } + + /** + * Write a start tag. + * + * <p>Each tag will begin on a new line, and will be + * indented by the current indent step times the number + * of ancestors that the element has.</p> + * + * <p>The newline and indentation will be passed on down + * the filter chain through regular characters events.</p> + * + * @param uri The element's Namespace URI. + * @param localName The element's local name. + * @param qName The element's qualified (prefixed) name. + * @param atts The element's attribute list. + * @exception org.xml.sax.SAXException If there is an error + * writing the start tag, or if a filter further + * down the chain raises an exception. + * @see XMLWriter#startElement(String, String, String, Attributes) + */ + @Override + public void startElement(String uri, String localName, String qName, Attributes atts) throws SAXException { + stateStack.push(SeenState.ELEMENT); + state = SeenState.NOTHING; + if (getDepth() > 0) { + super.characters(getLineSeparator()); + } + doIndent(); + super.startElement(uri, localName, qName, atts); + } + + /** + * Print indentation for the current level. + * + * @exception org.xml.sax.SAXException If there is an error + * writing the indentation characters, or if a filter + * further down the chain raises an exception. + */ + private void doIndent() throws SAXException { + if (indentStep > 0 && getDepth() > 0) { + characters(StringUtils.repeat(" ", indentStep * getDepth())); + } + } + + private int getDepth() { + return stateStack.size() - 1; + } + + + private enum SeenState { + + /** 初期値 */ + NOTHING, + + /** 要素出力後 */ + ELEMENT, + + /** データ出力後 */ + DATA + } + +} Added: artemis/trunk/org.jiemamy.core/src/main/java/com/megginson/sax/XMLWriter.java =================================================================== --- artemis/trunk/org.jiemamy.core/src/main/java/com/megginson/sax/XMLWriter.java (rev 0) +++ artemis/trunk/org.jiemamy.core/src/main/java/com/megginson/sax/XMLWriter.java 2008-12-29 05:37:47 UTC (rev 2327) @@ -0,0 +1,1032 @@ +// XMLWriter.java - serialize an XML document. +// Written by David Megginson, david****@meggi***** +// NO WARRANTY! This class is in the public domain. + +// $Id: XMLWriter.java,v 1.5 2000/09/17 01:08:16 david Exp $ + +package com.megginson.sax; + +import java.io.IOException; +import java.io.OutputStreamWriter; +import java.io.Writer; +import java.util.Enumeration; +import java.util.HashMap; +import java.util.Map; + +import org.apache.commons.lang.StringUtils; +import org.xml.sax.Attributes; +import org.xml.sax.SAXException; +import org.xml.sax.XMLReader; +import org.xml.sax.helpers.AttributesImpl; +import org.xml.sax.helpers.NamespaceSupport; +import org.xml.sax.helpers.XMLFilterImpl; + +/** + * Filter to write an XML document from a SAX event stream. + * + * <p> + * This class can be used by itself or as part of a SAX event stream: it takes as input a series of SAX2 ContentHandler + * events and uses the information in those events to write an XML document. Since this class is a filter, it can also + * pass the events on down a filter chain for further processing (you can use the XMLWriter to take a snapshot of the + * current state at any point in a filter chain), and it can be used directly as a ContentHandler for a SAX2 XMLReader. + * </p> + * + * <p> + * The client creates a document by invoking the methods for standard SAX2 events, always beginning with the + * {@link #startDocument startDocument} method and ending with the {@link #endDocument endDocument} method. There are + * convenience methods provided so that clients to not have to create empty attribute lists or provide empty strings as + * parameters; for example, the method invocation + * </p> + * + * <pre> + * w.startElement("foo"); + * </pre> + * + * <p> + * is equivalent to the regular SAX2 ContentHandler method + * </p> + * + * <pre> + * w.startElement("", "foo", "", new AttributesImpl()); + * </pre> + * + * <p> + * Except that it is more efficient because it does not allocate a new empty attribute list each time. The following + * code will send a simple XML document to standard output: + * </p> + * + * <pre> + * XMLWriter w = new XMLWriter(); + * w.startDocument(); + * w.startElement("greeting"); + * w.characters("Hello, world!"); + * w.endElement("greeting"); + * w.endDocument(); + * </pre> + * + * <p> + * The resulting document will look like this: + * </p> + * + * <pre> + * <?xml version="1.0" standalone="yes"?> + * <greeting>Hello, world!</greeting> + * </pre> + * + * <p> + * In fact, there is an even simpler convenience method, <var>dataElement</var>, designed for writing elements that + * contain only character data, so the code to generate the document could be shortened to + * </p> + * + * <pre> + * XMLWriter w = new XMLWriter(); + * w.startDocument(); + * w.dataElement("greeting", "Hello, world!"); + * w.endDocument(); + * </pre> + * + * <h2>Whitespace</h2> + * + * <p> + * According to the XML Recommendation, <em>all</em> whitespace in an XML document is potentially significant to an + * application, so this class never adds newlines or indentation. If you insert three elements in a row, as in + * </p> + * + * <pre> + * w.dataElement("item", "1"); + * w.dataElement("item", "2"); + * w.dataElement("item", "3"); + * </pre> + * + * <p> + * you will end up with + * </p> + * + * <pre> + * <item>1</item><item>3</item><item>3</item> + * </pre> + * + * <p> + * You need to invoke one of the <var>characters</var> methods explicitly to add newlines or indentation. + * Alternatively, you can use {@link com.megginson.sax.DataWriter DataWriter}, which is derived from this class -- it + * is optimized for writing purely data-oriented (or field-oriented) XML, and does automatic linebreaks and indentation + * (but does not support mixed content properly). + * </p> + * + * + * <h2>Namespace Support</h2> + * + * <p> + * The writer contains extensive support for XML Namespaces, so that a client application does not have to keep track of + * prefixes and supply <var>xmlns</var> attributes. By default, the XML writer will generate Namespace declarations in + * the form _NS1, _NS2, etc., wherever they are needed, as in the following example: + * </p> + * + * <pre> + * w.startDocument(); + * w.emptyElement("http://www.foo.com/ns/", "foo"); + * w.endDocument(); + * </pre> + * + * <p> + * The resulting document will look like this: + * </p> + * + * <pre> + * <?xml version="1.0" standalone="yes"?> + * <_NS1:foo xmlns:_NS1="http://www.foo.com/ns/"/> + * </pre> + * + * <p> + * In many cases, document authors will prefer to choose their own prefixes rather than using the (ugly) default names. + * The XML writer allows two methods for selecting prefixes: + * </p> + * + * <ol> + * <li>the qualified name</li> + * <li>the {@link #setPrefix setPrefix} method.</li> + * </ol> + * + * <p> + * Whenever the XML writer finds a new Namespace URI, it checks to see if a qualified (prefixed) name is also available; + * if so it attempts to use the name's prefix (as long as the prefix is not already in use for another Namespace URI). + * </p> + * + * <p> + * Before writing a document, the client can also pre-map a prefix to a Namespace URI with the setPrefix method: + * </p> + * + * <pre> + * w.setPrefix("http://www.foo.com/ns/", "foo"); + * w.startDocument(); + * w.emptyElement("http://www.foo.com/ns/", "foo"); + * w.endDocument(); + * </pre> + * + * <p> + * The resulting document will look like this: + * </p> + * + * <pre> + * <?xml version="1.0" standalone="yes"?> + * <foo:foo xmlns:foo="http://www.foo.com/ns/"/> + * </pre> + * + * <p> + * The default Namespace simply uses an empty string as the prefix: + * </p> + * + * <pre> + * w.setPrefix("http://www.foo.com/ns/", ""); + * w.startDocument(); + * w.emptyElement("http://www.foo.com/ns/", "foo"); + * w.endDocument(); + * </pre> + * + * <p> + * The resulting document will look like this: + * </p> + * + * <pre> + * <?xml version="1.0" standalone="yes"?> + * <foo xmlns="http://www.foo.com/ns/"/> + * </pre> + * + * <p> + * By default, the XML writer will not declare a Namespace until it is actually used. Sometimes, this approach will + * create a large number of Namespace declarations, as in the following example: + * </p> + * + * <pre> + * <xml version="1.0" standalone="yes"?> + * <rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"> + * <rdf:Description about="http://www.foo.com/ids/books/12345"> + * <dc:title xmlns:dc="http://www.purl.org/dc/">A Dark Night</dc:title> + * <dc:creator xmlns:dc="http://www.purl.org/dc/">Jane Smith</dc:title> + * <dc:date xmlns:dc="http://www.purl.org/dc/">2000-09-09</dc:title> + * </rdf:Description> + * </rdf:RDF> + * </pre> + * + * <p> + * The "rdf" prefix is declared only once, because the RDF Namespace is used by the root element and can be inherited by + * all of its descendants; the "dc" prefix, on the other hand, is declared three times, because no higher element uses + * the Namespace. To solve this problem, you can instruct the XML writer to predeclare Namespaces on the root element + * even if they are not used there: + * </p> + * + * <pre> + * w.forceNSDecl("http://www.purl.org/dc/"); + * </pre> + * + * <p> + * Now, the "dc" prefix will be declared on the root element even though it's not needed there, and can be inherited by + * its descendants: + * </p> + * + * <pre> + * <xml version="1.0" standalone="yes"?> + * <rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" + * xmlns:dc="http://www.purl.org/dc/"> + * <rdf:Description about="http://www.foo.com/ids/books/12345"> + * <dc:title>A Dark Night</dc:title> + * <dc:creator>Jane Smith</dc:title> + * <dc:date>2000-09-09</dc:title> + * </rdf:Description> + * </rdf:RDF> + * </pre> + * + * <p> + * This approach is also useful for declaring Namespace prefixes that be used by qualified names appearing in attribute + * values or character data. + * </p> + * + * @author David Megginson, david****@meggi***** + * @version 0.2 + * @see org.xml.sax.XMLFilter + * @see org.xml.sax.ContentHandler + */ +public class XMLWriter extends XMLFilterImpl { + + /** 空属性定数 */ + private static final Attributes EMPTY_ATTS = new AttributesImpl(); + + private Map<String, String> prefixMap; + + private Map<String, Boolean> forcedDeclarations; + + private Map<String, String> doneDeclerations; + + private int elementLevel = 0; + + /** 出力先Writer */ + private Writer output; + + private NamespaceSupport nsSupport; + + private int prefixCounter = 0; + + /** + * 出力時に使用する改行コード + * + * デフォルトではシステムプロパティに設定されている値を使用する。 + */ + private String lineSeparator = System.getProperty("line.separator"); + + + /** + * Create a new XML writer. + * + * <p>Write to standard output.</p> + */ + public XMLWriter() { + init(null); + } + + /** + * Create a new XML writer. + * + * <p>Write to the writer provided.</p> + * + * @param writer The output destination, or null to use standard output. + */ + public XMLWriter(Writer writer) { + init(writer); + } + + /** + * Create a new XML writer. + * + * <p>Use the specified XML reader as the parent.</p> + * + * @param xmlreader The parent in the filter chain, or null for no parent. + */ + public XMLWriter(XMLReader xmlreader) { + super(xmlreader); + init(null); + } + + /** + * Create a new XML writer. + * + * <p>Use the specified XML reader as the parent, and write to the specified writer.</p> + * + * @param xmlreader The parent in the filter chain, or null for no parent. + * @param writer The output destination, or null to use standard output. + */ + public XMLWriter(XMLReader xmlreader, Writer writer) { + super(xmlreader); + init(writer); + } + + /** + * Write character data. + * + * <p>Pass the event on down the filter chain for further processing.</p> + * + * @param ch The array of characters to write. + * @param start The starting position in the array. + * @param len The number of characters to write. + * @throws org.xml.sax.SAXException If there is an error writing the characters, or if a handler further down the + * filter chain raises an exception. + * @see org.xml.sax.ContentHandler#characters(char[], int, int) + */ + @Override + public void characters(char[] ch, int start, int len) throws SAXException { + writeEsc(ch, start, len, false); + super.characters(ch, start, len); + } + + /** + * Write a string of character data, with XML escaping. + * + * <p>This is a convenience method that takes an XML String, converts it to a character array, then invokes + * {@link #characters(char[], int, int)}.</p> + * + * @param data The character data. + * @throws org.xml.sax.SAXException If there is an error writing the string, or if a handler further down the + * filter chain raises an exception. + * @see #characters(char[], int, int) + */ + public void characters(String data) throws SAXException { + char[] ch = data.toCharArray(); + characters(ch, 0, ch.length); + } + + /** + * Write an element with character data content but no attributes or Namespace URI. + * + * <p>This is a convenience method to write a complete element with character data content, including the start tag + * and end tag. The method provides an empty string for the Namespace URI, and empty string for the qualified name, + * and an empty attribute list.</p> + * + * <p>This method invokes {@link #startElement(String, String, String, Attributes)}, followed by + * {@link #characters(String)}, followed by {@link #endElement(String, String, String)}.</p> + * + * @param localName The element's local name. + * @param content The character data content. + * @throws org.xml.sax.SAXException If there is an error writing the empty tag, or if a handler further down the + * filter chain raises an exception. + * @see #startElement(String, String, String, Attributes) + * @see #characters(String) + * @see #endElement(String, String, String) + */ + public void dataElement(String localName, String content) throws SAXException { + dataElement(StringUtils.EMPTY, localName, StringUtils.EMPTY, EMPTY_ATTS, content); + } + + /** + * Write an element with character data content but no attributes. + * + * <p>This is a convenience method to write a complete element with character data content, including the start tag + * and end tag. This method provides an empty string for the qname and an empty attribute list.</p> + * + * <p>This method invokes {@link #startElement(String, String, String, Attributes)}, followed by + * {@link #characters(String)}, followed by {@link #endElement(String, String, String)}.</p> + * + * @param uri The element's Namespace URI. + * @param localName The element's local name. + * @param content The character data content. + * @throws org.xml.sax.SAXException If there is an error writing the empty tag, or if a handler further down the + * filter chain raises an exception. + * @see #startElement(String, String, String, Attributes) + * @see #characters(String) + * @see #endElement(String, String, String) + */ + public void dataElement(String uri, String localName, String content) throws SAXException { + dataElement(uri, localName, StringUtils.EMPTY, EMPTY_ATTS, content); + } + + /** + * Write an element with character data content. + * + * <p>This is a convenience method to write a complete element with character data content, including the start tag + * and end tag.</p> + * + * <p>This method invokes {@link #startElement(String, String, String, Attributes)}, followed by + * {@link #characters(String)}, followed by {@link #endElement(String, String, String)}.</p> + * + * @param uri The element's Namespace URI. + * @param localName The element's local name. + * @param qName The element's default qualified name. + * @param atts The element's attributes. + * @param content The character data content. + * @throws org.xml.sax.SAXException If there is an error writing the empty tag, or if a handler further down the + * filter chain raises an exception. + * @see #startElement(String, String, String, Attributes) + * @see #characters(String) + * @see #endElement(String, String, String) + */ + public void dataElement(String uri, String localName, String qName, Attributes atts, String content) + throws SAXException { + startElement(uri, localName, qName, atts); + characters(content); + endElement(uri, localName, qName); + } + + /** + * Add an empty element without a Namespace URI, qname or attributes. + * + * <p>This method will supply an empty string for the qname, and empty string for the Namespace URI, and an empty + * attribute list. It invokes {@link #emptyElement(String, String, String, Attributes)} directly.</p> + * + * @param localName The element's local name. + * @throws org.xml.sax.SAXException If there is an error writing the empty tag, or if a handler further down the + * filter chain raises an exception. + * @see #emptyElement(String, String, String, Attributes) + */ + public void emptyElement(String localName) throws SAXException { + emptyElement(StringUtils.EMPTY, localName, StringUtils.EMPTY, EMPTY_ATTS); + } + + /** + * Add an empty element without a qname or attributes. + * + * <p>This method will supply an empty string for the qname and an empty attribute list. It invokes + * {@link #emptyElement(String, String, String, Attributes)} directly.</p> + * + * @param uri The element's Namespace URI. + * @param localName The element's local name. + * @throws org.xml.sax.SAXException If there is an error writing the empty tag, or if a handler further down the + * filter chain raises an exception. + * @see #emptyElement(String, String, String, Attributes) + */ + public void emptyElement(String uri, String localName) throws SAXException { + emptyElement(uri, localName, StringUtils.EMPTY, EMPTY_ATTS); + } + + /** + * Write an empty element. + * + * <p>This method writes an empty element tag rather than a start tag followed by an end tag. Both a + * {@link #startElement(String, String, String, Attributes) startElement} and an + * {@link #endElement(String, String, String) endElement} event will be passed on down the filter chain.</p> + * + * @param uri The element's Namespace URI, or the empty string if the element has no Namespace or if Namespace + * processing is not being performed. + * @param localName The element's local name (without prefix). This parameter must be provided. + * @param qName The element's qualified name (with prefix), or the empty string if none is available. This parameter + * is strictly advisory: the writer may or may not use the prefix attached. + * @param atts The element's attribute list. + * @throws org.xml.sax.SAXException If there is an error writing the empty tag, or if a handler further down the + * filter chain raises an exception. + * @see #startElement(String, String, String, Attributes) + * @see #endElement(String, String, String) + */ + public void emptyElement(String uri, String localName, String qName, Attributes atts) throws SAXException { + nsSupport.pushContext(); + write('<'); + writeName(uri, localName, qName, true); + writeAttributes(atts); + if (elementLevel == 1) { + forceNSDeclerations(); + } + writeNSDeclerations(); + write("/>"); + super.startElement(uri, localName, qName, atts); + super.endElement(uri, localName, qName); +// nsSupport.popContext(); + } + + /** + * Write a newline at the end of the document. + * + * <p>Pass the event on down the filter chain for further processing.</p> + * + * @throws org.xml.sax.SAXException If there is an error writing the newline, or if a handler further down the + * filter chain raises an exception. + * @see org.xml.sax.ContentHandler#endDocument() + */ + @Override + public void endDocument() throws SAXException { + write(lineSeparator); + super.endDocument(); + try { + output.close(); + } catch (IOException e) { + throw new SAXException(e); + } + } + + /** + * End an element without a Namespace URI or qname. + * + * <p>This method will supply an empty string for the qName and an empty string for the Namespace URI. It invokes + * {@link #endElement(String, String, String)} directly.</p> + * + * @param localName The element's local name. + * @throws org.xml.sax.SAXException If there is an error writing the end tag, or if a handler further down the + * filter chain raises an exception. + * @see #endElement(String, String, String) + */ + public void endElement(String localName) throws SAXException { + endElement(StringUtils.EMPTY, localName, StringUtils.EMPTY); + } + + /** + * End an element without a qname. + * + * <p>This method will supply an empty string for the qName. It invokes {@link #endElement(String,String,String)} + * directly.</p> + * + * @param uri The element's Namespace URI. + * @param localName The element's local name. + * @throws org.xml.sax.SAXException If there is an error writing the end tag, or if a handler further down the + * filter chain raises an exception. + * @see #endElement(String, String, String) + */ + public void endElement(String uri, String localName) throws SAXException { + endElement(uri, localName, StringUtils.EMPTY); + } + + /** + * Write an end tag. Pass the event on down the filter chain for further processing. + * + * @param uri The Namespace URI, or the empty string if none is available. + * @param localName The element's local (unprefixed) name (required). + * @param qName The element's qualified (prefixed) name, or the empty string is none is available. This method will + * use the qName as a template for generating a prefix if necessary, but it is not guaranteed to use the + * same qName. + * @throws org.xml.sax.SAXException If there is an error writing the end tag, or if a handler further down the + * filter chain raises an exception. + * @see org.xml.sax.ContentHandler#endElement(String, String, String) + */ + @Override + public void endElement(String uri, String localName, String qName) throws SAXException { + write("</"); + writeName(uri, localName, qName, true); + write('>'); + if (elementLevel == 1) { + write(lineSeparator); + } + super.endElement(uri, localName, qName); + nsSupport.popContext(); + elementLevel--; + } + + /** + * Flush the output. + * + * <p>This method flushes the output stream. It is especially useful when you need to make certain that the entire + * document has been written to output but do not want to close the output stream.</p> + * + * <p>This method is invoked automatically by the {@link #endDocument endDocument} method after writing a document. + * </p> + * + * @throws IOException + * @see #reset + */ + public void flush() throws IOException { + output.flush(); + } + + /** + * Force a Namespace to be declared on the root element. + * + * <p>By default, the XMLWriter will declare only the Namespaces needed for an element; as a result, a Namespace may + * be declared many places in a document if it is not used on the root element.</p> + * + * <p>This method forces a Namespace to be declared on the root element even if it is not used there, and reduces + * the number of xmlns attributes in the document.</p> + * + * @param uri The Namespace URI to declare. + * @see #forceNSDecleration(String, String) + * @see #setPrefix(String, String) + */ + public void forceNSDecleration(String uri) { + forcedDeclarations.put(uri, true); + } + + /** + * Force a Namespace declaration with a preferred prefix. + * + * <p>This is a convenience method that invokes {@link #setPrefix setPrefix} then + * {@link #forceNSDecleration(String)} .</p> + * + * @param uri The Namespace URI to declare on the root element. + * @param prefix The preferred prefix for the Namespace, or "" for the default Namespace. + * @see #setPrefix + * @see #forceNSDecleration(String) + */ + public void forceNSDecleration(String uri, String prefix) { + setPrefix(uri, prefix); + forceNSDecleration(uri); + } + + /** + * 使用している改行コードを取得する。 + * + * @return 現在設定されている改行コード。 + */ + public String getLineSeparator() { + return lineSeparator; + } + + /** + * Get the current or preferred prefix for a Namespace URI. + * + * @param uri The Namespace URI. + * @return The preferred prefix, or "" for the default Namespace. + * @see #setPrefix(String, String) + */ + public String getPrefix(String uri) { + return prefixMap.get(uri); + } + + /** + * Write ignorable whitespace. Pass the event on down the filter chain for further processing. + * + * @param ch The array of characters to write. + * @param start The starting position in the array. + * @param length The number of characters to write. + * @throws org.xml.sax.SAXException If there is an error writing the whitespace, or if a handler further down the + * filter chain raises an exception. + * @see org.xml.sax.ContentHandler#ignorableWhitespace(char[], int, int) + */ + @Override + public void ignorableWhitespace(char[] ch, int start, int length) throws SAXException { + writeEsc(ch, start, length, false); + super.ignorableWhitespace(ch, start, length); + } + + /** + * Write a processing instruction. Pass the event on down the filter chain for further processing. + * + * @param target The PI target. + * @param data The PI data. + * @throws org.xml.sax.SAXException If there is an error writing the PI, or if a handler further down the filter + * chain raises an exception. + * @see org.xml.sax.ContentHandler#processingInstruction(String, String) + */ + @Override + public void processingInstruction(String target, String data) throws SAXException { + write("<?"); + write(target); + write(' '); + write(data); + write("?>"); + if (elementLevel < 1) { + write(lineSeparator); + } + super.processingInstruction(target, data); + } + + /** + * Reset the writer. + * + * <p>This method is especially useful if the writer throws an exception before it is finished, and you want to + * reuse the writer for a new document. It is usually a good idea to invoke {@link #flush flush} before resetting + * the writer, to make sure that no output is lost.</p> + * + * <p>This method is invoked automatically by the {@link #startDocument startDocument} method before writing a new + * document.</p> + * + * <p><strong>Note:</strong> this method will <em>not</em> clear the prefix or URI information in the writer or the + * selected output writer.</p> + * + * @see #flush() + */ + public void reset() { + elementLevel = 0; + prefixCounter = 0; + nsSupport.reset(); + } + + /** + * 使用する改行コードを設定する。 + * + * @param lineSeparator 設定する改行コード。 + */ + public void setLineSeparator(String lineSeparator) { + this.lineSeparator = lineSeparator; + } + + /** + * Set a new output destination for the document. + * + * @param writer The output destination, or null to use standard output. + * @see #flush() + */ + public void setOutput(Writer writer) { + if (writer == null) { + output = new OutputStreamWriter(System.out); + } else { + output = writer; + } + } + + /** + * Specify a preferred prefix for a Namespace URI. + * + * <p>Note that this method does not actually force the Namespace to be declared; to do that, use the + * {@link #forceNSDecleration(String)} method as well.</p> + * + * @param uri The Namespace URI. + * @param prefix The preferred prefix, or "" to select the default Namespace. + * @see #getPrefix(String) + * @see #forceNSDecleration(String) + * @see #forceNSDecleration(String, String) + */ + public void setPrefix(String uri, String prefix) { + prefixMap.put(uri, prefix); + } + + /** + * Write the XML declaration at the beginning of the document. Pass the event on down the filter chain for further + * processing. + * + * @throws org.xml.sax.SAXException If there is an error writing the XML declaration, or if a handler further + * down the filter chain raises an exception. + * @see org.xml.sax.ContentHandler#startDocument() + */ + @Override + public void startDocument() throws SAXException { + reset(); + write("<?xml version=\"1.0\"?>" + lineSeparator); + super.startDocument(); + } + + /** + * Start a new element without a qname, attributes or a Namespace URI. + * + * <p>This method will provide an empty string for the Namespace URI, and empty string for the qualified name, and a + * default empty attribute list. It invokes #startElement(String, String, String, Attributes)} directly.</p> + * + * @param localName The element's local name. + * @throws org.xml.sax.SAXException If there is an error writing the start tag, or if a handler further down the + * filter chain raises an exception. + * @see #startElement(String, String, String, Attributes) + */ + public void startElement(String localName) throws SAXException { + startElement(StringUtils.EMPTY, localName, StringUtils.EMPTY, EMPTY_ATTS); + } + + /** + * Start a new element without a qname or attributes. + * + * <p>This method will provide a default empty attribute list and an empty string for the qualified name. It invokes + * {@link #startElement(String,String,String,Attributes)} directly.</p> + * + * @param uri The element's Namespace URI. + * @param localName The element's local name. + * @throws org.xml.sax.SAXException If there is an error writing the start tag, or if a handler further down the + * filter chain raises an exception. + * @see #startElement(String, String, String, Attributes) + */ + public void startElement(String uri, String localName) throws SAXException { + startElement(uri, localName, StringUtils.EMPTY, EMPTY_ATTS); + } + + /** + * Write a start tag. Pass the event on down the filter chain for further processing. + * + * @param uri The Namespace URI, or the empty string if none is available. + * @param localName The element's local (unprefixed) name (required). + * @param qName The element's qualified (prefixed) name, or the empty string is none is available. This method will + * use the qName as a template for generating a prefix if necessary, but it is not guaranteed to use the + * same qName. + * @param atts The element's attribute list (must not be null). + * @throws org.xml.sax.SAXException If there is an error writing the start tag, or if a handler further down the + * filter chain raises an exception. + * @see org.xml.sax.ContentHandler#startElement(String, String, String, Attributes) + */ + @Override + public void startElement(String uri, String localName, String qName, Attributes atts) throws SAXException { + elementLevel++; + nsSupport.pushContext(); + write('<'); + writeName(uri, localName, qName, true); + writeAttributes(atts); + if (elementLevel == 1) { + forceNSDeclerations(); + } + writeNSDeclerations(); + write('>'); + super.startElement(uri, localName, qName, atts); + } + + /** + * Determine the prefix for an element or attribute name. + * + * @param uri The Namespace URI. + * @param qName The qualified name (optional); this will be used to indicate the preferred prefix if none is + * currently bound. + * @param isElement true if this is an element name, false if it is an attribute name (which cannot use the default + * Namespace). + * @return + */ + private String doPrefix(String uri, String qName, boolean isElement) { + // TODO this method probably needs some cleanup. + String defaultNS = nsSupport.getURI(StringUtils.EMPTY); + if (StringUtils.EMPTY.equals(uri)) { + if (isElement && defaultNS != null) { + nsSupport.declarePrefix(StringUtils.EMPTY, StringUtils.EMPTY); + } + return null; + } + String prefix; + if (isElement && defaultNS != null && uri.equals(defaultNS)) { + prefix = StringUtils.EMPTY; + } else { + prefix = nsSupport.getPrefix(uri); + } + if (prefix != null) { + return prefix; + } + prefix = doneDeclerations.get(uri); + if (prefix != null + && ((isElement == false || defaultNS != null) && StringUtils.EMPTY.equals(prefix) || nsSupport + .getURI(prefix) != null)) { + prefix = null; + } + if (prefix == null) { + prefix = prefixMap.get(uri); + if (prefix != null + && ((isElement == false || defaultNS != null) && StringUtils.EMPTY.equals(prefix) || nsSupport + .getURI(prefix) != null)) { + prefix = null; + } + } + if (prefix == null && qName != null && StringUtils.EMPTY.equals(qName) == false) { + int i = qName.indexOf(':'); + if (i == -1) { + if (isElement && defaultNS == null) { + prefix = StringUtils.EMPTY; + } + } else { + prefix = qName.substring(0, i); + } + } + while (prefix == null || nsSupport.getURI(prefix) != null) { + prefix = "__NS" + ++prefixCounter; + } + nsSupport.declarePrefix(prefix, uri); + doneDeclerations.put(uri, prefix); + return prefix; + } + + /** + * Force all Namespaces to be declared. This method is used on the root element to ensure that the predeclared + * Namespaces all appear. + */ + private void forceNSDeclerations() { + for (String prefix : forcedDeclarations.keySet()) { + doPrefix(prefix, null, true); + } + } + + /** + * Internal initialization method. + * + * <p>All of the public constructors invoke this method.</p> + * + * @param writer The output destination, or null to use standard output. + */ + private void init(Writer writer) { + setOutput(writer); + nsSupport = new NamespaceSupport(); + prefixMap = new HashMap<String, String>(); + forcedDeclarations = new HashMap<String, Boolean>(); + doneDeclerations = new HashMap<String, String>(); + } + + /** + * Write a raw character. + * + * @param c The character to write. + * @throws org.xml.sax.SAXException If there is an error writing the character, this method will throw an + * IOException wrapped in a SAXException. + */ + private void write(char c) throws SAXException { + try { + output.write(c); + } catch (IOException e) { + throw new SAXException(e); + } + } + + /** + * Write a raw string. + * + * @param s + * @throws org.xml.sax.SAXException If there is an error writing the string, this method will throw an + * IOException wrapped in a SAXException + */ + private void write(String s) throws SAXException { + try { + output.write(s); + } catch (IOException e) { + throw new SAXException(e); + } + } + + /** + * Write out an attribute list, escaping values. The names will have prefixes added to them. + * + * @param atts The attribute list to write. + * @throws SAXException If there is an error writing the attribute list, this method will throw an IOException + * wrapped in a SAXException. + */ + private void writeAttributes(Attributes atts) throws SAXException { + int len = atts.getLength(); + for (int i = 0; i < len; i++) { + char[] ch = atts.getValue(i).toCharArray(); + write(' '); + writeName(atts.getURI(i), atts.getLocalName(i), atts.getQName(i), false); + write("=\""); + writeEsc(ch, 0, ch.length, true); + write('"'); + } + } + + /** + * Write an array of data characters with escaping. + * + * @param ch The array of characters. + * @param start The starting position. + * @param length The number of characters to use. + * @param isAttVal true if this is an attribute value literal. + * @throws SAXException If there is an error writing the characters, this method will throw an IOException wrapped + * in a SAXException. + */ + private void writeEsc(char[] ch, int start, int length, boolean isAttVal) throws SAXException { + for (int i = start; i < start + length; i++) { + switch (ch[i]) { + case '&': + write("&"); + break; + case '<': + write("<"); + break; + case '>': + write(">"); + break; + case '\"': + if (isAttVal) { + write("""); + } else { + write('\"'); + } + break; + default: +// if (ch[i] > '\u007f') { +// write("&#"); +// write(Integer.toString(ch[i])); +// write(';'); +// } else { + write(ch[i]); +// } + } + } + } + + /** + * Write an element or attribute name. + * + * @param uri The Namespace URI. + * @param localName The local name. + * @param qName The prefixed name, if available, or the empty string. + * @param isElement true if this is an element name, false if it is an attribute name. + * @throws org.xml.sax.SAXException This method will throw an IOException wrapped in a SAXException if there is + * an error writing the name. + */ + private void writeName(String uri, String localName, String qName, boolean isElement) throws SAXException { + String prefix = doPrefix(uri, qName, isElement); + if (prefix != null && StringUtils.EMPTY.equals(prefix) == false) { + write(prefix); + write(':'); + } + write(localName); + } + + /** + * Write out the list of Namespace declarations. + * + * @throws org.xml.sax.SAXException This method will throw an IOException wrapped in a SAXException if there is + * an error writing the Namespace declarations. + */ + private void writeNSDeclerations() throws SAXException { + @SuppressWarnings("unchecked") + // TODO キャスト安全性の根拠提示 + Enumeration<String> prefixes = nsSupport.getDeclaredPrefixes(); + while (prefixes.hasMoreElements()) { + String prefix = prefixes.nextElement(); + String uri = nsSupport.getURI(prefix); + if (uri == null) { + uri = StringUtils.EMPTY; + } + char[] ch = uri.toCharArray(); + write(' '); + if (StringUtils.EMPTY.equals(prefix)) { + write("xmlns=\""); + } else { + write("xmlns:"); + write(prefix); + write("=\""); + } + writeEsc(ch, 0, ch.length, true); + write('\"'); + } + } + +} Added: artemis/trunk/org.jiemamy.core/src/main/java/javanet/staxutils/IndentingXMLEventWriter.java =================================================================== --- artemis/trunk/org.jiemamy.core/src/main/java/javanet/staxutils/IndentingXMLEventWriter.java (rev 0) +++ artemis/trunk/org.jiemamy.core/src/main/java/javanet/staxutils/IndentingXMLEventWriter.java 2008-12-29 05:37:47 UTC (rev 2327) @@ -0,0 +1,540 @@ +/* $Id: IndentingXMLEventWriter.java,v 1.2 2004/06/24 22:06:11 kohsuke Exp $ +* +* Copyright (c) 2004, Sun Microsystems, Inc. +* All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions are +* met: +* +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* +* * Redistributions in binary form must reproduce the above +* copyright notice, this list of conditions and the following +* disclaimer in the documentation and/or other materials provided +* with the distribution. +* +* * Neither the name of Sun Microsystems, Inc. nor the names of its +* contributors may be used to endorse or promote products derived +* from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +*/ +package javanet.staxutils; + +import java.io.IOException; +import java.io.Writer; + +import javax.xml.namespace.NamespaceContext; +import javax.xml.namespace.QName; +import javax.xml.stream.Location; +import javax.xml.stream.XMLEventReader; +import javax.xml.stream.XMLEventWriter; +import javax.xml.stream.XMLStreamConstants; +import javax.xml.stream.XMLStreamException; +import javax.xml.stream.events.Characters; +import javax.xml.stream.events.EndElement; +import javax.xml.stream.events.StartElement; +import javax.xml.stream.events.XMLEvent; + +/** + * Wraps another {@link XMLEventWriter} and does the indentation. + * + * <p>CAUTION; オリジナルコードではなく、カスタマイズ済みです。</p> + * + * <p> + * {@link XMLEventWriter} API doesn't provide any portable way of + * doing pretty-printing. This {@link XMLEventWriter} filter provides + * a portable indentation support by wrapping another {@link XMLEventWriter} + * and adding proper {@link Characters} event for indentation. + * + * <p> + * Because whitespace handling in XML is tricky, this is not an + * one-size-fit-all indentation engine. Instead, this class is + * focused on handling so-called "data-oritented XML" like follows: + * + * <pre><xmp> + * <cards> + * <card id="kk.152"> + * <firstName>Kohsuke</firstName> + * <lastName>Kawaguchi</lastName> + * </card> + * </cards> + * </xmp></pre> + * + * <p> + * We'll discuss more about the supported subset of XML later. + * + * <p> + * To use this engine, do as follows: + * <pre> + * {@link XMLEventWriter} w = xmlOutputFactory.createXMLEventWriter(...); + * w = new {@link IndentingXMLEventWriter}(w); + * + * // start writing + * </pre> + * + * <p> + * Use {@link #setIndent(String)} and {@link #setNewLine(String)} to + * control the indentation if you want. + * + * + * <h2>What Subset Does This Support?</h2> + * <p> + * This engine works when the content model of each element is either + * element-only or #PCDATA (but not mixed content model.) IOW, it + * assumes that the children of any element is either (a) only elements + * and no #PCDATA or (b) #PCDATA only and no elements. + * + * <p> + * The engine also tries to handle comments, PIs, and a DOCTYPE decl, + * but in general it works only when those things appear in the + * element-only content model. + * + * + * <h2>For Maintainers</h2> + * <p> + * Please don't try to make this class into an almighty indentation class. + * I've seen it attempted in Xerces and it's not gonna be pretty. + * + * <p> + * If you come up with an idea of another pretty-printer + * that supports another subset, please go ahead and write your own class. + * + * + * + * @author + * Kohsuke Kawaguchi (kohsu****@sun*****) + */ +public class IndentingXMLEventWriter implements XMLEventWriter { + + private final XMLEventWriter core; + + /** + * String used for indentation. + */ + private String indent = " "; + + /** + * String for EOL. + */ + private String newLine; + + /** + * Current nest level. + */ + private int depth = 0; + + /** + * True if the current element has text. + */ + private boolean hasText; + + private int prevEventType; + + /** + * {@link XMLEvent} constant that returns the {@link #newLine}. + */ + private final Characters newLineEvent = new CharactersImpl() { + + public String getData() { + return newLine; + } + }; + + /** + * {@link XMLEvent} constant that returns the {@link #indent}. + */ + private final Characters indentEvent = new CharactersImpl() { + + public String getData() { + return indent; + } + }; + + + /** + * コンストラクタ。 + * @param core + * @category instance creation + */ + public IndentingXMLEventWriter(XMLEventWriter core) { + if (core == null) { + throw new IllegalArgumentException(); + } + this.core = core; + + // get the default line separator + try { + newLine = System.getProperty("line.separator"); + } catch (SecurityException e) { + // use '\n' if we can't figure it out + newLine = "\n"; + } + } + + /** + * {@inheritDoc} + */ + public void add(XMLEvent event) throws XMLStreamException { + switch (event.getEventType()) { + case XMLStreamConstants.CHARACTERS: + case XMLStreamConstants.CDATA: + case XMLStreamConstants.SPACE: + if (event.asCharacters().isWhiteSpace()) { + // skip any indentation given by the client + // we are running the risk of ignoring the non-ignorable + // significant whitespaces, but that's a risk explained + // in the class javadoc. + return; + } + + hasText = true; + core.add(event); + break; + + case XMLStreamConstants.START_ELEMENT: + newLine(); + core.add(event); + hasText = false; + depth++; + break; + + case XMLStreamConstants.END_ELEMENT: + depth--; + if (hasText == false && prevEventType != XMLStreamConstants.START_ELEMENT) { + newLine(); + } + core.add(event); + hasText = false; + break; + + case XMLStreamConstants.PROCESSING_INSTRUCTION: + case XMLStreamConstants.COMMENT: + case XMLStreamConstants.DTD: + // those things can be mixed with text, + // and at this point we don't know if text follows this + // like <foo><?pi?>text</foo> + // + // but we make a bold assumption that the those primitives + // only appear as a part of the element-only content model. + // so we always indent them as: + // <foo> + // <?pi?> + // ... + // </foo> + if (hasText == false && prevEventType != XMLStreamConstants.START_ELEMENT) { + // if we know that we already had a text, I see no + // reason to indent + newLine(); + } + core.add(event); + return; + + case XMLStreamConstants.END_DOCUMENT: + core.add(event); + // some implementation does the buffering by default, + // and it prevents the output from appearing. + // this has been a confusion for many people. + // calling flush wouldn't hurt decent impls, and it + // prevent such unnecessary confusion. + flush(); + break; + + default: + core.add(event); + break; + } + + prevEventType = event.getEventType(); + } + + /** + * {@inheritDoc} + */ + public void add(XMLEventReader reader) throws XMLStreamException { + // we can't just delegate to the core + // because we need to do indentation. + if (reader == null) { + throw new IllegalArgumentException(); + } + while (reader.hasNext()) { + add(reader.nextEvent()); + } + } + + /** + * {@inheritDoc} + */ + public void close() throws XMLStreamException { + core.close(); + } + + /** + * {@inheritDoc} + */ + public void flush() throws XMLStreamException { + core.flush(); + } + + /** + * Returns the string used for indentation. + * @return the string used for indentation + */ + public String getIndent() { + return indent; + } + + /** + * {@inheritDoc} + */ + public NamespaceContext getNamespaceContext() { + return core.getNamespaceContext(); + } + + /** + * Returns the string used for newline. + * @return the string used for newline + */ + public String getNewLine() { + return newLine; + } + + /** + * {@inheritDoc} + */ + public String getPrefix(String uri) throws XMLStreamException { + return core.getPrefix(uri); + } + + /** + * {@inheritDoc} + */ + public void setDefaultNamespace(String uri) throws XMLStreamException { + core.setDefaultNamespace(uri); + } + + /** + * Sets the string used for indentation. + * + * <p> + * By default, this is set to two space chars. + * + * @param indent + * A string like " ", "\\t". Must not be null. + */ + public void setIndent(String indent) { + if (indent == null) { + throw new IllegalArgumentException(); + } + this.indent = indent; + } + + /** + * {@inheritDoc} + */ + public void setNamespaceContext(NamespaceContext context) throws XMLStreamException { + core.setNamespaceContext(context); + } + + /** + * Sets the string used for newline. + * + * <p> + * By default, this is set to the platform default new line. + * + * @param newLine + * A string like "\\n" or "\\r\\n". Must not be null. + */ + public void setNewLine(String newLine) { + if (newLine == null) { + throw new IllegalArgumentException(); + } + this.newLine = newLine; + } + + /** + * {@inheritDoc} + */ + public void setPrefix(String prefix, String uri) throws XMLStreamException { + core.setPrefix(prefix, uri); + } + + /** + * Prints out a new line and indent. + * @throws XMLStreamException + */ + private void newLine() throws XMLStreamException { + core.add(newLineEvent); + for (int i = 0; i < depth; i++) { + core.add(indentEvent); + } + } + + + /** + * Partial implementation of {@link Characters} event. + */ + private abstract static class CharactersImpl implements Characters { + + /** + * {@inheritDoc} + */ + public Characters asCharacters() { + return this; + } + + /** + * {@inheritDoc} + */ + public EndElement asEndElement() { + return null; + } + + /** + * {@inheritDoc} + */ + public StartElement asStartElement() { + return null; + } + + /** + * {@inheritDoc} + */ + public int getEventType() { + // it's not clear if we are supposed to return SPACES + return XMLStreamConstants.CHARACTERS; + } + + /** + * {@inheritDoc} + */ + public Location getLocation() { + // spec isn't clear if we can return null, but it doesn't say we can't. + return null; + } + + /** + * {@inheritDoc} + */ + public QName getSchemaType() { + return null; + } + + /** + * {@inheritDoc} + */ + public boolean isAttribute() { + return false; + } + + /** + * {@inheritDoc} + */ + public boolean isCData() { + return false; + } + + /** + * {@inheritDoc} + */ + public boolean isCharacters() { + return true; + } + + /** + * {@inheritDoc} + */ + public boolean isEndDocument() { + return false; + } + + /** + * {@inheritDoc} + */ + public boolean isEndElement() { + return false; + } + + /** + * {@inheritDoc} + */ + public boolean isEntityReference() { + return false; + } + + /** + * {@inheritDoc} + */ + public boolean isIgnorableWhiteSpace() { + // this is hard call. On one hand, we want the indentation to + // get through whatever pipeline, so we are tempted to return false. + // also DTD isn't necessarily present. + // + // But on the other hand, this IS an ignorable whitespace + // in its intended meaning. + return true; + } + + /** + * {@inheritDoc} + */ + public boolean isNamespace() { + return false; + } + + /** + * {@inheritDoc} + */ + public boolean isProcessingInstruction() { + return false; + } + + /** + * {@inheritDoc} + */ + public boolean isStartDocument() { + return false; + } + + /** + * {@inheritDoc} + */ + public boolean isStartElement() { + return false; + } + + /** + * {@inheritDoc} + */ + public boolean isWhiteSpace() { + return true; + } + + /** + * {@inheritDoc} + */ + public void writeAsEncodedUnicode(Writer writer) throws XMLStreamException { + try { + // technically we need to do escaping, for we allow + // any characters to be used for indent and newLine. + // but in practice, who'll use something other than 0x20,0x0D,0x0A,0x08? + writer.write(getData()); + } catch (IOException e) { + throw new XMLStreamException(e); + } + } + + } +} Added: artemis/trunk/org.jiemamy.core/src/main/java/org/jiemamy/internal/serializer/stax/JiemamyCommandInputStreamImpl.java =================================================================== --- artemis/trunk/org.jiemamy.core/src/main/java/org/jiemamy/internal/serializer/stax/JiemamyCommandInputStreamImpl.java (rev 0) +++ artemis/trunk/org.jiemamy.core/src/main/java/org/jiemamy/internal/serializer/stax/JiemamyCommandInputStreamImpl.java 2008-12-29 05:37:47 UTC (rev 2327) @@ -0,0 +1,142 @@ +/* + * Copyright 2007-2008 MIYAMOTO Daisuke, jiemamy.org and the Others. + * Created on 2008/12/15 + * + * This file is part of Jiemamy. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, + * either express or implied. See the License for the specific language + * governing permissions and limitations under the License. + */ +package org.jiemamy.internal.serializer.stax; + +import java.util.Collection; +import java.util.NoSuchElementException; + +import org.apache.commons.lang.Validate; + +import org.jiemamy.command.CloseCommandImpl; +import org.jiemamy.command.EndElementCommandImpl; +import org.jiemamy.command.JiemamyCommand; +import org.jiemamy.command.JiemamyCommandInputStream; +import org.jiemamy.command.OpenCommandImpl; +import org.jiemamy.command.StartElementCommandImpl; +import org.jiemamy.internal.command.DialectCommand; +import org.jiemamy.internal.command.RootModelCommand; +import org.jiemamy.model.RootModel; +import org.jiemamy.utils.ResolvableQueue; + +/** + * {@link RootModel}の内容を{@link JiemamyCommand}として読み出す、Reader実装。 + * + * <p> + * </p> + * <ul> + * <li>{@link OpenCommandImpl}</li> + * <ul><li>{@link StartElementCommandImpl} of {@link RootModel}</li> + * <ul><li>{@link StartElementCommandImpl} of {@link String} (dialect)</li> + * <ul><li>{@link DialectCommand}</li></ul> + * <li>{@link EndElementCommandImpl} of {@link String} (dialect)</li> + * <li>...</li> + * <li>{@link StartElementCommandImpl} of {@link Collection} (domains)</li> + * <ul><li>...</li></ul> + * <li>{@link EndElementCommandImpl} of {@link Collection} (domains)</li> + * <li>{@link StartElementCommandImpl} of {@link Collection} (nodes)</li> + * <ul><li>...</li></ul> + * <li>{@link EndElementCommandImpl} of {@link Collection} (nodes)</li> + * <li>{@link StartElementCommandImpl} of {@link Collection} (connections)</li> + * <ul><li>...</li></ul> + * <li>{@link EndElementCommandImpl} of {@link Collection} (connections)</li> + * <li>{@link StartElementCommandImpl} of {@link Collection} (insertDataSetModels)</li> + * <ul><li>...</li></ul> + * <li>{@link EndElementCommandImpl} of {@link Collection} (insertDataSetModels)</li> + * <li>{@link StartElementCommandImpl} of {@link Collection} (view:diagramPresentations)</li> + * <ul><li>...</li></ul> + * <li>{@link EndElementCommandImpl} of {@link Collection} (view:diagramPresentations)</li> + * <li>...</li></ul> + * <li>{@link EndElementCommandImpl} of {@link RootModel}</li></ul> + * <li>{@link CloseCommandImpl}</li> + * </ul> + * + * @author daisuke + */ +public class JiemamyCommandInputStreamImpl implements JiemamyCommandInputStream { + + private RootModel rootModel; + + private ResolvableQueue<JiemamyCommand> queue = new ResolvableQueue<JiemamyCommand>(); + + private boolean closed; + + + /** + * コンストラクタ。 + * @param rootModel + * @throws IllegalArgumentException 引数に{@code null}を与えた場合 + * @category instance creation + */ + public JiemamyCommandInputStreamImpl(RootModel rootModel) { + Validate.notNull(rootModel); + this.rootModel = rootModel; + reset(); + } + + /** + * {@inheritDoc} + */ + public void close() { + checkClosed(); + closed = true; + } + + /** + * {@inheritDoc} + */ + public boolean hasNext() { + checkClosed(); + return queue.isEmpty() == false; + } + + /** + * {@inheritDoc} + */ + public JiemamyCommand nextCommand() { + checkClosed(); + checkNext(); + + return queue.dequeue(); + } + + /** + * ストリームをリセットして、最初から読み出せるようにする。 + * @throws UnsupportedOperationException + * @throws IllegalStateException Writerが既にcloseされていた場合 + */ + public void reset() { + checkClosed(); + queue.clear(); + queue.enqueue(new OpenCommandImpl()); + queue.enqueue(new RootModelCommand(rootModel)); + queue.enqueue(new CloseCommandImpl()); + } + + private void checkClosed() { + if (closed) { + throw new IllegalStateException("JiemamyCommandInputStream is already closed."); + } + } + + private void checkNext() { + if (hasNext() == false) { + throw new NoSuchElementException(); + } + } +} Added: artemis/trunk/org.jiemamy.core/src/main/java/org/jiemamy/internal/serializer/stax/JiemamyCommandOutputStreamImpl.java =================================================================== --- artemis/trunk/org.jiemamy.core/src/main/java/org/jiemamy/internal/serializer/stax/JiemamyCommandOutputStreamImpl.java (rev 0) +++ artemis/trunk/org.jiemamy.core/src/main/java/org/jiemamy/internal/serializer/stax/JiemamyCommandOutputStreamImpl.java 2008-12-29 05:37:47 UTC (rev 2327) @@ -0,0 +1,75 @@ +/* + * Copyright 2007-2008 MIYAMOTO Daisuke, jiemamy.org and the Others. + * Created on 2008/12/15 + * + * This file is part of Jiemamy. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, + * either express or implied. See the License for the specific language + * governing permissions and limitations under the License. + */ +package org.jiemamy.internal.serializer.stax; + +import org.jiemamy.command.JiemamyCommand; +import org.jiemamy.command.JiemamyCommandOutputStream; +import org.jiemamy.command.ObjectCommandDestination; +import org.jiemamy.exception.JiemamyCommandException; +import org.jiemamy.model.RootModel; + +/** + * {@link JiemamyCommand}の内容を{@link RootModel}に書き出す為の、Command stream実装クラス。 + * @author daisuke + */ +public class JiemamyCommandOutputStreamImpl implements JiemamyCommandOutputStream { + + private ObjectCommandDestination dest = new ObjectCommandDestination(); + + private boolean closed; + + + /** + * {@inheritDoc} + */ + public void close() { + checkClosed(); + closed = true; + } + + /** + * 書き出し結果の{@link RootModel}を取得する。 + * + * <p>OpenEventさえも書き込まれていない場合は、{@code null}を返す。</p> + * + * @return 書き出し結果 + * @throws IllegalStateException Writerがまだcloseされていない場合 + */ + public RootModel getRootModel() { + if (closed == false) { + throw new IllegalStateException("JiemamyCommandOutputStream is not closed yet."); + } + return dest.getRootModel(); + } + + /** + * {@inheritDoc} + */ + public void write(JiemamyCommand command) throws JiemamyCommandException { + checkClosed(); + dest.apply(command); + } + + private void checkClosed() { + if (closed) { + throw new IllegalStateException("JiemamyCommandOutputStream is already closed."); + } + } + +} Added: artemis/trunk/org.jiemamy.core/src/main/java/org/jiemamy/internal/serializer/stax/XmlEventReaderAdapter.java =================================================================== --- artemis/trunk/org.jiemamy.core/src/main/java/org/jiemamy/internal/serializer/stax/XmlEventReaderAdapter.java (rev 0) +++ artemis/trunk/org.jiemamy.core/src/main/java/org/jiemamy/internal/serializer/stax/XmlEventReaderAdapter.java 2008-12-29 05:37:47 UTC (rev 2327) @@ -0,0 +1,84 @@ +/* + * Copyright 2007-2008 MIYAMOTO Daisuke, jiemamy.org and the Others. + * Created on 2008/12/15 + * + * This file is part of Jiemamy. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, + * either express or implied. See the License for the specific language + * governing permissions and limitations under the License. + */ +package org.jiemamy.internal.serializer.stax; + +import javax.xml.stream.XMLEventReader; +import javax.xml.stream.XMLStreamException; +import javax.xml.stream.events.XMLEvent; + +import org.apache.commons.lang.Validate; + +import org.jiemamy.command.CommandSource; +import org.jiemamy.command.JiemamyCommand; +import org.jiemamy.command.JiemamyCommandInputStream; +import org.jiemamy.command.StaxCommandSource; +import org.jiemamy.exception.JiemamyCommandException; + +/** + * {@link XMLEventReader}を{@link JiemamyCommandInputStream}として扱うアダプタ。 + * @author daisuke + */ +public class XmlEventReaderAdapter implements JiemamyCommandInputStream { + + private XMLEventReader xmlEventReader; + + + /** + * コンストラクタ。 + * + * @param xmlEventReader readerの実体としての{@link XMLEventReader} + * @throws IllegalArgumentException 引数に{@code null}を与えた場合 + * @category instance creation + */ + public XmlEventReaderAdapter(XMLEventReader xmlEventReader) { + Validate.notNull(xmlEventReader); + this.xmlEventReader = xmlEventReader; + } + + /** + * {@inheritDoc} + */ + public void close() throws JiemamyCommandException { + try { + xmlEventReader.close(); + } catch (XMLStreamException e) { + throw new JiemamyCommandException(e); + } + } + + /** + * {@inheritDoc} + */ + public boolean hasNext() { + return xmlEventReader.hasNext(); + } + + /** + * {@inheritDoc} + */ + public JiemamyCommand nextCommand() throws JiemamyCommandException { + try { + XMLEvent xmlEvent = xmlEventReader.nextEvent(); + CommandSource source = new StaxCommandSource(xmlEvent); + return source.getCommand(); + } catch (XMLStreamException e) { + throw new JiemamyCommandException(e); + } + } +} Added: artemis/trunk/org.jiemamy.core/src/main/java/org/jiemamy/internal/serializer/stax/XmlEventWriterAdapter.java =================================================================== --- artemis/trunk/org.jiemamy.core/src/main/java/org/jiemamy/internal/serializer/stax/XmlEventWriterAdapter.java (rev 0) +++ artemis/trunk/org.jiemamy.core/src/main/java/org/jiemamy/internal/serializer/stax/XmlEventWriterAdapter.java 2008-12-29 05:37:47 UTC (rev 2327) @@ -0,0 +1,71 @@ +/* + * Copyright 2007-2008 MIYAMOTO Daisuke, jiemamy.org and the Others. + * Created on 2008/12/15 + * + * This file is part of Jiemamy. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, + * either express or implied. See the License for the specific language + * governing permissions and limitations under the License. + */ +package org.jiemamy.internal.serializer.stax; + +import javax.xml.stream.XMLEventWriter; +import javax.xml.stream.XMLStreamException; +import javax.xml.stream.XMLStreamWriter; + +import org.apache.commons.lang.Validate; + +import org.jiemamy.command.JiemamyCommand; +import org.jiemamy.command.JiemamyCommandOutputStream; +import org.jiemamy.command.StaxCommandDestination; +import org.jiemamy.exception.JiemamyCommandException; + +/** + * {@link XMLStreamWriter}を{@link JiemamyCommandOutputStream}として扱うアダプタ。 + * @author daisuke + */ +public class XmlEventWriterAdapter implements JiemamyCommandOutputStream { + + private StaxCommandDestination dest; + + + /** + * コンストラクタ。 + * @param eventWriter + * @throws IllegalArgumentException 引数に{@code null}を与えた場合 + * @category instance creation + */ + public XmlEventWriterAdapter(XMLEventWriter eventWriter) { + Validate.notNull(eventWriter); + dest = new StaxCommandDestination(eventWriter); + } + + /** + * {@inheritDoc} + */ + public void close() throws JiemamyCommandException { + try { + dest.getXmlWriter().close(); + } catch (XMLStreamException e) { + throw new JiemamyCommandException(e); + } + } + + /** + * {@inheritDoc} + */ + public void write(JiemamyCommand command) throws JiemamyCommandException { + Validate.notNull(command); + dest.apply(command); + } + +} Added: artemis/trunk/org.jiemamy.core/src/main/java/org/jiemamy/serializer/InvalidClassException.java =================================================================== --- artemis/trunk/org.jiemamy.core/src/main/java/org/jiemamy/serializer/InvalidClassException.java (rev 0) +++ artemis/trunk/org.jiemamy.core/src/main/java/org/jiemamy/serializer/InvalidClassException.java 2008-12-29 05:37:47 UTC (rev 2327) @@ -0,0 +1,67 @@ +/* + * Copyright 2007-2008 MIYAMOTO Daisuke, jiemamy.org and the Others. + * Created on 2008/12/01 + * + * This file is part of Jiemamy. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, + * either express or implied. See the License for the specific language + * governing permissions and limitations under the License. + */ +package org.jiemamy.serializer; + +import org.jiemamy.exception.JiemamyException; + +/** + * XMLモデルの class 属性に指定されたクラスがおかしい場合。 + * TODO 命名検討 + * @author daisuke + */ + @ SuppressWarnings("serial") +public class InvalidClassException extends JiemamyException { + + /** + * コンストラクタ。 + * @category instance creation + */ + public InvalidClassException() { + super(); + } + + /** + * コンストラクタ。 + * @param message + * @category instance creation + */ + public InvalidClassException(String message) { + super(message); + } + + /** + * コンストラクタ。 + * @param message + * @param cause + * @category instance creation + */ + public InvalidClassException(String message, Throwable cause) { + super(message, cause); + } + + /** + * コンストラクタ。 + * @param cause + * @category instance creation + */ + public InvalidClassException(Throwable cause) { + super(cause); + } + +} Added: artemis/trunk/org.jiemamy.core/src/main/java/org/jiemamy/serializer/JiemamyStaxSerializer.java =================================================================== --- artemis/trunk/org.jiemamy.core/src/main/java/org/jiemamy/serializer/JiemamyStaxSerializer.java (rev 0) +++ artemis/trunk/org.jiemamy.core/src/main/java/org/jiemamy/serializer/JiemamyStaxSerializer.java 2008-12-29 05:37:47 UTC (rev 2327) @@ -0,0 +1,141 @@ +/* + * Copyright 2007-2008 MIYAMOTO Daisuke, jiemamy.org and the Others. + * Created on 2008/12/12 + * + * This file is part of Jiemamy. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, + * either express or implied. See the License for the specific language + * governing permissions and limitations under the License. + */ +package org.jiemamy.serializer; + +import java.io.InputStream; +import java.io.OutputStream; + +import javanet.staxutils.IndentingXMLEventWriter; + +import javax.xml.stream.EventFilter; +import javax.xml.stream.XMLEventReader; +import javax.xml.stream.XMLEventWriter; +import javax.xml.stream.XMLInputFactory; +import javax.xml.stream.XMLOutputFactory; +import javax.xml.stream.XMLStreamException; +import javax.xml.stream.events.XMLEvent; + +import org.apache.commons.lang.CharUtils; +import org.apache.commons.lang.Validate; + +import org.jiemamy.command.JiemamyCommandInputStream; +import org.jiemamy.command.JiemamyCommandOutputStream; +import org.jiemamy.exception.JiemamyCommandException; +import org.jiemamy.exception.SerializationException; +import org.jiemamy.internal.serializer.stax.JiemamyCommandInputStreamImpl; +import org.jiemamy.internal.serializer.stax.JiemamyCommandOutputStreamImpl; +import org.jiemamy.internal.serializer.stax.XmlEventReaderAdapter; +import org.jiemamy.internal.serializer.stax.XmlEventWriterAdapter; +import org.jiemamy.model.RootModel; + +/** + * シリアライザのStAXによる実装。 + * @author daisuke + */ +public class JiemamyStaxSerializer implements JiemamySerializer { + + /** + * Copy models from a {@link JiemamyCommandException} to a {@link JiemamyCommandOutputStream}. And close both. + * + * @param input resource which send models + * @param output resource which recieve models + * @throws SerializationException + */ + private static void copyAndClose(JiemamyCommandInputStream input, JiemamyCommandOutputStream output) + throws SerializationException { + try { + while (input.hasNext()) { + output.write(input.nextCommand()); + } + } catch (JiemamyCommandException e) { + throw new SerializationException(e); + } finally { + if (input != null) { + try { + input.close(); + } catch (JiemamyCommandException e) { + // ignore + } + } + if (output != null) { + try { + output.close(); + } catch (JiemamyCommandException e) { + // ignore + } + } + } + } + + /** + * {@inheritDoc} + */ + public RootModel deserialize(InputStream in) throws SerializationException { + Validate.notNull(in); + + RootModel result; + try { + XMLInputFactory factory = XMLInputFactory.newInstance(); + factory.setProperty(XMLInputFactory.IS_NAMESPACE_AWARE, true); +// XMLEventReader xmlEventReader = factory.createXMLEventReader(in); + XMLEventReader xmlEventReader = + factory.createFilteredReader(factory.createXMLEventReader(in), new EventFilter() { + + public boolean accept(XMLEvent event) { + if (event.isCharacters() && event.asCharacters().isWhiteSpace()) { + return false; + } + return true; + } + + }); + JiemamyCommandInputStream input = new XmlEventReaderAdapter(xmlEventReader); + JiemamyCommandOutputStream output = new JiemamyCommandOutputStreamImpl(); + + copyAndClose(input, output); + result = ((JiemamyCommandOutputStreamImpl) output).getRootModel(); + } catch (XMLStreamException e) { + throw new SerializationException(e); + } + + return result; + } + + /** + * {@inheritDoc} + */ + public void serialize(RootModel rootModel, OutputStream out) throws SerializationException { + Validate.notNull(rootModel); + Validate.notNull(out); + + try { + XMLOutputFactory factory = XMLOutputFactory.newInstance(); + factory.setProperty(XMLOutputFactory.IS_REPAIRING_NAMESPACES, true); + XMLEventWriter writer = factory.createXMLEventWriter(out); + IndentingXMLEventWriter indentingWriter = new IndentingXMLEventWriter(writer); + indentingWriter.setNewLine(String.valueOf(CharUtils.LF)); + JiemamyCommandOutputStream input = new XmlEventWriterAdapter(indentingWriter); + JiemamyCommandInputStream output = new JiemamyCommandInputStreamImpl(rootModel); + + copyAndClose(output, input); + } catch (XMLStreamException e) { + throw new SerializationException(e); + } + } +} Added: artemis/trunk/org.jiemamy.core/src/test/java/com/megginson/sax/DataWriterTest.java =================================================================== --- artemis/trunk/org.jiemamy.core/src/test/java/com/megginson/sax/DataWriterTest.java (rev 0) +++ artemis/trunk/org.jiemamy.core/src/test/java/com/megginson/sax/DataWriterTest.java 2008-12-29 05:37:47 UTC (rev 2327) @@ -0,0 +1,77 @@ +/* + * Copyright 2007-2008 MIYAMOTO Daisuke, jiemamy.org and the Others. + * Created on 2008/10/22 + * + * 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 com.megginson.sax; + +import static org.junit.Assert.assertEquals; + +import java.io.StringWriter; + +import org.apache.commons.lang.text.StrBuilder; +import org.junit.Test; + +/** + * {@link DataWriter}用のテストクラス。 + * @author daisuke + */ +public class DataWriterTest { + + /** + * 各出力メソッドの動作とインデントを検証する + * @throws Exception + */ + @Test + public void test01_各出力メソッドの動作とインデントを検証する() throws Exception { + StringWriter sw = new StringWriter(); + DataWriter w = new DataWriter(sw); + + w.setIndentStep(2); + w.startDocument(); + w.startElement("foo"); + w.dataElement("bar", "1"); + w.dataElement("bar", "2"); + w.startElement("baz"); + w.dataElement("qux", "3"); + w.startElement("corge"); + w.characters("4"); + w.endElement("corge"); + w.dataElement("grault", ""); + w.emptyElement("garply"); + w.endElement("baz"); + w.dataElement("bar", "5"); + w.endElement("foo"); + w.endDocument(); + + StrBuilder sb = new StrBuilder(); + sb.appendln("<?xml version=\"1.0\"?>"); + sb.appendln("<foo>"); + sb.appendln(" <bar>1</bar>"); + sb.appendln(" <bar>2</bar>"); + sb.appendln(" <baz>"); + sb.appendln(" <qux>3</qux>"); + sb.appendln(" <corge>4</corge>"); + sb.appendln(" <grault></grault>"); + sb.appendln(" <garply/>"); + sb.appendln(" </baz>"); + sb.appendln(" <bar>5</bar>"); + sb.appendln("</foo>"); + sb.appendln(""); + + assertEquals(sb.toString(), sw.toString()); + } +} Added: artemis/trunk/org.jiemamy.core/src/test/java/org/jiemamy/internal/serializer/stax/JiemamyCommandInputStreamTest.java =================================================================== --- artemis/trunk/org.jiemamy.core/src/test/java/org/jiemamy/internal/serializer/stax/JiemamyCommandInputStreamTest.java (rev 0) +++ artemis/trunk/org.jiemamy.core/src/test/java/org/jiemamy/internal/serializer/stax/JiemamyCommandInputStreamTest.java 2008-12-29 05:37:47 UTC (rev 2327) @@ -0,0 +1,167 @@ +package org.jiemamy.internal.serializer.stax; + +import static org.hamcrest.CoreMatchers.instanceOf; +import static org.junit.Assert.assertThat; + +import java.io.InputStream; +import java.util.List; + +import javax.xml.stream.EventFilter; +import javax.xml.stream.XMLEventReader; +import javax.xml.stream.XMLInputFactory; +import javax.xml.stream.events.XMLEvent; + +import org.apache.commons.lang.ClassUtils; +import org.junit.After; +import org.junit.Before; +import org.junit.Test; +import org.seasar.framework.util.tiger.CollectionsUtil; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import org.jiemamy.Artemis; +import org.jiemamy.command.CloseCommand; +import org.jiemamy.command.DataCommand; +import org.jiemamy.command.EndElementCommand; +import org.jiemamy.command.JiemamyCommand; +import org.jiemamy.command.JiemamyCommandInputStream; +import org.jiemamy.command.OpenCommand; +import org.jiemamy.command.StartElementCommand; +import org.jiemamy.exception.JiemamyCommandException; +import org.jiemamy.model.Jiemamy; +import org.jiemamy.model.RootModel; + +/** + * {@link JiemamyCommandInputStreamImpl}のテストクラス。 + * @author daisuke + */ +public class JiemamyCommandInputStreamTest { + + private static Logger logger = LoggerFactory.getLogger(JiemamyCommandInputStreamTest.class); + + + /** + * setup + * @throws java.lang.Exception + */ + @Before + public void setUp() throws Exception { + Jiemamy.init(new Artemis()); + } + + /** + * teardown + * @throws java.lang.Exception + */ + @After + public void tearDown() throws Exception { + Jiemamy.dispose(); + } + + /** + * Read command stream from {@link RootModel} + * @throws Exception + */ + @Test + public void test01_fromRootModel() throws Exception { + RootModel rootModel = Jiemamy.newRootModel(); + JiemamyCommandInputStream stream = new JiemamyCommandInputStreamImpl(rootModel); + + List<Class<?>> expectedClasses = CollectionsUtil.newArrayList(); + { + expectedClasses.add(OpenCommand.class); + expectedClasses.add(StartElementCommand.class); + expectedClasses.add(StartElementCommand.class); + expectedClasses.add(DataCommand.class); + expectedClasses.add(EndElementCommand.class); + expectedClasses.add(EndElementCommand.class); + expectedClasses.add(CloseCommand.class); + } + + List<JiemamyCommand> actual = asList(stream); + + int index = 0; + for (Class<?> expectedClass : expectedClasses) { + logger.info("expected" + index + " is " + expectedClass); + logger.info("actual " + index + " is " + actual.get(index).getClass()); + assertThat("error index=" + index, actual.get(index), instanceOf(expectedClass)); + index++; + } + + stream.close(); + } + + /** + * Read command stream from XML + * @throws Exception + */ + @Test + public void test02_fromXmlModel() throws Exception { + InputStream in = JiemamyCommandInputStreamTest.class.getResourceAsStream("/minimal.jiemamy-core.xml"); + + XMLInputFactory factory = XMLInputFactory.newInstance(); + factory.setProperty(XMLInputFactory.IS_NAMESPACE_AWARE, true); + XMLEventReader xmlEventReader = + factory.createFilteredReader(factory.createXMLEventReader(in), new EventFilter() { + + public boolean accept(XMLEvent event) { + if (event.isCharacters() && event.asCharacters().isWhiteSpace()) { + return false; + } + return true; + } + + }); + JiemamyCommandInputStream stream = new XmlEventReaderAdapter(xmlEventReader); + + List<Class<? extends JiemamyCommand>> expectedClasses = CollectionsUtil.newArrayList(); + { + // <?xml version='1.0' encoding='UTF-8'?> + expectedClasses.add(OpenCommand.class); + + // <rootModel xmlns="http://jiemamy.org/xml/ns/core" id="ffffffff-ffff-ffff-ffff-ffffffffffff"> + expectedClasses.add(StartElementCommand.class); + + // <dialect> + expectedClasses.add(StartElementCommand.class); + + // com.example.HogeDialect + expectedClasses.add(DataCommand.class); + + // </dialect> + expectedClasses.add(EndElementCommand.class); + + // </rootModel> + expectedClasses.add(EndElementCommand.class); + expectedClasses.add(CloseCommand.class); + } + + List<JiemamyCommand> actual = asList(stream); + + int index = 0; + for (Class<? extends JiemamyCommand> expectedClass : expectedClasses) { + logger.info("expected" + index + " is " + expectedClass); + logger.info("actual " + index + " is " + actual.get(index).getClass()); + assertThat("error index=" + index, actual.get(index), instanceOf(expectedClass)); + index++; + } + + stream.close(); + } + + /** + * streamの内容を {@link List} として取得する。 + * @param stream + * @return コマンドストリームのリスト + * @throws JiemamyCommandException 読み出しに失敗した場合 + */ + private List<JiemamyCommand> asList(JiemamyCommandInputStream stream) throws JiemamyCommandException { + List<JiemamyCommand> result = CollectionsUtil.newArrayList(); + while (stream.hasNext()) { + JiemamyCommand command = stream.nextCommand(); + logger.info(ClassUtils.getShortClassName(command, "null")); + result.add(command); + } + return result; + } +} Added: artemis/trunk/org.jiemamy.core/src/test/java/org/jiemamy/internal/serializer/stax/JiemamyCommandOutputStreamTest.java =================================================================== --- artemis/trunk/org.jiemamy.core/src/test/java/org/jiemamy/internal/serializer/stax/JiemamyCommandOutputStreamTest.java (rev 0) +++ artemis/trunk/org.jiemamy.core/src/test/java/org/jiemamy/internal/serializer/stax/JiemamyCommandOutputStreamTest.java 2008-12-29 05:37:47 UTC (rev 2327) @@ -0,0 +1,142 @@ +/* + * Copyright 2007-2008 MIYAMOTO Daisuke, jiemamy.org and the Others. + * Created on 2008/12/17 + * + * 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.internal.serializer.stax; + +import static org.hamcrest.CoreMatchers.is; +import static org.hamcrest.CoreMatchers.notNullValue; +import static org.junit.Assert.assertThat; + +import java.io.ByteArrayOutputStream; +import java.util.HashMap; +import java.util.Map; + +import javanet.staxutils.IndentingXMLEventWriter; + +import javax.xml.namespace.QName; +import javax.xml.stream.XMLEventWriter; +import javax.xml.stream.XMLOutputFactory; + +import org.apache.commons.lang.CharEncoding; +import org.apache.commons.lang.CharUtils; +import org.junit.After; +import org.junit.Before; +import org.junit.Test; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import org.jiemamy.Artemis; +import org.jiemamy.command.CloseCommandImpl; +import org.jiemamy.command.DataCommandImpl; +import org.jiemamy.command.EndElementCommandImpl; +import org.jiemamy.command.JiemamyCommandOutputStream; +import org.jiemamy.command.OpenCommandImpl; +import org.jiemamy.command.StartElementCommandImpl; +import org.jiemamy.exception.JiemamyCommandException; +import org.jiemamy.model.Jiemamy; +import org.jiemamy.model.RootModel; +import org.jiemamy.xml.Nodes; + +/** + * {@link JiemamyCommandInputStreamImpl}のテストクラス。 + * @author daisuke + */ +public class JiemamyCommandOutputStreamTest { + + private static final String DIALECT_ID = "com.example.HogeDialect"; + + private static Logger logger = LoggerFactory.getLogger(JiemamyCommandOutputStreamTest.class); + + + /** + * setup + * @throws java.lang.Exception + */ + @Before + public void setUp() throws Exception { + Jiemamy.init(new Artemis()); + } + + /** + * teardown + * @throws java.lang.Exception + */ + @After + public void tearDown() throws Exception { + Jiemamy.dispose(); + } + + /** + * Write command stream to {@link RootModel} + * @throws Exception + */ + @Test + public void test01_toRootModel() throws Exception { + JiemamyCommandOutputStream stream = new JiemamyCommandOutputStreamImpl(); + + writeTestDataTo(stream); + + stream.close(); + + RootModel rootModel = ((JiemamyCommandOutputStreamImpl) stream).getRootModel(); + assertThat(rootModel, is(notNullValue())); + logger.info(rootModel.toString()); + assertThat(rootModel.getDialectId(), is(DIALECT_ID)); + } + + /** + * Write command stream to XML + * @throws Exception + */ + @Test + public void test02_toXmlModel() throws Exception { + ByteArrayOutputStream out = new ByteArrayOutputStream(); + + XMLOutputFactory factory = XMLOutputFactory.newInstance(); + factory.setProperty(XMLOutputFactory.IS_REPAIRING_NAMESPACES, true); + XMLEventWriter writer = factory.createXMLEventWriter(out); + IndentingXMLEventWriter indentingWriter = new IndentingXMLEventWriter(writer); + indentingWriter.setNewLine(String.valueOf(CharUtils.LF)); + JiemamyCommandOutputStream stream = new XmlEventWriterAdapter(indentingWriter); + + writeTestDataTo(stream); + + stream.close(); + String result = out.toString(CharEncoding.UTF_8); + + logger.info(result); + } + + /** + * テスト用 command stream を書き込む。 + * @param stream 書き込み先 + * @throws JiemamyCommandException 書き込みに失敗した場合 + */ + private void writeTestDataTo(JiemamyCommandOutputStream stream) throws JiemamyCommandException { + Map<QName, String> attributes = new HashMap<QName, String>(); + attributes.put(new QName("id"), "ffffffff-ffff-ffff-ffff-ffffffffffff"); + + stream.write(new OpenCommandImpl()); + stream.write(new StartElementCommandImpl(Nodes.ROOT_MODEL, attributes)); + stream.write(new StartElementCommandImpl(Nodes.DIALECT)); + stream.write(new DataCommandImpl(DIALECT_ID)); + stream.write(new EndElementCommandImpl(Nodes.DIALECT)); + stream.write(new EndElementCommandImpl(Nodes.ROOT_MODEL)); + stream.write(new CloseCommandImpl()); + } +} Added: artemis/trunk/org.jiemamy.core/src/test/java/org/jiemamy/internal/serializer/stax/StaxTest.java =================================================================== --- artemis/trunk/org.jiemamy.core/src/test/java/org/jiemamy/internal/serializer/stax/StaxTest.java (rev 0) +++ artemis/trunk/org.jiemamy.core/src/test/java/org/jiemamy/internal/serializer/stax/StaxTest.java 2008-12-29 05:37:47 UTC (rev 2327) @@ -0,0 +1,114 @@ +/* + * Copyright 2007-2008 MIYAMOTO Daisuke, jiemamy.org and the Others. + * Created on 2008/12/16 + * + * 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.internal.serializer.stax; + +import java.io.InputStream; +import java.io.StringWriter; + +import javanet.staxutils.IndentingXMLEventWriter; + +import javax.xml.namespace.QName; +import javax.xml.stream.XMLEventFactory; +import javax.xml.stream.XMLEventReader; +import javax.xml.stream.XMLEventWriter; +import javax.xml.stream.XMLInputFactory; +import javax.xml.stream.XMLOutputFactory; +import javax.xml.stream.events.Attribute; +import javax.xml.stream.events.EndElement; +import javax.xml.stream.events.StartElement; +import javax.xml.stream.events.XMLEvent; + +import com.bea.xml.stream.EventFactory; + +import org.codehaus.stax2.XMLInputFactory2; +import org.codehaus.stax2.XMLOutputFactory2; +import org.junit.Test; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import org.jiemamy.serializer.SerializationTest; +import org.jiemamy.utils.StaxUtil; + +/** + * StAXの動作確認用テストクラス。assertionは特に行っていない。 + * @author daisuke + */ +public class StaxTest { + + private static Logger logger = LoggerFactory.getLogger(StaxTest.class); + + + /** + * Write by StAX + * @throws Exception + */ + @Test + public void test01_writeByStAX() throws Exception { + StringWriter stringWriter = new StringWriter(); + XMLOutputFactory outFactory = XMLOutputFactory2.newInstance(); + XMLEventWriter writer = outFactory.createXMLEventWriter(stringWriter); + IndentingXMLEventWriter indentingWriter = new IndentingXMLEventWriter(writer); + indentingWriter.setNewLine("\n"); + writer = indentingWriter; + + XMLEventFactory eventFactory = EventFactory.newInstance(); + + writer.add(eventFactory.createStartDocument()); + writer.add(eventFactory.createStartElement("", "", "foo")); + writer.add(eventFactory.createStartElement("", "", "bar")); + writer.add(eventFactory.createAttribute("prefix", "uri", "localName", "piyo")); + writer.add(eventFactory.createCharacters("value")); + writer.add(eventFactory.createEndElement("", "", "bar")); + writer.add(eventFactory.createStartElement("", "", "bar")); + writer.add(eventFactory.createEndElement("", "", "bar")); + writer.add(eventFactory.createEndElement("", "", "foo")); + writer.add(eventFactory.createEndDocument()); + writer.close(); + + logger.info(stringWriter.toString()); + } + + /** + * Read by StAX + * @throws Exception + */ + @Test + public void test02_readByStAX() throws Exception { + InputStream in = SerializationTest.class.getResourceAsStream("/minimal.xml"); + XMLInputFactory inFactory = XMLInputFactory2.newInstance(); + inFactory.setProperty(XMLInputFactory.IS_NAMESPACE_AWARE, true); + XMLEventReader reader = inFactory.createXMLEventReader(in); + + while (reader.hasNext()) { + XMLEvent event = reader.nextEvent(); + if (event.isStartElement()) { + StartElement startElement = event.asStartElement(); + logger.info(StaxUtil.toEventTypeEnum(event.getEventType()) + ": " + startElement.getName().toString()); + Attribute id = startElement.getAttributeByName(new QName("id")); + if (id != null) { + logger.info("id=" + id.getValue()); + } + } else if (event.isEndElement()) { + EndElement endElement = event.asEndElement(); + logger.info(StaxUtil.toEventTypeEnum(event.getEventType()) + ": " + endElement.getName().toString()); + } + } + reader.close(); + } +} Added: artemis/trunk/org.jiemamy.core/src/test/java/org/jiemamy/serializer/SerializationTest.java =================================================================== --- artemis/trunk/org.jiemamy.core/src/test/java/org/jiemamy/serializer/SerializationTest.java (rev 0) +++ artemis/trunk/org.jiemamy.core/src/test/java/org/jiemamy/serializer/SerializationTest.java 2008-12-29 05:37:47 UTC (rev 2327) @@ -0,0 +1,244 @@ +/* + * Copyright 2007-2008 MIYAMOTO Daisuke, jiemamy.org and the Others. + * Created on 2008/06/09 + * + * This file is part of Jiemamy. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, + * either express or implied. See the License for the specific language + * governing permissions and limitations under the License. + */ +package org.jiemamy.serializer; + +import static org.hamcrest.CoreMatchers.is; +import static org.hamcrest.CoreMatchers.notNullValue; +import static org.junit.Assert.assertThat; +import static org.junit.Assert.assertTrue; + +import java.io.BufferedReader; +import java.io.ByteArrayOutputStream; +import java.io.IOException; +import java.io.InputStream; +import java.io.InputStreamReader; +import java.io.PipedInputStream; +import java.io.PipedOutputStream; +import java.util.Collection; +import java.util.List; + +import org.apache.commons.io.IOUtils; +import org.apache.commons.lang.CharEncoding; +import org.apache.commons.lang.builder.ToStringBuilder; +import org.apache.commons.lang.builder.ToStringStyle; +import org.junit.After; +import org.junit.Before; +import org.junit.Ignore; +import org.junit.Test; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import org.jiemamy.Artemis; +import org.jiemamy.model.Jiemamy; +import org.jiemamy.model.RootModel; +import org.jiemamy.model.attribute.ColumnModel; +import org.jiemamy.model.connection.AbstractConnectionModel; +import org.jiemamy.model.datatype.DomainModel; +import org.jiemamy.model.node.StickyModel; +import org.jiemamy.model.node.TableModel; +import org.jiemamy.model.node.ViewModel; + +/** + * モデルのシリアライズ全体のテスト。 + * コードで作ったモデル -(serialize)-> XML -(deserialize-> 復元モデルを比較して同一性をチェックする。 + * @author daisuke + */ +public class SerializationTest { + + private static Logger logger = LoggerFactory.getLogger(SerializationTest.class); + + /** JiemamySerializer */ + private JiemamySerializer jiemamySerializer; + + + /** + * setup + * @throws Exception + */ + @Before + public void setUp() throws Exception { + Jiemamy.init(new Artemis(/* FIXME new ArtemisView()*/)); + jiemamySerializer = new JiemamyStaxSerializer(); + } + + /** + * teardown + * @throws Exception + */ + @After + public void tearDown() throws Exception { + jiemamySerializer = null; + Jiemamy.dispose(); + } + + /** + * test + * @throws Exception + */ + @Test + public void test01_とりあえず書き込んでみる() throws Exception { + ByteArrayOutputStream out = null; + RootModel rootModel = Jiemamy.newRootModel();// new ApplicationModelCreator().createModel(); + + try { + out = new ByteArrayOutputStream(); + jiemamySerializer.serialize(rootModel, out); + logger.info(out.toString(CharEncoding.UTF_8)); + } finally { + IOUtils.closeQuietly(out); + } + } + + /** + * test + * @throws Exception + */ + @Test + public void test02_とりあえず読み込んでみる() throws Exception { + InputStream in = null; + RootModel rootModel; + try { + in = SerializationTest.class.getResourceAsStream("/sample.xml"); + rootModel = jiemamySerializer.deserialize(in); + } finally { + IOUtils.closeQuietly(in); + } + + assertThat(rootModel, is(notNullValue())); + + logger.info("RootModel(Id):" + rootModel.getId()); + assertThat(rootModel.getId().toString(), is("d5a96af3-b1e9-4285-a8ef-c491ce5ae308")); + + logger.info("RootModel(Dialect):" + rootModel.getDialectId()); + assertThat(rootModel.getDialectId(), is("org.jiemamy.dialect.mysql.MySqlDialect")); + + logger.info("RootModel(BeginScript):" + rootModel.getBeginScript()); + logger.info("RootModel(EndScript):" + rootModel.getEndScript()); + logger.info("RootModel(Description):" + rootModel.getDescription()); + logger.info("RootModel(SchemaName):" + rootModel.getSchemaName()); + + logger.info("***Domain"); + List<DomainModel> domains = rootModel.getDomains(); + for (DomainModel domain : domains) { + logger.info(" " + ToStringBuilder.reflectionToString(domain)); + } + + logger.info("***Table"); + Collection<TableModel> tables = rootModel.getNodes(TableModel.class); + for (TableModel table : tables) { + logger.info(" Table:" + table.getId() + "," + table.getName() + "," + table.getLogicalName() + "," + + table.getDescription()); + + for (ColumnModel column : table.getColumns()) { + logger.info(" " + column); + } + } + + logger.info("***View"); + Collection<ViewModel> views = rootModel.getNodes(ViewModel.class); + for (ViewModel view : views) { + logger.info(" View:" + view); + } + + logger.info("***Sticky"); + Collection<StickyModel> stickies = rootModel.getNodes(StickyModel.class); + for (StickyModel sticky : stickies) { + logger.info(" Sticky:" + sticky); + } + + logger.info("***Connection"); + Collection<AbstractConnectionModel> connections = rootModel.getConnections(); + for (AbstractConnectionModel conn : connections) { + logger.info(" Connection:" + conn); + } + } + + /** + * シリアライザの動作チェック。 + * @throws Exception + */ + @Test + @Ignore + public void test03_シリアライザの動作チェック() throws Exception { + RootModel rootModel = Jiemamy.newRootModel();//new ApplicationModelCreator().createModel(); + + PipedInputStream serializeIn1 = null; + PipedInputStream serializeIn2 = null; + InputStream referenceIn1 = null; + InputStream referenceIn2 = null; + InputStream referenceIn3 = null; + PipedOutputStream out1 = null; + PipedOutputStream out2 = null; + + try { + // とりあえず表示 + serializeIn1 = new PipedInputStream(); + out1 = new PipedOutputStream(serializeIn1); + jiemamySerializer.serialize(rootModel, out1); + + logger.info("serialized=");// + IOUtils.toString(serializeIs1)); + print(serializeIn1); + referenceIn1 = SerializationTest.class.getResourceAsStream("/sample.xml"); + logger.info("reference=");// + IOUtils.toString(referenceIs1)); + print(referenceIn1); + + // シリアライズ結果と参照ファイルの同一性試験 + serializeIn2 = new PipedInputStream(); + out2 = new PipedOutputStream(serializeIn2); + referenceIn2 = SerializationTest.class.getResourceAsStream("/sample.xml"); + jiemamySerializer.serialize(rootModel, out2); +// assertTrue(IOUtils.contentEquals(serializeIs2, referenceIs2)); + + // this.rootModel と deserialized の同一性試験 + referenceIn3 = SerializationTest.class.getResourceAsStream("/sample.xml"); + RootModel deserialized = jiemamySerializer.deserialize(referenceIn3); + + logger.info("======== ORIGINAL"); + logger.info(ToStringBuilder.reflectionToString(rootModel, ToStringStyle.SHORT_PREFIX_STYLE)); + logger.info("======== DESERIALIZED"); + logger.info(ToStringBuilder.reflectionToString(deserialized, ToStringStyle.SHORT_PREFIX_STYLE)); + + // TODO [CORE-22] モデルに関するequalsを実装する。 + assertTrue(ToStringBuilder.reflectionToString(rootModel, ToStringStyle.SHORT_PREFIX_STYLE).equals( + ToStringBuilder.reflectionToString(deserialized, ToStringStyle.SHORT_PREFIX_STYLE))); + } finally { + IOUtils.closeQuietly(serializeIn1); + IOUtils.closeQuietly(serializeIn2); + IOUtils.closeQuietly(referenceIn1); + IOUtils.closeQuietly(referenceIn2); + IOUtils.closeQuietly(referenceIn3); + IOUtils.closeQuietly(out1); + IOUtils.closeQuietly(out2); + } + } + + /** + * {@link InputStream}の内容をlog出力する。 + * @param in + * @throws IOException + */ + private void print(InputStream in) throws IOException { + final BufferedReader reader = new BufferedReader(new InputStreamReader(in)); + String buf; + while ((buf = reader.readLine()) != null) { + logger.info(buf); + } + } + +} Added: artemis/trunk/org.jiemamy.core/src/test/resources/minimal.jiemamy-core.xml =================================================================== --- artemis/trunk/org.jiemamy.core/src/test/resources/minimal.jiemamy-core.xml (rev 0) +++ artemis/trunk/org.jiemamy.core/src/test/resources/minimal.jiemamy-core.xml 2008-12-29 05:37:47 UTC (rev 2327) @@ -0,0 +1,4 @@ +<?xml version='1.0' encoding='UTF-8'?> +<rootModel xmlns="http://jiemamy.org/xml/ns/core" id="ffffffff-ffff-ffff-ffff-ffffffffffff"> + <dialect>com.example.HogeDialect</dialect> +</rootModel> Added: artemis/trunk/org.jiemamy.core/src/test/resources/minimal.xml =================================================================== --- artemis/trunk/org.jiemamy.core/src/test/resources/minimal.xml (rev 0) +++ artemis/trunk/org.jiemamy.core/src/test/resources/minimal.xml 2008-12-29 05:37:47 UTC (rev 2327) @@ -0,0 +1,5 @@ +<?xml version="1.0" encoding="utf-8" ?> +<foo xmlns:prefix="uri_prifix" xmlns="uri_anon"> + <bar prefix:localName="piyo">value</bar> + <bar /> +</foo> \ No newline at end of file Added: artemis/trunk/org.jiemamy.core/src/test/resources/sample.xml =================================================================== --- artemis/trunk/org.jiemamy.core/src/test/resources/sample.xml (rev 0) +++ artemis/trunk/org.jiemamy.core/src/test/resources/sample.xml 2008-12-29 05:37:47 UTC (rev 2327) @@ -0,0 +1,493 @@ +<?xml version="1.0"?> +<rootModel id="d5a96af3-b1e9-4285-a8ef-c491ce5ae308" + xmlns="http://jiemamy.org/xml/ns/core" + xmlns:view="http://jiemamy.org/xml/ns/view" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation= + "http://jiemamy.org/xml/ns/core ../../../../org.jiemamy.core/src/main/resources/jiemamy-core.xsd + http://jiemamy.org/xml/ns/view ../../../../org.jiemamy.core/src/main/resources/jiemamy-view.xsd"> + + <dialect>org.jiemamy.dialect.mysql.MySqlDialect</dialect> + <schemaName>FOO</schemaName> + <beginScript>BEGIN;</beginScript> + <endScript>COMMIT;</endScript> + <description>シリアライゼーションイメージ</description> + <domains> + <domain id="2eec0aa0-5122-4eb7-833d-9f5a43e7abe9"> + <name>ID</name> + <logicalName/> + <dataTypeDescriptor class="org.jiemamy.model.datatype.IntegerDataTypeDescriptor"/> + <defaultValue/> + <notNull>true</notNull> + <simpleIndex>false</simpleIndex> + <freeString/> + <description/> + <options/> + </domain> + <domain id="62f1e6ec-e6aa-4d52-a6c3-27dac086f2d7"> + <name>NAME</name> + <logicalName/> + <dataTypeDescriptor class="org.jiemamy.model.datatype.VarcharDataTypeDescriptor"> + <adapter class="org.jiemamy.model.datatype.adapter.SizedDataTypeAdapter"> + <size>32</size> + </adapter> + </dataTypeDescriptor> + <defaultValue/> + <notNull>false</notNull> + <constraints/> + <simpleIndex>false</simpleIndex> + <freeString/> + <description>人名用の型です。</description> + <options/> + </domain> + </domains> + <nodes> + <table id="d7489ed6-0add-443d-95cf-234376eb0455"> + <name>T_DEPT</name> + <logicalName/> + <sourceConnections/> + <targetConnections> + <foreignKey ref="e7dd92b4-1d97-4be6-bab6-fa9fe26eb6ed"/> + </targetConnections> + <beginScript>/* test begin script */</beginScript> + <endScript/> + <description>部署マスタです。</description> + <columns> + <column id="c7ed225d-92a6-4cc2-90de-60531804464e"> + <name>ID</name> + <logicalName>部署ID</logicalName> + <dataTypeDescriptor ref="2eec0aa0-5122-4eb7-833d-9f5a43e7abe9"/> + <defaultValue/> + <notNull>false</notNull> + <simpleIndex>false</simpleIndex> + <freeString/> + <description/> + <options/> + <representation>false</representation> + </column> + <column id="2d951389-6bc7-49d7-8631-1d26fe17047e"> + <name>DEPT_NO</name> + <logicalName>部署番号</logicalName> + <dataTypeDescriptor class="org.jiemamy.model.datatype.IntegerDataTypeDescriptor"/> + <defaultValue/> + <notNull>false</notNull> + <simpleIndex>false</simpleIndex> + <freeString/> + <description/> + <options/> + <representation>false</representation> + </column> + <column id="1fcd63d3-974e-4d2e-a0d8-3b9c233104d9"> + <name>DEPT_NAME</name> + <logicalName>部署名</logicalName> + <dataTypeDescriptor class="org.jiemamy.model.datatype.VarcharDataTypeDescriptor"> + <adapter class="org.jiemamy.model.datatype.adapter.SizedDataTypeAdapter"> + <size>20</size> + </adapter> + </dataTypeDescriptor> + <defaultValue/> + <notNull>false</notNull> + <simpleIndex>false</simpleIndex> + <freeString/> + <description/> + <options/> + <representation>true</representation> + </column> + <column id="7bf79e76-07b8-43b6-a993-b8ef374a31f5"> + <name>LOC</name> + <logicalName>ロケーション</logicalName> + <dataTypeDescriptor class="org.jiemamy.model.datatype.VarcharDataTypeDescriptor"> + <adapter class="org.jiemamy.model.datatype.adapter.SizedDataTypeAdapter"> + <size>20</size> + </adapter> + </dataTypeDescriptor> + <defaultValue>secret</defaultValue> + <notNull>false</notNull> + <simpleIndex>false</simpleIndex> + <freeString/> + <description/> + <options/> + <representation>false</representation> + </column> + </columns> + </table> + <table id="9f522e56-809c-45fd-8416-39201014218b"> + <name>T_EMP</name> + <logicalName>従業員</logicalName> + <sourceConnections> + <foreignKey ref="e43d3c43-33c8-4b02-aa42-83f2d868cfe6"/> + <foreignKey ref="e7dd92b4-1d97-4be6-bab6-fa9fe26eb6ed"/> + </sourceConnections> + <targetConnections> + <foreignKey ref="e43d3c43-33c8-4b02-aa42-83f2d868cfe6"/> + </targetConnections> + <beginScript>/* test end script */</beginScript> + <endScript/> + <description>従業員マスタです。</description> + <columns> + <column id="44c8e93d-b7ad-46cc-9b29-88c3a7d6c33e"> + <name>ID</name> + <logicalName>従業員ID</logicalName> + <dataTypeDescriptor ref="2eec0aa0-5122-4eb7-833d-9f5a43e7abe9"/> + <defaultValue/> + <notNull>false</notNull> + <freeString/> + <description/> + <options/> + <representation>false</representation> + </column> + <column id="248a429b-2159-4ebd-a791-eee42a059374"> + <name>EMP_NO</name> + <logicalName>従業員番号</logicalName> + <dataTypeDescriptor class="org.jiemamy.model.datatype.IntegerDataTypeDescriptor"/> + <defaultValue/> + <notNull>false</notNull> + <freeString/> + <description/> + <options/> + <representation>false</representation> + </column> + <column id="0e51b6df-43ab-408c-90ef-de13c6aab881"> + <name>EMP_NAME</name> + <dataTypeDescriptor ref="62f1e6ec-e6aa-4d52-a6c3-27dac086f2d7"/> + <defaultValue>no name</defaultValue> + <notNull>false</notNull> + <freeString/> + <description/> + <options/> + <representation>true</representation> + </column> + <column id="3d21a85a-72de-41b3-99dd-f4cb94e58d84"> + <name>MGR_ID</name> + <logicalName>上司ID</logicalName> + <dataTypeDescriptor class="org.jiemamy.model.datatype.IntegerDataTypeDescriptor"/> + <defaultValue/> + <notNull>false</notNull> + <freeString/> + <description/> + <options/> + <representation>false</representation> + </column> + <column id="f0b57eed-98ab-4c21-9855-218c592814dc"> + <name>HIREDATE</name> + <logicalName/> + <dataTypeDescriptor class="org.jiemamy.model.datatype.TimestampDataTypeDescriptor"> + <adapter class="org.jiemamy.model.datatype.adapter.TimezonedDataTypeAdapter"> + <timezone>false</timezone> + </adapter> + </dataTypeDescriptor> + <defaultValue/> + <notNull>false</notNull> + <freeString/> + <description/> + <options/> + <representation>false</representation> + </column> + <column id="80786549-dc2c-4c1c-bcbd-9f6fdec911d2"> + <name>SAL</name> + <logicalName/> + <dataTypeDescriptor class="org.jiemamy.model.datatype.NumericDataTypeDescriptor"> + <adapter class="org.jiemamy.model.datatype.adapter.PrecisionedDataTypeAdapter"> + <precision>7</precision> + <scale>2</scale> + </adapter> + </dataTypeDescriptor> + <defaultValue/> + <notNull>false</notNull> + <freeString/> + <description/> + <options/> + <representation>false</representation> + </column> + <column id="4ae69b7a-7a0e-422a-89dc-0f0cff77565b"> + <name>DEPT_ID</name> + <logicalName/> + <dataTypeDescriptor class="org.jiemamy.model.datatype.IntegerDataTypeDescriptor"/> + <defaultValue/> + <notNull>false</notNull> + <freeString/> + <description/> + <options/> + <representation>false</representation> + </column> + </columns> + </table> + <view id="516f7961-cb7b-48e2-990b-7fb0c750c3a4"> + <name>V_HIGH_SAL_EMP</name> + <logicalName>高給取り</logicalName> + <beginScript/> + <endScript/> + <description/> + <definition>SELECT * FROM T_EMP WHERE SAL > 2000;</definition> + </view> + <sticky id="43beb884-2562-4480-8030-bb797f701783"> + <contents>メモーー</contents> + </sticky> + </nodes> + <connections> + <foreignKey id="e43d3c43-33c8-4b02-aa42-83f2d868cfe6"> + <name>fkey_T_EMP_T_EMP_1225727057074</name> + <logicalName/> + <source ref="9f522e56-809c-45fd-8416-39201014218b"/> + <target ref="9f522e56-809c-45fd-8416-39201014218b"/> + <mappings> + <mapping id="081fedb4-ca8c-4c8d-b3a1-50be0783c244"> + <constraintColumn ref="3d21a85a-72de-41b3-99dd-f4cb94e58d84"/> + <referenceColumn ref="44c8e93d-b7ad-46cc-9b29-88c3a7d6c33e"/> + </mapping> + </mappings> + <matchType/> + <onDelete>SET_NULL</onDelete> + <onUpdate/> + <deferrable>true</deferrable> + <initiallyCheckTime>DEFERRED</initiallyCheckTime> + <description/> + </foreignKey> + <foreignKey id="e7dd92b4-1d97-4be6-bab6-fa9fe26eb6ed"> + <name>fkey_T_EMP_T_DEPT_1225727057074</name> + <logicalName/> + <source ref="9f522e56-809c-45fd-8416-39201014218b"/> + <target ref="d7489ed6-0add-443d-95cf-234376eb0455"/> + <mappings> + <mapping id="d66f6db7-5648-477a-8b87-5dce622c48e1"> + <constraintColumn ref="4ae69b7a-7a0e-422a-89dc-0f0cff77565b"/> + <referenceColumn ref="c7ed225d-92a6-4cc2-90de-60531804464e"/> + </mapping> + </mappings> + <matchType/> + <onDelete/> + <onUpdate/> + <deferrable>false</deferrable> + <initiallyCheckTime/> + <description/> + </foreignKey> + </connections> + <insertDataSetModels> + <dataSet id="6000"> + <name>データ群en</name> + <table ref="d7489ed6-0add-443d-95cf-234376eb0455"> + <record id="rec01"> + <column ref="c7ed225d-92a6-4cc2-90de-60531804464e">1</column> + <column ref="2d951389-6bc7-49d7-8631-1d26fe17047e">10</column> + <column ref="1fcd63d3-974e-4d2e-a0d8-3b9c233104d9">ACCOUNTING</column> + <column ref="7bf79e76-07b8-43b6-a993-b8ef374a31f5">NEW YORK</column> + </record> + <record id="rec02"> + <column ref="c7ed225d-92a6-4cc2-90de-60531804464e">2</column> + <column ref="2d951389-6bc7-49d7-8631-1d26fe17047e">20</column> + <column ref="1fcd63d3-974e-4d2e-a0d8-3b9c233104d9">RESEARCH</column> + <column ref="7bf79e76-07b8-43b6-a993-b8ef374a31f5">DALLAS</column> + </record> + <record id="rec03"> + <column ref="c7ed225d-92a6-4cc2-90de-60531804464e">3</column> + <column ref="2d951389-6bc7-49d7-8631-1d26fe17047e">30</column> + <column ref="1fcd63d3-974e-4d2e-a0d8-3b9c233104d9">SALES</column> + <column ref="7bf79e76-07b8-43b6-a993-b8ef374a31f5">CHICAGO</column> + </record> + <record id="rec04"> + <column ref="c7ed225d-92a6-4cc2-90de-60531804464e">4</column> + <column ref="2d951389-6bc7-49d7-8631-1d26fe17047e">40</column> + <column ref="1fcd63d3-974e-4d2e-a0d8-3b9c233104d9">OPERATIONS</column> + <column ref="7bf79e76-07b8-43b6-a993-b8ef374a31f5">BOSTON</column> + </record> + </table> + <table ref="9f522e56-809c-45fd-8416-39201014218b"> + <record id="rec11"> + <column ref="44c8e93d-b7ad-46cc-9b29-88c3a7d6c33e">1</column> + <column ref="248a429b-2159-4ebd-a791-eee42a059374">10</column> + <column ref="0e51b6df-43ab-408c-90ef-de13c6aab881">SMITH</column> + <column ref="3d21a85a-72de-41b3-99dd-f4cb94e58d84">3</column> + <column ref="f0b57eed-98ab-4c21-9855-218c592814dc">2003-02-01</column> + <column ref="80786549-dc2c-4c1c-bcbd-9f6fdec911d2">40</column> + <column ref="4ae69b7a-7a0e-422a-89dc-0f0cff77565b">3</column> + </record> + <record id="rec12"> + <column ref="44c8e93d-b7ad-46cc-9b29-88c3a7d6c33e">2</column> + <column ref="248a429b-2159-4ebd-a791-eee42a059374">20</column> + <column ref="0e51b6df-43ab-408c-90ef-de13c6aab881">ALLEN</column> + <column ref="3d21a85a-72de-41b3-99dd-f4cb94e58d84">3</column> + <column ref="f0b57eed-98ab-4c21-9855-218c592814dc">2003-03-04</column> + <column ref="80786549-dc2c-4c1c-bcbd-9f6fdec911d2">50</column> + <column ref="4ae69b7a-7a0e-422a-89dc-0f0cff77565b">4</column> + </record> + <record id="rec13"> + <column ref="44c8e93d-b7ad-46cc-9b29-88c3a7d6c33e">3</column> + <column ref="248a429b-2159-4ebd-a791-eee42a059374">30</column> + <column ref="0e51b6df-43ab-408c-90ef-de13c6aab881">WARD</column> + <column ref="3d21a85a-72de-41b3-99dd-f4cb94e58d84"/> + <column ref="f0b57eed-98ab-4c21-9855-218c592814dc">1993-12-05</column> + <column ref="80786549-dc2c-4c1c-bcbd-9f6fdec911d2">60</column> + <column ref="4ae69b7a-7a0e-422a-89dc-0f0cff77565b">4</column> + </record> + <record id="rec14"> + <column ref="44c8e93d-b7ad-46cc-9b29-88c3a7d6c33e">4</column> + <column ref="248a429b-2159-4ebd-a791-eee42a059374">40</column> + <column ref="0e51b6df-43ab-408c-90ef-de13c6aab881">JONES</column> + <column ref="3d21a85a-72de-41b3-99dd-f4cb94e58d84">2</column> + <column ref="f0b57eed-98ab-4c21-9855-218c592814dc">2007-04-01</column> + <column ref="80786549-dc2c-4c1c-bcbd-9f6fdec911d2">36</column> + <column ref="4ae69b7a-7a0e-422a-89dc-0f0cff77565b">2</column> + </record> + <record id="rec15"> + <column ref="44c8e93d-b7ad-46cc-9b29-88c3a7d6c33e">5</column> + <column ref="248a429b-2159-4ebd-a791-eee42a059374">50</column> + <column ref="0e51b6df-43ab-408c-90ef-de13c6aab881">MARTIN</column> + <column ref="3d21a85a-72de-41b3-99dd-f4cb94e58d84">1</column> + <column ref="f0b57eed-98ab-4c21-9855-218c592814dc">2002-05-30</column> + <column ref="80786549-dc2c-4c1c-bcbd-9f6fdec911d2">30</column> + <column ref="4ae69b7a-7a0e-422a-89dc-0f0cff77565b">3</column> + </record> + <record id="rec16"> + <column ref="44c8e93d-b7ad-46cc-9b29-88c3a7d6c33e">6</column> + <column ref="248a429b-2159-4ebd-a791-eee42a059374">60</column> + <column ref="0e51b6df-43ab-408c-90ef-de13c6aab881">BLAKE</column> + <column ref="3d21a85a-72de-41b3-99dd-f4cb94e58d84">3</column> + <column ref="f0b57eed-98ab-4c21-9855-218c592814dc">2007-04-01</column> + <column ref="80786549-dc2c-4c1c-bcbd-9f6fdec911d2">25</column> + <column ref="4ae69b7a-7a0e-422a-89dc-0f0cff77565b">2</column> + </record> + <record id="rec17"> + <column ref="44c8e93d-b7ad-46cc-9b29-88c3a7d6c33e">7</column> + <column ref="248a429b-2159-4ebd-a791-eee42a059374">70</column> + <column ref="0e51b6df-43ab-408c-90ef-de13c6aab881">CLARK</column> + <column ref="3d21a85a-72de-41b3-99dd-f4cb94e58d84">1</column> + <column ref="f0b57eed-98ab-4c21-9855-218c592814dc">2004-09-01</column> + <column ref="80786549-dc2c-4c1c-bcbd-9f6fdec911d2">30</column> + <column ref="4ae69b7a-7a0e-422a-89dc-0f0cff77565b">1</column> + </record> + <record id="rec18"> + <column ref="44c8e93d-b7ad-46cc-9b29-88c3a7d6c33e">8</column> + <column ref="248a429b-2159-4ebd-a791-eee42a059374">80</column> + <column ref="0e51b6df-43ab-408c-90ef-de13c6aab881">SCOTT</column> + <column ref="3d21a85a-72de-41b3-99dd-f4cb94e58d84">4</column> + <column ref="f0b57eed-98ab-4c21-9855-218c592814dc">2008-03-01</column> + <column ref="80786549-dc2c-4c1c-bcbd-9f6fdec911d2">25</column> + <column ref="4ae69b7a-7a0e-422a-89dc-0f0cff77565b">2</column> + </record> + </table> + </dataSet> + <dataSet id="6001"> + <name>データ群ja</name> + <table ref="d7489ed6-0add-443d-95cf-234376eb0455"> + <record id="rec21"> + <column ref="c7ed225d-92a6-4cc2-90de-60531804464e">1</column> + <column ref="2d951389-6bc7-49d7-8631-1d26fe17047e">10</column> + <column ref="1fcd63d3-974e-4d2e-a0d8-3b9c233104d9">経理部</column> + <column ref="7bf79e76-07b8-43b6-a993-b8ef374a31f5">広島</column> + </record> + <record id="rec22"> + <column ref="c7ed225d-92a6-4cc2-90de-60531804464e">2</column> + <column ref="2d951389-6bc7-49d7-8631-1d26fe17047e">20</column> + <column ref="1fcd63d3-974e-4d2e-a0d8-3b9c233104d9">研究開発部</column> + <column ref="7bf79e76-07b8-43b6-a993-b8ef374a31f5">京都</column> + </record> + <record id="rec23"> + <column ref="c7ed225d-92a6-4cc2-90de-60531804464e">3</column> + <column ref="2d951389-6bc7-49d7-8631-1d26fe17047e">30</column> + <column ref="1fcd63d3-974e-4d2e-a0d8-3b9c233104d9">営業部</column> + <column ref="7bf79e76-07b8-43b6-a993-b8ef374a31f5">東京</column> + </record> + <record id="rec24"> + <column ref="c7ed225d-92a6-4cc2-90de-60531804464e">4</column> + <column ref="2d951389-6bc7-49d7-8631-1d26fe17047e">40</column> + <column ref="1fcd63d3-974e-4d2e-a0d8-3b9c233104d9">経営本部</column> + </record> + </table> + <table ref="9f522e56-809c-45fd-8416-39201014218b"> + <record id="rec31"> + <column ref="44c8e93d-b7ad-46cc-9b29-88c3a7d6c33e">1</column> + <column ref="248a429b-2159-4ebd-a791-eee42a059374">10</column> + <column ref="0e51b6df-43ab-408c-90ef-de13c6aab881">鈴木 茂</column> + <column ref="3d21a85a-72de-41b3-99dd-f4cb94e58d84">3</column> + <column ref="f0b57eed-98ab-4c21-9855-218c592814dc">2003-02-01</column> + <column ref="80786549-dc2c-4c1c-bcbd-9f6fdec911d2">40</column> + <column ref="4ae69b7a-7a0e-422a-89dc-0f0cff77565b">3</column> + </record> + <record id="rec32"> + <column ref="44c8e93d-b7ad-46cc-9b29-88c3a7d6c33e">2</column> + <column ref="248a429b-2159-4ebd-a791-eee42a059374">20</column> + <column ref="0e51b6df-43ab-408c-90ef-de13c6aab881">内海 透</column> + <column ref="3d21a85a-72de-41b3-99dd-f4cb94e58d84">3</column> + <column ref="f0b57eed-98ab-4c21-9855-218c592814dc">2003-03-04</column> + <column ref="80786549-dc2c-4c1c-bcbd-9f6fdec911d2">50</column> + <column ref="4ae69b7a-7a0e-422a-89dc-0f0cff77565b">4</column> + </record> + <record id="rec33"> + <column ref="44c8e93d-b7ad-46cc-9b29-88c3a7d6c33e">3</column> + <column ref="248a429b-2159-4ebd-a791-eee42a059374">30</column> + <column ref="0e51b6df-43ab-408c-90ef-de13c6aab881">村瀬 武彦</column> + <column ref="3d21a85a-72de-41b3-99dd-f4cb94e58d84"/> + <column ref="f0b57eed-98ab-4c21-9855-218c592814dc">1993-12-05</column> + <column ref="80786549-dc2c-4c1c-bcbd-9f6fdec911d2">60</column> + <column ref="4ae69b7a-7a0e-422a-89dc-0f0cff77565b">4</column> + </record> + <record id="rec34"> + <column ref="44c8e93d-b7ad-46cc-9b29-88c3a7d6c33e">4</column> + <column ref="248a429b-2159-4ebd-a791-eee42a059374">40</column> + <column ref="0e51b6df-43ab-408c-90ef-de13c6aab881">近藤 美樹</column> + <column ref="3d21a85a-72de-41b3-99dd-f4cb94e58d84">2</column> + <column ref="f0b57eed-98ab-4c21-9855-218c592814dc">2007-04-01</column> + <column ref="80786549-dc2c-4c1c-bcbd-9f6fdec911d2">36</column> + <column ref="4ae69b7a-7a0e-422a-89dc-0f0cff77565b">2</column> + </record> + <record id="rec35"> + <column ref="44c8e93d-b7ad-46cc-9b29-88c3a7d6c33e">5</column> + <column ref="248a429b-2159-4ebd-a791-eee42a059374">50</column> + <column ref="0e51b6df-43ab-408c-90ef-de13c6aab881">榊 美子</column> + <column ref="3d21a85a-72de-41b3-99dd-f4cb94e58d84">1</column> + <column ref="f0b57eed-98ab-4c21-9855-218c592814dc">2002-05-30</column> + <column ref="80786549-dc2c-4c1c-bcbd-9f6fdec911d2">30</column> + <column ref="4ae69b7a-7a0e-422a-89dc-0f0cff77565b">3</column> + </record> + <record id="rec36"> + <column ref="44c8e93d-b7ad-46cc-9b29-88c3a7d6c33e">6</column> + <column ref="248a429b-2159-4ebd-a791-eee42a059374">60</column> + <column ref="0e51b6df-43ab-408c-90ef-de13c6aab881">三浦 佑</column> + <column ref="3d21a85a-72de-41b3-99dd-f4cb94e58d84">3</column> + <column ref="f0b57eed-98ab-4c21-9855-218c592814dc">2007-04-01</column> + <column ref="80786549-dc2c-4c1c-bcbd-9f6fdec911d2">25</column> + <column ref="4ae69b7a-7a0e-422a-89dc-0f0cff77565b">2</column> + </record> + <record id="rec37"> + <column ref="44c8e93d-b7ad-46cc-9b29-88c3a7d6c33e">7</column> + <column ref="248a429b-2159-4ebd-a791-eee42a059374">70</column> + <column ref="0e51b6df-43ab-408c-90ef-de13c6aab881">前島 孝幸</column> + <column ref="3d21a85a-72de-41b3-99dd-f4cb94e58d84">1</column> + <column ref="f0b57eed-98ab-4c21-9855-218c592814dc">2004-09-01</column> + <column ref="80786549-dc2c-4c1c-bcbd-9f6fdec911d2">30</column> + <column ref="4ae69b7a-7a0e-422a-89dc-0f0cff77565b">1</column> + </record> + <record id="rec38"> + <column ref="44c8e93d-b7ad-46cc-9b29-88c3a7d6c33e">8</column> + <column ref="248a429b-2159-4ebd-a791-eee42a059374">80</column> + <column ref="0e51b6df-43ab-408c-90ef-de13c6aab881">島崎 由比</column> + <column ref="3d21a85a-72de-41b3-99dd-f4cb94e58d84">4</column> + <column ref="f0b57eed-98ab-4c21-9855-218c592814dc">2008-03-01</column> + <column ref="80786549-dc2c-4c1c-bcbd-9f6fdec911d2">25</column> + <column ref="4ae69b7a-7a0e-422a-89dc-0f0cff77565b">2</column> + </record> + </table> + </dataSet> + </insertDataSetModels> + <view:diagramPresentations> + <view:diagramPresentation> + <name>全部表示する</name> + <view:node ref="d7489ed6-0add-443d-95cf-234376eb0455" x="360" y="60" width="-1" height="-1" color="#ff00ff"/> + <view:node ref="9f522e56-809c-45fd-8416-39201014218b" x="60" y="60" width="-1" height="-1" color="#ff00ff"/> + <view:node ref="516f7961-cb7b-48e2-990b-7fb0c750c3a4" x="60" y="270" width="-1" height="-1" color="#ff00ff"/> + <view:node ref="43beb884-2562-4480-8030-bb797f701783" x="360" y="270" width="-1" height="-1" color="#ff00ff"/> + <view:connection ref="e43d3c43-33c8-4b02-aa42-83f2d868cfe6"/> + <view:connection ref="e7dd92b4-1d97-4be6-bab6-fa9fe26eb6ed"> + <view:bendpoint x="310" y="60" /> + <view:bendpoint x="360" y="10" /> + </view:connection> + </view:diagramPresentation> + <view:diagramPresentation> + <name>一部表示する</name> + <view:node ref="d7489ed6-0add-443d-95cf-234376eb0455" x="60" y="60" width="-1" height="-1" color="#ff00ff"/> + <view:node ref="516f7961-cb7b-48e2-990b-7fb0c750c3a4" x="270" y="270" width="-1" height="-1" color="#ff00ff"/> + <view:connection ref="e43d3c43-33c8-4b02-aa42-83f2d868cfe6"/> + </view:diagramPresentation> + </view:diagramPresentations> +</rootModel> + Modified: artemis/trunk/org.jiemamy.dialect.mysql/.project =================================================================== --- artemis/trunk/org.jiemamy.dialect.mysql/.project 2008-12-27 17:43:07 UTC (rev 2326) +++ artemis/trunk/org.jiemamy.dialect.mysql/.project 2008-12-29 05:37:47 UTC (rev 2327) @@ -50,14 +50,14 @@ </natures> <linkedResources> <link> - <name>.fbprefs</name> + <name>findbugs.xml</name> <type>1</type> - <locationURI>DOCUMENTS/org.jiemamy.project/.fbprefs</locationURI> + <locationURI>DOCUMENTS/org.jiemamy.project/findbugs.xml</locationURI> </link> <link> - <name>findbugs.xml</name> + <name>.fbprefs</name> <type>1</type> - <locationURI>DOCUMENTS/org.jiemamy.project/findbugs.xml</locationURI> + <locationURI>DOCUMENTS/org.jiemamy.project/.fbprefs</locationURI> </link> <link> <name>.checkstyle</name> Modified: artemis/trunk/org.jiemamy.dialect.postgresql/.project =================================================================== --- artemis/trunk/org.jiemamy.dialect.postgresql/.project 2008-12-27 17:43:07 UTC (rev 2326) +++ artemis/trunk/org.jiemamy.dialect.postgresql/.project 2008-12-29 05:37:47 UTC (rev 2327) @@ -50,14 +50,14 @@ </natures> <linkedResources> <link> - <name>.fbprefs</name> + <name>findbugs.xml</name> <type>1</type> - <locationURI>DOCUMENTS/org.jiemamy.project/.fbprefs</locationURI> + <locationURI>DOCUMENTS/org.jiemamy.project/findbugs.xml</locationURI> </link> <link> - <name>findbugs.xml</name> + <name>.fbprefs</name> <type>1</type> - <locationURI>DOCUMENTS/org.jiemamy.project/findbugs.xml</locationURI> + <locationURI>DOCUMENTS/org.jiemamy.project/.fbprefs</locationURI> </link> <link> <name>.checkstyle</name> Modified: artemis/trunk/org.jiemamy.dialect.sql99/.project =================================================================== --- artemis/trunk/org.jiemamy.dialect.sql99/.project 2008-12-27 17:43:07 UTC (rev 2326) +++ artemis/trunk/org.jiemamy.dialect.sql99/.project 2008-12-29 05:37:47 UTC (rev 2327) @@ -50,14 +50,14 @@ </natures> <linkedResources> <link> - <name>.fbprefs</name> + <name>findbugs.xml</name> <type>1</type> - <locationURI>DOCUMENTS/org.jiemamy.project/.fbprefs</locationURI> + <locationURI>DOCUMENTS/org.jiemamy.project/findbugs.xml</locationURI> </link> <link> - <name>findbugs.xml</name> + <name>.fbprefs</name> <type>1</type> - <locationURI>DOCUMENTS/org.jiemamy.project/findbugs.xml</locationURI> + <locationURI>DOCUMENTS/org.jiemamy.project/.fbprefs</locationURI> </link> <link> <name>.checkstyle</name> Modified: artemis/trunk/org.jiemamy.project/pom.xml =================================================================== --- artemis/trunk/org.jiemamy.project/pom.xml 2008-12-27 17:43:07 UTC (rev 2326) +++ artemis/trunk/org.jiemamy.project/pom.xml 2008-12-29 05:37:47 UTC (rev 2327) @@ -84,7 +84,6 @@ <module>../org.jiemamy.core</module> <module>../org.jiemamy.event</module> <module>../org.jiemamy.view</module> - <module>../org.jiemamy.serializer</module> <module>../org.jiemamy.dialect.sql99</module> <module>../org.jiemamy.dialect.postgresql</module> <module>../org.jiemamy.dialect.mysql</module> Modified: artemis/trunk/org.jiemamy.serializer/META-INF/MANIFEST.MF =================================================================== --- artemis/trunk/org.jiemamy.serializer/META-INF/MANIFEST.MF 2008-12-27 17:43:07 UTC (rev 2326) +++ artemis/trunk/org.jiemamy.serializer/META-INF/MANIFEST.MF 2008-12-29 05:37:47 UTC (rev 2327) @@ -5,7 +5,6 @@ Bundle-Version: 0.2.0.SNAPSHOT Bundle-ClassPath: . Bundle-Vendor: Jiemamy Project -Export-Package: org.jiemamy.serializer Require-Bundle: org.jiemamy.spec.core, org.jiemamy.spec.view Eclipse-BuddyPolicy: registered Modified: artemis/trunk/org.jiemamy.serializer/pom.xml =================================================================== --- artemis/trunk/org.jiemamy.serializer/pom.xml 2008-12-27 17:43:07 UTC (rev 2326) +++ artemis/trunk/org.jiemamy.serializer/pom.xml 2008-12-29 05:37:47 UTC (rev 2327) @@ -3,12 +3,6 @@ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> <modelVersion>4.0.0</modelVersion> - <parent> - <groupId>org.jiemamy</groupId> - <artifactId>jiemamy-project</artifactId> - <version>0.2.0-SNAPSHOT</version> - <relativePath>../org.jiemamy.project</relativePath> - </parent> <groupId>org.jiemamy</groupId> <artifactId>org.jiemamy.serializer</artifactId> <name>Jiemamy Serialiser</name> @@ -168,89 +162,6 @@ <version>1.4</version> <scope>test</scope> </dependency> - <dependency> - <groupId>org.slf4j</groupId> - <artifactId>slf4j-api</artifactId> - <version>1.5.5</version> - </dependency> - <dependency> - <groupId>org.slf4j</groupId> - <artifactId>jcl-over-slf4j</artifactId> - <version>1.5.5</version> - </dependency> - <dependency> - <groupId>ch.qos.logback</groupId> - <artifactId>logback-core</artifactId> - <version>0.9.9</version> - </dependency> - <dependency> - <groupId>ch.qos.logback</groupId> - <artifactId>logback-classic</artifactId> - <version>0.9.9</version> - </dependency> - <dependency> - <groupId>commons-lang</groupId> - <artifactId>commons-lang</artifactId> - <version>2.3</version> - </dependency> - <dependency> - <groupId>commons-io</groupId> - <artifactId>commons-io</artifactId> - <version>1.3.2</version> - </dependency> - <dependency> - <groupId>stax</groupId> - <artifactId>stax</artifactId> - <version>1.2.0</version> - </dependency> - <!-- - <dependency> - <groupId>net.java.dev.stax-utils</groupId> - <artifactId>stax-utils</artifactId> - <version>20060502</version> - </dependency> - --> - <dependency> - <groupId>org.codehaus.woodstox</groupId> - <artifactId>wstx-asl</artifactId> - <version>3.2.7</version> - </dependency> - <!-- - <dependency> - <groupId>org.codehaus.staxmate</groupId> - <artifactId>staxmate</artifactId> - <version>1.3.1</version> - </dependency> - --> - <dependency> - <groupId>${project.groupId}</groupId> - <artifactId>org.jiemamy.spec.core</artifactId> - <version>${project.version}</version> - </dependency> - <dependency> - <groupId>${project.groupId}</groupId> - <artifactId>org.jiemamy.spec.view</artifactId> - <version>${project.version}</version> - </dependency> - <dependency> - <groupId>${project.groupId}</groupId> - <artifactId>org.jiemamy.core</artifactId> - <version>${project.version}</version> - <!-- scope>test</scope --> - </dependency> - <dependency> - <groupId>${project.groupId}</groupId> - <artifactId>org.jiemamy.core</artifactId> - <version>${project.version}</version> - <type>test-jar</type> - <scope>test</scope> - </dependency> - <dependency> - <groupId>${project.groupId}</groupId> - <artifactId>org.jiemamy.view</artifactId> - <version>${project.version}</version> - <scope>test</scope> - </dependency> </dependencies> <reporting> <plugins> Deleted: artemis/trunk/org.jiemamy.serializer/src/test/resources/logback.xml =================================================================== --- artemis/trunk/org.jiemamy.serializer/src/test/resources/logback.xml 2008-12-27 17:43:07 UTC (rev 2326) +++ artemis/trunk/org.jiemamy.serializer/src/test/resources/logback.xml 2008-12-29 05:37:47 UTC (rev 2327) @@ -1,18 +0,0 @@ -<configuration> - <appender name="STDOUT" - class="ch.qos.logback.core.ConsoleAppender"> - <Target>System.out</Target> - <layout class="ch.qos.logback.classic.PatternLayout"> - <Pattern>%d{HH:mm:ss,SSS} [%thread] %-5level %logger{36} - %msg%n</Pattern> - </layout> - </appender> - - <logger name="org.jiemamy"> - <level value="DEBUG" /> - </logger> - - <root> - <level value="INFO" /> - <appender-ref ref="STDOUT" /> - </root> -</configuration> Deleted: artemis/trunk/org.jiemamy.serializer/src/test/resources/minimal.jiemamy-core.xml =================================================================== --- artemis/trunk/org.jiemamy.serializer/src/test/resources/minimal.jiemamy-core.xml 2008-12-27 17:43:07 UTC (rev 2326) +++ artemis/trunk/org.jiemamy.serializer/src/test/resources/minimal.jiemamy-core.xml 2008-12-29 05:37:47 UTC (rev 2327) @@ -1,4 +0,0 @@ -<?xml version='1.0' encoding='UTF-8'?> -<rootModel xmlns="http://jiemamy.org/xml/ns/core" id="ffffffff-ffff-ffff-ffff-ffffffffffff"> - <dialect>com.example.HogeDialect</dialect> -</rootModel> Deleted: artemis/trunk/org.jiemamy.serializer/src/test/resources/minimal.xml =================================================================== --- artemis/trunk/org.jiemamy.serializer/src/test/resources/minimal.xml 2008-12-27 17:43:07 UTC (rev 2326) +++ artemis/trunk/org.jiemamy.serializer/src/test/resources/minimal.xml 2008-12-29 05:37:47 UTC (rev 2327) @@ -1,5 +0,0 @@ -<?xml version="1.0" encoding="utf-8" ?> -<foo xmlns:prefix="uri_prifix" xmlns="uri_anon"> - <bar prefix:localName="piyo">value</bar> - <bar /> -</foo> \ No newline at end of file Deleted: artemis/trunk/org.jiemamy.serializer/src/test/resources/sample.xml =================================================================== --- artemis/trunk/org.jiemamy.serializer/src/test/resources/sample.xml 2008-12-27 17:43:07 UTC (rev 2326) +++ artemis/trunk/org.jiemamy.serializer/src/test/resources/sample.xml 2008-12-29 05:37:47 UTC (rev 2327) @@ -1,493 +0,0 @@ -<?xml version="1.0"?> -<rootModel id="d5a96af3-b1e9-4285-a8ef-c491ce5ae308" - xmlns="http://jiemamy.org/xml/ns/core" - xmlns:view="http://jiemamy.org/xml/ns/view" - xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:schemaLocation= - "http://jiemamy.org/xml/ns/core ../../../../org.jiemamy.core/src/main/resources/jiemamy-core.xsd - http://jiemamy.org/xml/ns/view ../../../../org.jiemamy.core/src/main/resources/jiemamy-view.xsd"> - - <dialect>org.jiemamy.dialect.mysql.MySqlDialect</dialect> - <schemaName>FOO</schemaName> - <beginScript>BEGIN;</beginScript> - <endScript>COMMIT;</endScript> - <description>シリアライゼーションイメージ</description> - <domains> - <domain id="2eec0aa0-5122-4eb7-833d-9f5a43e7abe9"> - <name>ID</name> - <logicalName/> - <dataTypeDescriptor class="org.jiemamy.model.datatype.IntegerDataTypeDescriptor"/> - <defaultValue/> - <notNull>true</notNull> - <simpleIndex>false</simpleIndex> - <freeString/> - <description/> - <options/> - </domain> - <domain id="62f1e6ec-e6aa-4d52-a6c3-27dac086f2d7"> - <name>NAME</name> - <logicalName/> - <dataTypeDescriptor class="org.jiemamy.model.datatype.VarcharDataTypeDescriptor"> - <adapter class="org.jiemamy.model.datatype.adapter.SizedDataTypeAdapter"> - <size>32</size> - </adapter> - </dataTypeDescriptor> - <defaultValue/> - <notNull>false</notNull> - <constraints/> - <simpleIndex>false</simpleIndex> - <freeString/> - <description>人名用の型です。</description> - <options/> - </domain> - </domains> - <nodes> - <table id="d7489ed6-0add-443d-95cf-234376eb0455"> - <name>T_DEPT</name> - <logicalName/> - <sourceConnections/> - <targetConnections> - <foreignKey ref="e7dd92b4-1d97-4be6-bab6-fa9fe26eb6ed"/> - </targetConnections> - <beginScript>/* test begin script */</beginScript> - <endScript/> - <description>部署マスタです。</description> - <columns> - <column id="c7ed225d-92a6-4cc2-90de-60531804464e"> - <name>ID</name> - <logicalName>部署ID</logicalName> - <dataTypeDescriptor ref="2eec0aa0-5122-4eb7-833d-9f5a43e7abe9"/> - <defaultValue/> - <notNull>false</notNull> - <simpleIndex>false</simpleIndex> - <freeString/> - <description/> - <options/> - <representation>false</representation> - </column> - <column id="2d951389-6bc7-49d7-8631-1d26fe17047e"> - <name>DEPT_NO</name> - <logicalName>部署番号</logicalName> - <dataTypeDescriptor class="org.jiemamy.model.datatype.IntegerDataTypeDescriptor"/> - <defaultValue/> - <notNull>false</notNull> - <simpleIndex>false</simpleIndex> - <freeString/> - <description/> - <options/> - <representation>false</representation> - </column> - <column id="1fcd63d3-974e-4d2e-a0d8-3b9c233104d9"> - <name>DEPT_NAME</name> - <logicalName>部署名</logicalName> - <dataTypeDescriptor class="org.jiemamy.model.datatype.VarcharDataTypeDescriptor"> - <adapter class="org.jiemamy.model.datatype.adapter.SizedDataTypeAdapter"> - <size>20</size> - </adapter> - </dataTypeDescriptor> - <defaultValue/> - <notNull>false</notNull> - <simpleIndex>false</simpleIndex> - <freeString/> - <description/> - <options/> - <representation>true</representation> - </column> - <column id="7bf79e76-07b8-43b6-a993-b8ef374a31f5"> - <name>LOC</name> - <logicalName>ロケーション</logicalName> - <dataTypeDescriptor class="org.jiemamy.model.datatype.VarcharDataTypeDescriptor"> - <adapter class="org.jiemamy.model.datatype.adapter.SizedDataTypeAdapter"> - <size>20</size> - </adapter> - </dataTypeDescriptor> - <defaultValue>secret</defaultValue> - <notNull>false</notNull> - <simpleIndex>false</simpleIndex> - <freeString/> - <description/> - <options/> - <representation>false</representation> - </column> - </columns> - </table> - <table id="9f522e56-809c-45fd-8416-39201014218b"> - <name>T_EMP</name> - <logicalName>従業員</logicalName> - <sourceConnections> - <foreignKey ref="e43d3c43-33c8-4b02-aa42-83f2d868cfe6"/> - <foreignKey ref="e7dd92b4-1d97-4be6-bab6-fa9fe26eb6ed"/> - </sourceConnections> - <targetConnections> - <foreignKey ref="e43d3c43-33c8-4b02-aa42-83f2d868cfe6"/> - </targetConnections> - <beginScript>/* test end script */</beginScript> - <endScript/> - <description>従業員マスタです。</description> - <columns> - <column id="44c8e93d-b7ad-46cc-9b29-88c3a7d6c33e"> - <name>ID</name> - <logicalName>従業員ID</logicalName> - <dataTypeDescriptor ref="2eec0aa0-5122-4eb7-833d-9f5a43e7abe9"/> - <defaultValue/> - <notNull>false</notNull> - <freeString/> - <description/> - <options/> - <representation>false</representation> - </column> - <column id="248a429b-2159-4ebd-a791-eee42a059374"> - <name>EMP_NO</name> - <logicalName>従業員番号</logicalName> - <dataTypeDescriptor class="org.jiemamy.model.datatype.IntegerDataTypeDescriptor"/> - <defaultValue/> - <notNull>false</notNull> - <freeString/> - <description/> - <options/> - <representation>false</representation> - </column> - <column id="0e51b6df-43ab-408c-90ef-de13c6aab881"> - <name>EMP_NAME</name> - <dataTypeDescriptor ref="62f1e6ec-e6aa-4d52-a6c3-27dac086f2d7"/> - <defaultValue>no name</defaultValue> - <notNull>false</notNull> - <freeString/> - <description/> - <options/> - <representation>true</representation> - </column> - <column id="3d21a85a-72de-41b3-99dd-f4cb94e58d84"> - <name>MGR_ID</name> - <logicalName>上司ID</logicalName> - <dataTypeDescriptor class="org.jiemamy.model.datatype.IntegerDataTypeDescriptor"/> - <defaultValue/> - <notNull>false</notNull> - <freeString/> - <description/> - <options/> - <representation>false</representation> - </column> - <column id="f0b57eed-98ab-4c21-9855-218c592814dc"> - <name>HIREDATE</name> - <logicalName/> - <dataTypeDescriptor class="org.jiemamy.model.datatype.TimestampDataTypeDescriptor"> - <adapter class="org.jiemamy.model.datatype.adapter.TimezonedDataTypeAdapter"> - <timezone>false</timezone> - </adapter> - </dataTypeDescriptor> - <defaultValue/> - <notNull>false</notNull> - <freeString/> - <description/> - <options/> - <representation>false</representation> - </column> - <column id="80786549-dc2c-4c1c-bcbd-9f6fdec911d2"> - <name>SAL</name> - <logicalName/> - <dataTypeDescriptor class="org.jiemamy.model.datatype.NumericDataTypeDescriptor"> - <adapter class="org.jiemamy.model.datatype.adapter.PrecisionedDataTypeAdapter"> - <precision>7</precision> - <scale>2</scale> - </adapter> - </dataTypeDescriptor> - <defaultValue/> - <notNull>false</notNull> - <freeString/> - <description/> - <options/> - <representation>false</representation> - </column> - <column id="4ae69b7a-7a0e-422a-89dc-0f0cff77565b"> - <name>DEPT_ID</name> - <logicalName/> - <dataTypeDescriptor class="org.jiemamy.model.datatype.IntegerDataTypeDescriptor"/> - <defaultValue/> - <notNull>false</notNull> - <freeString/> - <description/> - <options/> - <representation>false</representation> - </column> - </columns> - </table> - <view id="516f7961-cb7b-48e2-990b-7fb0c750c3a4"> - <name>V_HIGH_SAL_EMP</name> - <logicalName>高給取り</logicalName> - <beginScript/> - <endScript/> - <description/> - <definition>SELECT * FROM T_EMP WHERE SAL > 2000;</definition> - </view> - <sticky id="43beb884-2562-4480-8030-bb797f701783"> - <contents>メモーー</contents> - </sticky> - </nodes> - <connections> - <foreignKey id="e43d3c43-33c8-4b02-aa42-83f2d868cfe6"> - <name>fkey_T_EMP_T_EMP_1225727057074</name> - <logicalName/> - <source ref="9f522e56-809c-45fd-8416-39201014218b"/> - <target ref="9f522e56-809c-45fd-8416-39201014218b"/> - <mappings> - <mapping id="081fedb4-ca8c-4c8d-b3a1-50be0783c244"> - <constraintColumn ref="3d21a85a-72de-41b3-99dd-f4cb94e58d84"/> - <referenceColumn ref="44c8e93d-b7ad-46cc-9b29-88c3a7d6c33e"/> - </mapping> - </mappings> - <matchType/> - <onDelete>SET_NULL</onDelete> - <onUpdate/> - <deferrable>true</deferrable> - <initiallyCheckTime>DEFERRED</initiallyCheckTime> - <description/> - </foreignKey> - <foreignKey id="e7dd92b4-1d97-4be6-bab6-fa9fe26eb6ed"> - <name>fkey_T_EMP_T_DEPT_1225727057074</name> - <logicalName/> - <source ref="9f522e56-809c-45fd-8416-39201014218b"/> - <target ref="d7489ed6-0add-443d-95cf-234376eb0455"/> - <mappings> - <mapping id="d66f6db7-5648-477a-8b87-5dce622c48e1"> - <constraintColumn ref="4ae69b7a-7a0e-422a-89dc-0f0cff77565b"/> - <referenceColumn ref="c7ed225d-92a6-4cc2-90de-60531804464e"/> - </mapping> - </mappings> - <matchType/> - <onDelete/> - <onUpdate/> - <deferrable>false</deferrable> - <initiallyCheckTime/> - <description/> - </foreignKey> - </connections> - <insertDataSetModels> - <dataSet id="6000"> - <name>データ群en</name> - <table ref="d7489ed6-0add-443d-95cf-234376eb0455"> - <record id="rec01"> - <column ref="c7ed225d-92a6-4cc2-90de-60531804464e">1</column> - <column ref="2d951389-6bc7-49d7-8631-1d26fe17047e">10</column> - <column ref="1fcd63d3-974e-4d2e-a0d8-3b9c233104d9">ACCOUNTING</column> - <column ref="7bf79e76-07b8-43b6-a993-b8ef374a31f5">NEW YORK</column> - </record> - <record id="rec02"> - <column ref="c7ed225d-92a6-4cc2-90de-60531804464e">2</column> - <column ref="2d951389-6bc7-49d7-8631-1d26fe17047e">20</column> - <column ref="1fcd63d3-974e-4d2e-a0d8-3b9c233104d9">RESEARCH</column> - <column ref="7bf79e76-07b8-43b6-a993-b8ef374a31f5">DALLAS</column> - </record> - <record id="rec03"> - <column ref="c7ed225d-92a6-4cc2-90de-60531804464e">3</column> - <column ref="2d951389-6bc7-49d7-8631-1d26fe17047e">30</column> - <column ref="1fcd63d3-974e-4d2e-a0d8-3b9c233104d9">SALES</column> - <column ref="7bf79e76-07b8-43b6-a993-b8ef374a31f5">CHICAGO</column> - </record> - <record id="rec04"> - <column ref="c7ed225d-92a6-4cc2-90de-60531804464e">4</column> - <column ref="2d951389-6bc7-49d7-8631-1d26fe17047e">40</column> - <column ref="1fcd63d3-974e-4d2e-a0d8-3b9c233104d9">OPERATIONS</column> - <column ref="7bf79e76-07b8-43b6-a993-b8ef374a31f5">BOSTON</column> - </record> - </table> - <table ref="9f522e56-809c-45fd-8416-39201014218b"> - <record id="rec11"> - <column ref="44c8e93d-b7ad-46cc-9b29-88c3a7d6c33e">1</column> - <column ref="248a429b-2159-4ebd-a791-eee42a059374">10</column> - <column ref="0e51b6df-43ab-408c-90ef-de13c6aab881">SMITH</column> - <column ref="3d21a85a-72de-41b3-99dd-f4cb94e58d84">3</column> - <column ref="f0b57eed-98ab-4c21-9855-218c592814dc">2003-02-01</column> - <column ref="80786549-dc2c-4c1c-bcbd-9f6fdec911d2">40</column> - <column ref="4ae69b7a-7a0e-422a-89dc-0f0cff77565b">3</column> - </record> - <record id="rec12"> - <column ref="44c8e93d-b7ad-46cc-9b29-88c3a7d6c33e">2</column> - <column ref="248a429b-2159-4ebd-a791-eee42a059374">20</column> - <column ref="0e51b6df-43ab-408c-90ef-de13c6aab881">ALLEN</column> - <column ref="3d21a85a-72de-41b3-99dd-f4cb94e58d84">3</column> - <column ref="f0b57eed-98ab-4c21-9855-218c592814dc">2003-03-04</column> - <column ref="80786549-dc2c-4c1c-bcbd-9f6fdec911d2">50</column> - <column ref="4ae69b7a-7a0e-422a-89dc-0f0cff77565b">4</column> - </record> - <record id="rec13"> - <column ref="44c8e93d-b7ad-46cc-9b29-88c3a7d6c33e">3</column> - <column ref="248a429b-2159-4ebd-a791-eee42a059374">30</column> - <column ref="0e51b6df-43ab-408c-90ef-de13c6aab881">WARD</column> - <column ref="3d21a85a-72de-41b3-99dd-f4cb94e58d84"/> - <column ref="f0b57eed-98ab-4c21-9855-218c592814dc">1993-12-05</column> - <column ref="80786549-dc2c-4c1c-bcbd-9f6fdec911d2">60</column> - <column ref="4ae69b7a-7a0e-422a-89dc-0f0cff77565b">4</column> - </record> - <record id="rec14"> - <column ref="44c8e93d-b7ad-46cc-9b29-88c3a7d6c33e">4</column> - <column ref="248a429b-2159-4ebd-a791-eee42a059374">40</column> - <column ref="0e51b6df-43ab-408c-90ef-de13c6aab881">JONES</column> - <column ref="3d21a85a-72de-41b3-99dd-f4cb94e58d84">2</column> - <column ref="f0b57eed-98ab-4c21-9855-218c592814dc">2007-04-01</column> - <column ref="80786549-dc2c-4c1c-bcbd-9f6fdec911d2">36</column> - <column ref="4ae69b7a-7a0e-422a-89dc-0f0cff77565b">2</column> - </record> - <record id="rec15"> - <column ref="44c8e93d-b7ad-46cc-9b29-88c3a7d6c33e">5</column> - <column ref="248a429b-2159-4ebd-a791-eee42a059374">50</column> - <column ref="0e51b6df-43ab-408c-90ef-de13c6aab881">MARTIN</column> - <column ref="3d21a85a-72de-41b3-99dd-f4cb94e58d84">1</column> - <column ref="f0b57eed-98ab-4c21-9855-218c592814dc">2002-05-30</column> - <column ref="80786549-dc2c-4c1c-bcbd-9f6fdec911d2">30</column> - <column ref="4ae69b7a-7a0e-422a-89dc-0f0cff77565b">3</column> - </record> - <record id="rec16"> - <column ref="44c8e93d-b7ad-46cc-9b29-88c3a7d6c33e">6</column> - <column ref="248a429b-2159-4ebd-a791-eee42a059374">60</column> - <column ref="0e51b6df-43ab-408c-90ef-de13c6aab881">BLAKE</column> - <column ref="3d21a85a-72de-41b3-99dd-f4cb94e58d84">3</column> - <column ref="f0b57eed-98ab-4c21-9855-218c592814dc">2007-04-01</column> - <column ref="80786549-dc2c-4c1c-bcbd-9f6fdec911d2">25</column> - <column ref="4ae69b7a-7a0e-422a-89dc-0f0cff77565b">2</column> - </record> - <record id="rec17"> - <column ref="44c8e93d-b7ad-46cc-9b29-88c3a7d6c33e">7</column> - <column ref="248a429b-2159-4ebd-a791-eee42a059374">70</column> - <column ref="0e51b6df-43ab-408c-90ef-de13c6aab881">CLARK</column> - <column ref="3d21a85a-72de-41b3-99dd-f4cb94e58d84">1</column> - <column ref="f0b57eed-98ab-4c21-9855-218c592814dc">2004-09-01</column> - <column ref="80786549-dc2c-4c1c-bcbd-9f6fdec911d2">30</column> - <column ref="4ae69b7a-7a0e-422a-89dc-0f0cff77565b">1</column> - </record> - <record id="rec18"> - <column ref="44c8e93d-b7ad-46cc-9b29-88c3a7d6c33e">8</column> - <column ref="248a429b-2159-4ebd-a791-eee42a059374">80</column> - <column ref="0e51b6df-43ab-408c-90ef-de13c6aab881">SCOTT</column> - <column ref="3d21a85a-72de-41b3-99dd-f4cb94e58d84">4</column> - <column ref="f0b57eed-98ab-4c21-9855-218c592814dc">2008-03-01</column> - <column ref="80786549-dc2c-4c1c-bcbd-9f6fdec911d2">25</column> - <column ref="4ae69b7a-7a0e-422a-89dc-0f0cff77565b">2</column> - </record> - </table> - </dataSet> - <dataSet id="6001"> - <name>データ群ja</name> - <table ref="d7489ed6-0add-443d-95cf-234376eb0455"> - <record id="rec21"> - <column ref="c7ed225d-92a6-4cc2-90de-60531804464e">1</column> - <column ref="2d951389-6bc7-49d7-8631-1d26fe17047e">10</column> - <column ref="1fcd63d3-974e-4d2e-a0d8-3b9c233104d9">経理部</column> - <column ref="7bf79e76-07b8-43b6-a993-b8ef374a31f5">広島</column> - </record> - <record id="rec22"> - <column ref="c7ed225d-92a6-4cc2-90de-60531804464e">2</column> - <column ref="2d951389-6bc7-49d7-8631-1d26fe17047e">20</column> - <column ref="1fcd63d3-974e-4d2e-a0d8-3b9c233104d9">研究開発部</column> - <column ref="7bf79e76-07b8-43b6-a993-b8ef374a31f5">京都</column> - </record> - <record id="rec23"> - <column ref="c7ed225d-92a6-4cc2-90de-60531804464e">3</column> - <column ref="2d951389-6bc7-49d7-8631-1d26fe17047e">30</column> - <column ref="1fcd63d3-974e-4d2e-a0d8-3b9c233104d9">営業部</column> - <column ref="7bf79e76-07b8-43b6-a993-b8ef374a31f5">東京</column> - </record> - <record id="rec24"> - <column ref="c7ed225d-92a6-4cc2-90de-60531804464e">4</column> - <column ref="2d951389-6bc7-49d7-8631-1d26fe17047e">40</column> - <column ref="1fcd63d3-974e-4d2e-a0d8-3b9c233104d9">経営本部</column> - </record> - </table> - <table ref="9f522e56-809c-45fd-8416-39201014218b"> - <record id="rec31"> - <column ref="44c8e93d-b7ad-46cc-9b29-88c3a7d6c33e">1</column> - <column ref="248a429b-2159-4ebd-a791-eee42a059374">10</column> - <column ref="0e51b6df-43ab-408c-90ef-de13c6aab881">鈴木 茂</column> - <column ref="3d21a85a-72de-41b3-99dd-f4cb94e58d84">3</column> - <column ref="f0b57eed-98ab-4c21-9855-218c592814dc">2003-02-01</column> - <column ref="80786549-dc2c-4c1c-bcbd-9f6fdec911d2">40</column> - <column ref="4ae69b7a-7a0e-422a-89dc-0f0cff77565b">3</column> - </record> - <record id="rec32"> - <column ref="44c8e93d-b7ad-46cc-9b29-88c3a7d6c33e">2</column> - <column ref="248a429b-2159-4ebd-a791-eee42a059374">20</column> - <column ref="0e51b6df-43ab-408c-90ef-de13c6aab881">内海 透</column> - <column ref="3d21a85a-72de-41b3-99dd-f4cb94e58d84">3</column> - <column ref="f0b57eed-98ab-4c21-9855-218c592814dc">2003-03-04</column> - <column ref="80786549-dc2c-4c1c-bcbd-9f6fdec911d2">50</column> - <column ref="4ae69b7a-7a0e-422a-89dc-0f0cff77565b">4</column> - </record> - <record id="rec33"> - <column ref="44c8e93d-b7ad-46cc-9b29-88c3a7d6c33e">3</column> - <column ref="248a429b-2159-4ebd-a791-eee42a059374">30</column> - <column ref="0e51b6df-43ab-408c-90ef-de13c6aab881">村瀬 武彦</column> - <column ref="3d21a85a-72de-41b3-99dd-f4cb94e58d84"/> - <column ref="f0b57eed-98ab-4c21-9855-218c592814dc">1993-12-05</column> - <column ref="80786549-dc2c-4c1c-bcbd-9f6fdec911d2">60</column> - <column ref="4ae69b7a-7a0e-422a-89dc-0f0cff77565b">4</column> - </record> - <record id="rec34"> - <column ref="44c8e93d-b7ad-46cc-9b29-88c3a7d6c33e">4</column> - <column ref="248a429b-2159-4ebd-a791-eee42a059374">40</column> - <column ref="0e51b6df-43ab-408c-90ef-de13c6aab881">近藤 美樹</column> - <column ref="3d21a85a-72de-41b3-99dd-f4cb94e58d84">2</column> - <column ref="f0b57eed-98ab-4c21-9855-218c592814dc">2007-04-01</column> - <column ref="80786549-dc2c-4c1c-bcbd-9f6fdec911d2">36</column> - <column ref="4ae69b7a-7a0e-422a-89dc-0f0cff77565b">2</column> - </record> - <record id="rec35"> - <column ref="44c8e93d-b7ad-46cc-9b29-88c3a7d6c33e">5</column> - <column ref="248a429b-2159-4ebd-a791-eee42a059374">50</column> - <column ref="0e51b6df-43ab-408c-90ef-de13c6aab881">榊 美子</column> - <column ref="3d21a85a-72de-41b3-99dd-f4cb94e58d84">1</column> - <column ref="f0b57eed-98ab-4c21-9855-218c592814dc">2002-05-30</column> - <column ref="80786549-dc2c-4c1c-bcbd-9f6fdec911d2">30</column> - <column ref="4ae69b7a-7a0e-422a-89dc-0f0cff77565b">3</column> - </record> - <record id="rec36"> - <column ref="44c8e93d-b7ad-46cc-9b29-88c3a7d6c33e">6</column> - <column ref="248a429b-2159-4ebd-a791-eee42a059374">60</column> - <column ref="0e51b6df-43ab-408c-90ef-de13c6aab881">三浦 佑</column> - <column ref="3d21a85a-72de-41b3-99dd-f4cb94e58d84">3</column> - <column ref="f0b57eed-98ab-4c21-9855-218c592814dc">2007-04-01</column> - <column ref="80786549-dc2c-4c1c-bcbd-9f6fdec911d2">25</column> - <column ref="4ae69b7a-7a0e-422a-89dc-0f0cff77565b">2</column> - </record> - <record id="rec37"> - <column ref="44c8e93d-b7ad-46cc-9b29-88c3a7d6c33e">7</column> - <column ref="248a429b-2159-4ebd-a791-eee42a059374">70</column> - <column ref="0e51b6df-43ab-408c-90ef-de13c6aab881">前島 孝幸</column> - <column ref="3d21a85a-72de-41b3-99dd-f4cb94e58d84">1</column> - <column ref="f0b57eed-98ab-4c21-9855-218c592814dc">2004-09-01</column> - <column ref="80786549-dc2c-4c1c-bcbd-9f6fdec911d2">30</column> - <column ref="4ae69b7a-7a0e-422a-89dc-0f0cff77565b">1</column> - </record> - <record id="rec38"> - <column ref="44c8e93d-b7ad-46cc-9b29-88c3a7d6c33e">8</column> - <column ref="248a429b-2159-4ebd-a791-eee42a059374">80</column> - <column ref="0e51b6df-43ab-408c-90ef-de13c6aab881">島崎 由比</column> - <column ref="3d21a85a-72de-41b3-99dd-f4cb94e58d84">4</column> - <column ref="f0b57eed-98ab-4c21-9855-218c592814dc">2008-03-01</column> - <column ref="80786549-dc2c-4c1c-bcbd-9f6fdec911d2">25</column> - <column ref="4ae69b7a-7a0e-422a-89dc-0f0cff77565b">2</column> - </record> - </table> - </dataSet> - </insertDataSetModels> - <view:diagramPresentations> - <view:diagramPresentation> - <name>全部表示する</name> - <view:node ref="d7489ed6-0add-443d-95cf-234376eb0455" x="360" y="60" width="-1" height="-1" color="#ff00ff"/> - <view:node ref="9f522e56-809c-45fd-8416-39201014218b" x="60" y="60" width="-1" height="-1" color="#ff00ff"/> - <view:node ref="516f7961-cb7b-48e2-990b-7fb0c750c3a4" x="60" y="270" width="-1" height="-1" color="#ff00ff"/> - <view:node ref="43beb884-2562-4480-8030-bb797f701783" x="360" y="270" width="-1" height="-1" color="#ff00ff"/> - <view:connection ref="e43d3c43-33c8-4b02-aa42-83f2d868cfe6"/> - <view:connection ref="e7dd92b4-1d97-4be6-bab6-fa9fe26eb6ed"> - <view:bendpoint x="310" y="60" /> - <view:bendpoint x="360" y="10" /> - </view:connection> - </view:diagramPresentation> - <view:diagramPresentation> - <name>一部表示する</name> - <view:node ref="d7489ed6-0add-443d-95cf-234376eb0455" x="60" y="60" width="-1" height="-1" color="#ff00ff"/> - <view:node ref="516f7961-cb7b-48e2-990b-7fb0c750c3a4" x="270" y="270" width="-1" height="-1" color="#ff00ff"/> - <view:connection ref="e43d3c43-33c8-4b02-aa42-83f2d868cfe6"/> - </view:diagramPresentation> - </view:diagramPresentations> -</rootModel> - Modified: vesta/trunk/org.jiemamy.eclipse/.project =================================================================== --- vesta/trunk/org.jiemamy.eclipse/.project 2008-12-27 17:43:07 UTC (rev 2326) +++ vesta/trunk/org.jiemamy.eclipse/.project 2008-12-29 05:37:47 UTC (rev 2327) @@ -50,14 +50,14 @@ </natures> <linkedResources> <link> - <name>.fbprefs</name> + <name>findbugs.xml</name> <type>1</type> - <locationURI>DOCUMENTS/org.jiemamy.project/.fbprefs</locationURI> + <locationURI>DOCUMENTS/org.jiemamy.project/findbugs.xml</locationURI> </link> <link> - <name>findbugs.xml</name> + <name>.fbprefs</name> <type>1</type> - <locationURI>DOCUMENTS/org.jiemamy.project/findbugs.xml</locationURI> + <locationURI>DOCUMENTS/org.jiemamy.project/.fbprefs</locationURI> </link> <link> <name>.checkstyle</name> Modified: vesta/trunk/org.jiemamy.eclipse/META-INF/MANIFEST.MF =================================================================== --- vesta/trunk/org.jiemamy.eclipse/META-INF/MANIFEST.MF 2008-12-27 17:43:07 UTC (rev 2326) +++ vesta/trunk/org.jiemamy.eclipse/META-INF/MANIFEST.MF 2008-12-29 05:37:47 UTC (rev 2327) @@ -34,7 +34,6 @@ org.jiemamy.core, org.jiemamy.event, org.jiemamy.view, - org.jiemamy.serializer, org.jiemamy.dialect.mysql, org.jiemamy.dialect.postgresql, org.jiemamy.dialect.sql99, @@ -47,7 +46,6 @@ org.jiemamy.core, org.jiemamy.event, org.jiemamy.view, - org.jiemamy.serializer, org.jiemamy.dialect.mysql, org.jiemamy.dialect.postgresql, org.jiemamy.dialect.sql99, Modified: vesta/trunk/org.jiemamy.eclipse/pom.xml =================================================================== --- vesta/trunk/org.jiemamy.eclipse/pom.xml 2008-12-27 17:43:07 UTC (rev 2326) +++ vesta/trunk/org.jiemamy.eclipse/pom.xml 2008-12-29 05:37:47 UTC (rev 2327) @@ -208,17 +208,6 @@ <artifactId>org.jiemamy.view</artifactId> <version>${project.version}</version> </dependency> - <dependency> - <groupId>${project.groupId}</groupId> - <artifactId>org.jiemamy.serializer</artifactId> - <version>${project.version}</version> - <exclusions> - <exclusion> - <groupId>org.jiemamy</groupId> - <artifactId>org.jiemamy.core</artifactId> - </exclusion> - </exclusions> - </dependency> <dependency> <groupId>org.seasar.eclipsecommon</groupId> <artifactId>eclipse-common</artifactId>