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

* extracted method

parent dd0ef492
Loading
Loading
Loading
Loading
+18 −13
Original line number Diff line number Diff line
@@ -111,19 +111,7 @@ public class Validator {

			for (String part : constraints) {
				String source = "epsilon/constraints/"+part;
				URI uri = new File(source).toURI();
				//FIXED: also for TO? -> should work with all now
				if (Platform.isRunning()) {
					//System.out.println("Running as plugin...");
					Bundle bundle = Platform.getBundle("org.etsi.mts.tdl.constraints");
					URL url = bundle.getEntry(source);
					uri = url.toURI();
				} else {
					//WS
					String binPath=this.getClass().getProtectionDomain().getCodeSource().getLocation().getPath();
					String projectPath = new File(binPath).getParent();
					uri = new File(projectPath+"/"+source).toURI();
				}
				URI uri = getSourceUri(source);
				
				EvlModule module = new EvlModule();
				module.parse(uri);
@@ -188,6 +176,23 @@ public class Validator {
		return violations;
	}

	private URI getSourceUri(String source) throws URISyntaxException {
		URI uri = new File(source).toURI();
		//FIXED: also for TO? -> should work with all now
		if (Platform.isRunning()) {
			//System.out.println("Running as plugin...");
			Bundle bundle = Platform.getBundle("org.etsi.mts.tdl.constraints");
			URL url = bundle.getEntry(source);
			uri = url.toURI();
		} else {
			//WS
			String binPath=this.getClass().getProtectionDomain().getCodeSource().getLocation().getPath();
			String projectPath = new File(binPath).getParent();
			uri = new File(projectPath+"/"+source).toURI();
		}
		return uri;
	}

	public void dumpViolations(List<UnsatisfiedConstraint> violations, boolean includeLocation) {
		for (UnsatisfiedConstraint constraint : violations) {
			System.out.println("  Validator: " + constraint.getMessage());