[WIP] Upgrade ONOS to karaf version 4.2.1

Change-Id: I7cd40c995bdf1c80f94b1895fb3344e32404c7fa
diff --git a/utils/osgiwrap/src/main/java/org/onlab/osgiwrap/OSGiWrapper.java b/utils/osgiwrap/src/main/java/org/onlab/osgiwrap/OSGiWrapper.java
index 821bf40..b57dab5 100644
--- a/utils/osgiwrap/src/main/java/org/onlab/osgiwrap/OSGiWrapper.java
+++ b/utils/osgiwrap/src/main/java/org/onlab/osgiwrap/OSGiWrapper.java
@@ -84,6 +84,7 @@
     private String destdir;
 
     private String bundleClasspath;
+    private String karafCommands;
 
     // FIXME should consider using Commons CLI, etc.
     public static void main(String[] args) {
@@ -107,6 +108,7 @@
         String dynamicimportPackages = args[12];
         String destdir = args[13];
         String bundleClasspath = args[14];
+        String karafCommands = args[15];
         String desc = Joiner.on(' ').join(Arrays.copyOfRange(args, 12, args.length));
 
         OSGiWrapper wrapper = new OSGiWrapper(jar, output, cp,
@@ -119,7 +121,8 @@
                 dynamicimportPackages,
                 desc,
                 destdir,
-                bundleClasspath);
+                bundleClasspath,
+                karafCommands);
         wrapper.log(wrapper + "\n");
         if (!wrapper.execute()) {
             System.err.printf("Error generating %s\n", name);
@@ -143,7 +146,8 @@
                        String dynamicimportPackages,
                        String bundleDescription,
                        String destdir,
-                       String bundleClasspath) {
+                       String bundleClasspath,
+                       String karafCommands) {
         this.inputJar = inputJar;
         this.classpath = Lists.newArrayList(classpath.split(":"));
         if (!this.classpath.contains(inputJar)) {
@@ -174,6 +178,7 @@
         this.destdir = destdir;
 
         this.bundleClasspath = bundleClasspath;
+        this.karafCommands = karafCommands;
     }
 
     private void setProperties(Analyzer analyzer) {
@@ -189,6 +194,7 @@
         //analyzer.setProperty("-consumer-policy", "${range;[===,==+)}");
 
         analyzer.setProperty(Analyzer.DYNAMICIMPORT_PACKAGE, dynamicimportPackages);
+        analyzer.setProperty(Analyzer.DSANNOTATIONS_OPTIONS, "inherit");
 
         // TODO include version in export, but not in import
         analyzer.setProperty(Analyzer.EXPORT_PACKAGE, exportPackages);
@@ -207,6 +213,7 @@
             analyzer.setProperty(Analyzer.IMPORT_PACKAGE, importPackages +
                     ",org.glassfish.jersey.servlet,org.jvnet.mimepull\n");
         }
+        analyzer.setProperty("Karaf-Commands", karafCommands);
     }
 
     public boolean execute() {
@@ -230,14 +237,14 @@
             // Analyze the target JAR first
             analyzer.analyze();
 
-            // Scan the JAR for Felix SCR annotations and generate XML files
-            Map<String, String> properties = Maps.newHashMap();
-            // destdir hack
-            properties.put("destdir", destdir);
-            SCRDescriptorBndPlugin scrDescriptorBndPlugin = new SCRDescriptorBndPlugin();
-            scrDescriptorBndPlugin.setProperties(properties);
-            scrDescriptorBndPlugin.setReporter(analyzer);
-            scrDescriptorBndPlugin.analyzeJar(analyzer);
+            //// Scan the JAR for Felix SCR annotations and generate XML files
+            //Map<String, String> properties = Maps.newHashMap();
+            //// destdir hack
+            //properties.put("destdir", destdir);
+            //SCRDescriptorBndPlugin scrDescriptorBndPlugin = new SCRDescriptorBndPlugin();
+            //scrDescriptorBndPlugin.setProperties(properties);
+            //scrDescriptorBndPlugin.setReporter(analyzer);
+            //scrDescriptorBndPlugin.analyzeJar(analyzer);
 
             if (includeResources != null) {
                 doIncludeResources(analyzer);