summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorStefan Schmidt <stefan@buglabs.net>2010-12-02 15:37:18 +0100
committerStefan Schmidt <stefan@buglabs.net>2011-01-31 12:03:52 +0100
commit2d4c7b685c9f750e08491f5cc10c080483db855d (patch)
treec769cdc89670f69afa225dad3adddfb74ec8aaad
parent4725ca4c02ab092c1b0c7451549ece6b0ee58344 (diff)
downloadopenembedded-2d4c7b685c9f750e08491f5cc10c080483db855d.tar.gz
concierge: Add OSGi R3 implementation and service tracker
-rw-r--r--recipes/concierge/concierge_1.0.bb27
-rw-r--r--recipes/concierge/files/fix-EE-string.patch13
-rw-r--r--recipes/concierge/files/run-in-place.patch97
-rw-r--r--recipes/concierge/files/service-tracker-MANIFEST.MF5
-rw-r--r--recipes/concierge/service-tracker_1.0-rc3.bb34
5 files changed, 176 insertions, 0 deletions
diff --git a/recipes/concierge/concierge_1.0.bb b/recipes/concierge/concierge_1.0.bb
new file mode 100644
index 0000000000..e4a99e041a
--- /dev/null
+++ b/recipes/concierge/concierge_1.0.bb
@@ -0,0 +1,27 @@
+DESCRIPTION = "A fast, lightweight OSGi R3 framework implementation"
+LICENSE = "BSD"
+DEPENDS = "fastjar-native"
+
+SRCREV = "246"
+PV = "1.0+svnr${SRCREV}"
+PR = "r0"
+
+SRC_URI = "svn://concierge.svn.sourceforge.net/svnroot/concierge/tags/Concierge/1.0.0/trunk;module=framework;proto=http;localdir=framework \
+ file://fix-EE-string.patch \
+ file://run-in-place.patch;striplevel=1 \
+ "
+S = "${WORKDIR}/framework"
+
+inherit bug-java-library
+
+do_compile() {
+ mkdir -p build
+ javac -sourcepath src/main/java -d build `find src/main/java -name \*.java`
+ fastjar -0 -C build -c -f ${JARFILENAME} .
+}
+
+PACKAGE_ARCH = "all"
+# override java-library's naming conventions
+PACKAGES = "${PN}"
+
+FILES_${PN} += "${datadir_java}/${PN}.jar"
diff --git a/recipes/concierge/files/fix-EE-string.patch b/recipes/concierge/files/fix-EE-string.patch
new file mode 100644
index 0000000000..9c04eb5710
--- /dev/null
+++ b/recipes/concierge/files/fix-EE-string.patch
@@ -0,0 +1,13 @@
+Index: framework/src/main/java/ch/ethz/iks/concierge/framework/Framework.java
+===================================================================
+--- framework.orig/src/main/java/ch/ethz/iks/concierge/framework/Framework.java
++++ framework/src/main/java/ch/ethz/iks/concierge/framework/Framework.java
+@@ -624,7 +624,7 @@ public final class Framework {
+ case 7:
+ myEEs.append("J2SE-1.7,");
+ case 6:
+- myEEs.append("J2SE-1.6,");
++ myEEs.append("JavaSE-1.6,");
+ case 5:
+ myEEs.append("J2SE-1.5,");
+ case 4:
diff --git a/recipes/concierge/files/run-in-place.patch b/recipes/concierge/files/run-in-place.patch
new file mode 100644
index 0000000000..04bb86c364
--- /dev/null
+++ b/recipes/concierge/files/run-in-place.patch
@@ -0,0 +1,97 @@
+---
+ src/main/java/ch/ethz/iks/concierge/framework/BundleClassLoader.java | 11 +++++-
+ src/main/java/ch/ethz/iks/concierge/framework/Framework.java | 17 ++++++++--
+ 2 files changed, 24 insertions(+), 4 deletions(-)
+
+--- framework.orig/src/main/java/ch/ethz/iks/concierge/framework/BundleClassLoader.java
++++ framework/src/main/java/ch/ethz/iks/concierge/framework/BundleClassLoader.java
+@@ -172,13 +172,20 @@ final class BundleClassLoader extends Cl
+ this.bundle = bundle;
+ this.storageLocation = Framework.STORAGE_LOCATION + bundle.bundleID
+ + File.separatorChar + File.separatorChar;
+
+ try {
+- // write the JAR file to the storage
+ File file = new File(storageLocation, BUNDLE_FILE_NAME);
+- storeFile(file, stream);
++
++ if (Framework.RUN_IN_PLACE) {
++ file.getParentFile().mkdirs();
++ String fileLoc = bundle.location.indexOf(':') > -1 ? bundle.location.substring(bundle.location.indexOf(':') + 1) : bundle.location;
++ file = new File(fileLoc);
++ } else {
++ // write the JAR file to the storage
++ storeFile(file, stream);
++ }
+
+ // and open a JarFile
+ final JarFile jar = new JarFile(file);
+
+ // process the manifest
+--- framework.orig/src/main/java/ch/ethz/iks/concierge/framework/Framework.java
++++ framework/src/main/java/ch/ethz/iks/concierge/framework/Framework.java
+@@ -164,10 +164,15 @@ public final class Framework {
+
+ /**
+ * debug outputs from services ?
+ */
+ static boolean DEBUG_SERVICES;
++
++ /**
++ * run without copying classes to storage ?
++ */
++ static boolean RUN_IN_PLACE;
+
+ /**
+ * the profile.
+ */
+ private static String PROFILE;
+@@ -382,27 +387,34 @@ public final class Framework {
+ PROFILE = properties.getProperty("osgi.profile", "default");
+ launch();
+
+ // if profile set, try to restart the profile
+ target = -1;
++ restart = false;
+ boolean init = getProperty("osgi.init", false);
+- if (!init) {
++ if (RUN_IN_PLACE) {
++ System.out.println("Executing jars in place.");
++ }
++
++ if (!init && !RUN_IN_PLACE) {
+ time = System.currentTimeMillis();
+ target = restoreProfile();
+ restart = true;
+ }
+
+ if (target == -1) {
+- restart = false;
+ File storage = new File(STORAGE_LOCATION);
+ if (init) {
+ if (storage.exists()) {
+ System.out.println("purging storage ...");
+ deleteDirectory(storage);
+ }
++ } else if (RUN_IN_PLACE && storage.exists()) {
++ restart = true;
+ }
+
++
+ storage.mkdirs();
+
+ // TO THE ACTUAL WORK
+ time = System.currentTimeMillis();
+ properties.setProperty("osgi.auto.install.1", properties
+@@ -592,10 +604,11 @@ public final class Framework {
+ false);
+ DECOMPRESS_EMBEDDED = getProperty(
+ "ch.ethz.iks.concierge.decompressEmbedded", true);
+ SECURITY_ENABLED = getProperty(
+ "ch.ethz.iks.concierge.security.enabled", false);
++ RUN_IN_PLACE = getProperty("ch.ethz.iks.concierge.runInPlace", false);
+
+ final String ADDITIONAL_PACKAGES = properties
+ .getProperty("org.osgi.framework.system.packages");
+
+ if (ADDITIONAL_PACKAGES != null) {
diff --git a/recipes/concierge/files/service-tracker-MANIFEST.MF b/recipes/concierge/files/service-tracker-MANIFEST.MF
new file mode 100644
index 0000000000..89d989103c
--- /dev/null
+++ b/recipes/concierge/files/service-tracker-MANIFEST.MF
@@ -0,0 +1,5 @@
+Bundle-Name: Service Tracker
+Bundle-Description: Concierge Service Tracker
+Bundle-Vendor: Jan S. Rellermeyer, ETH Zurich
+Import-Package: org.osgi.framework;specification-version=1.2
+Export-Package: org.osgi.util.tracker;specification-version=1.2
diff --git a/recipes/concierge/service-tracker_1.0-rc3.bb b/recipes/concierge/service-tracker_1.0-rc3.bb
new file mode 100644
index 0000000000..6899232845
--- /dev/null
+++ b/recipes/concierge/service-tracker_1.0-rc3.bb
@@ -0,0 +1,34 @@
+DESCRIPTION = "OSGi R3 ServiceTracker classes"
+HOMEPAGE = "http://concierge.sourceforge.net"
+LICENSE = "BSD"
+DEPENDS = "fastjar-native concierge"
+
+SRCREV = "220"
+PV = "1.0+svnr${SRCREV}"
+PR = "r0"
+
+SRC_URI = "svn://concierge.svn.sourceforge.net/svnroot/concierge/tags/Concierge/1.0.0.RC3/;module=bundles/service_tracker;proto=http;localdir=${PN} \
+ file://files/service-tracker-MANIFEST.MF \
+"
+
+S = "${WORKDIR}/bundles/service_tracker"
+
+inherit bug-java-library
+
+do_compile() {
+ mkdir -p build
+ oe_makeclasspath cp -s ${DEPENDS} ${EXTRA_CP}
+ echo "JAVAC CLASSPATH ---------------"
+ echo $cp | awk 'BEGIN {FS=":"} {split($0,a,":"); for (i=1; i<=NF; i++) print a[i]; }'
+ echo "-------------------------"
+ javac -sourcepath src/main/java -cp $cp -d build `find src/main/java -name \*.java`
+ fastjar -m ${WORKDIR}/files/service-tracker-MANIFEST.MF -C build -c -f ${JARFILENAME} .
+ fastjar -C src/main/java -u -f ${JARFILENAME} .
+}
+
+PACKAGE_ARCH = "all"
+# override java-library's naming conventions
+PACKAGES = "${PN}"
+
+FILES_${PN} += "${datadir_java}/${PN}.jar"
+FILES_${PN} += "${datadir_java}/${P}.jar"