Reorganize support for external packages

The codegenerator and the xtumlrt components deal with several "external
packages". "External packages" include UML profiles, model libraries and
other user UML or EMF packages. In particular, we must deal with the
UML-RT profile, the RTS model library, the RtCppProperties profile and
the Ansi C model library.

The existing code had hard-coded support for these packages, but not
only is this inflexible and limits future customizability and
extensions, but also presented difficulties in separating the codegen
and xtumlrt components as the existing setup resulted in circular
dependencies.

This change-set reorganizes the required support for external packages
with the following:

* Introduces the xtumrlt.external plugin with ExternalPackageManager as
the main class. There is a global instance of this class which can be
obtained by codegen and other components.
* Move external package metadata classes to xtumlrt.external.
ExternalPackageMetadata simplifies and replaces
AbstractRegisteredPackageMetadata.
* Update to plugin finder to work within Eclipse as well as in
stand-alone. The plugin-finder is now used by the external package
manager.
* Updates the code generator to work with this new external package
management system.

Change-Id: Ic4e2fd92a91865338334d9b7cad8d4a94362e20e
Signed-off-by: Ernesto Posse <eposse@gmail.com>
diff --git a/features/codegen/org.eclipse.papyrusrt.codegen-feature/feature.xml b/features/codegen/org.eclipse.papyrusrt.codegen-feature/feature.xml
index cf2895c..f17a57b 100644
--- a/features/codegen/org.eclipse.papyrusrt.codegen-feature/feature.xml
+++ b/features/codegen/org.eclipse.papyrusrt.codegen-feature/feature.xml
@@ -272,4 +272,11 @@
          version="0.0.0"
          unpack="false"/>
 
+   <plugin
+         id="org.eclipse.papyrusrt.xtumlrt.external"
+         download-size="0"
+         install-size="0"
+         version="0.0.0"
+         unpack="false"/>
+
 </feature>
diff --git a/models/samples/ComputerSystem/expected_src/CMakeLists.txt b/models/samples/ComputerSystem/expected_src/CMakeLists.txt
new file mode 100644
index 0000000..fa484e2
--- /dev/null
+++ b/models/samples/ComputerSystem/expected_src/CMakeLists.txt
@@ -0,0 +1,36 @@
+# Generated
+
+cmake_minimum_required(VERSION 2.8.7)
+set(TARGET TopMain)
+project(${TARGET})
+
+# require location of supporting RTS
+if (NOT UMLRTS_ROOT)
+  if (DEFINED ENV{UMLRTS_ROOT})
+    set(UMLRTS_ROOT $ENV{UMLRTS_ROOT})
+  else ()
+    set(UMLRTS_ROOT ${CMAKE_CURRENT_SOURCE_DIR}/umlrt.rts)
+  endif ()
+endif ()
+
+# setup primary envars - provides tooling config
+include(${UMLRTS_ROOT}/build/buildenv.cmake)
+
+# model sources
+set(SRCS TopMain.cc Computer.cc Resource.cc ResourceManager.cc WordProcessorApp.cc USBProtocol.cc AppControl.cc User.cc USBDeviceDriver.cc USBStorageDriver.cc USBPrinterDriver.cc Application.cc LocalPrinter.cc ExtMassStorage.cc OSCommand.cc ComputerSystem.cc Top.cc TopControllers.cc )
+
+# specify target
+add_executable(${TARGET} ${SRCS})
+
+# setup lib dependency support after defining TARGET
+include(${UMLRTS_ROOT}/build/rtslib.cmake)
+
+# compiler parameters
+set_target_properties(${TARGET} PROPERTIES COMPILE_OPTIONS "${COPTS}")
+set_target_properties(${TARGET} PROPERTIES COMPILE_DEFINITIONS "${CDEFS}")
+include_directories(${INCS})
+
+# linker parameters
+set_target_properties(${TARGET} PROPERTIES CMAKE_EXE_LINKER_FLAGS "${LOPTS}")
+target_link_libraries(${TARGET} ${LIBS})
+
diff --git a/models/tests/PingPong/expected_src/CMakeLists.txt b/models/tests/PingPong/expected_src/CMakeLists.txt
new file mode 100644
index 0000000..25373ad
--- /dev/null
+++ b/models/tests/PingPong/expected_src/CMakeLists.txt
@@ -0,0 +1,36 @@
+# Generated
+
+cmake_minimum_required(VERSION 2.8.7)
+set(TARGET TopMain)
+project(${TARGET})
+
+# require location of supporting RTS
+if (NOT UMLRTS_ROOT)
+  if (DEFINED ENV{UMLRTS_ROOT})
+    set(UMLRTS_ROOT $ENV{UMLRTS_ROOT})
+  else ()
+    set(UMLRTS_ROOT ${CMAKE_CURRENT_SOURCE_DIR}/umlrt.rts)
+  endif ()
+endif ()
+
+# setup primary envars - provides tooling config
+include(${UMLRTS_ROOT}/build/buildenv.cmake)
+
+# model sources
+set(SRCS TopMain.cc PingPongProtocol.cc Pinger.cc Ponger.cc Top.cc TopControllers.cc )
+
+# specify target
+add_executable(${TARGET} ${SRCS})
+
+# setup lib dependency support after defining TARGET
+include(${UMLRTS_ROOT}/build/rtslib.cmake)
+
+# compiler parameters
+set_target_properties(${TARGET} PROPERTIES COMPILE_OPTIONS "${COPTS}")
+set_target_properties(${TARGET} PROPERTIES COMPILE_DEFINITIONS "${CDEFS}")
+include_directories(${INCS})
+
+# linker parameters
+set_target_properties(${TARGET} PROPERTIES CMAKE_EXE_LINKER_FLAGS "${LOPTS}")
+target_link_libraries(${TARGET} ${LIBS})
+
diff --git a/plugins/umlrt/codegen/org.eclipse.papyrusrt.codegen.cpp.profile/META-INF/MANIFEST.MF b/plugins/umlrt/codegen/org.eclipse.papyrusrt.codegen.cpp.profile/META-INF/MANIFEST.MF
index 31b8f7f..14af79b 100644
--- a/plugins/umlrt/codegen/org.eclipse.papyrusrt.codegen.cpp.profile/META-INF/MANIFEST.MF
+++ b/plugins/umlrt/codegen/org.eclipse.papyrusrt.codegen.cpp.profile/META-INF/MANIFEST.MF
@@ -12,7 +12,8 @@
  org.eclipse.xtext.xbase.lib;bundle-version="2.9.0",
  org.eclipse.xtend2.lib;bundle-version="2.10.0",
  org.eclipse.papyrusrt.xtumlrt.common.model;bundle-version="0.7.2",
- org.eclipse.papyrusrt.xtumlrt.trans.from.uml;bundle-version="0.7.2"
+ org.eclipse.papyrusrt.xtumlrt.trans.from.uml;bundle-version="0.7.2",
+ org.eclipse.papyrusrt.xtumlrt.external;bundle-version="0.7.2"
 Bundle-ActivationPolicy: lazy
 Bundle-Vendor: %providerName
 Bundle-Localization: plugin
diff --git a/plugins/umlrt/codegen/org.eclipse.papyrusrt.codegen.cpp.profile/src/org/eclipse/papyrusrt/codegen/cpp/profile/facade/RTCppPropertiesProfileMetadata.java b/plugins/umlrt/codegen/org.eclipse.papyrusrt.codegen.cpp.profile/src/org/eclipse/papyrusrt/codegen/cpp/profile/facade/RTCppPropertiesProfileMetadata.java
new file mode 100644
index 0000000..400eca2
--- /dev/null
+++ b/plugins/umlrt/codegen/org.eclipse.papyrusrt.codegen.cpp.profile/src/org/eclipse/papyrusrt/codegen/cpp/profile/facade/RTCppPropertiesProfileMetadata.java
@@ -0,0 +1,55 @@
+/*******************************************************************************
+ * Copyright (c) 2015 Zeligsoft (2009) Limited 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
+ *******************************************************************************/
+package org.eclipse.papyrusrt.codegen.cpp.profile.facade;
+
+import org.eclipse.emf.ecore.EPackage;
+import org.eclipse.papyrusrt.codegen.cpp.profile.RTCppProperties.RTCppPropertiesPackage;
+import org.eclipse.papyrusrt.xtumlrt.external.ExternalPackageMetadata;
+
+/**
+ * Meta-data for the RTCppProperties profile.
+ * 
+ * @see ExternalPackageMetadata
+ * @author epp
+ */
+public final class RTCppPropertiesProfileMetadata extends ExternalPackageMetadata {
+
+	/** Common instance. */
+	public static final RTCppPropertiesProfileMetadata INSTANCE = new RTCppPropertiesProfileMetadata();
+
+	/** Profile id. */
+	private static final String ID = "org.eclipse.papyrusrt.codegen.cpp.profile";
+
+	/** Name-space URI. */
+	private static final String NS_URI = RTCppPropertiesPackage.eNS_URI;
+
+	/** Pathmap. */
+	private static final String BASEPATHMAP = "pathmap://UMLRT_CPP/RTCppProperties.profile.uml";
+
+	/** Root node id. */
+	// TODO: Find out if this can be extracted programatically
+	private static final String ROOT_ID = "_vl5LALs8EeSTjNEQkASznQ";
+
+	/** Subdirectory containing the model. */
+	private static final String FOLDER = "profiles";
+
+	/** File containing the model. */
+	private static final String FILE = "RTCppProperties.profile.uml";
+
+	/** {@link EPackage}. */
+	private static final RTCppPropertiesPackage EPACKAGE = RTCppPropertiesPackage.eINSTANCE;
+
+	/**
+	 * Default constructor. Private as this class should not be extended.
+	 *
+	 */
+	private RTCppPropertiesProfileMetadata() {
+		super(ID, Kind.Profile, NS_URI, BASEPATHMAP, ROOT_ID, FOLDER, FILE, EPACKAGE);
+	}
+
+}
diff --git a/plugins/umlrt/codegen/org.eclipse.papyrusrt.codegen.cpp.rts/META-INF/MANIFEST.MF b/plugins/umlrt/codegen/org.eclipse.papyrusrt.codegen.cpp.rts/META-INF/MANIFEST.MF
index 8a7ea0a..11eb8da 100644
--- a/plugins/umlrt/codegen/org.eclipse.papyrusrt.codegen.cpp.rts/META-INF/MANIFEST.MF
+++ b/plugins/umlrt/codegen/org.eclipse.papyrusrt.codegen.cpp.rts/META-INF/MANIFEST.MF
@@ -10,6 +10,7 @@
  org.eclipse.papyrusrt.rts,
  org.eclipse.papyrusrt.xtumlrt.common.model,
  org.eclipse.papyrusrt.xtumlrt.umlrt.model,
- org.eclipse.papyrusrt.xtumlrt.util;bundle-version="0.7.2"
+ org.eclipse.papyrusrt.xtumlrt.util;bundle-version="0.7.2",
+ org.eclipse.papyrusrt.xtumlrt.external;bundle-version="0.7.2"
 Export-Package: org.eclipse.papyrusrt.codegen.cpp.rts
 Bundle-Vendor: Zeligsoft (2009) Limited
diff --git a/plugins/umlrt/codegen/org.eclipse.papyrusrt.codegen.cpp.rts/src/org/eclipse/papyrusrt/codegen/cpp/rts/UMLRTRuntime.java b/plugins/umlrt/codegen/org.eclipse.papyrusrt.codegen.cpp.rts/src/org/eclipse/papyrusrt/codegen/cpp/rts/UMLRTRuntime.java
index a09370b..c36f883 100644
--- a/plugins/umlrt/codegen/org.eclipse.papyrusrt.codegen.cpp.rts/src/org/eclipse/papyrusrt/codegen/cpp/rts/UMLRTRuntime.java
+++ b/plugins/umlrt/codegen/org.eclipse.papyrusrt.codegen.cpp.rts/src/org/eclipse/papyrusrt/codegen/cpp/rts/UMLRTRuntime.java
@@ -33,7 +33,7 @@
 import org.eclipse.papyrusrt.xtumlrt.common.NamedElement;
 import org.eclipse.papyrusrt.xtumlrt.common.Protocol;
 import org.eclipse.papyrusrt.xtumlrt.common.Signal;
-import org.eclipse.papyrusrt.xtumlrt.util.RTSModelLibraryUtils;
+import org.eclipse.papyrusrt.xtumlrt.external.predefined.RTSModelLibraryUtils;
 import org.eclipse.papyrusrt.xtumlrt.util.XTUMLRTUtil;
 
 /**
diff --git a/plugins/umlrt/codegen/org.eclipse.papyrusrt.codegen.cpp/META-INF/MANIFEST.MF b/plugins/umlrt/codegen/org.eclipse.papyrusrt.codegen.cpp/META-INF/MANIFEST.MF
index db83029..b3938b1 100644
--- a/plugins/umlrt/codegen/org.eclipse.papyrusrt.codegen.cpp/META-INF/MANIFEST.MF
+++ b/plugins/umlrt/codegen/org.eclipse.papyrusrt.codegen.cpp/META-INF/MANIFEST.MF
@@ -27,7 +27,8 @@
  org.eclipse.papyrusrt.xtumlrt.statemach.model,
  org.eclipse.papyrus.designer.languages.common.base;bundle-version="1.0.1",
  org.eclipse.papyrus.designer.languages.common.profile;bundle-version="1.0.1",
- org.eclipse.papyrusrt.xtumlrt.util;bundle-version="0.7.2"
+ org.eclipse.papyrusrt.xtumlrt.util;bundle-version="0.7.2",
+ org.eclipse.papyrusrt.xtumlrt.external;bundle-version="0.7.2"
 Export-Package: org.eclipse.papyrusrt.codegen.cpp,
  org.eclipse.papyrusrt.codegen.cpp.internal,
  org.eclipse.papyrusrt.codegen.instance.model
diff --git a/plugins/umlrt/codegen/org.eclipse.papyrusrt.codegen.cpp/src/org/eclipse/papyrusrt/codegen/cpp/AbstractUMLRTGenerator.java b/plugins/umlrt/codegen/org.eclipse.papyrusrt.codegen.cpp/src/org/eclipse/papyrusrt/codegen/cpp/AbstractUMLRTGenerator.java
index cc1e3b9..4e2a25e 100644
--- a/plugins/umlrt/codegen/org.eclipse.papyrusrt.codegen.cpp/src/org/eclipse/papyrusrt/codegen/cpp/AbstractUMLRTGenerator.java
+++ b/plugins/umlrt/codegen/org.eclipse.papyrusrt.codegen.cpp/src/org/eclipse/papyrusrt/codegen/cpp/AbstractUMLRTGenerator.java
@@ -27,9 +27,15 @@
 import org.eclipse.papyrus.designer.languages.common.base.codesync.ChangeObject;
 import org.eclipse.papyrus.designer.languages.common.base.codesync.ManageChangeEvents;
 import org.eclipse.papyrusrt.codegen.CodeGenPlugin;
+import org.eclipse.papyrusrt.codegen.cpp.profile.facade.RTCppPropertiesProfileMetadata;
 import org.eclipse.papyrusrt.codegen.utils.CodeGenUtils;
+import org.eclipse.papyrusrt.xtumlrt.external.ExternalPackageManager;
+import org.eclipse.papyrusrt.xtumlrt.external.ExternalPackageMetadata;
+import org.eclipse.papyrusrt.xtumlrt.external.predefined.AnsiCLibraryMetadata;
+import org.eclipse.papyrusrt.xtumlrt.external.predefined.RTSModelLibraryMetadata;
+import org.eclipse.papyrusrt.xtumlrt.external.predefined.RTSModelLibraryUtils;
+import org.eclipse.papyrusrt.xtumlrt.external.predefined.UMLRTProfileMetadata;
 import org.eclipse.papyrusrt.xtumlrt.trans.from.uml.UML2xtumlrtModelTranslator;
-import org.eclipse.papyrusrt.xtumlrt.util.RTSModelLibraryUtils;
 
 /**
  * Abstract base generator. This is the generation "director". It executes the overall workflow of generation.
@@ -38,14 +44,47 @@
  */
 public abstract class AbstractUMLRTGenerator {
 
+	/** The collection of 'known' packages that must be loaded and registered. */
+	private static final ExternalPackageMetadata[] BUILT_IN_PACKAGES = {
+			UMLRTProfileMetadata.INSTANCE,
+			RTCppPropertiesProfileMetadata.INSTANCE,
+			AnsiCLibraryMetadata.INSTANCE,
+			RTSModelLibraryMetadata.INSTANCE
+	};
+
+	/** The {@link ExternalPackageManager}. */
+	protected ExternalPackageManager externalPackageManager = ExternalPackageManager.getInstance();
+
+	/** The {@link ResourceSet} containing the model being generated as well as external packages. */
+	private ResourceSet resourceSet;
+
+	/** Whether we are running in a stand-alone Java application or within Eclipse. */
+	private boolean standalone = true;
+
 	/** Flag set to {@code false} for incremental generation, and {@code true} for full regeneration. */
 	private boolean regenerate = false;
 
+	private boolean forceExternalPackageReset = true; // For debugging set to true
+
 	/**
 	 * Constructor.
 	 */
 	protected AbstractUMLRTGenerator() {
-		// TODO Auto-generated constructor stub
+	}
+
+	/**
+	 * @return {@code true} iff we are running in a stand-alone Java application or within Eclipse.
+	 */
+	public boolean isStandalone() {
+		return standalone;
+	}
+
+	/**
+	 * @param standalone
+	 *            - Whether we are running in a stand-alone Java application or within Eclipse.
+	 */
+	public void setStandalone(boolean standalone) {
+		this.standalone = standalone;
 	}
 
 	public void setRegenerate(boolean flag) {
@@ -85,6 +124,8 @@
 		ChangeTracker changeTracker = uml ? new UML2ChangeTracker(cpp) : new XTUMLRTChangeTracker(cpp);
 		CppCodeGenerator codegen = new CppCodeGenerator(cpp, changeTracker);
 
+		preGenerationTasks(elements);
+
 		// find top capsule
 		EObject topCapsule = CodeGenUtils.findCapsule(elements.get(0), top);
 		if (topCapsule == null) {
@@ -108,7 +149,6 @@
 		Map<File, File> outputFolders = new HashMap<>();
 
 		boolean first = true;
-		ResourceSet resourceSet = null;
 
 		for (EObject eobj : elements) {
 			getChanges(changes, eobj);
@@ -126,20 +166,11 @@
 				outputFolder = getOutputFolder(eobj, codegen);
 				outputFolders.put(modelFolder, outputFolder);
 			}
-			if (first || resourceSet == null) {
-				first = false;
-				resourceSet = eobj.eResource().getResourceSet();
-			} else if (resourceSet != eobj.eResource().getResourceSet()) {
-				CodeGenPlugin.warning("Target elements belong to different resource sets. This may result in errors during generation.");
-			}
 		}
 
 		codegen.getChangeTracker().addChanges(changes);
 		Collection<EObject> changedElements = codegen.getChangeTracker().getAllChanged();
 
-		RTSModelLibraryUtils.setResourceSet(resourceSet);
-		RTSModelLibraryUtils.loadRTSModelLibrary();
-
 		// The ErrorDialog cannot display status that is OK. There is a bitmask
 		// check that needs
 		// at least a bit to be enabled. We use INFO instead of OK to work
@@ -200,6 +231,19 @@
 	}
 
 	/**
+	 * Perform pre-generation tasks.
+	 * 
+	 * @param elements
+	 *            - The list of {@link EObject} elements for which code will be generated.
+	 * @return {@code true} iff successful.
+	 */
+	protected boolean preGenerationTasks(List<EObject> elements) {
+		boolean success = false;
+		success = setupResourceSet(elements);
+		return success;
+	}
+
+	/**
 	 * Translate the given list of UML elements into xtUML-RT.
 	 * 
 	 * @param translator
@@ -295,5 +339,100 @@
 		}
 	}
 
+	/**
+	 * Setup the {@link #resourceSet} to work with.
+	 * 
+	 * <p>
+	 * The resource set is chosen to be the resource set of the first {@link EObject} provided.
+	 * 
+	 * <p>
+	 * If the elements belong to different resource sets, a warning is issued, as it may result in generation errors.
+	 * 
+	 * <p>
+	 * If the chosen resource set is different than the previously chosen resource set, we initialize the external packages.
+	 * 
+	 * @see #setupExternalPackageManagement()
+	 * 
+	 * @param elements
+	 *            - The list of {@link EObject}s from which to generate.
+	 * @return {@code true} if the resource set could be set correctly.
+	 */
+	private boolean setupResourceSet(List<EObject> elements) {
+		boolean success = false;
+		ResourceSet elementsResourceSet = null;
+		boolean first = true;
+		for (EObject eobj : elements) {
+			if (first || elementsResourceSet == null) {
+				first = false;
+				elementsResourceSet = eobj.eResource().getResourceSet();
+			} else if (elementsResourceSet != eobj.eResource().getResourceSet()) {
+				CodeGenPlugin.warning("Target elements belong to different resource sets. This may result in errors during generation.");
+			}
+		}
+		if (elementsResourceSet != resourceSet || forceExternalPackageReset) {
+			resourceSet = elementsResourceSet;
+			setupExternalPackageManagement(resourceSet);
+		}
+		if (resourceSet != null) {
+			success = true;
+		}
+		return success;
+	}
+
+	/**
+	 * Initialize management of external packages. It performs several tasks:
+	 * 
+	 * <ol>
+	 * <li>Sets the {@link ResourceSet} of the {@link #externalPackageManager}.
+	 * <li>Tells the {@code externalPackageManager} that
+	 * </ol>
+	 * 
+	 * @param resourceSet
+	 *            - The {@link ResourceSet}.
+	 */
+	public void setupExternalPackageManagement(ResourceSet resourceSet) {
+		externalPackageManager = ExternalPackageManager.getInstance();
+		if (forceExternalPackageReset) {
+			externalPackageManager.reset();
+		}
+		externalPackageManager.setResourceSet(resourceSet);
+		externalPackageManager.setStandalone(standalone);
+		for (ExternalPackageMetadata metadata : BUILT_IN_PACKAGES) {
+			externalPackageManager.addRequiredPackage(metadata);
+		}
+		externalPackageManager.setup();
+		for (ExternalPackageMetadata metadata : BUILT_IN_PACKAGES) {
+			customSetup(metadata);
+		}
+	}
+
+	private void customSetup(ExternalPackageMetadata metadata) {
+		if (metadata instanceof UMLRTProfileMetadata) {
+			customSetup((UMLRTProfileMetadata) metadata);
+		} else if (metadata instanceof RTCppPropertiesProfileMetadata) {
+			customSetup((RTCppPropertiesProfileMetadata) metadata);
+		} else if (metadata instanceof RTSModelLibraryMetadata) {
+			customSetup((RTSModelLibraryMetadata) metadata);
+		} else if (metadata instanceof AnsiCLibraryMetadata) {
+			customSetup((AnsiCLibraryMetadata) metadata);
+		}
+	}
+
+	private void customSetup(UMLRTProfileMetadata metadata) {
+	}
+
+	private void customSetup(RTCppPropertiesProfileMetadata metadata) {
+	}
+
+	private void customSetup(RTSModelLibraryMetadata metadata) {
+		RTSModelLibraryUtils.init();
+	}
+
+	private void customSetup(AnsiCLibraryMetadata metadata) {
+	}
+
+
+
+
 }
 
diff --git a/plugins/umlrt/codegen/org.eclipse.papyrusrt.codegen.cpp/src/org/eclipse/papyrusrt/codegen/cpp/CppCMakeListsGenerator.xtend b/plugins/umlrt/codegen/org.eclipse.papyrusrt.codegen.cpp/src/org/eclipse/papyrusrt/codegen/cpp/CppCMakeListsGenerator.xtend
index d2d82fc..07aa276 100644
--- a/plugins/umlrt/codegen/org.eclipse.papyrusrt.codegen.cpp/src/org/eclipse/papyrusrt/codegen/cpp/CppCMakeListsGenerator.xtend
+++ b/plugins/umlrt/codegen/org.eclipse.papyrusrt.codegen.cpp/src/org/eclipse/papyrusrt/codegen/cpp/CppCMakeListsGenerator.xtend
@@ -22,7 +22,6 @@
 {
     override protected String doGenerate(List<FileName> files, String main, String rtsPath)
     {
-        //  «»
         '''
         # Generated «(new SimpleDateFormat("yyyy-MM-dd HH:mm:ss")).format(new Date())»
 
diff --git a/plugins/umlrt/codegen/org.eclipse.papyrusrt.codegen.cpp/src/org/eclipse/papyrusrt/codegen/cpp/CppCodeGenerator.java b/plugins/umlrt/codegen/org.eclipse.papyrusrt.codegen.cpp/src/org/eclipse/papyrusrt/codegen/cpp/CppCodeGenerator.java
index babfe12..d4ffd26 100644
--- a/plugins/umlrt/codegen/org.eclipse.papyrusrt.codegen.cpp/src/org/eclipse/papyrusrt/codegen/cpp/CppCodeGenerator.java
+++ b/plugins/umlrt/codegen/org.eclipse.papyrusrt.codegen.cpp/src/org/eclipse/papyrusrt/codegen/cpp/CppCodeGenerator.java
@@ -39,12 +39,12 @@
 import org.eclipse.papyrusrt.xtumlrt.common.StructuredType;
 import org.eclipse.papyrusrt.xtumlrt.common.TypeDefinition;
 import org.eclipse.papyrusrt.xtumlrt.common.util.CommonSwitch;
+import org.eclipse.papyrusrt.xtumlrt.external.predefined.RTSModelLibraryUtils;
 import org.eclipse.papyrusrt.xtumlrt.statemach.StateMachine;
 import org.eclipse.papyrusrt.xtumlrt.statemach.StatemachFactory;
 import org.eclipse.papyrusrt.xtumlrt.trans.from.uml.UML2xtumlrtModelTranslator;
 import org.eclipse.papyrusrt.xtumlrt.umlrt.RTModel;
 import org.eclipse.papyrusrt.xtumlrt.util.GeneralUtil;
-import org.eclipse.papyrusrt.xtumlrt.util.RTSModelLibraryUtils;
 import org.eclipse.papyrusrt.xtumlrt.util.XTUMLRTUtil;
 
 /**
diff --git a/plugins/umlrt/codegen/org.eclipse.papyrusrt.codegen.cpp/src/org/eclipse/papyrusrt/codegen/cpp/CppCodePattern.java b/plugins/umlrt/codegen/org.eclipse.papyrusrt.codegen.cpp/src/org/eclipse/papyrusrt/codegen/cpp/CppCodePattern.java
index f273a18..b9f0932 100644
--- a/plugins/umlrt/codegen/org.eclipse.papyrusrt.codegen.cpp/src/org/eclipse/papyrusrt/codegen/cpp/CppCodePattern.java
+++ b/plugins/umlrt/codegen/org.eclipse.papyrusrt.codegen.cpp/src/org/eclipse/papyrusrt/codegen/cpp/CppCodePattern.java
@@ -43,10 +43,10 @@
 import org.eclipse.papyrusrt.xtumlrt.common.Protocol;
 import org.eclipse.papyrusrt.xtumlrt.common.RedefinableElement;
 import org.eclipse.papyrusrt.xtumlrt.common.Signal;
+import org.eclipse.papyrusrt.xtumlrt.external.predefined.RTSModelLibraryUtils;
 import org.eclipse.papyrusrt.xtumlrt.trans.from.uml.UML2xtumlrtModelTranslator;
 import org.eclipse.papyrusrt.xtumlrt.util.GeneralUtil;
 import org.eclipse.papyrusrt.xtumlrt.util.QualifiedNames;
-import org.eclipse.papyrusrt.xtumlrt.util.RTSModelLibraryUtils;
 import org.eclipse.papyrusrt.xtumlrt.util.XTUMLRTUtil;
 
 /**
diff --git a/plugins/umlrt/codegen/org.eclipse.papyrusrt.codegen.cpp/src/org/eclipse/papyrusrt/codegen/cpp/CppProjectGenerator.xtend b/plugins/umlrt/codegen/org.eclipse.papyrusrt.codegen.cpp/src/org/eclipse/papyrusrt/codegen/cpp/CppProjectGenerator.xtend
index 1b0d93b..671a4cb 100644
--- a/plugins/umlrt/codegen/org.eclipse.papyrusrt.codegen.cpp/src/org/eclipse/papyrusrt/codegen/cpp/CppProjectGenerator.xtend
+++ b/plugins/umlrt/codegen/org.eclipse.papyrusrt.codegen.cpp/src/org/eclipse/papyrusrt/codegen/cpp/CppProjectGenerator.xtend
@@ -15,7 +15,7 @@
 import org.eclipse.papyrusrt.codegen.CodeGenPlugin
 import org.eclipse.papyrusrt.codegen.cpp.rts.UMLRTSUtil
 import org.eclipse.uml2.uml.util.UMLUtil
-import org.eclipse.papyrusrt.codegen.utils.AbstractRegisteredPackageMetadata
+import org.eclipse.papyrusrt.xtumlrt.external.ExternalPackageManager
 
 class CppProjectGenerator {
 	
@@ -97,7 +97,7 @@
 			var rtsroot = System.getenv("UMLRTS_ROOT");
 			if(UMLUtil.isEmpty(rtsroot)){
 				if(CodeGenPlugin.isStandalone){
-					val loc = AbstractRegisteredPackageMetadata.PLUGIN_FINDER.get(RTS_PLUGIN_ID)
+					val loc = ExternalPackageManager.getInstance().getPluginFinder().get(RTS_PLUGIN_ID)
 					if(loc != null){
 						val uri = URI.create(loc)
 						UMLRTS_ROOT = uri.path + "/umlrts"
diff --git a/plugins/umlrt/codegen/org.eclipse.papyrusrt.codegen.cpp/src/org/eclipse/papyrusrt/codegen/cpp/UML2ChangeTracker.java b/plugins/umlrt/codegen/org.eclipse.papyrusrt.codegen.cpp/src/org/eclipse/papyrusrt/codegen/cpp/UML2ChangeTracker.java
index 12045d2..ce5994c 100644
--- a/plugins/umlrt/codegen/org.eclipse.papyrusrt.codegen.cpp/src/org/eclipse/papyrusrt/codegen/cpp/UML2ChangeTracker.java
+++ b/plugins/umlrt/codegen/org.eclipse.papyrusrt.codegen.cpp/src/org/eclipse/papyrusrt/codegen/cpp/UML2ChangeTracker.java
@@ -28,9 +28,9 @@
 import org.eclipse.papyrusrt.codegen.cpp.CppCodeGenerator.GeneratorKey;
 import org.eclipse.papyrusrt.codegen.cpp.CppCodeGenerator.Kind;
 import org.eclipse.papyrusrt.codegen.lang.cpp.name.FileName;
+import org.eclipse.papyrusrt.xtumlrt.external.predefined.RTSModelLibraryUtils;
 import org.eclipse.papyrusrt.xtumlrt.trans.from.uml.UML2xtumlrtModelTranslator;
 import org.eclipse.papyrusrt.xtumlrt.util.GeneralUtil;
-import org.eclipse.papyrusrt.xtumlrt.util.RTSModelLibraryUtils;
 import org.eclipse.papyrusrt.xtumlrt.util.UMLRealTimeProfileUtil;
 import org.eclipse.uml2.uml.Behavior;
 import org.eclipse.uml2.uml.Class;
diff --git a/plugins/umlrt/codegen/org.eclipse.papyrusrt.codegen.cpp/src/org/eclipse/papyrusrt/codegen/cpp/internal/CapsuleGenerator.java b/plugins/umlrt/codegen/org.eclipse.papyrusrt.codegen.cpp/src/org/eclipse/papyrusrt/codegen/cpp/internal/CapsuleGenerator.java
index 80cb7bf..b113ecb 100644
--- a/plugins/umlrt/codegen/org.eclipse.papyrusrt.codegen.cpp/src/org/eclipse/papyrusrt/codegen/cpp/internal/CapsuleGenerator.java
+++ b/plugins/umlrt/codegen/org.eclipse.papyrusrt.codegen.cpp/src/org/eclipse/papyrusrt/codegen/cpp/internal/CapsuleGenerator.java
@@ -57,7 +57,7 @@
 import org.eclipse.papyrusrt.xtumlrt.common.Port;
 import org.eclipse.papyrusrt.xtumlrt.common.Protocol;
 import org.eclipse.papyrusrt.xtumlrt.common.RedefinableElement;
-import org.eclipse.papyrusrt.xtumlrt.util.RTSModelLibraryUtils;
+import org.eclipse.papyrusrt.xtumlrt.external.predefined.RTSModelLibraryUtils;
 import org.eclipse.papyrusrt.xtumlrt.util.XTUMLRTUtil;
 
 /**
diff --git a/plugins/umlrt/codegen/org.eclipse.papyrusrt.codegen.cpp/src/org/eclipse/papyrusrt/codegen/cpp/internal/GeneratorDescriptor.java b/plugins/umlrt/codegen/org.eclipse.papyrusrt.codegen.cpp/src/org/eclipse/papyrusrt/codegen/cpp/internal/GeneratorDescriptor.java
index fe21c84..999caff 100644
--- a/plugins/umlrt/codegen/org.eclipse.papyrusrt.codegen.cpp/src/org/eclipse/papyrusrt/codegen/cpp/internal/GeneratorDescriptor.java
+++ b/plugins/umlrt/codegen/org.eclipse.papyrusrt.codegen.cpp/src/org/eclipse/papyrusrt/codegen/cpp/internal/GeneratorDescriptor.java
@@ -26,7 +26,7 @@
 @SuppressWarnings("rawtypes")
 public class GeneratorDescriptor {
 
-	/** The extention's 'type' attribute name. */
+	/** The extension's 'type' attribute name. */
 	private static final String ATTR_TYPE = "type";
 
 	/** The extension's 'class' attribute name. */
diff --git a/plugins/umlrt/codegen/org.eclipse.papyrusrt.codegen.cpp/src/org/eclipse/papyrusrt/codegen/cpp/internal/ProtocolGenerator.java b/plugins/umlrt/codegen/org.eclipse.papyrusrt.codegen.cpp/src/org/eclipse/papyrusrt/codegen/cpp/internal/ProtocolGenerator.java
index 42236ec..211ceb1 100644
--- a/plugins/umlrt/codegen/org.eclipse.papyrusrt.codegen.cpp/src/org/eclipse/papyrusrt/codegen/cpp/internal/ProtocolGenerator.java
+++ b/plugins/umlrt/codegen/org.eclipse.papyrusrt.codegen.cpp/src/org/eclipse/papyrusrt/codegen/cpp/internal/ProtocolGenerator.java
@@ -47,7 +47,7 @@
 import org.eclipse.papyrusrt.codegen.lang.cpp.stmt.ReturnStatement;
 import org.eclipse.papyrusrt.xtumlrt.common.Protocol;
 import org.eclipse.papyrusrt.xtumlrt.common.Signal;
-import org.eclipse.papyrusrt.xtumlrt.util.RTSModelLibraryUtils;
+import org.eclipse.papyrusrt.xtumlrt.external.predefined.RTSModelLibraryUtils;
 import org.eclipse.papyrusrt.xtumlrt.util.XTUMLRTUtil;
 
 /**
diff --git a/plugins/umlrt/codegen/org.eclipse.papyrusrt.codegen.papyrus/src/org/eclipse/papyrusrt/codegen/papyrus/UMLRTGenerator.java b/plugins/umlrt/codegen/org.eclipse.papyrusrt.codegen.papyrus/src/org/eclipse/papyrusrt/codegen/papyrus/UMLRTGenerator.java
index ddc3958..affd3ba 100644
--- a/plugins/umlrt/codegen/org.eclipse.papyrusrt.codegen.papyrus/src/org/eclipse/papyrusrt/codegen/papyrus/UMLRTGenerator.java
+++ b/plugins/umlrt/codegen/org.eclipse.papyrusrt.codegen.papyrus/src/org/eclipse/papyrusrt/codegen/papyrus/UMLRTGenerator.java
@@ -51,6 +51,8 @@
 	 *
 	 */
 	private UMLRTGenerator() {
+		super();
+		setStandalone(false);
 	}
 
 	@Override
diff --git a/plugins/umlrt/codegen/org.eclipse.papyrusrt.codegen.standalone/META-INF/MANIFEST.MF b/plugins/umlrt/codegen/org.eclipse.papyrusrt.codegen.standalone/META-INF/MANIFEST.MF
index 50d1bd2..5e6d5f2 100644
--- a/plugins/umlrt/codegen/org.eclipse.papyrusrt.codegen.standalone/META-INF/MANIFEST.MF
+++ b/plugins/umlrt/codegen/org.eclipse.papyrusrt.codegen.standalone/META-INF/MANIFEST.MF
@@ -26,4 +26,5 @@
  org.eclipse.xtext.xbase.lib;bundle-version="2.9.0",
  org.eclipse.papyrus.designer.languages.cpp.library;bundle-version="0.7.0",
  org.eclipse.papyrusrt.umlrt.common.rts.library,
- org.eclipse.papyrusrt.xtumlrt.util;bundle-version="0.7.2"
+ org.eclipse.papyrusrt.xtumlrt.util;bundle-version="0.7.2",
+ org.eclipse.papyrusrt.xtumlrt.external;bundle-version="0.7.2"
diff --git a/plugins/umlrt/codegen/org.eclipse.papyrusrt.codegen.standalone/src/org/eclipse/papyrusrt/codegen/standalone/AnsiCLibraryMetadata.java b/plugins/umlrt/codegen/org.eclipse.papyrusrt.codegen.standalone/src/org/eclipse/papyrusrt/codegen/standalone/AnsiCLibraryMetadata.java
deleted file mode 100644
index 362f8a0..0000000
--- a/plugins/umlrt/codegen/org.eclipse.papyrusrt.codegen.standalone/src/org/eclipse/papyrusrt/codegen/standalone/AnsiCLibraryMetadata.java
+++ /dev/null
@@ -1,97 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2015 Zeligsoft (2009) Limited 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
- *******************************************************************************/
-package org.eclipse.papyrusrt.codegen.standalone;
-
-import org.eclipse.emf.ecore.EPackage;
-import org.eclipse.papyrusrt.codegen.utils.AbstractRegisteredPackageMetadata;
-
-/**
- * Meta-data for the Ansi C Library.
- * 
- * @see AbstractRegisteredPackageMetadata
- * @author epp
- */
-public final class AnsiCLibraryMetadata extends AbstractRegisteredPackageMetadata {
-
-	/** Common instance. */
-	public static final AnsiCLibraryMetadata INSTANCE = new AnsiCLibraryMetadata();
-
-	/** Profile id. */
-	private static final String ANSI_C_LIB_ID = "org.eclipse.papyrus.designer.languages.cpp.library";
-
-	/** Name-space URI. */
-	private static final String ANSI_C_LIB_NS_URI = "http://www.eclipse.org/papyrus/C_Cpp/1";
-
-	/** {@link EPackage}. */
-	private static final EPackage ANSI_C_LIB_PKG = null;
-
-	/** Pathmap. */
-	private static final String ANSI_C_LIB_PATHMAP = "pathmap://PapyrusC_Cpp_LIBRARIES/AnsiCLibrary.uml";
-
-	/** Root node id. */
-	// TODO: Find out if this can be extracted programatically
-	private static final String ANSI_C_LIB_ROOT_ID = "_DV8nkBv8EduZN5aJJITI5w";
-
-	/** Root URI. */
-	private static final String ANSI_C_LIB_ROOT_URI = ANSI_C_LIB_PATHMAP + "#" + ANSI_C_LIB_ROOT_ID;
-
-	/** Subdirectory containing the model. */
-	private static final String ANSI_C_LIB_SUBDIR = "models";
-
-	/** File containing the model. */
-	private static final String ANSI_C_LIB_MODEL = "AnsiCLibrary.uml";
-
-	/**
-	 * Default constructor. Private as this class should not be extended.
-	 *
-	 */
-	private AnsiCLibraryMetadata() {
-	}
-
-	@Override
-	public String getPackageId() {
-		return ANSI_C_LIB_ID;
-	}
-
-	@Override
-	public String getNSURI() {
-		return ANSI_C_LIB_NS_URI;
-	}
-
-	@Override
-	public EPackage getPackage() {
-		return ANSI_C_LIB_PKG;
-	}
-
-	@Override
-	public String getPathmap() {
-		return ANSI_C_LIB_PATHMAP;
-	}
-
-	@Override
-	public String getRootId() {
-		return ANSI_C_LIB_ROOT_ID;
-	}
-
-	@Override
-	public String getRootURI() {
-		return ANSI_C_LIB_ROOT_URI;
-	}
-
-	@Override
-	public String getPackageSubdirectory() {
-		return ANSI_C_LIB_SUBDIR;
-	}
-
-	@Override
-	public String getPackageModel() {
-		return ANSI_C_LIB_MODEL;
-	}
-
-
-}
diff --git a/plugins/umlrt/codegen/org.eclipse.papyrusrt.codegen.standalone/src/org/eclipse/papyrusrt/codegen/standalone/RTCppPropertiesProfileMetadata.java b/plugins/umlrt/codegen/org.eclipse.papyrusrt.codegen.standalone/src/org/eclipse/papyrusrt/codegen/standalone/RTCppPropertiesProfileMetadata.java
deleted file mode 100644
index 1444383..0000000
--- a/plugins/umlrt/codegen/org.eclipse.papyrusrt.codegen.standalone/src/org/eclipse/papyrusrt/codegen/standalone/RTCppPropertiesProfileMetadata.java
+++ /dev/null
@@ -1,97 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2015 Zeligsoft (2009) Limited 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
- *******************************************************************************/
-package org.eclipse.papyrusrt.codegen.standalone;
-
-import org.eclipse.emf.ecore.EPackage;
-import org.eclipse.papyrusrt.codegen.cpp.profile.RTCppProperties.RTCppPropertiesPackage;
-import org.eclipse.papyrusrt.codegen.utils.AbstractRegisteredPackageMetadata;
-
-/**
- * Meta-data for the RTCppProperties profile.
- * 
- * @see AbstractRegisteredPackageMetadata
- * @author epp
- */
-public final class RTCppPropertiesProfileMetadata extends AbstractRegisteredPackageMetadata {
-
-	/** Common instance. */
-	public static final RTCppPropertiesProfileMetadata INSTANCE = new RTCppPropertiesProfileMetadata();
-
-	/** Profile id. */
-	private static final String RTCPP_PROFILE_ID = "org.eclipse.papyrusrt.codegen.cpp.profile";
-
-	/** Name-space URI. */
-	private static final String RTCPP_NS_URI = RTCppPropertiesPackage.eNS_URI;
-
-	/** {@link EPackage}. */
-	private static final RTCppPropertiesPackage RTCPP_PKG = RTCppPropertiesPackage.eINSTANCE;
-
-	/** Pathmap. */
-	private static final String RTCPP_PATHMAP = "pathmap://UMLRT_CPP/RTCppProperties.profile.uml";
-
-	/** Root node id. */
-	// TODO: Find out if this can be extracted programatically
-	private static final String RTCPP_ROOT_ID = "_vl5LALs8EeSTjNEQkASznQ";
-
-	/** Root URI. */
-	private static final String RTCPP_ROOT_URI = RTCPP_PATHMAP + "#" + RTCPP_ROOT_ID;
-
-	/** Subdirectory containing the model. */
-	private static final String RTCPP_PROFILE_SUBDIR = "profiles";
-
-	/** File containing the model. */
-	private static final String RTCPP_PROFILE_MODEL = "RTCppProperties.profile.uml";
-
-	/**
-	 * Default constructor. Private as this class should not be extended.
-	 *
-	 */
-	private RTCppPropertiesProfileMetadata() {
-	}
-
-	@Override
-	public String getPackageId() {
-		return RTCPP_PROFILE_ID;
-	}
-
-	@Override
-	public String getNSURI() {
-		return RTCPP_NS_URI;
-	}
-
-	@Override
-	public EPackage getPackage() {
-		return RTCPP_PKG;
-	}
-
-	@Override
-	public String getPathmap() {
-		return RTCPP_PATHMAP;
-	}
-
-	@Override
-	public String getRootId() {
-		return RTCPP_ROOT_ID;
-	}
-
-	@Override
-	public String getRootURI() {
-		return RTCPP_ROOT_URI;
-	}
-
-	@Override
-	public String getPackageSubdirectory() {
-		return RTCPP_PROFILE_SUBDIR;
-	}
-
-	@Override
-	public String getPackageModel() {
-		return RTCPP_PROFILE_MODEL;
-	}
-
-}
diff --git a/plugins/umlrt/codegen/org.eclipse.papyrusrt.codegen.standalone/src/org/eclipse/papyrusrt/codegen/standalone/RTSModelLibraryMetadata.java b/plugins/umlrt/codegen/org.eclipse.papyrusrt.codegen.standalone/src/org/eclipse/papyrusrt/codegen/standalone/RTSModelLibraryMetadata.java
deleted file mode 100644
index da83db7..0000000
--- a/plugins/umlrt/codegen/org.eclipse.papyrusrt.codegen.standalone/src/org/eclipse/papyrusrt/codegen/standalone/RTSModelLibraryMetadata.java
+++ /dev/null
@@ -1,92 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2015 Zeligsoft (2009) Limited 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
- *******************************************************************************/
-package org.eclipse.papyrusrt.codegen.standalone;
-
-import org.eclipse.emf.ecore.EPackage;
-import org.eclipse.papyrusrt.codegen.utils.AbstractRegisteredPackageMetadata;
-
-/**
- * Meta-data for the UML-RT RTS Model Library.
- * 
- * @see AbstractRegisteredPackageMetadata
- * @author epp
- */
-public final class RTSModelLibraryMetadata extends AbstractRegisteredPackageMetadata {
-
-	/** Common instance. */
-	public static final RTSModelLibraryMetadata INSTANCE = new RTSModelLibraryMetadata();
-
-	/** Profile id. */
-	private static final String RTS_MODLIB_PACKAGE_ID = "org.eclipse.papyrusrt.umlrt.common.rts.library";
-
-	/** Name-space URI. */
-	private static final String RTS_MODLIB_NS_URI = "http://www.eclipse.org/papyrusrt/rts";
-
-	/** {@link EPackage}. */
-	private static final EPackage RTS_MODLIB_PKG = null;
-
-	/** Pathmap. */
-	private static final String RTS_MODLIB_PATHMAP = "pathmap://UMLRTRTSLIB/UMLRT-RTS.uml";
-
-	/** Root node id. */
-	// TODO: Find out if this can be extracted programatically
-	private static final String RTS_MODLIB_ROOT_ID = "_mPjAgGXmEeS_4daqvwyFrg";
-
-	/** Root URI. */
-	private static final String RTS_MODLIB_ROOT_URI = RTS_MODLIB_PATHMAP + "#" + RTS_MODLIB_ROOT_ID;
-
-	/** Subdirectory containing the model. */
-	private static final String RTS_MODLIB_PACKAGE_SUBDIR = "libraries";
-
-	/** File containing the model. */
-	private static final String RTS_MODLIB_PACKAGE_MODEL = "UMLRT-RTS.uml";
-
-	private RTSModelLibraryMetadata() {
-	}
-
-	@Override
-	public String getPackageId() {
-		return RTS_MODLIB_PACKAGE_ID;
-	}
-
-	@Override
-	public String getNSURI() {
-		return RTS_MODLIB_NS_URI;
-	}
-
-	@Override
-	public EPackage getPackage() {
-		return RTS_MODLIB_PKG;
-	}
-
-	@Override
-	public String getPathmap() {
-		return RTS_MODLIB_PATHMAP;
-	}
-
-	@Override
-	public String getRootId() {
-		return RTS_MODLIB_ROOT_ID;
-	}
-
-	@Override
-	public String getRootURI() {
-		return RTS_MODLIB_ROOT_URI;
-	}
-
-	@Override
-	public String getPackageSubdirectory() {
-		return RTS_MODLIB_PACKAGE_SUBDIR;
-	}
-
-	@Override
-	public String getPackageModel() {
-		return RTS_MODLIB_PACKAGE_MODEL;
-	}
-
-}
diff --git a/plugins/umlrt/codegen/org.eclipse.papyrusrt.codegen.standalone/src/org/eclipse/papyrusrt/codegen/standalone/StandaloneUMLRTCodeGenerator.java b/plugins/umlrt/codegen/org.eclipse.papyrusrt.codegen.standalone/src/org/eclipse/papyrusrt/codegen/standalone/StandaloneUMLRTCodeGenerator.java
index 1288a1a..8001868 100644
--- a/plugins/umlrt/codegen/org.eclipse.papyrusrt.codegen.standalone/src/org/eclipse/papyrusrt/codegen/standalone/StandaloneUMLRTCodeGenerator.java
+++ b/plugins/umlrt/codegen/org.eclipse.papyrusrt.codegen.standalone/src/org/eclipse/papyrusrt/codegen/standalone/StandaloneUMLRTCodeGenerator.java
@@ -37,15 +37,15 @@
 import org.eclipse.papyrusrt.codegen.CodeGenPlugin;
 import org.eclipse.papyrusrt.codegen.cpp.GeneratorManager;
 import org.eclipse.papyrusrt.codegen.standalone.internal.StandaloneGeneratorManager;
-import org.eclipse.papyrusrt.codegen.utils.AbstractRegisteredPackageMetadata;
-import org.eclipse.papyrusrt.codegen.utils.PluginFinder;
-import org.eclipse.papyrusrt.xtumlrt.util.RTSModelLibraryUtils;
+import org.eclipse.papyrusrt.xtumlrt.external.PluginFinder;
+import org.eclipse.papyrusrt.xtumlrt.external.predefined.RTSModelLibraryMetadata;
+import org.eclipse.papyrusrt.xtumlrt.external.predefined.RTSModelLibraryUtils;
+import org.eclipse.papyrusrt.xtumlrt.util.XTUMLRTLogger;
 import org.eclipse.uml2.uml.Element;
 import org.eclipse.uml2.uml.Model;
 import org.eclipse.uml2.uml.Profile;
 import org.eclipse.uml2.uml.Stereotype;
 import org.eclipse.uml2.uml.UMLPackage;
-import org.eclipse.uml2.uml.resources.util.UMLResourcesUtil;
 
 /**
  * Stand-alone code generator.
@@ -335,10 +335,14 @@
 		Level level = Level.parse(clargs.getOptionValue(OPT_LOG_LEVEL, DEFAULT_LOG_LEVEL).toUpperCase());
 		Handler consoleHandler = new ConsoleHandler();
 		consoleHandler.setLevel(level);
+		CodeGenPlugin codegenPlugin = new CodeGenPlugin();
 		CodeGenPlugin.getLogger().addHandler(consoleHandler);
 		CodeGenPlugin.getLogger().setLevel(level);
-		CodeGenPlugin codegenPlugin = new CodeGenPlugin();
 		CodeGenPlugin.setStandalone(printStackTrace);
+		XTUMLRTLogger xtumlrtLogger = new XTUMLRTLogger();
+		XTUMLRTLogger.getLogger().addHandler(consoleHandler);
+		XTUMLRTLogger.getLogger().setLevel(level);
+		XTUMLRTLogger.setStandalone(printStackTrace);
 	}
 
 	/**
@@ -411,31 +415,9 @@
 	private static void init() {
 		logPaths();
 		// updateClassPath();
-		// Create the resource set
 		resourceSet = new ResourceSetImpl();
-		// Initialize global registry
-		UMLResourcesUtil.init(resourceSet);
-		AbstractRegisteredPackageMetadata.searchPlugins(UMLRTProfileMetadata.INSTANCE.getPackageId(),
-				RTCppPropertiesProfileMetadata.INSTANCE.getPackageId(),
-				AnsiCLibraryMetadata.INSTANCE.getPackageId(),
-				RTSModelLibraryMetadata.INSTANCE.getPackageId());
-		// Register UMLRT profile
-		UMLRTProfileMetadata.INSTANCE.registerProfile(resourceSet);
-		// Load and register the RTS Model library
-		// We load it only if we can find it. If we cannot find it, code
-		// generation
-		// will go ahead, but if the model refers to the library, it will fail.
-		// If it cannot find it but the model doesn't use the library, code
-		// generation may succeed.
-		if (pluginsPaths != null) {
-			// Register Papyrus Ansi C Library
-			loadAnsiCLibrary();
-			AnsiCLibraryMetadata.INSTANCE.registerPackage(resourceSet);
-			loadModelLibrary();
-			RTSModelLibraryMetadata.INSTANCE.registerPackage(resourceSet);
-			loadRTCppPropertiesProfile();
-			RTCppPropertiesProfileMetadata.INSTANCE.registerProfile(resourceSet);
-		}
+		UMLRTGenerator.INSTANCE.setStandalone(true);
+		UMLRTGenerator.INSTANCE.setupExternalPackageManagement(resourceSet);
 	}
 
 	/**
@@ -489,28 +471,6 @@
 	}
 
 	/**
-	 * Loads the RTCppProperties profile.
-	 * 
-	 * @return The {@link org.eclipse.uml2.uml.Profile}.
-	 */
-	private static Profile loadRTCppPropertiesProfile() {
-		URI profileLocationURI = RTCppPropertiesProfileMetadata.INSTANCE.getPackageLocationURI();
-		Profile lib = loadProfile(profileLocationURI);
-		return lib;
-	}
-
-	/**
-	 * Loads the Ansi C Library.
-	 * 
-	 * @return The {@link org.eclipse.uml2.uml.Model}.
-	 */
-	private static Model loadAnsiCLibrary() {
-		URI ansiCLibLocationURI = AnsiCLibraryMetadata.INSTANCE.getPackageLocationURI();
-		Model lib = loadModel(ansiCLibLocationURI);
-		return lib;
-	}
-
-	/**
 	 * Invokes the actual code generator.
 	 * 
 	 * <p>
diff --git a/plugins/umlrt/codegen/org.eclipse.papyrusrt.codegen.standalone/src/org/eclipse/papyrusrt/codegen/standalone/UMLRTGenerator.java b/plugins/umlrt/codegen/org.eclipse.papyrusrt.codegen.standalone/src/org/eclipse/papyrusrt/codegen/standalone/UMLRTGenerator.java
index 6b0ec96..04f0d86 100644
--- a/plugins/umlrt/codegen/org.eclipse.papyrusrt.codegen.standalone/src/org/eclipse/papyrusrt/codegen/standalone/UMLRTGenerator.java
+++ b/plugins/umlrt/codegen/org.eclipse.papyrusrt.codegen.standalone/src/org/eclipse/papyrusrt/codegen/standalone/UMLRTGenerator.java
@@ -49,6 +49,8 @@
 	 *
 	 */
 	private UMLRTGenerator() {
+		super();
+		setStandalone(true);
 	}
 
 	@Override
diff --git a/plugins/umlrt/codegen/org.eclipse.papyrusrt.codegen.standalone/src/org/eclipse/papyrusrt/codegen/standalone/UMLRTProfileMetadata.java b/plugins/umlrt/codegen/org.eclipse.papyrusrt.codegen.standalone/src/org/eclipse/papyrusrt/codegen/standalone/UMLRTProfileMetadata.java
deleted file mode 100644
index eb35f73..0000000
--- a/plugins/umlrt/codegen/org.eclipse.papyrusrt.codegen.standalone/src/org/eclipse/papyrusrt/codegen/standalone/UMLRTProfileMetadata.java
+++ /dev/null
@@ -1,98 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2015 Zeligsoft (2009) Limited 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
- *******************************************************************************/
-package org.eclipse.papyrusrt.codegen.standalone;
-
-import org.eclipse.emf.ecore.EPackage;
-import org.eclipse.papyrusrt.codegen.utils.AbstractRegisteredPackageMetadata;
-import org.eclipse.papyrusrt.umlrt.profile.UMLRealTime.UMLRealTimePackage;
-
-/**
- * Meta-data for the UML-RT profile.
- * 
- * @see AbstractRegisteredPackageMetadata
- * @author epp
- */
-public final class UMLRTProfileMetadata extends AbstractRegisteredPackageMetadata {
-
-	/** Common instance. */
-	public static final UMLRTProfileMetadata INSTANCE = new UMLRTProfileMetadata();
-
-	/** Profile id. */
-	private static final String UMLRT_PROFILE_ID = "org.eclipse.papyrusrt.umlrt.profile";
-
-	/** Name-space URI. */
-	// It should be "http://www.eclipse.org/papyrus/umlrt"
-	private static final String UMLRT_NS_URI = UMLRealTimePackage.eNS_URI;
-
-	/** {@link EPackage}. */
-	private static final UMLRealTimePackage UMLRT_PKG = UMLRealTimePackage.eINSTANCE;
-
-	/** Pathmap. */
-	private static final String UMLRT_PATHMAP = "pathmap://UML_RT_PROFILE/uml-rt.profile.uml";
-
-	/** Root node id. */
-	// TODO: Find out if this can be extracted programatically
-	private static final String UMLRT_ROOT_ID = "_1h74oEeVEeO0lv5O1DTHOQ";
-
-	/** Root URI. */
-	private static final String UMLRT_ROOT_URI = UMLRT_PATHMAP + "#" + UMLRT_ROOT_ID;
-
-	/** Subdirectory containing the model. */
-	private static final String UMLRT_PROFILE_SUBDIR = "umlProfile";
-
-	/** File containing the model. */
-	private static final String UMLRT_PROFILE_MODEL = "uml-rt.profile.uml";
-
-	/**
-	 * Default constructor. Private as this class should not be extended.
-	 *
-	 */
-	private UMLRTProfileMetadata() {
-	}
-
-	@Override
-	public String getPackageId() {
-		return UMLRT_PROFILE_ID;
-	}
-
-	@Override
-	public String getNSURI() {
-		return UMLRT_NS_URI;
-	}
-
-	@Override
-	public EPackage getPackage() {
-		return UMLRT_PKG;
-	}
-
-	@Override
-	public String getPathmap() {
-		return UMLRT_PATHMAP;
-	}
-
-	@Override
-	public String getRootId() {
-		return UMLRT_ROOT_ID;
-	}
-
-	@Override
-	public String getRootURI() {
-		return UMLRT_ROOT_URI;
-	}
-
-	@Override
-	public String getPackageSubdirectory() {
-		return UMLRT_PROFILE_SUBDIR;
-	}
-
-	@Override
-	public String getPackageModel() {
-		return UMLRT_PROFILE_MODEL;
-	}
-
-}
diff --git a/plugins/umlrt/codegen/org.eclipse.papyrusrt.codegen.standalone/umlrtgen.sh b/plugins/umlrt/codegen/org.eclipse.papyrusrt.codegen.standalone/umlrtgen.sh
index fbdb4b4..1dc7043 100755
--- a/plugins/umlrt/codegen/org.eclipse.papyrusrt.codegen.standalone/umlrtgen.sh
+++ b/plugins/umlrt/codegen/org.eclipse.papyrusrt.codegen.standalone/umlrtgen.sh
@@ -103,6 +103,7 @@
 find_jar_for org.eclipse.papyrusrt.xtumlrt.trans
 find_jar_for org.eclipse.papyrusrt.xtumlrt.umlrt.model
 find_jar_for org.eclipse.papyrusrt.xtumlrt.xtext
+find_jar_for org.eclipse.papyrusrt.xtumlrt.external
 find_jar_for org.eclipse.papyrusrt.xtumlrt.util
 find_plugindir_for org.eclipse.papyrusrt.codegen.standalone
 
diff --git a/plugins/umlrt/codegen/org.eclipse.papyrusrt.codegen.utils/src/org/eclipse/papyrusrt/codegen/utils/AbstractRegisteredPackageMetadata.java b/plugins/umlrt/codegen/org.eclipse.papyrusrt.codegen.utils/src/org/eclipse/papyrusrt/codegen/utils/AbstractRegisteredPackageMetadata.java
deleted file mode 100644
index 1454d91..0000000
--- a/plugins/umlrt/codegen/org.eclipse.papyrusrt.codegen.utils/src/org/eclipse/papyrusrt/codegen/utils/AbstractRegisteredPackageMetadata.java
+++ /dev/null
@@ -1,187 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2015 Zeligsoft (2009) Limited 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
- *******************************************************************************/
-package org.eclipse.papyrusrt.codegen.utils;
-
-import java.io.IOException;
-import java.net.URISyntaxException;
-import java.nio.file.FileSystemAlreadyExistsException;
-import java.nio.file.FileSystems;
-import java.nio.file.Path;
-import java.nio.file.Paths;
-import java.util.Collections;
-
-import org.eclipse.emf.common.util.URI;
-import org.eclipse.emf.ecore.EPackage;
-import org.eclipse.emf.ecore.resource.ResourceSet;
-import org.eclipse.uml2.uml.UMLPlugin;
-
-/**
- * Instances of subclasses of this class contain meta-data for various packages, models and profiles
- * that need to be loaded by the generator.
- * 
- * @author epp
- */
-@SuppressWarnings("restriction")
-public abstract class AbstractRegisteredPackageMetadata {
-
-	/** The instance of the {@link PluginFinder} used to locate plugins. */
-	public static final PluginFinder PLUGIN_FINDER = new PluginFinder();
-
-	/** Return the package id. @return The id as a {@link String}. */
-	public abstract String getPackageId();
-
-	/** Return the package name-space URI. @return The nsURI as a {@link String}. */
-	public abstract String getNSURI();
-
-	/** Return the {@link EPackage} for the package. @return The {@link EPackage}. */
-	public abstract EPackage getPackage();
-
-	/** Return the pathmap of the package. @return The pathmap as a {@link String}. */
-	public abstract String getPathmap();
-
-	/** Return the id of the package's root element. @return The root id as a {@link String}. */
-	public abstract String getRootId();
-
-	/** Return the uri of the package's root element. @return The root URI as a {@link String}. */
-	public abstract String getRootURI();
-
-	/** Return the subdirectory within the plugin where the package is stored. @return The path as a {@String}. */
-	public abstract String getPackageSubdirectory();
-
-	/** Return the name of the model file containing the package. @return The name as {@link String}. */
-	public abstract String getPackageModel();
-
-	/**
-	 * Registers the instance's package as a profile in the resource set's package registry.
-	 * 
-	 * @param resourceSet
-	 *            - A {@link ResourceSet}.
-	 */
-	public void registerProfile(ResourceSet resourceSet) {
-		// Register profile package in the resourceSet package registry
-		String nsUri = getNSURI();
-		EPackage pkg = getPackage();
-		String rootUri = getRootURI();
-		if (nsUri != null && pkg != null) {
-			resourceSet.getPackageRegistry().put(nsUri, pkg);
-		}
-		// Register the profile's NS_URI to its pathmap location
-		if (nsUri != null && rootUri != null) {
-			UMLPlugin.getEPackageNsURIToProfileLocationMap().put(nsUri, URI.createURI(rootUri));
-		}
-		// Register the actual profile location with the URIConverter
-		registerPackage(resourceSet);
-	}
-
-	/**
-	 * Registers the instance's package in the resource set's package registry.
-	 * 
-	 * @param resourceSet
-	 *            - A {@link ResourceSet}.
-	 */
-	public void registerPackage(ResourceSet resourceSet) {
-		String pathmap = getPathmap();
-		String loc = getPackageLocation();
-		if (pathmap != null && loc != null) {
-			resourceSet.getURIConverter()
-					.getURIMap()
-					.put(URI.createURI(pathmap),
-							URI.createURI(loc));
-		}
-	}
-
-	/**
-	 * Registers a given {@link EPackage} in the resource set's package registry.
-	 * 
-	 * @param resourceSet
-	 *            - A {@link ResourceSet}.
-	 * @param pkg
-	 *            - An {@link EPackage}.
-	 */
-	public void registerPackage(ResourceSet resourceSet, EPackage pkg) {
-		String nsUri = getNSURI();
-		// Register profile package in the resourceSet package registry
-		if (nsUri != null && pkg != null) {
-			resourceSet.getPackageRegistry().put(nsUri, pkg);
-		}
-		// Register the actual profile location with the URIConverter
-		registerPackage(resourceSet);
-	}
-
-	/**
-	 * Search for the plugins containing the packages with the provided package ids.
-	 * 
-	 * @param pkgIds
-	 *            - An array of package id's given as {@link String}s.
-	 */
-	public static void searchPlugins(String... pkgIds) {
-		for (String pkgId : pkgIds) {
-			PLUGIN_FINDER.addRequiredPlugin(pkgId);
-		}
-		PLUGIN_FINDER.resolve();
-		PLUGIN_FINDER.logResolvedMappings();
-	}
-
-	/**
-	 * Find the plugin that contains the profile.
-	 * 
-	 * @return A {@link String} with the path to the package.
-	 */
-	public String getPackageLocation() {
-		String resolvedPath = null;
-		String pkgId = getPackageId();
-		if (pkgId != null) {
-			String packageLoc = PLUGIN_FINDER.get(pkgId);
-			if (packageLoc != null) {
-				Path path = parsePath(packageLoc);
-				String subdir = getPackageSubdirectory();
-				if (subdir != null) {
-					path = path.resolve(subdir);
-				}
-				String pkgModel = getPackageModel();
-				if (pkgModel != null) {
-					path = path.resolve(pkgModel);
-				}
-				resolvedPath = path.toUri().toString();
-			}
-		}
-		return resolvedPath;
-	}
-
-	/**
-	 * Obtains a normalized path from the given bundle path. The bundle path may be a directory or a jar file and may be
-	 * specified with a URI with different schemes (e.g. 'file:', 'jar:', 'jar:file:') and different OS path separators.
-	 * Furthermore, if it is a jar bundle, it may or may not have associated path info, e.g. jar:file:/a/b!/c.
-	 * 
-	 * @param path
-	 *            - A {@link String} with the URI of a bundle.
-	 * @return The normalized {@link Path} of the given path.
-	 */
-	private Path parsePath(String path) {
-		Path result = null;
-		java.net.URI uri = null;
-		try {
-			uri = new java.net.URI(path);
-			if (uri.getScheme().equals("jar")) {
-				FileSystems.newFileSystem(uri, Collections.<String, Object> emptyMap());
-			}
-		} catch (URISyntaxException | IOException | FileSystemAlreadyExistsException e) {
-		}
-		result = Paths.get(uri);
-		return result;
-	}
-
-	public URI getPathmapURI() {
-		return URI.createURI(getPathmap());
-	}
-
-	public URI getPackageLocationURI() {
-		return URI.createURI(getPackageLocation());
-	}
-
-}
diff --git a/plugins/xtumlrt/common/org.eclipse.papyrusrt.xtumlrt.external/.checkstyle b/plugins/xtumlrt/common/org.eclipse.papyrusrt.xtumlrt.external/.checkstyle
new file mode 100644
index 0000000..f479982
--- /dev/null
+++ b/plugins/xtumlrt/common/org.eclipse.papyrusrt.xtumlrt.external/.checkstyle
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<fileset-config file-format-version="1.2.0" simple-config="true" sync-formatter="false">
+  <fileset name="all" enabled="true" check-config-name="Papyrus-RT" local="false">
+    <file-match-pattern match-pattern="." include-pattern="true"/>
+  </fileset>
+</fileset-config>
diff --git a/plugins/xtumlrt/common/org.eclipse.papyrusrt.xtumlrt.external/.classpath b/plugins/xtumlrt/common/org.eclipse.papyrusrt.xtumlrt.external/.classpath
new file mode 100644
index 0000000..428337e
--- /dev/null
+++ b/plugins/xtumlrt/common/org.eclipse.papyrusrt.xtumlrt.external/.classpath
@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+	<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="xtend-gen"/>
+	<classpathentry kind="output" path="bin"/>
+</classpath>
diff --git a/plugins/xtumlrt/common/org.eclipse.papyrusrt.xtumlrt.external/.project b/plugins/xtumlrt/common/org.eclipse.papyrusrt.xtumlrt.external/.project
new file mode 100644
index 0000000..ba82bd4
--- /dev/null
+++ b/plugins/xtumlrt/common/org.eclipse.papyrusrt.xtumlrt.external/.project
@@ -0,0 +1,40 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+	<name>org.eclipse.papyrusrt.xtumlrt.external</name>
+	<comment></comment>
+	<projects>
+	</projects>
+	<buildSpec>
+		<buildCommand>
+			<name>org.eclipse.xtext.ui.shared.xtextBuilder</name>
+			<arguments>
+			</arguments>
+		</buildCommand>
+		<buildCommand>
+			<name>org.eclipse.jdt.core.javabuilder</name>
+			<arguments>
+			</arguments>
+		</buildCommand>
+		<buildCommand>
+			<name>org.eclipse.pde.ManifestBuilder</name>
+			<arguments>
+			</arguments>
+		</buildCommand>
+		<buildCommand>
+			<name>org.eclipse.pde.SchemaBuilder</name>
+			<arguments>
+			</arguments>
+		</buildCommand>
+		<buildCommand>
+			<name>net.sf.eclipsecs.core.CheckstyleBuilder</name>
+			<arguments>
+			</arguments>
+		</buildCommand>
+	</buildSpec>
+	<natures>
+		<nature>org.eclipse.pde.PluginNature</nature>
+		<nature>org.eclipse.jdt.core.javanature</nature>
+		<nature>net.sf.eclipsecs.core.CheckstyleNature</nature>
+		<nature>org.eclipse.xtext.ui.shared.xtextNature</nature>
+	</natures>
+</projectDescription>
diff --git a/plugins/xtumlrt/common/org.eclipse.papyrusrt.xtumlrt.external/.settings/org.eclipse.core.resources.prefs b/plugins/xtumlrt/common/org.eclipse.papyrusrt.xtumlrt.external/.settings/org.eclipse.core.resources.prefs
new file mode 100644
index 0000000..99f26c0
--- /dev/null
+++ b/plugins/xtumlrt/common/org.eclipse.papyrusrt.xtumlrt.external/.settings/org.eclipse.core.resources.prefs
@@ -0,0 +1,2 @@
+eclipse.preferences.version=1
+encoding/<project>=UTF-8
diff --git a/plugins/xtumlrt/common/org.eclipse.papyrusrt.xtumlrt.external/.settings/org.eclipse.jdt.core.prefs b/plugins/xtumlrt/common/org.eclipse.papyrusrt.xtumlrt.external/.settings/org.eclipse.jdt.core.prefs
new file mode 100644
index 0000000..28f0d0f
--- /dev/null
+++ b/plugins/xtumlrt/common/org.eclipse.papyrusrt.xtumlrt.external/.settings/org.eclipse.jdt.core.prefs
@@ -0,0 +1,297 @@
+eclipse.preferences.version=1
+org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
+org.eclipse.jdt.core.compiler.codegen.methodParameters=do not generate
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.7
+org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
+org.eclipse.jdt.core.compiler.compliance=1.7
+org.eclipse.jdt.core.compiler.debug.lineNumber=generate
+org.eclipse.jdt.core.compiler.debug.localVariable=generate
+org.eclipse.jdt.core.compiler.debug.sourceFile=generate
+org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
+org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
+org.eclipse.jdt.core.compiler.source=1.7
+org.eclipse.jdt.core.formatter.align_type_members_on_columns=false
+org.eclipse.jdt.core.formatter.alignment_for_arguments_in_allocation_expression=16
+org.eclipse.jdt.core.formatter.alignment_for_arguments_in_annotation=0
+org.eclipse.jdt.core.formatter.alignment_for_arguments_in_enum_constant=16
+org.eclipse.jdt.core.formatter.alignment_for_arguments_in_explicit_constructor_call=16
+org.eclipse.jdt.core.formatter.alignment_for_arguments_in_method_invocation=16
+org.eclipse.jdt.core.formatter.alignment_for_arguments_in_qualified_allocation_expression=16
+org.eclipse.jdt.core.formatter.alignment_for_assignment=0
+org.eclipse.jdt.core.formatter.alignment_for_binary_expression=16
+org.eclipse.jdt.core.formatter.alignment_for_compact_if=16
+org.eclipse.jdt.core.formatter.alignment_for_conditional_expression=80
+org.eclipse.jdt.core.formatter.alignment_for_enum_constants=0
+org.eclipse.jdt.core.formatter.alignment_for_expressions_in_array_initializer=16
+org.eclipse.jdt.core.formatter.alignment_for_method_declaration=0
+org.eclipse.jdt.core.formatter.alignment_for_multiple_fields=16
+org.eclipse.jdt.core.formatter.alignment_for_parameters_in_constructor_declaration=16
+org.eclipse.jdt.core.formatter.alignment_for_parameters_in_method_declaration=16
+org.eclipse.jdt.core.formatter.alignment_for_resources_in_try=80
+org.eclipse.jdt.core.formatter.alignment_for_selector_in_method_invocation=16
+org.eclipse.jdt.core.formatter.alignment_for_superclass_in_type_declaration=16
+org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_enum_declaration=16
+org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_type_declaration=16
+org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_constructor_declaration=16
+org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_method_declaration=16
+org.eclipse.jdt.core.formatter.alignment_for_union_type_in_multicatch=16
+org.eclipse.jdt.core.formatter.blank_lines_after_imports=1
+org.eclipse.jdt.core.formatter.blank_lines_after_package=1
+org.eclipse.jdt.core.formatter.blank_lines_before_field=0
+org.eclipse.jdt.core.formatter.blank_lines_before_first_class_body_declaration=0
+org.eclipse.jdt.core.formatter.blank_lines_before_imports=1
+org.eclipse.jdt.core.formatter.blank_lines_before_member_type=1
+org.eclipse.jdt.core.formatter.blank_lines_before_method=1
+org.eclipse.jdt.core.formatter.blank_lines_before_new_chunk=1
+org.eclipse.jdt.core.formatter.blank_lines_before_package=0
+org.eclipse.jdt.core.formatter.blank_lines_between_import_groups=1
+org.eclipse.jdt.core.formatter.blank_lines_between_type_declarations=1
+org.eclipse.jdt.core.formatter.brace_position_for_annotation_type_declaration=end_of_line
+org.eclipse.jdt.core.formatter.brace_position_for_anonymous_type_declaration=end_of_line
+org.eclipse.jdt.core.formatter.brace_position_for_array_initializer=end_of_line
+org.eclipse.jdt.core.formatter.brace_position_for_block=end_of_line
+org.eclipse.jdt.core.formatter.brace_position_for_block_in_case=end_of_line
+org.eclipse.jdt.core.formatter.brace_position_for_constructor_declaration=end_of_line
+org.eclipse.jdt.core.formatter.brace_position_for_enum_constant=end_of_line
+org.eclipse.jdt.core.formatter.brace_position_for_enum_declaration=end_of_line
+org.eclipse.jdt.core.formatter.brace_position_for_lambda_body=end_of_line
+org.eclipse.jdt.core.formatter.brace_position_for_method_declaration=end_of_line
+org.eclipse.jdt.core.formatter.brace_position_for_switch=end_of_line
+org.eclipse.jdt.core.formatter.brace_position_for_type_declaration=end_of_line
+org.eclipse.jdt.core.formatter.comment.clear_blank_lines_in_block_comment=false
+org.eclipse.jdt.core.formatter.comment.clear_blank_lines_in_javadoc_comment=false
+org.eclipse.jdt.core.formatter.comment.format_block_comments=true
+org.eclipse.jdt.core.formatter.comment.format_header=false
+org.eclipse.jdt.core.formatter.comment.format_html=true
+org.eclipse.jdt.core.formatter.comment.format_javadoc_comments=true
+org.eclipse.jdt.core.formatter.comment.format_line_comments=true
+org.eclipse.jdt.core.formatter.comment.format_source_code=true
+org.eclipse.jdt.core.formatter.comment.indent_parameter_description=true
+org.eclipse.jdt.core.formatter.comment.indent_root_tags=true
+org.eclipse.jdt.core.formatter.comment.insert_new_line_before_root_tags=insert
+org.eclipse.jdt.core.formatter.comment.insert_new_line_for_parameter=insert
+org.eclipse.jdt.core.formatter.comment.line_length=260
+org.eclipse.jdt.core.formatter.comment.new_lines_at_block_boundaries=true
+org.eclipse.jdt.core.formatter.comment.new_lines_at_javadoc_boundaries=true
+org.eclipse.jdt.core.formatter.comment.preserve_white_space_between_code_and_line_comments=false
+org.eclipse.jdt.core.formatter.compact_else_if=true
+org.eclipse.jdt.core.formatter.continuation_indentation=2
+org.eclipse.jdt.core.formatter.continuation_indentation_for_array_initializer=2
+org.eclipse.jdt.core.formatter.disabling_tag=@formatter\:off
+org.eclipse.jdt.core.formatter.enabling_tag=@formatter\:on
+org.eclipse.jdt.core.formatter.format_guardian_clause_on_one_line=false
+org.eclipse.jdt.core.formatter.format_line_comment_starting_on_first_column=true
+org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_annotation_declaration_header=true
+org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_enum_constant_header=true
+org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_enum_declaration_header=true
+org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_type_header=true
+org.eclipse.jdt.core.formatter.indent_breaks_compare_to_cases=true
+org.eclipse.jdt.core.formatter.indent_empty_lines=false
+org.eclipse.jdt.core.formatter.indent_statements_compare_to_block=true
+org.eclipse.jdt.core.formatter.indent_statements_compare_to_body=true
+org.eclipse.jdt.core.formatter.indent_switchstatements_compare_to_cases=true
+org.eclipse.jdt.core.formatter.indent_switchstatements_compare_to_switch=false
+org.eclipse.jdt.core.formatter.indentation.size=4
+org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_field=insert
+org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_local_variable=insert
+org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_method=insert
+org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_package=insert
+org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_parameter=do not insert
+org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_type=insert
+org.eclipse.jdt.core.formatter.insert_new_line_after_label=do not insert
+org.eclipse.jdt.core.formatter.insert_new_line_after_opening_brace_in_array_initializer=do not insert
+org.eclipse.jdt.core.formatter.insert_new_line_after_type_annotation=do not insert
+org.eclipse.jdt.core.formatter.insert_new_line_at_end_of_file_if_missing=do not insert
+org.eclipse.jdt.core.formatter.insert_new_line_before_catch_in_try_statement=do not insert
+org.eclipse.jdt.core.formatter.insert_new_line_before_closing_brace_in_array_initializer=do not insert
+org.eclipse.jdt.core.formatter.insert_new_line_before_else_in_if_statement=do not insert
+org.eclipse.jdt.core.formatter.insert_new_line_before_finally_in_try_statement=do not insert
+org.eclipse.jdt.core.formatter.insert_new_line_before_while_in_do_statement=do not insert
+org.eclipse.jdt.core.formatter.insert_new_line_in_empty_annotation_declaration=insert
+org.eclipse.jdt.core.formatter.insert_new_line_in_empty_anonymous_type_declaration=insert
+org.eclipse.jdt.core.formatter.insert_new_line_in_empty_block=insert
+org.eclipse.jdt.core.formatter.insert_new_line_in_empty_enum_constant=insert
+org.eclipse.jdt.core.formatter.insert_new_line_in_empty_enum_declaration=insert
+org.eclipse.jdt.core.formatter.insert_new_line_in_empty_method_body=insert
+org.eclipse.jdt.core.formatter.insert_new_line_in_empty_type_declaration=insert
+org.eclipse.jdt.core.formatter.insert_space_after_and_in_type_parameter=insert
+org.eclipse.jdt.core.formatter.insert_space_after_assignment_operator=insert
+org.eclipse.jdt.core.formatter.insert_space_after_at_in_annotation=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_at_in_annotation_type_declaration=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_binary_operator=insert
+org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_arguments=insert
+org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_parameters=insert
+org.eclipse.jdt.core.formatter.insert_space_after_closing_brace_in_block=insert
+org.eclipse.jdt.core.formatter.insert_space_after_closing_paren_in_cast=insert
+org.eclipse.jdt.core.formatter.insert_space_after_colon_in_assert=insert
+org.eclipse.jdt.core.formatter.insert_space_after_colon_in_case=insert
+org.eclipse.jdt.core.formatter.insert_space_after_colon_in_conditional=insert
+org.eclipse.jdt.core.formatter.insert_space_after_colon_in_for=insert
+org.eclipse.jdt.core.formatter.insert_space_after_colon_in_labeled_statement=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_allocation_expression=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_annotation=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_array_initializer=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_constructor_declaration_parameters=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_constructor_declaration_throws=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_enum_constant_arguments=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_enum_declarations=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_explicitconstructorcall_arguments=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_for_increments=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_for_inits=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_declaration_parameters=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_declaration_throws=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_invocation_arguments=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_multiple_field_declarations=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_multiple_local_declarations=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_parameterized_type_reference=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_superinterfaces=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_type_arguments=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_type_parameters=insert
+org.eclipse.jdt.core.formatter.insert_space_after_ellipsis=insert
+org.eclipse.jdt.core.formatter.insert_space_after_lambda_arrow=insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_parameterized_type_reference=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_type_arguments=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_type_parameters=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_brace_in_array_initializer=insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_bracket_in_array_allocation_expression=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_bracket_in_array_reference=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_annotation=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_cast=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_catch=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_constructor_declaration=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_enum_constant=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_for=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_if=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_method_declaration=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_method_invocation=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_parenthesized_expression=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_switch=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_synchronized=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_try=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_while=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_postfix_operator=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_prefix_operator=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_question_in_conditional=insert
+org.eclipse.jdt.core.formatter.insert_space_after_question_in_wildcard=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_semicolon_in_for=insert
+org.eclipse.jdt.core.formatter.insert_space_after_semicolon_in_try_resources=insert
+org.eclipse.jdt.core.formatter.insert_space_after_unary_operator=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_and_in_type_parameter=insert
+org.eclipse.jdt.core.formatter.insert_space_before_assignment_operator=insert
+org.eclipse.jdt.core.formatter.insert_space_before_at_in_annotation_type_declaration=insert
+org.eclipse.jdt.core.formatter.insert_space_before_binary_operator=insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_parameterized_type_reference=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_type_arguments=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_type_parameters=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_brace_in_array_initializer=insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_bracket_in_array_allocation_expression=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_bracket_in_array_reference=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_annotation=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_cast=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_catch=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_constructor_declaration=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_enum_constant=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_for=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_if=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_method_declaration=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_method_invocation=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_parenthesized_expression=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_switch=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_synchronized=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_try=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_while=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_colon_in_assert=insert
+org.eclipse.jdt.core.formatter.insert_space_before_colon_in_case=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_colon_in_conditional=insert
+org.eclipse.jdt.core.formatter.insert_space_before_colon_in_default=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_colon_in_for=insert
+org.eclipse.jdt.core.formatter.insert_space_before_colon_in_labeled_statement=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_allocation_expression=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_annotation=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_array_initializer=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_constructor_declaration_parameters=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_constructor_declaration_throws=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_enum_constant_arguments=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_enum_declarations=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_explicitconstructorcall_arguments=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_for_increments=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_for_inits=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_declaration_parameters=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_declaration_throws=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_invocation_arguments=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_multiple_field_declarations=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_multiple_local_declarations=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_parameterized_type_reference=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_superinterfaces=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_type_arguments=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_type_parameters=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_ellipsis=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_lambda_arrow=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_parameterized_type_reference=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_type_arguments=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_type_parameters=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_annotation_type_declaration=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_anonymous_type_declaration=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_array_initializer=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_block=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_constructor_declaration=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_enum_constant=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_enum_declaration=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_method_declaration=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_switch=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_type_declaration=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_allocation_expression=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_reference=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_type_reference=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_annotation=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_annotation_type_member_declaration=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_catch=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_constructor_declaration=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_enum_constant=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_for=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_if=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_method_declaration=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_method_invocation=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_parenthesized_expression=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_switch=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_synchronized=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_try=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_while=insert
+org.eclipse.jdt.core.formatter.insert_space_before_parenthesized_expression_in_return=insert
+org.eclipse.jdt.core.formatter.insert_space_before_parenthesized_expression_in_throw=insert
+org.eclipse.jdt.core.formatter.insert_space_before_postfix_operator=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_prefix_operator=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_question_in_conditional=insert
+org.eclipse.jdt.core.formatter.insert_space_before_question_in_wildcard=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_semicolon=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_semicolon_in_for=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_semicolon_in_try_resources=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_unary_operator=do not insert
+org.eclipse.jdt.core.formatter.insert_space_between_brackets_in_array_type_reference=do not insert
+org.eclipse.jdt.core.formatter.insert_space_between_empty_braces_in_array_initializer=do not insert
+org.eclipse.jdt.core.formatter.insert_space_between_empty_brackets_in_array_allocation_expression=do not insert
+org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_annotation_type_member_declaration=do not insert
+org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_constructor_declaration=do not insert
+org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_enum_constant=do not insert
+org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_method_declaration=do not insert
+org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_method_invocation=do not insert
+org.eclipse.jdt.core.formatter.join_lines_in_comments=false
+org.eclipse.jdt.core.formatter.join_wrapped_lines=false
+org.eclipse.jdt.core.formatter.keep_else_statement_on_same_line=false
+org.eclipse.jdt.core.formatter.keep_empty_array_initializer_on_one_line=false
+org.eclipse.jdt.core.formatter.keep_imple_if_on_one_line=false
+org.eclipse.jdt.core.formatter.keep_then_statement_on_same_line=false
+org.eclipse.jdt.core.formatter.lineSplit=260
+org.eclipse.jdt.core.formatter.never_indent_block_comments_on_first_column=false
+org.eclipse.jdt.core.formatter.never_indent_line_comments_on_first_column=false
+org.eclipse.jdt.core.formatter.number_of_blank_lines_at_beginning_of_method_body=0
+org.eclipse.jdt.core.formatter.number_of_empty_lines_to_preserve=5
+org.eclipse.jdt.core.formatter.put_empty_statement_on_new_line=true
+org.eclipse.jdt.core.formatter.tabulation.char=tab
+org.eclipse.jdt.core.formatter.tabulation.size=4
+org.eclipse.jdt.core.formatter.use_on_off_tags=false
+org.eclipse.jdt.core.formatter.use_tabs_only_for_leading_indentations=false
+org.eclipse.jdt.core.formatter.wrap_before_binary_operator=true
+org.eclipse.jdt.core.formatter.wrap_before_or_operator_multicatch=true
+org.eclipse.jdt.core.formatter.wrap_outer_expressions_when_nested=true
+org.eclipse.jdt.core.javaFormatter=org.eclipse.jdt.core.defaultJavaFormatter
diff --git a/plugins/xtumlrt/common/org.eclipse.papyrusrt.xtumlrt.external/.settings/org.eclipse.jdt.ui.prefs b/plugins/xtumlrt/common/org.eclipse.papyrusrt.xtumlrt.external/.settings/org.eclipse.jdt.ui.prefs
new file mode 100644
index 0000000..b22a3a0
--- /dev/null
+++ b/plugins/xtumlrt/common/org.eclipse.papyrusrt.xtumlrt.external/.settings/org.eclipse.jdt.ui.prefs
@@ -0,0 +1,127 @@
+cleanup.add_default_serial_version_id=true
+cleanup.add_generated_serial_version_id=false
+cleanup.add_missing_annotations=true
+cleanup.add_missing_deprecated_annotations=true
+cleanup.add_missing_methods=false
+cleanup.add_missing_nls_tags=false
+cleanup.add_missing_override_annotations=true
+cleanup.add_missing_override_annotations_interface_methods=true
+cleanup.add_serial_version_id=false
+cleanup.always_use_blocks=true
+cleanup.always_use_parentheses_in_expressions=false
+cleanup.always_use_this_for_non_static_field_access=false
+cleanup.always_use_this_for_non_static_method_access=false
+cleanup.convert_functional_interfaces=false
+cleanup.convert_to_enhanced_for_loop=false
+cleanup.correct_indentation=false
+cleanup.format_source_code=false
+cleanup.format_source_code_changes_only=false
+cleanup.insert_inferred_type_arguments=false
+cleanup.make_local_variable_final=true
+cleanup.make_parameters_final=false
+cleanup.make_private_fields_final=true
+cleanup.make_type_abstract_if_missing_method=false
+cleanup.make_variable_declarations_final=false
+cleanup.never_use_blocks=false
+cleanup.never_use_parentheses_in_expressions=true
+cleanup.organize_imports=false
+cleanup.qualify_static_field_accesses_with_declaring_class=false
+cleanup.qualify_static_member_accesses_through_instances_with_declaring_class=true
+cleanup.qualify_static_member_accesses_through_subtypes_with_declaring_class=true
+cleanup.qualify_static_member_accesses_with_declaring_class=true
+cleanup.qualify_static_method_accesses_with_declaring_class=false
+cleanup.remove_private_constructors=true
+cleanup.remove_redundant_type_arguments=true
+cleanup.remove_trailing_whitespaces=true
+cleanup.remove_trailing_whitespaces_all=true
+cleanup.remove_trailing_whitespaces_ignore_empty=false
+cleanup.remove_unnecessary_casts=true
+cleanup.remove_unnecessary_nls_tags=true
+cleanup.remove_unused_imports=true
+cleanup.remove_unused_local_variables=false
+cleanup.remove_unused_private_fields=true
+cleanup.remove_unused_private_members=false
+cleanup.remove_unused_private_methods=true
+cleanup.remove_unused_private_types=true
+cleanup.sort_members=false
+cleanup.sort_members_all=false
+cleanup.use_anonymous_class_creation=false
+cleanup.use_blocks=true
+cleanup.use_blocks_only_for_return_and_throw=false
+cleanup.use_lambda=true
+cleanup.use_parentheses_in_expressions=false
+cleanup.use_this_for_non_static_field_access=false
+cleanup.use_this_for_non_static_field_access_only_if_necessary=true
+cleanup.use_this_for_non_static_method_access=false
+cleanup.use_this_for_non_static_method_access_only_if_necessary=true
+cleanup.use_type_arguments=false
+cleanup_profile=_Papyrus
+cleanup_settings_version=2
+eclipse.preferences.version=1
+editor_save_participant_org.eclipse.jdt.ui.postsavelistener.cleanup=true
+formatter_profile=_Papyrus
+formatter_settings_version=12
+org.eclipse.jdt.ui.ignorelowercasenames=true
+org.eclipse.jdt.ui.importorder=java;javax;org;com;
+org.eclipse.jdt.ui.javadoc=true
+org.eclipse.jdt.ui.ondemandthreshold=99
+org.eclipse.jdt.ui.staticondemandthreshold=99
+org.eclipse.jdt.ui.text.custom_code_templates=<?xml version\="1.0" encoding\="UTF-8" standalone\="no"?><templates><template autoinsert\="true" context\="gettercomment_context" deleted\="false" description\="Comment for getter method" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.gettercomment" name\="gettercomment">/**\n * @return the ${bare_field_name}\n */</template><template autoinsert\="true" context\="settercomment_context" deleted\="false" description\="Comment for setter method" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.settercomment" name\="settercomment">/**\n * @param ${param} the ${bare_field_name} to set\n */</template><template autoinsert\="false" context\="constructorcomment_context" deleted\="false" description\="Comment for created constructors" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.constructorcomment" name\="constructorcomment">/**\n * Constructor.\n *\n * ${tags}\n */</template><template autoinsert\="false" context\="filecomment_context" deleted\="false" description\="Comment for created Java files" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.filecomment" name\="filecomment">/*****************************************************************************\n * Copyright (c) ${year} CEA LIST and others.\n * \n * All rights reserved. This program and the accompanying materials\n * are made available under the terms of the Eclipse Public License v1.0\n * which accompanies this distribution, and is available at\n * http\://www.eclipse.org/legal/epl-v10.html\n *\n * Contributors\:\n *   CEA LIST - Initial API and implementation\n *   \n *****************************************************************************/\n</template><template autoinsert\="true" context\="typecomment_context" deleted\="false" description\="Comment for created types" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.typecomment" name\="typecomment">/**\n * @author ${user}\n *\n * ${tags}\n */</template><template autoinsert\="true" context\="fieldcomment_context" deleted\="false" description\="Comment for fields" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.fieldcomment" name\="fieldcomment">/**\n * \n */</template><template autoinsert\="true" context\="methodcomment_context" deleted\="false" description\="Comment for non-overriding methods" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.methodcomment" name\="methodcomment">/**\n * ${tags}\n */</template><template autoinsert\="false" context\="overridecomment_context" deleted\="false" description\="Comment for overriding methods" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.overridecomment" name\="overridecomment">/**\n * ${see_to_overridden}\n *\n * ${tags}\n */</template><template autoinsert\="false" context\="delegatecomment_context" deleted\="false" description\="Comment for delegate methods" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.delegatecomment" name\="delegatecomment">/**\n * ${see_to_target}\n *\n * ${tags}\n */</template><template autoinsert\="true" context\="newtype_context" deleted\="false" description\="Newly created files" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.newtype" name\="newtype">${filecomment}\n${package_declaration}\n\n${typecomment}\n${type_declaration}</template><template autoinsert\="true" context\="classbody_context" deleted\="false" description\="Code in new class type bodies" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.classbody" name\="classbody">\n</template><template autoinsert\="true" context\="interfacebody_context" deleted\="false" description\="Code in new interface type bodies" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.interfacebody" name\="interfacebody">\n</template><template autoinsert\="true" context\="enumbody_context" deleted\="false" description\="Code in new enum type bodies" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.enumbody" name\="enumbody">\n</template><template autoinsert\="true" context\="annotationbody_context" deleted\="false" description\="Code in new annotation type bodies" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.annotationbody" name\="annotationbody">\n</template><template autoinsert\="true" context\="catchblock_context" deleted\="false" description\="Code in new catch blocks" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.catchblock" name\="catchblock">// ${todo} Auto-generated catch block\n${exception_var}.printStackTrace();</template><template autoinsert\="true" context\="methodbody_context" deleted\="false" description\="Code in created method stubs" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.methodbody" name\="methodbody">// ${todo} Auto-generated method stub\n${body_statement}</template><template autoinsert\="true" context\="constructorbody_context" deleted\="false" description\="Code in created constructor stubs" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.constructorbody" name\="constructorbody">${body_statement}\n// ${todo} Auto-generated constructor stub</template><template autoinsert\="true" context\="getterbody_context" deleted\="false" description\="Code in created getters" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.getterbody" name\="getterbody">return ${field};</template><template autoinsert\="true" context\="setterbody_context" deleted\="false" description\="Code in created setters" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.setterbody" name\="setterbody">${field} \= ${param};</template></templates>
+sp_cleanup.add_default_serial_version_id=true
+sp_cleanup.add_generated_serial_version_id=false
+sp_cleanup.add_missing_annotations=true
+sp_cleanup.add_missing_deprecated_annotations=true
+sp_cleanup.add_missing_methods=false
+sp_cleanup.add_missing_nls_tags=false
+sp_cleanup.add_missing_override_annotations=true
+sp_cleanup.add_missing_override_annotations_interface_methods=true
+sp_cleanup.add_serial_version_id=false
+sp_cleanup.always_use_blocks=true
+sp_cleanup.always_use_parentheses_in_expressions=false
+sp_cleanup.always_use_this_for_non_static_field_access=false
+sp_cleanup.always_use_this_for_non_static_method_access=false
+sp_cleanup.convert_functional_interfaces=false
+sp_cleanup.convert_to_enhanced_for_loop=false
+sp_cleanup.correct_indentation=false
+sp_cleanup.format_source_code=true
+sp_cleanup.format_source_code_changes_only=false
+sp_cleanup.insert_inferred_type_arguments=false
+sp_cleanup.make_local_variable_final=true
+sp_cleanup.make_parameters_final=false
+sp_cleanup.make_private_fields_final=true
+sp_cleanup.make_type_abstract_if_missing_method=false
+sp_cleanup.make_variable_declarations_final=false
+sp_cleanup.never_use_blocks=false
+sp_cleanup.never_use_parentheses_in_expressions=true
+sp_cleanup.on_save_use_additional_actions=true
+sp_cleanup.organize_imports=true
+sp_cleanup.qualify_static_field_accesses_with_declaring_class=false
+sp_cleanup.qualify_static_member_accesses_through_instances_with_declaring_class=true
+sp_cleanup.qualify_static_member_accesses_through_subtypes_with_declaring_class=true
+sp_cleanup.qualify_static_member_accesses_with_declaring_class=false
+sp_cleanup.qualify_static_method_accesses_with_declaring_class=false
+sp_cleanup.remove_private_constructors=true
+sp_cleanup.remove_redundant_type_arguments=true
+sp_cleanup.remove_trailing_whitespaces=false
+sp_cleanup.remove_trailing_whitespaces_all=true
+sp_cleanup.remove_trailing_whitespaces_ignore_empty=false
+sp_cleanup.remove_unnecessary_casts=true
+sp_cleanup.remove_unnecessary_nls_tags=false
+sp_cleanup.remove_unused_imports=false
+sp_cleanup.remove_unused_local_variables=false
+sp_cleanup.remove_unused_private_fields=true
+sp_cleanup.remove_unused_private_members=false
+sp_cleanup.remove_unused_private_methods=true
+sp_cleanup.remove_unused_private_types=true
+sp_cleanup.sort_members=false
+sp_cleanup.sort_members_all=false
+sp_cleanup.use_anonymous_class_creation=false
+sp_cleanup.use_blocks=false
+sp_cleanup.use_blocks_only_for_return_and_throw=false
+sp_cleanup.use_lambda=true
+sp_cleanup.use_parentheses_in_expressions=false
+sp_cleanup.use_this_for_non_static_field_access=false
+sp_cleanup.use_this_for_non_static_field_access_only_if_necessary=true
+sp_cleanup.use_this_for_non_static_method_access=false
+sp_cleanup.use_this_for_non_static_method_access_only_if_necessary=true
+sp_cleanup.use_type_arguments=false
diff --git a/plugins/xtumlrt/common/org.eclipse.papyrusrt.xtumlrt.external/META-INF/MANIFEST.MF b/plugins/xtumlrt/common/org.eclipse.papyrusrt.xtumlrt.external/META-INF/MANIFEST.MF
new file mode 100644
index 0000000..22a2842
--- /dev/null
+++ b/plugins/xtumlrt/common/org.eclipse.papyrusrt.xtumlrt.external/META-INF/MANIFEST.MF
@@ -0,0 +1,17 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: PapyrusRT - XtUML-RT External Packages
+Bundle-SymbolicName: org.eclipse.papyrusrt.xtumlrt.external;singleton:=true
+Bundle-Version: 0.7.2.qualifier
+Bundle-Vendor: Zeligsoft (2009) Ltd.
+Bundle-RequiredExecutionEnvironment: JavaSE-1.8
+Require-Bundle: org.eclipse.papyrusrt.xtumlrt.util;bundle-version="0.7.2",
+ org.eclipse.emf.ecore,
+ org.eclipse.uml2.uml,
+ org.eclipse.papyrusrt.umlrt.profile;bundle-version="0.7.2",
+ org.eclipse.core.runtime;bundle-version="3.12.0",
+ org.eclipse.xtend.lib;bundle-version="2.10.0",
+ org.eclipse.uml2.uml.resources,
+ org.eclipse.papyrusrt.xtumlrt.common.model;bundle-version="0.7.2"
+Export-Package: org.eclipse.papyrusrt.xtumlrt.external,
+ org.eclipse.papyrusrt.xtumlrt.external.predefined
diff --git a/plugins/xtumlrt/common/org.eclipse.papyrusrt.xtumlrt.external/about.html b/plugins/xtumlrt/common/org.eclipse.papyrusrt.xtumlrt.external/about.html
new file mode 100755
index 0000000..d35d5ae
--- /dev/null
+++ b/plugins/xtumlrt/common/org.eclipse.papyrusrt.xtumlrt.external/about.html
@@ -0,0 +1,28 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
+    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml">
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"/>
+<title>About</title>
+</head>
+<body lang="EN-US">
+<h2>About This Content</h2>
+ 
+<p>June 5, 2007</p>	
+<h3>License</h3>
+
+<p>The Eclipse Foundation makes available all content in this plug-in (&quot;Content&quot;).  Unless otherwise 
+indicated below, the Content is provided to you under the terms and conditions of the
+Eclipse Public License Version 1.0 (&quot;EPL&quot;).  A copy of the EPL is available 
+at <a href="http://www.eclipse.org/legal/epl-v10.html">http://www.eclipse.org/legal/epl-v10.html</a>.
+For purposes of the EPL, &quot;Program&quot; will mean the Content.</p>
+
+<p>If you did not receive this Content directly from the Eclipse Foundation, the Content is 
+being redistributed by another party (&quot;Redistributor&quot;) and different terms and conditions may
+apply to your use of any object code in the Content.  Check the Redistributor's license that was 
+provided with the Content.  If no such license exists, contact the Redistributor.  Unless otherwise
+indicated below, the terms and conditions of the EPL still apply to any source code in the Content
+and such source code may be obtained at <a href="http://www.eclipse.org/">http://www.eclipse.org</a>.</p>
+
+</body>
+</html>
diff --git a/plugins/xtumlrt/common/org.eclipse.papyrusrt.xtumlrt.external/about.properties b/plugins/xtumlrt/common/org.eclipse.papyrusrt.xtumlrt.external/about.properties
new file mode 100755
index 0000000..ee25a34
--- /dev/null
+++ b/plugins/xtumlrt/common/org.eclipse.papyrusrt.xtumlrt.external/about.properties
@@ -0,0 +1,12 @@
+# about.properties
+# contains externalized strings for about.ini
+# java.io.Properties file (ISO 8859-1 with "\" escapes)
+# fill-ins are supplied by about.mappings
+# This file should be translated.
+
+featureText=Papyrus for Real Time (Papyrus-RT) \n\
+\n\
+Copyright (c) 2014-2015 Zeligsoft (2009) Limited and others
+\n\
+Papyrus-RT is an industrial-grade, complete modeling environment for the development of complex, software intensive, real-time, embedded, cyber-physical systems.
+Visit https://projects.eclipse.org/projects/modeling.papyrus-rt
diff --git a/plugins/xtumlrt/common/org.eclipse.papyrusrt.xtumlrt.external/build.properties b/plugins/xtumlrt/common/org.eclipse.papyrusrt.xtumlrt.external/build.properties
new file mode 100644
index 0000000..600d1b4
--- /dev/null
+++ b/plugins/xtumlrt/common/org.eclipse.papyrusrt.xtumlrt.external/build.properties
@@ -0,0 +1,6 @@
+source.. = src/,\
+           xtend-gen/
+output.. = bin/
+bin.includes = META-INF/,\
+               .,\
+               plugin.xml
diff --git a/plugins/xtumlrt/common/org.eclipse.papyrusrt.xtumlrt.external/plugin.xml b/plugins/xtumlrt/common/org.eclipse.papyrusrt.xtumlrt.external/plugin.xml
new file mode 100644
index 0000000..5535690
--- /dev/null
+++ b/plugins/xtumlrt/common/org.eclipse.papyrusrt.xtumlrt.external/plugin.xml
@@ -0,0 +1,5 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<?eclipse version="3.4"?>
+<plugin>
+
+</plugin>
diff --git a/plugins/xtumlrt/common/org.eclipse.papyrusrt.xtumlrt.external/pom.xml b/plugins/xtumlrt/common/org.eclipse.papyrusrt.xtumlrt.external/pom.xml
new file mode 100644
index 0000000..849d0b0
--- /dev/null
+++ b/plugins/xtumlrt/common/org.eclipse.papyrusrt.xtumlrt.external/pom.xml
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project
+	xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"
+	xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
+
+	<modelVersion>4.0.0</modelVersion>
+	<groupId>org.eclipse.papyrusrt</groupId>
+	<artifactId>org.eclipse.papyrusrt.xtumlrt.external</artifactId>
+	<version>0.7.2-SNAPSHOT</version>
+	<packaging>eclipse-plugin</packaging>
+
+	<parent>
+		<groupId>org.eclipse.papyrusrt</groupId>
+		<artifactId>umlrt.code-generator</artifactId>
+		<version>0.7.2-SNAPSHOT</version>
+		<relativePath>../../../../releng/codegen/pom.xml</relativePath>
+	</parent>
+
+	<build>
+		<plugins>
+			<plugin>
+				<groupId>org.eclipse.xtend</groupId>
+				<artifactId>xtend-maven-plugin</artifactId>
+			</plugin>
+		</plugins>
+	</build>
+
+</project>
diff --git a/plugins/xtumlrt/common/org.eclipse.papyrusrt.xtumlrt.external/src/org/eclipse/papyrusrt/xtumlrt/external/ExternalPackageManager.java b/plugins/xtumlrt/common/org.eclipse.papyrusrt.xtumlrt.external/src/org/eclipse/papyrusrt/xtumlrt/external/ExternalPackageManager.java
new file mode 100644
index 0000000..5070cbf
--- /dev/null
+++ b/plugins/xtumlrt/common/org.eclipse.papyrusrt.xtumlrt.external/src/org/eclipse/papyrusrt/xtumlrt/external/ExternalPackageManager.java
@@ -0,0 +1,407 @@
+/*****************************************************************************
+ * Copyright (c) 2016 Zeligsoft (2009) Limited 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:
+ *   Ernesto Posse - Initial API and implementation
+ *****************************************************************************/
+
+package org.eclipse.papyrusrt.xtumlrt.external;
+
+import java.io.IOException;
+import java.net.URISyntaxException;
+import java.nio.file.FileSystemAlreadyExistsException;
+import java.nio.file.FileSystems;
+import java.nio.file.Path;
+import java.nio.file.Paths;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.Map;
+
+import org.eclipse.core.runtime.Plugin;
+import org.eclipse.emf.common.util.EList;
+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.ResourceSet;
+import org.eclipse.emf.ecore.resource.impl.ResourceSetImpl;
+import org.eclipse.papyrusrt.xtumlrt.util.XTUMLRTLogger;
+import org.eclipse.uml2.uml.UMLPlugin;
+import org.eclipse.uml2.uml.resources.util.UMLResourcesUtil;
+import org.osgi.framework.BundleContext;
+
+/**
+ * This class is used to manage external packages, models and profiles used or refered to in xtUML-RT models.
+ * 
+ * <p>
+ * It takes care of initializing resources, performing package registration etc.
+ * 
+ * <p>
+ * Models can be used in different contexts:
+ * 
+ * <ol>
+ * <li>Within a running Eclipse platform instance.
+ * <ol>
+ * <li>With a Papyrus UML model opened
+ * <li>Without a Papyrus UML model opened (e.g. when invoking an action on a file selected in the Project Explorer)
+ * </ol>
+ * <li>In stand-alone Java applications.
+ * </ol>
+ * 
+ * <p>
+ * This class is useful to deal in particular with the last two cases (1.2 and 2).
+ * 
+ * @author Ernesto Posse
+ */
+public final class ExternalPackageManager extends Plugin {
+
+	/** Plugin ID. */
+	public static final String ID = "org.eclipse.papyrusrt.xtumlrt.external";
+
+	/** The global instance of this class. */
+	private static ExternalPackageManager instance;
+
+	/** The bundle's execution context. */
+	private static BundleContext context;
+
+	/** Whether we are running as a Java stand-alone application or in an Eclipse platform instance. */
+	private boolean standalone;
+
+	/** The instance of the {@link PluginFinder} used to locate plugins. */
+	private PluginFinder pluginFinder;
+
+	/** A map from package IDs (as Strings) to {@link ExternalPackageMetadata} containing the requested packages. */
+	private Map<String, ExternalPackageMetadata> requiredPackages;
+
+	/** A map from package IDs (as Strings) to {@link ExternalPackageMetadata} containing the successfuly loaded and registered packages. */
+	private Map<String, ExternalPackageMetadata> registeredPackages;
+
+	/** The EMF {@link ResourceSet} where the packages and models are (going to be) loaded. */
+	private ResourceSet resourceSet;
+
+	/** Whether setup has already been done. */
+	private boolean setup;
+
+	/**
+	 * Constructor. Private so that instances can be obtained only with the {@link #getInstance()} factory method.
+	 */
+	private ExternalPackageManager() {
+		super();
+		reset();
+	}
+
+	/**
+	 * Resets the state of the manager.
+	 */
+	public void reset() {
+		this.standalone = false;
+		this.pluginFinder = new PluginFinder();
+		this.requiredPackages = new HashMap<>();
+		this.registeredPackages = new HashMap<>();
+		this.resourceSet = new ResourceSetImpl();
+		this.setup = false;
+	}
+
+	/**
+	 * Factory method.
+	 * 
+	 * @return The shared {@link #instance}.
+	 */
+	public static ExternalPackageManager getInstance() {
+		if (instance == null) {
+			instance = new ExternalPackageManager();
+		}
+		return instance;
+	}
+
+	public static BundleContext getContext() {
+		return context;
+	}
+
+	public PluginFinder getPluginFinder() {
+		return pluginFinder;
+	}
+
+	public Map<String, ExternalPackageMetadata> getRegistry() {
+		return registeredPackages;
+	}
+
+	public ResourceSet getResourceSet() {
+		return resourceSet;
+	}
+
+	public boolean isStandalone() {
+		return standalone;
+	}
+
+	/**
+	 * @param packageId
+	 *            - A {@link String} with the package ID.
+	 * @return The corresponding {@link ExternalPackageMetadata} if the package is registered
+	 *         or {@code null} if it isn't.
+	 */
+	public ExternalPackageMetadata getPackageMetadata(String packageId) {
+		return registeredPackages.get(packageId);
+	}
+
+	public void setStandalone(boolean standalone) {
+		this.standalone = standalone;
+	}
+
+	public void setResourceSet(ResourceSet resourceSet) {
+		this.resourceSet = resourceSet;
+	}
+
+	@Override
+	public void start(BundleContext context) {
+		ExternalPackageManager.context = context;
+	}
+
+	@Override
+	public void stop(BundleContext context) {
+		ExternalPackageManager.context = null;
+	}
+
+	/**
+	 * Adds an external package to the list of required packages.
+	 * 
+	 * <p>
+	 * Only packages added with this method will be loaded and registered. But this method does not
+	 * load or registers the package. That task is performed by the {@link #setup} method which is to
+	 * be invoked by the framework, not the package's provider.
+	 * 
+	 * @param packageMetadata
+	 *            - An {@link AbstractPackageMetadata} object with the package information.
+	 */
+	public void addRequiredPackage(ExternalPackageMetadata packageMetadata) {
+		if (packageMetadata != null) {
+			String key = packageMetadata.getPackageId();
+			if (key != null && !key.isEmpty()) {
+				if (registeredPackages.containsKey(key)) {
+					XTUMLRTLogger.warning("Package '" + key + "' was already registered. The old registration will be overriden.");
+				}
+				requiredPackages.put(key, packageMetadata);
+			} else {
+				XTUMLRTLogger.warning("Attempting to register a package with no ID.");
+			}
+		} else {
+			XTUMLRTLogger.warning("Attempting to register null as a package.");
+		}
+	}
+
+	/**
+	 * Initialize UML resources, load added packages, libraries and profiles and perform the necessary EMF registrations.
+	 * 
+	 * <p>
+	 * This method should be invoked by clients only after providers of external packages have added them with
+	 * {@link #addRequiredPackage(ExternalPackageMetadata)}.
+	 */
+	public void setup() {
+		if (!setup) {
+			if (standalone) {
+				UMLResourcesUtil.init(resourceSet);
+			}
+			searchPlugins();
+			for (String requiredPackageId : requiredPackages.keySet()) {
+				ExternalPackageMetadata metadata = requiredPackages.get(requiredPackageId);
+				boolean loaded = loadPackage(metadata);
+				if (!loaded) {
+					XTUMLRTLogger.warning("Unable to load package: '" + requiredPackageId + "'");
+				} else {
+					boolean registered = registerPackage(metadata);
+					if (!registered) {
+						XTUMLRTLogger.warning("Unable to register package: '" + requiredPackageId + "'");
+					}
+				}
+			}
+			setup = true;
+		}
+	}
+
+	/**
+	 * Search for the plugins containing the packages with the provided package ids.
+	 */
+	private void searchPlugins() {
+		// We only search the first time.
+		if (!pluginFinder.isResolved()) {
+			for (String pkgId : requiredPackages.keySet()) {
+				pluginFinder.addRequiredPlugin(pkgId);
+			}
+			pluginFinder.resolve(standalone);
+			pluginFinder.logResolvedMappings();
+		}
+	}
+
+	/**
+	 * Finds and loads the package described by the given meta-data.
+	 * 
+	 * <p>
+	 * If successful, this method updates the metadata itself by setting its {@link EObject} root element.
+	 * 
+	 * @param metadata
+	 *            - The {@link ExternalPackageMetadata}.
+	 * @return {@code true} iff the package is successfully loaded.
+	 */
+	private boolean loadPackage(ExternalPackageMetadata metadata) {
+		boolean success = false;
+		String packageId = metadata.getPackageId();
+		if (pluginFinder.found(packageId)) {
+			resolvePackageLocation(metadata);
+			URI fullURI = metadata.getPackageLocationURI();
+			Resource resource = resourceSet.getResource(fullURI, true);
+			metadata.setResource(resource);
+			EList<EObject> contents = resource.getContents();
+			EObject root = contents.get(0);
+			metadata.setRoot(root);
+			success = true;
+		} else {
+			XTUMLRTLogger.warning("Unable to find plugin with id '" + packageId + "'");
+		}
+		return success;
+	}
+
+	/**
+	 * Obtain the actual file system location of the package file and update the
+	 * package's metadata.
+	 * 
+	 * <p>
+	 * The resolved path is obtained by normalizing the location found by the {@link #pluginFinder}
+	 * with {@link #parsePath(String)} and then appending the folder and file name of the package
+	 * within the bundle.
+	 * 
+	 * @param metadata
+	 *            - The {@link ExternalPackageMetadata}.
+	 */
+	private void resolvePackageLocation(ExternalPackageMetadata metadata) {
+		String resolvedPath = null;
+		String pkgId = metadata.getPackageId();
+		if (pkgId != null) {
+			String packageLoc = pluginFinder.get(pkgId);
+			if (packageLoc != null) {
+				Path path = parsePath(packageLoc);
+				String subdir = metadata.getFolderName();
+				if (subdir != null) {
+					path = path.resolve(subdir);
+				}
+				String pkgModel = metadata.getFileName();
+				if (pkgModel != null) {
+					path = path.resolve(pkgModel);
+				}
+				resolvedPath = path.toUri().toString();
+			}
+		}
+		metadata.setPackageLocation(resolvedPath);
+	}
+
+	/**
+	 * Obtains a normalized path from the given bundle path. The bundle path may be a directory or a jar file and may be
+	 * specified with a URI with different schemes (e.g. 'file:', 'jar:', 'jar:file:') and different OS path separators.
+	 * Furthermore, if it is a jar bundle, it may or may not have associated path info, e.g. jar:file:/a/b!/c.
+	 * 
+	 * @param path
+	 *            - A {@link String} with the URI of a bundle.
+	 * @return The normalized {@link Path} of the given path.
+	 */
+	private Path parsePath(String path) {
+		Path result = null;
+		java.net.URI uri = null;
+		try {
+			uri = new java.net.URI(path);
+			if (uri.getScheme().equals("jar")) {
+				FileSystems.newFileSystem(uri, Collections.<String, Object> emptyMap());
+			}
+		} catch (URISyntaxException | IOException | FileSystemAlreadyExistsException e) {
+		}
+		result = Paths.get(uri);
+		return result;
+	}
+
+	/**
+	 * Perform EMF registration for the package.
+	 * 
+	 * @param metadata
+	 *            - The {@link ExternalPackageMetadata}.
+	 * @return {@code true} iff successful.
+	 */
+	private boolean registerPackage(ExternalPackageMetadata metadata) {
+		boolean success = false;
+		if (standalone) {
+			switch (metadata.getKind()) {
+			case Package:
+				success = doRegisterNormalPackage(metadata);
+				break;
+			case Library:
+				success = doRegisterLibrary(metadata);
+				break;
+			case Profile:
+				success = doRegisterProfile(metadata);
+				break;
+			default:
+				success = doRegisterNormalPackage(metadata);
+				break;
+			}
+		} else {
+			success = true;
+		}
+		if (success) {
+			registeredPackages.put(metadata.getPackageId(), metadata);
+		}
+		return success;
+	}
+
+	/**
+	 * @param metadata
+	 *            - The {@link ExternalPackageMetadata}.
+	 * @return {@code true} iff successful.
+	 */
+	private boolean doRegisterNormalPackage(ExternalPackageMetadata metadata) {
+		// Add a map entry from the logical pathmap URI to the physical location URI.
+		URI pathmapUri = metadata.getPathmapURI();
+		URI packageLocUri = metadata.getPackageLocationURI();
+		resourceSet.getURIConverter()
+				.getURIMap()
+				.put(pathmapUri, packageLocUri);
+		String nsUri = metadata.getNsURI();
+		EPackage pkg = metadata.getEPackage();
+		// Register package in the resourceSet package registeredPackages
+		if (nsUri != null && pkg != null) {
+			resourceSet.getPackageRegistry().put(nsUri, pkg);
+		}
+		return true;
+	}
+
+	/**
+	 * @param metadata
+	 *            - The {@link ExternalPackageMetadata}.
+	 * @return {@code true} iff successful.
+	 */
+	private boolean doRegisterLibrary(ExternalPackageMetadata metadata) {
+		return doRegisterNormalPackage(metadata);
+	}
+
+	/**
+	 * @param metadata
+	 *            - The {@link ExternalPackageMetadata}.
+	 * @return {@code true} iff successful.
+	 */
+	private boolean doRegisterProfile(ExternalPackageMetadata metadata) {
+		boolean success = false;
+		success = doRegisterNormalPackage(metadata);
+		if (success) {
+			String nsUri = metadata.getNsURI();
+			URI rootUri = metadata.getRootURI();
+			// Register the profile's NS_URI to its pathmap location
+			if (nsUri != null && rootUri != null) {
+				UMLPlugin.getEPackageNsURIToProfileLocationMap().put(nsUri, rootUri);
+				success = true;
+			}
+		}
+		return success;
+	}
+
+}
diff --git a/plugins/xtumlrt/common/org.eclipse.papyrusrt.xtumlrt.external/src/org/eclipse/papyrusrt/xtumlrt/external/ExternalPackageMetadata.java b/plugins/xtumlrt/common/org.eclipse.papyrusrt.xtumlrt.external/src/org/eclipse/papyrusrt/xtumlrt/external/ExternalPackageMetadata.java
new file mode 100644
index 0000000..c4dbfa6
--- /dev/null
+++ b/plugins/xtumlrt/common/org.eclipse.papyrusrt.xtumlrt.external/src/org/eclipse/papyrusrt/xtumlrt/external/ExternalPackageMetadata.java
@@ -0,0 +1,231 @@
+/*******************************************************************************
+ * Copyright (c) 2015 Zeligsoft (2009) Limited 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
+ *******************************************************************************/
+package org.eclipse.papyrusrt.xtumlrt.external;
+
+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;
+
+/**
+ * Instances of subclasses of this class contain meta-data for various packages, models and profiles
+ * that need to be loaded by the generator.
+ * 
+ * @author epp
+ */
+public class ExternalPackageMetadata {
+
+	/** The package id. It must be the same as the bundle id. */
+	private String packageId;
+
+	/** The {@link #Kind} of package. */
+	private Kind kind;
+
+	/** The package namespace URI. */
+	private String nsURI;
+
+	/** The package's base pathmap. */
+	private String basePathmap;
+
+	/** The id of the package's root element. */
+	private String rootId;
+
+	/** The bundle subdirectory that contains the package's file. */
+	private String folderName;
+
+	/** The name of the model file containing the package. */
+	private String fileName;
+
+	/** The package's {@link EPackage} instance. */
+	private EPackage ePackage;
+
+	// Derived attributes
+
+	/** The EMF resource containing the package. */
+	private Resource resource;
+
+	/** The root element of the package. */
+	private EObject rootElement;
+
+	/** The actual package location. */
+	private String packageLocation;
+
+	/**
+	 * Constructor.
+	 * 
+	 * @param packageId
+	 *            - A {@link String}. It must be a bundle id.
+	 * @param kind
+	 *            - The package's {@link ExternalPackageMetadata.Kind}.
+	 * @param nsURI
+	 *            - The package's name-space URI as a {@link String}.
+	 * @param basePathmap
+	 *            - The package's base pathmap as a {@link String}. It should start with "pathmap://".
+	 * @param rootId
+	 *            - The package's root element's Id as a {@link String}.
+	 * @param folderName
+	 *            - The sub-folder within the provider bundle.
+	 * @param fileName
+	 *            - The name of the file containing the package.
+	 * @param ePackage
+	 *            - The {@link EPackage} of this package.
+	 */
+	public ExternalPackageMetadata(String packageId, Kind kind, String nsURI, String basePathmap, String rootId, String folderName, String fileName, EPackage ePackage) {
+		this.packageId = packageId;
+		this.kind = kind;
+		this.nsURI = nsURI;
+		this.basePathmap = basePathmap;
+		this.rootId = rootId;
+		this.folderName = folderName;
+		this.fileName = fileName;
+		this.ePackage = ePackage;
+	}
+
+	//
+	// Basic getters
+	//
+
+	public String getPackageId() {
+		return packageId;
+	}
+
+	public Kind getKind() {
+		return kind;
+	}
+
+	public String getNsURI() {
+		return nsURI;
+	}
+
+	public String getBasePathmap() {
+		return basePathmap;
+	}
+
+	public String getRootId() {
+		return rootId;
+	}
+
+	public String getFolderName() {
+		return folderName;
+	}
+
+	public String getFileName() {
+		return fileName;
+	}
+
+	//
+	// Derived information
+	//
+
+	/**
+	 * @return The full pathmap concatenating the base pathmap and the file name, or null if the base pathmap is null or empty.
+	 */
+	public String getPathmap() {
+		String pathmap = null;
+		String basePathmap = getBasePathmap();
+		if (basePathmap != null && !basePathmap.isEmpty()) {
+			char last = basePathmap.charAt(basePathmap.length() - 1);
+			String separator = last == '/' ? "" : "/";
+			pathmap = basePathmap + separator + getFileName();
+		}
+		return pathmap;
+	}
+
+	public String getRootPathmap() {
+		return getPathmap() + "#" + getRootId();
+	}
+
+	public URI getRootURI() {
+		return URI.createURI(getRootPathmap());
+	}
+
+	public URI getPathmapURI() {
+		return URI.createURI(getPathmap());
+	}
+
+	/**
+	 * Find the plugin that contains the profile.
+	 * 
+	 * @return A {@link String} with the path to the package.
+	 */
+	public String getPackageLocation() {
+		return packageLocation;
+	}
+
+
+
+	public URI getPackageLocationURI() {
+		return URI.createURI(getPackageLocation());
+	}
+
+	//
+	// Ecore elements
+	//
+
+	/**
+	 * Return the {@link EPackage} for the package. This default implementation looks for the package in the
+	 * {@link org.eclipse.emf.ecore.EPackage.Registry#INSTANCE global} package registry.
+	 * 
+	 * @return The {@link EPackage}.
+	 */
+	public EPackage getEPackage() {
+		if (ePackage == null) {
+			String nsURI = getNsURI();
+			ePackage = EPackage.Registry.INSTANCE.getEPackage(nsURI);
+		}
+		return ePackage;
+	}
+
+	public Resource getResource() {
+		return resource;
+	}
+
+	/** @return The root element contained in the package, if it is loaded, or null otherwise. */
+	public EObject getRootElement() {
+		return rootElement;
+	}
+
+	//
+	// Setters
+	//
+
+	public void setResource(Resource resource) {
+		this.resource = resource;
+	}
+
+	public void setRoot(EObject root) {
+		this.rootElement = root;
+	}
+
+	public void setPackageLocation(String loc) {
+		this.packageLocation = loc;
+	}
+
+	/** The kind of package: normal package or model, model library or profile. */
+	public enum Kind {
+		Package("package"), Library("library"), Profile("profile");
+		/** The symbolic name of the kind. */
+		private String name;
+
+		/**
+		 * Constructor.
+		 *
+		 * @param name
+		 *            - A {@link String}.
+		 */
+		Kind(String name) {
+			this.name = name;
+		}
+
+		String getName() {
+			return name;
+		}
+	}
+
+}
+
diff --git a/plugins/umlrt/codegen/org.eclipse.papyrusrt.codegen.utils/src/org/eclipse/papyrusrt/codegen/utils/PluginFinder.java b/plugins/xtumlrt/common/org.eclipse.papyrusrt.xtumlrt.external/src/org/eclipse/papyrusrt/xtumlrt/external/PluginFinder.java
similarity index 81%
rename from plugins/umlrt/codegen/org.eclipse.papyrusrt.codegen.utils/src/org/eclipse/papyrusrt/codegen/utils/PluginFinder.java
rename to plugins/xtumlrt/common/org.eclipse.papyrusrt.xtumlrt.external/src/org/eclipse/papyrusrt/xtumlrt/external/PluginFinder.java
index 8022301..4f215bc 100644
--- a/plugins/umlrt/codegen/org.eclipse.papyrusrt.codegen.utils/src/org/eclipse/papyrusrt/codegen/utils/PluginFinder.java
+++ b/plugins/xtumlrt/common/org.eclipse.papyrusrt.xtumlrt.external/src/org/eclipse/papyrusrt/xtumlrt/external/PluginFinder.java
@@ -5,11 +5,14 @@
  * which accompanies this distribution, and is available at
  * http://www.eclipse.org/legal/epl-v10.html
  *******************************************************************************/
-package org.eclipse.papyrusrt.codegen.utils;
+package org.eclipse.papyrusrt.xtumlrt.external;
 
 import java.io.File;
 import java.io.FileInputStream;
 import java.io.IOException;
+import java.net.URI;
+import java.net.URISyntaxException;
+import java.net.URL;
 import java.nio.file.Files;
 import java.nio.file.Path;
 import java.nio.file.Paths;
@@ -25,7 +28,10 @@
 
 import javax.xml.parsers.DocumentBuilderFactory;
 
-import org.eclipse.papyrusrt.codegen.CodeGenPlugin;
+import org.eclipse.core.runtime.FileLocator;
+import org.eclipse.core.runtime.Platform;
+import org.eclipse.papyrusrt.xtumlrt.util.XTUMLRTLogger;
+import org.osgi.framework.Bundle;
 import org.w3c.dom.Document;
 
 /**
@@ -39,7 +45,7 @@
  * The user search paths are added before class path entries so they take
  * priority during the search.
  *
- * @author Erenesto Posse
+ * @author Ernesto Posse
  */
 public class PluginFinder {
 
@@ -59,7 +65,6 @@
 	private final Map<PluginData, String> resolvedMappings = new HashMap<>();
 
 	/**
-	 * 
 	 * Constructor.
 	 *
 	 * @param requiredProjects
@@ -196,6 +201,38 @@
 	}
 
 	/**
+	 * @param pluginId
+	 *            - A {@link String}.
+	 * @return {@code true} iff a plugin with the given id was found.
+	 */
+	public boolean found(String pluginId) {
+		return get(pluginId) != null;
+	}
+
+	/**
+	 * @param pluginId
+	 *            - A {@link String}.
+	 * @param version
+	 *            - A {@link String}.
+	 * @return {@code true} iff a plugin with the given id and version was found.
+	 */
+	public boolean found(String pluginId, String version) {
+		return get(pluginId, version) != null;
+	}
+
+	public boolean isResolved() {
+		return !resolvedMappings.isEmpty();
+	}
+
+	/**
+	 * Rests the plugin finder by removing all required projects/plugins and resolved mappings.
+	 */
+	public void reset() {
+		resolvedMappings.clear();
+		requiredMappings.clear();
+	}
+
+	/**
 	 * Get the path of the plugin/project's manifest.
 	 * 
 	 * <p>
@@ -320,7 +357,13 @@
 				String version = getVersion(manifest);
 				PluginData plugin = new PluginData(name, version);
 				if (isRequired(plugin)) {
-					String uri = type + (!"".equals(type) ? ":" : "") + f.toURI() + ("jar".equals(type) ? "!/" : "");
+					File canonical = null;
+					try {
+						canonical = new File(f.getCanonicalPath());
+					} catch (IOException e) {
+						canonical = f;
+					}
+					String uri = type + (!"".equals(type) ? ":" : "") + canonical.toURI() + ("jar".equals(type) ? "!/" : "");
 					resolvedMappings.put(plugin, uri); // $NON-NLS-1$ //$NON-NLS-2$
 					requiredMappings.put(plugin, Boolean.TRUE);
 					result = true;
@@ -414,8 +457,63 @@
 
 	/**
 	 * Resolve required plugins/projects.
+	 * 
+	 * @param standalone
+	 *            - {@code true} iff the plugin finder is running from a stand-alone Java application or
+	 *            from a plugin within a running Eclipse platform.
 	 */
-	public void resolve() {
+	public void resolve(boolean standalone) {
+		if (standalone) {
+			resolveInStandalone();
+		} else {
+			resolveInEclipse();
+		}
+	}
+
+	/**
+	 * Resolve the required plugins/projects when running in Eclipse.
+	 */
+	private void resolveInEclipse() {
+		for (PluginData requiredPlugin : requiredMappings.keySet()) {
+			String requiredPluginName = requiredPlugin.getName();
+			String requiredPluginVersion = requiredPlugin.getVersion();
+			Bundle bundle = null;
+			if (requiredPluginVersion == null) {
+				bundle = Platform.getBundle(requiredPlugin.getName());
+			} else {
+				Bundle[] bundles = Platform.getBundles(requiredPlugin.getName(), requiredPluginVersion);
+				if (bundles != null) {
+					// Look for an exact version match.
+					for (Bundle candidate : bundles) {
+						if (candidate.getSymbolicName().equals(requiredPluginName)
+								&& candidate.getVersion().toString().equals(requiredPluginVersion)) {
+							bundle = candidate;
+						}
+					}
+					// If no exact version match is found, select the highest version.
+					if (bundle == null) {
+						bundle = bundles[0];
+					}
+				}
+			}
+			if (bundle != null) {
+				try {
+					URL url = bundle.getEntry("/");
+					URI uri = FileLocator.resolve(url).toURI();
+					String uriStr = uri.toString(); // TODO: clean-up URI: normalize? absolute? remove file:// ?
+					resolvedMappings.put(requiredPlugin, uriStr);
+					requiredMappings.put(requiredPlugin, Boolean.TRUE);
+				} catch (URISyntaxException | IOException e) {
+					XTUMLRTLogger.warning("Unable to find required plugin or project: '" + requiredPlugin.toString() + "'");
+				}
+			}
+		}
+	}
+
+	/**
+	 * Resolve the required plugins/projects when running in standalone mode.
+	 */
+	private void resolveInStandalone() {
 		String property = System.getProperty("java.class.path"); //$NON-NLS-1$
 		if (property == null) {
 			return;
@@ -501,11 +599,14 @@
 	 * Log the resolved paths.
 	 */
 	public void logResolvedMappings() {
-		CodeGenPlugin.info("resolved mapping start");
+		XTUMLRTLogger.info("resolved mapping start");
+		System.out.println("resolved mapping start");
 		for (Map.Entry<PluginData, String> entry : resolvedMappings.entrySet()) {
-			CodeGenPlugin.info(entry.getKey() + " |-> " + entry.getValue());
+			XTUMLRTLogger.info(entry.getKey() + " |-> " + entry.getValue());
+			System.out.println(entry.getKey() + " |-> " + entry.getValue());
 		}
-		CodeGenPlugin.info("resolved mapping end");
+		XTUMLRTLogger.info("resolved mapping end");
+		System.out.println("resolved mapping end");
 	}
 
 	/**
diff --git a/plugins/xtumlrt/common/org.eclipse.papyrusrt.xtumlrt.external/src/org/eclipse/papyrusrt/xtumlrt/external/predefined/AnsiCLibraryMetadata.java b/plugins/xtumlrt/common/org.eclipse.papyrusrt.xtumlrt.external/src/org/eclipse/papyrusrt/xtumlrt/external/predefined/AnsiCLibraryMetadata.java
new file mode 100644
index 0000000..a174d56
--- /dev/null
+++ b/plugins/xtumlrt/common/org.eclipse.papyrusrt.xtumlrt.external/src/org/eclipse/papyrusrt/xtumlrt/external/predefined/AnsiCLibraryMetadata.java
@@ -0,0 +1,54 @@
+/*******************************************************************************
+ * Copyright (c) 2015 Zeligsoft (2009) Limited 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
+ *******************************************************************************/
+package org.eclipse.papyrusrt.xtumlrt.external.predefined;
+
+import org.eclipse.emf.ecore.EPackage;
+import org.eclipse.papyrusrt.xtumlrt.external.ExternalPackageMetadata;
+
+/**
+ * Meta-data for the Ansi C Library.
+ * 
+ * @see ExternalPackageMetadata
+ * @author epp
+ */
+public final class AnsiCLibraryMetadata extends ExternalPackageMetadata {
+
+	/** Common instance. */
+	public static final AnsiCLibraryMetadata INSTANCE = new AnsiCLibraryMetadata();
+
+	/** Profile id. */
+	private static final String ID = "org.eclipse.papyrus.designer.languages.cpp.library";
+
+	/** Name-space URI. */
+	private static final String NS_URI = "http://www.eclipse.org/papyrus/C_Cpp/1";
+
+	/** Pathmap. */
+	private static final String BASEPATHMAP = "pathmap://PapyrusC_Cpp_LIBRARIES";
+
+	/** Root node id. */
+	// TODO: Find out if this can be extracted programatically
+	private static final String ROOT_ID = "_DV8nkBv8EduZN5aJJITI5w";
+
+	/** Subdirectory containing the model. */
+	private static final String FOLDER = "models";
+
+	/** File containing the model. */
+	private static final String FILE = "AnsiCLibrary.uml";
+
+	/** {@link EPackage}. */
+	private static final EPackage EPACKAGE = null;
+
+	/**
+	 * Default constructor. Private as this class should not be extended.
+	 *
+	 */
+	private AnsiCLibraryMetadata() {
+		super(ID, Kind.Library, NS_URI, BASEPATHMAP, ROOT_ID, FOLDER, FILE, EPACKAGE);
+	}
+
+}
diff --git a/plugins/xtumlrt/common/org.eclipse.papyrusrt.xtumlrt.external/src/org/eclipse/papyrusrt/xtumlrt/external/predefined/RTSModelLibraryMetadata.java b/plugins/xtumlrt/common/org.eclipse.papyrusrt.xtumlrt.external/src/org/eclipse/papyrusrt/xtumlrt/external/predefined/RTSModelLibraryMetadata.java
new file mode 100644
index 0000000..17d75d8
--- /dev/null
+++ b/plugins/xtumlrt/common/org.eclipse.papyrusrt.xtumlrt.external/src/org/eclipse/papyrusrt/xtumlrt/external/predefined/RTSModelLibraryMetadata.java
@@ -0,0 +1,50 @@
+/*******************************************************************************
+ * Copyright (c) 2015 Zeligsoft (2009) Limited 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
+ *******************************************************************************/
+package org.eclipse.papyrusrt.xtumlrt.external.predefined;
+
+import org.eclipse.emf.ecore.EPackage;
+import org.eclipse.papyrusrt.xtumlrt.external.ExternalPackageMetadata;
+
+/**
+ * Meta-data for the UML-RT RTS Model Library.
+ * 
+ * @see ExternalPackageMetadata
+ * @author epp
+ */
+public final class RTSModelLibraryMetadata extends ExternalPackageMetadata {
+
+	/** Common instance. */
+	public static final RTSModelLibraryMetadata INSTANCE = new RTSModelLibraryMetadata();
+
+	/** Profile id. */
+	private static final String ID = "org.eclipse.papyrusrt.umlrt.common.rts.library";
+
+	/** Name-space URI. */
+	private static final String NS_URI = "http://www.eclipse.org/papyrusrt/rts";
+
+	/** Pathmap. */
+	private static final String BASEPATHMAP = "pathmap://UMLRTRTSLIB";
+
+	/** Root node id. */
+	// TODO: Find out if this can be extracted programatically
+	private static final String ROOT_ID = "_mPjAgGXmEeS_4daqvwyFrg";
+
+	/** Subdirectory containing the model. */
+	private static final String FOLDER = "libraries";
+
+	/** File containing the model. */
+	private static final String FILE = "UMLRT-RTS.uml";
+
+	/** {@link EPackage}. */
+	private static final EPackage EPACKAGE = null;
+
+	private RTSModelLibraryMetadata() {
+		super(ID, Kind.Library, NS_URI, BASEPATHMAP, ROOT_ID, FOLDER, FILE, EPACKAGE);
+	}
+
+}
diff --git a/plugins/xtumlrt/common/org.eclipse.papyrusrt.xtumlrt.util/src/org/eclipse/papyrusrt/xtumlrt/util/RTSModelLibraryUtils.xtend b/plugins/xtumlrt/common/org.eclipse.papyrusrt.xtumlrt.external/src/org/eclipse/papyrusrt/xtumlrt/external/predefined/RTSModelLibraryUtils.xtend
similarity index 94%
rename from plugins/xtumlrt/common/org.eclipse.papyrusrt.xtumlrt.util/src/org/eclipse/papyrusrt/xtumlrt/util/RTSModelLibraryUtils.xtend
rename to plugins/xtumlrt/common/org.eclipse.papyrusrt.xtumlrt.external/src/org/eclipse/papyrusrt/xtumlrt/external/predefined/RTSModelLibraryUtils.xtend
index 4934266..7069243 100644
--- a/plugins/xtumlrt/common/org.eclipse.papyrusrt.xtumlrt.util/src/org/eclipse/papyrusrt/xtumlrt/util/RTSModelLibraryUtils.xtend
+++ b/plugins/xtumlrt/common/org.eclipse.papyrusrt.xtumlrt.external/src/org/eclipse/papyrusrt/xtumlrt/external/predefined/RTSModelLibraryUtils.xtend
@@ -5,7 +5,7 @@
  * which accompanies this distribution, and is available at
  * http://www.eclipse.org/legal/epl-v10.html
  *******************************************************************************/
-package org.eclipse.papyrusrt.xtumlrt.util
+package org.eclipse.papyrusrt.xtumlrt.external.predefined
 
 import org.eclipse.emf.common.util.URI
 import org.eclipse.emf.ecore.resource.Resource
@@ -24,14 +24,15 @@
 
 import static extension org.eclipse.papyrusrt.xtumlrt.util.UMLRealTimeProfileUtil.*
 import static extension org.eclipse.papyrusrt.xtumlrt.util.XTUMLRTUtil.*
-import java.nio.file.Paths
-import java.nio.file.Files
-import java.util.logging.Logger
+import org.eclipse.papyrusrt.xtumlrt.util.XTUMLRTLogger
+import org.eclipse.papyrusrt.xtumlrt.external.ExternalPackageManager
 
 class RTSModelLibraryUtils
 {
 
+	@Deprecated
     private static var ResourceSet resourceSet
+	@Deprecated
     private static var reload = true
     private static var org.eclipse.uml2.uml.Model RTSModelLibrary
 
@@ -45,6 +46,7 @@
     public static val RTS_LIBRARY_NAME    = "UMLRT-RTS"
     public static val RTS_LIBRARY_URI     = URI.createURI(RTS_MODLIB_PATHMAP).appendFragment(RTS_MODLIB_ROOT_ID)
     public static val RTS_LIBRARY_URI_STR = RTS_LIBRARY_URI.toPlatformString( false )
+	@Deprecated
     private static var resolvedRTSLibUri = null
 
     /** Textual (xtumlrt) RTS Model Library */
@@ -91,6 +93,18 @@
     private static var RTBOUND_MESSAGE   = null
     private static var RTUNBOUND_MESSAGE = null
 
+	static def init()
+	{
+		val externalPackageManager = ExternalPackageManager.instance
+		val metadata = externalPackageManager.getPackageMetadata(RTSModelLibraryMetadata.INSTANCE.packageId)
+		// metadata == RTSModelLibraryMetadata.INSTANCE
+		RTSModelLibrary = metadata.rootElement as org.eclipse.uml2.uml.Model
+		if (RTSModelLibrary == null)
+		{
+			XTUMLRTLogger.error("The RTS model library was not loaded or registered.")
+		}
+	}
+
     static def addSysAnnotation( NamedElement element )
     {
         val sysAnnotation = CommonFactory.eINSTANCE.createAnnotation
@@ -98,6 +112,7 @@
         element.annotations.add( sysAnnotation )
     }
 
+	@Deprecated
     static def loadPackage( URI fullURI )
     {
         if (resourceSet === null)
@@ -127,6 +142,7 @@
         return pkg
     }
 
+	@Deprecated
     static def loadRTSModelLibrary()
     {
         if (!reload) return
@@ -160,17 +176,20 @@
         return RTSModelLibrary
     }
 
+	@Deprecated
     static def reloadRTSModelLibrary()
     {
         reload = true
         loadRTSModelLibrary
     }
 
+	@Deprecated
     static def setReload( boolean flag )
     {
         reload = flag
     }
 
+	@Deprecated
     static def setResourceSet( ResourceSet resSet )
     {
         if (resSet !== resourceSet || resourceSet === null)
@@ -184,6 +203,7 @@
         }
     }
 
+	@Deprecated
     static def setResolvedRTSModelLibraryLocation( URI resolvedLocation )
     {
         val uriConverter = resourceSet.URIConverter
@@ -195,11 +215,13 @@
         }
     }
 
+	@Deprecated
     static def getRTSModelLibrary()
     {
         RTSModelLibrary
     }
 
+	@Deprecated
     static def getResolvedRTSModelLibraryLocation()
     {
         resolvedRTSLibUri
diff --git a/plugins/xtumlrt/common/org.eclipse.papyrusrt.xtumlrt.external/src/org/eclipse/papyrusrt/xtumlrt/external/predefined/UMLRTProfileMetadata.java b/plugins/xtumlrt/common/org.eclipse.papyrusrt.xtumlrt.external/src/org/eclipse/papyrusrt/xtumlrt/external/predefined/UMLRTProfileMetadata.java
new file mode 100644
index 0000000..361610f
--- /dev/null
+++ b/plugins/xtumlrt/common/org.eclipse.papyrusrt.xtumlrt.external/src/org/eclipse/papyrusrt/xtumlrt/external/predefined/UMLRTProfileMetadata.java
@@ -0,0 +1,56 @@
+/*******************************************************************************
+ * Copyright (c) 2015 Zeligsoft (2009) Limited 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
+ *******************************************************************************/
+package org.eclipse.papyrusrt.xtumlrt.external.predefined;
+
+import org.eclipse.emf.ecore.EPackage;
+import org.eclipse.papyrusrt.umlrt.profile.UMLRealTime.UMLRealTimePackage;
+import org.eclipse.papyrusrt.xtumlrt.external.ExternalPackageMetadata;
+
+/**
+ * Meta-data for the UML-RT profile.
+ * 
+ * @see ExternalPackageMetadata
+ * @author epp
+ */
+public final class UMLRTProfileMetadata extends ExternalPackageMetadata {
+
+	/** Common instance. */
+	public static final UMLRTProfileMetadata INSTANCE = new UMLRTProfileMetadata();
+
+	/** Profile id. */
+	private static final String ID = "org.eclipse.papyrusrt.umlrt.profile";
+
+	/** Name-space URI. */
+	// It should be "http://www.eclipse.org/papyrus/umlrt"
+	private static final String NS_URI = UMLRealTimePackage.eNS_URI;
+
+	/** Pathmap. */
+	private static final String BASEPATHMAP = "pathmap://UML_RT_PROFILE";
+
+	/** Root node id. */
+	// TODO: Find out if this can be extracted programatically
+	private static final String ROOT_ID = "_1h74oEeVEeO0lv5O1DTHOQ";
+
+	/** Subdirectory containing the model. */
+	private static final String FOLDER = "umlProfile";
+
+	/** File containing the model. */
+	private static final String FILE = "uml-rt.profile.uml";
+
+	/** {@link EPackage}. */
+	private static final UMLRealTimePackage EPACKAGE = UMLRealTimePackage.eINSTANCE;
+
+	/**
+	 * Default constructor. Private as this class should not be extended.
+	 *
+	 */
+	private UMLRTProfileMetadata() {
+		super(ID, Kind.Profile, NS_URI, BASEPATHMAP, ROOT_ID, FOLDER, FILE, EPACKAGE);
+	}
+
+}
diff --git a/plugins/xtumlrt/common/org.eclipse.papyrusrt.xtumlrt.util/.classpath b/plugins/xtumlrt/common/org.eclipse.papyrusrt.xtumlrt.util/.classpath
index 325150d..428337e 100644
--- a/plugins/xtumlrt/common/org.eclipse.papyrusrt.xtumlrt.util/.classpath
+++ b/plugins/xtumlrt/common/org.eclipse.papyrusrt.xtumlrt.util/.classpath
@@ -1,6 +1,6 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <classpath>
-	<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.7"/>
+	<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="xtend-gen"/>
diff --git a/plugins/xtumlrt/common/org.eclipse.papyrusrt.xtumlrt.util/.settings/org.eclipse.jdt.core.prefs b/plugins/xtumlrt/common/org.eclipse.papyrusrt.xtumlrt.util/.settings/org.eclipse.jdt.core.prefs
index 28f0d0f..9b6d675 100644
--- a/plugins/xtumlrt/common/org.eclipse.papyrusrt.xtumlrt.util/.settings/org.eclipse.jdt.core.prefs
+++ b/plugins/xtumlrt/common/org.eclipse.papyrusrt.xtumlrt.util/.settings/org.eclipse.jdt.core.prefs
@@ -1,15 +1,15 @@
 eclipse.preferences.version=1
 org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
 org.eclipse.jdt.core.compiler.codegen.methodParameters=do not generate
-org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.7
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8
 org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
-org.eclipse.jdt.core.compiler.compliance=1.7
+org.eclipse.jdt.core.compiler.compliance=1.8
 org.eclipse.jdt.core.compiler.debug.lineNumber=generate
 org.eclipse.jdt.core.compiler.debug.localVariable=generate
 org.eclipse.jdt.core.compiler.debug.sourceFile=generate
 org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
 org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
-org.eclipse.jdt.core.compiler.source=1.7
+org.eclipse.jdt.core.compiler.source=1.8
 org.eclipse.jdt.core.formatter.align_type_members_on_columns=false
 org.eclipse.jdt.core.formatter.alignment_for_arguments_in_allocation_expression=16
 org.eclipse.jdt.core.formatter.alignment_for_arguments_in_annotation=0
diff --git a/plugins/xtumlrt/trans/org.eclipse.papyrusrt.xtumlrt.trans.from.uml/META-INF/MANIFEST.MF b/plugins/xtumlrt/trans/org.eclipse.papyrusrt.xtumlrt.trans.from.uml/META-INF/MANIFEST.MF
index 8502662..737088d 100644
--- a/plugins/xtumlrt/trans/org.eclipse.papyrusrt.xtumlrt.trans.from.uml/META-INF/MANIFEST.MF
+++ b/plugins/xtumlrt/trans/org.eclipse.papyrusrt.xtumlrt.trans.from.uml/META-INF/MANIFEST.MF
@@ -16,5 +16,6 @@
  org.eclipse.uml2.types,
  org.eclipse.uml2.uml;bundle-version="4.1.0",
  org.eclipse.xtend.lib;bundle-version="2.9.0",
- org.eclipse.papyrusrt.xtumlrt.util;bundle-version="0.7.2"
+ org.eclipse.papyrusrt.xtumlrt.util;bundle-version="0.7.2",
+ org.eclipse.papyrusrt.xtumlrt.external;bundle-version="0.7.2"
 Export-Package: org.eclipse.papyrusrt.xtumlrt.trans.from.uml
diff --git a/plugins/xtumlrt/trans/org.eclipse.papyrusrt.xtumlrt.trans.from.uml/src/org/eclipse/papyrusrt/xtumlrt/trans/from/uml/UML2xtumlrtModelTranslator.xtend b/plugins/xtumlrt/trans/org.eclipse.papyrusrt.xtumlrt.trans.from.uml/src/org/eclipse/papyrusrt/xtumlrt/trans/from/uml/UML2xtumlrtModelTranslator.xtend
index f10b67c..f8546fe 100644
--- a/plugins/xtumlrt/trans/org.eclipse.papyrusrt.xtumlrt.trans.from.uml/src/org/eclipse/papyrusrt/xtumlrt/trans/from/uml/UML2xtumlrtModelTranslator.xtend
+++ b/plugins/xtumlrt/trans/org.eclipse.papyrusrt.xtumlrt.trans.from.uml/src/org/eclipse/papyrusrt/xtumlrt/trans/from/uml/UML2xtumlrtModelTranslator.xtend
@@ -69,7 +69,7 @@
 import org.eclipse.uml2.uml.ValueSpecification
 
 import static extension org.eclipse.papyrusrt.xtumlrt.util.GeneralUtil.*
-import static extension org.eclipse.papyrusrt.xtumlrt.util.RTSModelLibraryUtils.*
+import static extension org.eclipse.papyrusrt.xtumlrt.external.predefined.RTSModelLibraryUtils.*
 import static extension org.eclipse.papyrusrt.xtumlrt.util.UMLRealTimeProfileUtil.*
 import org.eclipse.xtend.lib.annotations.Accessors
 
diff --git a/plugins/xtumlrt/trans/org.eclipse.papyrusrt.xtumlrt.trans.from.uml/src/org/eclipse/papyrusrt/xtumlrt/trans/from/uml/UML2xtumlrtTranslator.xtend b/plugins/xtumlrt/trans/org.eclipse.papyrusrt.xtumlrt.trans.from.uml/src/org/eclipse/papyrusrt/xtumlrt/trans/from/uml/UML2xtumlrtTranslator.xtend
index 60b4307..cc6d02a 100644
--- a/plugins/xtumlrt/trans/org.eclipse.papyrusrt.xtumlrt.trans.from.uml/src/org/eclipse/papyrusrt/xtumlrt/trans/from/uml/UML2xtumlrtTranslator.xtend
+++ b/plugins/xtumlrt/trans/org.eclipse.papyrusrt.xtumlrt.trans.from.uml/src/org/eclipse/papyrusrt/xtumlrt/trans/from/uml/UML2xtumlrtTranslator.xtend
@@ -38,7 +38,7 @@
 import org.eclipse.xtend.lib.annotations.Data
 
 import static extension org.eclipse.papyrusrt.xtumlrt.util.UMLRealTimeProfileUtil.*
-import static extension org.eclipse.papyrusrt.xtumlrt.util.RTSModelLibraryUtils.*
+import static extension org.eclipse.papyrusrt.xtumlrt.external.predefined.RTSModelLibraryUtils.*
 
 /**
  * This is the base class for translators from UML2 to xtUMLrt.
diff --git a/plugins/xtumlrt/trans/org.eclipse.papyrusrt.xtumlrt.trans/META-INF/MANIFEST.MF b/plugins/xtumlrt/trans/org.eclipse.papyrusrt.xtumlrt.trans/META-INF/MANIFEST.MF
index 5ec31c8..169905a 100644
--- a/plugins/xtumlrt/trans/org.eclipse.papyrusrt.xtumlrt.trans/META-INF/MANIFEST.MF
+++ b/plugins/xtumlrt/trans/org.eclipse.papyrusrt.xtumlrt.trans/META-INF/MANIFEST.MF
@@ -9,6 +9,7 @@
  org.eclipse.papyrusrt.xtumlrt.umlrt.model;bundle-version="0.7.2",
  org.eclipse.xtend.lib;bundle-version="2.9.1",
  org.eclipse.papyrusrt.codegen.utils;bundle-version="0.7.2",
- org.eclipse.papyrusrt.xtumlrt.util;bundle-version="0.7.2"
+ org.eclipse.papyrusrt.xtumlrt.util;bundle-version="0.7.2",
+ org.eclipse.papyrusrt.xtumlrt.external;bundle-version="0.7.2"
 Export-Package: org.eclipse.papyrusrt.xtumlrt.trans,
  org.eclipse.papyrusrt.xtumlrt.trans.preproc
diff --git a/plugins/xtumlrt/trans/org.eclipse.papyrusrt.xtumlrt.trans/src/org/eclipse/papyrusrt/xtumlrt/trans/preproc/AnnotateSystemElementsPreprocessor.xtend b/plugins/xtumlrt/trans/org.eclipse.papyrusrt.xtumlrt.trans/src/org/eclipse/papyrusrt/xtumlrt/trans/preproc/AnnotateSystemElementsPreprocessor.xtend
index 09fd028..8f17ba4 100644
--- a/plugins/xtumlrt/trans/org.eclipse.papyrusrt.xtumlrt.trans/src/org/eclipse/papyrusrt/xtumlrt/trans/preproc/AnnotateSystemElementsPreprocessor.xtend
+++ b/plugins/xtumlrt/trans/org.eclipse.papyrusrt.xtumlrt.trans/src/org/eclipse/papyrusrt/xtumlrt/trans/preproc/AnnotateSystemElementsPreprocessor.xtend
@@ -12,7 +12,7 @@
 import org.eclipse.papyrusrt.xtumlrt.common.NamedElement
 import org.eclipse.papyrusrt.xtumlrt.trans.Transformation
 import org.eclipse.papyrusrt.xtumlrt.trans.TransformationContext
-import static extension org.eclipse.papyrusrt.xtumlrt.util.RTSModelLibraryUtils.*
+import static extension org.eclipse.papyrusrt.xtumlrt.external.predefined.RTSModelLibraryUtils.*
 
 class AnnotateSystemElementsPreprocessor implements Transformation<Model, Model>
 {
diff --git a/plugins/xtumlrt/xtext/org.eclipse.papyrusrt.xtumlrt.xtext.trans/META-INF/MANIFEST.MF b/plugins/xtumlrt/xtext/org.eclipse.papyrusrt.xtumlrt.xtext.trans/META-INF/MANIFEST.MF
index c31d084..8f7b0ae 100644
--- a/plugins/xtumlrt/xtext/org.eclipse.papyrusrt.xtumlrt.xtext.trans/META-INF/MANIFEST.MF
+++ b/plugins/xtumlrt/xtext/org.eclipse.papyrusrt.xtumlrt.xtext.trans/META-INF/MANIFEST.MF
@@ -20,7 +20,8 @@
  org.eclipse.papyrus.infra.services.edit;bundle-version="1.1.3",
  org.eclipse.papyrus.infra.gmfdiag.commands;bundle-version="1.1.3",
  org.eclipse.papyrusrt.codegen.cpp.profile;bundle-version="0.7.2",
- org.eclipse.papyrusrt.xtumlrt.util;bundle-version="0.7.2"
+ org.eclipse.papyrusrt.xtumlrt.util;bundle-version="0.7.2",
+ org.eclipse.papyrusrt.xtumlrt.external;bundle-version="0.7.2"
 Bundle-RequiredExecutionEnvironment: JavaSE-1.8
 Bundle-ActivationPolicy: lazy
 Export-Package: org.eclipse.papyrusrt.xtumlrt.xtext.trans,
diff --git a/plugins/xtumlrt/xtext/org.eclipse.papyrusrt.xtumlrt.xtext.trans/src/org/eclipse/papyrusrt/xtumlrt/xtext/trans/umlrt/TextToUMLRTGenerator.xtend b/plugins/xtumlrt/xtext/org.eclipse.papyrusrt.xtumlrt.xtext.trans/src/org/eclipse/papyrusrt/xtumlrt/xtext/trans/umlrt/TextToUMLRTGenerator.xtend
index d81e73f..e025945 100644
--- a/plugins/xtumlrt/xtext/org.eclipse.papyrusrt.xtumlrt.xtext.trans/src/org/eclipse/papyrusrt/xtumlrt/xtext/trans/umlrt/TextToUMLRTGenerator.xtend
+++ b/plugins/xtumlrt/xtext/org.eclipse.papyrusrt.xtumlrt.xtext.trans/src/org/eclipse/papyrusrt/xtumlrt/xtext/trans/umlrt/TextToUMLRTGenerator.xtend
@@ -9,7 +9,7 @@
 import org.eclipse.papyrus.infra.core.resource.ModelSet
 import org.eclipse.papyrus.uml.tools.model.UmlModel
 import org.eclipse.papyrusrt.codegen.cpp.profile.RTCppProperties.RTCppPropertiesPackage
-import org.eclipse.papyrusrt.xtumlrt.util.RTSModelLibraryUtils
+import org.eclipse.papyrusrt.xtumlrt.external.predefined.RTSModelLibraryUtils
 import org.eclipse.papyrusrt.umlrt.core.types.UMLRTElementTypesEnumerator
 import org.eclipse.papyrusrt.umlrt.profile.UMLRealTime.RTMessageKind
 import org.eclipse.papyrusrt.umlrt.profile.UMLRealTime.UMLRealTimePackage
diff --git a/plugins/xtumlrt/xtext/org.eclipse.papyrusrt.xtumlrt.xtext.trans/src/org/eclipse/papyrusrt/xtumlrt/xtext/trans/umlrt/TextToUMLRTGeneratorUtils.java b/plugins/xtumlrt/xtext/org.eclipse.papyrusrt.xtumlrt.xtext.trans/src/org/eclipse/papyrusrt/xtumlrt/xtext/trans/umlrt/TextToUMLRTGeneratorUtils.java
index f075d23..2ba577c 100644
--- a/plugins/xtumlrt/xtext/org.eclipse.papyrusrt.xtumlrt.xtext.trans/src/org/eclipse/papyrusrt/xtumlrt/xtext/trans/umlrt/TextToUMLRTGeneratorUtils.java
+++ b/plugins/xtumlrt/xtext/org.eclipse.papyrusrt.xtumlrt.xtext.trans/src/org/eclipse/papyrusrt/xtumlrt/xtext/trans/umlrt/TextToUMLRTGeneratorUtils.java
@@ -29,7 +29,7 @@
 import org.eclipse.papyrus.uml.tools.utils.PackageUtil;
 import org.eclipse.papyrusrt.codegen.CodeGenPlugin;
 import org.eclipse.papyrusrt.codegen.utils.CodeGenUtils;
-import org.eclipse.papyrusrt.xtumlrt.util.RTSModelLibraryUtils;
+import org.eclipse.papyrusrt.xtumlrt.external.predefined.RTSModelLibraryUtils;
 import org.eclipse.papyrusrt.xtumlrt.xtext.trans.Activator;
 import org.eclipse.uml2.uml.Element;
 import org.eclipse.uml2.uml.NamedElement;
diff --git a/releng/codegen/pom.xml b/releng/codegen/pom.xml
index ddedfff..155f8ae 100644
--- a/releng/codegen/pom.xml
+++ b/releng/codegen/pom.xml
@@ -34,6 +34,7 @@
 		<module>../../plugins/xtumlrt/metamodel/org.eclipse.papyrusrt.xtumlrt.umlrt.model</module>
 		<module>../../plugins/xtumlrt/metamodel/org.eclipse.papyrusrt.xtumlrt.mmgenerators</module>
 		<module>../../plugins/xtumlrt/common/org.eclipse.papyrusrt.xtumlrt.util</module>
+		<module>../../plugins/xtumlrt/common/org.eclipse.papyrusrt.xtumlrt.external</module>
 		<module>../../plugins/xtumlrt/trans/org.eclipse.papyrusrt.xtumlrt.trans</module>
 		<module>../../plugins/xtumlrt/trans/org.eclipse.papyrusrt.xtumlrt.trans.from.uml</module>
 		<module>../../plugins/xtumlrt/xtext/org.eclipse.papyrusrt.xtumlrt.xtext</module>
diff --git a/tests/junit/umlrt/codegen/org.eclipse.papyrusrt.codegen.cpp.test/META-INF/MANIFEST.MF b/tests/junit/umlrt/codegen/org.eclipse.papyrusrt.codegen.cpp.test/META-INF/MANIFEST.MF
index c1141bf..accb4b6 100644
--- a/tests/junit/umlrt/codegen/org.eclipse.papyrusrt.codegen.cpp.test/META-INF/MANIFEST.MF
+++ b/tests/junit/umlrt/codegen/org.eclipse.papyrusrt.codegen.cpp.test/META-INF/MANIFEST.MF
@@ -25,4 +25,5 @@
  org.eclipse.xtext.xbase.lib;bundle-version="2.8.4",
  org.junit;bundle-version="4.11.0",
  org.eclipse.papyrus.designer.languages.cpp.library;bundle-version="0.7.0",
- org.eclipse.papyrusrt.umlrt.common.rts.library;bundle-version="0.7.2"
+ org.eclipse.papyrusrt.umlrt.common.rts.library;bundle-version="0.7.2",
+ org.eclipse.papyrusrt.xtumlrt.util
diff --git a/tests/junit/umlrt/codegen/org.eclipse.papyrusrt.codegen.cpp.test/src/org/eclipse/papyrusrt/codegen/cpp/test/codecompare/CodeGenCompareTest.java b/tests/junit/umlrt/codegen/org.eclipse.papyrusrt.codegen.cpp.test/src/org/eclipse/papyrusrt/codegen/cpp/test/codecompare/CodeGenCompareTest.java
index 7da2a3b..cb0ce35 100644
--- a/tests/junit/umlrt/codegen/org.eclipse.papyrusrt.codegen.cpp.test/src/org/eclipse/papyrusrt/codegen/cpp/test/codecompare/CodeGenCompareTest.java
+++ b/tests/junit/umlrt/codegen/org.eclipse.papyrusrt.codegen.cpp.test/src/org/eclipse/papyrusrt/codegen/cpp/test/codecompare/CodeGenCompareTest.java
@@ -7,9 +7,11 @@
 import java.io.BufferedReader;
 import java.io.File;
 import java.io.FileReader;
+import java.io.IOException;
 import java.net.URL;
 import java.util.ArrayList;
 import java.util.List;
+import java.util.logging.Level;
 
 import org.eclipse.core.runtime.FileLocator;
 import org.eclipse.core.runtime.IStatus;
@@ -23,31 +25,55 @@
 import org.eclipse.emf.ecore.resource.impl.ResourceSetImpl;
 import org.eclipse.emf.ecore.util.EcoreUtil;
 import org.eclipse.papyrusrt.codegen.utils.CodeGenUtils;
+import org.eclipse.papyrusrt.xtumlrt.util.XTUMLRTLogger;
 import org.eclipse.uml2.uml.UMLPackage;
 import org.junit.Test;
 import org.osgi.framework.Bundle;
 
+/**
+ * Unit test to compare the output of the code generator.
+ */
 public class CodeGenCompareTest {
+
+	/** The plugin id. */
 	public static final String PLUGIN_ID = "org.eclipse.papyrusrt.codegen.cpp.test";
 
-	private static final String MODEL_PATH = "models";
-
+	/** The resource set where the models will be loaded. */
 	protected static ResourceSetImpl resourceSet = new ResourceSetImpl();
 
-	private static final List<String> testModels = new ArrayList<>();
+	/** The folder containing the models whose generated code will be compared. */
+	private static final String MODEL_PATH = "models";
 
+	/** The list of models to test. */
+	private static final List<String> TEST_MODELS = new ArrayList<>();
+
+	/** The prefixes for lines that are to be ignored by the comparison. */
+	private static final String[] PREFIXES_TO_IGNORE = {
+			"/*",
+			"# Generated",
+			"UMLRTS_ROOT",
+			"set(UMLRTS_ROOT"
+	};
+
+	/**
+	 * Constructor.
+	 */
 	public CodeGenCompareTest() {
+		XTUMLRTLogger.getLogger().setLevel(Level.FINEST);
+		UMLRTTestGenerator.INSTANCE.setupExternalPackageManagement(resourceSet);
 		// models to test
-		testModels.add("PingPong");
-		// testModels.add( "PingPong-data" );
-		testModels.add("ComputerSystem");
+		TEST_MODELS.add("PingPong");
+		// TEST_MODELS.add( "PingPong-data" );
+		// TEST_MODELS.add( "PingPong-dynamic" );
+		TEST_MODELS.add("ComputerSystem");
 	}
 
 	/**
 	 * Load test model.
 	 * 
 	 * @param fullURI
-	 * @return
+	 *            - The {@link URI} of the model to load.
+	 * @return The loaded UML {@link org.eclipse.uml2.uml.Package Package}.
 	 */
 	public static org.eclipse.uml2.uml.Package loadModel(URI fullURI) {
 		Resource resource = resourceSet.getResource(fullURI, true);
@@ -56,6 +82,11 @@
 		return pkg;
 	}
 
+	/**
+	 * The basic compate test. For each test model, loads the model, invokes the code generator,
+	 * and iterates through each of the files in the original model's "expected_src" folder
+	 * comparing them with the file of the same name in the generated "src" folder.
+	 */
 	@Test
 	public void testCompare() {
 		Bundle bundle = Platform.getBundle(CodeGenCompareTest.PLUGIN_ID);
@@ -73,7 +104,7 @@
 
 		// test all the models under models folder
 		for (File modelFolder : modelsDir.listFiles()) {
-			if (!testModels.contains(modelFolder.getName())) {
+			if (!TEST_MODELS.contains(modelFolder.getName())) {
 				continue;
 			}
 			String modelName = modelFolder.getName() + ".uml";
@@ -106,38 +137,70 @@
 		}
 	}
 
-	private boolean compare(File expected, File generated) throws Exception {
+	/**
+	 * Compares two text files line by line.
+	 * 
+	 * @param expected
+	 *            - A {@link File}.
+	 * @param generated
+	 *            - Another {@link File}.
+	 * @return {@code true} iff the files are identical, other than for lines that are to be ignored. (see {@link #ignoreLine}).
+	 * @throws IOException
+	 *             If one of the files could not be opened or could not be read.
+	 * @throws FileNotFound
+	 *             If one of the files could not be found.
+	 */
+	private boolean compare(File expected, File generated) throws IOException {
 
 		boolean result = true;
 		BufferedReader src = new BufferedReader(new FileReader(expected));
 		BufferedReader target = new BufferedReader(new FileReader(generated));
 
-		String strLine1, strLine2;
+		String strLine1 = null;
+		String strLine2 = null;
+		int lineNo = 0;
 
 		while ((strLine1 = src.readLine()) != null) {
 			strLine2 = target.readLine();
+			lineNo++;
 			if (strLine2 == null) {
 				break;
 			}
 			strLine1 = strLine1.trim();
 			strLine2 = strLine2.trim();
-			if (strLine1.startsWith("/*") && strLine2.startsWith("/*")) {
-				continue;
-			}
-			if (strLine1.startsWith("UMLRTS_ROOT") && strLine2.startsWith("UMLRTS_ROOT")) {
+			if (ignoreLine(strLine1, strLine2)) {
 				continue;
 			}
 			if (!strLine1.trim().equals(strLine2.trim())) {
-				System.out.println(">> " + strLine1 + " :: " + strLine2);
+				System.out.println(">> line " + lineNo + " : \"" + strLine1 + "\" :: \"" + strLine2 + "\"");
 				result = false;
 				break;
 			}
 		}
-		if (result == true && target.readLine() != null) {
+		if (result && target.readLine() != null) {
 			result = false;
 		}
 		src.close();
 		target.close();
 		return result;
 	}
+
+	/**
+	 * @param strLine1
+	 *            - A {@link String}.
+	 * @param strLine2
+	 *            - A {@link String}.
+	 * @return {@code true} iff both lines begin with one of the strings in {@link #PREFIXES_TO_IGNORE}.
+	 */
+	private boolean ignoreLine(String strLine1, String strLine2) {
+		boolean ignore = false;
+		for (String prefix : PREFIXES_TO_IGNORE) {
+			if (strLine1.startsWith(prefix) && strLine2.startsWith(prefix)) {
+				ignore = true;
+				break;
+			}
+		}
+		return ignore;
+	}
+
 }
diff --git a/tests/junit/umlrt/codegen/org.eclipse.papyrusrt.codegen.cpp.test/src/org/eclipse/papyrusrt/codegen/cpp/test/codecompare/UMLRTTestGenerator.java b/tests/junit/umlrt/codegen/org.eclipse.papyrusrt.codegen.cpp.test/src/org/eclipse/papyrusrt/codegen/cpp/test/codecompare/UMLRTTestGenerator.java
index 5473ac6..ee21e3e 100644
--- a/tests/junit/umlrt/codegen/org.eclipse.papyrusrt.codegen.cpp.test/src/org/eclipse/papyrusrt/codegen/cpp/test/codecompare/UMLRTTestGenerator.java
+++ b/tests/junit/umlrt/codegen/org.eclipse.papyrusrt.codegen.cpp.test/src/org/eclipse/papyrusrt/codegen/cpp/test/codecompare/UMLRTTestGenerator.java
@@ -35,154 +35,124 @@
 import org.osgi.framework.Bundle;
 
 @SuppressWarnings("nls")
-public class UMLRTTestGenerator extends AbstractUMLRTGenerator
-{
+public class UMLRTTestGenerator extends AbstractUMLRTGenerator {
 
-    public static UMLRTTestGenerator INSTANCE = new UMLRTTestGenerator();
+	public static UMLRTTestGenerator INSTANCE = new UMLRTTestGenerator();
 
-    private UMLRTTestGenerator()
-    {
-    }
+	private UMLRTTestGenerator() {
+		super();
+		setStandalone(false);
+	}
 
-    @Override
-    public IStatus generate( List<EObject> elements, String top, boolean uml )
-    {
+	@Override
+	public IStatus generate(List<EObject> elements, String top, boolean uml) {
 
-        IStatus status = super.generate( elements, top, uml );
+		IStatus status = super.generate(elements, top, uml);
 
-        Set<IProject> projects = new HashSet<IProject>();
-        for (EObject e : elements)
-        {
-            IProject p = getProject( e );
-            if (p != null)
-            {
-                projects.add( p );
-            }
-        }
+		Set<IProject> projects = new HashSet<>();
+		for (EObject e : elements) {
+			IProject p = getProject(e);
+			if (p != null) {
+				projects.add(p);
+			}
+		}
 
-        // Refresh generated projects
-        for (IProject p : projects)
-        {
-            try
-            {
-                p.refreshLocal( IResource.DEPTH_INFINITE, null );
-            }
-            catch (CoreException e)
-            {
-                // ignore
-            }
-        }
+		// Refresh generated projects
+		for (IProject p : projects) {
+			try {
+				p.refreshLocal(IResource.DEPTH_INFINITE, null);
+			} catch (CoreException e) {
+				// ignore
+			}
+		}
 
-        return status;
-    }
+		return status;
+	}
 
-    @Override
-    protected File getModelFolder( EObject eobj )
-    {
-        if (eobj == null)
-            return null;
+	@Override
+	protected File getModelFolder(EObject eobj) {
+		if (eobj == null)
+			return null;
 
-        String modelName = ((NamedElement) eobj).getName();
+		String modelName = ((NamedElement) eobj).getName();
 
-        Bundle bundle = Platform.getBundle( CodeGenCompareTest.PLUGIN_ID );
-        Path path = new Path( "models/" + modelName );
-        URL url = FileLocator.find( bundle, path, null );
-        try
-        {
-            java.net.URI uri = FileLocator.resolve( url ).toURI();
-            return new File( CodeGenUtils.simplifyPath( uri.getRawPath() ) );
-        }
-        catch (Exception e)
-        {
-        }
-        return null;
-    }
+		Bundle bundle = Platform.getBundle(CodeGenCompareTest.PLUGIN_ID);
+		Path path = new Path("models/" + modelName);
+		URL url = FileLocator.find(bundle, path, null);
+		try {
+			java.net.URI uri = FileLocator.resolve(url).toURI();
+			return new File(CodeGenUtils.simplifyPath(uri.getRawPath()));
+		} catch (Exception e) {
+		}
+		return null;
+	}
 
-    public File getOutputFolder( EObject eobj )
-    {
-        return getOutputFolder( eobj, null );
-    }
+	public File getOutputFolder(EObject eobj) {
+		return getOutputFolder(eobj, null);
+	}
 
-    @Override
-    protected File getOutputFolder( EObject eobj, CppCodeGenerator codeGen )
-    {
-        IProject project = getProject( eobj, codeGen );
+	@Override
+	protected File getOutputFolder(EObject eobj, CppCodeGenerator codeGen) {
+		IProject project = getProject(eobj, codeGen);
 
-        // Bug 109: Refresh the folder before checking if it exists.
-        IFolder folder = project.getFolder( "src" );
-        try
-        {
-            folder.refreshLocal( IResource.DEPTH_ZERO, null );
-        }
-        catch (CoreException e)
-        {
-            CodeGenPlugin.error( "could not refresh output folder", e );
-        }
+		// Bug 109: Refresh the folder before checking if it exists.
+		IFolder folder = project.getFolder("src");
+		try {
+			folder.refreshLocal(IResource.DEPTH_ZERO, null);
+		} catch (CoreException e) {
+			CodeGenPlugin.error("could not refresh output folder", e);
+		}
 
-        if (!folder.exists())
-            try
-            {
-                folder.create( true, true, null );
-            }
-            catch (CoreException e)
-            {
-                CodeGenPlugin.error( "could not create output folder", e );
-            }
+		if (!folder.exists())
+			try {
+				folder.create(true, true, null);
+			} catch (CoreException e) {
+				CodeGenPlugin.error("could not create output folder", e);
+			}
 
-        return folder.getRawLocation().toFile();
-    }
+		return folder.getRawLocation().toFile();
+	}
 
-    public IProject getProject( EObject eobj )
-    {
-        return getProject( eobj, null );
-    }
+	public IProject getProject(EObject eobj) {
+		return getProject(eobj, null);
+	}
 
-    public IProject getProject( EObject eobj, CppCodeGenerator codeGen )
-    {
-        String projectName = ProjectUtils.getProjectName( eobj );
-        projectName = projectName + "_CDTProject";
+	public IProject getProject(EObject eobj, CppCodeGenerator codeGen) {
+		String projectName = ProjectUtils.getProjectName(eobj);
+		projectName = projectName + "_CDTProject";
 
-        String rootPath = ResourcesPlugin.getWorkspace().getRoot().getLocation().toOSString();
+		String rootPath = ResourcesPlugin.getWorkspace().getRoot().getLocation().toOSString();
 
-        IProject project = ResourcesPlugin.getWorkspace().getRoot().getProject( projectName );
+		IProject project = ResourcesPlugin.getWorkspace().getRoot().getProject(projectName);
 
-        if (!project.exists())
-        {
-            resetResource( eobj, codeGen );
+		if (!project.exists()) {
+			resetResource(eobj, codeGen);
 
-            boolean result = new CppProjectGenerator().generate( rootPath, projectName );
-            if (!result)
-            {
-                CodeGenPlugin.error( "Failed to create output project" );
-                return null;
-            }
+			boolean result = new CppProjectGenerator().generate(rootPath, projectName);
+			if (!result) {
+				CodeGenPlugin.error("Failed to create output project");
+				return null;
+			}
 
-            try
-            {
-                IProjectDescription description = ResourcesPlugin.getWorkspace()
-                        .loadProjectDescription( new org.eclipse.core.runtime.Path( rootPath + "/" + projectName
-                                + "/.project" ) );
-                project = ResourcesPlugin.getWorkspace().getRoot().getProject( description.getName() );
-                project.create( description, null );
-            }
-            catch (CoreException e1)
-            {
-                CodeGenPlugin.error( "Failed to create output project" );
-            }
-        }
+			try {
+				IProjectDescription description = ResourcesPlugin.getWorkspace()
+						.loadProjectDescription(new org.eclipse.core.runtime.Path(rootPath + "/" + projectName
+								+ "/.project"));
+				project = ResourcesPlugin.getWorkspace().getRoot().getProject(description.getName());
+				project.create(description, null);
+			} catch (CoreException e1) {
+				CodeGenPlugin.error("Failed to create output project");
+			}
+		}
 
-        if (!project.isOpen())
-        {
-            try
-            {
-                project.open( new NullProgressMonitor() );
-            }
-            catch (CoreException e)
-            {
-                CodeGenPlugin.error( "Failed to open project" );
-            }
-        }
+		if (!project.isOpen()) {
+			try {
+				project.open(new NullProgressMonitor());
+			} catch (CoreException e) {
+				CodeGenPlugin.error("Failed to open project");
+			}
+		}
 
-        return project;
-    }
+		return project;
+	}
 }
\ No newline at end of file