diff --git a/plugins/org.etsi.mts.tdl.constraints/src/org/etsi/mts/tdl/constraints/evl/Validator.java b/plugins/org.etsi.mts.tdl.constraints/src/org/etsi/mts/tdl/constraints/evl/Validator.java index d4f511d9b1c0b1280cc84c780dbca2d65f8db7ef..d067539d0e793e86eca53bd72ed482916fcdec04 100644 --- a/plugins/org.etsi.mts.tdl.constraints/src/org/etsi/mts/tdl/constraints/evl/Validator.java +++ b/plugins/org.etsi.mts.tdl.constraints/src/org/etsi/mts/tdl/constraints/evl/Validator.java @@ -64,9 +64,18 @@ public class Validator { //TODO: also for TO? Bundle bundle = Platform.getBundle("org.etsi.mts.tdl.constraints"); - String moduleSource = bundle.getLocation().substring(15)+source; + URL url = bundle.getEntry(source); - IEolExecutableModule module = loadModule(moduleSource); + IEolExecutableModule module = new EvlModule(); + 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()); + } + } IModel tdlModel = getTDLModel(r, true, false); tdlModel.load(); @@ -94,30 +103,7 @@ public class Validator { return violations; } - 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; - } - + //TODO: extract to shared library public IModel getTDLModel(Resource resource, boolean read, boolean write) throws Exception { EmfModel model; model = new InMemoryEmfModel("TDL", resource, tdlPackage.eINSTANCE);