[jboss-osgi-commits] JBoss-OSGI SVN: r87480 - in projects/jboss-osgi/trunk: runtime/equinox/src/main/java/org/jboss/osgi/equinox/framework and 8 other directories.
jboss-osgi-commits at lists.jboss.org
jboss-osgi-commits at lists.jboss.org
Fri Apr 17 05:11:43 EDT 2009
Author: thomas.diesler at jboss.com
Date: 2009-04-17 05:11:43 -0400 (Fri, 17 Apr 2009)
New Revision: 87480
Modified:
projects/jboss-osgi/trunk/runtime/deployer/src/main/java/org/jboss/osgi/deployer/BundleMetaData.java
projects/jboss-osgi/trunk/runtime/deployer/src/main/java/org/jboss/osgi/deployer/BundleMetaDataDeployer.java
projects/jboss-osgi/trunk/runtime/deployer/src/main/java/org/jboss/osgi/deployer/BundleRealDeployer.java
projects/jboss-osgi/trunk/runtime/equinox/src/main/java/org/jboss/osgi/equinox/framework/EquinoxIntegration.java
projects/jboss-osgi/trunk/runtime/equinox/src/main/resources/jboss-osgi-beans.xml
projects/jboss-osgi/trunk/runtime/equinox/src/main/resources/osgi-deployers-jboss-beans.xml
projects/jboss-osgi/trunk/runtime/felix/src/main/java/org/jboss/osgi/felix/framework/FelixIntegration.java
projects/jboss-osgi/trunk/runtime/felix/src/main/resources/jboss-osgi-beans.xml
projects/jboss-osgi/trunk/runtime/felix/src/main/resources/osgi-deployers-jboss-beans.xml
projects/jboss-osgi/trunk/runtime/knopflerfish/src/main/java/org/jboss/osgi/knopflerfish/KnopflerfishIntegration.java
projects/jboss-osgi/trunk/runtime/knopflerfish/src/main/resources/jboss-osgi-beans.xml
projects/jboss-osgi/trunk/runtime/knopflerfish/src/main/resources/osgi-deployers-jboss-beans.xml
projects/jboss-osgi/trunk/spi/src/main/java/org/jboss/osgi/spi/framework/OSGiFramework.java
projects/jboss-osgi/trunk/testsuite/functional/src/test/java/org/jboss/test/osgi/bootstrap/MockFramework.java
projects/jboss-osgi/trunk/testsuite/functional/src/test/java/org/jboss/test/osgi/jbosgi39/FELIX1040TestCase.java
Log:
Add more control to the OSGiFramework API
Modified: projects/jboss-osgi/trunk/runtime/deployer/src/main/java/org/jboss/osgi/deployer/BundleMetaData.java
===================================================================
--- projects/jboss-osgi/trunk/runtime/deployer/src/main/java/org/jboss/osgi/deployer/BundleMetaData.java 2009-04-17 08:57:52 UTC (rev 87479)
+++ projects/jboss-osgi/trunk/runtime/deployer/src/main/java/org/jboss/osgi/deployer/BundleMetaData.java 2009-04-17 09:11:43 UTC (rev 87480)
@@ -23,7 +23,7 @@
//$Id$
-import java.net.URI;
+import java.net.URL;
import org.jboss.deployers.vfs.spi.deployer.helpers.AbstractManifestMetaData;
@@ -37,7 +37,7 @@
public class BundleMetaData extends AbstractManifestMetaData
{
private String symbolicName;
- private URI bundleLocation;
+ private URL bundleLocation;
// exteralizable usage
public BundleMetaData()
@@ -54,12 +54,12 @@
return symbolicName;
}
- public URI getBundleLocation()
+ public URL getBundleLocation()
{
return bundleLocation;
}
- public void setBundleLocation(URI bundleLocation)
+ public void setBundleLocation(URL bundleLocation)
{
this.bundleLocation = bundleLocation;
}
Modified: projects/jboss-osgi/trunk/runtime/deployer/src/main/java/org/jboss/osgi/deployer/BundleMetaDataDeployer.java
===================================================================
--- projects/jboss-osgi/trunk/runtime/deployer/src/main/java/org/jboss/osgi/deployer/BundleMetaDataDeployer.java 2009-04-17 08:57:52 UTC (rev 87479)
+++ projects/jboss-osgi/trunk/runtime/deployer/src/main/java/org/jboss/osgi/deployer/BundleMetaDataDeployer.java 2009-04-17 09:11:43 UTC (rev 87480)
@@ -52,7 +52,7 @@
BundleMetaData metaData = super.parse(unit, file, root);
if (metaData != null)
{
- metaData.setBundleLocation(unit.getRoot().toURI());
+ metaData.setBundleLocation(unit.getRoot().toURL());
log.debug("Bundle-SymbolicName: " + metaData.getSymbolicName() + " in " + file);
}
return metaData;
Modified: projects/jboss-osgi/trunk/runtime/deployer/src/main/java/org/jboss/osgi/deployer/BundleRealDeployer.java
===================================================================
--- projects/jboss-osgi/trunk/runtime/deployer/src/main/java/org/jboss/osgi/deployer/BundleRealDeployer.java 2009-04-17 08:57:52 UTC (rev 87479)
+++ projects/jboss-osgi/trunk/runtime/deployer/src/main/java/org/jboss/osgi/deployer/BundleRealDeployer.java 2009-04-17 09:11:43 UTC (rev 87480)
@@ -23,7 +23,7 @@
//$Id$
-import java.net.URI;
+import java.net.URL;
import java.util.List;
import org.jboss.deployers.spi.DeploymentException;
@@ -47,7 +47,7 @@
public class BundleRealDeployer extends AbstractSimpleRealDeployer<BundleMetaData>
{
private BundleContext systemContext;
- private List<URI> skipBundles;
+ private List<URL> skipBundles;
public BundleRealDeployer()
{
@@ -61,18 +61,18 @@
this.systemContext = bundleContext;
}
- public void setSkipBundles(List<URI> skipBundles)
+ public void setSkipBundles(List<URL> skipBundles)
{
this.skipBundles = skipBundles;
}
public void deploy(DeploymentUnit unit, BundleMetaData metadata) throws DeploymentException
{
- URI bundleUri = metadata.getBundleLocation();
- if (bundleUri == null)
+ URL bundleURL = metadata.getBundleLocation();
+ if (bundleURL == null)
throw new IllegalStateException("Cannot obtain bundle location for: " + metadata);
- String bundlePath = bundleUri.getPath();
+ String bundlePath = bundleURL.getPath();
if (bundlePath.endsWith("/"))
bundlePath = bundlePath.substring(0, bundlePath.length() - 1);
@@ -81,7 +81,7 @@
if (skipBundles != null)
{
boolean skipBundle = false;
- for (URI skip : skipBundles)
+ for (URL skip : skipBundles)
{
String skipPath = skip.getPath();
if (skipPath.equals(bundlePath))
@@ -92,7 +92,7 @@
}
if (skipBundle == false)
{
- Bundle bundle = systemContext.installBundle(bundleUri.toString());
+ Bundle bundle = systemContext.installBundle(bundleURL.toString());
unit.addAttachment(Bundle.class, bundle);
log.info("Installed: " + bundle);
Modified: projects/jboss-osgi/trunk/runtime/equinox/src/main/java/org/jboss/osgi/equinox/framework/EquinoxIntegration.java
===================================================================
--- projects/jboss-osgi/trunk/runtime/equinox/src/main/java/org/jboss/osgi/equinox/framework/EquinoxIntegration.java 2009-04-17 08:57:52 UTC (rev 87479)
+++ projects/jboss-osgi/trunk/runtime/equinox/src/main/java/org/jboss/osgi/equinox/framework/EquinoxIntegration.java 2009-04-17 09:11:43 UTC (rev 87480)
@@ -23,7 +23,7 @@
//$Id$
-import java.net.URI;
+import java.net.URL;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Iterator;
@@ -51,38 +51,38 @@
// Provide logging
final Logger log = Logger.getLogger(EquinoxIntegration.class);
- private Map<String, Object> frameworkProperties = new HashMap<String, Object>();
- private List<URI> autoInstall = new ArrayList<URI>();
- private List<URI> autoStart = new ArrayList<URI>();
+ private Map<String, Object> properties = new HashMap<String, Object>();
+ private List<URL> autoInstall = new ArrayList<URL>();
+ private List<URL> autoStart = new ArrayList<URL>();
private Framework framework;
- public Map<String, Object> getFrameworkProperties()
+ public Map<String, Object> getProperties()
{
- return frameworkProperties;
+ return properties;
}
- public void setFrameworkProperties(Map<String, Object> props)
+ public void setProperties(Map<String, Object> props)
{
- this.frameworkProperties = props;
+ this.properties = props;
}
- public List<URI> getAutoInstall()
+ public List<URL> getAutoInstall()
{
return autoInstall;
}
- public void setAutoInstall(List<URI> autoInstall)
+ public void setAutoInstall(List<URL> autoInstall)
{
this.autoInstall = autoInstall;
}
- public List<URI> getAutoStart()
+ public List<URL> getAutoStart()
{
return autoStart;
}
- public void setAutoStart(List<URI> autoStart)
+ public void setAutoStart(List<URL> autoStart)
{
this.autoStart = autoStart;
}
@@ -104,11 +104,11 @@
// Push configured props to FrameworkProperties
System.setProperty("osgi.framework.useSystemProperties", "false");
- Iterator<String> itKeys = frameworkProperties.keySet().iterator();
+ Iterator<String> itKeys = properties.keySet().iterator();
while (itKeys.hasNext())
{
String key = itKeys.next();
- Object value = frameworkProperties.get(key);
+ Object value = properties.get(key);
if (value instanceof String)
{
FrameworkProperties.setProperty(key, (String)value);
@@ -134,41 +134,41 @@
if (context == null)
throw new FrameworkException("Cannot obtain system context");
- Map<URI, Bundle> autoBundles = new HashMap<URI, Bundle>();
+ Map<URL, Bundle> autoBundles = new HashMap<URL, Bundle>();
// Add the autoStart bundles to autoInstall
- for (URI bundleURI : autoStart)
+ for (URL bundleURL : autoStart)
{
- autoInstall.add(bundleURI);
+ autoInstall.add(bundleURL);
}
// Install autoInstall bundles
- for (URI bundleURI : autoInstall)
+ for (URL bundleURL : autoInstall)
{
try
{
- Bundle bundle = context.installBundle(bundleURI.toString());
+ Bundle bundle = context.installBundle(bundleURL.toString());
log.info("Installed bundle: " + bundle.getSymbolicName());
- autoBundles.put(bundleURI, bundle);
+ autoBundles.put(bundleURL, bundle);
}
catch (BundleException ex)
{
- log.error("Cannot install bundle: " + bundleURI, ex);
+ log.error("Cannot install bundle: " + bundleURL, ex);
}
}
// Start autoStart bundles
- for (URI bundleURI : autoStart)
+ for (URL bundleURL : autoStart)
{
try
{
- Bundle bundle = autoBundles.get(bundleURI);
+ Bundle bundle = autoBundles.get(bundleURL);
bundle.start();
log.info("Started bundle: " + bundle.getSymbolicName());
}
catch (BundleException ex)
{
- log.error("Cannot start bundle: " + bundleURI, ex);
+ log.error("Cannot start bundle: " + bundleURL, ex);
}
}
}
Modified: projects/jboss-osgi/trunk/runtime/equinox/src/main/resources/jboss-osgi-beans.xml
===================================================================
--- projects/jboss-osgi/trunk/runtime/equinox/src/main/resources/jboss-osgi-beans.xml 2009-04-17 08:57:52 UTC (rev 87479)
+++ projects/jboss-osgi/trunk/runtime/equinox/src/main/resources/jboss-osgi-beans.xml 2009-04-17 09:11:43 UTC (rev 87480)
@@ -5,7 +5,7 @@
<!-- The OSGiFramework -->
<bean name="jboss.osgi:service=Framework" class="org.jboss.osgi.equinox.framework.EquinoxIntegration">
- <property name="frameworkProperties">
+ <property name="properties">
<map keyClass="java.lang.String" valueClass="java.lang.String">
<entry><key>org.osgi.framework.storage.clean</key><value>onFirstInit</value></entry>
</map>
Modified: projects/jboss-osgi/trunk/runtime/equinox/src/main/resources/osgi-deployers-jboss-beans.xml
===================================================================
--- projects/jboss-osgi/trunk/runtime/equinox/src/main/resources/osgi-deployers-jboss-beans.xml 2009-04-17 08:57:52 UTC (rev 87479)
+++ projects/jboss-osgi/trunk/runtime/equinox/src/main/resources/osgi-deployers-jboss-beans.xml 2009-04-17 09:11:43 UTC (rev 87480)
@@ -4,7 +4,7 @@
<!-- The OSGiFramework -->
<bean name="jboss.osgi:service=Framework" class="org.jboss.osgi.equinox.framework.EquinoxIntegration">
- <property name="frameworkProperties">
+ <property name="properties">
<map keyClass="java.lang.String" valueClass="java.lang.String">
<entry><key>org.osgi.framework.storage.clean</key><value>onFirstInit</value></entry>
<entry><key>org.osgi.service.http.port</key><value>8090</value></entry>
Modified: projects/jboss-osgi/trunk/runtime/felix/src/main/java/org/jboss/osgi/felix/framework/FelixIntegration.java
===================================================================
--- projects/jboss-osgi/trunk/runtime/felix/src/main/java/org/jboss/osgi/felix/framework/FelixIntegration.java 2009-04-17 08:57:52 UTC (rev 87479)
+++ projects/jboss-osgi/trunk/runtime/felix/src/main/java/org/jboss/osgi/felix/framework/FelixIntegration.java 2009-04-17 09:11:43 UTC (rev 87480)
@@ -23,7 +23,7 @@
//$Id$
-import java.net.URI;
+import java.net.URL;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
@@ -35,7 +35,10 @@
import org.jboss.osgi.spi.framework.OSGiFramework;
import org.osgi.framework.Bundle;
import org.osgi.framework.BundleContext;
+import org.osgi.framework.BundleEvent;
import org.osgi.framework.BundleException;
+import org.osgi.framework.BundleListener;
+import org.osgi.framework.SynchronousBundleListener;
/**
* An abstraction of an OSGi Framework
@@ -48,38 +51,38 @@
// Provide logging
final Logger log = Logger.getLogger(FelixIntegration.class);
- private Map<String, Object> frameworkProperties = new HashMap<String, Object>();
- private List<URI> autoInstall = new ArrayList<URI>();
- private List<URI> autoStart = new ArrayList<URI>();
+ private Map<String, Object> properties = new HashMap<String, Object>();
+ private List<URL> autoInstall = new ArrayList<URL>();
+ private List<URL> autoStart = new ArrayList<URL>();
private Felix framework;
- public Map<String, Object> getFrameworkProperties()
+ public Map<String, Object> getProperties()
{
- return frameworkProperties;
+ return properties;
}
- public void setFrameworkProperties(Map<String, Object> props)
+ public void setProperties(Map<String, Object> props)
{
- this.frameworkProperties = props;
+ this.properties = props;
}
- public List<URI> getAutoInstall()
+ public List<URL> getAutoInstall()
{
return autoInstall;
}
- public void setAutoInstall(List<URI> autoInstall)
+ public void setAutoInstall(List<URL> autoInstall)
{
this.autoInstall = autoInstall;
}
- public List<URI> getAutoStart()
+ public List<URL> getAutoStart()
{
return autoStart;
}
- public void setAutoStart(List<URI> autoStart)
+ public void setAutoStart(List<URL> autoStart)
{
this.autoStart = autoStart;
}
@@ -101,65 +104,67 @@
// When a Felix instance is embedded in a host application,
// the host application must inform the Felix instance that it is embedded
- frameworkProperties.put("felix.embedded.execution", "true");
+ properties.put("felix.embedded.execution", "true");
// An instance of Logger that the framework uses as its default logger
- frameworkProperties.put("felix.log.logger", new FelixLogger());
+ properties.put("felix.log.logger", new FelixLogger());
- // Init & Start the System Bundle
+ // Init the System Bundle
+ framework = new Felix(properties);
+ }
+
+ public void start()
+ {
+ // Start the System Bundle
try
{
- framework = new Felix(frameworkProperties);
framework.start();
}
catch (BundleException ex)
{
- throw new FrameworkException("Cannot initialze system bundle", ex);
+ throw new FrameworkException("Cannot start system bundle", ex);
}
- }
-
- public void start()
- {
+
// Get system bundle context
BundleContext context = framework.getBundleContext();
if (context == null)
throw new FrameworkException("Cannot obtain system context");
- Map<URI, Bundle> autoBundles = new HashMap<URI, Bundle>();
+ Map<URL, Bundle> autoBundles = new HashMap<URL, Bundle>();
// Add the autoStart bundles to autoInstall
- for (URI bundleURI : autoStart)
+ for (URL bundleURL : autoStart)
{
- autoInstall.add(bundleURI);
+ autoInstall.add(bundleURL);
}
// Install autoInstall bundles
- for (URI bundleURI : autoInstall)
+ for (URL bundleURL : autoInstall)
{
try
{
- Bundle bundle = context.installBundle(bundleURI.toString());
+ Bundle bundle = context.installBundle(bundleURL.toString());
log.info("Installed bundle: " + bundle.getSymbolicName());
- autoBundles.put(bundleURI, bundle);
+ autoBundles.put(bundleURL, bundle);
}
catch (BundleException ex)
{
- log.error("Cannot install bundle: " + bundleURI, ex);
+ log.error("Cannot install bundle: " + bundleURL, ex);
}
}
// Start autoStart bundles
- for (URI bundleURI : autoStart)
+ for (URL bundleURL : autoStart)
{
try
{
- Bundle bundle = autoBundles.get(bundleURI);
+ Bundle bundle = autoBundles.get(bundleURL);
bundle.start();
log.info("Started bundle: " + bundle.getSymbolicName());
}
catch (BundleException ex)
{
- log.error("Cannot start bundle: " + bundleURI, ex);
+ log.error("Cannot start bundle: " + bundleURL, ex);
}
}
}
@@ -170,6 +175,22 @@
{
try
{
+ BundleListener listener = new SynchronousBundleListener()
+ {
+ long sysBundleId = getSystemBundle().getBundleId();
+ public void bundleChanged(BundleEvent event)
+ {
+ Bundle bundle = event.getBundle();
+ long bundleId = bundle.getBundleId();
+ int type = event.getType();
+ if (bundleId == sysBundleId && type == BundleEvent.STOPPED)
+ {
+ log.debug("SystemBundle STOPPED");
+ }
+ }
+ };
+ getSystemBundleContext().addBundleListener(listener);
+
framework.stop();
}
catch (BundleException ex)
Modified: projects/jboss-osgi/trunk/runtime/felix/src/main/resources/jboss-osgi-beans.xml
===================================================================
--- projects/jboss-osgi/trunk/runtime/felix/src/main/resources/jboss-osgi-beans.xml 2009-04-17 08:57:52 UTC (rev 87479)
+++ projects/jboss-osgi/trunk/runtime/felix/src/main/resources/jboss-osgi-beans.xml 2009-04-17 09:11:43 UTC (rev 87480)
@@ -5,7 +5,7 @@
<!-- The OSGiFramework -->
<bean name="jboss.osgi:service=Framework" class="org.jboss.osgi.felix.framework.FelixIntegration">
- <property name="frameworkProperties">
+ <property name="properties">
<map keyClass="java.lang.String" valueClass="java.lang.String">
<entry><key>org.osgi.framework.storage.clean</key><value>onFirstInit</value></entry>
<entry>
@@ -38,7 +38,7 @@
</map>
</property>
<property name="autoStart">
- <list elementClass="java.net.URI">
+ <list elementClass="java.net.URL">
<value>file://${test.archive.directory}/bundles/org.apache.felix.log.jar</value>
<value>file://${test.archive.directory}/bundles/jboss-osgi-common.jar</value>
<value>file://${test.archive.directory}/bundles/jboss-osgi-logging.jar</value>
Modified: projects/jboss-osgi/trunk/runtime/felix/src/main/resources/osgi-deployers-jboss-beans.xml
===================================================================
--- projects/jboss-osgi/trunk/runtime/felix/src/main/resources/osgi-deployers-jboss-beans.xml 2009-04-17 08:57:52 UTC (rev 87479)
+++ projects/jboss-osgi/trunk/runtime/felix/src/main/resources/osgi-deployers-jboss-beans.xml 2009-04-17 09:11:43 UTC (rev 87480)
@@ -4,7 +4,7 @@
<!-- The OSGiFramework -->
<bean name="jboss.osgi:service=Framework" class="org.jboss.osgi.felix.framework.FelixIntegration">
- <property name="frameworkProperties">
+ <property name="properties">
<map keyClass="java.lang.String" valueClass="java.lang.String">
<entry><key>org.osgi.framework.storage</key><value>${jboss.server.data.dir}/osgi-store</value></entry>
<entry><key>org.osgi.framework.storage.clean</key><value>onFirstInit</value></entry>
@@ -49,7 +49,7 @@
</map>
</property>
<property name="autoStart">
- <list elementClass="java.net.URI">
+ <list elementClass="java.net.URL">
<value>${jboss.server.home.url}/deploy/osgi/org.osgi.compendium.jar</value>
<value>${jboss.server.home.url}/deploy/osgi/jboss-osgi-common.jar</value>
<value>${jboss.server.home.url}/deploy/osgi/jboss-osgi-logging.jar</value>
Modified: projects/jboss-osgi/trunk/runtime/knopflerfish/src/main/java/org/jboss/osgi/knopflerfish/KnopflerfishIntegration.java
===================================================================
--- projects/jboss-osgi/trunk/runtime/knopflerfish/src/main/java/org/jboss/osgi/knopflerfish/KnopflerfishIntegration.java 2009-04-17 08:57:52 UTC (rev 87479)
+++ projects/jboss-osgi/trunk/runtime/knopflerfish/src/main/java/org/jboss/osgi/knopflerfish/KnopflerfishIntegration.java 2009-04-17 09:11:43 UTC (rev 87480)
@@ -25,7 +25,7 @@
import java.io.ByteArrayOutputStream;
import java.io.PrintStream;
-import java.net.URI;
+import java.net.URL;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Iterator;
@@ -51,38 +51,38 @@
// Provide logging
final Logger log = Logger.getLogger(KnopflerfishIntegration.class);
- private Map<String, Object> frameworkProperties = new HashMap<String, Object>();
- private List<URI> autoInstall = new ArrayList<URI>();
- private List<URI> autoStart = new ArrayList<URI>();
+ private Map<String, Object> properties = new HashMap<String, Object>();
+ private List<URL> autoInstall = new ArrayList<URL>();
+ private List<URL> autoStart = new ArrayList<URL>();
private Framework framework;
- public Map<String, Object> getFrameworkProperties()
+ public Map<String, Object> getProperties()
{
- return frameworkProperties;
+ return properties;
}
- public void setFrameworkProperties(Map<String, Object> props)
+ public void setProperties(Map<String, Object> props)
{
- this.frameworkProperties = props;
+ this.properties = props;
}
- public List<URI> getAutoInstall()
+ public List<URL> getAutoInstall()
{
return autoInstall;
}
- public void setAutoInstall(List<URI> autoInstall)
+ public void setAutoInstall(List<URL> autoInstall)
{
this.autoInstall = autoInstall;
}
- public List<URI> getAutoStart()
+ public List<URL> getAutoStart()
{
return autoStart;
}
- public void setAutoStart(List<URI> autoStart)
+ public void setAutoStart(List<URL> autoStart)
{
this.autoStart = autoStart;
}
@@ -103,11 +103,11 @@
log.info("OSGi Integration Knopflerfish - " + implVersion);
// Push configured props to FrameworkProperties
- Iterator<String> itKeys = frameworkProperties.keySet().iterator();
+ Iterator<String> itKeys = properties.keySet().iterator();
while (itKeys.hasNext())
{
String key = itKeys.next();
- Object value = frameworkProperties.get(key);
+ Object value = properties.get(key);
if (value instanceof String)
{
Framework.setProperty(key, (String)value);
@@ -160,41 +160,41 @@
if (context == null)
throw new FrameworkException("Cannot obtain system context");
- Map<URI, Bundle> autoBundles = new HashMap<URI, Bundle>();
+ Map<URL, Bundle> autoBundles = new HashMap<URL, Bundle>();
// Add the autoStart bundles to autoInstall
- for (URI bundleURI : autoStart)
+ for (URL bundleURL : autoStart)
{
- autoInstall.add(bundleURI);
+ autoInstall.add(bundleURL);
}
// Install autoInstall bundles
- for (URI bundleURI : autoInstall)
+ for (URL bundleURL : autoInstall)
{
try
{
- Bundle bundle = context.installBundle(bundleURI.toString());
+ Bundle bundle = context.installBundle(bundleURL.toString());
log.info("Installed bundle: " + bundle.getSymbolicName());
- autoBundles.put(bundleURI, bundle);
+ autoBundles.put(bundleURL, bundle);
}
catch (BundleException ex)
{
- log.error("Cannot install bundle: " + bundleURI, ex);
+ log.error("Cannot install bundle: " + bundleURL, ex);
}
}
// Start autoStart bundles
- for (URI bundleURI : autoStart)
+ for (URL bundleURL : autoStart)
{
try
{
- Bundle bundle = autoBundles.get(bundleURI);
+ Bundle bundle = autoBundles.get(bundleURL);
bundle.start();
log.info("Started bundle: " + bundle.getSymbolicName());
}
catch (BundleException ex)
{
- log.error("Cannot start bundle: " + bundleURI, ex);
+ log.error("Cannot start bundle: " + bundleURL, ex);
}
}
}
Modified: projects/jboss-osgi/trunk/runtime/knopflerfish/src/main/resources/jboss-osgi-beans.xml
===================================================================
--- projects/jboss-osgi/trunk/runtime/knopflerfish/src/main/resources/jboss-osgi-beans.xml 2009-04-17 08:57:52 UTC (rev 87479)
+++ projects/jboss-osgi/trunk/runtime/knopflerfish/src/main/resources/jboss-osgi-beans.xml 2009-04-17 09:11:43 UTC (rev 87480)
@@ -5,7 +5,7 @@
<!-- The OSGiFramework -->
<bean name="jboss.osgi:service=Framework" class="org.jboss.osgi.knopflerfish.KnopflerfishIntegration">
- <property name="frameworkProperties">
+ <property name="properties">
<map keyClass="java.lang.String" valueClass="java.lang.String">
<entry><key>org.osgi.framework.storage.clean</key><value>onFirstInit</value></entry>
</map>
Modified: projects/jboss-osgi/trunk/runtime/knopflerfish/src/main/resources/osgi-deployers-jboss-beans.xml
===================================================================
--- projects/jboss-osgi/trunk/runtime/knopflerfish/src/main/resources/osgi-deployers-jboss-beans.xml 2009-04-17 08:57:52 UTC (rev 87479)
+++ projects/jboss-osgi/trunk/runtime/knopflerfish/src/main/resources/osgi-deployers-jboss-beans.xml 2009-04-17 09:11:43 UTC (rev 87480)
@@ -4,7 +4,7 @@
<!-- The OSGiFramework -->
<bean name="jboss.osgi:service=Framework" class="org.jboss.osgi.knopflerfish.KnopflerfishIntegration">
- <property name="frameworkProperties">
+ <property name="properties">
<map keyClass="java.lang.String" valueClass="java.lang.String">
<entry><key>org.osgi.framework.storage.clean</key><value>onFirstInit</value></entry>
<entry><key>org.osgi.service.http.port</key><value>8090</value></entry>
@@ -48,6 +48,9 @@
<!-- The OSGi MetaData Deployer -->
<bean name="jboss.osgi:service=BundleMetaDataDeployer" class="org.jboss.osgi.deployer.BundleMetaDataDeployer" />
+ <!-- The OSGi Bundle Structure Deployer -->
+ <bean name="jboss.osgi:service=BundleStructureDeployer" class="org.jboss.osgi.deployer.BundleStructureDeployer" />
+
<!-- The OSGi Bundle Deployer -->
<bean name="jboss.osgi:service=BundleRealDeployer" class="org.jboss.osgi.deployer.BundleRealDeployer">
<property name="systemContext"><inject bean="jboss.osgi:service=Framework" property="systemBundleContext" /></property>
Modified: projects/jboss-osgi/trunk/spi/src/main/java/org/jboss/osgi/spi/framework/OSGiFramework.java
===================================================================
--- projects/jboss-osgi/trunk/spi/src/main/java/org/jboss/osgi/spi/framework/OSGiFramework.java 2009-04-17 08:57:52 UTC (rev 87479)
+++ projects/jboss-osgi/trunk/spi/src/main/java/org/jboss/osgi/spi/framework/OSGiFramework.java 2009-04-17 09:11:43 UTC (rev 87480)
@@ -23,6 +23,10 @@
//$Id$
+import java.net.URL;
+import java.util.List;
+import java.util.Map;
+
import org.osgi.framework.Bundle;
import org.osgi.framework.BundleContext;
@@ -34,13 +38,56 @@
*/
public interface OSGiFramework
{
- /**
- * Get the System Bundle associated with this Framework
- */
- Bundle getSystemBundle();
-
- /**
- * Get the System Bundle Context associated with this Framework
- */
- BundleContext getSystemBundleContext();
+ /**
+ * Get the Framework properties
+ */
+ Map<String, Object> getProperties();
+
+ /**
+ * Set the Framework properties.
+ * This can only be done before the Framework is started.
+ */
+ void setProperties(Map<String, Object> props);
+
+ /**
+ * Get the list of bundles that get installed automatically
+ */
+ List<URL> getAutoInstall();
+
+ /**
+ * Set the list of bundles that get installed automatically.
+ * This can only be done before the Framework is started.
+ */
+ void setAutoInstall(List<URL> autoInstall);
+
+ /**
+ * Get the list of bundles that get installed and started automatically
+ */
+ List<URL> getAutoStart();
+
+ /**
+ * Set the list of bundles that get installed and started automatically.
+ * This can only be done before the Framework is started.
+ */
+ void setAutoStart(List<URL> autoStart);
+
+ /**
+ * Start the Framework
+ */
+ void start();
+
+ /**
+ * Stop the Framework
+ */
+ void stop();
+
+ /**
+ * Get the System Bundle associated with this Framework
+ */
+ Bundle getSystemBundle();
+
+ /**
+ * Get the System Bundle Context associated with this Framework
+ */
+ BundleContext getSystemBundleContext();
}
\ No newline at end of file
Modified: projects/jboss-osgi/trunk/testsuite/functional/src/test/java/org/jboss/test/osgi/bootstrap/MockFramework.java
===================================================================
--- projects/jboss-osgi/trunk/testsuite/functional/src/test/java/org/jboss/test/osgi/bootstrap/MockFramework.java 2009-04-17 08:57:52 UTC (rev 87479)
+++ projects/jboss-osgi/trunk/testsuite/functional/src/test/java/org/jboss/test/osgi/bootstrap/MockFramework.java 2009-04-17 09:11:43 UTC (rev 87480)
@@ -23,6 +23,10 @@
//$Id: MockFramework.java 84917 2009-03-02 08:18:40Z thomas.diesler at jboss.com $
+import java.net.URL;
+import java.util.List;
+import java.util.Map;
+
import org.jboss.osgi.spi.framework.OSGiFramework;
import org.osgi.framework.Bundle;
import org.osgi.framework.BundleContext;
@@ -44,4 +48,39 @@
{
return null;
}
+
+ public List<URL> getAutoInstall()
+ {
+ return null;
+ }
+
+ public List<URL> getAutoStart()
+ {
+ return null;
+ }
+
+ public Map<String, Object> getProperties()
+ {
+ return null;
+ }
+
+ public void setAutoInstall(List<URL> autoInstall)
+ {
+ }
+
+ public void setAutoStart(List<URL> autoStart)
+ {
+ }
+
+ public void setProperties(Map<String, Object> props)
+ {
+ }
+
+ public void start()
+ {
+ }
+
+ public void stop()
+ {
+ }
}
\ No newline at end of file
Modified: projects/jboss-osgi/trunk/testsuite/functional/src/test/java/org/jboss/test/osgi/jbosgi39/FELIX1040TestCase.java
===================================================================
--- projects/jboss-osgi/trunk/testsuite/functional/src/test/java/org/jboss/test/osgi/jbosgi39/FELIX1040TestCase.java 2009-04-17 08:57:52 UTC (rev 87479)
+++ projects/jboss-osgi/trunk/testsuite/functional/src/test/java/org/jboss/test/osgi/jbosgi39/FELIX1040TestCase.java 2009-04-17 09:11:43 UTC (rev 87480)
@@ -23,6 +23,7 @@
//$Id$
+import org.jboss.osgi.felix.framework.FelixIntegration;
import org.jboss.osgi.spi.framework.OSGiFramework;
import org.jboss.osgi.spi.junit.OSGiTest;
import org.osgi.framework.Bundle;
@@ -48,6 +49,9 @@
assertEquals("Bundle installed", Bundle.INSTALLED, bundleA.getState());
bundleA.start();
+
+ // Stop the framework
+ fwOne.stop();
OSGiFramework fwTwo = createBootstrapProvider().getFramework();
BundleContext ctxTwo = fwTwo.getSystemBundleContext();
More information about the jboss-osgi-commits
mailing list