Commit d16e558c authored by Philip Makedonski's avatar Philip Makedonski
Browse files

* refined transformation script loading for target platform deployment


* relocated transformation scripts

Change-Id: I9314552f59f055fa36cc6a2b6e7a42ea534b6342
Signed-off-by: Philip Makedonski's avatarmakedonski <makedonski@informatik.uni-goettingen.de>
parent cdb742a4
......@@ -3,5 +3,6 @@
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8"/>
<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
<classpathentry kind="src" path="src"/>
<classpathentry kind="src" path="epsilon"/>
<classpathentry kind="output" path="bin"/>
</classpath>
......@@ -9,8 +9,8 @@ Require-Bundle: org.eclipse.emf.common,
org.eclipse.core.runtime,
org.eclipse.emf.ecore,
org.eclipse.osgi,
de.ugoe.cs.swe.TTCN3,
org.etsi.mts.tdl.model,
de.ugoe.cs.swe.TTCN3,
org.eclipse.epsilon.common,
org.eclipse.epsilon.emc.emf,
org.eclipse.epsilon.eol.engine,
......
source.. = src/
output.. = bin/
bin.includes = META-INF/,\
.
.,\
epsilon/
package org.etsi.mts.tdl.ttcn3;
import java.io.File;
import java.net.URISyntaxException;
import java.net.URL;
import org.eclipse.core.runtime.Platform;
import org.eclipse.emf.ecore.resource.Resource;
import org.eclipse.epsilon.common.parse.problem.ParseProblem;
import org.eclipse.epsilon.emc.emf.EmfModel;
import org.eclipse.epsilon.emc.emf.InMemoryEmfModel;
import org.eclipse.epsilon.eol.EolModule;
import org.eclipse.epsilon.eol.IEolExecutableModule;
import org.eclipse.epsilon.eol.models.IModel;
import org.eclipse.epsilon.etl.EtlModule;
......@@ -20,13 +18,24 @@ import de.ugoe.cs.swe.tTCN3.TTCN3Package;
public class Transform {
public void transform(Resource r, Resource tr) {
try {
String source = "src/org/etsi/mts/tdl/ttcn3/epsilon/ttcn3mapping.etl";
//load transformation scripts
String source = "epsilon/ttcn3mapping.etl";
Bundle bundle = Platform.getBundle("org.etsi.mts.tdl.ttcn3");
String moduleSource = bundle.getLocation().substring(15)+source;
IEolExecutableModule module = loadModule(moduleSource);
URL url = bundle.getEntry(source);
IEolExecutableModule module = new EtlModule();
module.parse(url.toURI());
//TODO: integrate error reporting
if (module.getParseProblems().size() > 0) {
System.err.println("Parse errors occured...");
for (ParseProblem problem : module.getParseProblems()) {
System.err.println(problem.toString());
}
}
//load models
IModel tdlModel = getTDLModel(r, true, false);
IModel ttcnModel = getTTCNModel(tr, false, true);
tdlModel.load();
......@@ -48,30 +57,6 @@ public class Transform {
}
//TODO: extract to shared library
private IEolExecutableModule loadModule(String source) throws Exception, URISyntaxException {
IEolExecutableModule module = null;
if (source.endsWith("etl")) {
module = new EtlModule();
} else if (source.endsWith("eol")) {
module = new EolModule();
// } else if (source.endsWith("evl")) {
// module = new EvlModule();
} else {
}
module.parse(new File(source));
if (module.getParseProblems().size() > 0) {
System.err.println("Parse errors occured...");
for (ParseProblem problem : module.getParseProblems()) {
System.err.println(problem.toString());
}
}
return module;
}
public IModel getTDLModel(Resource resource, boolean read, boolean write) throws Exception {
EmfModel model;
model = new InMemoryEmfModel("TDL", resource, tdlPackage.eINSTANCE);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment