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

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Mon Apr 6 09:07:23 EDT 2009


Author: thomas.diesler at jboss.com
Date: 2009-04-06 09:07:23 -0400 (Mon, 06 Apr 2009)
New Revision: 86847

Added:
   projects/jboss-osgi/trunk/runtime/knopflerfish/.classpath
   projects/jboss-osgi/trunk/runtime/knopflerfish/.project
   projects/jboss-osgi/trunk/runtime/knopflerfish/.settings/
   projects/jboss-osgi/trunk/runtime/knopflerfish/.settings/org.eclipse.jdt.core.prefs
   projects/jboss-osgi/trunk/runtime/knopflerfish/.settings/org.maven.ide.eclipse.prefs
   projects/jboss-osgi/trunk/runtime/knopflerfish/pom.xml
   projects/jboss-osgi/trunk/runtime/knopflerfish/scripts/
   projects/jboss-osgi/trunk/runtime/knopflerfish/src/
   projects/jboss-osgi/trunk/runtime/knopflerfish/src/main/java/org/jboss/osgi/knopflerfish/
   projects/jboss-osgi/trunk/runtime/knopflerfish/src/main/java/org/jboss/osgi/knopflerfish/KnopflerfishIntegration.java
   projects/jboss-osgi/trunk/runtime/knopflerfish/src/test/java/org/jboss/test/osgi/knopflerfish/
   projects/jboss-osgi/trunk/runtime/knopflerfish/src/test/java/org/jboss/test/osgi/knopflerfish/SystemBundleTestCase.java
Removed:
   projects/jboss-osgi/trunk/runtime/knopflerfish/src/main/java/org/jboss/osgi/equinox/
   projects/jboss-osgi/trunk/runtime/knopflerfish/src/test/java/org/jboss/test/osgi/equinox/
Modified:
   projects/jboss-osgi/trunk/pom.xml
   projects/jboss-osgi/trunk/runtime/equinox/src/test/java/org/jboss/test/osgi/equinox/SystemBundleTestCase.java
   projects/jboss-osgi/trunk/runtime/felix/src/test/java/org/jboss/test/osgi/felix/SystemBundleTestCase.java
   projects/jboss-osgi/trunk/runtime/knopflerfish/
   projects/jboss-osgi/trunk/runtime/knopflerfish/src/main/resources/jboss-osgi-beans.xml
   projects/jboss-osgi/trunk/runtime/knopflerfish/src/main/resources/osgi-deployers-jboss-beans.xml
   projects/jboss-osgi/trunk/runtime/knopflerfish/src/test/resources/jboss-osgi-beans.xml
   projects/jboss-osgi/trunk/runtime/pom.xml
Log:
Initial Knopflerfish integration

Modified: projects/jboss-osgi/trunk/pom.xml
===================================================================
--- projects/jboss-osgi/trunk/pom.xml	2009-04-06 11:53:41 UTC (rev 86846)
+++ projects/jboss-osgi/trunk/pom.xml	2009-04-06 13:07:23 UTC (rev 86847)
@@ -60,6 +60,7 @@
     <version.jboss.microcontainer>2.0.4.GA</version.jboss.microcontainer>
     <version.jboss.test>1.0.5.GA</version.jboss.test>
     <version.junit>4.4</version.junit>
+    <version.knopflerfish>2.2.0</version.knopflerfish>
     <version.log4j>1.2.14</version.log4j>
     <version.osgi>r4v41</version.osgi>
   </properties>
@@ -243,6 +244,13 @@
         <version>${version.felix.webconsole}</version>
       </dependency>
 
+      <!-- Equinox Dependencies -->
+      <dependency>
+        <groupId>org.knopflerfish</groupId>
+        <artifactId>org.knopflerfish.framework</artifactId>
+        <version>${version.knopflerfish}</version>
+      </dependency>
+      
       <!-- Test Dependencies -->
       <dependency>
         <groupId>org.jboss</groupId>

Modified: projects/jboss-osgi/trunk/runtime/equinox/src/test/java/org/jboss/test/osgi/equinox/SystemBundleTestCase.java
===================================================================
--- projects/jboss-osgi/trunk/runtime/equinox/src/test/java/org/jboss/test/osgi/equinox/SystemBundleTestCase.java	2009-04-06 11:53:41 UTC (rev 86846)
+++ projects/jboss-osgi/trunk/runtime/equinox/src/test/java/org/jboss/test/osgi/equinox/SystemBundleTestCase.java	2009-04-06 13:07:23 UTC (rev 86847)
@@ -47,7 +47,7 @@
       Bundle bundle = framework.getSystemBundle();
 
       assertEquals("BundleId == 0", 0, bundle.getBundleId());
-      assertEquals("SymbolicName == org.eclipse.osgi", "org.eclipse.osgi", bundle.getSymbolicName());
+      assertEquals("SymbolicName", "org.eclipse.osgi", bundle.getSymbolicName());
    }
    
    public void testSystemBundle()
@@ -57,6 +57,6 @@
       Bundle bundle = framework.getSystemBundle();
 
       assertEquals("BundleId == 0", 0, bundle.getBundleId());
-      assertEquals("SymbolicName == org.eclipse.osgi", "org.eclipse.osgi", bundle.getSymbolicName());
+      assertEquals("SymbolicName", "org.eclipse.osgi", bundle.getSymbolicName());
    }
 }
\ No newline at end of file

Modified: projects/jboss-osgi/trunk/runtime/felix/src/test/java/org/jboss/test/osgi/felix/SystemBundleTestCase.java
===================================================================
--- projects/jboss-osgi/trunk/runtime/felix/src/test/java/org/jboss/test/osgi/felix/SystemBundleTestCase.java	2009-04-06 11:53:41 UTC (rev 86846)
+++ projects/jboss-osgi/trunk/runtime/felix/src/test/java/org/jboss/test/osgi/felix/SystemBundleTestCase.java	2009-04-06 13:07:23 UTC (rev 86847)
@@ -47,7 +47,7 @@
       Bundle bundle = framework.getSystemBundle();
 
       assertEquals("BundleId == 0", 0, bundle.getBundleId());
-      assertEquals("SymbolicName == system.bundle", "system.bundle", bundle.getSymbolicName());
+      assertEquals("SymbolicName", "system.bundle", bundle.getSymbolicName());
    }
    
    public void testSystemBundle()
@@ -57,6 +57,6 @@
       Bundle bundle = framework.getSystemBundle();
 
       assertEquals("BundleId == 0", 0, bundle.getBundleId());
-      assertEquals("SymbolicName == system.bundle", "system.bundle", bundle.getSymbolicName());
+      assertEquals("SymbolicName", "system.bundle", bundle.getSymbolicName());
    }
 }
\ No newline at end of file


Property changes on: projects/jboss-osgi/trunk/runtime/knopflerfish
___________________________________________________________________
Name: svn:ignore
   + target


Added: projects/jboss-osgi/trunk/runtime/knopflerfish/.classpath
===================================================================
--- projects/jboss-osgi/trunk/runtime/knopflerfish/.classpath	                        (rev 0)
+++ projects/jboss-osgi/trunk/runtime/knopflerfish/.classpath	2009-04-06 13:07:23 UTC (rev 86847)
@@ -0,0 +1,10 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+	<classpathentry kind="src" output="target/classes" path="src/main/java"/>
+	<classpathentry excluding="**" kind="src" output="target/classes" path="src/main/resources"/>
+	<classpathentry kind="src" output="target/test-classes" path="src/test/java"/>
+	<classpathentry excluding="**" kind="src" output="target/test-classes" path="src/test/resources"/>
+	<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/J2SE-1.5"/>
+	<classpathentry kind="con" path="org.maven.ide.eclipse.MAVEN2_CLASSPATH_CONTAINER"/>
+	<classpathentry kind="output" path="target/classes"/>
+</classpath>

Added: projects/jboss-osgi/trunk/runtime/knopflerfish/.project
===================================================================
--- projects/jboss-osgi/trunk/runtime/knopflerfish/.project	                        (rev 0)
+++ projects/jboss-osgi/trunk/runtime/knopflerfish/.project	2009-04-06 13:07:23 UTC (rev 86847)
@@ -0,0 +1,23 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+	<name>jboss-osgi-runtime-knopflerfish</name>
+	<comment></comment>
+	<projects>
+	</projects>
+	<buildSpec>
+		<buildCommand>
+			<name>org.eclipse.jdt.core.javabuilder</name>
+			<arguments>
+			</arguments>
+		</buildCommand>
+		<buildCommand>
+			<name>org.maven.ide.eclipse.maven2Builder</name>
+			<arguments>
+			</arguments>
+		</buildCommand>
+	</buildSpec>
+	<natures>
+		<nature>org.eclipse.jdt.core.javanature</nature>
+		<nature>org.maven.ide.eclipse.maven2Nature</nature>
+	</natures>
+</projectDescription>

Added: projects/jboss-osgi/trunk/runtime/knopflerfish/.settings/org.eclipse.jdt.core.prefs
===================================================================
--- projects/jboss-osgi/trunk/runtime/knopflerfish/.settings/org.eclipse.jdt.core.prefs	                        (rev 0)
+++ projects/jboss-osgi/trunk/runtime/knopflerfish/.settings/org.eclipse.jdt.core.prefs	2009-04-06 13:07:23 UTC (rev 86847)
@@ -0,0 +1,5 @@
+#Mon Apr 06 13:33:40 CEST 2009
+eclipse.preferences.version=1
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5
+org.eclipse.jdt.core.compiler.compliance=1.5
+org.eclipse.jdt.core.compiler.source=1.5

Added: projects/jboss-osgi/trunk/runtime/knopflerfish/.settings/org.maven.ide.eclipse.prefs
===================================================================
--- projects/jboss-osgi/trunk/runtime/knopflerfish/.settings/org.maven.ide.eclipse.prefs	                        (rev 0)
+++ projects/jboss-osgi/trunk/runtime/knopflerfish/.settings/org.maven.ide.eclipse.prefs	2009-04-06 13:07:23 UTC (rev 86847)
@@ -0,0 +1,9 @@
+#Mon Apr 06 13:33:38 CEST 2009
+activeProfiles=
+eclipse.preferences.version=1
+fullBuildGoals=process-test-resources
+includeModules=false
+resolveWorkspaceProjects=true
+resourceFilterGoals=process-resources resources\:testResources
+skipCompilerPlugin=true
+version=1

Copied: projects/jboss-osgi/trunk/runtime/knopflerfish/pom.xml (from rev 86836, projects/jboss-osgi/trunk/runtime/equinox/pom.xml)
===================================================================
--- projects/jboss-osgi/trunk/runtime/knopflerfish/pom.xml	                        (rev 0)
+++ projects/jboss-osgi/trunk/runtime/knopflerfish/pom.xml	2009-04-06 13:07:23 UTC (rev 86847)
@@ -0,0 +1,242 @@
+<?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>
+
+  <name>JBossOSGi - Runtime Knopflerfish</name>
+  <description>JBossOSGi - Knopflerfish Runtime</description>
+
+  <groupId>org.jboss.osgi</groupId>
+  <artifactId>jboss-osgi-runtime-knopflerfish</artifactId>
+  <packaging>jar</packaging>
+
+  <parent>
+    <groupId>org.jboss.osgi</groupId>
+    <artifactId>jboss-osgi-runtime</artifactId>
+    <version>1.0.0.Beta1</version>
+  </parent>
+
+  <!-- Properties -->
+  <properties>
+    <surefire.security.args>-Djava.security.manager -Djava.security.policy=src/test/resources/tst.policy</surefire.security.args>
+  </properties>
+
+  <!-- Dependencies -->
+  <dependencies>
+    <dependency>
+      <groupId>javax.servlet</groupId>
+      <artifactId>servlet-api</artifactId>
+      <scope>provided</scope>
+    </dependency>
+    <dependency>
+      <groupId>org.jboss.osgi</groupId>
+      <artifactId>jboss-osgi-runtime-spi</artifactId>
+      <version>${version}</version>
+    </dependency>
+    <dependency>
+      <groupId>org.knopflerfish</groupId>
+      <artifactId>org.knopflerfish.framework</artifactId>
+    </dependency>
+
+    <!-- Test Dependencies -->
+    <dependency>
+      <groupId>org.jboss.osgi</groupId>
+      <artifactId>jboss-osgi-testsuite</artifactId>
+      <version>${version}</version>
+      <type>zip</type>
+    </dependency>
+    <dependency>
+      <groupId>junit</groupId>
+      <artifactId>junit</artifactId>
+      <scope>test</scope>
+    </dependency>
+    <dependency>
+      <groupId>log4j</groupId>
+      <artifactId>log4j</artifactId>
+      <scope>test</scope>
+    </dependency>
+  </dependencies>
+
+  <!-- Build -->
+  <build>
+    <testResources>
+      <testResource>
+        <directory>src/test/resources</directory>
+        <filtering>true</filtering>
+      </testResource>
+      <testResource>
+        <directory>src/testsuite/resources</directory>
+      </testResource>
+    </testResources>
+    <plugins>
+      <plugin>
+        <groupId>org.codehaus.mojo</groupId>
+        <artifactId>build-helper-maven-plugin</artifactId>
+        <executions>
+          <execution>
+            <id>add-test-source</id>
+            <phase>generate-sources</phase>
+            <goals>
+              <goal>add-test-source</goal>
+            </goals>
+            <configuration>
+              <sources>
+                <source>src/testsuite</source>
+              </sources>
+            </configuration>
+          </execution>
+        </executions>
+      </plugin>
+      <plugin>
+        <artifactId>maven-assembly-plugin</artifactId>
+        <executions>
+          <execution>
+            <phase>package</phase>
+            <goals>
+              <goal>single</goal>
+            </goals>
+            <configuration>
+              <finalName>${project.build.finalName}</finalName>
+              <appendAssemblyId>true</appendAssemblyId>
+              <descriptors>
+                <descriptor>scripts/assembly-config.xml</descriptor>
+              </descriptors>
+            </configuration>
+          </execution>
+        </executions>
+      </plugin>
+      <plugin>
+        <artifactId>maven-clean-plugin</artifactId>
+        <configuration>
+          <filesets>
+            <fileset>
+              <directory>src/testsuite</directory>
+            </fileset>
+          </filesets>
+        </configuration>
+      </plugin>
+      <plugin>
+        <artifactId>maven-jar-plugin</artifactId>
+        <configuration>
+          <excludes>
+            <exclude>*beans.xml</exclude>
+          </excludes>
+        </configuration>
+      </plugin>
+    </plugins>
+  </build>
+
+  <profiles>
+
+    <!--
+      Name:  framework-knopflerfish
+      Descr: Setup for Knopflerfish integration testing
+    -->
+    <profile>
+      <id>framework-knopflerfish</id>
+      <activation>
+        <property>
+          <name>framework</name>
+          <value>knopflerfish</value>
+        </property>
+      </activation>
+      <build>
+        <plugins>
+          <plugin>
+            <artifactId>maven-dependency-plugin</artifactId>
+            <executions>
+              <execution>
+                <phase>generate-sources</phase>
+                <goals>
+                  <goal>unpack</goal>
+                </goals>
+                <configuration>
+                  <artifactItems>
+                    <artifactItem>
+                      <groupId>org.jboss.osgi</groupId>
+                      <artifactId>jboss-osgi-testsuite</artifactId>
+                      <type>zip</type>
+                      <outputDirectory>src/testsuite</outputDirectory>
+                      <excludes>test-libs/**</excludes>
+                    </artifactItem>
+                    <artifactItem>
+                      <groupId>org.jboss.osgi</groupId>
+                      <artifactId>jboss-osgi-testsuite</artifactId>
+                      <type>zip</type>
+                      <outputDirectory>target</outputDirectory>
+                      <includes>test-libs/**</includes>
+                    </artifactItem>
+                  </artifactItems>
+                </configuration>
+              </execution>
+            </executions>
+          </plugin>
+        </plugins>
+      </build>
+    </profile>
+
+    <!--
+      Name:  embedded-tesing
+      Descr: Setup for embedded integration testing
+    -->
+    <profile>
+      <id>embedded-tesing</id>
+      <activation>
+        <property>
+          <name>!jboss.bind.address</name>
+        </property>
+      </activation>
+      <build>
+        <plugins>
+          <plugin>
+            <artifactId>maven-surefire-plugin</artifactId>
+            <configuration>
+              <excludes>
+                <!-- Exclude all testsuite tests -->
+                <exclude>org/jboss/test/osgi/jbosgi*/**</exclude>
+                <exclude>org/jboss/test/osgi/service/**</exclude>
+              </excludes>
+            </configuration>
+          </plugin>
+        </plugins>
+      </build>
+    </profile>
+
+    <!--
+      Name:  remote-tesing
+      Descr: Setup for remote integration testing
+    -->
+    <profile>
+      <id>remote-tesing</id>
+      <activation>
+        <property>
+          <name>jboss.bind.address</name>
+        </property>
+      </activation>
+      <dependencies>
+        <dependency>
+          <groupId>org.jboss.jbossas</groupId>
+          <artifactId>jboss-as-client</artifactId>
+          <scope>test</scope>
+          <type>pom</type>
+        </dependency>
+      </dependencies>
+      <build>
+        <plugins>
+          <plugin>
+            <artifactId>maven-surefire-plugin</artifactId>
+            <configuration>
+              <argLine>${surefire.security.args}</argLine>
+              <excludes>
+                <!-- Exclude all testsuite tests -->
+                <exclude>org/jboss/test/osgi/jbosgi*/**</exclude>
+                <exclude>org/jboss/test/osgi/service/**</exclude>
+              </excludes>
+            </configuration>
+          </plugin>
+        </plugins>
+      </build>
+    </profile>
+
+  </profiles>
+
+</project>


Property changes on: projects/jboss-osgi/trunk/runtime/knopflerfish/pom.xml
___________________________________________________________________
Name: svn:keywords
   + Id Revision
Name: svn:mergeinfo
   + 
Name: svn:eol-style
   + LF

Copied: projects/jboss-osgi/trunk/runtime/knopflerfish/scripts (from rev 86836, projects/jboss-osgi/trunk/runtime/equinox/scripts)

Copied: projects/jboss-osgi/trunk/runtime/knopflerfish/src (from rev 86836, projects/jboss-osgi/trunk/runtime/equinox/src)

Copied: projects/jboss-osgi/trunk/runtime/knopflerfish/src/main/java/org/jboss/osgi/knopflerfish/KnopflerfishIntegration.java (from rev 86836, projects/jboss-osgi/trunk/runtime/equinox/src/main/java/org/jboss/osgi/equinox/framework/EquinoxIntegration.java)
===================================================================
--- projects/jboss-osgi/trunk/runtime/knopflerfish/src/main/java/org/jboss/osgi/knopflerfish/KnopflerfishIntegration.java	                        (rev 0)
+++ projects/jboss-osgi/trunk/runtime/knopflerfish/src/main/java/org/jboss/osgi/knopflerfish/KnopflerfishIntegration.java	2009-04-06 13:07:23 UTC (rev 86847)
@@ -0,0 +1,209 @@
+/*
+ * 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.knopflerfish;
+
+//$Id$
+
+import java.io.ByteArrayOutputStream;
+import java.io.PrintStream;
+import java.net.URI;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+
+import org.jboss.logging.Logger;
+import org.jboss.osgi.spi.FrameworkException;
+import org.jboss.osgi.spi.framework.OSGiFramework;
+import org.knopflerfish.framework.Framework;
+import org.osgi.framework.Bundle;
+import org.osgi.framework.BundleContext;
+import org.osgi.framework.BundleException;
+
+/**
+ * The OSGiFramework for Makewave Knopflerfish
+ * 
+ * @author thomas.diesler at jboss.com
+ * @since 06-Apr-2009
+ */
+public class KnopflerfishIntegration implements OSGiFramework
+{
+   // Provide logging
+   final Logger log = Logger.getLogger(KnopflerfishIntegration.class);
+
+   private Map<String, Object> frameworkProperties = new HashMap<String, Object>();
+   private List<URI> autoInstall = new ArrayList<URI>();
+   private List<URI> autoStart = new ArrayList<URI>();
+
+   private Framework framework;
+
+   public Map<String, Object> getFrameworkProperties()
+   {
+      return frameworkProperties;
+   }
+
+   public void setFrameworkProperties(Map<String, Object> props)
+   {
+      this.frameworkProperties = props;
+   }
+
+   public List<URI> getAutoInstall()
+   {
+      return autoInstall;
+   }
+
+   public void setAutoInstall(List<URI> autoInstall)
+   {
+      this.autoInstall = autoInstall;
+   }
+
+   public List<URI> getAutoStart()
+   {
+      return autoStart;
+   }
+
+   public void setAutoStart(List<URI> autoStart)
+   {
+      this.autoStart = autoStart;
+   }
+
+   public Bundle getSystemBundle()
+   {
+      return framework.getSystemBundleContext().getBundle();
+   }
+
+   public BundleContext getSystemBundleContext()
+   {
+      return getSystemBundle().getBundleContext();
+   }
+
+   public void create()
+   {
+      String implVersion = getClass().getPackage().getImplementationVersion();
+      log.info("OSGi Integration Knopflerfish - " + implVersion);
+
+      // Push configured props to FrameworkProperties 
+      Iterator<String> itKeys = frameworkProperties.keySet().iterator();
+      while (itKeys.hasNext())
+      {
+         String key = itKeys.next();
+         Object value = frameworkProperties.get(key);
+         if (value instanceof String)
+         {
+            Framework.setProperty(key, (String)value);
+         }
+      }
+      
+      // Prevent a NPE when the config area is not set
+      if (Framework.getProperty("org.osgi.framework.dir") == null)
+      {
+         String userHome = Framework.getProperty("user.home");
+         Framework.setProperty("org.osgi.framework.dir", userHome + "/knopflerfish");
+      }
+
+      // Cannot disable REGISTERSERVICEURLHANDLER
+      // https://sourceforge.net/tracker/?func=detail&aid=2737425&group_id=82798&atid=567241
+      //
+      // java.lang.Error: factory already defined
+      // at java.net.URL.setURLStreamHandlerFactory(URL.java:1076)
+      // at org.knopflerfish.framework.Framework.<init>(Framework.java:353)
+      PrintStream sysOut = System.out;
+      System.setOut(new PrintStream(new ByteArrayOutputStream()));
+      PrintStream sysErr = System.err;
+      System.setErr(new PrintStream(new ByteArrayOutputStream()));
+      
+      // Init & Start the Framework
+      try
+      {
+         framework = new Framework(null);
+         framework.launch(0);
+      }
+      catch (RuntimeException rte)
+      {
+         throw rte;
+      }
+      catch (Exception ex)
+      {
+         throw new FrameworkException("Cannot initialze system bundle", ex);
+      }
+      finally
+      {
+         System.setOut(sysOut);
+         System.setErr(sysErr);
+      }
+   }
+
+   public void start()
+   {
+      // Get system bundle context
+      BundleContext context = getSystemBundleContext();
+      if (context == null)
+         throw new FrameworkException("Cannot obtain system context");
+
+      Map<URI, Bundle> autoBundles = new HashMap<URI, Bundle>();
+
+      // Add the autoStart bundles to autoInstall
+      for (URI bundleURI : autoStart)
+      {
+         autoInstall.add(bundleURI);
+      }
+
+      // Install autoInstall bundles
+      for (URI bundleURI : autoInstall)
+      {
+         try
+         {
+            Bundle bundle = context.installBundle(bundleURI.toString());
+            log.info("Installed bundle: " + bundle.getSymbolicName());
+            autoBundles.put(bundleURI, bundle);
+         }
+         catch (BundleException ex)
+         {
+            log.error("Cannot install bundle: " + bundleURI, ex);
+         }
+      }
+
+      // Start autoStart bundles
+      for (URI bundleURI : autoStart)
+      {
+         try
+         {
+            Bundle bundle = autoBundles.get(bundleURI);
+            bundle.start();
+            log.info("Started bundle: " + bundle.getSymbolicName());
+         }
+         catch (BundleException ex)
+         {
+            log.error("Cannot start bundle: " + bundleURI, ex);
+         }
+      }
+   }
+
+   public void stop()
+   {
+      if (framework != null)
+      {
+         framework.shutdown();
+      }
+   }
+}
\ No newline at end of file

Modified: projects/jboss-osgi/trunk/runtime/knopflerfish/src/main/resources/jboss-osgi-beans.xml
===================================================================
--- projects/jboss-osgi/trunk/runtime/equinox/src/main/resources/jboss-osgi-beans.xml	2009-04-06 07:33:56 UTC (rev 86836)
+++ projects/jboss-osgi/trunk/runtime/knopflerfish/src/main/resources/jboss-osgi-beans.xml	2009-04-06 13:07:23 UTC (rev 86847)
@@ -4,7 +4,7 @@
 <deployment xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="urn:jboss:bean-deployer:2.0 bean-deployer_2_0.xsd" xmlns="urn:jboss:bean-deployer:2.0">
 
  <!-- The OSGiFramework -->
- <bean name="jboss.osgi:service=Framework" class="org.jboss.osgi.equinox.framework.EquinoxIntegration">
+ <bean name="jboss.osgi:service=Framework" class="org.jboss.osgi.knopflerfish.KnopflerfishIntegration">
   <property name="frameworkProperties">
    <map keyClass="java.lang.String" valueClass="java.lang.String">
     <entry><key>org.osgi.framework.storage.clean</key><value>onFirstInit</value></entry>

Modified: projects/jboss-osgi/trunk/runtime/knopflerfish/src/main/resources/osgi-deployers-jboss-beans.xml
===================================================================
--- projects/jboss-osgi/trunk/runtime/equinox/src/main/resources/osgi-deployers-jboss-beans.xml	2009-04-06 07:33:56 UTC (rev 86836)
+++ projects/jboss-osgi/trunk/runtime/knopflerfish/src/main/resources/osgi-deployers-jboss-beans.xml	2009-04-06 13:07:23 UTC (rev 86847)
@@ -3,12 +3,11 @@
 <deployment xmlns="urn:jboss:bean-deployer:2.0">
 
   <!-- The OSGiFramework -->
-  <bean name="jboss.osgi:service=Framework" class="org.jboss.osgi.equinox.framework.EquinoxIntegration">
+  <bean name="jboss.osgi:service=Framework" class="org.jboss.osgi.knopflerfish.KnopflerfishIntegration">
     <property name="frameworkProperties">
       <map keyClass="java.lang.String" valueClass="java.lang.String">
         <entry><key>org.osgi.framework.storage.clean</key><value>onFirstInit</value></entry>
         <entry><key>org.osgi.service.http.port</key><value>8090</value></entry>
-        <entry><key>osgi.framework</key><value>${jboss.server.home.url}/deployers/osgi.deployer/org.eclipse.osgi.jar</value></entry>
         <entry><key>osgi.install.area</key><value>${jboss.server.data.dir}/equinox</value></entry>
         <entry><key>felix.cm.dir</key><value>${jboss.server.data.dir}/osgi-configadmin</value></entry>
         <entry>

Copied: projects/jboss-osgi/trunk/runtime/knopflerfish/src/test/java/org/jboss/test/osgi/knopflerfish/SystemBundleTestCase.java (from rev 86836, projects/jboss-osgi/trunk/runtime/equinox/src/test/java/org/jboss/test/osgi/equinox/SystemBundleTestCase.java)
===================================================================
--- projects/jboss-osgi/trunk/runtime/knopflerfish/src/test/java/org/jboss/test/osgi/knopflerfish/SystemBundleTestCase.java	                        (rev 0)
+++ projects/jboss-osgi/trunk/runtime/knopflerfish/src/test/java/org/jboss/test/osgi/knopflerfish/SystemBundleTestCase.java	2009-04-06 13:07:23 UTC (rev 86847)
@@ -0,0 +1,62 @@
+/*
+ * 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.test.osgi.knopflerfish;
+
+//$Id$
+
+import org.jboss.osgi.knopflerfish.KnopflerfishIntegration;
+import org.jboss.osgi.spi.framework.OSGiBootstrap;
+import org.jboss.osgi.spi.framework.OSGiBootstrapProvider;
+import org.jboss.osgi.spi.framework.OSGiFramework;
+import org.jboss.osgi.spi.junit.OSGiTest;
+import org.osgi.framework.Bundle;
+
+/**
+ * Test OSGi System bundle access
+ * 
+ * @author thomas.diesler at jboss.com
+ * @since 23-Jan-2009
+ */
+public class SystemBundleTestCase extends OSGiTest
+{
+   public void testEquinoxIntegration()
+   {
+      KnopflerfishIntegration framework = new KnopflerfishIntegration();
+      framework.create();
+      framework.start();
+      
+      Bundle bundle = framework.getSystemBundle();
+
+      assertEquals("BundleId == 0", 0, bundle.getBundleId());
+      assertEquals("SymbolicName", "system.bundle", bundle.getSymbolicName());
+   }
+   
+   public void testSystemBundle()
+   {
+      OSGiBootstrapProvider configProvider = OSGiBootstrap.getBootstrapProvider();
+      OSGiFramework framework = configProvider.getFramework();
+      Bundle bundle = framework.getSystemBundle();
+
+      assertEquals("BundleId == 0", 0, bundle.getBundleId());
+      assertEquals("SymbolicName", "system.bundle", bundle.getSymbolicName());
+   }
+}
\ No newline at end of file

Modified: projects/jboss-osgi/trunk/runtime/knopflerfish/src/test/resources/jboss-osgi-beans.xml
===================================================================
--- projects/jboss-osgi/trunk/runtime/equinox/src/test/resources/jboss-osgi-beans.xml	2009-04-06 07:33:56 UTC (rev 86836)
+++ projects/jboss-osgi/trunk/runtime/knopflerfish/src/test/resources/jboss-osgi-beans.xml	2009-04-06 13:07:23 UTC (rev 86847)
@@ -4,10 +4,11 @@
 <deployment xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="urn:jboss:bean-deployer:2.0 bean-deployer_2_0.xsd" xmlns="urn:jboss:bean-deployer:2.0">
 
  <!-- The OSGiFramework -->
- <bean name="jboss.osgi:service=Framework" class="org.jboss.osgi.equinox.framework.EquinoxIntegration">
+ <bean name="jboss.osgi:service=Framework" class="org.jboss.osgi.knopflerfish.KnopflerfishIntegration">
   <property name="frameworkProperties">
    <map keyClass="java.lang.String" valueClass="java.lang.String">
     <entry><key>org.osgi.framework.storage.clean</key><value>onFirstInit</value></entry>
+    <entry><key>org.knopflerfish.osgi.registerserviceurlhandler</key><value>false</value></entry>
    </map>
   </property>
  </bean>

Modified: projects/jboss-osgi/trunk/runtime/pom.xml
===================================================================
--- projects/jboss-osgi/trunk/runtime/pom.xml	2009-04-06 11:53:41 UTC (rev 86846)
+++ projects/jboss-osgi/trunk/runtime/pom.xml	2009-04-06 13:07:23 UTC (rev 86847)
@@ -16,6 +16,7 @@
     <module>deployer</module>
     <module>equinox</module>
     <module>felix</module>
+    <module>knopflerfish</module>
   </modules>
 
 </project>




More information about the jboss-cvs-commits mailing list