Move to Commons Base
authorMathieu Baudier <mbaudier@argeo.org>
Tue, 17 Jul 2012 12:34:05 +0000 (12:34 +0000)
committerMathieu Baudier <mbaudier@argeo.org>
Tue, 17 Jul 2012 12:34:05 +0000 (12:34 +0000)
git-svn-id: https://svn.argeo.org/commons/trunk@5482 4cfe0d0a-d680-48aa-b62c-e0a02a3f76cc

base/dist/osgi-boot/pom.xml [new file with mode: 0644]
base/dist/osgi-boot/src/main/rpm/etc/osgiboot/osgi-service-init-functions.sh [new file with mode: 0644]
base/dist/osgi-boot/src/main/rpm/etc/osgiboot/osgi-service-settings.sh [new file with mode: 0644]
base/dist/osgi-boot/src/main/rpm/usr/sbin/osgi-service [new file with mode: 0644]
base/dist/pom.xml [new file with mode: 0644]
osgi/dist/osgi-boot/pom.xml [deleted file]
osgi/dist/osgi-boot/src/main/rpm/etc/osgiboot/osgi-service-init-functions.sh [deleted file]
osgi/dist/osgi-boot/src/main/rpm/etc/osgiboot/osgi-service-settings.sh [deleted file]
osgi/dist/osgi-boot/src/main/rpm/usr/sbin/osgi-service [deleted file]
osgi/dist/pom.xml [deleted file]

diff --git a/base/dist/osgi-boot/pom.xml b/base/dist/osgi-boot/pom.xml
new file mode 100644 (file)
index 0000000..069c8ba
--- /dev/null
@@ -0,0 +1,189 @@
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+       <modelVersion>4.0.0</modelVersion>
+       <parent>
+               <groupId>org.argeo.commons.osgi</groupId>
+               <version>1.1.4-SNAPSHOT</version>
+               <artifactId>dist</artifactId>
+               <relativePath>..</relativePath>
+       </parent>
+       <artifactId>osgi-boot</artifactId>
+       <packaging>pom</packaging>
+       <name>Commons OSGi Boot Distribution</name>
+       <build>
+               <plugins>
+                       <plugin>
+                               <groupId>org.apache.maven.plugins</groupId>
+                               <artifactId>maven-dependency-plugin</artifactId>
+                               <executions>
+                                       <execution>
+                                               <id>copy-dependencies</id>
+                                               <phase>package</phase>
+                                               <goals>
+                                                       <goal>copy-dependencies</goal>
+                                               </goals>
+                                               <configuration>
+                                                       <includeTypes>jar</includeTypes>
+                                                       <stripVersion>true</stripVersion>
+                                                       <outputDirectory>${project.build.directory}/lib</outputDirectory>
+                                               </configuration>
+                                       </execution>
+                               </executions>
+                       </plugin>
+               </plugins>
+       </build>
+       <dependencies>
+               <dependency>
+                       <groupId>org.argeo.commons.osgi</groupId>
+                       <artifactId>org.argeo.osgi.boot</artifactId>
+                       <version>1.1.4-SNAPSHOT</version>
+               </dependency>
+       </dependencies>
+       <profiles>
+               <profile>
+                       <id>rpmbuild</id>
+                       <build>
+                               <plugins>
+                                       <plugin>
+                                               <groupId>org.codehaus.mojo</groupId>
+                                               <artifactId>rpm-maven-plugin</artifactId>
+                                               <executions>
+                                                       <execution>
+                                                               <id>rpm-osgi-boot</id>
+                                                               <phase>package</phase>
+                                                               <goals>
+                                                                       <goal>rpm</goal>
+                                                               </goals>
+                                                               <configuration>
+                                                                       <name>osgi-boot</name>
+                                                                       <copyright>2011 Argeo</copyright>
+                                                                       <mappings>
+                                                                               <mapping>
+                                                                                       <directory>/etc/osgiboot</directory>
+                                                                                       <username>root</username>
+                                                                                       <groupname>root</groupname>
+                                                                                       <filemode>644</filemode>
+                                                                                       <configuration>noreplace</configuration>
+                                                                                       <directoryIncluded>false</directoryIncluded>
+                                                                                       <sources>
+                                                                                               <source>
+                                                                                                       <location>src/main/rpm/etc/osgiboot</location>
+                                                                                                       <includes>
+                                                                                                               <include>*-settings.sh</include>
+                                                                                                       </includes>
+                                                                                               </source>
+                                                                                       </sources>
+                                                                               </mapping>
+                                                                               <mapping>
+                                                                                       <directory>/etc/osgiboot</directory>
+                                                                                       <username>root</username>
+                                                                                       <groupname>root</groupname>
+                                                                                       <filemode>644</filemode>
+                                                                                       <directoryIncluded>false</directoryIncluded>
+                                                                                       <sources>
+                                                                                               <source>
+                                                                                                       <location>src/main/rpm/etc/osgiboot</location>
+                                                                                                       <includes>
+                                                                                                               <include>*-functions.sh</include>
+                                                                                                       </includes>
+                                                                                               </source>
+                                                                                       </sources>
+                                                                               </mapping>
+                                                                               <mapping>
+                                                                                       <directory>/usr/sbin</directory>
+                                                                                       <username>root</username>
+                                                                                       <groupname>root</groupname>
+                                                                                       <filemode>755</filemode>
+                                                                                       <sources>
+                                                                                               <source>
+                                                                                                       <location>src/main/rpm/usr/sbin</location>
+                                                                                               </source>
+                                                                                       </sources>
+                                                                               </mapping>
+                                                                               <mapping>
+                                                                                       <directory>/usr/share/osgi/boot</directory>
+                                                                                       <username>root</username>
+                                                                                       <groupname>root</groupname>
+                                                                                       <filemode>644</filemode>
+                                                                                       <directoryIncluded>false</directoryIncluded>
+                                                                                       <sources>
+                                                                                               <source>
+                                                                                                       <location>${project.build.directory}/lib</location>
+                                                                                                       <includes>
+                                                                                                               <include>org.argeo.osgi.boot.jar</include>
+                                                                                                       </includes>
+                                                                                               </source>
+                                                                                       </sources>
+                                                                               </mapping>
+                                                                       </mappings>
+                                                                       <requires>
+                                                                               <require>osgi-boot-equinox</require>
+                                                                       </requires>
+                                                               </configuration>
+                                                       </execution>
+                                               </executions>
+                                       </plugin>
+                                       <plugin>
+                                               <artifactId>maven-antrun-plugin</artifactId>
+                                               <executions>
+                                                       <execution>
+                                                               <phase>install</phase>
+                                                               <goals>
+                                                                       <goal>run</goal>
+                                                               </goals>
+                                                               <configuration>
+                                                                       <target>
+                                                                               <copy todir="${rpm.stagingRepository}" verbose="true">
+                                                                                       <fileset dir="${project.build.directory}/rpm" includes="*/RPMS/**/*.rpm" />
+                                                                                       <flattenmapper />
+                                                                               </copy>
+                                                                       </target>
+                                                               </configuration>
+                                                       </execution>
+                                               </executions>
+                                       </plugin>
+                               </plugins>
+                       </build>
+               </profile>
+               <profile>
+                       <id>rpmbuild-tp</id>
+                       <build>
+                               <plugins>
+                                       <plugin>
+                                               <groupId>org.codehaus.mojo</groupId>
+                                               <artifactId>rpm-maven-plugin</artifactId>
+                                               <executions>
+                                                       <execution>
+                                                               <id>rpm-osgi-boot-equinox</id>
+                                                               <phase>package</phase>
+                                                               <goals>
+                                                                       <goal>rpm</goal>
+                                                               </goals>
+                                                               <configuration>
+                                                                       <name>osgi-boot-equinox</name>
+                                                                       <projversion>${version.argeo-distribution}</projversion>
+                                                                       <mappings>
+                                                                               <mapping>
+                                                                                       <directory>/usr/share/osgi/boot</directory>
+                                                                                       <username>root</username>
+                                                                                       <groupname>root</groupname>
+                                                                                       <filemode>644</filemode>
+                                                                                       <directoryIncluded>false</directoryIncluded>
+                                                                                       <sources>
+                                                                                               <source>
+                                                                                                       <location>${project.build.directory}/lib</location>
+                                                                                                       <includes>
+                                                                                                               <include>org.eclipse.osgi.jar</include>
+                                                                                                       </includes>
+                                                                                               </source>
+                                                                                       </sources>
+                                                                               </mapping>
+                                                                       </mappings>
+                                                               </configuration>
+                                                       </execution>
+                                               </executions>
+                                       </plugin>
+                               </plugins>
+                       </build>
+               </profile>
+       </profiles>
+</project>
diff --git a/base/dist/osgi-boot/src/main/rpm/etc/osgiboot/osgi-service-init-functions.sh b/base/dist/osgi-boot/src/main/rpm/etc/osgiboot/osgi-service-init-functions.sh
new file mode 100644 (file)
index 0000000..35bf970
--- /dev/null
@@ -0,0 +1,59 @@
+#!/bin/bash
+
+# Source function library.
+. /etc/rc.d/init.d/functions
+
+RETVAL=0
+
+osgi_service_start() {
+       APP=$1
+       # create log an run directories writable by the application user
+       USER=$APP
+       GROUP=$APP
+       RUN_DIR=/var/run/$APP
+       LOG_DIR=/var/log/$APP
+       if [ ! -d $LOG_DIR ];then
+               mkdir -m 0750 $LOG_DIR
+               chown -R $USER.$GROUP $LOG_DIR
+       fi
+       if [ ! -d $RUN_DIR ];then
+               mkdir -m 0750 $RUN_DIR
+               chown -R $USER.$GROUP $RUN_DIR
+       fi
+       
+       # call Argeo Commons OSGi utilities as the application user
+       daemon --user $USER /usr/sbin/osgi-service $APP start
+       
+       RETVAL=$?
+       #action $"Start $APP" /bin/true
+       if [ $RETVAL -eq 0 ];then
+               PID=`cat $RUN_DIR/$APP.pid`
+               action $"Started $APP with pid $PID" /bin/true
+       else
+               action $"Could not start $APP" /bin/false
+       fi
+       return $RETVAL
+}
+
+osgi_service_stop() {
+       APP=$1
+       USER=$APP
+       # call Argeo Commons OSGi utilities as the application user
+       runuser -s /bin/bash $USER -c "/usr/sbin/osgi-service $APP stop"
+       RETVAL=$?
+       if [ $RETVAL -eq 0 ];then
+               action $"Stopped $APP" /bin/true
+       else
+               action $"Could not stop $APP" /bin/false
+       fi
+       return $RETVAL
+}
+
+osgi_service_status() {
+       APP=$1
+       USER=$APP
+       # call Argeo Commons OSGi utilities as the application user
+       runuser -s /bin/bash $USER -c "/usr/sbin/osgi-service $APP status"
+       RETVAL=$?
+       return $RETVAL
+}
diff --git a/base/dist/osgi-boot/src/main/rpm/etc/osgiboot/osgi-service-settings.sh b/base/dist/osgi-boot/src/main/rpm/etc/osgiboot/osgi-service-settings.sh
new file mode 100644 (file)
index 0000000..f5504f8
--- /dev/null
@@ -0,0 +1 @@
+#JAVA_OPTS=-Xmx256m
\ No newline at end of file
diff --git a/base/dist/osgi-boot/src/main/rpm/usr/sbin/osgi-service b/base/dist/osgi-boot/src/main/rpm/usr/sbin/osgi-service
new file mode 100644 (file)
index 0000000..5c37f9c
--- /dev/null
@@ -0,0 +1,153 @@
+#!/bin/sh
+
+JVM=java
+. /etc/osgiboot/osgi-service-settings.sh
+
+APP=$1
+
+CONF_DIR=/etc/$APP
+if [ -f $CONF_DIR/settings.sh ];then
+       . $CONF_DIR/settings.sh
+fi
+
+LIB_DIR=/usr/share/$APP/lib
+
+# read/write
+EXEC_DIR=/var/lib/$APP
+DATA_DIR=$EXEC_DIR/data
+CONF_RW=$EXEC_DIR/conf
+
+LOG_DIR=/var/log/$APP
+LOG_FILE=$LOG_DIR/$APP.log
+
+RUN_DIR=/var/run/$APP
+PID_FILE=$RUN_DIR/$APP.pid
+SHUTDOWN_FILE=$RUN_DIR/$APP.shutdown
+
+OSGI_INSTALL_AREA=/usr/share/osgi/boot
+OSGI_FRAMEWORK=$OSGI_INSTALL_AREA/org.eclipse.osgi.jar
+
+RETVAL=0
+
+start() {
+       if [ -f $PID_FILE ];then
+               PID=`cat $PID_FILE`
+               kill -0 $PID &> /dev/null
+               PID_EXISTS=$?
+               if [ $PID_EXISTS -eq 0 ]; then
+                       echo $APP already running with pid $PID
+                       RETVAL=1
+                       return $RETVAL
+               else
+                       echo Old $APP process with pid $PID is dead, removing $PID_FILE
+                       rm -f $PID_FILE
+               fi
+       fi
+
+       cp --preserve $CONF_DIR/config.ini $CONF_RW/config.ini
+       touch $SHUTDOWN_FILE
+       cd $EXEC_DIR
+       $JVM \
+               -Dargeo.osgi.shutdownFile="$SHUTDOWN_FILE" \
+               -Dlog4j.configuration="file:$CONF_DIR/log4j.properties" \
+               $JAVA_OPTS -jar $OSGI_FRAMEWORK \
+               -clean \
+               -configuration "$CONF_RW" \
+               -data "$DATA_DIR" \
+               >> $LOG_FILE 2>&1 &
+       # (above) stderr redirected to stdout, then stdout to log file
+       # see http://tldp.org/LDP/abs/html/io-redirection.html
+       PID=$!
+       echo $PID > $PID_FILE
+       #echo Started $APP with pid $PID
+       return $RETVAL
+}
+
+stop() {
+       if [ -f $PID_FILE ];then
+               PID=`cat $PID_FILE`
+               kill -0 $PID &> /dev/null
+               PID_EXISTS=$?
+               if [ $PID_EXISTS -ne 0 ]; then
+                       echo Dead $APP process with pid $PID, removing $PID_FILE
+                       rm -f $PID_FILE
+                       RETVAL=1
+                       return $RETVAL
+               fi
+       else
+               echo $APP is not running
+               RETVAL=1
+               return $RETVAL
+       fi
+       
+       # notifies application by removing the shutdown file
+       rm -f $SHUTDOWN_FILE
+       
+       # wait 5 min for application to shutdown, then kill it
+       TIMEOUT=$((5*60))
+       BEGIN=$(date +%s)
+       while kill -0 $PID &> /dev/null
+       do
+               sleep 1
+               NOW=$(date +%s)
+               DURATION=$(($NOW-$BEGIN))
+               if [ $DURATION -gt $TIMEOUT ]; then
+                       kill -9 $PID
+                       echo Forcibly killed $APP with pid $PID
+                       RETVAL=1
+               fi
+       done
+       
+       # remove pid file
+       rm -f $PID_FILE
+       return $RETVAL
+
+# timeout is only available in EL6
+#      timeout 5m sh << EOF
+#while kill -0 $PID &> /dev/null; do sleep 1; done
+#EOF
+#      TIMEOUT_EXIT=$?
+#      if [ $TIMEOUT_EXIT -eq 124 ];then
+#              kill -9 $PID
+#              RETVAL=1
+#              echo Killed $APP with pid $PID
+#      else
+#              echo Stopped $APP with pid $PID
+#      fi
+#      rm -f $PID_FILE
+#      return $RETVAL
+}
+
+status() {
+       if [ -f $PID_FILE ];then
+               PID=`cat $PID_FILE`
+       else
+               echo $APP is not running
+               return $RETVAL
+       fi
+       kill -0 $PID &> /dev/null
+       PID_EXISTS=$?
+       if [ $PID_EXISTS -eq 0 ]; then
+               echo $APP is running with pid $PID ...
+       else
+               echo No $APP process with pid $PID, removing $PID_FILE
+               rm -f $PID_FILE
+       fi
+       return $RETVAL
+}
+
+# main
+case "$2" in
+  start)
+        start
+        ;;
+  stop)
+        stop
+        ;;
+  status)
+       status
+        ;;
+  *)
+        echo $"Usage: $0 {start|stop|status}"
+        exit 1
+esac
\ No newline at end of file
diff --git a/base/dist/pom.xml b/base/dist/pom.xml
new file mode 100644 (file)
index 0000000..48b81a2
--- /dev/null
@@ -0,0 +1,17 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+       <modelVersion>4.0.0</modelVersion>
+       <parent>
+               <groupId>org.argeo.commons</groupId>
+               <version>1.1.4-SNAPSHOT</version>
+               <artifactId>osgi</artifactId>
+               <relativePath>..</relativePath>
+       </parent>
+       <groupId>org.argeo.commons.osgi</groupId>
+       <artifactId>dist</artifactId>
+       <name>Commons OSGi Distributions</name>
+       <packaging>pom</packaging>
+       <modules>
+               <module>osgi-boot</module>
+       </modules>
+</project>
\ No newline at end of file
diff --git a/osgi/dist/osgi-boot/pom.xml b/osgi/dist/osgi-boot/pom.xml
deleted file mode 100644 (file)
index 069c8ba..0000000
+++ /dev/null
@@ -1,189 +0,0 @@
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
-       <modelVersion>4.0.0</modelVersion>
-       <parent>
-               <groupId>org.argeo.commons.osgi</groupId>
-               <version>1.1.4-SNAPSHOT</version>
-               <artifactId>dist</artifactId>
-               <relativePath>..</relativePath>
-       </parent>
-       <artifactId>osgi-boot</artifactId>
-       <packaging>pom</packaging>
-       <name>Commons OSGi Boot Distribution</name>
-       <build>
-               <plugins>
-                       <plugin>
-                               <groupId>org.apache.maven.plugins</groupId>
-                               <artifactId>maven-dependency-plugin</artifactId>
-                               <executions>
-                                       <execution>
-                                               <id>copy-dependencies</id>
-                                               <phase>package</phase>
-                                               <goals>
-                                                       <goal>copy-dependencies</goal>
-                                               </goals>
-                                               <configuration>
-                                                       <includeTypes>jar</includeTypes>
-                                                       <stripVersion>true</stripVersion>
-                                                       <outputDirectory>${project.build.directory}/lib</outputDirectory>
-                                               </configuration>
-                                       </execution>
-                               </executions>
-                       </plugin>
-               </plugins>
-       </build>
-       <dependencies>
-               <dependency>
-                       <groupId>org.argeo.commons.osgi</groupId>
-                       <artifactId>org.argeo.osgi.boot</artifactId>
-                       <version>1.1.4-SNAPSHOT</version>
-               </dependency>
-       </dependencies>
-       <profiles>
-               <profile>
-                       <id>rpmbuild</id>
-                       <build>
-                               <plugins>
-                                       <plugin>
-                                               <groupId>org.codehaus.mojo</groupId>
-                                               <artifactId>rpm-maven-plugin</artifactId>
-                                               <executions>
-                                                       <execution>
-                                                               <id>rpm-osgi-boot</id>
-                                                               <phase>package</phase>
-                                                               <goals>
-                                                                       <goal>rpm</goal>
-                                                               </goals>
-                                                               <configuration>
-                                                                       <name>osgi-boot</name>
-                                                                       <copyright>2011 Argeo</copyright>
-                                                                       <mappings>
-                                                                               <mapping>
-                                                                                       <directory>/etc/osgiboot</directory>
-                                                                                       <username>root</username>
-                                                                                       <groupname>root</groupname>
-                                                                                       <filemode>644</filemode>
-                                                                                       <configuration>noreplace</configuration>
-                                                                                       <directoryIncluded>false</directoryIncluded>
-                                                                                       <sources>
-                                                                                               <source>
-                                                                                                       <location>src/main/rpm/etc/osgiboot</location>
-                                                                                                       <includes>
-                                                                                                               <include>*-settings.sh</include>
-                                                                                                       </includes>
-                                                                                               </source>
-                                                                                       </sources>
-                                                                               </mapping>
-                                                                               <mapping>
-                                                                                       <directory>/etc/osgiboot</directory>
-                                                                                       <username>root</username>
-                                                                                       <groupname>root</groupname>
-                                                                                       <filemode>644</filemode>
-                                                                                       <directoryIncluded>false</directoryIncluded>
-                                                                                       <sources>
-                                                                                               <source>
-                                                                                                       <location>src/main/rpm/etc/osgiboot</location>
-                                                                                                       <includes>
-                                                                                                               <include>*-functions.sh</include>
-                                                                                                       </includes>
-                                                                                               </source>
-                                                                                       </sources>
-                                                                               </mapping>
-                                                                               <mapping>
-                                                                                       <directory>/usr/sbin</directory>
-                                                                                       <username>root</username>
-                                                                                       <groupname>root</groupname>
-                                                                                       <filemode>755</filemode>
-                                                                                       <sources>
-                                                                                               <source>
-                                                                                                       <location>src/main/rpm/usr/sbin</location>
-                                                                                               </source>
-                                                                                       </sources>
-                                                                               </mapping>
-                                                                               <mapping>
-                                                                                       <directory>/usr/share/osgi/boot</directory>
-                                                                                       <username>root</username>
-                                                                                       <groupname>root</groupname>
-                                                                                       <filemode>644</filemode>
-                                                                                       <directoryIncluded>false</directoryIncluded>
-                                                                                       <sources>
-                                                                                               <source>
-                                                                                                       <location>${project.build.directory}/lib</location>
-                                                                                                       <includes>
-                                                                                                               <include>org.argeo.osgi.boot.jar</include>
-                                                                                                       </includes>
-                                                                                               </source>
-                                                                                       </sources>
-                                                                               </mapping>
-                                                                       </mappings>
-                                                                       <requires>
-                                                                               <require>osgi-boot-equinox</require>
-                                                                       </requires>
-                                                               </configuration>
-                                                       </execution>
-                                               </executions>
-                                       </plugin>
-                                       <plugin>
-                                               <artifactId>maven-antrun-plugin</artifactId>
-                                               <executions>
-                                                       <execution>
-                                                               <phase>install</phase>
-                                                               <goals>
-                                                                       <goal>run</goal>
-                                                               </goals>
-                                                               <configuration>
-                                                                       <target>
-                                                                               <copy todir="${rpm.stagingRepository}" verbose="true">
-                                                                                       <fileset dir="${project.build.directory}/rpm" includes="*/RPMS/**/*.rpm" />
-                                                                                       <flattenmapper />
-                                                                               </copy>
-                                                                       </target>
-                                                               </configuration>
-                                                       </execution>
-                                               </executions>
-                                       </plugin>
-                               </plugins>
-                       </build>
-               </profile>
-               <profile>
-                       <id>rpmbuild-tp</id>
-                       <build>
-                               <plugins>
-                                       <plugin>
-                                               <groupId>org.codehaus.mojo</groupId>
-                                               <artifactId>rpm-maven-plugin</artifactId>
-                                               <executions>
-                                                       <execution>
-                                                               <id>rpm-osgi-boot-equinox</id>
-                                                               <phase>package</phase>
-                                                               <goals>
-                                                                       <goal>rpm</goal>
-                                                               </goals>
-                                                               <configuration>
-                                                                       <name>osgi-boot-equinox</name>
-                                                                       <projversion>${version.argeo-distribution}</projversion>
-                                                                       <mappings>
-                                                                               <mapping>
-                                                                                       <directory>/usr/share/osgi/boot</directory>
-                                                                                       <username>root</username>
-                                                                                       <groupname>root</groupname>
-                                                                                       <filemode>644</filemode>
-                                                                                       <directoryIncluded>false</directoryIncluded>
-                                                                                       <sources>
-                                                                                               <source>
-                                                                                                       <location>${project.build.directory}/lib</location>
-                                                                                                       <includes>
-                                                                                                               <include>org.eclipse.osgi.jar</include>
-                                                                                                       </includes>
-                                                                                               </source>
-                                                                                       </sources>
-                                                                               </mapping>
-                                                                       </mappings>
-                                                               </configuration>
-                                                       </execution>
-                                               </executions>
-                                       </plugin>
-                               </plugins>
-                       </build>
-               </profile>
-       </profiles>
-</project>
diff --git a/osgi/dist/osgi-boot/src/main/rpm/etc/osgiboot/osgi-service-init-functions.sh b/osgi/dist/osgi-boot/src/main/rpm/etc/osgiboot/osgi-service-init-functions.sh
deleted file mode 100644 (file)
index 35bf970..0000000
+++ /dev/null
@@ -1,59 +0,0 @@
-#!/bin/bash
-
-# Source function library.
-. /etc/rc.d/init.d/functions
-
-RETVAL=0
-
-osgi_service_start() {
-       APP=$1
-       # create log an run directories writable by the application user
-       USER=$APP
-       GROUP=$APP
-       RUN_DIR=/var/run/$APP
-       LOG_DIR=/var/log/$APP
-       if [ ! -d $LOG_DIR ];then
-               mkdir -m 0750 $LOG_DIR
-               chown -R $USER.$GROUP $LOG_DIR
-       fi
-       if [ ! -d $RUN_DIR ];then
-               mkdir -m 0750 $RUN_DIR
-               chown -R $USER.$GROUP $RUN_DIR
-       fi
-       
-       # call Argeo Commons OSGi utilities as the application user
-       daemon --user $USER /usr/sbin/osgi-service $APP start
-       
-       RETVAL=$?
-       #action $"Start $APP" /bin/true
-       if [ $RETVAL -eq 0 ];then
-               PID=`cat $RUN_DIR/$APP.pid`
-               action $"Started $APP with pid $PID" /bin/true
-       else
-               action $"Could not start $APP" /bin/false
-       fi
-       return $RETVAL
-}
-
-osgi_service_stop() {
-       APP=$1
-       USER=$APP
-       # call Argeo Commons OSGi utilities as the application user
-       runuser -s /bin/bash $USER -c "/usr/sbin/osgi-service $APP stop"
-       RETVAL=$?
-       if [ $RETVAL -eq 0 ];then
-               action $"Stopped $APP" /bin/true
-       else
-               action $"Could not stop $APP" /bin/false
-       fi
-       return $RETVAL
-}
-
-osgi_service_status() {
-       APP=$1
-       USER=$APP
-       # call Argeo Commons OSGi utilities as the application user
-       runuser -s /bin/bash $USER -c "/usr/sbin/osgi-service $APP status"
-       RETVAL=$?
-       return $RETVAL
-}
diff --git a/osgi/dist/osgi-boot/src/main/rpm/etc/osgiboot/osgi-service-settings.sh b/osgi/dist/osgi-boot/src/main/rpm/etc/osgiboot/osgi-service-settings.sh
deleted file mode 100644 (file)
index f5504f8..0000000
+++ /dev/null
@@ -1 +0,0 @@
-#JAVA_OPTS=-Xmx256m
\ No newline at end of file
diff --git a/osgi/dist/osgi-boot/src/main/rpm/usr/sbin/osgi-service b/osgi/dist/osgi-boot/src/main/rpm/usr/sbin/osgi-service
deleted file mode 100644 (file)
index 5c37f9c..0000000
+++ /dev/null
@@ -1,153 +0,0 @@
-#!/bin/sh
-
-JVM=java
-. /etc/osgiboot/osgi-service-settings.sh
-
-APP=$1
-
-CONF_DIR=/etc/$APP
-if [ -f $CONF_DIR/settings.sh ];then
-       . $CONF_DIR/settings.sh
-fi
-
-LIB_DIR=/usr/share/$APP/lib
-
-# read/write
-EXEC_DIR=/var/lib/$APP
-DATA_DIR=$EXEC_DIR/data
-CONF_RW=$EXEC_DIR/conf
-
-LOG_DIR=/var/log/$APP
-LOG_FILE=$LOG_DIR/$APP.log
-
-RUN_DIR=/var/run/$APP
-PID_FILE=$RUN_DIR/$APP.pid
-SHUTDOWN_FILE=$RUN_DIR/$APP.shutdown
-
-OSGI_INSTALL_AREA=/usr/share/osgi/boot
-OSGI_FRAMEWORK=$OSGI_INSTALL_AREA/org.eclipse.osgi.jar
-
-RETVAL=0
-
-start() {
-       if [ -f $PID_FILE ];then
-               PID=`cat $PID_FILE`
-               kill -0 $PID &> /dev/null
-               PID_EXISTS=$?
-               if [ $PID_EXISTS -eq 0 ]; then
-                       echo $APP already running with pid $PID
-                       RETVAL=1
-                       return $RETVAL
-               else
-                       echo Old $APP process with pid $PID is dead, removing $PID_FILE
-                       rm -f $PID_FILE
-               fi
-       fi
-
-       cp --preserve $CONF_DIR/config.ini $CONF_RW/config.ini
-       touch $SHUTDOWN_FILE
-       cd $EXEC_DIR
-       $JVM \
-               -Dargeo.osgi.shutdownFile="$SHUTDOWN_FILE" \
-               -Dlog4j.configuration="file:$CONF_DIR/log4j.properties" \
-               $JAVA_OPTS -jar $OSGI_FRAMEWORK \
-               -clean \
-               -configuration "$CONF_RW" \
-               -data "$DATA_DIR" \
-               >> $LOG_FILE 2>&1 &
-       # (above) stderr redirected to stdout, then stdout to log file
-       # see http://tldp.org/LDP/abs/html/io-redirection.html
-       PID=$!
-       echo $PID > $PID_FILE
-       #echo Started $APP with pid $PID
-       return $RETVAL
-}
-
-stop() {
-       if [ -f $PID_FILE ];then
-               PID=`cat $PID_FILE`
-               kill -0 $PID &> /dev/null
-               PID_EXISTS=$?
-               if [ $PID_EXISTS -ne 0 ]; then
-                       echo Dead $APP process with pid $PID, removing $PID_FILE
-                       rm -f $PID_FILE
-                       RETVAL=1
-                       return $RETVAL
-               fi
-       else
-               echo $APP is not running
-               RETVAL=1
-               return $RETVAL
-       fi
-       
-       # notifies application by removing the shutdown file
-       rm -f $SHUTDOWN_FILE
-       
-       # wait 5 min for application to shutdown, then kill it
-       TIMEOUT=$((5*60))
-       BEGIN=$(date +%s)
-       while kill -0 $PID &> /dev/null
-       do
-               sleep 1
-               NOW=$(date +%s)
-               DURATION=$(($NOW-$BEGIN))
-               if [ $DURATION -gt $TIMEOUT ]; then
-                       kill -9 $PID
-                       echo Forcibly killed $APP with pid $PID
-                       RETVAL=1
-               fi
-       done
-       
-       # remove pid file
-       rm -f $PID_FILE
-       return $RETVAL
-
-# timeout is only available in EL6
-#      timeout 5m sh << EOF
-#while kill -0 $PID &> /dev/null; do sleep 1; done
-#EOF
-#      TIMEOUT_EXIT=$?
-#      if [ $TIMEOUT_EXIT -eq 124 ];then
-#              kill -9 $PID
-#              RETVAL=1
-#              echo Killed $APP with pid $PID
-#      else
-#              echo Stopped $APP with pid $PID
-#      fi
-#      rm -f $PID_FILE
-#      return $RETVAL
-}
-
-status() {
-       if [ -f $PID_FILE ];then
-               PID=`cat $PID_FILE`
-       else
-               echo $APP is not running
-               return $RETVAL
-       fi
-       kill -0 $PID &> /dev/null
-       PID_EXISTS=$?
-       if [ $PID_EXISTS -eq 0 ]; then
-               echo $APP is running with pid $PID ...
-       else
-               echo No $APP process with pid $PID, removing $PID_FILE
-               rm -f $PID_FILE
-       fi
-       return $RETVAL
-}
-
-# main
-case "$2" in
-  start)
-        start
-        ;;
-  stop)
-        stop
-        ;;
-  status)
-       status
-        ;;
-  *)
-        echo $"Usage: $0 {start|stop|status}"
-        exit 1
-esac
\ No newline at end of file
diff --git a/osgi/dist/pom.xml b/osgi/dist/pom.xml
deleted file mode 100644 (file)
index 48b81a2..0000000
+++ /dev/null
@@ -1,17 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
-       <modelVersion>4.0.0</modelVersion>
-       <parent>
-               <groupId>org.argeo.commons</groupId>
-               <version>1.1.4-SNAPSHOT</version>
-               <artifactId>osgi</artifactId>
-               <relativePath>..</relativePath>
-       </parent>
-       <groupId>org.argeo.commons.osgi</groupId>
-       <artifactId>dist</artifactId>
-       <name>Commons OSGi Distributions</name>
-       <packaging>pom</packaging>
-       <modules>
-               <module>osgi-boot</module>
-       </modules>
-</project>
\ No newline at end of file