buglabs-oe: remove AUTOREV from bnd-native since it seems to lock bitbake, not sure...
[leafcutter:leafcutter-oe.git] / recipes / concierge / files / run-in-place.patch
1 ---
2  src/main/java/ch/ethz/iks/concierge/framework/BundleClassLoader.java |   11 +++++-
3  src/main/java/ch/ethz/iks/concierge/framework/Framework.java         |   17 ++++++++--
4  2 files changed, 24 insertions(+), 4 deletions(-)
5
6 --- framework.orig/src/main/java/ch/ethz/iks/concierge/framework/BundleClassLoader.java
7 +++ framework/src/main/java/ch/ethz/iks/concierge/framework/BundleClassLoader.java
8 @@ -172,13 +172,20 @@ final class BundleClassLoader extends Cl
9                 this.bundle = bundle;\r
10                 this.storageLocation = Framework.STORAGE_LOCATION + bundle.bundleID\r
11                                 + File.separatorChar + File.separatorChar;\r
12  \r
13                 try {\r
14 -                       // write the JAR file to the storage\r
15                         File file = new File(storageLocation, BUNDLE_FILE_NAME);\r
16 -                       storeFile(file, stream);\r
17 +\r
18 +                       if (Framework.RUN_IN_PLACE) {\r
19 +                               file.getParentFile().mkdirs();\r
20 +                               String fileLoc = bundle.location.indexOf(':') > -1 ? bundle.location.substring(bundle.location.indexOf(':') + 1) : bundle.location;\r
21 +                               file = new File(fileLoc);\r
22 +                       } else {\r
23 +                               // write the JAR file to the storage\r
24 +                               storeFile(file, stream);\r
25 +                       }\r
26  \r
27                         // and open a JarFile\r
28                         final JarFile jar = new JarFile(file);\r
29  \r
30                         // process the manifest\r
31 --- framework.orig/src/main/java/ch/ethz/iks/concierge/framework/Framework.java
32 +++ framework/src/main/java/ch/ethz/iks/concierge/framework/Framework.java
33 @@ -164,10 +164,15 @@ public final class Framework {
34  \r
35         /**\r
36          * debug outputs from services ?\r
37          */\r
38         static boolean DEBUG_SERVICES;\r
39 +       \r
40 +       /**\r
41 +        * run without copying classes to storage ?\r
42 +        */\r
43 +       static boolean RUN_IN_PLACE;\r
44  \r
45         /**\r
46          * the profile.\r
47          */\r
48         private static String PROFILE;\r
49 @@ -382,27 +387,34 @@ public final class Framework {
50                                 PROFILE = properties.getProperty("osgi.profile", "default");\r
51                                 launch();\r
52  \r
53                                 // if profile set, try to restart the profile\r
54                                 target = -1;\r
55 +                               restart = false;\r
56                                 boolean init = getProperty("osgi.init", false);\r
57 -                               if (!init) {\r
58 +                               if (RUN_IN_PLACE) {\r
59 +                                       System.out.println("Executing jars in place.");\r
60 +                               }\r
61 +                               \r
62 +                               if (!init && !RUN_IN_PLACE) {\r
63                                         time = System.currentTimeMillis();\r
64                                         target = restoreProfile();\r
65                                         restart = true;\r
66                                 }\r
67  \r
68                                 if (target == -1) {\r
69 -                                       restart = false;\r
70                                         File storage = new File(STORAGE_LOCATION);\r
71                                         if (init) {\r
72                                                 if (storage.exists()) {\r
73                                                         System.out.println("purging storage ...");\r
74                                                         deleteDirectory(storage);\r
75                                                 }\r
76 +                                       } else if (RUN_IN_PLACE && storage.exists()) {\r
77 +                                               restart = true;\r
78                                         }\r
79  \r
80 +\r
81                                         storage.mkdirs();\r
82  \r
83                                         // TO THE ACTUAL WORK\r
84                                         time = System.currentTimeMillis();\r
85                                         properties.setProperty("osgi.auto.install.1", properties\r
86 @@ -592,10 +604,11 @@ public final class Framework {
87                                 false);\r
88                 DECOMPRESS_EMBEDDED = getProperty(\r
89                                 "ch.ethz.iks.concierge.decompressEmbedded", true);\r
90                 SECURITY_ENABLED = getProperty(\r
91                                 "ch.ethz.iks.concierge.security.enabled", false);\r
92 +               RUN_IN_PLACE = getProperty("ch.ethz.iks.concierge.runInPlace", false);\r
93  \r
94                 final String ADDITIONAL_PACKAGES = properties\r
95                                 .getProperty("org.osgi.framework.system.packages");\r
96  \r
97                 if (ADDITIONAL_PACKAGES != null) {\r