Skip to content

Commit

Permalink
felix: Add recipes for the felix OSGi implementation
Browse files Browse the repository at this point in the history
  • Loading branch information
Stefan Schmidt committed Jan 27, 2011
1 parent f1c6fc7 commit 734e885
Show file tree
Hide file tree
Showing 9 changed files with 319 additions and 0 deletions.
19 changes: 19 additions & 0 deletions recipes/felix/felix-configadmin_1.2.8.bb
@@ -0,0 +1,19 @@
require felix.inc

DESCRIPTION = "R4 Compliant OSGi Config Admin implementation."

PR = "${INC_PR}.1"

FQPN="org.apache.felix.configadmin"

datadir_java = ${datadir}/java/bundle/

FILES_${PN}="${datadir_java}"

addtask prep_install after do_compile before do_install
do_prep_install(){
install -m 0644 ${FQPN}-${PV}.jar ${S}/${BPN}.jar
}

SRC_URI[md5sum] = "bccdf944cc2ba6b51af47dc344ec00b6"
SRC_URI[sha256sum] = "0fab455db897b1651781433fa5829007b4c89ad4eb89e226c4b41e902aaa34bd"
46 changes: 46 additions & 0 deletions recipes/felix/felix-init.bb
@@ -0,0 +1,46 @@
DESCRIPTION = "Initialization and startup scripts for felix on BUG"
LICENSE = "MIT"
PR = "r0"
RDEPENDS+="update-rc.d"

SRC_URI = "file://config.properties \
file://start.sh \
file://felix \
file://felix-debug"

framedir = "/usr/share/java"

PACKAGE_ARCH = "${MACHINE_ARCH}"

FILES_${PN} += "${framedir}/start.sh \
${framedir}/conf/config.properties \
/etc/init.d/felix \
/etc/init.d/felix-debug \
"

DEPENDS = "fastjar-native felix"

do_compile() {
echo "bug.os.version=${DISTRO_VERSION}" >> ${WORKDIR}/config.properties
}

addtask init_install before do_package after do_install
do_init_install() {
install -m 0755 -d ${D}${framedir}
install -m 0755 -d ${D}${framedir}/conf
install -m 0755 ${WORKDIR}/start.sh ${D}${framedir}
install -m 0755 ${WORKDIR}/config.properties ${D}${framedir}/conf/
install -d ${D}/etc
install -d ${D}/etc/init.d
install -m 0755 ${WORKDIR}/felix ${D}/etc/init.d
install -m 0755 ${WORKDIR}/felix-debug ${D}/etc/init.d
}

inherit update-rc.d

INITSCRIPT_NAME = "felix"
INITSCRIPT_PARAMS = "start 30 5 2 . stop 30 0 1 6 ."

pkg_postrm_${PN}() {
update-rc.d -f felix remove
}
47 changes: 47 additions & 0 deletions recipes/felix/felix-init/config.properties
@@ -0,0 +1,47 @@
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.

# This configuration file is for BUG 2.0 Felix

# System configuration elements
org.osgi.framework.os.name=linux
org.osgi.framework.processor=armv7l
java.library.path=/usr/lib/jni
bug.os.version=2009.X-stable

# Felix configuration elements
felix.shutdown.hook=true
# Set log level to INFO (1 = ERROR, 4 = DEBUG)
org.osgi.logging.level=3
# Set number of log events that will be cached in memory
org.osgi.logging.bufferSize = 32
# uncomment next line to stop all log output
#org.osgi.logging.quiet=true
# uncomment and change next line to modify date format of log event
#org.osgi.logging.date.format="MM/dd HH:mm.ss"
#determines behavior of bundles in the bundle directory.
felix.auto.deploy.action=install,start
#where to store the exploded bundles and any data they generate.
felix.cache.rootdir=/var/volatile
#where felix ConfigurationAdmin stores it's configuration data.
felix.cm.dir=/var/local/cm

# BUG configuration elements
org.osgi.console.port=8090
app.bundle.path=/usr/share/java/apps
org.osgi.service.http.port=80

45 changes: 45 additions & 0 deletions recipes/felix/felix-init/felix
@@ -0,0 +1,45 @@
#!/bin/sh
#
# Init script to start Apache Felix on BUG devices.
#

# Location of Java program
JVM_PATH=/usr/bin/java

# Where OSGi runtime is located
RUN_DIR=/usr/share/java

# Where log output is directed
LOG_FILE=/var/log/felix.log

# Where Java JNI libraries are located
JNI_DIR=/usr/lib/jni

# Max memory JVM should use.
JVM_MEMORY="-Xmx64M"

# Name and location of OSGi framework to launch
OSGI_FRAMEWORK_JAR_NAME=/usr/share/java/felix.jar

# Configuration properties used when launching OSGi framework
OSGI_FRAMEWORK_CONFIG=/usr/share/java/conf/config.properties

EXTRA_ARGS=" $JVM_MEMORY -Dfelix.config.properties=file://$OSGI_FRAMEWORK_CONFIG -jar $OSGI_FRAMEWORK_JAR_NAME"

if [ "$1" = "stop" -o "$1" = "restart" ]; then
echo "Stopping Felix."
if test -f /var/run/felix.pid ; then
start-stop-daemon --oknodo --quiet --stop --retry 5 -p /var/run/felix.pid
fi
fi

if [ "$1" = "start" -o "$1" = "restart" ]; then
echo "Starting Apache Felix. Logging output to $LOG_FILE."
cd $RUN_DIR
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$JNI_DIR
export DISPLAY=:0.0
`start-stop-daemon -S \
--make-pidfile --pidfile /var/run/felix.pid \
--exec "$JVM_PATH" -- $EXTRA_ARGS > $LOG_FILE 2>&1 &`
fi

51 changes: 51 additions & 0 deletions recipes/felix/felix-init/felix-debug
@@ -0,0 +1,51 @@
#!/bin/sh
#
# Init script to start Apache Felix on BUG devices with remote debugging enabled. Remote debugger listens on port 5000 by default.
#

# Location of Java program
JVM_PATH=/usr/bin/java

# Where OSGi runtime is located
RUN_DIR=/usr/share/java

# Where log output is directed
LOG_FILE=/var/log/felix.log

# Where Java JNI libraries are located
JNI_DIR=/usr/lib/jni

# Max memory JVM should use.
JVM_MEMORY="-Xmx64M"

# Name and location of OSGi framework to launch
OSGI_FRAMEWORK_JAR_NAME=/usr/share/java/felix.jar

# Configuration properties used when launching OSGi framework
OSGI_FRAMEWORK_CONFIG=/usr/share/java/conf/config.properties

# Port that remote debugger will listen on.
REMOTE_DEBUG_PORT="5000"

# Debug parameters for JVM
REMOTE_DEBUG_PARAMS=" -Xdebug -Xrunjdwp:transport=dt_socket,server=y,address=$REMOTE_DEBUG_PORT "

EXTRA_ARGS=" $REMOTE_DEBUG_PARAMS $JVM_MEMORY -Dfelix.config.properties=file://$OSGI_FRAMEWORK_CONFIG -jar $OSGI_FRAMEWORK_JAR_NAME"

if [ "$1" = "stop" -o "$1" = "restart" ]; then
echo "Stopping Felix."
if test -f /var/run/felix.pid ; then
start-stop-daemon --oknodo --quiet --stop --retry 5 -p /var/run/felix.pid
fi
fi

if [ "$1" = "start" -o "$1" = "restart" ]; then
echo "Starting Apache Felix in remote debug mode. Logging output to $LOG_FILE. Listening on port $REMOTE_DEBUG_PORT..."
cd $RUN_DIR
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$JNI_DIR
export DISPLAY=:0.0
`start-stop-daemon -S \
--make-pidfile --pidfile /var/run/felix.pid \
--exec "$JVM_PATH" -- $EXTRA_ARGS > $LOG_FILE 2>&1 &`
fi

48 changes: 48 additions & 0 deletions recipes/felix/felix-init/start.sh
@@ -0,0 +1,48 @@
#!/bin/sh
# The user can request that we initialize concierge as
# part of startup by holding down hotkeys 1 and 3 during
# boot.
# The user can request that we remove all existing BUG
# applications and also initialize concierge as part of
# startup by holding down hotkeys 2 and 4 during boot.
# The bugnav driver has a proc file that reports the
# current state of the BUGbase buttons, so we use that
# to figure out whether we need to do anything special


#Not sure how much of this is actually accurate for 2.0 since the pMEA=>openjdk, concierge=>felix, new button interface. commenting out for now
#INIT_BUTTON_CHECK=$(egrep "M1 1|M2 0|M3 1|M4 0" /proc/bugnav|wc -l)
#RESET_BUTTON_CHECK=$(egrep "M1 0|M2 1|M3 0|M4 1" /proc/bugnav|wc -l)
#RUN_DIR=/usr/share/java
#INIT_ARG=-Dosgi.init=true
#
#CVM_DIR=/usr/lib/jvm/phoneme-advanced-personal-debug
#CVM_PATH=/usr/bin/java
#CVM_PARAMS=
#
#if [ -n "$WANT_DEBUG" ]; then
# echo 'Running debug CVM'
# # example to stop before running any code and wait for debugger client to connect to us on port 5000
# CVM_PARAMS='-Xdebug -Xrunjdwp:transport=dt_socket,server=y,address=5000 '
#elif [ -n "$WANT_PROFILE" ]; then
# # this is an example profile run; change it to '-agentlib:jvmtihprof=help' to see all the options
# CVM_PARAMS="-agentlib:jvmtihprof=heap=all,cpu=samples,file=/tmp/profile.txt -Xbootclasspath/a:$CVM_DIR/lib/java_crw_demo.jar"
#fi
#
#if [ $INIT_BUTTON_CHECK = 4 ]; then
# echo 'init request by user'
# INIT=$INIT_ARG
#elif [ $RESET_BUTTON_CHECK = 4 ]; then
# echo 'reset requested by user'
# INIT=$INIT_ARG
# echo 'removing existing apps'
# /bin/rm -f $RUN_DIR/apps/*.jar
#else
# echo 'normal startup'
# INIT=
#fi
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/lib/jni

export DISPLAY=:0.0
/usr/bin/java -Xmx64M -Dfelix.config.properties=file:///usr/share/java/conf/config.properties -Dfreetype.font=/usr/share/fonts/ttf/LiberationSans-Regular.ttf -Djava.library.path=/usr/lib/jni -jar /usr/share/java/felix.jar
#$CVM_PATH $CVM_PARAMS -Xmx64M -cp concierge.jar -Dfreetype.font=/usr/share/fonts/ttf/LiberationSans-Regular.ttf -Djava.library.path=/usr/lib/jni -Dxargs=$RUN_DIR/init.xargs $INIT ch.ethz.iks.concierge.framework.Framework
21 changes: 21 additions & 0 deletions recipes/felix/felix-log_1.0.0.bb
@@ -0,0 +1,21 @@
require felix.inc

DESCRIPTION = "R4 Compliant OSGi logger bundle"

PR = "${INC_PR}.1"

RCONFLICTS="concierge"

FQPN="org.apache.felix.log"

datadir_java = ${datadir}/java/bundle/

FILES_${PN}="${datadir_java}"

addtask prep_install after do_compile before do_install
do_prep_install(){
install -m 0644 org.apache.felix.log-${PV}.jar ${S}/${BPN}.jar
}

SRC_URI[md5sum] = "95d51e8f9750d6f9839dbd71c0a42f26"
SRC_URI[sha256sum] = "1b5a71515122e2a08938a98f94188a741bfa8a1db9337669396a415a2896d85c"
25 changes: 25 additions & 0 deletions recipes/felix/felix.inc
@@ -0,0 +1,25 @@
DESCRIPTION = "Apache Felix is an implementation of the OSGi Release 4 core framework specification."
LICENSE = "Apache-2.0"
HOMEPAGE = "http://felix.apache.org/site/index.html"

INC_PR = "r0"

inherit bug-java-library

#Fully Qualified Project Name.
FQPN="CHANGE_ME"

SRC_URI = "${APACHE_MIRROR}/felix/${FQPN}-${PV}-bin.tar.gz"
S = "${WORKDIR}/${FQPN}-${PV}"

PACKAGE_ARCH = "all"

FILES_${PN}="/usr/share/java/"

# override java-library's naming conventions
PACKAGES = ${PN}

# dummy to keep jar from being removed by java-library.bbclass
do_removebinaries() {
:
}
17 changes: 17 additions & 0 deletions recipes/felix/felix_3.0.4.bb
@@ -0,0 +1,17 @@
require felix.inc

PR = "${INC_PR}.1"

FQPN="org.apache.felix.main.distribution"

SRC_URI = "${APACHE_MIRROR}/felix/${FQPN}-${PV}-project.tar.gz"

FILES_${PN}="/usr/share/java/"

addtask prep_install after do_compile before do_install
do_prep_install(){
install -m 0644 bin/${PN}.jar ${S}
}

SRC_URI[md5sum] = "aebdc76fe950e2ce01f1b41f1ff1f184"
SRC_URI[sha256sum] = "9a6a8f420065d3b97c58c8a564c8c5c77d893002e134948afec6d3245a6b3edc"

0 comments on commit 734e885

Please sign in to comment.