[295057] Introduce InternalTransformation executor class
diff --git a/plugins/org.eclipse.m2m.qvt.oml/src/org/eclipse/m2m/internal/qvt/oml/ExecutionDiagnosticImpl.java b/plugins/org.eclipse.m2m.qvt.oml/src/org/eclipse/m2m/internal/qvt/oml/ExecutionDiagnosticImpl.java
new file mode 100644
index 0000000..61f5f1b
--- /dev/null
+++ b/plugins/org.eclipse.m2m.qvt.oml/src/org/eclipse/m2m/internal/qvt/oml/ExecutionDiagnosticImpl.java
@@ -0,0 +1,76 @@
+/*******************************************************************************
+ * Copyright (c) 2009 Eclipse Modeling Project and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ *     Radek Dvorak - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.m2m.internal.qvt.oml;
+
+import java.io.PrintWriter;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+
+import org.eclipse.emf.common.util.BasicDiagnostic;
+import org.eclipse.emf.common.util.Diagnostic;
+import org.eclipse.m2m.internal.qvt.oml.evaluator.QvtRuntimeException;
+import org.eclipse.m2m.qvt.oml.ExecutionDiagnostic;
+import org.eclipse.m2m.qvt.oml.ExecutionStackTraceElement;
+
+/**
+ * A diagnostic class representing the result status of a transformation
+ * execution.
+ * 
+ * @since 3.0
+ * 
+ * @noextend This class is not intended to be sub-classed by clients.
+ */
+public final class ExecutionDiagnosticImpl extends BasicDiagnostic implements ExecutionDiagnostic {
+	
+	public static final ExecutionDiagnosticImpl OK_INSTANCE = new ExecutionDiagnosticImpl(
+			Diagnostic.OK, 0, "OK", null); //$NON-NLS-1$
+
+	// instance fields
+
+	private List<ExecutionStackTraceElement> fStackTrace;
+
+	public ExecutionDiagnosticImpl(int severity, int code, String message, Object[] data) {
+		super(severity, SOURCE, code, message, data);
+	}
+
+	public ExecutionDiagnosticImpl(int severity, int code, String message) {
+		super(severity, SOURCE, code, message, null);
+	}
+
+	public void setStackTrace(List<? extends ExecutionStackTraceElement> stackElements) {
+		fStackTrace = new ArrayList<ExecutionStackTraceElement>(stackElements);
+	}
+
+	/**
+	 * Gets the stack trace that resulted from interrupted execution either by
+	 * user termination request or exception thrown
+	 * 
+	 * @return list of trace elements or an empty list
+	 */
+	public List<ExecutionStackTraceElement> getStackTrace() {
+		return fStackTrace != null ? Collections.unmodifiableList(fStackTrace)
+				: Collections.<ExecutionStackTraceElement> emptyList();
+	}
+
+	/**
+	 * Prints the execution stack-trace (if available) of this diagnostic to the
+	 * specified print writer.
+	 * 
+	 * @param writer
+	 *            <code>PrintWriter</code> to use for output
+	 */
+	public void printStackTrace(PrintWriter writer) {
+		if (fStackTrace != null) {
+			QvtRuntimeException.printQvtStackTrace(writer, fStackTrace);
+		}
+	}
+}
diff --git a/plugins/org.eclipse.m2m.qvt.oml/src/org/eclipse/m2m/qvt/oml/InternalTransformationExecutor.java b/plugins/org.eclipse.m2m.qvt.oml/src/org/eclipse/m2m/internal/qvt/oml/InternalTransformationExecutor.java
similarity index 88%
rename from plugins/org.eclipse.m2m.qvt.oml/src/org/eclipse/m2m/qvt/oml/InternalTransformationExecutor.java
rename to plugins/org.eclipse.m2m.qvt.oml/src/org/eclipse/m2m/internal/qvt/oml/InternalTransformationExecutor.java
index 1b64c71..2dafc15 100644
--- a/plugins/org.eclipse.m2m.qvt.oml/src/org/eclipse/m2m/qvt/oml/InternalTransformationExecutor.java
+++ b/plugins/org.eclipse.m2m.qvt.oml/src/org/eclipse/m2m/internal/qvt/oml/InternalTransformationExecutor.java
@@ -1,15 +1,14 @@
 /*******************************************************************************
- * Copyright (c) 2009 Borland Software Corporation
- * 
+ * Copyright (c) 2009 Eclipse Modeling Project and others.
  * All rights reserved. This program and the accompanying materials
  * are made available under the terms of the Eclipse Public License v1.0
  * which accompanies this distribution, and is available at
  * http://www.eclipse.org/legal/epl-v10.html
- *   
+ *
  * Contributors:
- *     Borland Software Corporation - initial API and implementation
+ *     Radek Dvorak - initial API and implementation
  *******************************************************************************/
-package org.eclipse.m2m.qvt.oml;
+package org.eclipse.m2m.internal.qvt.oml;
 
 import java.util.ArrayList;
 import java.util.List;
@@ -26,9 +25,6 @@
 import org.eclipse.emf.ecore.EPackage;
 import org.eclipse.emf.ecore.EParameter;
 import org.eclipse.emf.ecore.EStructuralFeature;
-import org.eclipse.m2m.internal.qvt.oml.Messages;
-import org.eclipse.m2m.internal.qvt.oml.NLS;
-import org.eclipse.m2m.internal.qvt.oml.QvtMessage;
 import org.eclipse.m2m.internal.qvt.oml.ast.env.ModelParameterExtent;
 import org.eclipse.m2m.internal.qvt.oml.ast.env.QvtOperationalEnv;
 import org.eclipse.m2m.internal.qvt.oml.ast.env.QvtOperationalEnvFactory;
@@ -54,14 +50,16 @@
 import org.eclipse.m2m.internal.qvt.oml.expressions.OperationalTransformation;
 import org.eclipse.m2m.internal.qvt.oml.library.Context;
 import org.eclipse.m2m.internal.qvt.oml.library.IContext;
+import org.eclipse.m2m.qvt.oml.ExecutionContext;
+import org.eclipse.m2m.qvt.oml.ExecutionDiagnostic;
+import org.eclipse.m2m.qvt.oml.ModelExtent;
 import org.eclipse.ocl.EvaluationVisitor;
 import org.eclipse.ocl.ecore.CallOperationAction;
 import org.eclipse.ocl.ecore.Constraint;
 import org.eclipse.ocl.ecore.SendSignalAction;
 
 /**
- * A utility class that enables to execute existing transformation in the
- * specified execution context.
+ * Internal transformation executor
  * 
  * @since 3.0
  */
@@ -70,7 +68,7 @@
 	private URI fURI;
 	private EPackage.Registry fPackageRegistry;
 	private CompiledUnit fCompiledUnit;
-	private ExecutionDiagnostic fLoadDiagnostic;
+	private ExecutionDiagnosticImpl fLoadDiagnostic;
 	private OperationalTransformation fTransformation;
 
 	/**
@@ -88,11 +86,7 @@
 
 		fURI = uri;
 	}
-	
-	public CompiledUnit getUnit() {
-		return fCompiledUnit;
-	}
-	
+		
 	public InternalTransformationExecutor(URI uri, EPackage.Registry registry) {
 		this(uri);
 		
@@ -119,6 +113,21 @@
 		}
 		return fLoadDiagnostic;
 	}
+	
+	/**
+	 * Retrieves compiled unit if the referencing URI gets successfully resolved
+	 * <p>
+	 * <b>Remark</b>: This method invocation causes the referenced transformation to
+	 * load if not already done before by direct call to
+	 * {@linkplain #loadTransformation()} or
+	 * {@linkplain #execute(ExecutionContext, ModelExtent...)}
+	 * 
+	 * @return compiled unit or <code>null</code> if it failed to be obtained
+	 */
+	public CompiledUnit getUnit() {
+		loadTransformation();
+		return fCompiledUnit;
+	}	
 
 	/**
 	 * Executes the transformation referred by this executor using the given
@@ -197,7 +206,7 @@
 			try {
 				args[i++].setContents(allRootElements);
 			} catch (UnsupportedOperationException e) {
-				return new ExecutionDiagnostic(Diagnostic.ERROR,
+				return new ExecutionDiagnosticImpl(Diagnostic.ERROR,
 						ExecutionDiagnostic.MODEL_PARAMETER_MISMATCH, NLS
 								.bind(Messages.ReadOnlyExtentModificationError,
 										i - 1));
@@ -208,11 +217,11 @@
 	}
 
 	private void doLoad() {
-		fLoadDiagnostic = ExecutionDiagnostic.OK_INSTANCE;
+		fLoadDiagnostic = ExecutionDiagnosticImpl.OK_INSTANCE;
 
 		UnitProxy unit = UnitResolverFactory.Registry.INSTANCE.getUnit(fURI);
 		if (unit == null) {
-			fLoadDiagnostic = new ExecutionDiagnostic(Diagnostic.ERROR,
+			fLoadDiagnostic = new ExecutionDiagnosticImpl(Diagnostic.ERROR,
 					ExecutionDiagnostic.TRANSFORMATION_LOAD_FAILED, NLS.bind(
 							Messages.UnitNotFoundError, fURI));
 			return;
@@ -226,7 +235,7 @@
 			fLoadDiagnostic = createCompilationDiagnostic(fCompiledUnit);
 
 		} catch (MdaException e) {
-			fLoadDiagnostic = new ExecutionDiagnostic(Diagnostic.ERROR,
+			fLoadDiagnostic = new ExecutionDiagnosticImpl(Diagnostic.ERROR,
 					ExecutionDiagnostic.TRANSFORMATION_LOAD_FAILED, NLS.bind(
 							Messages.FailedToCompileUnitError, fURI));
 
@@ -237,13 +246,13 @@
 				&& fLoadDiagnostic.getSeverity() == Diagnostic.OK) {
 			fTransformation = getTransformation();
 			if (fTransformation == null) {
-				fLoadDiagnostic = new ExecutionDiagnostic(Diagnostic.ERROR,
+				fLoadDiagnostic = new ExecutionDiagnosticImpl(Diagnostic.ERROR,
 						ExecutionDiagnostic.TRANSFORMATION_LOAD_FAILED, NLS
 								.bind(Messages.NotTransformationInUnitError,
 										fURI));
 			}
 
-			ExecutionDiagnostic validForExecution = checkIsExecutable(fTransformation);
+			ExecutionDiagnosticImpl validForExecution = checkIsExecutable(fTransformation);
 			if (validForExecution.getSeverity() != Diagnostic.OK) {
 				fLoadDiagnostic = validForExecution;
 			}
@@ -257,7 +266,7 @@
 		EList<ModelParameter> modelParameters = transformationModel
 				.getModelParameter();
 		if (modelParameters.size() != args.length) {
-			return new ExecutionDiagnostic(Diagnostic.ERROR,
+			return new ExecutionDiagnosticImpl(Diagnostic.ERROR,
 					ExecutionDiagnostic.MODEL_PARAMETER_MISMATCH, NLS.bind(
 							Messages.InvalidModelParameterCountError,
 							args.length, modelParameters.size()));
@@ -288,17 +297,17 @@
 		return result;
 	}
 
-	private static ExecutionDiagnostic checkIsExecutable(
+	private static ExecutionDiagnosticImpl checkIsExecutable(
 			OperationalTransformation transformation) {
 		EList<EOperation> operations = transformation.getEOperations();
 		for (EOperation oper : operations) {
 			if (oper instanceof ImperativeOperation
 					&& QvtOperationalEnv.MAIN.equals(oper.getName())) {
-				return ExecutionDiagnostic.OK_INSTANCE;
+				return ExecutionDiagnosticImpl.OK_INSTANCE;
 			}
 		}
 
-		return new ExecutionDiagnostic(Diagnostic.ERROR,
+		return new ExecutionDiagnosticImpl(Diagnostic.ERROR,
 				ExecutionDiagnostic.VALIDATION, NLS.bind(
 						Messages.NoTransformationEntryPointError,
 						transformation.getName()));
@@ -344,7 +353,7 @@
 			message = NLS.bind(Messages.QVTRuntimeExceptionCaught,
 					qvtRuntimeException.getClass().getName());
 		}
-		ExecutionDiagnostic diagnostic = new ExecutionDiagnostic(severity,
+		ExecutionDiagnosticImpl diagnostic = new ExecutionDiagnosticImpl(severity,
 				code, message, data);
 		diagnostic.setStackTrace(qvtRuntimeException.getQvtStackTrace());
 		return diagnostic;
@@ -364,15 +373,15 @@
 		}
 	}
 
-	private static ExecutionDiagnostic createCompilationDiagnostic(
+	private static ExecutionDiagnosticImpl createCompilationDiagnostic(
 			CompiledUnit compiledUnit) {
 		List<QvtMessage> errors = compiledUnit.getErrors();
 		if (errors.isEmpty()) {
-			return ExecutionDiagnostic.OK_INSTANCE;
+			return ExecutionDiagnosticImpl.OK_INSTANCE;
 		}
 
 		URI uri = compiledUnit.getURI();
-		ExecutionDiagnostic mainDiagnostic = new ExecutionDiagnostic(
+		ExecutionDiagnosticImpl mainDiagnostic = new ExecutionDiagnosticImpl(
 				Diagnostic.ERROR, ExecutionDiagnostic.VALIDATION, NLS.bind(
 						Messages.CompilationErrorsFoundInUnit, uri.toString()));
 
diff --git a/plugins/org.eclipse.m2m.qvt.oml/src/org/eclipse/m2m/qvt/oml/ExecutionDiagnostic.java b/plugins/org.eclipse.m2m.qvt.oml/src/org/eclipse/m2m/qvt/oml/ExecutionDiagnostic.java
index e8f81a3..f1dd8ee 100644
--- a/plugins/org.eclipse.m2m.qvt.oml/src/org/eclipse/m2m/qvt/oml/ExecutionDiagnostic.java
+++ b/plugins/org.eclipse.m2m.qvt.oml/src/org/eclipse/m2m/qvt/oml/ExecutionDiagnostic.java
@@ -12,23 +12,20 @@
 package org.eclipse.m2m.qvt.oml;
 
 import java.io.PrintWriter;
-import java.util.ArrayList;
-import java.util.Collections;
 import java.util.List;
 
-import org.eclipse.emf.common.util.BasicDiagnostic;
 import org.eclipse.emf.common.util.Diagnostic;
-import org.eclipse.m2m.internal.qvt.oml.evaluator.QvtRuntimeException;
+import org.eclipse.m2m.internal.qvt.oml.ExecutionDiagnosticImpl;
 
 /**
- * A diagnostic class representing the result status of a transformation
+ * A diagnostic interface representing the result status of a transformation
  * execution.
  * 
  * @since 2.0
  * 
- * @noextend This class is not intended to be subclassed by clients.
+ * @noextend This interface is not intended to be extended by clients.
  */
-public class ExecutionDiagnostic extends BasicDiagnostic {
+public interface ExecutionDiagnostic extends Diagnostic {
 
 	/**
 	 * The execution was terminated by failed QVT assertion.
@@ -50,35 +47,16 @@
 
 	public static final String SOURCE = "org.eclipse.m2m.qvt.oml.execution"; //$NON-NLS-1$
 
-	static final ExecutionDiagnostic OK_INSTANCE = new ExecutionDiagnostic(
-			Diagnostic.OK, 0, "OK", null); //$NON-NLS-1$
-
-	// instance fields
-
-	private List<ExecutionStackTraceElement> fStackTrace;
-
-	ExecutionDiagnostic(int severity, int code, String message, Object[] data) {
-		super(severity, SOURCE, code, message, data);
-	}
-
-	ExecutionDiagnostic(int severity, int code, String message) {
-		super(severity, SOURCE, code, message, null);
-	}
-
-	void setStackTrace(List<? extends ExecutionStackTraceElement> stackElements) {
-		fStackTrace = new ArrayList<ExecutionStackTraceElement>(stackElements);
-	}
-
+	
+	public static final ExecutionDiagnostic OK_INSTANCE = ExecutionDiagnosticImpl.OK_INSTANCE;
+	
 	/**
 	 * Gets the stack trace that resulted from interrupted execution either by
 	 * user termination request or exception thrown
 	 * 
 	 * @return list of trace elements or an empty list
 	 */
-	public List<ExecutionStackTraceElement> getStackTrace() {
-		return fStackTrace != null ? Collections.unmodifiableList(fStackTrace)
-				: Collections.<ExecutionStackTraceElement> emptyList();
-	}
+	public List<ExecutionStackTraceElement> getStackTrace();
 
 	/**
 	 * Prints the execution stack-trace (if available) of this diagnostic to the
@@ -87,9 +65,5 @@
 	 * @param writer
 	 *            <code>PrintWriter</code> to use for output
 	 */
-	public void printStackTrace(PrintWriter writer) {
-		if (fStackTrace != null) {
-			QvtRuntimeException.printQvtStackTrace(writer, fStackTrace);
-		}
-	}
+	public void printStackTrace(PrintWriter writer);
 }
diff --git a/plugins/org.eclipse.m2m.qvt.oml/src/org/eclipse/m2m/qvt/oml/TransformationExecutor.java b/plugins/org.eclipse.m2m.qvt.oml/src/org/eclipse/m2m/qvt/oml/TransformationExecutor.java
index 485fd67..c19f4f6 100644
--- a/plugins/org.eclipse.m2m.qvt.oml/src/org/eclipse/m2m/qvt/oml/TransformationExecutor.java
+++ b/plugins/org.eclipse.m2m.qvt.oml/src/org/eclipse/m2m/qvt/oml/TransformationExecutor.java
@@ -11,53 +11,10 @@
  *******************************************************************************/
 package org.eclipse.m2m.qvt.oml;
 
-import java.util.ArrayList;
-import java.util.List;
-
-import org.eclipse.emf.common.util.BasicDiagnostic;
 import org.eclipse.emf.common.util.Diagnostic;
-import org.eclipse.emf.common.util.EList;
 import org.eclipse.emf.common.util.URI;
-import org.eclipse.emf.ecore.EClass;
-import org.eclipse.emf.ecore.EClassifier;
-import org.eclipse.emf.ecore.EEnumLiteral;
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.emf.ecore.EOperation;
 import org.eclipse.emf.ecore.EPackage;
-import org.eclipse.emf.ecore.EParameter;
-import org.eclipse.emf.ecore.EStructuralFeature;
-import org.eclipse.m2m.internal.qvt.oml.Messages;
-import org.eclipse.m2m.internal.qvt.oml.NLS;
-import org.eclipse.m2m.internal.qvt.oml.QvtMessage;
-import org.eclipse.m2m.internal.qvt.oml.ast.env.ModelParameterExtent;
-import org.eclipse.m2m.internal.qvt.oml.ast.env.QvtOperationalEnv;
-import org.eclipse.m2m.internal.qvt.oml.ast.env.QvtOperationalEnvFactory;
-import org.eclipse.m2m.internal.qvt.oml.ast.env.QvtOperationalEvaluationEnv;
-import org.eclipse.m2m.internal.qvt.oml.ast.env.QvtOperationalFileEnv;
-import org.eclipse.m2m.internal.qvt.oml.common.MdaException;
-import org.eclipse.m2m.internal.qvt.oml.compiler.CompiledUnit;
-import org.eclipse.m2m.internal.qvt.oml.compiler.CompilerUtils;
-import org.eclipse.m2m.internal.qvt.oml.compiler.QVTOCompiler;
-import org.eclipse.m2m.internal.qvt.oml.compiler.UnitProxy;
-import org.eclipse.m2m.internal.qvt.oml.compiler.UnitResolver;
-import org.eclipse.m2m.internal.qvt.oml.compiler.UnitResolverFactory;
-import org.eclipse.m2m.internal.qvt.oml.evaluator.InternalEvaluator;
-import org.eclipse.m2m.internal.qvt.oml.evaluator.ModelInstance;
-import org.eclipse.m2m.internal.qvt.oml.evaluator.ModelParameterHelper;
-import org.eclipse.m2m.internal.qvt.oml.evaluator.QvtAssertionFailed;
-import org.eclipse.m2m.internal.qvt.oml.evaluator.QvtInterruptedExecutionException;
-import org.eclipse.m2m.internal.qvt.oml.evaluator.QvtRuntimeException;
-import org.eclipse.m2m.internal.qvt.oml.evaluator.QvtStackOverFlowError;
-import org.eclipse.m2m.internal.qvt.oml.expressions.ImperativeOperation;
-import org.eclipse.m2m.internal.qvt.oml.expressions.ModelParameter;
-import org.eclipse.m2m.internal.qvt.oml.expressions.Module;
-import org.eclipse.m2m.internal.qvt.oml.expressions.OperationalTransformation;
-import org.eclipse.m2m.internal.qvt.oml.library.Context;
-import org.eclipse.m2m.internal.qvt.oml.library.IContext;
-import org.eclipse.ocl.EvaluationVisitor;
-import org.eclipse.ocl.ecore.CallOperationAction;
-import org.eclipse.ocl.ecore.Constraint;
-import org.eclipse.ocl.ecore.SendSignalAction;
+import org.eclipse.m2m.internal.qvt.oml.InternalTransformationExecutor;
 
 /**
  * A utility class that enables to execute existing transformation in the
@@ -67,12 +24,8 @@
  */
 public final class TransformationExecutor {
 
-	private URI fURI;
-	private EPackage.Registry fPackageRegistry;
-	private CompiledUnit fCompiledUnit;
-	private ExecutionDiagnostic fLoadDiagnostic;
-	private OperationalTransformation fTransformation;
-
+	private InternalTransformationExecutor fExector;
+	
 	/**
 	 * Constructs the executor for the given transformation URI.
 	 * <p>
@@ -82,25 +35,24 @@
 	 *            the URI of an existing transformation
 	 */
 	public TransformationExecutor(URI uri) {
-		if (uri == null) {
-			throw new IllegalArgumentException("null transformation URI"); //$NON-NLS-1$
-		}
-
-		fURI = uri;
+		fExector = new InternalTransformationExecutor(uri);
 	}
 	
 	/**
+	 * Constructs the executor for the given transformation URI.
+	 * <p>
+	 * No attempt to resolve and load the transformation is done at this step
+	 * 
+	 * @param uri
+	 *            the URI of an existing transformation
+	 * @param registry
+	 *            a package registry of meta-models to be referenced by the
+	 *            executed transformation
 	 * @since 3.0
 	 */
 	public TransformationExecutor(URI uri, EPackage.Registry registry) {
-		this(uri);
-		
-		if (registry == null) {
-			throw new IllegalArgumentException("null package registry"); //$NON-NLS-1$
-		}
-		
-		fPackageRegistry = registry;
-	}	
+		fExector = new InternalTransformationExecutor(uri, registry);
+	}
 			
 	/**
 	 * Attempts to load the transformation referred by this executor and checks
@@ -113,10 +65,7 @@
 	 * @return the diagnostic indicating possible problems of the load action
 	 */
 	public Diagnostic loadTransformation() {
-		if (fLoadDiagnostic == null) {
-			doLoad();
-		}
-		return fLoadDiagnostic;
+		return fExector.loadTransformation();
 	}
 
 	/**
@@ -136,284 +85,6 @@
 	 */
 	public ExecutionDiagnostic execute(ExecutionContext executionContext,
 			ModelExtent... modelParameters) {
-		// Java API check for nulls etc.
-		if (executionContext == null) {
-			throw new IllegalArgumentException();
-		}
-		checkLegalModelParams(modelParameters);
-
-		// ensure transformation unit is loaded
-		loadTransformation();
-
-		// check if we have successfully loaded the transformation unit
-		if (!isSuccess(fLoadDiagnostic)) {
-			return fLoadDiagnostic;
-		}
-
-		try {
-			return doExecute(modelParameters,
-					createInternalContext(executionContext));
-		} catch (QvtRuntimeException e) {
-			return createExecutionFailure(e);
-		}
+		return fExector.execute(executionContext, modelParameters);
 	}
-
-	private ExecutionDiagnostic doExecute(ModelExtent[] args, IContext context) {
-		QvtOperationalEnvFactory factory = getEnvironmentFactory();
-		QvtOperationalEvaluationEnv evaluationEnv = factory
-				.createEvaluationEnvironment(context, null);
-
-		ExecutionDiagnostic modelParamsDiagnostic = initArguments(evaluationEnv, fTransformation, args);
-		if (modelParamsDiagnostic.getSeverity() != Diagnostic.OK) {
-			return modelParamsDiagnostic;
-		}
-
-		QvtOperationalFileEnv rootEnv = factory.createEnvironment(fCompiledUnit.getURI());
-		EvaluationVisitor<EPackage, EClassifier, EOperation, EStructuralFeature, EEnumLiteral, EParameter, EObject, CallOperationAction, SendSignalAction, Constraint, EClass, EObject> evaluator = factory
-				.createEvaluationVisitor(rootEnv, evaluationEnv, null);
-
-		// perform the actual execution
-		assert evaluator instanceof InternalEvaluator : "expecting InternalEvaluator implementation"; //$NON-NLS-1$
-		InternalEvaluator rawEvaluator = (InternalEvaluator) evaluator;
-
-		rawEvaluator.execute(fTransformation);
-
-		// instantiate trace model and pass it to transformation evaluation
-		// TODO: traces not involved yet, as it is not part of the API,
-		// provide an option to serialize to a resource
-		// Trace traces =
-		// evaluationEnv.getAdapter(InternalEvaluationEnv.class).getTraces();
-
-		// unpack the internal extents into the passed model parameters
-		List<Object> resultArgs = evaluationEnv.getOperationArgs();
-		int i = 0;
-		for (Object nextResultArg : resultArgs) {
-			ModelInstance modelInstance = (ModelInstance) nextResultArg;
-			ModelParameterExtent extent = modelInstance.getExtent();
-
-			List<EObject> allRootElements = extent.getContents()
-					.getAllRootElements();
-			try {
-				args[i++].setContents(allRootElements);
-			} catch (UnsupportedOperationException e) {
-				return new ExecutionDiagnostic(Diagnostic.ERROR,
-						ExecutionDiagnostic.MODEL_PARAMETER_MISMATCH, NLS
-								.bind(Messages.ReadOnlyExtentModificationError,
-										i - 1));
-			}
-		}
-
-		return ExecutionDiagnostic.OK_INSTANCE;
-	}
-
-	private void doLoad() {
-		fLoadDiagnostic = ExecutionDiagnostic.OK_INSTANCE;
-
-		UnitProxy unit = UnitResolverFactory.Registry.INSTANCE.getUnit(fURI);
-		if (unit == null) {
-			fLoadDiagnostic = new ExecutionDiagnostic(Diagnostic.ERROR,
-					ExecutionDiagnostic.TRANSFORMATION_LOAD_FAILED, NLS.bind(
-							Messages.UnitNotFoundError, fURI));
-			return;
-		}
-
-		QVTOCompiler compiler = createCompiler(unit.getResolver());
-		try {
-			fCompiledUnit = compiler.compile(unit, null, null);
-		//	fCompilerKernel = compiler.getKernel();
-
-			fLoadDiagnostic = createCompilationDiagnostic(fCompiledUnit);
-
-		} catch (MdaException e) {
-			fLoadDiagnostic = new ExecutionDiagnostic(Diagnostic.ERROR,
-					ExecutionDiagnostic.TRANSFORMATION_LOAD_FAILED, NLS.bind(
-							Messages.FailedToCompileUnitError, fURI));
-
-			fLoadDiagnostic.merge(BasicDiagnostic.toDiagnostic(e));
-		}
-
-		if (fCompiledUnit != null
-				&& fLoadDiagnostic.getSeverity() == Diagnostic.OK) {
-			fTransformation = getTransformation();
-			if (fTransformation == null) {
-				fLoadDiagnostic = new ExecutionDiagnostic(Diagnostic.ERROR,
-						ExecutionDiagnostic.TRANSFORMATION_LOAD_FAILED, NLS
-								.bind(Messages.NotTransformationInUnitError,
-										fURI));
-			}
-
-			ExecutionDiagnostic validForExecution = checkIsExecutable(fTransformation);
-			if (validForExecution.getSeverity() != Diagnostic.OK) {
-				fLoadDiagnostic = validForExecution;
-			}
-		}
-	}
-
-	private ExecutionDiagnostic initArguments(
-			QvtOperationalEvaluationEnv evalEnv,
-			OperationalTransformation transformationModel, ModelExtent[] args) {
-
-		EList<ModelParameter> modelParameters = transformationModel
-				.getModelParameter();
-		if (modelParameters.size() != args.length) {
-			return new ExecutionDiagnostic(Diagnostic.ERROR,
-					ExecutionDiagnostic.MODEL_PARAMETER_MISMATCH, NLS.bind(
-							Messages.InvalidModelParameterCountError,
-							args.length, modelParameters.size()));
-		}
-
-		ExecutionDiagnostic result = ExecutionDiagnostic.OK_INSTANCE;
-		List<ModelParameterExtent> extents = new ArrayList<ModelParameterExtent>(
-				args.length);
-
-		int argCount = 0;
-		for (ModelParameter modelParam : modelParameters) {
-			ModelParameterExtent nextExtent;
-			ModelExtent nextArg = args[argCount++];
-
-			if (modelParam.getKind() != org.eclipse.m2m.internal.qvt.oml.expressions.DirectionKind.OUT) {
-				nextExtent = new ModelParameterExtent(nextArg.getContents(), null, modelParam);
-			} else {
-				nextExtent = new ModelParameterExtent();
-			}
-
-			extents.add(nextExtent);
-		}
-
-		List<ModelInstance> modelArgs = ModelParameterHelper
-				.createModelArguments(transformationModel, extents);
-		evalEnv.getOperationArgs().addAll(modelArgs);
-
-		return result;
-	}
-
-	private static ExecutionDiagnostic checkIsExecutable(
-			OperationalTransformation transformation) {
-		EList<EOperation> operations = transformation.getEOperations();
-		for (EOperation oper : operations) {
-			if (oper instanceof ImperativeOperation
-					&& QvtOperationalEnv.MAIN.equals(oper.getName())) {
-				return ExecutionDiagnostic.OK_INSTANCE;
-			}
-		}
-
-		return new ExecutionDiagnostic(Diagnostic.ERROR,
-				ExecutionDiagnostic.VALIDATION, NLS.bind(
-						Messages.NoTransformationEntryPointError,
-						transformation.getName()));
-	}
-
-	private OperationalTransformation getTransformation() {
-		List<Module> allModules = fCompiledUnit.getModules();
-		for (Module module : allModules) {
-			if (module instanceof OperationalTransformation) {
-				return (OperationalTransformation) module;
-			}
-		}
-
-		return null;
-	}
-
-	private QvtOperationalEnvFactory getEnvironmentFactory() {
-		return new QvtOperationalEnvFactory();
-	}
-
-	private static ExecutionDiagnostic createExecutionFailure(
-			QvtRuntimeException qvtRuntimeException) {
-		int code = 0;
-		int severity = Diagnostic.ERROR;
-		String message = qvtRuntimeException.getLocalizedMessage();
-		Object[] data = null;
-
-		if (qvtRuntimeException instanceof QvtAssertionFailed) {
-			code = ExecutionDiagnostic.FATAL_ASSERTION;
-		} else if (qvtRuntimeException instanceof QvtInterruptedExecutionException) {
-			code = ExecutionDiagnostic.USER_INTERRUPTED;
-			severity = Diagnostic.CANCEL;
-		} else {
-			code = ExecutionDiagnostic.EXCEPTION_THROWN;
-			if (qvtRuntimeException instanceof QvtStackOverFlowError == false) {
-				data = new Object[] { qvtRuntimeException };
-			} else {
-				message = Messages.StackTraceOverFlowError;
-			}
-		}
-
-		if (message == null) {
-			message = NLS.bind(Messages.QVTRuntimeExceptionCaught,
-					qvtRuntimeException.getClass().getName());
-		}
-		ExecutionDiagnostic diagnostic = new ExecutionDiagnostic(severity,
-				code, message, data);
-		diagnostic.setStackTrace(qvtRuntimeException.getQvtStackTrace());
-		return diagnostic;
-	}
-
-	private void checkLegalModelParams(ModelExtent[] extents)
-			throws IllegalArgumentException {
-		if (extents == null) {
-			throw new IllegalArgumentException("Null model parameters"); //$NON-NLS-1$
-		}
-
-		for (int i = 0; i < extents.length; i++) {
-			if (extents[i] == null) {
-				throw new IllegalArgumentException(
-						"Null model parameter[" + i + "]"); //$NON-NLS-1$ //$NON-NLS-2$
-			}
-		}
-	}
-
-	private static ExecutionDiagnostic createCompilationDiagnostic(
-			CompiledUnit compiledUnit) {
-		List<QvtMessage> errors = compiledUnit.getErrors();
-		if (errors.isEmpty()) {
-			return ExecutionDiagnostic.OK_INSTANCE;
-		}
-
-		URI uri = compiledUnit.getURI();
-		ExecutionDiagnostic mainDiagnostic = new ExecutionDiagnostic(
-				Diagnostic.ERROR, ExecutionDiagnostic.VALIDATION, NLS.bind(
-						Messages.CompilationErrorsFoundInUnit, uri.toString()));
-
-		for (QvtMessage message : errors) {
-			// FIXME - we should include warnings as well
-			mainDiagnostic.add(CompilerUtils.createProblemDiagnostic(uri, message));
-		}
-
-		return mainDiagnostic;
-	}
-
-	private static boolean isSuccess(Diagnostic diagnostic) {
-		int severity = diagnostic.getSeverity();
-		return severity == Diagnostic.OK || severity == Diagnostic.WARNING
-				|| severity == Diagnostic.INFO;
-	}
-
-	private static IContext createInternalContext(
-			ExecutionContext executionContext) {
-		Context ctx = new Context();
-		ctx.setLog(executionContext.getLog());
-		ctx.setMonitor(executionContext.getMonitor());
-
-		for (String key : executionContext.getConfigPropertyNames()) {
-			Object value = executionContext.getConfigProperty(key);
-			ctx.setConfigProperty(key, value);
-		}
-
-		return ctx;
-	}
-
-	@Override
-	public String toString() {
-		return "QVTO-Executor: " + fURI; //$NON-NLS-1$
-	}
-	
-	private QVTOCompiler createCompiler(UnitResolver unitResolver) {
-		if(fPackageRegistry == null) {
-			return CompilerUtils.createCompiler(unitResolver);
-		}
-		
-		return QVTOCompiler.createCompiler(unitResolver, fPackageRegistry);
-	}
-
 }