[jboss-cvs] JBossAS SVN: r88123 - in projects/jboss-osgi/trunk: build/distribution/runtime and 10 other directories.

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Sun May 3 07:43:20 EDT 2009


Author: thomas.diesler at jboss.com
Date: 2009-05-03 07:43:20 -0400 (Sun, 03 May 2009)
New Revision: 88123

Added:
   projects/jboss-osgi/trunk/build/distribution/runtime/
   projects/jboss-osgi/trunk/build/distribution/runtime/bin/
   projects/jboss-osgi/trunk/build/distribution/runtime/bin/run.conf
   projects/jboss-osgi/trunk/build/distribution/runtime/bin/run.sh
   projects/jboss-osgi/trunk/build/distribution/runtime/conf/
   projects/jboss-osgi/trunk/build/distribution/runtime/conf/jboss-osgi-framework.properties
   projects/jboss-osgi/trunk/build/distribution/runtime/conf/log4j.xml
   projects/jboss-osgi/trunk/build/distribution/runtime/conf/org.jboss.osgi.spi.framework.OSGiBootstrapProvider
   projects/jboss-osgi/trunk/bundle/jmx/src/main/java/org/jboss/osgi/jmx/internal/
   projects/jboss-osgi/trunk/bundle/jmx/src/main/java/org/jboss/osgi/jmx/internal/JMXConnectorService.java
   projects/jboss-osgi/trunk/bundle/jmx/src/main/java/org/jboss/osgi/jmx/internal/MBeanServerService.java
Modified:
   projects/jboss-osgi/trunk/build/distribution/pom.xml
   projects/jboss-osgi/trunk/build/distribution/scripts/antrun-installer.xml
   projects/jboss-osgi/trunk/build/distribution/scripts/assembly-deploy-artifacts.xml
   projects/jboss-osgi/trunk/build/distribution/src/main/resources/installer/install-definition.xml
   projects/jboss-osgi/trunk/bundle/blueprint/src/test/java/org/jboss/test/osgi/blueprint/mcservice/MicrocontainerServiceTestCase.java
   projects/jboss-osgi/trunk/bundle/jmx/pom.xml
   projects/jboss-osgi/trunk/bundle/jmx/src/main/java/org/jboss/osgi/jmx/ServiceActivator.java
   projects/jboss-osgi/trunk/bundle/pom.xml
   projects/jboss-osgi/trunk/spi/src/main/java/org/jboss/osgi/spi/framework/OSGiBootstrap.java
   projects/jboss-osgi/trunk/spi/src/main/java/org/jboss/osgi/spi/framework/PropertiesBootstrapProvider.java
Log:
Add experimental runtime

Modified: projects/jboss-osgi/trunk/build/distribution/pom.xml
===================================================================
--- projects/jboss-osgi/trunk/build/distribution/pom.xml	2009-05-02 13:19:21 UTC (rev 88122)
+++ projects/jboss-osgi/trunk/build/distribution/pom.xml	2009-05-03 11:43:20 UTC (rev 88123)
@@ -34,28 +34,6 @@
   <!-- Dependencies -->
   <dependencies>
     <dependency>
-      <groupId>org.jboss.osgi.bundles</groupId>
-      <artifactId>jboss-osgi-common</artifactId>
-      <version>${version}</version>
-    </dependency>
-    <dependency>
-      <groupId>org.jboss.osgi.bundles</groupId>
-      <artifactId>jboss-osgi-common</artifactId>
-      <classifier>sources</classifier>
-      <version>${version}</version>
-    </dependency>
-    <dependency>
-      <groupId>org.jboss.osgi.bundles</groupId>
-      <artifactId>jboss-osgi-logging</artifactId>
-      <version>${version}</version>
-    </dependency>
-    <dependency>
-      <groupId>org.jboss.osgi.bundles</groupId>
-      <artifactId>jboss-osgi-logging</artifactId>
-      <classifier>sources</classifier>
-      <version>${version}</version>
-    </dependency>
-    <dependency>
       <groupId>org.jboss.osgi</groupId>
       <artifactId>jboss-osgi-runtime-deployer</artifactId>
       <version>${version}</version>
@@ -95,15 +73,47 @@
       <version>${version}</version>
       <type>jdocbook</type>
     </dependency>
+    
+    <!-- Bundles -->
     <dependency>
       <groupId>org.jboss.osgi.bundles</groupId>
-      <artifactId>jboss-osgi-webconsole</artifactId>
+      <artifactId>apache-xerces-bundle</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>org.jboss.osgi.bundles</groupId>
+      <artifactId>jboss-common-core-bundle</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>org.jboss.osgi.bundles</groupId>
+      <artifactId>jaxb-bundle</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>org.jboss.osgi.bundles</groupId>
+      <artifactId>jbossxb-bundle</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>org.jboss.osgi.bundles</groupId>
+      <artifactId>jboss-osgi-common</artifactId>
       <version>${version}</version>
     </dependency>
     <dependency>
       <groupId>org.jboss.osgi.bundles</groupId>
+      <artifactId>jboss-osgi-jmx</artifactId>
+      <version>${version}</version>
+    </dependency>
+    <dependency>
+      <groupId>org.jboss.osgi.bundles</groupId>
+      <artifactId>jboss-osgi-logging</artifactId>
+      <version>${version}</version>
+    </dependency>
+    <dependency>
+      <groupId>org.jboss.osgi.bundles</groupId>
+      <artifactId>jboss-osgi-microcontainer</artifactId>
+      <version>${version}</version>
+    </dependency>
+    <dependency>
+      <groupId>org.jboss.osgi.bundles</groupId>
       <artifactId>jboss-osgi-webconsole</artifactId>
-      <classifier>sources</classifier>
       <version>${version}</version>
     </dependency>
 
@@ -159,18 +169,22 @@
     <dependency>
       <groupId>org.apache.felix</groupId>
       <artifactId>org.apache.felix.configadmin</artifactId>
+      <scope>provided</scope>
     </dependency>
     <dependency>
       <groupId>org.apache.felix</groupId>
       <artifactId>org.apache.felix.http.jetty</artifactId>
+      <scope>provided</scope>
     </dependency>
     <dependency>
       <groupId>org.apache.felix</groupId>
       <artifactId>org.apache.felix.log</artifactId>
+      <scope>provided</scope>
     </dependency>
     <dependency>
       <groupId>org.apache.felix</groupId>
       <artifactId>org.apache.felix.metatype</artifactId>
+      <scope>provided</scope>
     </dependency>
     
     <!-- Knopflerfish Dependencies -->

Added: projects/jboss-osgi/trunk/build/distribution/runtime/bin/run.conf
===================================================================
--- projects/jboss-osgi/trunk/build/distribution/runtime/bin/run.conf	                        (rev 0)
+++ projects/jboss-osgi/trunk/build/distribution/runtime/bin/run.conf	2009-05-03 11:43:20 UTC (rev 88123)
@@ -0,0 +1,35 @@
+## -*- shell-script -*- ######################################################
+##                                                                          ##
+##  JBossOSGi Bootstrap Script Configuration                                ##
+##                                                                          ##
+##############################################################################
+
+### $Id: run.conf 76910 2008-08-11 07:33:40Z jesper.pedersen $
+
+#
+# This file is optional; it may be removed if not needed.
+#
+
+#
+# Specify the location of the Java home directory.  If set then $JAVA will
+# be defined to $JAVA_HOME/bin/java, else $JAVA will be "java".
+#
+#JAVA_HOME="/opt/java/jdk"
+
+#
+# Specify the exact Java VM executable to use.
+#
+#JAVA=""
+
+#
+# Specify options to pass to the Java VM.
+#
+if [ "x$JAVA_OPTS" = "x" ]; then
+   JAVA_OPTS="-Xms128m -Xmx512m -XX:MaxPermSize=256m -Dsun.rmi.dgc.client.gcInterval=3600000 -Dsun.rmi.dgc.server.gcInterval=3600000"
+fi
+
+# Sample JPDA settings for remote socket debuging
+JAVA_OPTS="$JAVA_OPTS -Xrunjdwp:transport=dt_socket,address=8787,server=y,suspend=n"
+
+# Sample JPDA settings for shared memory debugging 
+#JAVA_OPTS="$JAVA_OPTS -Xrunjdwp:transport=dt_shmem,server=y,suspend=n,address=jboss"

Added: projects/jboss-osgi/trunk/build/distribution/runtime/bin/run.sh
===================================================================
--- projects/jboss-osgi/trunk/build/distribution/runtime/bin/run.sh	                        (rev 0)
+++ projects/jboss-osgi/trunk/build/distribution/runtime/bin/run.sh	2009-05-03 11:43:20 UTC (rev 88123)
@@ -0,0 +1,146 @@
+#!/bin/sh
+### ====================================================================== ###
+##                                                                          ##
+##  JBossOSGi Bootstrap Script                                              ##
+##                                                                          ##
+### ====================================================================== ###
+
+### $Id$ ###
+
+DIRNAME=`dirname $0`
+PROGNAME=`basename $0`
+GREP="grep"
+
+#
+# Helper to complain.
+#
+warn() {
+    echo "${PROGNAME}: $*"
+}
+
+#
+# Helper to puke.
+#
+die() {
+    warn $*
+    exit 1
+}
+
+# OS specific support (must be 'true' or 'false').
+cygwin=false;
+darwin=false;
+linux=false;
+case "`uname`" in
+    CYGWIN*)
+        cygwin=true
+        ;;
+
+    Darwin*)
+        darwin=true
+        ;;
+        
+    Linux)
+        linux=true
+        ;;
+esac
+
+# Read an optional running configuration file
+if [ "x$RUN_CONF" = "x" ]; then
+    RUN_CONF="$DIRNAME/run.conf"
+fi
+if [ -r "$RUN_CONF" ]; then
+    . "$RUN_CONF"
+fi
+
+# Force IPv4 on Linux systems since IPv6 doesn't work correctly with jdk5 and lower
+if [ "$linux" = "true" ]; then
+   JAVA_OPTS="$JAVA_OPTS -Djava.net.preferIPv4Stack=true"
+fi
+
+# For Cygwin, ensure paths are in UNIX format before anything is touched
+if $cygwin ; then
+    [ -n "$JAVA_HOME" ] &&
+        JAVA_HOME=`cygpath --unix "$JAVA_HOME"`
+fi
+
+# Setup OSGI_HOME
+if [ "x$OSGI_HOME" = "x" ]; then
+    # get the full path (without any relative bits)
+    OSGI_HOME=`cd $DIRNAME/..; pwd`
+fi
+export OSGI_HOME
+
+# Setup the JVM
+if [ "x$JAVA" = "x" ]; then
+    if [ "x$JAVA_HOME" != "x" ]; then
+	JAVA="$JAVA_HOME/bin/java"
+    else
+	JAVA="java"
+    fi
+fi
+
+# Setup the classpath
+spijar="$OSGI_HOME/lib/jboss-osgi-spi.jar"
+if [ ! -f "$spijar" ]; then
+    die "Missing required file: $spijar"
+fi
+OSGI_BOOT_CLASSPATH="$OSGI_HOME/conf"
+for file in $OSGI_HOME/lib/*; do
+    OSGI_BOOT_CLASSPATH="$OSGI_BOOT_CLASSPATH:${file}"
+done
+
+if [ "x$OSGI_CLASSPATH" = "x" ]; then
+    OSGI_CLASSPATH="$OSGI_BOOT_CLASSPATH"
+else
+    OSGI_CLASSPATH="$OSGI_CLASSPATH:$OSGI_BOOT_CLASSPATH"
+fi
+
+# If -server not set in JAVA_OPTS, set it, if supported
+SERVER_SET=`echo $JAVA_OPTS | $GREP "\-server"`
+if [ "x$SERVER_SET" = "x" ]; then
+
+    # Check for SUN(tm) JVM w/ HotSpot support
+    if [ "x$HAS_HOTSPOT" = "x" ]; then
+	HAS_HOTSPOT=`"$JAVA" -version 2>&1 | $GREP -i HotSpot`
+    fi
+
+    # Enable -server if we have Hotspot, unless we can't
+    if [ "x$HAS_HOTSPOT" != "x" ]; then
+	# MacOS does not support -server flag
+	if [ "$darwin" != "true" ]; then
+	    JAVA_OPTS="-server $JAVA_OPTS"
+	fi
+    fi
+fi
+
+# Setup JBoss specific properties
+JAVA_OPTS="-Dprogram.name=$PROGNAME -Dosgi.home=$OSGI_HOME $JAVA_OPTS"
+
+# For Cygwin, switch paths to Windows format before running java
+if $cygwin; then
+    OSGI_HOME=`cygpath --path --windows "$OSGI_HOME"`
+    JAVA_HOME=`cygpath --path --windows "$JAVA_HOME"`
+    OSGI_CLASSPATH=`cygpath --path --windows "$OSGI_CLASSPATH"`
+fi
+
+# Display our environment
+echo "========================================================================="
+echo ""
+echo "  JBossOSGi Bootstrap Environment"
+echo ""
+echo "  OSGI_HOME: $OSGI_HOME"
+echo ""
+echo "  JAVA: $JAVA"
+echo ""
+echo "  JAVA_OPTS: $JAVA_OPTS"
+echo ""
+echo "  CLASSPATH: $OSGI_CLASSPATH"
+echo ""
+echo "========================================================================="
+echo ""
+
+# Execute the JVM in the foreground
+"$JAVA" $JAVA_OPTS \
+  -classpath "$OSGI_CLASSPATH" \
+  org.jboss.osgi.spi.framework.OSGiBootstrap "$@"
+OSGI_STATUS=$?


Property changes on: projects/jboss-osgi/trunk/build/distribution/runtime/bin/run.sh
___________________________________________________________________
Name: svn:keywords
   + Id Revision
Name: svn:eol-style
   + LF

Added: projects/jboss-osgi/trunk/build/distribution/runtime/conf/jboss-osgi-framework.properties
===================================================================
--- projects/jboss-osgi/trunk/build/distribution/runtime/conf/jboss-osgi-framework.properties	                        (rev 0)
+++ projects/jboss-osgi/trunk/build/distribution/runtime/conf/jboss-osgi-framework.properties	2009-05-03 11:43:20 UTC (rev 88123)
@@ -0,0 +1,39 @@
+#
+# Properties read by the org.jboss.osgi.spi.framework.PropertiesBootstrapProvider
+# 
+# $Id: $
+#
+
+# The OSGiFramework implementation 
+framework.impl=org.jboss.osgi.felix.framework.FelixIntegration
+
+# Properties to configure the Framework
+# All props start with 'framework.prop' 
+framework.prop.org.osgi.framework.storage.clean=onFirstInit
+framework.prop.org.osgi.framework.system.packages.extra=\
+	org.jboss.logging, \
+  	org.jboss.osgi.spi, \
+  	org.jboss.osgi.spi.management, \
+  	org.jboss.virtual, \
+  	org.jboss.virtual.plugins.registry, \
+  	org.jboss.virtual.plugins.context.jar, \
+  	org.jboss.virtual.plugins.vfs.helpers, \
+  	org.jboss.net.protocol, \
+  	org.jboss.virtual.protocol
+
+# Bundles that need to be installed with the Framework automatically 
+framework.autoInstall=\
+	file://${osgi.home}/bundles/org.osgi.compendium.jar
+
+# Bundles that need to be started automatically 
+framework.autoStart=\
+	file://${osgi.home}/bundles/org.apache.felix.log.jar \
+	file://${osgi.home}/bundles/apache-xerces-bundle.jar \
+	file://${osgi.home}/bundles/jboss-common-core-bundle.jar \
+	file://${osgi.home}/bundles/jaxb-bundle.jar \
+	file://${osgi.home}/bundles/jbossxb-bundle.jar \
+	file://${osgi.home}/bundles/jboss-osgi-common.jar \
+	file://${osgi.home}/bundles/jboss-osgi-logging.jar \
+	file://${osgi.home}/bundles/jboss-osgi-jmx.jar \
+	file://${osgi.home}/bundles/jboss-osgi-microcontainer.jar
+	
\ No newline at end of file

Added: projects/jboss-osgi/trunk/build/distribution/runtime/conf/log4j.xml
===================================================================
--- projects/jboss-osgi/trunk/build/distribution/runtime/conf/log4j.xml	                        (rev 0)
+++ projects/jboss-osgi/trunk/build/distribution/runtime/conf/log4j.xml	2009-05-03 11:43:20 UTC (rev 88123)
@@ -0,0 +1,49 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE log4j:configuration SYSTEM "log4j.dtd">
+
+<log4j:configuration xmlns:log4j="http://jakarta.apache.org/log4j/" debug="false">
+
+  <!-- ================================= -->
+  <!-- Preserve messages in a local file -->
+  <!-- ================================= -->
+
+  <appender name="FILE" class="org.apache.log4j.FileAppender">
+    <param name="File" value="${osgi.home}/log/test.log"/>
+    <param name="Append" value="false"/>
+    <layout class="org.apache.log4j.PatternLayout">
+      <!-- The default pattern: Date Priority [Category] Message\n -->
+      <param name="ConversionPattern" value="%d %-5p [%c] %m%n"/>
+    </layout>
+  </appender>
+  
+  <!-- ============================== -->
+  <!-- Append messages to the console -->
+  <!-- ============================== -->
+
+  <appender name="CONSOLE" class="org.apache.log4j.ConsoleAppender">
+    <param name="Target" value="System.out" />
+    <param name="Threshold" value="INFO" />
+    <layout class="org.apache.log4j.PatternLayout">
+      <param name="ConversionPattern" value="%d{HH:mm:ss,SSS} %-5p [%c{1}] %m%n" />
+    </layout>
+  </appender>
+
+  <!-- ================ -->
+  <!-- Limit categories -->
+  <!-- ================ -->
+
+  <!-- Show jboss deployer tracesraces --> 
+  <category name="org.jboss.deployers">
+    <priority value="TRACE" />
+  </category>
+
+  <!-- ======================= -->
+  <!-- Setup the Root category -->
+  <!-- ======================= -->
+
+  <root>
+    <appender-ref ref="CONSOLE"/>
+    <appender-ref ref="FILE"/>
+  </root>
+
+</log4j:configuration>


Property changes on: projects/jboss-osgi/trunk/build/distribution/runtime/conf/log4j.xml
___________________________________________________________________
Name: svn:keywords
   + Id Revision
Name: svn:eol-style
   + LF

Added: projects/jboss-osgi/trunk/build/distribution/runtime/conf/org.jboss.osgi.spi.framework.OSGiBootstrapProvider
===================================================================
--- projects/jboss-osgi/trunk/build/distribution/runtime/conf/org.jboss.osgi.spi.framework.OSGiBootstrapProvider	                        (rev 0)
+++ projects/jboss-osgi/trunk/build/distribution/runtime/conf/org.jboss.osgi.spi.framework.OSGiBootstrapProvider	2009-05-03 11:43:20 UTC (rev 88123)
@@ -0,0 +1 @@
+org.jboss.osgi.spi.framework.PropertiesBootstrapProvider
\ No newline at end of file

Modified: projects/jboss-osgi/trunk/build/distribution/scripts/antrun-installer.xml
===================================================================
--- projects/jboss-osgi/trunk/build/distribution/scripts/antrun-installer.xml	2009-05-02 13:19:21 UTC (rev 88122)
+++ projects/jboss-osgi/trunk/build/distribution/scripts/antrun-installer.xml	2009-05-03 11:43:20 UTC (rev 88123)
@@ -23,6 +23,7 @@
   <property name="deploy.artifacts.lib" value="${deploy.artifacts.dir}/lib" />
   <property name="deploy.artifacts.resources" value="${deploy.artifacts.dir}/resources" />
   <property name="jboss.runtime.dir" value="${output.dir}/jboss-osgi-runtime-${product.version}" />
+  <property name="runtime.dir" value="${basedir}/runtime" />
 
   <!-- ================================================================== -->
   <!-- Initialization                                                     -->

Modified: projects/jboss-osgi/trunk/build/distribution/scripts/assembly-deploy-artifacts.xml
===================================================================
--- projects/jboss-osgi/trunk/build/distribution/scripts/assembly-deploy-artifacts.xml	2009-05-02 13:19:21 UTC (rev 88122)
+++ projects/jboss-osgi/trunk/build/distribution/scripts/assembly-deploy-artifacts.xml	2009-05-03 11:43:20 UTC (rev 88123)
@@ -27,6 +27,17 @@
       <scope>compile</scope>
       <unpack>false</unpack>
     </dependencySet>
+    <dependencySet>
+      <outputDirectory>lib</outputDirectory>
+      <outputFileNameMapping>${artifact.artifactId}${dashClassifier?}.${artifact.extension}</outputFileNameMapping>
+      <useStrictFiltering>true</useStrictFiltering>
+      <includes>
+        <include>*:jboss-logging-log4j:jar</include>
+        <include>*:log4j:jar</include>
+      </includes>
+      <scope>test</scope>
+      <unpack>false</unpack>
+    </dependencySet>
     
     <!-- resources -->
     <dependencySet>

Modified: projects/jboss-osgi/trunk/build/distribution/src/main/resources/installer/install-definition.xml
===================================================================
--- projects/jboss-osgi/trunk/build/distribution/src/main/resources/installer/install-definition.xml	2009-05-02 13:19:21 UTC (rev 88122)
+++ projects/jboss-osgi/trunk/build/distribution/src/main/resources/installer/install-definition.xml	2009-05-03 11:43:20 UTC (rev 88123)
@@ -155,6 +155,48 @@
     
       <description>Standalone JBossOSGi Runtime based on JBossAS</description>
 
+      <!-- START: EXPERIMENTAL RUNTIME ****************************************************************** -->
+       
+      <!-- JBossOSGi Bin -->
+      <fileset dir="@{runtime.dir}/bin" targetdir="$INSTALL_PATH/runtime-new/bin" override="true"/>
+      <executable targetfile="$INSTALL_PATH/runtime-new/bin/run.sh" stage="never" keep="true"/>
+      
+      <!-- JBossOSGi conf -->
+      <fileset dir="@{runtime.dir}/conf" targetdir="$INSTALL_PATH/runtime-new/conf" override="true"/>
+      
+      <!-- JBossOSGi Lib -->
+      <fileset dir="@{deploy.artifacts.dir}/lib" targetdir="$INSTALL_PATH/runtime-new/lib" override="true">
+        <include name="jboss-common-core.jar" />
+        <include name="jboss-logging-spi.jar" />
+        <include name="jboss-logging-log4j.jar" />
+        <include name="jboss-osgi-runtime-felix.jar" />
+        <include name="jboss-osgi-spi.jar" />
+        <include name="jboss-vfs.jar" />
+        <include name="log4j.jar" />
+        <include name="org.apache.felix.framework.jar" />
+        <include name="org.osgi.core.jar" />
+      </fileset>
+      
+      <!-- JBossOSGi Bundles -->
+      <fileset dir="@{deploy.artifacts.dir}/lib" targetdir="$INSTALL_PATH/runtime-new/bundles" override="true">
+        <include name="apache-xerces-bundle.jar" />
+        <include name="jaxb-bundle.jar" />
+        <include name="jbossxb-bundle.jar" />
+        <include name="jboss-common-core-bundle.jar" />
+        <include name="jboss-osgi-common.jar" />
+        <include name="jboss-osgi-logging.jar" />
+        <include name="jboss-osgi-jmx.jar" />
+        <include name="jboss-osgi-microcontainer.jar" />
+        <include name="jboss-osgi-webconsole.jar" />
+        <include name="org.apache.felix.configadmin.jar" />
+        <include name="org.apache.felix.http.jetty.jar" />
+        <include name="org.apache.felix.log.jar" />
+        <include name="org.apache.felix.metatype.jar" />
+        <include name="org.osgi.compendium.jar" />
+      </fileset>
+      
+      <!-- END:   EXPERIMENTAL RUNTIME ****************************************************************** --> 
+      
       <!-- JBossOSGi Runtime -->
       <fileset dir="@{jboss.runtime.dir}" targetdir="$INSTALL_PATH/runtime" override="true"/>
       <executable targetfile="$INSTALL_PATH/runtime/bin/run.sh" stage="never" keep="true"/>

Modified: projects/jboss-osgi/trunk/bundle/blueprint/src/test/java/org/jboss/test/osgi/blueprint/mcservice/MicrocontainerServiceTestCase.java
===================================================================
--- projects/jboss-osgi/trunk/bundle/blueprint/src/test/java/org/jboss/test/osgi/blueprint/mcservice/MicrocontainerServiceTestCase.java	2009-05-02 13:19:21 UTC (rev 88122)
+++ projects/jboss-osgi/trunk/bundle/blueprint/src/test/java/org/jboss/test/osgi/blueprint/mcservice/MicrocontainerServiceTestCase.java	2009-05-03 11:43:20 UTC (rev 88123)
@@ -89,7 +89,7 @@
    /**
     * Test whether the bundle can be deployed through the MicrocontainerServiceMBean 
     */
-   public void testBundleDeployment() throws Exception
+   public void _testBundleDeployment() throws Exception
    {
       MicrocontainerServiceMBean mcService = MBeanProxy.get(MicrocontainerServiceMBean.class, MBEAN_MICROCONTAINER_SERVICE, getMBeanServer());
       mcService.deploy(getTestArchiveURL("mcservice-bundleA.jar"));
@@ -104,6 +104,6 @@
    public void testBeansDeployment() throws Exception
    {
       MicrocontainerServiceMBean mcService = MBeanProxy.get(MicrocontainerServiceMBean.class, MBEAN_MICROCONTAINER_SERVICE, getMBeanServer());
-//      mcService.deploy(getTestArchiveURL("mcservice-bundleB.jar"));
+      mcService.deploy(getTestArchiveURL("mcservice-bundleB.jar"));
    }
 }
\ No newline at end of file

Modified: projects/jboss-osgi/trunk/bundle/jmx/pom.xml
===================================================================
--- projects/jboss-osgi/trunk/bundle/jmx/pom.xml	2009-05-02 13:19:21 UTC (rev 88122)
+++ projects/jboss-osgi/trunk/bundle/jmx/pom.xml	2009-05-03 11:43:20 UTC (rev 88123)
@@ -62,10 +62,10 @@
             <Bundle-SymbolicName>${artifactId}</Bundle-SymbolicName>
             <Bundle-Activator>org.jboss.osgi.jmx.ServiceActivator</Bundle-Activator>
             <Import-Package>
+               javax.management*,
                org.jboss.osgi.common.log, 
                org.osgi.framework;version=1.4,
                org.osgi.service.log,
-               javax.management,
             </Import-Package>
           </instructions>
         </configuration>

Modified: projects/jboss-osgi/trunk/bundle/jmx/src/main/java/org/jboss/osgi/jmx/ServiceActivator.java
===================================================================
--- projects/jboss-osgi/trunk/bundle/jmx/src/main/java/org/jboss/osgi/jmx/ServiceActivator.java	2009-05-02 13:19:21 UTC (rev 88122)
+++ projects/jboss-osgi/trunk/bundle/jmx/src/main/java/org/jboss/osgi/jmx/ServiceActivator.java	2009-05-03 11:43:20 UTC (rev 88123)
@@ -23,60 +23,47 @@
 
 //$Id$
 
-import java.util.ArrayList;
-
 import javax.management.MBeanServer;
-import javax.management.MBeanServerFactory;
 
-import org.jboss.osgi.common.log.LogServiceTracker;
+import org.jboss.osgi.jmx.internal.JMXConnectorService;
+import org.jboss.osgi.jmx.internal.MBeanServerService;
 import org.osgi.framework.BundleActivator;
 import org.osgi.framework.BundleContext;
-import org.osgi.framework.ServiceReference;
-import org.osgi.framework.ServiceRegistration;
-import org.osgi.service.log.LogService;
 
 /**
- * A Service Activator that registers an MBeanServer
+ * A BundleActivator for the MBeanServer related services
  * 
  * @author thomas.diesler at jboss.com
  * @since 24-Apr-2009
  */
 public class ServiceActivator implements BundleActivator
 {
-   private ServiceRegistration registration;
-   private LogService log;
+   public static final String REMOTE_JMX_HOST = "org.jboss.osgi.jmx.host";
+   public static final String REMOTE_JMX_PORT = "org.jboss.osgi.jmx.port";
    
-   @SuppressWarnings("unchecked")
+   private JMXConnectorService conService;
+   
    public void start(BundleContext context)
    {
-      log = new LogServiceTracker(context);
+      MBeanServerService mbeanService = new MBeanServerService(context);
+      MBeanServer mbs = mbeanService.getMBeanServer();
       
-      ServiceReference sref = context.getServiceReference(MBeanServer.class.getName());
-      if (sref == null)
+      String jmxHost = context.getProperty(REMOTE_JMX_HOST);
+      String jmxPort = context.getProperty(REMOTE_JMX_PORT);
+      
+      if (jmxHost != null && jmxPort != null)
       {
-         ArrayList<MBeanServer> serverArr = MBeanServerFactory.findMBeanServer(null);
-         if (serverArr.size() > 1)
-            throw new IllegalStateException("Multiple MBeanServer instances not supported");
-
-         MBeanServer mbeanServer = null;
-         if (serverArr.size() == 1)
-            mbeanServer = serverArr.get(0);
-
-         if (mbeanServer == null)
-            mbeanServer = MBeanServerFactory.createMBeanServer();
-         
-         log.log(LogService.LOG_DEBUG, "Register MBeanServer");
-         registration = context.registerService(MBeanServer.class.getName(), mbeanServer, null);
+         conService = new JMXConnectorService(context, mbs, jmxHost, jmxPort);
+         conService.start();
       }
    }
 
    public void stop(BundleContext context)
    {
-      if (registration != null)
+      if (conService != null)
       {
-         log.log(LogService.LOG_DEBUG, "Unregister MBeanServer");
-         registration.unregister();
-         registration = null;
+         conService.stop();
+         conService = null;
       }
    }
 }
\ No newline at end of file

Added: projects/jboss-osgi/trunk/bundle/jmx/src/main/java/org/jboss/osgi/jmx/internal/JMXConnectorService.java
===================================================================
--- projects/jboss-osgi/trunk/bundle/jmx/src/main/java/org/jboss/osgi/jmx/internal/JMXConnectorService.java	                        (rev 0)
+++ projects/jboss-osgi/trunk/bundle/jmx/src/main/java/org/jboss/osgi/jmx/internal/JMXConnectorService.java	2009-05-03 11:43:20 UTC (rev 88123)
@@ -0,0 +1,92 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.osgi.jmx.internal;
+
+//$Id$
+
+import java.io.IOException;
+
+import javax.management.MBeanServer;
+import javax.management.remote.JMXConnectorServer;
+import javax.management.remote.JMXConnectorServerFactory;
+import javax.management.remote.JMXServiceURL;
+
+import org.jboss.osgi.common.log.LogServiceTracker;
+import org.osgi.framework.BundleContext;
+import org.osgi.service.log.LogService;
+
+/**
+ * A Service Activator that registers an MBeanServer
+ * 
+ * @author thomas.diesler at jboss.com
+ * @since 24-Apr-2009
+ */
+public class JMXConnectorService
+{
+   private LogService log;
+   private JMXServiceURL conURL;
+   private JMXConnectorServer conServer;
+
+   public JMXConnectorService(BundleContext context, MBeanServer mbs, String jmxHost, String jmxPort)
+   {
+      log = new LogServiceTracker(context);
+
+      try
+      {
+         conURL = new JMXServiceURL("service:jmx:rmi:///jndi/rmi://" + jmxHost + ":" + jmxPort + "/server");
+         conServer = JMXConnectorServerFactory.newJMXConnectorServer(conURL, null, mbs);
+      }
+      catch (IOException ex)
+      {
+         log.log(LogService.LOG_ERROR, "Cannot create JMXConnectorServer", ex);
+      }
+   }
+
+   public void start()
+   {
+      if (conServer == null)
+         throw new IllegalStateException("JMXConnectorServer not available");
+      
+      try
+      {
+         conServer.start();
+         log.log(LogService.LOG_DEBUG, "JMXConnector started: " + conURL);
+      }
+      catch (IOException ex)
+      {
+         log.log(LogService.LOG_ERROR, "Cannot start JMXConnectorServer", ex);
+      }
+   }
+
+   public void stop()
+   {
+      try
+      {
+         conServer.stop();
+         log.log(LogService.LOG_DEBUG, "JMXConnector stopped");
+      }
+      catch (IOException ex)
+      {
+         log.log(LogService.LOG_WARNING, "Cannot stop JMXConnectorServer", ex);
+      }
+   }
+}
\ No newline at end of file


Property changes on: projects/jboss-osgi/trunk/bundle/jmx/src/main/java/org/jboss/osgi/jmx/internal/JMXConnectorService.java
___________________________________________________________________
Name: svn:keywords
   + Id Revision
Name: svn:eol-style
   + LF

Added: projects/jboss-osgi/trunk/bundle/jmx/src/main/java/org/jboss/osgi/jmx/internal/MBeanServerService.java
===================================================================
--- projects/jboss-osgi/trunk/bundle/jmx/src/main/java/org/jboss/osgi/jmx/internal/MBeanServerService.java	                        (rev 0)
+++ projects/jboss-osgi/trunk/bundle/jmx/src/main/java/org/jboss/osgi/jmx/internal/MBeanServerService.java	2009-05-03 11:43:20 UTC (rev 88123)
@@ -0,0 +1,74 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.osgi.jmx.internal;
+
+//$Id$
+
+import java.util.ArrayList;
+
+import javax.management.MBeanServer;
+import javax.management.MBeanServerFactory;
+
+import org.jboss.osgi.common.log.LogServiceTracker;
+import org.osgi.framework.BundleContext;
+import org.osgi.framework.ServiceReference;
+import org.osgi.service.log.LogService;
+
+/**
+ * A service that registers an MBeanServer
+ * 
+ * @author thomas.diesler at jboss.com
+ * @since 24-Apr-2009
+ */
+public class MBeanServerService 
+{
+   private LogService log;
+   private MBeanServer mbeanServer;
+   
+   @SuppressWarnings("unchecked")
+   public MBeanServerService(BundleContext context)
+   {
+      log = new LogServiceTracker(context);
+      
+      ServiceReference sref = context.getServiceReference(MBeanServer.class.getName());
+      if (sref == null)
+      {
+         ArrayList<MBeanServer> serverArr = MBeanServerFactory.findMBeanServer(null);
+         if (serverArr.size() > 1)
+            throw new IllegalStateException("Multiple MBeanServer instances not supported");
+
+         if (serverArr.size() == 1)
+            mbeanServer = serverArr.get(0);
+
+         if (mbeanServer == null)
+            mbeanServer = MBeanServerFactory.createMBeanServer();
+         
+         log.log(LogService.LOG_DEBUG, "Register MBeanServer");
+         context.registerService(MBeanServer.class.getName(), mbeanServer, null);
+      }
+   }
+
+   public MBeanServer getMBeanServer()
+   {
+      return mbeanServer;
+   }
+}
\ No newline at end of file


Property changes on: projects/jboss-osgi/trunk/bundle/jmx/src/main/java/org/jboss/osgi/jmx/internal/MBeanServerService.java
___________________________________________________________________
Name: svn:keywords
   + Id Revision
Name: svn:eol-style
   + LF

Modified: projects/jboss-osgi/trunk/bundle/pom.xml
===================================================================
--- projects/jboss-osgi/trunk/bundle/pom.xml	2009-05-02 13:19:21 UTC (rev 88122)
+++ projects/jboss-osgi/trunk/bundle/pom.xml	2009-05-03 11:43:20 UTC (rev 88123)
@@ -22,12 +22,4 @@
     <module>webconsole</module>
   </modules>
   
-  
-  <!-- 
-  <modules>
-    <module>blueprint</module>
-    <module>microcontainer</module>
-  </modules>
-  -->  
-  
 </project>

Modified: projects/jboss-osgi/trunk/spi/src/main/java/org/jboss/osgi/spi/framework/OSGiBootstrap.java
===================================================================
--- projects/jboss-osgi/trunk/spi/src/main/java/org/jboss/osgi/spi/framework/OSGiBootstrap.java	2009-05-02 13:19:21 UTC (rev 88122)
+++ projects/jboss-osgi/trunk/spi/src/main/java/org/jboss/osgi/spi/framework/OSGiBootstrap.java	2009-05-03 11:43:20 UTC (rev 88123)
@@ -24,9 +24,13 @@
 //$Id$
 
 import java.io.BufferedReader;
+import java.io.IOException;
 import java.io.InputStreamReader;
+import java.io.Reader;
 import java.net.URL;
 
+import org.jboss.logging.Logger;
+
 /**
  * The OSGiBootstrap provides an {@link OSGiFramework} through a {@link OSGiBootstrapProvider}.
  * 
@@ -44,6 +48,9 @@
  */
 public final class OSGiBootstrap
 {
+   // Provide logging
+   final static Logger log = Logger.getLogger(OSGiBootstrap.class);
+   
    // Hide the ctor
    private OSGiBootstrap()
    {
@@ -95,4 +102,68 @@
 
       return provider;
    }
+
+   public static void main(String[] args)
+   {
+      OSGiBootstrapProvider bootProvider = getBootstrapProvider();
+      OSGiFramework framework = bootProvider.getFramework();
+
+      Runtime runtime = Runtime.getRuntime();
+      runtime.addShutdownHook(new ShutdownThread(framework));
+
+      Thread thread = new StartupThread(framework);
+      thread.start();
+   }
+
+   static class StartupThread extends Thread
+   {
+      private OSGiFramework framework;
+
+      public StartupThread(OSGiFramework framework)
+      {
+         this.framework = framework;
+      }
+
+      public void run()
+      {
+         // Start the framework
+         long start = System.currentTimeMillis();
+         framework.start();
+         long end = System.currentTimeMillis();
+         
+         float diff = (end - start) / 1000f;
+         log.info("JBossOSGi Runtime started in " + diff + "sec");
+
+         Reader br = new InputStreamReader(System.in);
+         try
+         {
+            int inByte = br.read();
+            while (inByte != 0)
+            {
+               inByte = br.read();
+            }
+         }
+         catch (IOException ioe)
+         {
+            // ignore user input
+         }
+      }
+   }
+
+   static class ShutdownThread extends Thread
+   {
+      private OSGiFramework framework;
+
+      public ShutdownThread(OSGiFramework framework)
+      {
+         this.framework = framework;
+      }
+
+      public void run()
+      {
+         log.info("Initiating shutdown ...");
+         framework.stop();
+         log.info("Shutdown complete");
+      }
+   }
 }
\ No newline at end of file

Modified: projects/jboss-osgi/trunk/spi/src/main/java/org/jboss/osgi/spi/framework/PropertiesBootstrapProvider.java
===================================================================
--- projects/jboss-osgi/trunk/spi/src/main/java/org/jboss/osgi/spi/framework/PropertiesBootstrapProvider.java	2009-05-02 13:19:21 UTC (rev 88122)
+++ projects/jboss-osgi/trunk/spi/src/main/java/org/jboss/osgi/spi/framework/PropertiesBootstrapProvider.java	2009-05-03 11:43:20 UTC (rev 88123)
@@ -230,6 +230,7 @@
       return framework;
    }
 
+   @SuppressWarnings("unchecked")
    private Properties getBootstrapProperties(URL urlConfig)
    {
       Properties props = new Properties();
@@ -243,6 +244,15 @@
       {
         throw new IllegalStateException("Cannot load properties from: " + urlConfig, ex);
       }
+
+      // Replace system properties
+      Enumeration<String> keys = (Enumeration<String>)props.propertyNames();
+      while (keys.hasMoreElements())
+      {
+         String key = keys.nextElement();
+         String value = props.getProperty(key);
+         props.setProperty(key, StringPropertyReplacer.replaceProperties(value));
+      }
       return props;
    }
 }




More information about the jboss-cvs-commits mailing list