Skip to content
Snippets Groups Projects
Commit 161419e1 authored by Simon Barner's avatar Simon Barner
Browse files

- Use schema / MM specific Resource.Factory also for save()ing

parent 1a3c67c4
No related branches found
No related tags found
No related merge requests found
......@@ -33,7 +33,6 @@ import org.eclipse.emf.ecore.resource.Resource;
import org.eclipse.emf.ecore.resource.ResourceSet;
import org.eclipse.emf.ecore.resource.impl.ResourceSetImpl;
import org.eclipse.emf.ecore.xmi.XMLResource;
import org.eclipse.emf.ecore.xmi.impl.XMLResourceFactoryImpl;
import org.osgi.framework.Bundle;
/**
......@@ -43,7 +42,7 @@ import org.osgi.framework.Bundle;
* @author barner
* @author $Author$
* @version $Rev$
* @ConQAT.Rating YELLOW Hash: 55E1AD7060144688DF8479369724773A
* @ConQAT.Rating YELLOW Hash: B79585D91D30A107C87BF4517541AFEE
*/
public abstract class EcoreSerializerBase<R extends EObject> {
......@@ -109,7 +108,7 @@ public abstract class EcoreSerializerBase<R extends EObject> {
* @throws IOException
*/
public final R load(final URI uri) throws IOException {
ResourceSet resourceSet = createResourceSet(resourceFactory);
ResourceSet resourceSet = createResourceSet();
Resource resource = resourceSet.getResource(uri, true);
return getRootElement(resource.getContents().get(0));
......@@ -140,7 +139,7 @@ public abstract class EcoreSerializerBase<R extends EObject> {
* @throws IOException
*/
public final void save(final R rootElement, final URI uri) throws IOException {
ResourceSet resourceSet = createResourceSet(new XMLResourceFactoryImpl());
ResourceSet resourceSet = createResourceSet();
Resource resource = resourceSet.createResource(uri);
if(resource instanceof XMLResource) {
......@@ -240,8 +239,7 @@ public abstract class EcoreSerializerBase<R extends EObject> {
*
* @throws IOException
*/
private final ResourceSet createResourceSet(final Resource.Factory resourceFactory)
throws IOException {
private final ResourceSet createResourceSet() throws IOException {
ResourceSet resourceSet = new ResourceSetImpl();
resourceSet.getPackageRegistry().put(eNsURI, ePackage);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment