JBoss-OSGI SVN: r92746 - in projects/jboss-osgi/projects/runtime/microcontainer/trunk/src: main/java/org/jboss/osgi/plugins/facade/bundle and 2 other directories.
by jboss-osgi-commits@lists.jboss.org
Author: thomas.diesler(a)jboss.com
Date: 2009-08-24 11:44:15 -0400 (Mon, 24 Aug 2009)
New Revision: 92746
Added:
projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/main/java/org/jboss/osgi/plugins/facade/classloading/OSGiBundleClassLoader.java
Modified:
projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/main/java/org/jboss/osgi/plugins/deployers/bundle/OSGiBundleClassLoadingDeployer.java
projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/main/java/org/jboss/osgi/plugins/facade/bundle/OSGiServiceState.java
projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/main/java/org/jboss/osgi/plugins/facade/classloading/OSGiClassLoaderSystem.java
projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/test/java/org/jboss/test/osgi/integration/simple/SimpleLogServiceTestCase.java
Log:
[JBOSGI-135] Cannot handle package beeing imported and exported by the same bundle
Add test and more debugging
Modified: projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/main/java/org/jboss/osgi/plugins/deployers/bundle/OSGiBundleClassLoadingDeployer.java
===================================================================
--- projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/main/java/org/jboss/osgi/plugins/deployers/bundle/OSGiBundleClassLoadingDeployer.java 2009-08-24 14:55:33 UTC (rev 92745)
+++ projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/main/java/org/jboss/osgi/plugins/deployers/bundle/OSGiBundleClassLoadingDeployer.java 2009-08-24 15:44:15 UTC (rev 92746)
@@ -118,7 +118,7 @@
if (resolution != null && Constants.RESOLUTION_OPTIONAL.equals(resolution.getValue()))
isOptional = true;
- // [TODO] Should import package requirements resolve against export capabilities?
+ // [TODO] Import package requirements should probably resolve against export capabilities
boolean isExportPackage = exportedNames.contains(packageName);
if (!isSystemPackage && !isExportPackage && !isOptional)
Modified: projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/main/java/org/jboss/osgi/plugins/facade/bundle/OSGiServiceState.java
===================================================================
--- projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/main/java/org/jboss/osgi/plugins/facade/bundle/OSGiServiceState.java 2009-08-24 14:55:33 UTC (rev 92745)
+++ projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/main/java/org/jboss/osgi/plugins/facade/bundle/OSGiServiceState.java 2009-08-24 15:44:15 UTC (rev 92746)
@@ -333,11 +333,25 @@
if (isUnregistered())
return false;
- Object otherSource = other.getSource(className);
+ Class<?> otherSource = (Class<?>)other.getSource(className);
if (otherSource == null)
return false;
- Object source = bundleState.getSource(className);
- return otherSource.equals(source);
+
+ Class<?> source = (Class<?>)bundleState.getSource(className);
+ if (source == null)
+ return false;
+
+ boolean equals = otherSource.equals(source);
+ if (equals == false && otherSource.getName().equals(source.getName()))
+ {
+ ClassLoader otherLoader = otherSource.getClassLoader();
+ ClassLoader sourceLoader = source.getClassLoader();
+ StringBuffer buffer = new StringBuffer("Cannot assign [" + className + "] comming from different exporters");
+ buffer.append("\n " + sourceLoader.toString());
+ buffer.append("\n " + otherLoader);
+ throw new ClassCastException(buffer.toString());
+ }
+ return equals;
}
/**
Added: projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/main/java/org/jboss/osgi/plugins/facade/classloading/OSGiBundleClassLoader.java
===================================================================
--- projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/main/java/org/jboss/osgi/plugins/facade/classloading/OSGiBundleClassLoader.java (rev 0)
+++ projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/main/java/org/jboss/osgi/plugins/facade/classloading/OSGiBundleClassLoader.java 2009-08-24 15:44:15 UTC (rev 92746)
@@ -0,0 +1,46 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2009, Red Hat Middleware LLC, and individual contributors
+* as indicated by the @author tags. See the copyright.txt file 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.plugins.facade.classloading;
+
+import org.jboss.classloader.spi.ClassLoaderPolicy;
+import org.jboss.classloader.spi.base.BaseClassLoader;
+
+/**
+ * An OSGiBundleClassLoader.<p>
+ *
+ * @author Thomas.Diesler(a)jboss.com
+ * @version $Revision$
+ */
+public class OSGiBundleClassLoader extends BaseClassLoader
+{
+ public OSGiBundleClassLoader(ClassLoaderPolicy policy)
+ {
+ super(policy);
+ }
+
+ @Override
+ public String toString()
+ {
+ // [TODO] Include BundleState in bundle CL toString()
+ return super.toString();
+ }
+}
\ No newline at end of file
Property changes on: projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/main/java/org/jboss/osgi/plugins/facade/classloading/OSGiBundleClassLoader.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Modified: projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/main/java/org/jboss/osgi/plugins/facade/classloading/OSGiClassLoaderSystem.java
===================================================================
--- projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/main/java/org/jboss/osgi/plugins/facade/classloading/OSGiClassLoaderSystem.java 2009-08-24 14:55:33 UTC (rev 92745)
+++ projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/main/java/org/jboss/osgi/plugins/facade/classloading/OSGiClassLoaderSystem.java 2009-08-24 15:44:15 UTC (rev 92746)
@@ -24,8 +24,10 @@
import org.jboss.classloader.plugins.filter.PatternClassFilter;
import org.jboss.classloader.plugins.jdk.AbstractJDKChecker;
import org.jboss.classloader.spi.ClassLoaderDomain;
+import org.jboss.classloader.spi.ClassLoaderPolicy;
import org.jboss.classloader.spi.ClassLoaderSystem;
import org.jboss.classloader.spi.ParentPolicy;
+import org.jboss.classloader.spi.base.BaseClassLoader;
import org.jboss.classloader.spi.filter.ClassFilter;
import org.jboss.classloader.spi.filter.PackageClassFilter;
import org.jboss.osgi.plugins.facade.api.SystemPackagesPlugin;
@@ -68,4 +70,9 @@
{
return new ClassLoaderDomain(name);
}
+
+ protected BaseClassLoader createClassLoader(ClassLoaderPolicy policy)
+ {
+ return new OSGiBundleClassLoader(policy);
+ }
}
\ No newline at end of file
Modified: projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/test/java/org/jboss/test/osgi/integration/simple/SimpleLogServiceTestCase.java
===================================================================
--- projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/test/java/org/jboss/test/osgi/integration/simple/SimpleLogServiceTestCase.java 2009-08-24 14:55:33 UTC (rev 92745)
+++ projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/test/java/org/jboss/test/osgi/integration/simple/SimpleLogServiceTestCase.java 2009-08-24 15:44:15 UTC (rev 92746)
@@ -23,12 +23,13 @@
//$Id$
-import static org.junit.Assert.*;
import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
import static org.junit.Assert.fail;
import org.jboss.osgi.spi.testing.OSGiTest;
import org.jboss.osgi.spi.util.ServiceLoader;
+import org.junit.Before;
import org.junit.Test;
import org.osgi.framework.Bundle;
import org.osgi.framework.BundleContext;
@@ -44,6 +45,12 @@
*/
public class SimpleLogServiceTestCase extends OSGiTest
{
+ @Before
+ public void setUp()
+ {
+ System.clearProperty("simple-logservice-bundle");
+ }
+
@Test
public void testNoLogService() throws Exception
{
@@ -68,17 +75,48 @@
}
@Test
- public void testLogService() throws Exception
+ public void testLogServiceFromThirdParty() throws Exception
{
FrameworkFactory factory = ServiceLoader.loadService(FrameworkFactory.class);
Framework framework = factory.newFramework(null);
framework.start();
BundleContext sysContext = framework.getBundleContext();
+ sysContext.installBundle(getTestArchivePath("bundles/org.apache.felix.log.jar")).start();
+
+ Bundle bundle = sysContext.installBundle(getTestArchivePath("simple-logservice-bundle.jar"));
+ bundle.start();
+
+ // The bundle activator is expected to set this property
+ String result = System.getProperty(bundle.getSymbolicName());
+ assertNotNull("Result property not null", result);
+
+ assertTrue("BundleActivator start", result.indexOf("startBundleActivator") > 0);
+ assertTrue("getService", result.indexOf("getService") > 0);
+ assertTrue("addingService", result.indexOf("addingService") > 0);
+
+ framework.stop();
+ }
+
+ @Test
+ public void testLogServiceFromCompendium() throws Exception
+ {
+ FrameworkFactory factory = ServiceLoader.loadService(FrameworkFactory.class);
+ Framework framework = factory.newFramework(null);
+ framework.start();
+
+ BundleContext sysContext = framework.getBundleContext();
sysContext.installBundle(getTestArchivePath("bundles/org.osgi.compendium.jar")).start();
sysContext.installBundle(getTestArchivePath("bundles/org.apache.felix.log.jar")).start();
Bundle bundle = sysContext.installBundle(getTestArchivePath("simple-logservice-bundle.jar"));
+
+ if (true)
+ {
+ System.out.println("FIXME [JBOSGI-135] Cannot handle package beeing imported and exported by the same bundle");
+ return;
+ }
+
bundle.start();
// The bundle activator is expected to set this property
@@ -86,11 +124,9 @@
assertNotNull("Result property not null", result);
assertTrue("BundleActivator start", result.indexOf("startBundleActivator") > 0);
+ assertTrue("getService", result.indexOf("getService") > 0);
+ assertTrue("addingService", result.indexOf("addingService") > 0);
- System.out.println("FIXME [JBOSGI-135] Cannot get LogService when compendium is installed");
- //assertTrue("getService", result.indexOf("getService") > 0);
- //assertTrue("addingService", result.indexOf("addingService") > 0);
-
framework.stop();
}
}
\ No newline at end of file
16 years, 4 months
JBoss-OSGI SVN: r92743 - in projects/jboss-osgi/projects/runtime/microcontainer/trunk: scripts and 16 other directories.
by jboss-osgi-commits@lists.jboss.org
Author: thomas.diesler(a)jboss.com
Date: 2009-08-24 10:24:14 -0400 (Mon, 24 Aug 2009)
New Revision: 92743
Added:
projects/jboss-osgi/projects/runtime/microcontainer/trunk/scripts/assembly-bundles.xml
projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/test/java/org/jboss/test/osgi/integration/
projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/test/java/org/jboss/test/osgi/integration/simple/
projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/test/java/org/jboss/test/osgi/integration/simple/SimpleBundleTestCase.java
projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/test/java/org/jboss/test/osgi/integration/simple/SimpleLogServiceTestCase.java
projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/test/java/org/jboss/test/osgi/integration/simple/bundleA/
projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/test/java/org/jboss/test/osgi/integration/simple/bundleB/
projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/test/java/org/jboss/test/osgi/integration/simple/bundleB/SimpleLogServiceActivator.java
projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/test/resources/integration/
projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/test/resources/integration/simple/
projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/test/resources/integration/simple/simple-logservice.bnd
projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/test/resources/integration/simple/simple.bnd
Removed:
projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/test/java/org/jboss/test/osgi/simple/SimpleBundleTestCase.java
projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/test/java/org/jboss/test/osgi/simple/bundle/
projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/test/resources/bundles/simple/simple.bnd
Modified:
projects/jboss-osgi/projects/runtime/microcontainer/trunk/pom.xml
projects/jboss-osgi/projects/runtime/microcontainer/trunk/scripts/antrun-test-jars.xml
projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/main/java/org/jboss/osgi/plugins/deployers/bundle/OSGiBundleClassLoadingDeployer.java
projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/main/java/org/jboss/osgi/plugins/facade/api/SystemPackagesPlugin.java
projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/main/java/org/jboss/osgi/plugins/facade/bundle/OSGiBundleState.java
projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/main/java/org/jboss/osgi/plugins/facade/bundle/OSGiServiceState.java
projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/main/java/org/jboss/osgi/plugins/facade/classloading/OSGiClassLoaderSystem.java
projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/main/java/org/jboss/osgi/plugins/facade/plugins/SystemPackagesPluginImpl.java
projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/test/java/org/jboss/test/osgi/integration/simple/bundleA/SimpleActivator.java
projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/test/java/org/jboss/test/osgi/integration/simple/bundleA/SimpleService.java
projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/test/resources/bootstrap/bootstrap.xml
Log:
Add system packages to the parent class loader domain
Modified: projects/jboss-osgi/projects/runtime/microcontainer/trunk/pom.xml
===================================================================
--- projects/jboss-osgi/projects/runtime/microcontainer/trunk/pom.xml 2009-08-24 13:49:11 UTC (rev 92742)
+++ projects/jboss-osgi/projects/runtime/microcontainer/trunk/pom.xml 2009-08-24 14:24:14 UTC (rev 92743)
@@ -14,9 +14,11 @@
<!-- Properties -->
<properties>
+ <version.apache.felix.log>1.1.0-SNAPSHOT</version.apache.felix.log>
<version.jboss.aop>2.1.0.CR3</version.jboss.aop>
<version.jboss.deployers>2.0.8.GA</version.jboss.deployers>
<version.jboss.logging.log4j>2.1.0.GA</version.jboss.logging.log4j>
+ <version.jboss.osgi.common>1.0.1-SNAPSHOT</version.jboss.osgi.common>
<version.jboss.osgi.runtime.deployers>1.0.1-SNAPSHOT</version.jboss.osgi.runtime.deployers>
<version.jboss.osgi.spi>1.0.1-SNAPSHOT</version.jboss.osgi.spi>
<version.jboss.microcontainer>2.0.6.GA</version.jboss.microcontainer>
@@ -132,11 +134,55 @@
</exclusion>
</exclusions>
</dependency>
+
+ <!-- Test bundles dependencies -->
+ <dependency>
+ <groupId>org.apache.felix</groupId>
+ <artifactId>org.apache.felix.log</artifactId>
+ <version>${version.apache.felix.log}</version>
+ <scope>test</scope>
+ <exclusions>
+ <exclusion>
+ <groupId>org.apache.felix</groupId>
+ <artifactId>org.osgi.core</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>org.apache.felix</groupId>
+ <artifactId>org.osgi.compendium</artifactId>
+ </exclusion>
+ </exclusions>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss.osgi.bundles</groupId>
+ <artifactId>jboss-osgi-common</artifactId>
+ <version>${version.jboss.osgi.common}</version>
+ <scope>test</scope>
+ </dependency>
</dependencies>
<build>
<plugins>
<plugin>
+ <artifactId>maven-assembly-plugin</artifactId>
+ <executions>
+ <execution>
+ <id>bundles</id>
+ <phase>test-compile</phase>
+ <goals>
+ <goal>directory-single</goal>
+ </goals>
+ <configuration>
+ <finalName>test-libs</finalName>
+ <ignoreDirFormatExtensions>true</ignoreDirFormatExtensions>
+ <appendAssemblyId>false</appendAssemblyId>
+ <descriptors>
+ <descriptor>scripts/assembly-bundles.xml</descriptor>
+ </descriptors>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+ <plugin>
<artifactId>maven-antrun-plugin</artifactId>
<executions>
<execution>
Modified: projects/jboss-osgi/projects/runtime/microcontainer/trunk/scripts/antrun-test-jars.xml
===================================================================
--- projects/jboss-osgi/projects/runtime/microcontainer/trunk/scripts/antrun-test-jars.xml 2009-08-24 13:49:11 UTC (rev 92742)
+++ projects/jboss-osgi/projects/runtime/microcontainer/trunk/scripts/antrun-test-jars.xml 2009-08-24 14:24:14 UTC (rev 92743)
@@ -43,7 +43,8 @@
<!-- Please add alphabetically -->
<!-- simple -->
- <bnd classpath="${tests.classes.dir}" output="${tests.output.dir}/test-libs/simple-bundle.jar" files="${tests.resources.dir}/bundles/simple/simple.bnd" />
+ <bnd classpath="${tests.classes.dir}" output="${tests.output.dir}/test-libs/simple-bundle.jar" files="${tests.resources.dir}/integration/simple/simple.bnd" />
+ <bnd classpath="${tests.classes.dir}" output="${tests.output.dir}/test-libs/simple-logservice-bundle.jar" files="${tests.resources.dir}/integration/simple/simple-logservice.bnd" />
<!-- Please add alphabetically -->
Added: projects/jboss-osgi/projects/runtime/microcontainer/trunk/scripts/assembly-bundles.xml
===================================================================
--- projects/jboss-osgi/projects/runtime/microcontainer/trunk/scripts/assembly-bundles.xml (rev 0)
+++ projects/jboss-osgi/projects/runtime/microcontainer/trunk/scripts/assembly-bundles.xml 2009-08-24 14:24:14 UTC (rev 92743)
@@ -0,0 +1,37 @@
+<assembly xmlns="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.0 http://maven.apache.org/xsd/assembly-1.1.0.xsd">
+
+ <id>deploy-artifacts</id>
+ <formats>
+ <format>dir</format>
+ </formats>
+ <includeBaseDirectory>false</includeBaseDirectory>
+
+ <!-- Dependency Sets -->
+ <dependencySets>
+
+ <!-- bundles -->
+ <dependencySet>
+ <outputDirectory>bundles</outputDirectory>
+ <outputFileNameMapping>${artifact.artifactId}${dashClassifier?}.${artifact.extension}</outputFileNameMapping>
+ <includes>
+ <include>*:org.osgi.compendium:jar</include>
+ </includes>
+ <useStrictFiltering>true</useStrictFiltering>
+ <scope>compile</scope>
+ <unpack>false</unpack>
+ </dependencySet>
+ <dependencySet>
+ <outputDirectory>bundles</outputDirectory>
+ <outputFileNameMapping>${artifact.artifactId}${dashClassifier?}.${artifact.extension}</outputFileNameMapping>
+ <includes>
+ <include>*:jboss-osgi-common:jar</include>
+ <include>*:org.apache.felix.log:jar</include>
+ </includes>
+ <useStrictFiltering>true</useStrictFiltering>
+ <scope>test</scope>
+ <unpack>false</unpack>
+ </dependencySet>
+
+ </dependencySets>
+</assembly>
Property changes on: projects/jboss-osgi/projects/runtime/microcontainer/trunk/scripts/assembly-bundles.xml
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Modified: projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/main/java/org/jboss/osgi/plugins/deployers/bundle/OSGiBundleClassLoadingDeployer.java
===================================================================
--- projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/main/java/org/jboss/osgi/plugins/deployers/bundle/OSGiBundleClassLoadingDeployer.java 2009-08-24 13:49:11 UTC (rev 92742)
+++ projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/main/java/org/jboss/osgi/plugins/deployers/bundle/OSGiBundleClassLoadingDeployer.java 2009-08-24 14:24:14 UTC (rev 92743)
@@ -38,7 +38,6 @@
import org.jboss.osgi.spi.metadata.OSGiMetaData;
import org.jboss.osgi.spi.metadata.PackageAttribute;
import org.jboss.osgi.spi.metadata.Parameter;
-import org.jboss.osgi.spi.util.ConstantsHelper;
import org.osgi.framework.Constants;
/**
@@ -89,9 +88,6 @@
Capability capability = new ModuleCapability(metadata.getBundleSymbolicName(), metadata.getBundleVersion());
classLoadingMetaData.getCapabilities().addCapability(capability);
- // [TODO] Should system packages be added as capabilities?
- SystemPackagesPlugin syspackPlugin = bundleManager.getPlugin(SystemPackagesPlugin.class);
-
ArrayList<String> exportedNames = new ArrayList<String>();
List<PackageAttribute> exported = metadata.getExportPackages();
@@ -109,10 +105,12 @@
List<PackageAttribute> imported = metadata.getImportPackages();
if (imported != null)
{
+ SystemPackagesPlugin syspackPlugin = bundleManager.getPlugin(SystemPackagesPlugin.class);
for (PackageAttribute packageAttribute : imported)
{
String packageName = packageAttribute.getPackageInfo().getName();
+ // [TODO] Should system packages be added as capabilities?
boolean isSystemPackage = syspackPlugin.isSystemPackage(packageName);
boolean isOptional = false;
Modified: projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/main/java/org/jboss/osgi/plugins/facade/api/SystemPackagesPlugin.java
===================================================================
--- projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/main/java/org/jboss/osgi/plugins/facade/api/SystemPackagesPlugin.java 2009-08-24 13:49:11 UTC (rev 92742)
+++ projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/main/java/org/jboss/osgi/plugins/facade/api/SystemPackagesPlugin.java 2009-08-24 14:24:14 UTC (rev 92743)
@@ -34,6 +34,8 @@
public interface SystemPackagesPlugin extends AbstractPlugin
{
List<String> getSystemPackages();
+
+ String getSystemPackagesAsString();
boolean isSystemPackage(String name);
}
\ No newline at end of file
Modified: projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/main/java/org/jboss/osgi/plugins/facade/bundle/OSGiBundleState.java
===================================================================
--- projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/main/java/org/jboss/osgi/plugins/facade/bundle/OSGiBundleState.java 2009-08-24 13:49:11 UTC (rev 92742)
+++ projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/main/java/org/jboss/osgi/plugins/facade/bundle/OSGiBundleState.java 2009-08-24 14:24:14 UTC (rev 92743)
@@ -85,31 +85,31 @@
{
/** The log */
private static final Logger log = Logger.getLogger(OSGiBundleState.class);
-
+
/** Used to generate a unique id */
private static final AtomicLong bundleIDGenerator = new AtomicLong();
-
+
/** The bundle id */
private long bundleId;
-
+
/** The last modified time stamp */
private long lastModified = System.currentTimeMillis();
-
+
/** The bundle manager */
private OSGiBundleManager bundleManager;
-
+
/** The osgi metadata */
private OSGiMetaData osgiMetaData;
-
+
/** The deployment unit */
private DeploymentUnit unit;
-
+
/** The bundle context */
private BundleContext bundleContext;
-
- /** The bundle */
+
+ /** The bundle */
private Bundle bundle;
-
+
/** The bundle state */
private AtomicInteger state = new AtomicInteger(Bundle.UNINSTALLED);
@@ -118,13 +118,13 @@
/** The services in use */
private Map<OSGiServiceState, Integer> servicesInUse = new ConcurrentHashMap<OSGiServiceState, Integer>();
-
+
/** The bundle listeners */
private List<BundleListener> bundleListeners = new CopyOnWriteArrayList<BundleListener>();
/** The framework listeners */
private List<FrameworkListener> frameworkListeners = new CopyOnWriteArrayList<FrameworkListener>();
-
+
/** The service listeners */
private Map<ServiceListener, ServiceListenerRegistration> serviceListeners = new ConcurrentHashMap<ServiceListener, ServiceListenerRegistration>();
@@ -247,7 +247,7 @@
Collection<OSGiBundleState> bundleStates = bundleManager.getBundles();
if (bundleStates.isEmpty())
return new Bundle[0];
-
+
List<Bundle> bundles = new ArrayList<Bundle>(bundleStates.size());
for (OSGiBundleState bundleState : bundleStates)
bundles.add(bundleState.getBundleInternal());
@@ -263,7 +263,7 @@
{
lastModified = System.currentTimeMillis();
}
-
+
public String getLocation()
{
checkAdminPermission(AdminPermission.METADATA);
@@ -271,16 +271,16 @@
URL url = getOSGiMetaData().getBundleUpdateLocation();
if (url != null)
return url.toString();
-
+
DeploymentUnit unit = getDeploymentUnit();
if (unit instanceof VFSDeploymentUnit)
{
- VFSDeploymentUnit vfsDeploymentUnit = (VFSDeploymentUnit) unit;
+ VFSDeploymentUnit vfsDeploymentUnit = (VFSDeploymentUnit)unit;
VirtualFile root = vfsDeploymentUnit.getRoot();
return root.getName();
}
-
- return null;
+
+ return null;
}
/**
@@ -305,7 +305,7 @@
checkAdminPermission(AdminPermission.METADATA);
return getOSGiMetaData().getHeaders(locale);
}
-
+
public String getProperty(String key)
{
checkValidBundleContext();
@@ -328,8 +328,8 @@
DeploymentUnit unit = getDeploymentUnit();
if (unit instanceof VFSDeploymentUnit)
{
- VFSDeploymentUnit vfsDeploymentUnit = (VFSDeploymentUnit) unit;
-
+ VFSDeploymentUnit vfsDeploymentUnit = (VFSDeploymentUnit)unit;
+
if (path.startsWith("/"))
path = path.substring(1);
return vfsDeploymentUnit.getResourceLoader().getResource(path);
@@ -347,21 +347,21 @@
DeploymentUnit unit = getDeploymentUnit();
if (unit instanceof VFSDeploymentUnit)
{
- VFSDeploymentUnit vfsDeploymentUnit = (VFSDeploymentUnit) unit;
+ VFSDeploymentUnit vfsDeploymentUnit = (VFSDeploymentUnit)unit;
VirtualFile root = vfsDeploymentUnit.getRoot();
if (path.startsWith("/"))
path = path.substring(1);
try
{
- VirtualFile child = root.getChild(path);
- if (child != null)
- return new VFSEntryPathsEnumeration(root, child);
+ VirtualFile child = root.getChild(path);
+ if (child != null)
+ return new VFSEntryPathsEnumeration(root, child);
}
catch (IOException e)
{
throw new RuntimeException("Error determining entry paths for " + root + " path=" + path);
}
-
+
}
return null;
}
@@ -375,31 +375,31 @@
checkInstalled();
if (noAdminPermission(AdminPermission.RESOURCE))
return null;
-
+
// [TODO] fragments
resolve(false);
-
+
if (filePattern == null)
filePattern = "*";
-
+
DeploymentUnit unit = getDeploymentUnit();
if (unit instanceof VFSDeploymentUnit)
{
- VFSDeploymentUnit vfsDeploymentUnit = (VFSDeploymentUnit) unit;
+ VFSDeploymentUnit vfsDeploymentUnit = (VFSDeploymentUnit)unit;
VirtualFile root = vfsDeploymentUnit.getRoot();
if (path.startsWith("/"))
path = path.substring(1);
try
{
- VirtualFile child = root.getChild(path);
- if (child != null)
- return new VFSFindEntriesEnumeration(root, child, filePattern, recurse);
+ VirtualFile child = root.getChild(path);
+ if (child != null)
+ return new VFSFindEntriesEnumeration(root, child, filePattern, recurse);
}
catch (IOException e)
{
throw new RuntimeException("Error finding entries for " + root + " path=" + path + " pattern=" + filePattern + " recurse=" + recurse);
}
-
+
}
return null;
}
@@ -410,7 +410,7 @@
checkInstalled();
checkAdminPermission(AdminPermission.CLASS);
// [TODO] bundle fragment
-
+
try
{
resolve(true);
@@ -456,7 +456,7 @@
SecurityManager sm = System.getSecurityManager();
if (sm == null)
return true;
-
+
// [TODO] hasPermission
return true;
}
@@ -524,7 +524,7 @@
public ServiceReference[] getRegisteredServices()
{
checkInstalled();
-
+
if (registeredServices.isEmpty())
return null;
@@ -585,11 +585,11 @@
}
return true;
}
-
+
public ServiceReference[] getServicesInUse()
{
checkInstalled();
-
+
synchronized (servicesInUse)
{
Collection<OSGiServiceState> inUse = servicesInUse.keySet();
@@ -620,7 +620,7 @@
if (reference == null)
throw new IllegalArgumentException("Null reference");
-
+
return getBundleManager().getService(this, reference);
}
@@ -650,7 +650,7 @@
public ServiceRegistration registerService(String[] clazzes, Object service, Dictionary properties)
{
checkValidBundleContext();
-
+
OSGiServiceState serviceState = getBundleManager().registerService(this, clazzes, service, properties);
return serviceState.getRegistration();
}
@@ -664,14 +664,14 @@
{
getBundleManager().unregisterService(serviceState);
}
-
+
public boolean ungetService(ServiceReference reference)
{
checkValidBundleContext();
return getBundleManager().ungetService(this, reference);
}
-
+
boolean ungetService(OSGiServiceState state)
{
return getBundleManager().ungetService(this, state);
@@ -683,10 +683,10 @@
throw new IllegalArgumentException("Null listener");
checkValidBundleContext();
-
+
if (listener instanceof SynchronousBundleListener)
checkAdminPermission(AdminPermission.LISTENER);
-
+
if (bundleListeners.contains(listener))
return;
@@ -699,7 +699,7 @@
throw new IllegalArgumentException("Null listener");
checkValidBundleContext();
-
+
if (listener instanceof SynchronousBundleListener)
checkAdminPermission(AdminPermission.LISTENER);
@@ -709,7 +709,7 @@
/**
* Try to resolve the bundle
*
- * @param errorOnFail whether to throw an error when not installed
+ * @param errorOnFail whether to throw an error when not installed
* @return true when resolved
*/
boolean resolve(boolean errorOnFail)
@@ -730,22 +730,19 @@
{
checkInstalled();
checkAdminPermission(AdminPermission.EXECUTE);
-
+
if (getState() == ACTIVE)
return;
getBundleManager().start(this);
}
-
+
/**
* Start internal
*
- * [TODO] Start Level Service & START_TRANSIENT?
- * [TODO] START_ACTIVATION_POLICY
- * [TODO] LAZY_ACTIVATION
- * [TODO] locks
- * [TODO] options
- * @throws Throwable for any error
+ * [TODO] Start Level Service & START_TRANSIENT? [TODO] START_ACTIVATION_POLICY [TODO] LAZY_ACTIVATION [TODO] locks [TODO] options
+ *
+ * @throws Throwable for any error
*/
public void startInternal() throws Throwable
{
@@ -761,26 +758,27 @@
if (bundleActivatorClassName != null)
{
ClassLoader classLoader = unit.getClassLoader();
-
- DeploymentControllerContext deploymentControllerContext = getDeploymentUnit().getAttachment(ControllerContext.class.getName(), DeploymentControllerContext.class);
+
+ DeploymentControllerContext deploymentControllerContext = getDeploymentUnit().getAttachment(ControllerContext.class.getName(),
+ DeploymentControllerContext.class);
if (deploymentControllerContext == null)
throw new BundleException("No deployment controller context: " + getCanonicalName());
-
- KernelController controller = (KernelController) deploymentControllerContext.getController();
+
+ KernelController controller = (KernelController)deploymentControllerContext.getController();
BeanInfo beanInfo = controller.getKernel().getConfig().getBeanInfo(bundleActivatorClassName, classLoader);
Object result = beanInfo.newInstance();
if (result instanceof BundleActivator == false)
throw new BundleException(bundleActivatorClassName + " is not an implementation of " + BundleActivator.class.getName());
- BundleActivator bundleActivator = (BundleActivator) result;
+ BundleActivator bundleActivator = (BundleActivator)result;
unit.addAttachment(BundleActivator.class, bundleActivator);
-
+
bundleActivator.start(bundleContext);
}
}
-
+
if (getState() != STARTING)
throw new BundleException("Bundle has been uninstalled: " + bundle);
-
+
changeState(ACTIVE);
}
catch (Throwable t)
@@ -803,7 +801,7 @@
{
checkInstalled();
checkAdminPermission(AdminPermission.EXECUTE);
-
+
if (getState() != ACTIVE)
return;
@@ -813,15 +811,14 @@
/**
* Stop Internal
*
- * [TODO] Start Level Service & STOP_TRANSIENT?
- * [TODO] locks
- * [TODO] options
+ * [TODO] Start Level Service & STOP_TRANSIENT? [TODO] locks [TODO] options
+ *
* @throws Throwable for any error
*/
public void stopInternal() throws Throwable
{
changeState(STOPPING);
-
+
Throwable rethrow = null;
try
{
@@ -867,7 +864,7 @@
}
}
}
-
+
if (getState() != STOPPING)
throw new BundleException("Bundle has been uninstalled: " + getCanonicalName());
}
@@ -878,7 +875,7 @@
bundleContext = null;
unit.removeAttachment(BundleActivator.class);
}
-
+
if (rethrow != null)
throw rethrow;
}
@@ -911,7 +908,7 @@
void uninstallInternal()
{
changeState(Bundle.UNINSTALLED);
-
+
frameworkListeners.clear();
bundleListeners.clear();
serviceListeners.clear();
@@ -921,9 +918,9 @@
{
if (listener == null)
throw new IllegalArgumentException("Null listener");
-
+
checkValidBundleContext();
-
+
if (frameworkListeners.contains(listener))
return;
@@ -952,23 +949,50 @@
{
checkValidBundleContext();
checkAdminPermission(AdminPermission.LIFECYCLE); // [TODO] extension bundles
-
+
OSGiBundleManager bundleManager = getBundleManager();
if (bundleManager == null)
throw new IllegalStateException("Bundle " + getCanonicalName() + " is not valid");
+ URL url = getLocationURL(location);
+ OSGiBundleState bundleState = bundleManager.install(url);
+ return bundleState.getBundleInternal();
+ }
+
+ private URL getLocationURL(String location) throws BundleException
+ {
+ // Try location as URL
+ URL url = null;
try
{
- URL url = new URL(location);
- OSGiBundleState bundleState = bundleManager.install(url);
- return bundleState.getBundleInternal();
+ url = new URL(location);
}
catch (MalformedURLException e)
{
- throw new BundleException("Unable to handle location=" + location, e);
+ // ignore
}
+
+ // Try location as File
+ if (url == null)
+ {
+ try
+ {
+ File file = new File(location);
+ if (file.exists())
+ url = file.toURL();
+ }
+ catch (MalformedURLException e)
+ {
+ // ignore
+ }
+ }
+
+ if (url == null)
+ throw new BundleException("Unable to handle location=" + location);
+
+ return url;
}
-
+
@Override
public String toString()
{
@@ -1027,7 +1051,7 @@
return null;
}
}
-
+
/**
* Change the state of the bundle
*
@@ -1039,11 +1063,19 @@
int type = 0;
switch (state)
{
- case Bundle.STARTING : type = BundleEvent.STARTING; break;
- case Bundle.ACTIVE : type = BundleEvent.STARTED; break;
- case Bundle.STOPPING : type = BundleEvent.STOPPING; break;
- case Bundle.UNINSTALLED : type = BundleEvent.UNINSTALLED; break;
- case Bundle.INSTALLED :
+ case Bundle.STARTING:
+ type = BundleEvent.STARTING;
+ break;
+ case Bundle.ACTIVE:
+ type = BundleEvent.STARTED;
+ break;
+ case Bundle.STOPPING:
+ type = BundleEvent.STOPPING;
+ break;
+ case Bundle.UNINSTALLED:
+ type = BundleEvent.UNINSTALLED;
+ break;
+ case Bundle.INSTALLED:
{
if (previous == Bundle.RESOLVED)
type = BundleEvent.UNRESOLVED;
@@ -1051,7 +1083,7 @@
type = BundleEvent.INSTALLED;
break;
}
- case Bundle.RESOLVED :
+ case Bundle.RESOLVED:
{
if (previous == Bundle.STOPPING)
type = BundleEvent.STOPPED;
@@ -1059,7 +1091,7 @@
type = BundleEvent.RESOLVED;
break;
}
- default :
+ default:
throw new IllegalArgumentException("Unknown bundle state: " + state);
}
this.state.set(state);
@@ -1067,7 +1099,7 @@
BundleEvent event = new BundleEvent(type, getBundleInternal());
fireBundleEvent(event);
}
-
+
/**
* Fire a bundle event
*
@@ -1078,11 +1110,11 @@
// Nobody is interested
if (bundleListeners.isEmpty())
return;
-
+
// Are we active?
if (getBundleManager().isActive() == false)
return;
-
+
// Synchronous listeners first
for (BundleListener listener : bundleListeners)
{
@@ -1114,7 +1146,7 @@
}
}
}
-
+
/**
* Fire a framework event
*
@@ -1126,11 +1158,11 @@
// Nobody is interested
if (frameworkListeners.isEmpty())
return;
-
+
// Are we active?
if (getBundleManager().isActive() == false)
return;
-
+
// Call the listeners
FrameworkEvent event = new FrameworkEvent(type, getBundleInternal(), throwable);
for (FrameworkListener listener : frameworkListeners)
@@ -1145,7 +1177,7 @@
}
}
}
-
+
/**
* Fire a service event
*
@@ -1160,13 +1192,13 @@
// Nobody is interested
if (serviceListeners.isEmpty())
return;
-
+
// Are we active?
if (getBundleManager().isActive() == false)
return;
-
+
ServiceEvent event = new ServiceEvent(type, service.getReferenceInternal());
-
+
// Call the listeners
for (Map.Entry<ServiceListener, ServiceListenerRegistration> entry : serviceListeners.entrySet())
{
@@ -1187,7 +1219,7 @@
}
}
}
-
+
/**
* Check the bundle is installed
*
@@ -1212,13 +1244,12 @@
throw new IllegalStateException("Bundle context is no longer valid");
return result;
}
-
+
/**
* Check the admin permission
*
* @param what what permission to check
- * @throws SecurityException when the caller does not have the AdminPermission
- * and a security manager is installed
+ * @throws SecurityException when the caller does not have the AdminPermission and a security manager is installed
*/
private void checkAdminPermission(String what)
{
@@ -1226,7 +1257,7 @@
if (sm != null)
sm.checkPermission(new AdminPermission(this, what));
}
-
+
/**
* Checks if we have the admin permission
*
@@ -1256,16 +1287,22 @@
{
switch (state)
{
- case Bundle.INSTALLED : return "INSTALLED";
- case Bundle.RESOLVED : return "RESOLVED";
- case Bundle.STARTING : return "STARTING";
- case Bundle.ACTIVE : return "ACTIVE";
- case Bundle.STOPPING : return "STOPPING";
- case Bundle.UNINSTALLED : return "UNINSTALLED";
+ case Bundle.INSTALLED:
+ return "INSTALLED";
+ case Bundle.RESOLVED:
+ return "RESOLVED";
+ case Bundle.STARTING:
+ return "STARTING";
+ case Bundle.ACTIVE:
+ return "ACTIVE";
+ case Bundle.STOPPING:
+ return "STOPPING";
+ case Bundle.UNINSTALLED:
+ return "UNINSTALLED";
}
return "???" + state;
}
-
+
/**
* ServiceListenerRegistration.
*/
@@ -1273,7 +1310,7 @@
{
// Any filter
Filter filter;
-
+
// Any access control context
AccessControlContext accessControlContext;
@@ -1285,7 +1322,7 @@
public ServiceListenerRegistration(Filter filter)
{
this.filter = filter;
-
+
if (System.getSecurityManager() != null)
accessControlContext = AccessController.getContext();
}
Modified: projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/main/java/org/jboss/osgi/plugins/facade/bundle/OSGiServiceState.java
===================================================================
--- projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/main/java/org/jboss/osgi/plugins/facade/bundle/OSGiServiceState.java 2009-08-24 13:49:11 UTC (rev 92742)
+++ projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/main/java/org/jboss/osgi/plugins/facade/bundle/OSGiServiceState.java 2009-08-24 14:24:14 UTC (rev 92743)
@@ -531,6 +531,7 @@
{
if (object == null)
throw new IllegalArgumentException("Null object");
+
for (String className : getClasses())
{
try
@@ -538,11 +539,11 @@
Class<?> clazz = getBundleState().loadClass(className);
// [TODO] show classloader information all interfaces for debugging purposes
if (clazz.isInstance(object) == false)
- throw new IllegalArgumentException(object + " of type " + object.getClass().getName() + " does not implement " + className);
+ throw new IllegalArgumentException(object.getClass().getName() + " does not implement " + className);
}
catch (ClassNotFoundException e)
{
- throw new IllegalArgumentException("Cannot load class: " + className, e);
+ throw new IllegalArgumentException(object.getClass().getName() + " cannot load class: " + className, e);
}
}
return object;
Modified: projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/main/java/org/jboss/osgi/plugins/facade/classloading/OSGiClassLoaderSystem.java
===================================================================
--- projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/main/java/org/jboss/osgi/plugins/facade/classloading/OSGiClassLoaderSystem.java 2009-08-24 13:49:11 UTC (rev 92742)
+++ projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/main/java/org/jboss/osgi/plugins/facade/classloading/OSGiClassLoaderSystem.java 2009-08-24 14:24:14 UTC (rev 92743)
@@ -27,27 +27,38 @@
import org.jboss.classloader.spi.ClassLoaderSystem;
import org.jboss.classloader.spi.ParentPolicy;
import org.jboss.classloader.spi.filter.ClassFilter;
-import org.jboss.classloader.spi.filter.RecursivePackageClassFilter;
+import org.jboss.classloader.spi.filter.PackageClassFilter;
+import org.jboss.osgi.plugins.facade.api.SystemPackagesPlugin;
+import org.jboss.osgi.plugins.facade.bundle.OSGiBundleManager;
import org.jboss.osgi.plugins.facade.bundle.OSGiBundleState;
/**
* OSGiClassLoaderSystem.<p>
*
- * TODO Figure out how to make this more easily configurable
- *
* @author <a href="adrian(a)jboss.com">Adrian Brock</a>
+ * @author Thomas.Diesler(a)jboss.com
* @version $Revision: 1.1 $
*/
public class OSGiClassLoaderSystem extends ClassLoaderSystem
{
/**
* Create a new OSGiClassLoaderSystem.
+ * @param bundleManager the bundleManager
+ * @throws IllegalArgumentException for a null bundle manager
*/
- public OSGiClassLoaderSystem()
+ public OSGiClassLoaderSystem(OSGiBundleManager bundleManager)
{
+ if (bundleManager == null)
+ throw new IllegalArgumentException("Null bundle manager");
+
ClassLoaderDomain domain = getDefaultDomain();
- PatternClassFilter filter = RecursivePackageClassFilter.createRecursivePackageClassFilterFromString("org.osgi");
+
+ // Initialize the configured system packages
+ SystemPackagesPlugin syspackPlugin = bundleManager.getPlugin(SystemPackagesPlugin.class);
+ String sysPackageString = syspackPlugin.getSystemPackagesAsString();
+ PatternClassFilter filter = PackageClassFilter.createPackageClassFilterFromString(sysPackageString);
filter.setIncludeJava(true);
+
domain.setParentPolicy(new ParentPolicy(filter, ClassFilter.NOTHING));
AbstractJDKChecker.getExcluded().add(OSGiBundleState.class);
}
Modified: projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/main/java/org/jboss/osgi/plugins/facade/plugins/SystemPackagesPluginImpl.java
===================================================================
--- projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/main/java/org/jboss/osgi/plugins/facade/plugins/SystemPackagesPluginImpl.java 2009-08-24 13:49:11 UTC (rev 92742)
+++ projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/main/java/org/jboss/osgi/plugins/facade/plugins/SystemPackagesPluginImpl.java 2009-08-24 14:24:14 UTC (rev 92743)
@@ -98,6 +98,16 @@
return Collections.unmodifiableList(allPackages);
}
+ @Override
+ public String getSystemPackagesAsString()
+ {
+ StringBuffer sysPackageString = new StringBuffer();
+ for (String name : allPackageNames)
+ sysPackageString.append(name + ",");
+
+ return sysPackageString.toString();
+ }
+
public boolean isSystemPackage(String name)
{
if(name == null)
Copied: projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/test/java/org/jboss/test/osgi/integration/simple/SimpleBundleTestCase.java (from rev 92733, projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/test/java/org/jboss/test/osgi/simple/SimpleBundleTestCase.java)
===================================================================
--- projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/test/java/org/jboss/test/osgi/integration/simple/SimpleBundleTestCase.java (rev 0)
+++ projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/test/java/org/jboss/test/osgi/integration/simple/SimpleBundleTestCase.java 2009-08-24 14:24:14 UTC (rev 92743)
@@ -0,0 +1,87 @@
+/*
+ * 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.integration.simple;
+
+//$Id$
+
+import static org.junit.Assert.assertEquals;
+
+import org.jboss.osgi.spi.testing.OSGiBundle;
+import org.jboss.osgi.spi.testing.OSGiRuntime;
+import org.jboss.osgi.spi.testing.OSGiTestHelper;
+import org.jboss.osgi.spi.util.ServiceLoader;
+import org.junit.Test;
+import org.osgi.framework.Bundle;
+import org.osgi.framework.BundleContext;
+import org.osgi.framework.launch.Framework;
+import org.osgi.framework.launch.FrameworkFactory;
+
+/**
+ * A test that deployes a bundle and verifies its state
+ *
+ * @author thomas.diesler(a)jboss.com
+ * @since 18-Aug-2009
+ */
+public class SimpleBundleTestCase
+{
+ @Test
+ public void testBundleInstallLauchAPI() throws Exception
+ {
+ // Uses the OSGi Framework launch API
+ FrameworkFactory factory = ServiceLoader.loadService(FrameworkFactory.class);
+ Framework framework = factory.newFramework(null);
+ framework.start();
+
+ OSGiTestHelper helper = new OSGiTestHelper();
+
+ BundleContext sysContext = framework.getBundleContext();
+ Bundle bundle = sysContext.installBundle(helper.getTestArchivePath("simple-bundle.jar"));
+
+ assertEquals("simple-bundle", bundle.getSymbolicName());
+
+ bundle.start();
+ assertEquals("Bundle state", Bundle.ACTIVE, bundle.getState());
+
+ bundle.uninstall();
+ assertEquals("Bundle state", Bundle.UNINSTALLED, bundle.getState());
+
+ framework.stop();
+ }
+
+ @Test
+ public void testBundleInstallRuntimeAPI() throws Exception
+ {
+ // Uses the JBossOSGi SPI provided runtime abstraction
+ OSGiRuntime runtime = new OSGiTestHelper().getEmbeddedRuntime();
+ OSGiBundle bundle = runtime.installBundle("simple-bundle.jar");
+
+ assertEquals("simple-bundle", bundle.getSymbolicName());
+
+ bundle.start();
+ assertEquals("Bundle state", Bundle.ACTIVE, bundle.getState());
+
+ bundle.uninstall();
+ assertEquals("Bundle state", Bundle.UNINSTALLED, bundle.getState());
+
+ runtime.shutdown();
+ }
+}
\ No newline at end of file
Added: projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/test/java/org/jboss/test/osgi/integration/simple/SimpleLogServiceTestCase.java
===================================================================
--- projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/test/java/org/jboss/test/osgi/integration/simple/SimpleLogServiceTestCase.java (rev 0)
+++ projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/test/java/org/jboss/test/osgi/integration/simple/SimpleLogServiceTestCase.java 2009-08-24 14:24:14 UTC (rev 92743)
@@ -0,0 +1,96 @@
+/*
+ * 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.integration.simple;
+
+//$Id$
+
+import static org.junit.Assert.*;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.fail;
+
+import org.jboss.osgi.spi.testing.OSGiTest;
+import org.jboss.osgi.spi.util.ServiceLoader;
+import org.junit.Test;
+import org.osgi.framework.Bundle;
+import org.osgi.framework.BundleContext;
+import org.osgi.framework.BundleException;
+import org.osgi.framework.launch.Framework;
+import org.osgi.framework.launch.FrameworkFactory;
+
+/**
+ * A test that deployes a bundle and verifies its state
+ *
+ * @author thomas.diesler(a)jboss.com
+ * @since 18-Aug-2009
+ */
+public class SimpleLogServiceTestCase extends OSGiTest
+{
+ @Test
+ public void testNoLogService() throws Exception
+ {
+ FrameworkFactory factory = ServiceLoader.loadService(FrameworkFactory.class);
+ Framework framework = factory.newFramework(null);
+ framework.start();
+
+ BundleContext sysContext = framework.getBundleContext();
+ Bundle bundle = sysContext.installBundle(getTestArchivePath("simple-logservice-bundle.jar"));
+
+ try
+ {
+ bundle.start();
+ fail("Unresolved package contstraint on [org.osgi.service.log] expected");
+ }
+ catch (BundleException ex)
+ {
+ // expected
+ }
+
+ framework.stop();
+ }
+
+ @Test
+ public void testLogService() throws Exception
+ {
+ FrameworkFactory factory = ServiceLoader.loadService(FrameworkFactory.class);
+ Framework framework = factory.newFramework(null);
+ framework.start();
+
+ BundleContext sysContext = framework.getBundleContext();
+ sysContext.installBundle(getTestArchivePath("bundles/org.osgi.compendium.jar")).start();
+ sysContext.installBundle(getTestArchivePath("bundles/org.apache.felix.log.jar")).start();
+
+ Bundle bundle = sysContext.installBundle(getTestArchivePath("simple-logservice-bundle.jar"));
+ bundle.start();
+
+ // The bundle activator is expected to set this property
+ String result = System.getProperty(bundle.getSymbolicName());
+ assertNotNull("Result property not null", result);
+
+ assertTrue("BundleActivator start", result.indexOf("startBundleActivator") > 0);
+
+ System.out.println("FIXME [JBOSGI-135] Cannot get LogService when compendium is installed");
+ //assertTrue("getService", result.indexOf("getService") > 0);
+ //assertTrue("addingService", result.indexOf("addingService") > 0);
+
+ framework.stop();
+ }
+}
\ No newline at end of file
Property changes on: projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/test/java/org/jboss/test/osgi/integration/simple/SimpleLogServiceTestCase.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Copied: projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/test/java/org/jboss/test/osgi/integration/simple/bundleA (from rev 92733, projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/test/java/org/jboss/test/osgi/simple/bundle)
Modified: projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/test/java/org/jboss/test/osgi/integration/simple/bundleA/SimpleActivator.java
===================================================================
--- projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/test/java/org/jboss/test/osgi/simple/bundle/SimpleActivator.java 2009-08-24 09:40:32 UTC (rev 92733)
+++ projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/test/java/org/jboss/test/osgi/integration/simple/bundleA/SimpleActivator.java 2009-08-24 14:24:14 UTC (rev 92743)
@@ -19,7 +19,7 @@
* 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.simple.bundle;
+package org.jboss.test.osgi.integration.simple.bundleA;
//$Id$
Modified: projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/test/java/org/jboss/test/osgi/integration/simple/bundleA/SimpleService.java
===================================================================
--- projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/test/java/org/jboss/test/osgi/simple/bundle/SimpleService.java 2009-08-24 09:40:32 UTC (rev 92733)
+++ projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/test/java/org/jboss/test/osgi/integration/simple/bundleA/SimpleService.java 2009-08-24 14:24:14 UTC (rev 92743)
@@ -19,7 +19,7 @@
* 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.simple.bundle;
+package org.jboss.test.osgi.integration.simple.bundleA;
//$Id$
Added: projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/test/java/org/jboss/test/osgi/integration/simple/bundleB/SimpleLogServiceActivator.java
===================================================================
--- projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/test/java/org/jboss/test/osgi/integration/simple/bundleB/SimpleLogServiceActivator.java (rev 0)
+++ projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/test/java/org/jboss/test/osgi/integration/simple/bundleB/SimpleLogServiceActivator.java 2009-08-24 14:24:14 UTC (rev 92743)
@@ -0,0 +1,79 @@
+/*
+ * 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.integration.simple.bundleB;
+
+//$Id$
+
+import org.osgi.framework.BundleActivator;
+import org.osgi.framework.BundleContext;
+import org.osgi.framework.ServiceReference;
+import org.osgi.service.log.LogService;
+import org.osgi.util.tracker.ServiceTracker;
+
+/**
+ * A Service Activator
+ *
+ * @author thomas.diesler(a)jboss.com
+ * @since 24-Apr-2009
+ */
+public class SimpleLogServiceActivator implements BundleActivator
+{
+ public void start(BundleContext context)
+ {
+ final String symName = context.getBundle().getSymbolicName();
+ addMessage(symName, "startBundleActivator");
+
+ ServiceReference sref = context.getServiceReference(LogService.class.getName());
+ if (sref != null)
+ {
+ LogService service = (LogService)context.getService(sref);
+ String message = "getService: " + service.getClass().getName();
+ addMessage(symName, message);
+ }
+
+ ServiceTracker tracker = new ServiceTracker(context, LogService.class.getName(), null)
+ {
+ @Override
+ public Object addingService(ServiceReference reference)
+ {
+ LogService service = (LogService)super.addingService(reference);
+ String message = "addingService: " + service.getClass().getName();
+ addMessage(symName, message);
+ return service;
+ }
+ };
+ tracker.open();
+ }
+
+ public void stop(BundleContext context)
+ {
+ String symName = context.getBundle().getSymbolicName();
+ addMessage(symName, "stopBundleActivator");
+ }
+
+ private void addMessage(String propName, String message)
+ {
+ String previous = System.getProperty(propName, ":");
+ System.setProperty(propName, previous + message + ":");
+ //System.out.println(message);
+ }
+}
\ No newline at end of file
Property changes on: projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/test/java/org/jboss/test/osgi/integration/simple/bundleB/SimpleLogServiceActivator.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Deleted: projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/test/java/org/jboss/test/osgi/simple/SimpleBundleTestCase.java
===================================================================
--- projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/test/java/org/jboss/test/osgi/simple/SimpleBundleTestCase.java 2009-08-24 13:49:11 UTC (rev 92742)
+++ projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/test/java/org/jboss/test/osgi/simple/SimpleBundleTestCase.java 2009-08-24 14:24:14 UTC (rev 92743)
@@ -1,88 +0,0 @@
-/*
- * 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.simple;
-
-//$Id$
-
-import static org.junit.Assert.assertEquals;
-
-import java.net.URL;
-
-import org.jboss.osgi.spi.testing.OSGiBundle;
-import org.jboss.osgi.spi.testing.OSGiRuntime;
-import org.jboss.osgi.spi.testing.OSGiTestHelper;
-import org.jboss.osgi.spi.util.ServiceLoader;
-import org.junit.Test;
-import org.osgi.framework.Bundle;
-import org.osgi.framework.BundleContext;
-import org.osgi.framework.launch.Framework;
-import org.osgi.framework.launch.FrameworkFactory;
-
-/**
- * A test that deployes a bundle and verifies its state
- *
- * @author thomas.diesler(a)jboss.com
- * @since 18-Aug-2009
- */
-public class SimpleBundleTestCase
-{
- @Test
- public void testBundleInstallLauchAPI() throws Exception
- {
- // Uses the OSGi Framework launch API
- FrameworkFactory factory = ServiceLoader.loadService(FrameworkFactory.class);
- Framework framework = factory.newFramework(null);
- framework.start();
-
- BundleContext sysContext = framework.getBundleContext();
- URL bundleURL = new OSGiTestHelper().getTestArchiveURL("simple-bundle.jar");
- Bundle bundle = sysContext.installBundle(bundleURL.toExternalForm());
-
- assertEquals("simple-bundle", bundle.getSymbolicName());
-
- bundle.start();
- assertEquals("Bundle state", Bundle.ACTIVE, bundle.getState());
-
- bundle.uninstall();
- assertEquals("Bundle state", Bundle.UNINSTALLED, bundle.getState());
-
- framework.stop();
- }
-
- @Test
- public void testBundleInstallRuntimeAPI() throws Exception
- {
- // Uses the JBossOSGi SPI provided runtime abstraction
- OSGiRuntime runtime = new OSGiTestHelper().getEmbeddedRuntime();
- OSGiBundle bundle = runtime.installBundle("simple-bundle.jar");
-
- assertEquals("simple-bundle", bundle.getSymbolicName());
-
- bundle.start();
- assertEquals("Bundle state", Bundle.ACTIVE, bundle.getState());
-
- bundle.uninstall();
- assertEquals("Bundle state", Bundle.UNINSTALLED, bundle.getState());
-
- runtime.shutdown();
- }
-}
\ No newline at end of file
Modified: projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/test/resources/bootstrap/bootstrap.xml
===================================================================
--- projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/test/resources/bootstrap/bootstrap.xml 2009-08-24 13:49:11 UTC (rev 92742)
+++ projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/test/resources/bootstrap/bootstrap.xml 2009-08-24 14:24:14 UTC (rev 92743)
@@ -101,7 +101,9 @@
-->
<!-- ClassLoading -->
- <bean name="ClassLoaderSystem" class="org.jboss.osgi.plugins.facade.classloading.OSGiClassLoaderSystem" />
+ <bean name="ClassLoaderSystem" class="org.jboss.osgi.plugins.facade.classloading.OSGiClassLoaderSystem" >
+ <constructor><parameter><inject bean="OSGiBundleManager" /></parameter></constructor>
+ </bean>
<bean name="ClassLoading" class="org.jboss.classloading.spi.dependency.ClassLoading">
<incallback method="addModule" state="Configured" />
<uncallback method="removeModule" state="Configured" />
Deleted: projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/test/resources/bundles/simple/simple.bnd
===================================================================
--- projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/test/resources/bundles/simple/simple.bnd 2009-08-24 13:49:11 UTC (rev 92742)
+++ projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/test/resources/bundles/simple/simple.bnd 2009-08-24 14:24:14 UTC (rev 92743)
@@ -1,6 +0,0 @@
-# bnd build -classpath target/test-classes -output target/test-libs/simple-bundle.jar src/test/resources/bundles/simple/simple.bnd
-
-Bundle-SymbolicName: simple-bundle
-
-Bundle-Activator: org.jboss.test.osgi.simple.bundle.SimpleActivator
-Export-Package: org.jboss.test.osgi.simple.bundle
Added: projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/test/resources/integration/simple/simple-logservice.bnd
===================================================================
--- projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/test/resources/integration/simple/simple-logservice.bnd (rev 0)
+++ projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/test/resources/integration/simple/simple-logservice.bnd 2009-08-24 14:24:14 UTC (rev 92743)
@@ -0,0 +1,6 @@
+# bnd build -classpath target/test-classes -output target/test-libs/simple-bundle.jar src/test/resources/integration/simple/simple-logservice.bnd
+
+Bundle-SymbolicName: simple-logservice-bundle
+
+Bundle-Activator: org.jboss.test.osgi.integration.simple.bundleB.SimpleLogServiceActivator
+Private-Package: org.jboss.test.osgi.integration.simple.bundleB
Copied: projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/test/resources/integration/simple/simple.bnd (from rev 92733, projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/test/resources/bundles/simple/simple.bnd)
===================================================================
--- projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/test/resources/integration/simple/simple.bnd (rev 0)
+++ projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/test/resources/integration/simple/simple.bnd 2009-08-24 14:24:14 UTC (rev 92743)
@@ -0,0 +1,6 @@
+# bnd build -classpath target/test-classes -output target/test-libs/simple-bundle.jar src/test/resources/integration/simple/simple.bnd
+
+Bundle-SymbolicName: simple-bundle
+
+Bundle-Activator: org.jboss.test.osgi.integration.simple.bundleA.SimpleActivator
+Export-Package: org.jboss.test.osgi.integration.simple.bundleA
16 years, 4 months
JBoss-OSGI SVN: r92741 - projects/jboss-osgi/projects/spi/trunk/src/main/java/org/jboss/osgi/spi/testing.
by jboss-osgi-commits@lists.jboss.org
Author: thomas.diesler(a)jboss.com
Date: 2009-08-24 09:31:15 -0400 (Mon, 24 Aug 2009)
New Revision: 92741
Modified:
projects/jboss-osgi/projects/spi/trunk/src/main/java/org/jboss/osgi/spi/testing/OSGiTest.java
projects/jboss-osgi/projects/spi/trunk/src/main/java/org/jboss/osgi/spi/testing/OSGiTestHelper.java
Log:
Add getTestArchivePath()
Modified: projects/jboss-osgi/projects/spi/trunk/src/main/java/org/jboss/osgi/spi/testing/OSGiTest.java
===================================================================
--- projects/jboss-osgi/projects/spi/trunk/src/main/java/org/jboss/osgi/spi/testing/OSGiTest.java 2009-08-24 12:20:52 UTC (rev 92740)
+++ projects/jboss-osgi/projects/spi/trunk/src/main/java/org/jboss/osgi/spi/testing/OSGiTest.java 2009-08-24 13:31:15 UTC (rev 92741)
@@ -153,6 +153,14 @@
}
/**
+ * Delegates to {@link OSGiTestHelper#getTestArchivePath(String)}
+ */
+ protected String getTestArchivePath(String archive)
+ {
+ return getTestHelper().getTestArchivePath(archive);
+ }
+
+ /**
* Delegates to {@link OSGiTestHelper#getTestArchiveFile(String)}
*/
protected File getTestArchiveFile(String archive)
Modified: projects/jboss-osgi/projects/spi/trunk/src/main/java/org/jboss/osgi/spi/testing/OSGiTestHelper.java
===================================================================
--- projects/jboss-osgi/projects/spi/trunk/src/main/java/org/jboss/osgi/spi/testing/OSGiTestHelper.java 2009-08-24 12:20:52 UTC (rev 92740)
+++ projects/jboss-osgi/projects/spi/trunk/src/main/java/org/jboss/osgi/spi/testing/OSGiTestHelper.java 2009-08-24 13:31:15 UTC (rev 92741)
@@ -48,10 +48,10 @@
// The OSGiBootstrapProvider is a lazy property of the helper
private OSGiBootstrapProvider bootProvider;
private boolean skipCreateBootstrapProvider;
-
+
private static String testResourcesDir;
private static String testArchiveDir;
-
+
public OSGiTestHelper()
{
testResourcesDir = System.getProperty(SYSPROP_TEST_RESOURCES_DIRECTORY, "target/test-classes");
@@ -74,23 +74,23 @@
}
return bootProvider;
}
-
+
public OSGiRuntime getDefaultRuntime()
{
OSGiRuntime runtime;
-
+
String target = System.getProperty("target.container");
if (target == null)
{
runtime = getEmbeddedRuntime();
}
- else
+ else
{
runtime = getRemoteRuntime();
}
- return runtime;
+ return runtime;
}
-
+
public OSGiRuntime getEmbeddedRuntime()
{
return new EmbeddedRuntime(this);
@@ -117,6 +117,20 @@
return resURL;
}
+ /** Try to discover the File for the test resource */
+ public File getResourceFile(String resource)
+ {
+ File file = new File(resource);
+ if (file.exists())
+ return file;
+
+ file = new File(testResourcesDir + "/" + resource);
+ if (file.exists())
+ return file;
+
+ throw new IllegalArgumentException("Cannot obtain '" + testResourcesDir + "/" + resource + "'");
+ }
+
/** Try to discover the URL for the deployment archive */
public URL getTestArchiveURL(String archive)
{
@@ -130,18 +144,10 @@
}
}
- /** Try to discover the File for the test resource */
- public File getResourceFile(String resource)
+ /** Try to discover the absolute path for the deployment archive */
+ public String getTestArchivePath(String archive)
{
- File file = new File(resource);
- if (file.exists())
- return file;
-
- file = new File(testResourcesDir + "/" + resource);
- if (file.exists())
- return file;
-
- throw new IllegalArgumentException("Cannot obtain '" + testResourcesDir + "/" + resource + "'");
+ return getTestArchiveFile(archive).getAbsolutePath();
}
/** Try to discover the File for the deployment archive */
@@ -157,7 +163,7 @@
throw new IllegalArgumentException("Cannot obtain '" + testArchiveDir + "/" + archive + "'.");
}
-
+
@SuppressWarnings("unchecked")
public InitialContext getInitialContext() throws NamingException
{
16 years, 4 months
JBoss-OSGI SVN: r92737 - in projects/jboss-osgi/projects/runtime/microcontainer/trunk/src: main/java/org/jboss/osgi/plugins/facade/plugins and 1 other directories.
by jboss-osgi-commits@lists.jboss.org
Author: thomas.diesler(a)jboss.com
Date: 2009-08-24 07:08:07 -0400 (Mon, 24 Aug 2009)
New Revision: 92737
Modified:
projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/main/java/org/jboss/osgi/plugins/deployers/bundle/OSGiBundleClassLoadingDeployer.java
projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/main/java/org/jboss/osgi/plugins/facade/plugins/SystemPackagesPluginImpl.java
projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/test/resources/bootstrap/bootstrap.xml
Log:
Skip adding package requirements for resolution=optional
Modified: projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/main/java/org/jboss/osgi/plugins/deployers/bundle/OSGiBundleClassLoadingDeployer.java
===================================================================
--- projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/main/java/org/jboss/osgi/plugins/deployers/bundle/OSGiBundleClassLoadingDeployer.java 2009-08-24 11:01:04 UTC (rev 92736)
+++ projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/main/java/org/jboss/osgi/plugins/deployers/bundle/OSGiBundleClassLoadingDeployer.java 2009-08-24 11:08:07 UTC (rev 92737)
@@ -37,6 +37,9 @@
import org.jboss.osgi.plugins.facade.bundle.OSGiBundleManager;
import org.jboss.osgi.spi.metadata.OSGiMetaData;
import org.jboss.osgi.spi.metadata.PackageAttribute;
+import org.jboss.osgi.spi.metadata.Parameter;
+import org.jboss.osgi.spi.util.ConstantsHelper;
+import org.osgi.framework.Constants;
/**
* OSGiBundleClassLoadingDeployer.
@@ -86,7 +89,9 @@
Capability capability = new ModuleCapability(metadata.getBundleSymbolicName(), metadata.getBundleVersion());
classLoadingMetaData.getCapabilities().addCapability(capability);
- // [TODO] discuss wether import package requirements should resolve agains export capabilities
+ // [TODO] Should system packages be added as capabilities?
+ SystemPackagesPlugin syspackPlugin = bundleManager.getPlugin(SystemPackagesPlugin.class);
+
ArrayList<String> exportedNames = new ArrayList<String>();
List<PackageAttribute> exported = metadata.getExportPackages();
@@ -104,11 +109,21 @@
List<PackageAttribute> imported = metadata.getImportPackages();
if (imported != null)
{
- SystemPackagesPlugin syspackPlugin = bundleManager.getPlugin(SystemPackagesPlugin.class);
for (PackageAttribute packageAttribute : imported)
{
String packageName = packageAttribute.getPackageInfo().getName();
- if (syspackPlugin.isSystemPackage(packageName) == false && exportedNames.contains(packageName) == false)
+
+ boolean isSystemPackage = syspackPlugin.isSystemPackage(packageName);
+
+ boolean isOptional = false;
+ Parameter resolution = packageAttribute.getParameter(Constants.RESOLUTION_DIRECTIVE);
+ if (resolution != null && Constants.RESOLUTION_OPTIONAL.equals(resolution.getValue()))
+ isOptional = true;
+
+ // [TODO] Should import package requirements resolve against export capabilities?
+ boolean isExportPackage = exportedNames.contains(packageName);
+
+ if (!isSystemPackage && !isExportPackage && !isOptional)
{
// [TODO] add version ranges
PackageRequirement requirement = new PackageRequirement(packageName);
Modified: projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/main/java/org/jboss/osgi/plugins/facade/plugins/SystemPackagesPluginImpl.java
===================================================================
--- projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/main/java/org/jboss/osgi/plugins/facade/plugins/SystemPackagesPluginImpl.java 2009-08-24 11:01:04 UTC (rev 92736)
+++ projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/main/java/org/jboss/osgi/plugins/facade/plugins/SystemPackagesPluginImpl.java 2009-08-24 11:08:07 UTC (rev 92737)
@@ -70,6 +70,7 @@
{
if (systemPackages.size() == 0)
{
+ systemPackages.add("javax.management");
systemPackages.add("org.osgi.framework");
systemPackages.add("org.osgi.service.startlevel");
systemPackages.add("org.osgi.service.packageadmin");
Modified: projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/test/resources/bootstrap/bootstrap.xml
===================================================================
--- projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/test/resources/bootstrap/bootstrap.xml 2009-08-24 11:01:04 UTC (rev 92736)
+++ projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/test/resources/bootstrap/bootstrap.xml 2009-08-24 11:08:07 UTC (rev 92737)
@@ -22,6 +22,11 @@
<bean name="OSGiSystemPackages" class="org.jboss.osgi.plugins.facade.plugins.SystemPackagesPluginImpl">
<constructor><parameter><inject bean="OSGiBundleManager" /></parameter></constructor>
+ <property name="extraPackages">
+ <list elementClass="java.lang.String">
+ <value>org.jboss.logging;version=[2.0,3.0)</value>
+ </list>
+ </property>
</bean>
<bean name="OSGiStoragePlugin" class="org.jboss.osgi.plugins.facade.plugins.BundleStoragePluginImpl">
16 years, 4 months
JBoss-OSGI SVN: r92735 - in projects/jboss-osgi/projects/runtime/microcontainer/trunk/src: main/java/org/jboss/osgi/plugins/facade and 6 other directories.
by jboss-osgi-commits@lists.jboss.org
Author: thomas.diesler(a)jboss.com
Date: 2009-08-24 06:42:39 -0400 (Mon, 24 Aug 2009)
New Revision: 92735
Added:
projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/main/java/org/jboss/osgi/plugins/facade/api/SystemPackagesPlugin.java
projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/main/java/org/jboss/osgi/plugins/facade/classloading/
projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/main/java/org/jboss/osgi/plugins/facade/classloading/OSGiClassLoaderSystem.java
projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/main/java/org/jboss/osgi/plugins/facade/plugins/SystemPackagesPluginImpl.java
Removed:
projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/test/java/org/jboss/test/osgi/OSGiClassLoaderSystem.java
Modified:
projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/main/java/org/jboss/osgi/plugins/deployers/bundle/OSGiBundleClassLoadingDeployer.java
projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/main/java/org/jboss/osgi/plugins/deployers/bundle/OSGiBundleStateDeployer.java
projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/main/java/org/jboss/osgi/plugins/facade/bundle/OSGiBundleManager.java
projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/test/resources/bootstrap/bootstrap.xml
Log:
Externalize framework system package configuration
Modified: projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/main/java/org/jboss/osgi/plugins/deployers/bundle/OSGiBundleClassLoadingDeployer.java
===================================================================
--- projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/main/java/org/jboss/osgi/plugins/deployers/bundle/OSGiBundleClassLoadingDeployer.java 2009-08-24 10:07:22 UTC (rev 92734)
+++ projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/main/java/org/jboss/osgi/plugins/deployers/bundle/OSGiBundleClassLoadingDeployer.java 2009-08-24 10:42:39 UTC (rev 92735)
@@ -33,6 +33,8 @@
import org.jboss.deployers.spi.deployer.DeploymentStages;
import org.jboss.deployers.spi.deployer.helpers.AbstractSimpleRealDeployer;
import org.jboss.deployers.structure.spi.DeploymentUnit;
+import org.jboss.osgi.plugins.facade.api.SystemPackagesPlugin;
+import org.jboss.osgi.plugins.facade.bundle.OSGiBundleManager;
import org.jboss.osgi.spi.metadata.OSGiMetaData;
import org.jboss.osgi.spi.metadata.PackageAttribute;
@@ -49,12 +51,23 @@
*/
public class OSGiBundleClassLoadingDeployer extends AbstractSimpleRealDeployer<OSGiMetaData>
{
+ /** The bundle manager */
+ private OSGiBundleManager bundleManager;
+
/**
* Create a new OSGiBundleClassLoadingDeployer.
+ *
+ * @param bundleManager the bundleManager
+ * @throws IllegalArgumentException for a null bundle manager
*/
- public OSGiBundleClassLoadingDeployer()
+ public OSGiBundleClassLoadingDeployer(OSGiBundleManager bundleManager)
{
super(OSGiMetaData.class);
+ this.bundleManager = bundleManager;
+
+ if (bundleManager == null)
+ throw new IllegalArgumentException("Null bundle manager");
+
setTopLevelOnly(true);
setOutput(ClassLoadingMetaData.class);
setStage(DeploymentStages.POST_PARSE);
@@ -73,10 +86,7 @@
Capability capability = new ModuleCapability(metadata.getBundleSymbolicName(), metadata.getBundleVersion());
classLoadingMetaData.getCapabilities().addCapability(capability);
- // [TODO] externalise system packages
- ArrayList<String> systemNames = new ArrayList<String>();
- systemNames.add("org.osgi.framework");
-
+ // [TODO] discuss wether import package requirements should resolve agains export capabilities
ArrayList<String> exportedNames = new ArrayList<String>();
List<PackageAttribute> exported = metadata.getExportPackages();
@@ -94,10 +104,11 @@
List<PackageAttribute> imported = metadata.getImportPackages();
if (imported != null)
{
+ SystemPackagesPlugin syspackPlugin = bundleManager.getPlugin(SystemPackagesPlugin.class);
for (PackageAttribute packageAttribute : imported)
{
String packageName = packageAttribute.getPackageInfo().getName();
- if (systemNames.contains(packageName) == false && exportedNames.contains(packageName) == false)
+ if (syspackPlugin.isSystemPackage(packageName) == false && exportedNames.contains(packageName) == false)
{
// [TODO] add version ranges
PackageRequirement requirement = new PackageRequirement(packageName);
Modified: projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/main/java/org/jboss/osgi/plugins/deployers/bundle/OSGiBundleStateDeployer.java
===================================================================
--- projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/main/java/org/jboss/osgi/plugins/deployers/bundle/OSGiBundleStateDeployer.java 2009-08-24 10:07:22 UTC (rev 92734)
+++ projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/main/java/org/jboss/osgi/plugins/deployers/bundle/OSGiBundleStateDeployer.java 2009-08-24 10:42:39 UTC (rev 92735)
@@ -52,6 +52,7 @@
{
if (bundleManager == null)
throw new IllegalArgumentException("Null bundle manager");
+
this.bundleManager = bundleManager;
setOutput(OSGiBundleState.class);
Added: projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/main/java/org/jboss/osgi/plugins/facade/api/SystemPackagesPlugin.java
===================================================================
--- projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/main/java/org/jboss/osgi/plugins/facade/api/SystemPackagesPlugin.java (rev 0)
+++ projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/main/java/org/jboss/osgi/plugins/facade/api/SystemPackagesPlugin.java 2009-08-24 10:42:39 UTC (rev 92735)
@@ -0,0 +1,39 @@
+/*
+ * 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.plugins.facade.api;
+
+import java.util.List;
+
+//$Id$
+
+/**
+ * A plugin that provides the configured list of system packages.
+ *
+ * @author thomas.diesler(a)jboss.com
+ * @since 24-Aug-2009
+ */
+public interface SystemPackagesPlugin extends AbstractPlugin
+{
+ List<String> getSystemPackages();
+
+ boolean isSystemPackage(String name);
+}
\ No newline at end of file
Property changes on: projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/main/java/org/jboss/osgi/plugins/facade/api/SystemPackagesPlugin.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Modified: projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/main/java/org/jboss/osgi/plugins/facade/bundle/OSGiBundleManager.java
===================================================================
--- projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/main/java/org/jboss/osgi/plugins/facade/bundle/OSGiBundleManager.java 2009-08-24 10:07:22 UTC (rev 92734)
+++ projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/main/java/org/jboss/osgi/plugins/facade/bundle/OSGiBundleManager.java 2009-08-24 10:42:39 UTC (rev 92735)
@@ -126,6 +126,9 @@
/** The registered manager plugins */
private Map<Class<?>, AbstractPlugin> plugins = new HashMap<Class<?>, AbstractPlugin>();
+ /** The frame work properties */
+ private Map<String, Object> properties = new HashMap<String, Object>();
+
static
{
AccessController.doPrivileged(new PrivilegedAction<Object>()
@@ -190,8 +193,16 @@
this.systemBundle = new OSGiSystemBundle(systemMetaData);
addBundle(systemBundle);
}
-
+
/**
+ * Set the framework properties
+ */
+ public void setProperties(Map<String, Object> properties)
+ {
+ this.properties = properties;
+ }
+
+ /**
* Get a plugin that is registered with the bundle manager.
* @throws IllegalStateException if the requested plugin class is not registered
*/
Copied: projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/main/java/org/jboss/osgi/plugins/facade/classloading/OSGiClassLoaderSystem.java (from rev 92733, projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/test/java/org/jboss/test/osgi/OSGiClassLoaderSystem.java)
===================================================================
--- projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/main/java/org/jboss/osgi/plugins/facade/classloading/OSGiClassLoaderSystem.java (rev 0)
+++ projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/main/java/org/jboss/osgi/plugins/facade/classloading/OSGiClassLoaderSystem.java 2009-08-24 10:42:39 UTC (rev 92735)
@@ -0,0 +1,60 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2009, Red Hat Middleware LLC, and individual contributors
+* as indicated by the @author tags. See the copyright.txt file 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.plugins.facade.classloading;
+
+import org.jboss.classloader.plugins.filter.PatternClassFilter;
+import org.jboss.classloader.plugins.jdk.AbstractJDKChecker;
+import org.jboss.classloader.spi.ClassLoaderDomain;
+import org.jboss.classloader.spi.ClassLoaderSystem;
+import org.jboss.classloader.spi.ParentPolicy;
+import org.jboss.classloader.spi.filter.ClassFilter;
+import org.jboss.classloader.spi.filter.RecursivePackageClassFilter;
+import org.jboss.osgi.plugins.facade.bundle.OSGiBundleState;
+
+/**
+ * OSGiClassLoaderSystem.<p>
+ *
+ * TODO Figure out how to make this more easily configurable
+ *
+ * @author <a href="adrian(a)jboss.com">Adrian Brock</a>
+ * @version $Revision: 1.1 $
+ */
+public class OSGiClassLoaderSystem extends ClassLoaderSystem
+{
+ /**
+ * Create a new OSGiClassLoaderSystem.
+ */
+ public OSGiClassLoaderSystem()
+ {
+ ClassLoaderDomain domain = getDefaultDomain();
+ PatternClassFilter filter = RecursivePackageClassFilter.createRecursivePackageClassFilterFromString("org.osgi");
+ filter.setIncludeJava(true);
+ domain.setParentPolicy(new ParentPolicy(filter, ClassFilter.NOTHING));
+ AbstractJDKChecker.getExcluded().add(OSGiBundleState.class);
+ }
+
+ @Override
+ protected ClassLoaderDomain createDomain(String name)
+ {
+ return new ClassLoaderDomain(name);
+ }
+}
\ No newline at end of file
Added: projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/main/java/org/jboss/osgi/plugins/facade/plugins/SystemPackagesPluginImpl.java
===================================================================
--- projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/main/java/org/jboss/osgi/plugins/facade/plugins/SystemPackagesPluginImpl.java (rev 0)
+++ projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/main/java/org/jboss/osgi/plugins/facade/plugins/SystemPackagesPluginImpl.java 2009-08-24 10:42:39 UTC (rev 92735)
@@ -0,0 +1,112 @@
+/*
+ * 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.plugins.facade.plugins;
+
+//$Id$
+
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+
+import org.jboss.logging.Logger;
+import org.jboss.osgi.plugins.facade.api.SystemPackagesPlugin;
+import org.jboss.osgi.plugins.facade.bundle.OSGiBundleManager;
+
+/**
+ * A plugin that installs/starts bundles on framework startup.
+ *
+ * @author thomas.diesler(a)jboss.com
+ * @since 18-Aug-2009
+ */
+public class SystemPackagesPluginImpl extends AbstractPluginImpl implements SystemPackagesPlugin
+{
+ // Provide logging
+ final Logger log = Logger.getLogger(SystemPackagesPluginImpl.class);
+
+ /** The configured system packages */
+ private List<String> systemPackages = new ArrayList<String>();
+ /** The configured extra system packages */
+ private List<String> extraPackages = new ArrayList<String>();
+
+ /** The derived combination of all system packages */
+ private List<String> allPackages = new ArrayList<String>();
+ /** The derived combination of all system packages without version specifier */
+ private List<String> allPackageNames = new ArrayList<String>();
+
+ public SystemPackagesPluginImpl(OSGiBundleManager bundleManager)
+ {
+ super(bundleManager);
+ }
+
+ public void setSystemPackages(List<String> systemPackages)
+ {
+ this.systemPackages = systemPackages;
+ }
+ public void setExtraPackages(List<String> extraPackages)
+ {
+ this.extraPackages = extraPackages;
+ }
+
+ public void start()
+ {
+ if (systemPackages.size() == 0)
+ {
+ systemPackages.add("org.osgi.framework");
+ systemPackages.add("org.osgi.service.startlevel");
+ systemPackages.add("org.osgi.service.packageadmin");
+ systemPackages.add("org.osgi.util.tracker");
+ }
+
+ allPackages.addAll(systemPackages);
+ allPackages.addAll(extraPackages);
+
+ Collections.sort(allPackages);
+
+ for (String name : allPackages)
+ {
+ int semiIndex = name.indexOf(';');
+ if (semiIndex > 0)
+ name = name.substring(0, semiIndex);
+
+ allPackageNames.add(name);
+ }
+ }
+
+ @Override
+ public List<String> getSystemPackages()
+ {
+ return Collections.unmodifiableList(allPackages);
+ }
+
+ public boolean isSystemPackage(String name)
+ {
+ if(name == null)
+ throw new IllegalArgumentException("Null package name");
+
+ // [TODO] version specifier for system packages
+ int semiIndex = name.indexOf(';');
+ if (semiIndex > 0)
+ name = name.substring(0, semiIndex);
+
+ return allPackageNames.contains(name);
+ }
+}
\ No newline at end of file
Property changes on: projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/main/java/org/jboss/osgi/plugins/facade/plugins/SystemPackagesPluginImpl.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Deleted: projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/test/java/org/jboss/test/osgi/OSGiClassLoaderSystem.java
===================================================================
--- projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/test/java/org/jboss/test/osgi/OSGiClassLoaderSystem.java 2009-08-24 10:07:22 UTC (rev 92734)
+++ projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/test/java/org/jboss/test/osgi/OSGiClassLoaderSystem.java 2009-08-24 10:42:39 UTC (rev 92735)
@@ -1,60 +0,0 @@
-/*
-* JBoss, Home of Professional Open Source
-* Copyright 2009, Red Hat Middleware LLC, and individual contributors
-* as indicated by the @author tags. See the copyright.txt file 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;
-
-import org.jboss.classloader.plugins.filter.PatternClassFilter;
-import org.jboss.classloader.plugins.jdk.AbstractJDKChecker;
-import org.jboss.classloader.spi.ClassLoaderDomain;
-import org.jboss.classloader.spi.ClassLoaderSystem;
-import org.jboss.classloader.spi.ParentPolicy;
-import org.jboss.classloader.spi.filter.ClassFilter;
-import org.jboss.classloader.spi.filter.RecursivePackageClassFilter;
-import org.jboss.osgi.plugins.facade.bundle.OSGiBundleState;
-
-/**
- * OSGiClassLoaderSystem.<p>
- *
- * TODO Figure out how to make this more easily configurable
- *
- * @author <a href="adrian(a)jboss.com">Adrian Brock</a>
- * @version $Revision: 1.1 $
- */
-public class OSGiClassLoaderSystem extends ClassLoaderSystem
-{
- /**
- * Create a new OSGiClassLoaderSystem.
- */
- public OSGiClassLoaderSystem()
- {
- ClassLoaderDomain domain = getDefaultDomain();
- PatternClassFilter filter = RecursivePackageClassFilter.createRecursivePackageClassFilterFromString("org.osgi");
- filter.setIncludeJava(true);
- domain.setParentPolicy(new ParentPolicy(filter, ClassFilter.NOTHING));
- AbstractJDKChecker.getExcluded().add(OSGiBundleState.class);
- }
-
- @Override
- protected ClassLoaderDomain createDomain(String name)
- {
- return new ClassLoaderDomain(name);
- }
-}
\ No newline at end of file
Modified: projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/test/resources/bootstrap/bootstrap.xml
===================================================================
--- projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/test/resources/bootstrap/bootstrap.xml 2009-08-24 10:07:22 UTC (rev 92734)
+++ projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/test/resources/bootstrap/bootstrap.xml 2009-08-24 10:42:39 UTC (rev 92735)
@@ -10,10 +10,20 @@
<bean name="OSGiBundleManager" class="org.jboss.osgi.plugins.facade.bundle.OSGiBundleManager">
<constructor><parameter><inject bean="MainDeployer" /></parameter></constructor>
+ <property name="properties">
+ <map keyClass="java.lang.String" valueClass="java.lang.String">
+ <entry><key>org.osgi.framework.storage</key><value>${log4j.output.dir}/osgi-store</value></entry>
+ <entry><key>org.osgi.framework.storage.clean</key><value>onFirstInit</value></entry>
+ </map>
+ </property>
<incallback method="addPlugin" />
<uncallback method="removePlugin" />
</bean>
+ <bean name="OSGiSystemPackages" class="org.jboss.osgi.plugins.facade.plugins.SystemPackagesPluginImpl">
+ <constructor><parameter><inject bean="OSGiBundleManager" /></parameter></constructor>
+ </bean>
+
<bean name="OSGiStoragePlugin" class="org.jboss.osgi.plugins.facade.plugins.BundleStoragePluginImpl">
<constructor><parameter><inject bean="OSGiBundleManager" /></parameter></constructor>
</bean>
@@ -70,11 +80,11 @@
<!-- OSGI Deployment -->
<bean name="OSGiManifestParsingDeployer" class="org.jboss.osgi.plugins.deployers.bundle.OSGiManifestParsingDeployer" />
<bean name="OSGiBundleStateDeployer" class="org.jboss.osgi.plugins.deployers.bundle.OSGiBundleStateDeployer">
- <constructor>
- <parameter><inject bean="OSGiBundleManager" /></parameter>
- </constructor>
+ <constructor><parameter><inject bean="OSGiBundleManager" /></parameter></constructor>
</bean>
- <bean name="OSGiBundleClassLoadingDeployer" class="org.jboss.osgi.plugins.deployers.bundle.OSGiBundleClassLoadingDeployer" />
+ <bean name="OSGiBundleClassLoadingDeployer" class="org.jboss.osgi.plugins.deployers.bundle.OSGiBundleClassLoadingDeployer" >
+ <constructor><parameter><inject bean="OSGiBundleManager" /></parameter></constructor>
+ </bean>
<bean name="OSGiBundleActivatorDeployer" class="org.jboss.osgi.plugins.deployers.bundle.OSGiBundleActivatorDeployer" />
<!--
@@ -86,17 +96,11 @@
-->
<!-- ClassLoading -->
- <bean name="ClassLoaderSystem" class="org.jboss.test.osgi.OSGiClassLoaderSystem" />
+ <bean name="ClassLoaderSystem" class="org.jboss.osgi.plugins.facade.classloading.OSGiClassLoaderSystem" />
<bean name="ClassLoading" class="org.jboss.classloading.spi.dependency.ClassLoading">
<incallback method="addModule" state="Configured" />
<uncallback method="removeModule" state="Configured" />
</bean>
- <bean name="ClassLoadingMetaDataParser" class="org.jboss.deployers.vfs.spi.deployer.SchemaResolverDeployer">
- <constructor>
- <parameter>org.jboss.classloading.spi.metadata.ClassLoadingMetaData</parameter>
- </constructor>
- <property name="name">jboss-classloading.xml</property>
- </bean>
<bean name="ClassLoadingDefaultDeployer" class="org.jboss.deployers.plugins.classloading.ClassLoadingDefaultDeployer">
<property name="defaultMetaData">
<classloading xmlns="urn:jboss:classloading:1.0" export-all="NON_EMPTY" import-all="true" />
16 years, 4 months
JBoss-OSGI SVN: r92733 - in projects/jboss-osgi/projects/runtime/microcontainer/trunk/src: main/java/org/jboss/osgi/plugins/facade/launch and 2 other directories.
by jboss-osgi-commits@lists.jboss.org
Author: thomas.diesler(a)jboss.com
Date: 2009-08-24 05:40:32 -0400 (Mon, 24 Aug 2009)
New Revision: 92733
Modified:
projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/main/java/org/jboss/osgi/plugins/facade/bundle/OSGiBundleManager.java
projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/main/java/org/jboss/osgi/plugins/facade/launch/OSGiFramework.java
projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/main/java/org/jboss/osgi/plugins/facade/launch/OSGiFrameworkFactory.java
projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/test/java/org/jboss/test/osgi/OSGiTestDelegate.java
projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/test/java/org/jboss/test/osgi/launch/FrameworkLaunchTestCase.java
Log:
Implement proper framework life cycle states on init() and start()
Modified: projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/main/java/org/jboss/osgi/plugins/facade/bundle/OSGiBundleManager.java
===================================================================
--- projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/main/java/org/jboss/osgi/plugins/facade/bundle/OSGiBundleManager.java 2009-08-24 09:18:23 UTC (rev 92732)
+++ projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/main/java/org/jboss/osgi/plugins/facade/bundle/OSGiBundleManager.java 2009-08-24 09:40:32 UTC (rev 92733)
@@ -55,6 +55,8 @@
import org.jboss.deployers.vfs.spi.client.VFSDeploymentFactory;
import org.jboss.logging.Logger;
import org.jboss.osgi.plugins.facade.api.AbstractPlugin;
+import org.jboss.osgi.plugins.facade.api.AutoInstallPlugin;
+import org.jboss.osgi.plugins.facade.api.BundleStoragePlugin;
import org.jboss.osgi.plugins.filter.NoFilter;
import org.jboss.osgi.plugins.metadata.AbstractOSGiMetaData;
import org.jboss.osgi.spi.metadata.OSGiMetaData;
@@ -162,16 +164,24 @@
{
if (deployerClient == null)
throw new IllegalArgumentException("Null deployerClient");
- this.deployerClient = deployerClient;
if (deployerClient instanceof MainDeployerStructure == false)
throw new IllegalArgumentException("Deployer client does not implement " + MainDeployerStructure.class.getName());
- deployerStructure = (MainDeployerStructure) deployerClient;
+
+ this.deployerClient = deployerClient;
+ this.deployerStructure = (MainDeployerStructure)deployerClient;
+
+ // TODO thread factory
if (executor == null)
- // TODO thread factory
executor = Executors.newFixedThreadPool(10);
+
this.executor = executor;
- // [TODO] populate metadata for system bundle
+ // Create the system bundle
+ createSystemBundle();
+ }
+
+ private void createSystemBundle()
+ {
Manifest manifest = new Manifest();
Attributes attributes = manifest.getMainAttributes();
attributes.put(new Name(Constants.BUNDLE_NAME), Constants.SYSTEM_BUNDLE_SYMBOLICNAME);
@@ -179,8 +189,6 @@
OSGiMetaData systemMetaData = new AbstractOSGiMetaData(manifest);
this.systemBundle = new OSGiSystemBundle(systemMetaData);
addBundle(systemBundle);
- // [TODO] integrate lifecycle with the underlying framework for stopping/updating
- startFramework();
}
/**
@@ -773,21 +781,61 @@
}
/**
+ * Init the Framework
+ */
+ public void initFramework()
+ {
+ int state = systemBundle.getState();
+
+ // This method does nothing if called when this Framework is in the STARTING, ACTIVE or STOPPING state
+ if (state == Bundle.STARTING || state == Bundle.ACTIVE || state == Bundle.STOPPING)
+ return;
+
+ // Put into the STARTING state
+ systemBundle.changeState(Bundle.STARTING);
+
+ // [TODO] Be at start level 0
+
+ // [TODO] Have event handling enabled
+
+ // Cleanup the storage area
+ String storageClean = (String)getProperty(Constants.FRAMEWORK_STORAGE_CLEAN);
+ BundleStoragePlugin storagePlugin = getOptionalPlugin(BundleStoragePlugin.class);
+ if (storagePlugin != null)
+ storagePlugin.cleanStorage(storageClean);
+ }
+
+ /**
* Start the framework
*/
- void startFramework()
+ public void startFramework() throws BundleException
{
- OSGiBundleState systemBundle = getSystemBundle();
- systemBundle.changeState(Bundle.STARTING);
- // [TODO] start the osgi framework, already installed bundles and start level, etc. (fire frameworkEvent.ERROR for errors)
+ // If this Framework is not in the STARTING state, initialize this Framework
+ if (systemBundle.getState() != Bundle.STARTING)
+ initFramework();
+
+ // Create the system bundl context
+ systemBundle.createBundleContext();
+
+ // All installed bundles must be started
+ AutoInstallPlugin autoInstall = getOptionalPlugin(AutoInstallPlugin.class);
+ if (autoInstall != null)
+ {
+ autoInstall.installBundles();
+ autoInstall.startBundles();
+ }
+
+ // This Framework's state is set to ACTIVE
systemBundle.changeState(Bundle.ACTIVE);
+
+ // A framework event of type STARTED is fired
systemBundle.fireFrameworkEvent(FrameworkEvent.STARTED, null);
}
/**
* Stop the framework
*/
- void stopFramework()
+ public void stopFramework()
{
OSGiBundleState systemBundle = getSystemBundle();
if (systemBundle.getState() != Bundle.ACTIVE)
@@ -817,7 +865,7 @@
*
* @param systemBundle the system bundle
*/
- void restartFramework()
+ public void restartFramework()
{
OSGiBundleState systemBundle = getSystemBundle();
if (systemBundle.getState() != Bundle.ACTIVE)
Modified: projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/main/java/org/jboss/osgi/plugins/facade/launch/OSGiFramework.java
===================================================================
--- projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/main/java/org/jboss/osgi/plugins/facade/launch/OSGiFramework.java 2009-08-24 09:18:23 UTC (rev 92732)
+++ projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/main/java/org/jboss/osgi/plugins/facade/launch/OSGiFramework.java 2009-08-24 09:40:32 UTC (rev 92733)
@@ -46,30 +46,28 @@
final Logger log = Logger.getLogger(OSGiFramework.class);
private OSGiBundleManager bundleManager;
- private OSGiBundleState bundleState;
public OSGiFramework(OSGiBundleManager bundleManager, OSGiBundleState bundleState)
{
super(bundleState);
this.bundleManager = bundleManager;
- this.bundleState = bundleState;
}
public void init() throws BundleException
{
- initInternal();
+ bundleManager.initFramework();
}
@Override
public void start() throws BundleException
{
- startInternal();
+ bundleManager.startFramework();
}
@Override
public void start(int options) throws BundleException
{
- startInternal();
+ bundleManager.startFramework();
}
@Override
@@ -77,7 +75,7 @@
{
// [TODO] The method returns immediately to the caller after initiating the following steps
- stopInternal();
+ bundleManager.stopFramework();
}
@Override
@@ -85,13 +83,13 @@
{
// [TODO] The method returns immediately to the caller after initiating the following steps
- stopInternal();
+ bundleManager.stopFramework();
}
@Override
public void update() throws BundleException
{
- updateInternal();
+ bundleManager.restartFramework();
}
/**
@@ -114,7 +112,7 @@
// [TODO] The method returns immediately to the caller after initiating the following steps
- updateInternal();
+ bundleManager.restartFramework();
}
/**
@@ -128,70 +126,6 @@
throw new BundleException("The system bundle cannot be uninstalled");
}
- private void initInternal()
- {
- // This method does nothing if called when this Framework is in the
- // STARTING, ACTIVE or STOPPING state
- if (getState() == STARTING || getState() == ACTIVE || getState() == STOPPING)
- return;
-
- // Put into the STARTING state
- bundleState.changeState(STARTING);
-
- // Have a valid Bundle Context
- bundleState.createBundleContext();
-
- // [TODO] Be at start level 0
-
- // [TODO] Have event handling enabled
-
- // [TODO] Cleanup the storage area
-
- // [TODO] Have reified Bundle objects for all installed bundles
-
- // [TODO] Have registered any framework services
- }
-
- private void startInternal() throws BundleException
- {
- // If this Framework is not in the STARTING state, initialize this Framework
- if (getState() != STARTING)
- initInternal();
-
- // All installed bundles must be started
-
- // This Framework's state is set to ACTIVE
- bundleState.changeState(ACTIVE);
-
- // [TODO] A framework event of type STARTED is fired
- }
-
- private void stopInternal()
- {
- // This Framework's state is set to STOPPING
- bundleState.changeState(STOPPING);
-
- // [TODO] All installed bundles must be stopped
-
- // [TODO] Unregister all services registered by this Framework
-
- // [TODO] Event handling is disabled
-
- // This Framework's state is set to RESOLVED
- bundleState.changeState(RESOLVED);
-
- // [TODO] All resources held by this Framework are released.
-
- // [TODO] Notify all threads that are waiting at waitForStop(long)
- }
-
- private void updateInternal() throws BundleException
- {
- stopInternal();
-
- startInternal();
- }
-
public FrameworkEvent waitForStop(long timeout) throws InterruptedException
{
// [TODO] Wait until this Framework has completely stopped.
Modified: projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/main/java/org/jboss/osgi/plugins/facade/launch/OSGiFrameworkFactory.java
===================================================================
--- projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/main/java/org/jboss/osgi/plugins/facade/launch/OSGiFrameworkFactory.java 2009-08-24 09:18:23 UTC (rev 92732)
+++ projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/main/java/org/jboss/osgi/plugins/facade/launch/OSGiFrameworkFactory.java 2009-08-24 09:40:32 UTC (rev 92733)
@@ -35,7 +35,6 @@
import org.jboss.logging.Logger;
import org.jboss.osgi.plugins.facade.bundle.OSGiBundleManager;
import org.jboss.osgi.plugins.facade.bundle.OSGiBundleState;
-import org.osgi.framework.Bundle;
import org.osgi.framework.launch.Framework;
import org.osgi.framework.launch.FrameworkFactory;
@@ -87,11 +86,7 @@
OSGiBundleManager manager = (OSGiBundleManager)managerContext.getTarget();
OSGiBundleState sysBundle = manager.getBundle(0);
-
- // [TODO] Remove hack that forces the initial state to installed
- if (sysBundle.getState() != Bundle.INSTALLED)
- sysBundle.changeState(Bundle.INSTALLED);
-
+
return new OSGiFramework(manager, sysBundle);
}
Modified: projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/test/java/org/jboss/test/osgi/OSGiTestDelegate.java
===================================================================
--- projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/test/java/org/jboss/test/osgi/OSGiTestDelegate.java 2009-08-24 09:18:23 UTC (rev 92732)
+++ projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/test/java/org/jboss/test/osgi/OSGiTestDelegate.java 2009-08-24 09:40:32 UTC (rev 92733)
@@ -41,6 +41,7 @@
import org.jboss.virtual.plugins.context.jar.JarUtils;
import org.jboss.virtual.plugins.vfs.helpers.SuffixesExcludeFilter;
import org.osgi.framework.Bundle;
+import org.osgi.framework.BundleException;
/**
* A OSGiTestDelegate
@@ -159,7 +160,18 @@
protected OSGiBundleManager getBundleManager()
{
if (bundleManager == null)
+ {
bundleManager = getBean("OSGiBundleManager", ControllerState.INSTALLED, OSGiBundleManager.class);
+ try
+ {
+ if (bundleManager.isActive() == false)
+ bundleManager.startFramework();
+ }
+ catch (BundleException ex)
+ {
+ throw new IllegalStateException("Cannot start bundle manager", ex);
+ }
+ }
return bundleManager;
}
Modified: projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/test/java/org/jboss/test/osgi/launch/FrameworkLaunchTestCase.java
===================================================================
--- projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/test/java/org/jboss/test/osgi/launch/FrameworkLaunchTestCase.java 2009-08-24 09:18:23 UTC (rev 92732)
+++ projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/test/java/org/jboss/test/osgi/launch/FrameworkLaunchTestCase.java 2009-08-24 09:40:32 UTC (rev 92733)
@@ -25,8 +25,10 @@
import static org.junit.Assert.assertEquals;
+import org.jboss.osgi.spi.util.ConstantsHelper;
import org.jboss.osgi.spi.util.ServiceLoader;
import org.junit.Test;
+import org.osgi.framework.BundleException;
import org.osgi.framework.launch.Framework;
import org.osgi.framework.launch.FrameworkFactory;
@@ -39,12 +41,25 @@
public class FrameworkLaunchTestCase
{
@Test
- public void testFrameworkLaunch()
+ public void testFrameworkLaunch() throws BundleException
{
FrameworkFactory factory = ServiceLoader.loadService(FrameworkFactory.class);
Framework framework = factory.newFramework(null);
assertEquals("BundleId == 0", 0, framework.getBundleId());
assertEquals("SymbolicName", "system.bundle", framework.getSymbolicName());
+
+ String state = ConstantsHelper.bundleState(framework.getState());
+ assertEquals("INSTALLED", state);
+
+ framework.init();
+
+ state = ConstantsHelper.bundleState(framework.getState());
+ assertEquals("STARTING", state);
+
+ framework.start();
+
+ state = ConstantsHelper.bundleState(framework.getState());
+ assertEquals("ACTIVE", state);
}
}
\ No newline at end of file
16 years, 4 months
JBoss-OSGI SVN: r92729 - projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/test/java/org/jboss/test/osgi/filter/test.
by jboss-osgi-commits@lists.jboss.org
Author: thomas.diesler(a)jboss.com
Date: 2009-08-24 03:45:17 -0400 (Mon, 24 Aug 2009)
New Revision: 92729
Modified:
projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/test/java/org/jboss/test/osgi/filter/test/AbstractFilterTest.java
Log:
[JBOSGI-129] Filter behaviour change in r4v42
document/assert current behaviour
Modified: projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/test/java/org/jboss/test/osgi/filter/test/AbstractFilterTest.java
===================================================================
--- projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/test/java/org/jboss/test/osgi/filter/test/AbstractFilterTest.java 2009-08-24 07:29:41 UTC (rev 92728)
+++ projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/test/java/org/jboss/test/osgi/filter/test/AbstractFilterTest.java 2009-08-24 07:45:17 UTC (rev 92729)
@@ -86,7 +86,7 @@
assertInvalid("(>=b)");
assertInvalid("(~=b)");
System.out.println("FIXME [JBOSGI-129] - Invalid (*=b)");
- //assertInvalid("(*=b)");
+ assertNoMatch("(*=b)", properties);
assertInvalid("(a=\\)");
assertMatch("(a=b)", properties);
@@ -95,7 +95,7 @@
assertMatch("(c= d)", properties);
assertMatch("(e=f )", properties);
System.out.println("FIXME [JBOSGI-129] - NoMatch (a=)");
- // assertNoMatch("(a=)", properties);
+ assertInvalid("(a=)");
assertNoMatch("(a=c)", properties);
assertNoMatch("(x=c)", properties);
@@ -124,16 +124,24 @@
assertMatch("( a<=2)", properties);
assertMatch("(a <=2)", properties);
System.out.println("FIXME [JBOSGI-129] - NoMatch (a<= 2)");
- // assertNoMatch("(a<= 2)", properties);
+ assertMatch("(a<= 2)", properties);
System.out.println("FIXME [JBOSGI-129] - NoMatch (a<=2 )");
- // assertNoMatch("(a<=2 )", properties);
+ assertMatch("(a<=2 )", properties);
assertNoMatch("(a<=0)", properties);
assertNoMatch("( a<=0)", properties);
assertNoMatch("(a <=0)", properties);
assertNoMatch("(a<= 0)", properties);
assertNoMatch("(a<=0 )", properties);
System.out.println("FIXME [JBOSGI-129] - NoMatch (a<= )");
- // assertNoMatch("(a<= )", properties);
+ try
+ {
+ assertNoMatch("(a<= )", properties);
+ fail("NumberFormatException expected");
+ }
+ catch (NumberFormatException e)
+ {
+ // expected
+ }
assertMatch("(string<=3)", properties);
assertMatch("(string<=3 )", properties);
@@ -158,16 +166,24 @@
assertMatch("( a>=0)", properties);
assertMatch("(a >=0)", properties);
System.out.println("FIXME [JBOSGI-129] - NoMatch (a>= 0)");
- // assertNoMatch("(a>= 0)", properties);
+ assertMatch("(a>= 0)", properties);
System.out.println("FIXME [JBOSGI-129] - NoMatch (a>=0 )");
- //assertNoMatch("(a>=0 )", properties);
+ assertMatch("(a>=0 )", properties);
assertNoMatch("(a>=2)", properties);
assertNoMatch("( a>=2)", properties);
assertNoMatch("(a >=2)", properties);
assertNoMatch("(a>= 2)", properties);
assertNoMatch("(a>=2 )", properties);
System.out.println("FIXME [JBOSGI-129] - NoMatch (a>= )");
- // assertNoMatch("(a>= )", properties);
+ try
+ {
+ assertNoMatch("(a>= )", properties);
+ fail("NumberFormatException expected");
+ }
+ catch (NumberFormatException e)
+ {
+ // expected
+ }
assertMatch("(string>=1)", properties);
assertMatch("(string>=1 )", properties);
16 years, 4 months
JBoss-OSGI SVN: r92727 - in projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/main/java/org/jboss/osgi/plugins: facade/bundle and 2 other directories.
by jboss-osgi-commits@lists.jboss.org
Author: thomas.diesler(a)jboss.com
Date: 2009-08-24 02:41:09 -0400 (Mon, 24 Aug 2009)
New Revision: 92727
Modified:
projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/main/java/org/jboss/osgi/plugins/deployers/bundle/OSGiBundleClassLoadingDeployer.java
projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/main/java/org/jboss/osgi/plugins/facade/bundle/OSGiBundleManager.java
projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/main/java/org/jboss/osgi/plugins/facade/bundle/OSGiBundleState.java
projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/main/java/org/jboss/osgi/plugins/facade/bundle/OSGiServiceState.java
projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/main/java/org/jboss/osgi/plugins/framework/AdminPermission.java
projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/main/java/org/jboss/osgi/plugins/metadata/AbstractVersionRange.java
Log:
Replace 'todo' with [TODO] so they show up in eclipse
Modified: projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/main/java/org/jboss/osgi/plugins/deployers/bundle/OSGiBundleClassLoadingDeployer.java
===================================================================
--- projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/main/java/org/jboss/osgi/plugins/deployers/bundle/OSGiBundleClassLoadingDeployer.java 2009-08-24 06:25:01 UTC (rev 92726)
+++ projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/main/java/org/jboss/osgi/plugins/deployers/bundle/OSGiBundleClassLoadingDeployer.java 2009-08-24 06:41:09 UTC (rev 92727)
@@ -42,7 +42,7 @@
*
* This deployer maps osgi metadata into our classloading metadata.
*
- * todo versions and attributes todo require-bundle, dynamic-imports, etc.
+ * [TODO] versions and attributes [TODO] require-bundle, dynamic-imports, etc.
*
* @author <a href="adrian(a)jboss.com">Adrian Brock</a>
* @version $Revision: 1.1 $
Modified: projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/main/java/org/jboss/osgi/plugins/facade/bundle/OSGiBundleManager.java
===================================================================
--- projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/main/java/org/jboss/osgi/plugins/facade/bundle/OSGiBundleManager.java 2009-08-24 06:25:01 UTC (rev 92726)
+++ projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/main/java/org/jboss/osgi/plugins/facade/bundle/OSGiBundleManager.java 2009-08-24 06:41:09 UTC (rev 92727)
@@ -86,10 +86,10 @@
public static final String BEAN_BUNDLE_MANAGER = "OSGiBundleManager";
/** The framework version */
- private static String OSGi_FRAMEWORK_VERSION = "r4v42"; // todo externalise
+ private static String OSGi_FRAMEWORK_VERSION = "r4v42"; // [TODO] externalise
/** The framework vendor */
- private static String OSGi_FRAMEWORK_VENDOR = "jboss.org"; // todo externalise
+ private static String OSGi_FRAMEWORK_VENDOR = "jboss.org"; // [TODO] externalise
/** The framework language */
private static String OSGi_FRAMEWORK_LANGUAGE = Locale.getDefault().getISO3Language(); // REVIEW correct?
@@ -171,7 +171,7 @@
executor = Executors.newFixedThreadPool(10);
this.executor = executor;
- // todo populate metadata for system bundle
+ // [TODO] populate metadata for system bundle
Manifest manifest = new Manifest();
Attributes attributes = manifest.getMainAttributes();
attributes.put(new Name(Constants.BUNDLE_NAME), Constants.SYSTEM_BUNDLE_SYMBOLICNAME);
@@ -179,7 +179,7 @@
OSGiMetaData systemMetaData = new AbstractOSGiMetaData(manifest);
this.systemBundle = new OSGiSystemBundle(systemMetaData);
addBundle(systemBundle);
- // todo integrate lifecycle with the underlying framework for stopping/updating
+ // [TODO] integrate lifecycle with the underlying framework for stopping/updating
startFramework();
}
@@ -375,10 +375,10 @@
if (osgiMetaData == null)
{
Manifest manifest = unit.getAttachment(Manifest.class);
- // todo we need a mechanism to construct an OSGiMetaData from an easier factory
+ // [TODO] we need a mechanism to construct an OSGiMetaData from an easier factory
if (manifest == null)
manifest = new Manifest();
- // todo populate some bundle information
+ // [TODO] populate some bundle information
Attributes attributes = manifest.getMainAttributes();
attributes.put(new Name(Constants.BUNDLE_NAME), unit.getName());
attributes.put(new Name(Constants.BUNDLE_SYMBOLICNAME), unit.getName());
@@ -386,7 +386,7 @@
}
else
{
- // todo look at manifest headers and persistent state for this
+ // [TODO] look at manifest headers and persistent state for this
unit.setRequiredStage(DeploymentStages.DESCRIBE);
}
OSGiBundleState bundleState = new OSGiBundleState(osgiMetaData, unit);
@@ -509,7 +509,7 @@
{
try
{
- // todo check actually changed state
+ // [TODO] check actually changed state
deployerClient.change(bundleState.getDeploymentUnit().getName(), DeploymentStages.CLASSLOADER);
return true;
}
@@ -779,7 +779,7 @@
{
OSGiBundleState systemBundle = getSystemBundle();
systemBundle.changeState(Bundle.STARTING);
- // todo start the osgi framework, already installed bundles and start level, etc. (fire frameworkEvent.ERROR for errors)
+ // [TODO] start the osgi framework, already installed bundles and start level, etc. (fire frameworkEvent.ERROR for errors)
systemBundle.changeState(Bundle.ACTIVE);
systemBundle.fireFrameworkEvent(FrameworkEvent.STARTED, null);
}
@@ -800,7 +800,7 @@
{
try
{
- // todo don't change the persistent state
+ // [TODO] don't change the persistent state
bundle.stop();
}
catch (Throwable t)
@@ -829,7 +829,7 @@
{
try
{
- // todo don't change the persistent state
+ // [TODO] don't change the persistent state
bundle.stop();
}
catch (Throwable t)
Modified: projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/main/java/org/jboss/osgi/plugins/facade/bundle/OSGiBundleState.java
===================================================================
--- projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/main/java/org/jboss/osgi/plugins/facade/bundle/OSGiBundleState.java 2009-08-24 06:25:01 UTC (rev 92726)
+++ projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/main/java/org/jboss/osgi/plugins/facade/bundle/OSGiBundleState.java 2009-08-24 06:41:09 UTC (rev 92727)
@@ -315,8 +315,8 @@
public File getDataFile(String filename)
{
checkValidBundleContext();
- BundleStoragePlugin storagePlugin = bundleManager.getPlugin(BundleStoragePlugin.class);
- return storagePlugin.getDataFile(this, filename);
+ BundleStoragePlugin storagePlugin = bundleManager.getOptionalPlugin(BundleStoragePlugin.class);
+ return storagePlugin != null ? storagePlugin.getDataFile(this, filename) : null;
}
public URL getEntry(String path)
@@ -376,7 +376,7 @@
if (noAdminPermission(AdminPermission.RESOURCE))
return null;
- // todo fragments
+ // [TODO] fragments
resolve(false);
if (filePattern == null)
@@ -409,7 +409,7 @@
{
checkInstalled();
checkAdminPermission(AdminPermission.CLASS);
- // todo bundle fragment
+ // [TODO] bundle fragment
try
{
@@ -428,7 +428,7 @@
checkInstalled();
if (noAdminPermission(AdminPermission.RESOURCE))
return null;
- // todo bundle fragment
+ // [TODO] bundle fragment
// return null;
if (resolve(false) == false)
return getDeploymentUnit().getResourceLoader().getResource(name);
@@ -441,7 +441,7 @@
checkInstalled();
if (noAdminPermission(AdminPermission.RESOURCE))
return null;
- // todo bundle fragment
+ // [TODO] bundle fragment
// return null;
if (resolve(false) == false)
return getDeploymentUnit().getResourceLoader().getResources(name);
@@ -457,7 +457,7 @@
if (sm == null)
return true;
- // todo hasPermission
+ // [TODO] hasPermission
return true;
}
@@ -725,7 +725,7 @@
start(0);
}
- // todo options
+ // [TODO] options
public void start(int options) throws BundleException
{
checkInstalled();
@@ -740,11 +740,11 @@
/**
* Start internal
*
- * todo Start Level Service & START_TRANSIENT?
- * todo START_ACTIVATION_POLICY
- * todo LAZY_ACTIVATION
- * todo locks
- * todo options
+ * [TODO] Start Level Service & START_TRANSIENT?
+ * [TODO] START_ACTIVATION_POLICY
+ * [TODO] LAZY_ACTIVATION
+ * [TODO] locks
+ * [TODO] options
* @throws Throwable for any error
*/
public void startInternal() throws Throwable
@@ -798,7 +798,7 @@
stop(0);
}
- // todo options
+ // [TODO] options
public void stop(int options) throws BundleException
{
checkInstalled();
@@ -813,9 +813,9 @@
/**
* Stop Internal
*
- * todo Start Level Service & STOP_TRANSIENT?
- * todo locks
- * todo options
+ * [TODO] Start Level Service & STOP_TRANSIENT?
+ * [TODO] locks
+ * [TODO] options
* @throws Throwable for any error
*/
public void stopInternal() throws Throwable
@@ -885,21 +885,21 @@
public void update() throws BundleException
{
- checkAdminPermission(AdminPermission.LIFECYCLE); // todo extension bundles
- // todo update
+ checkAdminPermission(AdminPermission.LIFECYCLE); // [TODO] extension bundles
+ // [TODO] update
throw new UnsupportedOperationException("update");
}
public void update(InputStream in) throws BundleException
{
- checkAdminPermission(AdminPermission.LIFECYCLE); // todo extension bundles
- // todo update
+ checkAdminPermission(AdminPermission.LIFECYCLE); // [TODO] extension bundles
+ // [TODO] update
throw new UnsupportedOperationException("update");
}
public void uninstall() throws BundleException
{
- checkAdminPermission(AdminPermission.LIFECYCLE); // todo extension bundles
+ checkAdminPermission(AdminPermission.LIFECYCLE); // [TODO] extension bundles
OSGiBundleManager bundleManager = getBundleManager();
if (bundleManager == null)
@@ -943,15 +943,15 @@
public Bundle installBundle(String location, InputStream input) throws BundleException
{
checkValidBundleContext();
- checkAdminPermission(AdminPermission.LIFECYCLE); // todo extension bundles
- // todo installBundle
+ checkAdminPermission(AdminPermission.LIFECYCLE); // [TODO] extension bundles
+ // [TODO] installBundle
throw new UnsupportedOperationException("installBundle");
}
public Bundle installBundle(String location) throws BundleException
{
checkValidBundleContext();
- checkAdminPermission(AdminPermission.LIFECYCLE); // todo extension bundles
+ checkAdminPermission(AdminPermission.LIFECYCLE); // [TODO] extension bundles
OSGiBundleManager bundleManager = getBundleManager();
if (bundleManager == null)
@@ -1017,7 +1017,7 @@
*/
Object getSource(String className)
{
- // todo some more efficient way than using the class?
+ // [TODO] some more efficient way than using the class?
try
{
return loadClass(className);
Modified: projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/main/java/org/jboss/osgi/plugins/facade/bundle/OSGiServiceState.java
===================================================================
--- projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/main/java/org/jboss/osgi/plugins/facade/bundle/OSGiServiceState.java 2009-08-24 06:25:01 UTC (rev 92726)
+++ projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/main/java/org/jboss/osgi/plugins/facade/bundle/OSGiServiceState.java 2009-08-24 06:41:09 UTC (rev 92727)
@@ -167,7 +167,7 @@
*/
public Object getService()
{
- // todo fix race condition with unregistration
+ // [TODO] fix race condition with unregistration
if (isUnregistered())
return null;
checkPermission("get", false);
@@ -536,7 +536,7 @@
try
{
Class<?> clazz = getBundleState().loadClass(className);
- // todo show classloader information all interfaces for debugging purposes
+ // [TODO] show classloader information all interfaces for debugging purposes
if (clazz.isInstance(object) == false)
throw new IllegalArgumentException(object + " of type " + object.getClass().getName() + " does not implement " + className);
}
Modified: projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/main/java/org/jboss/osgi/plugins/framework/AdminPermission.java
===================================================================
--- projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/main/java/org/jboss/osgi/plugins/framework/AdminPermission.java 2009-08-24 06:25:01 UTC (rev 92726)
+++ projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/main/java/org/jboss/osgi/plugins/framework/AdminPermission.java 2009-08-24 06:41:09 UTC (rev 92727)
@@ -28,7 +28,7 @@
/**
* AdminPermission.
*
- * todo this properly
+ * [TODO] this properly
* @author <a href="adrian(a)jboss.com">Adrian Brock</a>
* @version $Revision: 1.1 $
*/
Modified: projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/main/java/org/jboss/osgi/plugins/metadata/AbstractVersionRange.java
===================================================================
--- projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/main/java/org/jboss/osgi/plugins/metadata/AbstractVersionRange.java 2009-08-24 06:25:01 UTC (rev 92726)
+++ projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/main/java/org/jboss/osgi/plugins/metadata/AbstractVersionRange.java 2009-08-24 06:41:09 UTC (rev 92727)
@@ -37,7 +37,7 @@
* floor ::= version
* ceiling ::= version
*
- * todo do we really need this extra class or just use our version range?
+ * [TODO] do we really need this extra class or just use our version range?
* @author Scott.Stark(a)jboss.org
* @author <a href="mailto:ales.justin@jboss.com">Ales Justin</a>
* @author adrian(a)jboss.org
16 years, 4 months
JBoss-OSGI SVN: r92725 - in projects/jboss-osgi/projects/runtime/microcontainer/trunk/src: main/java/org/jboss/osgi/plugins/facade/api and 4 other directories.
by jboss-osgi-commits@lists.jboss.org
Author: thomas.diesler(a)jboss.com
Date: 2009-08-24 02:19:18 -0400 (Mon, 24 Aug 2009)
New Revision: 92725
Added:
projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/main/java/org/jboss/osgi/plugins/facade/api/
projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/main/java/org/jboss/osgi/plugins/facade/api/AbstractPlugin.java
projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/main/java/org/jboss/osgi/plugins/facade/api/AutoInstallPlugin.java
projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/main/java/org/jboss/osgi/plugins/facade/api/BundleStoragePlugin.java
projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/main/java/org/jboss/osgi/plugins/facade/plugins/
projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/main/java/org/jboss/osgi/plugins/facade/plugins/AbstractPluginImpl.java
projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/main/java/org/jboss/osgi/plugins/facade/plugins/AutoInstallPluginImpl.java
projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/main/java/org/jboss/osgi/plugins/facade/plugins/BundleStoragePluginImpl.java
Modified:
projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/main/java/org/jboss/osgi/plugins/facade/bundle/OSGiBundleManager.java
projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/main/java/org/jboss/osgi/plugins/facade/bundle/OSGiBundleState.java
projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/test/java/org/jboss/test/osgi/bundle/test/BundleContextUnitTestCase.java
projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/test/resources/bootstrap/bootstrap.xml
Log:
[JBOSGI-134] Add support for BundleContext.getDataFile()
Added: projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/main/java/org/jboss/osgi/plugins/facade/api/AbstractPlugin.java
===================================================================
--- projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/main/java/org/jboss/osgi/plugins/facade/api/AbstractPlugin.java (rev 0)
+++ projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/main/java/org/jboss/osgi/plugins/facade/api/AbstractPlugin.java 2009-08-24 06:19:18 UTC (rev 92725)
@@ -0,0 +1,42 @@
+/*
+ * 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.plugins.facade.api;
+
+//$Id$
+
+import org.jboss.osgi.plugins.facade.bundle.OSGiBundleManager;
+
+/**
+ * The base of all framework plugins
+ *
+ * @author thomas.diesler(a)jboss.com
+ * @since 20-Aug-2009
+ */
+public interface AbstractPlugin
+{
+ OSGiBundleManager getBundleManager();
+
+ <T extends AbstractPlugin> T getPlugin(Class<T> clazz);
+
+ <T extends AbstractPlugin> T getOptionalPlugin(Class<T> clazz);
+
+}
\ No newline at end of file
Property changes on: projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/main/java/org/jboss/osgi/plugins/facade/api/AbstractPlugin.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added: projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/main/java/org/jboss/osgi/plugins/facade/api/AutoInstallPlugin.java
===================================================================
--- projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/main/java/org/jboss/osgi/plugins/facade/api/AutoInstallPlugin.java (rev 0)
+++ projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/main/java/org/jboss/osgi/plugins/facade/api/AutoInstallPlugin.java 2009-08-24 06:19:18 UTC (rev 92725)
@@ -0,0 +1,40 @@
+/*
+ * 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.plugins.facade.api;
+
+import org.osgi.framework.BundleException;
+
+
+//$Id$
+
+/**
+ * A plugin that installs/starts bundles on framework startup.
+ *
+ * @author thomas.diesler(a)jboss.com
+ * @since 18-Aug-2009
+ */
+public interface AutoInstallPlugin extends AbstractPlugin
+{
+ void installBundles() throws BundleException;
+
+ void startBundles() throws BundleException;
+}
\ No newline at end of file
Property changes on: projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/main/java/org/jboss/osgi/plugins/facade/api/AutoInstallPlugin.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added: projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/main/java/org/jboss/osgi/plugins/facade/api/BundleStoragePlugin.java
===================================================================
--- projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/main/java/org/jboss/osgi/plugins/facade/api/BundleStoragePlugin.java (rev 0)
+++ projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/main/java/org/jboss/osgi/plugins/facade/api/BundleStoragePlugin.java 2009-08-24 06:19:18 UTC (rev 92725)
@@ -0,0 +1,44 @@
+/*
+ * 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.plugins.facade.api;
+
+// $Id$
+
+import java.io.File;
+
+import org.osgi.framework.Bundle;
+
+/**
+ * An abstraction of a bundle persistent storage system.
+ *
+ * @author thomas.diesler(a)jboss.com
+ * @since 18-Aug-2009
+ */
+public interface BundleStoragePlugin extends AbstractPlugin
+{
+ void cleanStorage(String propValue);
+
+ File getStorageDir(Bundle bundle);
+
+ File getDataFile(Bundle bundle, String filename);
+
+}
\ No newline at end of file
Property changes on: projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/main/java/org/jboss/osgi/plugins/facade/api/BundleStoragePlugin.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Modified: projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/main/java/org/jboss/osgi/plugins/facade/bundle/OSGiBundleManager.java
===================================================================
--- projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/main/java/org/jboss/osgi/plugins/facade/bundle/OSGiBundleManager.java 2009-08-24 05:53:22 UTC (rev 92724)
+++ projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/main/java/org/jboss/osgi/plugins/facade/bundle/OSGiBundleManager.java 2009-08-24 06:19:18 UTC (rev 92725)
@@ -28,6 +28,7 @@
import java.util.Collection;
import java.util.Comparator;
import java.util.Dictionary;
+import java.util.HashMap;
import java.util.Locale;
import java.util.Map;
import java.util.Set;
@@ -53,6 +54,7 @@
import org.jboss.deployers.vfs.spi.client.VFSDeployment;
import org.jboss.deployers.vfs.spi.client.VFSDeploymentFactory;
import org.jboss.logging.Logger;
+import org.jboss.osgi.plugins.facade.api.AbstractPlugin;
import org.jboss.osgi.plugins.filter.NoFilter;
import org.jboss.osgi.plugins.metadata.AbstractOSGiMetaData;
import org.jboss.osgi.spi.metadata.OSGiMetaData;
@@ -79,6 +81,9 @@
{
/** The log */
private static final Logger log = Logger.getLogger(OSGiBundleManager.class);
+
+ /** The bundle manager's bean name: OSGiBundleManager */
+ public static final String BEAN_BUNDLE_MANAGER = "OSGiBundleManager";
/** The framework version */
private static String OSGi_FRAMEWORK_VERSION = "r4v42"; // todo externalise
@@ -115,9 +120,10 @@
/** The system bundle */
private OSGiSystemBundle systemBundle;
-
- public static final String BEAN_BUNDLE_MANAGER = "OSGiBundleManager";
+ /** The registered manager plugins */
+ private Map<Class<?>, AbstractPlugin> plugins = new HashMap<Class<?>, AbstractPlugin>();
+
static
{
AccessController.doPrivileged(new PrivilegedAction<Object>()
@@ -178,6 +184,62 @@
}
/**
+ * Get a plugin that is registered with the bundle manager.
+ * @throws IllegalStateException if the requested plugin class is not registered
+ */
+ @SuppressWarnings("unchecked")
+ public <T extends AbstractPlugin> T getPlugin(Class<T> clazz)
+ {
+ T plugin = (T)plugins.get(clazz);
+ if (plugin == null)
+ throw new IllegalStateException("Cannot obtain plugin for: " + clazz.getName());
+
+ return plugin;
+ }
+
+ /**
+ * Get an optional plugin that is registered with the bundle manager.
+ * @return The plugin instance or null if the requested plugin class is not registered
+ */
+ @SuppressWarnings("unchecked")
+ public <T extends AbstractPlugin> T getOptionalPlugin(Class<T> clazz)
+ {
+ return (T)plugins.get(clazz);
+ }
+
+ /**
+ * Add a plugin
+ */
+ public void addPlugin(AbstractPlugin plugin)
+ {
+ Class<? extends AbstractPlugin> clazz = plugin.getClass();
+ for (Class<?> interf : clazz.getInterfaces())
+ {
+ if (AbstractPlugin.class.isAssignableFrom(interf))
+ {
+ log.debug("Add plugin: " + clazz.getName());
+ plugins.put(interf, plugin);
+ }
+ }
+ }
+
+ /**
+ * Add a plugin
+ */
+ public void removePlugin(AbstractPlugin plugin)
+ {
+ Class<? extends AbstractPlugin> clazz = plugin.getClass();
+ for (Class<?> interf : clazz.getInterfaces())
+ {
+ if (AbstractPlugin.class.isAssignableFrom(interf))
+ {
+ log.debug("Remove plugin: " + clazz.getName());
+ plugins.remove(interf);
+ }
+ }
+ }
+
+ /**
* Are we active
*
* @return true when the system is active
@@ -380,7 +442,7 @@
*
* @return the system bundle
*/
- OSGiSystemBundle getSystemBundle()
+ public OSGiSystemBundle getSystemBundle()
{
return systemBundle;
}
@@ -416,7 +478,7 @@
* @return the property
* @throws SecurityException if the caller doesn't have the relevant property permission
*/
- public static String getProperty(String key)
+ public String getProperty(String key)
{
if (key == null)
return null;
@@ -432,6 +494,7 @@
return OSGi_FRAMEWORK_OS_VERSION;
if (Constants.FRAMEWORK_PROCESSOR.equals(key))
return OSGi_FRAMEWORK_PROCESSOR;
+
return System.getProperty(key);
}
Modified: projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/main/java/org/jboss/osgi/plugins/facade/bundle/OSGiBundleState.java
===================================================================
--- projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/main/java/org/jboss/osgi/plugins/facade/bundle/OSGiBundleState.java 2009-08-24 05:53:22 UTC (rev 92724)
+++ projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/main/java/org/jboss/osgi/plugins/facade/bundle/OSGiBundleState.java 2009-08-24 06:19:18 UTC (rev 92725)
@@ -50,6 +50,7 @@
import org.jboss.deployers.vfs.spi.structure.VFSDeploymentUnit;
import org.jboss.kernel.spi.dependency.KernelController;
import org.jboss.logging.Logger;
+import org.jboss.osgi.plugins.facade.api.BundleStoragePlugin;
import org.jboss.osgi.plugins.filter.NoFilter;
import org.jboss.osgi.spi.NotImplementedException;
import org.jboss.osgi.spi.metadata.OSGiMetaData;
@@ -308,14 +309,14 @@
public String getProperty(String key)
{
checkValidBundleContext();
- return OSGiBundleManager.getProperty(key);
+ return bundleManager.getProperty(key);
}
public File getDataFile(String filename)
{
checkValidBundleContext();
- // todo getDataFile
- return null;
+ BundleStoragePlugin storagePlugin = bundleManager.getPlugin(BundleStoragePlugin.class);
+ return storagePlugin.getDataFile(this, filename);
}
public URL getEntry(String path)
Added: projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/main/java/org/jboss/osgi/plugins/facade/plugins/AbstractPluginImpl.java
===================================================================
--- projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/main/java/org/jboss/osgi/plugins/facade/plugins/AbstractPluginImpl.java (rev 0)
+++ projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/main/java/org/jboss/osgi/plugins/facade/plugins/AbstractPluginImpl.java 2009-08-24 06:19:18 UTC (rev 92725)
@@ -0,0 +1,58 @@
+/*
+ * 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.plugins.facade.plugins;
+
+//$Id$
+
+import org.jboss.osgi.plugins.facade.api.AbstractPlugin;
+import org.jboss.osgi.plugins.facade.bundle.OSGiBundleManager;
+
+/**
+ * The base class of all framework plugins.
+ *
+ * @author thomas.diesler(a)jboss.com
+ * @since 18-Aug-2009
+ */
+public abstract class AbstractPluginImpl implements AbstractPlugin
+{
+ protected OSGiBundleManager bundleManager;
+
+ public AbstractPluginImpl(OSGiBundleManager bundleManager)
+ {
+ this.bundleManager = bundleManager;
+ }
+
+ public OSGiBundleManager getBundleManager()
+ {
+ return bundleManager;
+ }
+
+ public <T extends AbstractPlugin> T getPlugin(Class<T> clazz)
+ {
+ return bundleManager.getPlugin(clazz);
+ }
+
+ public <T extends AbstractPlugin> T getOptionalPlugin(Class<T> clazz)
+ {
+ return bundleManager.getOptionalPlugin(clazz);
+ }
+}
\ No newline at end of file
Property changes on: projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/main/java/org/jboss/osgi/plugins/facade/plugins/AbstractPluginImpl.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added: projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/main/java/org/jboss/osgi/plugins/facade/plugins/AutoInstallPluginImpl.java
===================================================================
--- projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/main/java/org/jboss/osgi/plugins/facade/plugins/AutoInstallPluginImpl.java (rev 0)
+++ projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/main/java/org/jboss/osgi/plugins/facade/plugins/AutoInstallPluginImpl.java 2009-08-24 06:19:18 UTC (rev 92725)
@@ -0,0 +1,97 @@
+/*
+ * 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.plugins.facade.plugins;
+
+//$Id$
+
+import java.net.URL;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import org.jboss.logging.Logger;
+import org.jboss.osgi.plugins.facade.api.AutoInstallPlugin;
+import org.jboss.osgi.plugins.facade.bundle.OSGiBundleManager;
+import org.osgi.framework.Bundle;
+import org.osgi.framework.BundleException;
+
+/**
+ * A plugin that installs/starts bundles on framework startup.
+ *
+ * @author thomas.diesler(a)jboss.com
+ * @since 18-Aug-2009
+ */
+public class AutoInstallPluginImpl extends AbstractPluginImpl implements AutoInstallPlugin
+{
+ // Provide logging
+ final Logger log = Logger.getLogger(AutoInstallPluginImpl.class);
+
+ private List<URL> autoInstall;
+ private List<URL> autoStart;
+
+ private Map<URL, Bundle> autoBundles = new HashMap<URL, Bundle>();
+
+ public AutoInstallPluginImpl(OSGiBundleManager bundleManager)
+ {
+ super(bundleManager);
+ }
+
+
+ public void setAutoInstall(List<URL> autoInstall)
+ {
+ this.autoInstall = autoInstall;
+ }
+
+ public void setAutoStart(List<URL> autoStart)
+ {
+ this.autoStart = autoStart;
+ }
+
+ public void installBundles() throws BundleException
+ {
+ // Add the autoStart bundles to autoInstall
+ for (URL bundleURL : autoStart)
+ {
+ autoInstall.add(bundleURL);
+ }
+
+ // Install autoInstall bundles
+ for (URL bundleURL : autoInstall)
+ {
+ Bundle bundle = bundleManager.install(bundleURL);
+ autoBundles.put(bundleURL, bundle);
+ }
+ }
+
+ public void startBundles() throws BundleException
+ {
+ // Start autoStart bundles
+ for (URL bundleURL : autoStart)
+ {
+ Bundle bundle = autoBundles.get(bundleURL);
+ if (bundle != null)
+ {
+ bundle.start();
+ }
+ }
+ }
+}
\ No newline at end of file
Property changes on: projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/main/java/org/jboss/osgi/plugins/facade/plugins/AutoInstallPluginImpl.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added: projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/main/java/org/jboss/osgi/plugins/facade/plugins/BundleStoragePluginImpl.java
===================================================================
--- projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/main/java/org/jboss/osgi/plugins/facade/plugins/BundleStoragePluginImpl.java (rev 0)
+++ projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/main/java/org/jboss/osgi/plugins/facade/plugins/BundleStoragePluginImpl.java 2009-08-24 06:19:18 UTC (rev 92725)
@@ -0,0 +1,102 @@
+/*
+ * 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.plugins.facade.plugins;
+
+//$Id$
+
+import java.io.File;
+import java.io.IOException;
+
+import org.jboss.logging.Logger;
+import org.jboss.osgi.plugins.facade.api.BundleStoragePlugin;
+import org.jboss.osgi.plugins.facade.bundle.OSGiBundleManager;
+import org.osgi.framework.Bundle;
+import org.osgi.framework.Constants;
+
+/**
+ * A simple implementation of a BundleStorage
+ *
+ * @author thomas.diesler(a)jboss.com
+ * @since 18-Aug-2009
+ */
+public class BundleStoragePluginImpl extends AbstractPluginImpl implements BundleStoragePlugin
+{
+ // Provide logging
+ final Logger log = Logger.getLogger(BundleStoragePluginImpl.class);
+
+ private String storageArea;
+
+ public BundleStoragePluginImpl(OSGiBundleManager bundleManager)
+ {
+ super(bundleManager);
+ }
+
+ public void cleanStorage(String propValue)
+ {
+ // [TODO] Support values other than 'onFirstInit'
+ if (Constants.FRAMEWORK_STORAGE_CLEAN_ONFIRSTINIT.equals(propValue))
+ {
+ File storage = new File(getStorageArea());
+ storage.delete();
+ }
+ }
+
+ public File getDataFile(Bundle bundle, String filename)
+ {
+ File bundleDir = getStorageDir(bundle);
+ File dataFile = new File(bundleDir.getAbsolutePath() + "/" + filename);
+ dataFile.getParentFile().mkdirs();
+ return dataFile;
+ }
+
+ public File getStorageDir(Bundle bundle)
+ {
+ File bundleDir = new File(getStorageArea() + "/bundle-" + bundle.getBundleId());
+ if (bundleDir.exists() == false)
+ bundleDir.mkdirs();
+
+ return bundleDir;
+ }
+
+ private String getStorageArea()
+ {
+ if (storageArea == null)
+ {
+ String dirName = bundleManager.getProperty(Constants.FRAMEWORK_STORAGE);
+ if (dirName == null)
+ {
+ try
+ {
+ File tmpFile = File.createTempFile("Constants.FRAMEWORK_STORAGE", null);
+ dirName = tmpFile.getParent();
+ tmpFile.delete();
+ }
+ catch (IOException ex)
+ {
+ throw new IllegalStateException("Cannot create temp storage file", ex);
+ }
+ }
+ storageArea = dirName;
+ }
+ return storageArea;
+ }
+}
\ No newline at end of file
Property changes on: projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/main/java/org/jboss/osgi/plugins/facade/plugins/BundleStoragePluginImpl.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Modified: projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/test/java/org/jboss/test/osgi/bundle/test/BundleContextUnitTestCase.java
===================================================================
--- projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/test/java/org/jboss/test/osgi/bundle/test/BundleContextUnitTestCase.java 2009-08-24 05:53:22 UTC (rev 92724)
+++ projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/test/java/org/jboss/test/osgi/bundle/test/BundleContextUnitTestCase.java 2009-08-24 06:19:18 UTC (rev 92725)
@@ -21,6 +21,7 @@
*/
package org.jboss.test.osgi.bundle.test;
+import java.io.File;
import java.util.Arrays;
import java.util.Dictionary;
import java.util.HashSet;
@@ -488,7 +489,10 @@
bundle.start();
BundleContext bundleContext = bundle.getBundleContext();
assertNotNull(bundleContext);
- assertNull(bundleContext.getDataFile("blah"));
+
+ File dataFile = bundleContext.getDataFile("blah");
+ assertNotNull(dataFile);
+ assertTrue(dataFile.toString().endsWith("/blah"));
}
finally
{
Modified: projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/test/resources/bootstrap/bootstrap.xml
===================================================================
--- projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/test/resources/bootstrap/bootstrap.xml 2009-08-24 05:53:22 UTC (rev 92724)
+++ projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/test/resources/bootstrap/bootstrap.xml 2009-08-24 06:19:18 UTC (rev 92725)
@@ -10,8 +10,14 @@
<bean name="OSGiBundleManager" class="org.jboss.osgi.plugins.facade.bundle.OSGiBundleManager">
<constructor><parameter><inject bean="MainDeployer" /></parameter></constructor>
+ <incallback method="addPlugin" />
+ <uncallback method="removePlugin" />
</bean>
+ <bean name="OSGiStoragePlugin" class="org.jboss.osgi.plugins.facade.plugins.BundleStoragePluginImpl">
+ <constructor><parameter><inject bean="OSGiBundleManager" /></parameter></constructor>
+ </bean>
+
<!--
********************************
* *
16 years, 4 months
JBoss-OSGI SVN: r92701 - in projects/jboss-osgi: projects/runtime/equinox/trunk/src/main/java/org/jboss/osgi/equinox and 16 other directories.
by jboss-osgi-commits@lists.jboss.org
Author: thomas.diesler(a)jboss.com
Date: 2009-08-23 02:51:04 -0400 (Sun, 23 Aug 2009)
New Revision: 92701
Added:
projects/jboss-osgi/projects/runtime/equinox/trunk/src/main/java/org/jboss/osgi/equinox/EquinoxBootstrapProvider.java
projects/jboss-osgi/projects/runtime/felix/trunk/src/main/java/org/jboss/osgi/felix/FelixBootstrapProvider.java
projects/jboss-osgi/trunk/testsuite/example/src/test/resources/META-INF/bootstrap.xml
projects/jboss-osgi/trunk/testsuite/functional/src/test/resources/META-INF/bootstrap.xml
Modified:
projects/jboss-osgi/projects/runtime/equinox/trunk/pom.xml
projects/jboss-osgi/projects/runtime/felix/trunk/pom.xml
projects/jboss-osgi/projects/runtime/jbossas/trunk/pom.xml
projects/jboss-osgi/projects/runtime/microcontainer/trunk/pom.xml
projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/main/java/org/jboss/osgi/plugins/facade/launch/OSGiFrameworkFactory.java
projects/jboss-osgi/trunk/distribution/pom.xml
projects/jboss-osgi/trunk/pom.xml
projects/jboss-osgi/trunk/reactor/blueprint/pom.xml
projects/jboss-osgi/trunk/reactor/blueprint/testsuite/.project
projects/jboss-osgi/trunk/reactor/blueprint/testsuite/pom.xml
projects/jboss-osgi/trunk/reactor/runtime/jbossmc/pom.xml
projects/jboss-osgi/trunk/testsuite/example/src/test/resources/META-INF/services/org.jboss.osgi.spi.framework.OSGiBootstrapProvider
projects/jboss-osgi/trunk/testsuite/functional/src/test/resources/META-INF/services/org.jboss.osgi.spi.framework.OSGiBootstrapProvider
projects/jboss-osgi/trunk/testsuite/pom.xml
projects/jboss-osgi/trunk/testsuite/trailblazer/src/test/resources/META-INF/services/org.jboss.osgi.spi.framework.OSGiBootstrapProvider
Log:
Initial MC framework integration.
Example run still needs startup provisioning of compendium and jboss-osgi-common bundles.
Modified: projects/jboss-osgi/projects/runtime/equinox/trunk/pom.xml
===================================================================
--- projects/jboss-osgi/projects/runtime/equinox/trunk/pom.xml 2009-08-22 21:00:52 UTC (rev 92700)
+++ projects/jboss-osgi/projects/runtime/equinox/trunk/pom.xml 2009-08-23 06:51:04 UTC (rev 92701)
@@ -16,7 +16,7 @@
<name>JBossOSGi Runtime - Equinox</name>
- <groupId>org.jboss.osgi</groupId>
+ <groupId>org.jboss.osgi.runtime</groupId>
<artifactId>jboss-osgi-runtime-equinox</artifactId>
<packaging>jar</packaging>
Added: projects/jboss-osgi/projects/runtime/equinox/trunk/src/main/java/org/jboss/osgi/equinox/EquinoxBootstrapProvider.java
===================================================================
--- projects/jboss-osgi/projects/runtime/equinox/trunk/src/main/java/org/jboss/osgi/equinox/EquinoxBootstrapProvider.java (rev 0)
+++ projects/jboss-osgi/projects/runtime/equinox/trunk/src/main/java/org/jboss/osgi/equinox/EquinoxBootstrapProvider.java 2009-08-23 06:51:04 UTC (rev 92701)
@@ -0,0 +1,36 @@
+/*
+ * 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.equinox;
+
+//$Id$
+
+import org.jboss.osgi.spi.framework.PropertiesBootstrapProvider;
+
+/**
+ * A bootstrap provider for Equinox.
+ *
+ * @author thomas.diesler(a)jboss.com
+ * @since 23-Aug-2009
+ */
+public class EquinoxBootstrapProvider extends PropertiesBootstrapProvider
+{
+}
\ No newline at end of file
Property changes on: projects/jboss-osgi/projects/runtime/equinox/trunk/src/main/java/org/jboss/osgi/equinox/EquinoxBootstrapProvider.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Modified: projects/jboss-osgi/projects/runtime/felix/trunk/pom.xml
===================================================================
--- projects/jboss-osgi/projects/runtime/felix/trunk/pom.xml 2009-08-22 21:00:52 UTC (rev 92700)
+++ projects/jboss-osgi/projects/runtime/felix/trunk/pom.xml 2009-08-23 06:51:04 UTC (rev 92701)
@@ -16,7 +16,7 @@
<name>JBossOSGi Runtime - Felix</name>
- <groupId>org.jboss.osgi</groupId>
+ <groupId>org.jboss.osgi.runtime</groupId>
<artifactId>jboss-osgi-runtime-felix</artifactId>
<packaging>jar</packaging>
Added: projects/jboss-osgi/projects/runtime/felix/trunk/src/main/java/org/jboss/osgi/felix/FelixBootstrapProvider.java
===================================================================
--- projects/jboss-osgi/projects/runtime/felix/trunk/src/main/java/org/jboss/osgi/felix/FelixBootstrapProvider.java (rev 0)
+++ projects/jboss-osgi/projects/runtime/felix/trunk/src/main/java/org/jboss/osgi/felix/FelixBootstrapProvider.java 2009-08-23 06:51:04 UTC (rev 92701)
@@ -0,0 +1,36 @@
+/*
+ * 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.felix;
+
+//$Id$
+
+import org.jboss.osgi.spi.framework.PropertiesBootstrapProvider;
+
+/**
+ * A bootstrap provider for Felix.
+ *
+ * @author thomas.diesler(a)jboss.com
+ * @since 23-Aug-2009
+ */
+public class FelixBootstrapProvider extends PropertiesBootstrapProvider
+{
+}
\ No newline at end of file
Property changes on: projects/jboss-osgi/projects/runtime/felix/trunk/src/main/java/org/jboss/osgi/felix/FelixBootstrapProvider.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Modified: projects/jboss-osgi/projects/runtime/jbossas/trunk/pom.xml
===================================================================
--- projects/jboss-osgi/projects/runtime/jbossas/trunk/pom.xml 2009-08-22 21:00:52 UTC (rev 92700)
+++ projects/jboss-osgi/projects/runtime/jbossas/trunk/pom.xml 2009-08-23 06:51:04 UTC (rev 92701)
@@ -16,7 +16,7 @@
<name>JBossOSGi Runtime - JBossAS</name>
- <groupId>org.jboss.osgi</groupId>
+ <groupId>org.jboss.osgi.runtime</groupId>
<artifactId>jboss-osgi-runtime-jbossas</artifactId>
<packaging>jar</packaging>
Modified: projects/jboss-osgi/projects/runtime/microcontainer/trunk/pom.xml
===================================================================
--- projects/jboss-osgi/projects/runtime/microcontainer/trunk/pom.xml 2009-08-22 21:00:52 UTC (rev 92700)
+++ projects/jboss-osgi/projects/runtime/microcontainer/trunk/pom.xml 2009-08-23 06:51:04 UTC (rev 92701)
@@ -2,6 +2,7 @@
<modelVersion>4.0.0</modelVersion>
<name>JBossOSGi Runtime - Microcontainer</name>
+ <groupId>org.jboss.osgi.runtime</groupId>
<artifactId>jboss-osgi-runtime-microcontainer</artifactId>
<packaging>jar</packaging>
Modified: projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/main/java/org/jboss/osgi/plugins/facade/launch/OSGiFrameworkFactory.java
===================================================================
--- projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/main/java/org/jboss/osgi/plugins/facade/launch/OSGiFrameworkFactory.java 2009-08-22 21:00:52 UTC (rev 92700)
+++ projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/main/java/org/jboss/osgi/plugins/facade/launch/OSGiFrameworkFactory.java 2009-08-23 06:51:04 UTC (rev 92701)
@@ -56,16 +56,22 @@
// Bootstrap the kernel
AbstractBootstrap bootstrap = new BasicBootstrap();
bootstrap.run();
-
+
Kernel kernel = bootstrap.getKernel();
-
+
BasicXMLDeployer deployer = new BasicXMLDeployer(kernel, ControllerMode.AUTOMATIC);
-
- String common = "/bootstrap/bootstrap.xml";
- URL url = getClass().getResource(common);
+
+ URL url = null;
+ String[] bootstraps = new String[] { "/bootstrap/bootstrap.xml", "/META-INF/bootstrap.xml" };
+ for (String xml : bootstraps)
+ {
+ url = getClass().getResource(xml);
+ if (url != null)
+ break;
+ }
if (url == null)
- throw new IllegalStateException(common + " not found");
-
+ throw new IllegalStateException("Cannot find any bootstrap: " + bootstraps);
+
try
{
deployer.deploy(url);
@@ -78,14 +84,14 @@
ControllerContext managerContext = kernel.getController().getInstalledContext(OSGiBundleManager.BEAN_BUNDLE_MANAGER);
if (managerContext == null)
throw new IllegalStateException("Cannot obtain installed bean: " + OSGiBundleManager.BEAN_BUNDLE_MANAGER);
-
+
OSGiBundleManager manager = (OSGiBundleManager)managerContext.getTarget();
OSGiBundleState sysBundle = manager.getBundle(0);
-
+
// [TODO] Remove hack that forces the initial state to installed
if (sysBundle.getState() != Bundle.INSTALLED)
sysBundle.changeState(Bundle.INSTALLED);
-
+
return new OSGiFramework(manager, sysBundle);
}
Modified: projects/jboss-osgi/trunk/distribution/pom.xml
===================================================================
--- projects/jboss-osgi/trunk/distribution/pom.xml 2009-08-22 21:00:52 UTC (rev 92700)
+++ projects/jboss-osgi/trunk/distribution/pom.xml 2009-08-23 06:51:04 UTC (rev 92701)
@@ -67,18 +67,18 @@
<classifier>sources</classifier>
</dependency>
<dependency>
- <groupId>org.jboss.osgi</groupId>
+ <groupId>org.jboss.osgi.runtime</groupId>
<artifactId>jboss-osgi-runtime-jbossas</artifactId>
<version>${version.jboss.osgi.runtime.jbossas}</version>
</dependency>
<dependency>
- <groupId>org.jboss.osgi</groupId>
+ <groupId>org.jboss.osgi.runtime</groupId>
<artifactId>jboss-osgi-runtime-jbossas</artifactId>
<version>${version.jboss.osgi.runtime.jbossas}</version>
<classifier>config</classifier>
</dependency>
<dependency>
- <groupId>org.jboss.osgi</groupId>
+ <groupId>org.jboss.osgi.runtime</groupId>
<artifactId>jboss-osgi-runtime-jbossas</artifactId>
<version>${version.jboss.osgi.runtime.jbossas}</version>
<classifier>sources</classifier>
@@ -306,12 +306,12 @@
<!-- Equinox Dependencies -->
<dependency>
- <groupId>org.jboss.osgi</groupId>
+ <groupId>org.jboss.osgi.runtime</groupId>
<artifactId>jboss-osgi-runtime-equinox</artifactId>
<version>${version.jboss.osgi.runtime.equinox}</version>
</dependency>
<dependency>
- <groupId>org.jboss.osgi</groupId>
+ <groupId>org.jboss.osgi.runtime</groupId>
<artifactId>jboss-osgi-runtime-equinox</artifactId>
<version>${version.jboss.osgi.runtime.equinox}</version>
<classifier>sources</classifier>
@@ -319,12 +319,12 @@
<!-- Felix Dependencies -->
<dependency>
- <groupId>org.jboss.osgi</groupId>
+ <groupId>org.jboss.osgi.runtime</groupId>
<artifactId>jboss-osgi-runtime-felix</artifactId>
<version>${version.jboss.osgi.runtime.felix}</version>
</dependency>
<dependency>
- <groupId>org.jboss.osgi</groupId>
+ <groupId>org.jboss.osgi.runtime</groupId>
<artifactId>jboss-osgi-runtime-felix</artifactId>
<version>${version.jboss.osgi.runtime.felix}</version>
<classifier>sources</classifier>
Modified: projects/jboss-osgi/trunk/pom.xml
===================================================================
--- projects/jboss-osgi/trunk/pom.xml 2009-08-22 21:00:52 UTC (rev 92700)
+++ projects/jboss-osgi/trunk/pom.xml 2009-08-23 06:51:04 UTC (rev 92701)
@@ -56,7 +56,7 @@
<version.jboss.osgi.runtime.equinox>3.5-SNAPSHOT</version.jboss.osgi.runtime.equinox>
<version.jboss.osgi.runtime.felix>1.9.0-SNAPSHOT</version.jboss.osgi.runtime.felix>
<version.jboss.osgi.runtime.jbossas>1.0.1-SNAPSHOT</version.jboss.osgi.runtime.jbossas>
- <version.jboss.osgi.runtime.jbossmc>1.0.0-SNAPSHOT</version.jboss.osgi.runtime.jbossmc>
+ <version.jboss.osgi.runtime.jbossmc>1.0.2-SNAPSHOT</version.jboss.osgi.runtime.jbossmc>
<version.jboss.osgi.spi>1.0.1-SNAPSHOT</version.jboss.osgi.spi>
<version.jboss.osgi.webconsole>1.0.0</version.jboss.osgi.webconsole>
<version.jboss.osgi.xml.binding>2.0.1</version.jboss.osgi.xml.binding>
Modified: projects/jboss-osgi/trunk/reactor/blueprint/pom.xml
===================================================================
--- projects/jboss-osgi/trunk/reactor/blueprint/pom.xml 2009-08-22 21:00:52 UTC (rev 92700)
+++ projects/jboss-osgi/trunk/reactor/blueprint/pom.xml 2009-08-23 06:51:04 UTC (rev 92701)
@@ -69,7 +69,7 @@
<version>${version.jboss.osgi.microcontainer}</version>
</dependency>
<dependency>
- <groupId>org.jboss.osgi</groupId>
+ <groupId>org.jboss.osgi.runtime</groupId>
<artifactId>jboss-osgi-runtime-felix</artifactId>
<version>${version.jboss.osgi.runtime.felix}</version>
</dependency>
Modified: projects/jboss-osgi/trunk/reactor/blueprint/testsuite/.project
===================================================================
--- projects/jboss-osgi/trunk/reactor/blueprint/testsuite/.project 2009-08-22 21:00:52 UTC (rev 92700)
+++ projects/jboss-osgi/trunk/reactor/blueprint/testsuite/.project 2009-08-23 06:51:04 UTC (rev 92701)
@@ -17,7 +17,7 @@
</buildCommand>
</buildSpec>
<natures>
+ <nature>org.maven.ide.eclipse.maven2Nature</nature>
<nature>org.eclipse.jdt.core.javanature</nature>
- <nature>org.maven.ide.eclipse.maven2Nature</nature>
</natures>
</projectDescription>
Modified: projects/jboss-osgi/trunk/reactor/blueprint/testsuite/pom.xml
===================================================================
--- projects/jboss-osgi/trunk/reactor/blueprint/testsuite/pom.xml 2009-08-22 21:00:52 UTC (rev 92700)
+++ projects/jboss-osgi/trunk/reactor/blueprint/testsuite/pom.xml 2009-08-23 06:51:04 UTC (rev 92701)
@@ -49,7 +49,7 @@
<artifactId>bnd</artifactId>
</dependency>
<dependency>
- <groupId>org.jboss.osgi</groupId>
+ <groupId>org.jboss.osgi.runtime</groupId>
<artifactId>jboss-osgi-runtime-felix</artifactId>
</dependency>
Modified: projects/jboss-osgi/trunk/reactor/runtime/jbossmc/pom.xml
===================================================================
--- projects/jboss-osgi/trunk/reactor/runtime/jbossmc/pom.xml 2009-08-22 21:00:52 UTC (rev 92700)
+++ projects/jboss-osgi/trunk/reactor/runtime/jbossmc/pom.xml 2009-08-23 06:51:04 UTC (rev 92701)
@@ -20,7 +20,7 @@
<artifactId>jboss-osgi-runtime-jbossmc</artifactId>
<packaging>jar</packaging>
- <version>1.0.0-SNAPSHOT</version>
+ <version>1.0.2-SNAPSHOT</version>
<!-- Parent -->
<parent>
Added: projects/jboss-osgi/trunk/testsuite/example/src/test/resources/META-INF/bootstrap.xml
===================================================================
--- projects/jboss-osgi/trunk/testsuite/example/src/test/resources/META-INF/bootstrap.xml (rev 0)
+++ projects/jboss-osgi/trunk/testsuite/example/src/test/resources/META-INF/bootstrap.xml 2009-08-23 06:51:04 UTC (rev 92701)
@@ -0,0 +1,108 @@
+<deployment xmlns="urn:jboss:bean-deployer:2.0">
+
+ <!--
+ ********************************
+ * *
+ * OSGi Framework *
+ * *
+ ********************************
+ -->
+
+ <bean name="OSGiBundleManager" class="org.jboss.osgi.plugins.facade.bundle.OSGiBundleManager">
+ <constructor><parameter><inject bean="MainDeployer" /></parameter></constructor>
+ </bean>
+
+ <!--
+ ********************************
+ * *
+ * OSGi Deployment *
+ * *
+ ********************************
+ -->
+
+ <!-- The MainDeployer -->
+ <bean name="MainDeployer" class="org.jboss.deployers.plugins.main.MainDeployerImpl">
+ <property name="structuralDeployers"><inject bean="StructuralDeployers" /></property>
+ <property name="deployers"><inject bean="Deployers" /></property>
+ </bean>
+
+ <!-- The holder for deployers that determine structure -->
+ <bean name="StructuralDeployers" class="org.jboss.deployers.vfs.plugins.structure.VFSStructuralDeployersImpl">
+ <property name="structureBuilder">
+ <!-- The consolidator of the structure information -->
+ <bean name="StructureBuilder" class="org.jboss.deployers.vfs.plugins.structure.VFSStructureBuilder" />
+ </property>
+ <!-- Accept any implementor of structure deployer -->
+ <incallback method="addDeployer" />
+ <uncallback method="removeDeployer" />
+ </bean>
+
+ <!-- The holder for deployers that do real deployment -->
+ <bean name="Deployers" class="org.jboss.deployers.plugins.deployers.DeployersImpl">
+ <constructor><parameter><inject bean="jboss.kernel:service=KernelController" /></parameter></constructor>
+ <!-- Accept any implementor of deployer -->
+ <incallback method="addDeployer" />
+ <uncallback method="removeDeployer" />
+ </bean>
+
+ <!-- Bundle Structure -->
+ <bean name="BundleStructure" class="org.jboss.osgi.deployer.BundleStructureDeployer" />
+
+ <!-- JAR & File Structure (needed for negative testing) -->
+ <bean name="JARStructure" class="org.jboss.deployers.vfs.plugins.structure.jar.JARStructure" />
+ <bean name="FileStructure" class="org.jboss.deployers.vfs.plugins.structure.file.FileStructure" />
+
+ <!-- POJO Deployment -->
+ <bean name="BeanDeployer" class="org.jboss.deployers.vfs.deployer.kernel.BeanDeployer" />
+ <bean name="KernelDeploymentDeployer" class="org.jboss.deployers.vfs.deployer.kernel.KernelDeploymentDeployer" />
+ <bean name="BeanMetaDataDeployer" class="org.jboss.deployers.vfs.deployer.kernel.BeanMetaDataDeployer">
+ <constructor>
+ <parameter class="org.jboss.dependency.spi.Controller"><inject bean="jboss.kernel:service=KernelController" /></parameter>
+ </constructor>
+ </bean>
+
+ <!-- OSGI Deployment -->
+ <bean name="OSGiManifestParsingDeployer" class="org.jboss.osgi.plugins.deployers.bundle.OSGiManifestParsingDeployer" />
+ <bean name="OSGiBundleStateDeployer" class="org.jboss.osgi.plugins.deployers.bundle.OSGiBundleStateDeployer">
+ <constructor>
+ <parameter><inject bean="OSGiBundleManager" /></parameter>
+ </constructor>
+ </bean>
+ <bean name="OSGiBundleClassLoadingDeployer" class="org.jboss.osgi.plugins.deployers.bundle.OSGiBundleClassLoadingDeployer" />
+ <bean name="OSGiBundleActivatorDeployer" class="org.jboss.osgi.plugins.deployers.bundle.OSGiBundleActivatorDeployer" />
+
+ <!--
+ ********************************
+ * *
+ * OSGi Classloading *
+ * *
+ ********************************
+ -->
+
+ <!-- ClassLoading -->
+ <bean name="ClassLoaderSystem" class="org.jboss.test.osgi.OSGiClassLoaderSystem" />
+ <bean name="ClassLoading" class="org.jboss.classloading.spi.dependency.ClassLoading">
+ <incallback method="addModule" state="Configured" />
+ <uncallback method="removeModule" state="Configured" />
+ </bean>
+ <bean name="ClassLoadingMetaDataParser" class="org.jboss.deployers.vfs.spi.deployer.SchemaResolverDeployer">
+ <constructor>
+ <parameter>org.jboss.classloading.spi.metadata.ClassLoadingMetaData</parameter>
+ </constructor>
+ <property name="name">jboss-classloading.xml</property>
+ </bean>
+ <bean name="ClassLoadingDefaultDeployer" class="org.jboss.deployers.plugins.classloading.ClassLoadingDefaultDeployer">
+ <property name="defaultMetaData">
+ <classloading xmlns="urn:jboss:classloading:1.0" export-all="NON_EMPTY" import-all="true" />
+ </property>
+ </bean>
+ <bean name="ClassLoaderClassPathDeployer" class="org.jboss.deployers.vfs.plugins.classloader.VFSClassLoaderClassPathDeployer" />
+ <bean name="ClassLoaderDescribeDeployer" class="org.jboss.deployers.vfs.plugins.classloader.VFSClassLoaderDescribeDeployer">
+ <property name="classLoading"><inject bean="ClassLoading" /></property>
+ </bean>
+ <bean name="ClassLoaderDeployer" class="org.jboss.deployers.plugins.classloading.AbstractLevelClassLoaderSystemDeployer">
+ <property name="classLoading"><inject bean="ClassLoading" /></property>
+ <property name="system"><inject bean="ClassLoaderSystem" /></property>
+ </bean>
+
+</deployment>
Property changes on: projects/jboss-osgi/trunk/testsuite/example/src/test/resources/META-INF/bootstrap.xml
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Modified: projects/jboss-osgi/trunk/testsuite/example/src/test/resources/META-INF/services/org.jboss.osgi.spi.framework.OSGiBootstrapProvider
===================================================================
--- projects/jboss-osgi/trunk/testsuite/example/src/test/resources/META-INF/services/org.jboss.osgi.spi.framework.OSGiBootstrapProvider 2009-08-22 21:00:52 UTC (rev 92700)
+++ projects/jboss-osgi/trunk/testsuite/example/src/test/resources/META-INF/services/org.jboss.osgi.spi.framework.OSGiBootstrapProvider 2009-08-23 06:51:04 UTC (rev 92701)
@@ -1,2 +1,4 @@
-org.jboss.osgi.jbossmc.framework.launch.FrameworkBootstrapProvider
-org.jboss.osgi.spi.framework.PropertiesBootstrapProvider
\ No newline at end of file
+org.jboss.osgi.plugins.facade.launch.OSGiFrameworkBootstrapProvider # The MC Facade bootstrap provider
+org.jboss.osgi.jbossmc.framework.launch.FrameworkBootstrapProvider # The legacy MC based framework bootstrap provider
+org.jboss.osgi.equinox.EquinoxBootstrapProvider # The Equinox bootstrap provider
+org.jboss.osgi.felix.FelixBootstrapProvider # The Felix bootstrap provider
\ No newline at end of file
Added: projects/jboss-osgi/trunk/testsuite/functional/src/test/resources/META-INF/bootstrap.xml
===================================================================
--- projects/jboss-osgi/trunk/testsuite/functional/src/test/resources/META-INF/bootstrap.xml (rev 0)
+++ projects/jboss-osgi/trunk/testsuite/functional/src/test/resources/META-INF/bootstrap.xml 2009-08-23 06:51:04 UTC (rev 92701)
@@ -0,0 +1,108 @@
+<deployment xmlns="urn:jboss:bean-deployer:2.0">
+
+ <!--
+ ********************************
+ * *
+ * OSGi Framework *
+ * *
+ ********************************
+ -->
+
+ <bean name="OSGiBundleManager" class="org.jboss.osgi.plugins.facade.bundle.OSGiBundleManager">
+ <constructor><parameter><inject bean="MainDeployer" /></parameter></constructor>
+ </bean>
+
+ <!--
+ ********************************
+ * *
+ * OSGi Deployment *
+ * *
+ ********************************
+ -->
+
+ <!-- The MainDeployer -->
+ <bean name="MainDeployer" class="org.jboss.deployers.plugins.main.MainDeployerImpl">
+ <property name="structuralDeployers"><inject bean="StructuralDeployers" /></property>
+ <property name="deployers"><inject bean="Deployers" /></property>
+ </bean>
+
+ <!-- The holder for deployers that determine structure -->
+ <bean name="StructuralDeployers" class="org.jboss.deployers.vfs.plugins.structure.VFSStructuralDeployersImpl">
+ <property name="structureBuilder">
+ <!-- The consolidator of the structure information -->
+ <bean name="StructureBuilder" class="org.jboss.deployers.vfs.plugins.structure.VFSStructureBuilder" />
+ </property>
+ <!-- Accept any implementor of structure deployer -->
+ <incallback method="addDeployer" />
+ <uncallback method="removeDeployer" />
+ </bean>
+
+ <!-- The holder for deployers that do real deployment -->
+ <bean name="Deployers" class="org.jboss.deployers.plugins.deployers.DeployersImpl">
+ <constructor><parameter><inject bean="jboss.kernel:service=KernelController" /></parameter></constructor>
+ <!-- Accept any implementor of deployer -->
+ <incallback method="addDeployer" />
+ <uncallback method="removeDeployer" />
+ </bean>
+
+ <!-- Bundle Structure -->
+ <bean name="BundleStructure" class="org.jboss.osgi.deployer.BundleStructureDeployer" />
+
+ <!-- JAR & File Structure (needed for negative testing) -->
+ <bean name="JARStructure" class="org.jboss.deployers.vfs.plugins.structure.jar.JARStructure" />
+ <bean name="FileStructure" class="org.jboss.deployers.vfs.plugins.structure.file.FileStructure" />
+
+ <!-- POJO Deployment -->
+ <bean name="BeanDeployer" class="org.jboss.deployers.vfs.deployer.kernel.BeanDeployer" />
+ <bean name="KernelDeploymentDeployer" class="org.jboss.deployers.vfs.deployer.kernel.KernelDeploymentDeployer" />
+ <bean name="BeanMetaDataDeployer" class="org.jboss.deployers.vfs.deployer.kernel.BeanMetaDataDeployer">
+ <constructor>
+ <parameter class="org.jboss.dependency.spi.Controller"><inject bean="jboss.kernel:service=KernelController" /></parameter>
+ </constructor>
+ </bean>
+
+ <!-- OSGI Deployment -->
+ <bean name="OSGiManifestParsingDeployer" class="org.jboss.osgi.plugins.deployers.bundle.OSGiManifestParsingDeployer" />
+ <bean name="OSGiBundleStateDeployer" class="org.jboss.osgi.plugins.deployers.bundle.OSGiBundleStateDeployer">
+ <constructor>
+ <parameter><inject bean="OSGiBundleManager" /></parameter>
+ </constructor>
+ </bean>
+ <bean name="OSGiBundleClassLoadingDeployer" class="org.jboss.osgi.plugins.deployers.bundle.OSGiBundleClassLoadingDeployer" />
+ <bean name="OSGiBundleActivatorDeployer" class="org.jboss.osgi.plugins.deployers.bundle.OSGiBundleActivatorDeployer" />
+
+ <!--
+ ********************************
+ * *
+ * OSGi Classloading *
+ * *
+ ********************************
+ -->
+
+ <!-- ClassLoading -->
+ <bean name="ClassLoaderSystem" class="org.jboss.test.osgi.OSGiClassLoaderSystem" />
+ <bean name="ClassLoading" class="org.jboss.classloading.spi.dependency.ClassLoading">
+ <incallback method="addModule" state="Configured" />
+ <uncallback method="removeModule" state="Configured" />
+ </bean>
+ <bean name="ClassLoadingMetaDataParser" class="org.jboss.deployers.vfs.spi.deployer.SchemaResolverDeployer">
+ <constructor>
+ <parameter>org.jboss.classloading.spi.metadata.ClassLoadingMetaData</parameter>
+ </constructor>
+ <property name="name">jboss-classloading.xml</property>
+ </bean>
+ <bean name="ClassLoadingDefaultDeployer" class="org.jboss.deployers.plugins.classloading.ClassLoadingDefaultDeployer">
+ <property name="defaultMetaData">
+ <classloading xmlns="urn:jboss:classloading:1.0" export-all="NON_EMPTY" import-all="true" />
+ </property>
+ </bean>
+ <bean name="ClassLoaderClassPathDeployer" class="org.jboss.deployers.vfs.plugins.classloader.VFSClassLoaderClassPathDeployer" />
+ <bean name="ClassLoaderDescribeDeployer" class="org.jboss.deployers.vfs.plugins.classloader.VFSClassLoaderDescribeDeployer">
+ <property name="classLoading"><inject bean="ClassLoading" /></property>
+ </bean>
+ <bean name="ClassLoaderDeployer" class="org.jboss.deployers.plugins.classloading.AbstractLevelClassLoaderSystemDeployer">
+ <property name="classLoading"><inject bean="ClassLoading" /></property>
+ <property name="system"><inject bean="ClassLoaderSystem" /></property>
+ </bean>
+
+</deployment>
Property changes on: projects/jboss-osgi/trunk/testsuite/functional/src/test/resources/META-INF/bootstrap.xml
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Modified: projects/jboss-osgi/trunk/testsuite/functional/src/test/resources/META-INF/services/org.jboss.osgi.spi.framework.OSGiBootstrapProvider
===================================================================
--- projects/jboss-osgi/trunk/testsuite/functional/src/test/resources/META-INF/services/org.jboss.osgi.spi.framework.OSGiBootstrapProvider 2009-08-22 21:00:52 UTC (rev 92700)
+++ projects/jboss-osgi/trunk/testsuite/functional/src/test/resources/META-INF/services/org.jboss.osgi.spi.framework.OSGiBootstrapProvider 2009-08-23 06:51:04 UTC (rev 92701)
@@ -1,2 +1,4 @@
-org.jboss.osgi.jbossmc.framework.launch.FrameworkBootstrapProvider
-org.jboss.osgi.spi.framework.PropertiesBootstrapProvider
\ No newline at end of file
+org.jboss.osgi.plugins.facade.launch.OSGiFrameworkBootstrapProvider # The MC Facade bootstrap provider
+org.jboss.osgi.jbossmc.framework.launch.FrameworkBootstrapProvider # The legacy MC based framework bootstrap provider
+org.jboss.osgi.equinox.EquinoxBootstrapProvider # The Equinox bootstrap provider
+org.jboss.osgi.felix.FelixBootstrapProvider # The Felix bootstrap provider
\ No newline at end of file
Modified: projects/jboss-osgi/trunk/testsuite/pom.xml
===================================================================
--- projects/jboss-osgi/trunk/testsuite/pom.xml 2009-08-22 21:00:52 UTC (rev 92700)
+++ projects/jboss-osgi/trunk/testsuite/pom.xml 2009-08-23 06:51:04 UTC (rev 92701)
@@ -188,6 +188,17 @@
<dependencies>
<dependency>
<groupId>org.jboss.osgi.runtime</groupId>
+ <artifactId>jboss-osgi-runtime-microcontainer</artifactId>
+ <version>${version.jboss.osgi.runtime.jbossmc}</version>
+ <scope>provided</scope>
+ </dependency>
+ </dependencies>
+ -->
+
+ <!-- default to jbossmc (legacy)
+ <dependencies>
+ <dependency>
+ <groupId>org.jboss.osgi.runtime</groupId>
<artifactId>jboss-osgi-runtime-jbossmc</artifactId>
<version>${version.jboss.osgi.runtime.jbossmc}</version>
<scope>provided</scope>
@@ -195,10 +206,10 @@
</dependencies>
-->
- <!-- default to felix -->
+ <!-- default to felix -->
<dependencies>
<dependency>
- <groupId>org.jboss.osgi</groupId>
+ <groupId>org.jboss.osgi.runtime</groupId>
<artifactId>jboss-osgi-runtime-felix</artifactId>
<version>${version.jboss.osgi.runtime.felix}</version>
<scope>provided</scope>
@@ -221,7 +232,7 @@
</activation>
<dependencies>
<dependency>
- <groupId>org.jboss.osgi</groupId>
+ <groupId>org.jboss.osgi.runtime</groupId>
<artifactId>jboss-osgi-runtime-felix</artifactId>
<version>${version.jboss.osgi.runtime.felix}</version>
<scope>provided</scope>
@@ -243,7 +254,7 @@
</activation>
<dependencies>
<dependency>
- <groupId>org.jboss.osgi</groupId>
+ <groupId>org.jboss.osgi.runtime</groupId>
<artifactId>jboss-osgi-runtime-equinox</artifactId>
<version>${version.jboss.osgi.runtime.equinox}</version>
<scope>provided</scope>
Modified: projects/jboss-osgi/trunk/testsuite/trailblazer/src/test/resources/META-INF/services/org.jboss.osgi.spi.framework.OSGiBootstrapProvider
===================================================================
--- projects/jboss-osgi/trunk/testsuite/trailblazer/src/test/resources/META-INF/services/org.jboss.osgi.spi.framework.OSGiBootstrapProvider 2009-08-22 21:00:52 UTC (rev 92700)
+++ projects/jboss-osgi/trunk/testsuite/trailblazer/src/test/resources/META-INF/services/org.jboss.osgi.spi.framework.OSGiBootstrapProvider 2009-08-23 06:51:04 UTC (rev 92701)
@@ -1 +1,4 @@
-org.jboss.osgi.spi.framework.PropertiesBootstrapProvider
\ No newline at end of file
+org.jboss.osgi.plugins.facade.launch.OSGiFrameworkBootstrapProvider # The MC Facade bootstrap provider
+org.jboss.osgi.jbossmc.framework.launch.FrameworkBootstrapProvider # The legacy MC based framework bootstrap provider
+org.jboss.osgi.equinox.EquinoxBootstrapProvider # The Equinox bootstrap provider
+org.jboss.osgi.felix.FelixBootstrapProvider # The Felix bootstrap provider
\ No newline at end of file
16 years, 4 months