Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
MelangeResource returns its own URI when queried
  • Loading branch information
Thomas Degueule committed Apr 30, 2015
1 parent c166a55 commit ab4e69b
Showing 1 changed file with 9 additions and 2 deletions.
@@ -1,15 +1,16 @@
package fr.inria.diverse.melange.resource

import fr.inria.diverse.melange.resource.loader.DozerLoader
import java.io.IOException
import java.util.Map
import org.eclipse.emf.common.util.AbstractTreeIterator
import org.eclipse.emf.common.util.URI
import org.eclipse.emf.ecore.EObject
import org.eclipse.emf.ecore.EPackage
import org.eclipse.emf.ecore.resource.Resource
import org.eclipse.emf.ecore.resource.impl.ResourceSetImpl
import org.eclipse.emf.ecore.xmi.impl.XMIResourceImpl
import org.eclipse.xtend.lib.annotations.Delegate
import fr.inria.diverse.melange.resource.loader.DozerLoader
import fr.inria.diverse.melange.resource.loader.ExtensionsAwareLoader

class MelangeResourceUtils
{
Expand Down Expand Up @@ -52,13 +53,15 @@ class MelangeResourceImpl implements Resource.Internal
@Delegate Resource.Internal wrappedResource
String expectedMt
String expectedMm
URI melangeUri
DozerLoader loader = new DozerLoader

new(URI uri) {
// FIXME: Retrieve the currently-used one
val rs = new ResourceSetImpl
val query = uri.query.split("=")

melangeUri = uri
wrappedResource = rs.getResource(MelangeResourceUtils.melangeToFallbackURI(uri), true) as Resource.Internal

if (query.head == "mt")
Expand Down Expand Up @@ -156,6 +159,10 @@ class MelangeResourceImpl implements Resource.Internal
// FIXME: Should perform adaptation here
throw new UnsupportedOperationException("FIXME: Should perform adaptation here")
}

override getURI() {
return melangeUri
}
}

class MelangeResourceException extends RuntimeException {
Expand Down

0 comments on commit ab4e69b

Please sign in to comment.