Introduce Bpmn2XmiResource

In addition to the special XML resource, provide a BPMN specific
XMIResource implementation and register it for the extension
"bpmn2xmi".

This is needed for suppressing the serialization of attributes only
relevant for schema-conform XML.
diff --git a/org.eclipse.bpmn2.tests/res/basic.xmi b/org.eclipse.bpmn2.tests/res/basic.bpmn2xmi
similarity index 100%
rename from org.eclipse.bpmn2.tests/res/basic.xmi
rename to org.eclipse.bpmn2.tests/res/basic.bpmn2xmi
diff --git a/org.eclipse.bpmn2.tests/src/org/eclipse/bpmn2/tests/XMISerializationTest.java b/org.eclipse.bpmn2.tests/src/org/eclipse/bpmn2/tests/XMISerializationTest.java
index 3dcc31c..616fd09 100644
--- a/org.eclipse.bpmn2.tests/src/org/eclipse/bpmn2/tests/XMISerializationTest.java
+++ b/org.eclipse.bpmn2.tests/src/org/eclipse/bpmn2/tests/XMISerializationTest.java
@@ -16,6 +16,7 @@
 
 import org.eclipse.bpmn2.Bpmn2Package;
 import org.eclipse.bpmn2.Definitions;
+import org.eclipse.bpmn2.util.Bpmn2XMIResourceFactoryImpl;
 import org.eclipse.emf.common.EMFPlugin;
 import org.eclipse.emf.ecore.resource.Resource;
 import org.eclipse.emf.ecore.xmi.XMIResource;
@@ -30,7 +31,7 @@
  *
  */
 public class XMISerializationTest extends XMLSerializationTest {
-    private static final String EXTENSION_XMI = "xmi";
+    private static final String EXTENSION_XMI = "bpmn2xmi";
 
     /**
      * Overrides the superclass method, instead registering the default XMI resource factory. 
@@ -39,7 +40,7 @@
     public void setUpResourceFactoryRegistry() {
         if (!EMFPlugin.IS_ECLIPSE_RUNNING)
             Resource.Factory.Registry.INSTANCE.getExtensionToFactoryMap().put(EXTENSION_XMI,
-                    new XMIResourceFactoryImpl());
+                    new Bpmn2XMIResourceFactoryImpl());
     }
 
     /**
diff --git a/org.eclipse.bpmn2/plugin.xml b/org.eclipse.bpmn2/plugin.xml
index 0515ff1..4d70591 100644
--- a/org.eclipse.bpmn2/plugin.xml
+++ b/org.eclipse.bpmn2/plugin.xml
@@ -34,6 +34,10 @@
       <parser

             type="bpmn2"

             class="org.eclipse.bpmn2.util.Bpmn2ResourceFactoryImpl"/>

+      <parser

+            class="org.eclipse.bpmn2.util.Bpmn2XMIResourceFactoryImpl"

+            type="bpmn2xmi">

+      </parser>

    </extension>

 

    <extension point="org.eclipse.emf.ecore.generated_package">

diff --git a/org.eclipse.bpmn2/src/org/eclipse/bpmn2/util/Bpmn2XMIResourceFactoryImpl.java b/org.eclipse.bpmn2/src/org/eclipse/bpmn2/util/Bpmn2XMIResourceFactoryImpl.java
new file mode 100644
index 0000000..fe3b163
--- /dev/null
+++ b/org.eclipse.bpmn2/src/org/eclipse/bpmn2/util/Bpmn2XMIResourceFactoryImpl.java
@@ -0,0 +1,52 @@
+/**
+ * <copyright>
+ * 
+ * Copyright (c) 2010 SAP AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ * 
+ * Contributors:
+ *    Reiner Hille-Doering (SAP AG) - initial API and implementation and/or initial documentation
+ * 
+ * </copyright>
+ *
+ */
+package org.eclipse.bpmn2.util;
+
+import org.eclipse.emf.common.util.URI;
+import org.eclipse.emf.ecore.resource.Resource;
+import org.eclipse.emf.ecore.resource.impl.ResourceFactoryImpl;
+
+/**
+ * <!-- begin-user-doc -->
+ * The <b>Resource Factory</b> associated with the package.
+ * <!-- end-user-doc -->
+ * @see org.eclipse.bpmn2.util.Bpmn2ResourceImpl
+ * @generated
+ */
+public class Bpmn2XMIResourceFactoryImpl extends ResourceFactoryImpl {
+    /**
+     * Creates an instance of the resource factory.
+     * <!-- begin-user-doc -->
+     * <!-- end-user-doc -->
+     * @generated
+     */
+    public Bpmn2XMIResourceFactoryImpl() {
+        super();
+    }
+
+    /**
+     * Creates an instance of the resource.
+     * <!-- begin-user-doc -->
+     * <!-- end-user-doc -->
+     * @generated
+     */
+    @Override
+    public Resource createResource(URI uri) {
+        Resource result = new Bpmn2XMIResourceImpl(uri);
+        return result;
+    }
+
+} //Bpmn2ResourceFactoryImpl
diff --git a/org.eclipse.bpmn2/src/org/eclipse/bpmn2/util/Bpmn2XMIResourceImpl.java b/org.eclipse.bpmn2/src/org/eclipse/bpmn2/util/Bpmn2XMIResourceImpl.java
new file mode 100644
index 0000000..bf26f26
--- /dev/null
+++ b/org.eclipse.bpmn2/src/org/eclipse/bpmn2/util/Bpmn2XMIResourceImpl.java
@@ -0,0 +1,40 @@
+/**
+ * Copyright (c) 2010 Henning Heitkoetter.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ * 
+ * Contributors:
+ *    Henning Heitkoetter - initial API and implementation
+ */
+package org.eclipse.bpmn2.util;
+
+import org.eclipse.bpmn2.Bpmn2Package;
+import org.eclipse.emf.common.util.URI;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.ecore.EStructuralFeature;
+import org.eclipse.emf.ecore.xmi.XMLSave;
+import org.eclipse.emf.ecore.xmi.impl.XMIResourceImpl;
+import org.eclipse.emf.ecore.xmi.impl.XMISaveImpl;
+
+/**
+ * <!-- begin-user-doc -->
+ * The <b>Resource </b> associated with the package.
+ * <!-- end-user-doc -->
+ * @see org.eclipse.bpmn2.util.Bpmn2ResourceFactoryImpl
+ * @generated
+ */
+public class Bpmn2XMIResourceImpl extends XMIResourceImpl {
+    /**
+     * Creates an instance of the resource.
+     * <!-- begin-user-doc -->
+     * <!-- end-user-doc -->
+     * @param uri the URI of the new resource.
+     * @generated
+     */
+    public Bpmn2XMIResourceImpl(URI uri) {
+        super(uri);
+    }
+
+} //Bpmn2ResourceImpl