Integrating YANG live compilation into YANG runtime.

- Bumped ONOS dependency on ONOS YANG tools 2.2.0-b4.
- Added CLI to compile YANG models.
- Added GUI capability to compile YANG models via drag-n-drop or file upload.
- Fixed defect in propagating self-contained JAR apps through the cluster.

Change-Id: Icbd2a588bf1ffe0282e12d3d10a117e0957c3084
diff --git a/core/common/src/main/java/org/onosproject/common/app/ApplicationArchive.java b/core/common/src/main/java/org/onosproject/common/app/ApplicationArchive.java
index b02d33a..ec38607 100644
--- a/core/common/src/main/java/org/onosproject/common/app/ApplicationArchive.java
+++ b/core/common/src/main/java/org/onosproject/common/app/ApplicationArchive.java
@@ -262,6 +262,9 @@
     public synchronized InputStream getApplicationInputStream(String appName) {
         try {
             File appFile = appFile(appName, appName + OAR);
+            if (!appFile.exists()) {
+                appFile = appFile(appName, appName + JAR);
+            }
             return new FileInputStream(appFile.exists() ? appFile : appFile(appName, APP_XML));
         } catch (FileNotFoundException e) {
             throw new ApplicationException("Application " + appName + " not found");
@@ -383,7 +386,7 @@
 
         // Create the file directory structure and copy the file there.
         File jar = appFile(desc.name(), jarName);
-        boolean ok = jar.getParentFile().mkdirs();
+        boolean ok = jar.getParentFile().exists() || jar.getParentFile().mkdirs();
         if (ok) {
             Files.write(toByteArray(stream), jar);
             Files.copy(appFile(desc.name(), FEATURES_XML), appFile(desc.name(), featuresName));
@@ -402,7 +405,9 @@
             cfg.setAttributeSplittingDisabled(true);
             cfg.setDelimiterParsingDisabled(true);
             cfg.load(appFile(desc.name(), FEATURES_XML));
-            return cfg.getString("feature.bundle");
+            return cfg.getString("feature.bundle")
+                    .replaceFirst("wrap:", "")
+                    .replaceFirst("\\$Bundle-.*$", "");
         } catch (ConfigurationException e) {
             log.warn("Self-contained application {} has no features.xml", desc.name());
             return null;