JBoss-OSGI SVN: r97934 - in projects/jboss-osgi/projects/runtime/framework/branches/tdiesler/src: main/java/org/jboss/osgi/framework/deployers and 7 other directories.
by jboss-osgi-commits@lists.jboss.org
Author: thomas.diesler(a)jboss.com
Date: 2009-12-17 03:47:52 -0500 (Thu, 17 Dec 2009)
New Revision: 97934
Modified:
projects/jboss-osgi/projects/runtime/framework/branches/tdiesler/src/main/java/org/jboss/osgi/framework/bundle/AbstractBundleState.java
projects/jboss-osgi/projects/runtime/framework/branches/tdiesler/src/main/java/org/jboss/osgi/framework/bundle/OSGiBundleManager.java
projects/jboss-osgi/projects/runtime/framework/branches/tdiesler/src/main/java/org/jboss/osgi/framework/bundle/OSGiBundleState.java
projects/jboss-osgi/projects/runtime/framework/branches/tdiesler/src/main/java/org/jboss/osgi/framework/bundle/OSGiSystemState.java
projects/jboss-osgi/projects/runtime/framework/branches/tdiesler/src/main/java/org/jboss/osgi/framework/deployers/AbstractOSGiBundleStateDeployer.java
projects/jboss-osgi/projects/runtime/framework/branches/tdiesler/src/main/java/org/jboss/osgi/framework/deployers/OSGiBundleStateRemoveDeployer.java
projects/jboss-osgi/projects/runtime/framework/branches/tdiesler/src/main/java/org/jboss/osgi/framework/service/internal/DeployerServiceImpl.java
projects/jboss-osgi/projects/runtime/framework/branches/tdiesler/src/test/java/org/jboss/test/osgi/FrameworkTest.java
projects/jboss-osgi/projects/runtime/framework/branches/tdiesler/src/test/java/org/jboss/test/osgi/FrameworkTestDelegate.java
projects/jboss-osgi/projects/runtime/framework/branches/tdiesler/src/test/java/org/jboss/test/osgi/bundle/BundleLifecycleTestCase.java
projects/jboss-osgi/projects/runtime/framework/branches/tdiesler/src/test/java/org/jboss/test/osgi/bundle/BundleUnitTestCase.java
projects/jboss-osgi/projects/runtime/framework/branches/tdiesler/src/test/java/org/jboss/test/osgi/classloader/RequireBundleUnitTestCase.java
projects/jboss-osgi/projects/runtime/framework/branches/tdiesler/src/test/java/org/jboss/test/osgi/compendium/PackageAdminTestCase.java
projects/jboss-osgi/projects/runtime/framework/branches/tdiesler/src/test/java/org/jboss/test/osgi/service/GetServiceReferencesUnitTestCase.java
projects/jboss-osgi/projects/runtime/framework/branches/tdiesler/src/test/java/org/jboss/test/osgi/service/ServiceMixUnitTestCase.java
projects/jboss-osgi/projects/runtime/framework/branches/tdiesler/src/test/java/org/jboss/test/osgi/service/ServiceReferenceUnitTestCase.java
projects/jboss-osgi/projects/runtime/framework/branches/tdiesler/src/test/java/org/jboss/test/osgi/smoke/OSGiSmokeTestCase.java
Log:
Bundle.update() - WIP
Modified: projects/jboss-osgi/projects/runtime/framework/branches/tdiesler/src/main/java/org/jboss/osgi/framework/bundle/AbstractBundleState.java
===================================================================
--- projects/jboss-osgi/projects/runtime/framework/branches/tdiesler/src/main/java/org/jboss/osgi/framework/bundle/AbstractBundleState.java 2009-12-17 08:47:28 UTC (rev 97933)
+++ projects/jboss-osgi/projects/runtime/framework/branches/tdiesler/src/main/java/org/jboss/osgi/framework/bundle/AbstractBundleState.java 2009-12-17 08:47:52 UTC (rev 97934)
@@ -77,9 +77,6 @@
/** The bundle manager */
private OSGiBundleManager bundleManager;
- /** The osgi metadata */
- private OSGiMetaData osgiMetaData;
-
/** The bundle context */
private BundleContext bundleContext;
@@ -89,27 +86,7 @@
/** The bundle state */
private AtomicInteger state = new AtomicInteger(Bundle.UNINSTALLED);
- /** The cached symbolic name */
- private String symbolicName;
-
- /** The cached version */
- private Version version;
-
/**
- * Create a new BundleState for the system bundle.
- *
- * @param osgiMetaData the osgi metadata
- * @throws IllegalArgumentException for a null parameter
- */
- AbstractBundleState(OSGiMetaData osgiMetaData)
- {
- if (osgiMetaData == null)
- throw new IllegalArgumentException("Null osgi metadata");
-
- this.osgiMetaData = osgiMetaData;
- }
-
- /**
* Get the bundleManager.
*
* @return the bundleManager.
@@ -118,26 +95,21 @@
{
if (bundleManager == null)
throw new IllegalStateException("Bundle not installed: " + getCanonicalName());
-
+
return bundleManager;
}
public String getSymbolicName()
{
+ String symbolicName = getOSGiMetaData().getBundleSymbolicName();
if (symbolicName == null)
- {
- symbolicName = osgiMetaData.getBundleSymbolicName();
- if (symbolicName == null)
- throw new IllegalStateException("Cannot obtain " + Constants.BUNDLE_SYMBOLICNAME);
- }
+ throw new IllegalStateException("Cannot obtain " + Constants.BUNDLE_SYMBOLICNAME);
return symbolicName;
}
public Version getVersion()
{
- if (version == null)
- version = osgiMetaData.getBundleVersion();
-
+ Version version = getOSGiMetaData().getBundleVersion();
return version;
}
@@ -202,7 +174,7 @@
List<Bundle> bundles = new ArrayList<Bundle>(bundleStates.size());
for (AbstractBundleState bundleState : bundleStates)
bundles.add(bundleState.getBundleInternal());
-
+
return bundles.toArray(new Bundle[bundles.size()]);
}
@@ -221,10 +193,7 @@
*
* @return the osgiMetaData.
*/
- public OSGiMetaData getOSGiMetaData()
- {
- return osgiMetaData;
- }
+ public abstract OSGiMetaData getOSGiMetaData();
@SuppressWarnings("rawtypes")
public Dictionary getHeaders()
@@ -376,7 +345,7 @@
}
if (references.isEmpty())
- return null;
+ return null;
return references.toArray(new ServiceReference[references.size()]);
}
@@ -510,13 +479,6 @@
stop(0);
}
- public void update() throws BundleException
- {
- checkAdminPermission(AdminPermission.LIFECYCLE); // [TODO] extension bundles
- // [TODO] update
- throw new UnsupportedOperationException("update");
- }
-
void uninstallInternal()
{
changeState(Bundle.UNINSTALLED);
@@ -621,8 +583,19 @@
*/
public void changeState(int state)
{
+ changeState(state, true);
+ }
+
+ /**
+ * Change the state of the bundle
+ *
+ * @param state the new state
+ * @param fireEvent if true the state change fires an event
+ */
+ public void changeState(int state, boolean fireEvent)
+ {
int previous = getState();
-
+
// Get the corresponding bundle event type
int bundleEventType;
switch (state)
@@ -658,7 +631,7 @@
default:
throw new IllegalArgumentException("Unknown bundle state: " + state);
}
-
+
// Invoke the bundle lifecycle interceptors
if (getBundleManager().isFrameworkActive() && getBundleId() != 0)
{
@@ -666,12 +639,12 @@
if (plugin != null)
plugin.handleStateChange(state, getBundleInternal());
}
-
+
this.state.set(state);
log.debug(this + " change state=" + ConstantsHelper.bundleState(state));
// Fire the bundle event
- if (getBundleManager().isFrameworkActive())
+ if (fireEvent == true && getBundleManager().isFrameworkActive())
{
FrameworkEventsPlugin plugin = getBundleManager().getPlugin(FrameworkEventsPlugin.class);
plugin.fireBundleEvent(this, bundleEventType);
@@ -735,13 +708,13 @@
{
if (bundle == null)
throw new IllegalArgumentException("Null bundle");
-
+
if (bundle instanceof OSGiBundleWrapper)
bundle = ((OSGiBundleWrapper)bundle).getBundleState();
-
+
if (bundle instanceof AbstractBundleState == false)
throw new IllegalArgumentException("Not an AbstractBundleState: " + bundle);
-
+
return (AbstractBundleState)bundle;
}
}
Modified: projects/jboss-osgi/projects/runtime/framework/branches/tdiesler/src/main/java/org/jboss/osgi/framework/bundle/OSGiBundleManager.java
===================================================================
--- projects/jboss-osgi/projects/runtime/framework/branches/tdiesler/src/main/java/org/jboss/osgi/framework/bundle/OSGiBundleManager.java 2009-12-17 08:47:28 UTC (rev 97933)
+++ projects/jboss-osgi/projects/runtime/framework/branches/tdiesler/src/main/java/org/jboss/osgi/framework/bundle/OSGiBundleManager.java 2009-12-17 08:47:52 UTC (rev 97934)
@@ -92,6 +92,7 @@
import org.jboss.virtual.VirtualFile;
import org.osgi.framework.Bundle;
import org.osgi.framework.BundleContext;
+import org.osgi.framework.BundleEvent;
import org.osgi.framework.BundleException;
import org.osgi.framework.Constants;
import org.osgi.framework.Filter;
@@ -594,7 +595,7 @@
* @return the bundle state
* @throws BundleException for any error
*/
- public AbstractBundleState installBundle(URL url) throws BundleException
+ public OSGiBundleState installBundle(URL url) throws BundleException
{
if (url == null)
throw new BundleException("Null url");
@@ -610,7 +611,7 @@
* @return the bundle state
* @throws BundleException for any error
*/
- public AbstractBundleState installBundle(String location, InputStream input) throws BundleException
+ public OSGiBundleState installBundle(String location, InputStream input) throws BundleException
{
if (location == null)
throw new BundleException("Null location");
@@ -620,23 +621,7 @@
// Get the location URL
if (input != null)
{
- try
- {
- BundleStoragePlugin plugin = getPlugin(BundleStoragePlugin.class);
- String path = plugin.getStorageDir(getSystemBundle()).getCanonicalPath();
-
- // [TODO] do properly
- File file = new File(path + "/bundle-" + System.currentTimeMillis() + ".jar");
- FileOutputStream fos = new FileOutputStream(file);
- VFSUtils.copyStream(input, fos);
- fos.close();
-
- locationURL = file.toURI().toURL();
- }
- catch (IOException ex)
- {
- throw new BundleException("Cannot store bundle from input stream", ex);
- }
+ locationURL = getBundleStorageLocation(input);
}
else
{
@@ -657,6 +642,28 @@
return install(root, location, false);
}
+ private URL getBundleStorageLocation(InputStream input) throws BundleException
+ {
+ try
+ {
+ BundleStoragePlugin plugin = getPlugin(BundleStoragePlugin.class);
+ String path = plugin.getStorageDir(getSystemBundle()).getCanonicalPath();
+
+ // [TODO] do properly
+ File file = new File(path + "/bundle-" + System.currentTimeMillis() + ".jar");
+ FileOutputStream fos = new FileOutputStream(file);
+ VFSUtils.copyStream(input, fos);
+ fos.close();
+
+ URL locationURL = file.toURI().toURL();
+ return locationURL;
+ }
+ catch (IOException ex)
+ {
+ throw new BundleException("Cannot store bundle from input stream", ex);
+ }
+ }
+
/**
* Install a bundle from a virtual file.
*
@@ -665,7 +672,7 @@
* @return the bundle state
* @throws BundleException for any error
*/
- public AbstractBundleState installBundle(VirtualFile root) throws BundleException
+ public OSGiBundleState installBundle(VirtualFile root) throws BundleException
{
return install(root, root.toString(), false);
}
@@ -673,7 +680,7 @@
/*
* Installs a bundle from the given virtual file.
*/
- private AbstractBundleState install(VirtualFile root, String location, boolean autoStart) throws BundleException
+ private OSGiBundleState install(VirtualFile root, String location, boolean autoStart) throws BundleException
{
if (location == null)
throw new IllegalArgumentException("Null location");
@@ -693,7 +700,7 @@
* @return the bundle state
* @throws BundleException for any error
*/
- public AbstractBundleState installBundle(Deployment dep) throws BundleException
+ public OSGiBundleState installBundle(Deployment dep) throws BundleException
{
// Create the deployment and deploy it
try
@@ -731,38 +738,98 @@
}
}
- private URL getLocationURL(String location) throws BundleException
+ /**
+ * Updates a bundle from an InputStream.
+ */
+ public void updateBundle(OSGiBundleState bundleState, InputStream in) throws BundleException
{
- // Try location as URL
- URL url = null;
- try
+ // If the specified InputStream is null, the Framework must create the InputStream from which to read the updated bundle by interpreting,
+ // in an implementation dependent manner, this bundle's Bundle-UpdateLocation Manifest header, if present, or this bundle's original location.
+ URL updateURL = bundleState.getOSGiMetaData().getBundleUpdateLocation();
+ if (in == null)
{
- url = new URL(location);
+ try
+ {
+ if (updateURL == null)
+ throw new IllegalStateException("Cannot obtain Bundle-UpdateLocation for: " + bundleState);
+
+ in = updateURL.openStream();
+ }
+ catch (IOException ex)
+ {
+ throw new BundleException("Cannot obtain update input stream for: " + bundleState, ex);
+ }
}
- catch (MalformedURLException e)
+
+ // If this bundle's state is ACTIVE, it must be stopped before the update and started after the update successfully completes.
+ boolean activeBeforeUpdate = (bundleState.getState() == Bundle.ACTIVE);
+
+ // If this bundle's state is UNINSTALLED then an IllegalStateException is thrown.
+ if (bundleState.getState() == Bundle.UNINSTALLED)
+ throw new IllegalStateException("Bundle already uninstalled: " + this);
+
+ // If this bundle has exported any packages that are imported by another bundle, these packages must not be updated.
+ // Instead, the previous package version must remain exported until the PackageAdmin.refreshPackages method has been
+ // has been called or the Framework is relaunched.
+
+ // If this bundle's state is ACTIVE, STARTING or STOPPING, this bundle is stopped as described in the Bundle.stop method.
+ // If Bundle.stop throws an exception, the exception is rethrown terminating the update.
+ if (bundleState.getState() == Bundle.ACTIVE || bundleState.getState() == Bundle.STARTING || bundleState.getState() == Bundle.STOPPING)
{
- // ignore
+ stopBundle(bundleState);
}
- // Try location as File
- if (url == null)
+ // The updated version of this bundle is read from the input stream and installed.
+ // If the Framework is unable to install the updated version of this bundle, the original version of this bundle must be restored
+ // and a BundleException must be thrown after completion of the remaining steps.
+ String location = (updateURL != null ? updateURL.toExternalForm() : bundleState.getCanonicalName() + "/update");
+ OSGiBundleState updatedBundleState = null;
+ BundleException throwAfterUpdate = null;
+ try
{
- try
+ URL storageLocation = getBundleStorageLocation(in);
+ VirtualFile root = VFS.getRoot(storageLocation);
+
+ BundleInfo info = BundleInfo.createBundleInfo(root, location);
+ Deployment dep = DeploymentFactory.createDeployment(info);
+ dep.addAttachment(OSGiBundleState.class, bundleState);
+ dep.setBundleUpdate(true);
+ dep.setAutoStart(false);
+
+ updatedBundleState = installBundle(dep);
+ }
+ catch (Exception ex)
+ {
+ if (ex instanceof BundleException)
+ throwAfterUpdate = (BundleException)ex;
+ else
+ throwAfterUpdate = new BundleException("Cannot install updated bundle from: " + location, ex);
+
+ if (activeBeforeUpdate)
{
- File file = new File(location);
- if (file.exists())
- url = file.toURI().toURL();
+ startBundle(bundleState);
}
- catch (MalformedURLException e)
+ }
+
+ // If the updated version of this bundle was successfully installed, a bundle event of type BundleEvent.UPDATED is fired
+ if (updatedBundleState != null)
+ {
+ FrameworkEventsPlugin plugin = getPlugin(FrameworkEventsPlugin.class);
+ plugin.fireBundleEvent(updatedBundleState, BundleEvent.UPDATED);
+
+ // If this bundle's state was originally ACTIVE, the updated bundle is started as described in the Bundle.start method.
+ // If Bundle.start throws an exception, a Framework event of type FrameworkEvent.ERROR is fired containing the exception
+ if (activeBeforeUpdate)
{
- // ignore
+ startBundle(updatedBundleState);
}
}
- if (url == null)
- throw new BundleException("Unable to handle location=" + location);
-
- return url;
+ // A BundleException must be thrown after completion of the remaining steps
+ if (throwAfterUpdate != null)
+ {
+ throw throwAfterUpdate;
+ }
}
/**
@@ -823,8 +890,18 @@
Deployment dep = unit.getAttachment(Deployment.class);
String location = (dep != null ? dep.getLocation() : unit.getName());
- OSGiBundleState bundleState = new OSGiBundleState(location, osgiMetaData, unit);
- addBundle(bundleState);
+ // In case of Bundle.update() the OSGiBundleState should be attached
+ // we add the DeploymentUnit
+ OSGiBundleState bundleState = (dep != null ? dep.getAttachment(OSGiBundleState.class) : null);
+ if (bundleState != null)
+ bundleState.addDeploymentUnit(unit);
+
+ // Create a new OSGiBundleState and add it to the manager
+ if (bundleState == null)
+ {
+ bundleState = new OSGiBundleState(location, unit);
+ addBundle(bundleState);
+ }
return bundleState;
}
@@ -867,7 +944,16 @@
bundleState.setBundleManager(this);
bundles.add(bundleState);
- bundleState.changeState(Bundle.INSTALLED);
+ // Only fire the INSTALLED event if this is not an update
+ boolean fireEvent = true;
+ if (bundleState instanceof OSGiBundleState)
+ {
+ DeploymentUnit unit = ((OSGiBundleState)bundleState).getDeploymentUnit();
+ Deployment dep = unit.getAttachment(Deployment.class);
+ fireEvent = (dep == null || dep.isBundleUpdate() == false);
+ }
+
+ bundleState.changeState(Bundle.INSTALLED, fireEvent);
// Add the bundle to the resolver
// Note, plugins are not registered when the system bundle is added
@@ -887,6 +973,8 @@
private void validateBundle(AbstractBundleState bundleState)
{
OSGiMetaData metaData = bundleState.getOSGiMetaData();
+ if (metaData == null)
+ return;
String symbolicName = metaData.getBundleSymbolicName();
if (symbolicName == null)
@@ -1201,7 +1289,7 @@
// Resolve all INSTALLED bundles through the PackageAdmin
PackageAdmin packageAdmin = getPlugin(PackageAdminPlugin.class);
packageAdmin.resolveBundles(null);
-
+
if (bundleState.getState() != Bundle.RESOLVED)
throw new BundleException("Cannot resolve bundle: " + bundleState);
}
@@ -1256,7 +1344,7 @@
// [TODO] If this bundle is in the process of being activated or deactivated then this method must wait for activation or deactivation
// to complete before continuing. If this does not occur in a reasonable time, a BundleException is thrown to indicate this bundle
// was unable to be stopped.
-
+
// [TODO] If the STOP_TRANSIENT option is not set then then set this bundle's persistent autostart setting to to Stopped.
// When the Framework is restarted and this bundle's autostart setting is Stopped, this bundle must not be automatically started.
@@ -1269,7 +1357,7 @@
DeploymentUnit unit = bundleState.getDeploymentUnit();
deployerClient.change(unit.getName(), DeploymentStages.CLASSLOADER);
deployerClient.checkComplete(unit.getName());
-
+
// The potential BundleException is attached by the OSGiBundleActivatorDeployer
BundleException stopEx = unit.removeAttachment(BundleException.class);
if (stopEx != null)
@@ -1282,7 +1370,7 @@
Throwable cause = ex.getCause();
if (cause instanceof BundleException)
throw (BundleException)cause;
-
+
throw new BundleException("Error stopping " + bundleState, (cause != null ? cause : ex));
}
}
@@ -1847,6 +1935,40 @@
}
}
+ private URL getLocationURL(String location) throws BundleException
+ {
+ // Try location as URL
+ URL url = null;
+ try
+ {
+ url = new URL(location);
+ }
+ catch (MalformedURLException e)
+ {
+ // ignore
+ }
+
+ // Try location as File
+ if (url == null)
+ {
+ try
+ {
+ File file = new File(location);
+ if (file.exists())
+ url = file.toURI().toURL();
+ }
+ catch (MalformedURLException e)
+ {
+ // ignore
+ }
+ }
+
+ if (url == null)
+ throw new BundleException("Unable to handle location=" + location);
+
+ return url;
+ }
+
/**
* Fire a framework error
*
Modified: projects/jboss-osgi/projects/runtime/framework/branches/tdiesler/src/main/java/org/jboss/osgi/framework/bundle/OSGiBundleState.java
===================================================================
--- projects/jboss-osgi/projects/runtime/framework/branches/tdiesler/src/main/java/org/jboss/osgi/framework/bundle/OSGiBundleState.java 2009-12-17 08:47:28 UTC (rev 97933)
+++ projects/jboss-osgi/projects/runtime/framework/branches/tdiesler/src/main/java/org/jboss/osgi/framework/bundle/OSGiBundleState.java 2009-12-17 08:47:52 UTC (rev 97934)
@@ -26,6 +26,7 @@
import java.net.URL;
import java.util.Enumeration;
import java.util.Set;
+import java.util.Stack;
import java.util.concurrent.atomic.AtomicLong;
import org.jboss.dependency.spi.ControllerContext;
@@ -59,8 +60,8 @@
/** The bundle location */
private String location;
- /** The deployment unit */
- private DeploymentUnit unit;
+ /** The stack of deployment units */
+ private Stack<DeploymentUnit> units = new Stack<DeploymentUnit>();
/**
* Create a new BundleState.
@@ -70,22 +71,27 @@
* @param unit the deployment unit
* @throws IllegalArgumentException for a null parameter
*/
- public OSGiBundleState(String location, OSGiMetaData osgiMetaData, DeploymentUnit unit)
+ public OSGiBundleState(String location, DeploymentUnit unit)
{
- super(osgiMetaData);
-
if (location == null)
throw new IllegalArgumentException("Null bundle location");
if (unit == null)
- throw new IllegalArgumentException("Null deployment unit");
+ throw new IllegalArgumentException("Null deployment unit");
- this.unit = unit;
this.location = location;
+ this.bundleId = bundleIDGenerator.incrementAndGet();
- this.bundleId = bundleIDGenerator.incrementAndGet();
- unit.getMutableMetaData().addMetaData(unit, DeploymentUnit.class);
+ addDeploymentUnit(unit);
}
+ @Override
+ public OSGiMetaData getOSGiMetaData()
+ {
+ DeploymentUnit unit = getDeploymentUnit();
+ OSGiMetaData metadata = unit.getAttachment(OSGiMetaData.class);
+ return metadata;
+ }
+
protected Set<ControllerContext> getRegisteredContexts()
{
return getBundleManager().getRegisteredContext(this);
@@ -97,15 +103,30 @@
}
/**
- * Get the unit.
+ * Get the DeploymentUnit that was added last.
*
- * @return the unit.
+ * Initially, an OSGiBundleState is associated with just one DeploymentUnit.
+ * A sucessful call to {@link #update()} or its variants pushes an additional
+ * DeploymentUnit to the stack.
+ *
+ * @return the unit that corresponds to the last sucessful update.
*/
public DeploymentUnit getDeploymentUnit()
{
- return unit;
+ return units.peek();
}
+ /**
+ * Add a DeploymentUnit to the stack.
+ *
+ * @see {@link OSGiBundleManager#updateBundle(OSGiBundleState, InputStream)}
+ */
+ void addDeploymentUnit(DeploymentUnit unit)
+ {
+ unit.getMutableMetaData().addMetaData(unit, DeploymentUnit.class);
+ units.push(unit);
+ }
+
public String getLocation()
{
return location;
@@ -224,11 +245,11 @@
checkInstalled();
if (noAdminPermission(AdminPermission.RESOURCE))
return null;
-
+
// [TODO] bundle fragment
if (resolveBundle() == false)
return getDeploymentUnit().getResourceLoader().getResource(name);
-
+
return getDeploymentUnit().getClassLoader().getResource(name);
}
@@ -242,7 +263,7 @@
// [TODO] bundle fragment
if (resolveBundle() == false)
return getDeploymentUnit().getResourceLoader().getResources(name);
-
+
return getDeploymentUnit().getClassLoader().getResources(name);
}
@@ -293,7 +314,7 @@
// Attach so we can call BundleActivator.stop() on this instance
BundleActivator bundleActivator = (BundleActivator)result;
- unit.addAttachment(BundleActivator.class, bundleActivator);
+ getDeploymentUnit().addAttachment(BundleActivator.class, bundleActivator);
bundleActivator.start(getBundleContext());
}
@@ -303,7 +324,7 @@
changeState(ACTIVE);
}
-
+
// If the BundleActivator is invalid or throws an exception then:
// * This bundle's state is set to STOPPING.
// * A bundle event of type BundleEvent.STOPPING is fired.
@@ -318,20 +339,20 @@
// This bundle's state is set to STOPPING
// A bundle event of type BundleEvent.STOPPING is fired
changeState(STOPPING);
-
+
// Any services registered by this bundle must be unregistered.
// Any services used by this bundle must be released.
// Any listeners registered by this bundle must be removed.
stopInternal();
-
+
// This bundle's state is set to RESOLVED
// A bundle event of type BundleEvent.STOPPED is fired
destroyBundleContext();
changeState(RESOLVED);
-
+
if (t instanceof BundleException)
throw (BundleException)t;
-
+
throw new BundleException("Cannot start bundle: " + this, t);
}
}
@@ -356,21 +377,21 @@
Throwable rethrow = null;
if (priorState == Bundle.ACTIVE)
{
- BundleActivator bundleActivator = getDeploymentUnit().getAttachment(BundleActivator.class);
- BundleContext bundleContext = getBundleContext();
- if (bundleActivator != null && bundleContext != null)
+ BundleActivator bundleActivator = getDeploymentUnit().getAttachment(BundleActivator.class);
+ BundleContext bundleContext = getBundleContext();
+ if (bundleActivator != null && bundleContext != null)
+ {
+ try
{
- try
- {
- bundleActivator.stop(bundleContext);
- }
- catch (Throwable t)
- {
- rethrow = t;
- }
+ bundleActivator.stop(bundleContext);
}
+ catch (Throwable t)
+ {
+ rethrow = t;
+ }
+ }
}
-
+
// Any services registered by this bundle must be unregistered
getBundleManager().unregisterContexts(this);
@@ -393,26 +414,48 @@
}
// [TODO] Any listeners registered by this bundle must be removed
-
+
// If this bundle's state is UNINSTALLED, because this bundle was uninstalled while the
// BundleActivator.stop method was running, a BundleException must be thrown
if (getState() == Bundle.UNINSTALLED)
throw new BundleException("Bundle uninstalled during activator stop: " + this);
-
+
// This bundle's state is set to RESOLVED
// A bundle event of type BundleEvent.STOPPED is fired
destroyBundleContext();
changeState(RESOLVED);
-
+
if (rethrow != null)
throw new BundleException("Error during stop of bundle: " + this, rethrow);
}
+ /**
+ * Updates this bundle.
+ *
+ * This method performs the same function as calling update(InputStream) with a null InputStream
+ */
+ public void update() throws BundleException
+ {
+ update(null);
+ }
+
+ /**
+ * Updates this bundle from an InputStream.
+ */
public void update(InputStream in) throws BundleException
{
- checkAdminPermission(AdminPermission.LIFECYCLE); // [TODO] extension bundles
- // [TODO] update
- throw new UnsupportedOperationException("update");
+ checkAdminPermission(AdminPermission.LIFECYCLE);
+ try
+ {
+ getBundleManager().updateBundle(this, in);
+ }
+ catch (Exception ex)
+ {
+ if (ex instanceof BundleException)
+ throw (BundleException)ex;
+
+ throw new BundleException("Cannot update bundle: " + this, ex);
+ }
}
public void uninstall() throws BundleException
@@ -424,26 +467,26 @@
@Override
protected void afterServiceRegistration(OSGiServiceState service)
{
- getBundleManager().putContext(service, unit);
+ getBundleManager().putContext(service, getDeploymentUnit());
}
@Override
protected void beforeServiceUnregistration(OSGiServiceState service)
{
- getBundleManager().removeContext(service, unit);
+ getBundleManager().removeContext(service, getDeploymentUnit());
}
public static OSGiBundleState assertBundleState(Bundle bundle)
{
if (bundle == null)
throw new IllegalArgumentException("Null bundle");
-
+
if (bundle instanceof OSGiBundleWrapper)
bundle = ((OSGiBundleWrapper)bundle).getBundleState();
-
+
if (bundle instanceof OSGiBundleState == false)
throw new IllegalArgumentException("Not an OSGiBundleState: " + bundle);
-
+
return (OSGiBundleState)bundle;
}
}
Modified: projects/jboss-osgi/projects/runtime/framework/branches/tdiesler/src/main/java/org/jboss/osgi/framework/bundle/OSGiSystemState.java
===================================================================
--- projects/jboss-osgi/projects/runtime/framework/branches/tdiesler/src/main/java/org/jboss/osgi/framework/bundle/OSGiSystemState.java 2009-12-17 08:47:28 UTC (rev 97933)
+++ projects/jboss-osgi/projects/runtime/framework/branches/tdiesler/src/main/java/org/jboss/osgi/framework/bundle/OSGiSystemState.java 2009-12-17 08:47:52 UTC (rev 97934)
@@ -46,6 +46,8 @@
{
/** The registred contexts */
private Set<ControllerContext> registered = new ConcurrentSet<ControllerContext>();
+ /** The osgi metadata */
+ private OSGiMetaData osgiMetaData;
/**
* Create a new OSGiSystemBundle.
@@ -53,9 +55,18 @@
*/
public OSGiSystemState(OSGiMetaData osgiMetaData)
{
- super(osgiMetaData);
+ if (osgiMetaData == null)
+ throw new IllegalArgumentException("Null osgi metadata");
+
+ this.osgiMetaData = osgiMetaData;
}
+ @Override
+ public OSGiMetaData getOSGiMetaData()
+ {
+ return osgiMetaData;
+ }
+
protected Set<ControllerContext> getRegisteredContexts()
{
return registered;
@@ -161,7 +172,6 @@
});
}
- @Override
public void update() throws BundleException
{
final OSGiBundleManager bundleManager = getBundleManager();
Modified: projects/jboss-osgi/projects/runtime/framework/branches/tdiesler/src/main/java/org/jboss/osgi/framework/deployers/AbstractOSGiBundleStateDeployer.java
===================================================================
--- projects/jboss-osgi/projects/runtime/framework/branches/tdiesler/src/main/java/org/jboss/osgi/framework/deployers/AbstractOSGiBundleStateDeployer.java 2009-12-17 08:47:28 UTC (rev 97933)
+++ projects/jboss-osgi/projects/runtime/framework/branches/tdiesler/src/main/java/org/jboss/osgi/framework/deployers/AbstractOSGiBundleStateDeployer.java 2009-12-17 08:47:52 UTC (rev 97934)
@@ -21,13 +21,12 @@
*/
package org.jboss.osgi.framework.deployers;
+import org.jboss.deployers.spi.DeploymentException;
import org.jboss.deployers.spi.deployer.DeploymentStages;
import org.jboss.deployers.spi.deployer.helpers.AbstractRealDeployer;
-import org.jboss.deployers.spi.DeploymentException;
import org.jboss.deployers.structure.spi.DeploymentUnit;
import org.jboss.osgi.framework.bundle.OSGiBundleManager;
import org.jboss.osgi.framework.bundle.OSGiBundleState;
-import org.jboss.osgi.framework.metadata.OSGiMetaData;
/**
* AbstractOSGiBundleStateDeployer.<p>
@@ -40,12 +39,6 @@
/** The bundle manager */
protected OSGiBundleManager bundleManager;
- /**
- * Create a new BundleStateDeployer.
- *
- * @param bundleManager the bundleManager
- * @throws IllegalArgumentException for a null bundle manager
- */
protected AbstractOSGiBundleStateDeployer(OSGiBundleManager bundleManager)
{
if (bundleManager == null)
Modified: projects/jboss-osgi/projects/runtime/framework/branches/tdiesler/src/main/java/org/jboss/osgi/framework/deployers/OSGiBundleStateRemoveDeployer.java
===================================================================
--- projects/jboss-osgi/projects/runtime/framework/branches/tdiesler/src/main/java/org/jboss/osgi/framework/deployers/OSGiBundleStateRemoveDeployer.java 2009-12-17 08:47:28 UTC (rev 97933)
+++ projects/jboss-osgi/projects/runtime/framework/branches/tdiesler/src/main/java/org/jboss/osgi/framework/deployers/OSGiBundleStateRemoveDeployer.java 2009-12-17 08:47:52 UTC (rev 97934)
@@ -21,7 +21,6 @@
*/
package org.jboss.osgi.framework.deployers;
-import org.jboss.deployers.spi.DeploymentException;
import org.jboss.deployers.structure.spi.DeploymentUnit;
import org.jboss.osgi.framework.bundle.OSGiBundleManager;
import org.jboss.osgi.framework.bundle.OSGiBundleState;
Modified: projects/jboss-osgi/projects/runtime/framework/branches/tdiesler/src/main/java/org/jboss/osgi/framework/service/internal/DeployerServiceImpl.java
===================================================================
--- projects/jboss-osgi/projects/runtime/framework/branches/tdiesler/src/main/java/org/jboss/osgi/framework/service/internal/DeployerServiceImpl.java 2009-12-17 08:47:28 UTC (rev 97933)
+++ projects/jboss-osgi/projects/runtime/framework/branches/tdiesler/src/main/java/org/jboss/osgi/framework/service/internal/DeployerServiceImpl.java 2009-12-17 08:47:52 UTC (rev 97934)
@@ -76,17 +76,17 @@
// do nothing
}
- public Deployment createDeployment(URL url)
+ public Deployment createDeployment(URL url) throws BundleException
{
return delegate.createDeployment(url);
}
- public Deployment createDeployment(VirtualFile file)
+ public Deployment createDeployment(VirtualFile file) throws BundleException
{
return delegate.createDeployment(file);
}
- public Deployment createDeployment(BundleInfo info)
+ public Deployment createDeployment(BundleInfo info) throws BundleException
{
return delegate.createDeployment(info);
}
Modified: projects/jboss-osgi/projects/runtime/framework/branches/tdiesler/src/test/java/org/jboss/test/osgi/FrameworkTest.java
===================================================================
--- projects/jboss-osgi/projects/runtime/framework/branches/tdiesler/src/test/java/org/jboss/test/osgi/FrameworkTest.java 2009-12-17 08:47:28 UTC (rev 97933)
+++ projects/jboss-osgi/projects/runtime/framework/branches/tdiesler/src/test/java/org/jboss/test/osgi/FrameworkTest.java 2009-12-17 08:47:52 UTC (rev 97934)
@@ -169,16 +169,19 @@
protected Bundle installBundle(String location) throws BundleException
{
- BundleContext context = getBundleManager().getSystemContext();
- return context.installBundle(location);
+ return getBundleManager().installBundle(location, null);
}
protected Bundle installBundle(String location, InputStream instream) throws BundleException
{
- BundleContext context = getBundleManager().getSystemContext();
- return context.installBundle(location, instream);
+ return getBundleManager().installBundle(location, instream);
}
+ protected Bundle installBundle(VirtualFile bundleFile) throws BundleException
+ {
+ return getBundleManager().installBundle(bundleFile);
+ }
+
/**
* Remove a bundle
*
@@ -195,12 +198,12 @@
return getDelegate().getDeploymentUnit(bundle);
}
- protected Bundle assembleBundle(String name, String resources, Class<?>... packages) throws Exception
+ protected VirtualFile assembleBundle(String name, String resources, Class<?>... packages) throws Exception
{
return getDelegate().assembleBundle(name, new String[] { resources }, packages);
}
- protected Bundle assembleBundle(String name, String[] resourcePaths, Class<?>... packages) throws Exception
+ protected VirtualFile assembleBundle(String name, String[] resourcePaths, Class<?>... packages) throws Exception
{
return getDelegate().assembleBundle(name, resourcePaths, packages);
}
Modified: projects/jboss-osgi/projects/runtime/framework/branches/tdiesler/src/test/java/org/jboss/test/osgi/FrameworkTestDelegate.java
===================================================================
--- projects/jboss-osgi/projects/runtime/framework/branches/tdiesler/src/test/java/org/jboss/test/osgi/FrameworkTestDelegate.java 2009-12-17 08:47:28 UTC (rev 97933)
+++ projects/jboss-osgi/projects/runtime/framework/branches/tdiesler/src/test/java/org/jboss/test/osgi/FrameworkTestDelegate.java 2009-12-17 08:47:52 UTC (rev 97934)
@@ -217,15 +217,15 @@
return deploymentUnit;
}
- public Bundle assembleBundle(String name, String resources, Class<?>... packages) throws Exception
+ public VirtualFile assembleBundle(String name, String resources, Class<?>... packages) throws Exception
{
return assembleBundle(name, new String[] { resources }, packages);
}
- public Bundle assembleBundle(String name, String[] resourcePaths, Class<?>... packages) throws Exception
+ public VirtualFile assembleBundle(String name, String[] resourcePaths, Class<?>... packages) throws Exception
{
AssembledDirectory assembledDirectory = createAssembledDirectory(name, "", resourcePaths, packages);
- return addBundle(assembledDirectory);
+ return assembledDirectory;
}
public Bundle deployBundle(String name, OSGiMetaData metaData, String resourcePath, Class<?>... packages) throws Exception
Modified: projects/jboss-osgi/projects/runtime/framework/branches/tdiesler/src/test/java/org/jboss/test/osgi/bundle/BundleLifecycleTestCase.java
===================================================================
--- projects/jboss-osgi/projects/runtime/framework/branches/tdiesler/src/test/java/org/jboss/test/osgi/bundle/BundleLifecycleTestCase.java 2009-12-17 08:47:28 UTC (rev 97933)
+++ projects/jboss-osgi/projects/runtime/framework/branches/tdiesler/src/test/java/org/jboss/test/osgi/bundle/BundleLifecycleTestCase.java 2009-12-17 08:47:52 UTC (rev 97934)
@@ -26,7 +26,6 @@
import org.jboss.test.osgi.FrameworkTest;
import org.jboss.test.osgi.bundle.support.a.FailOnStartActivator;
import org.jboss.test.osgi.bundle.support.b.LifecycleService;
-import org.jboss.test.osgi.bundle.support.b.LifecycleServiceActivator;
import org.osgi.framework.Bundle;
import org.osgi.framework.BundleException;
import org.osgi.framework.ServiceReference;
@@ -54,7 +53,7 @@
*/
public void testServiceBundle() throws Exception
{
- Bundle bundleA = assembleBundle("lifecycle-service", "/bundles/lifecycle/simple-service", LifecycleService.class, LifecycleServiceActivator.class);
+ Bundle bundleA = installBundle(assembleBundle("lifecycle-service", "/bundles/lifecycle/simple-service", LifecycleService.class));
try
{
assertBundleState(Bundle.INSTALLED, bundleA.getState());
@@ -77,7 +76,7 @@
*/
public void testServiceNotAvailable() throws Exception
{
- Bundle bundleA = assembleBundle("lifecycle-service", "/bundles/lifecycle/simple-service", LifecycleService.class, LifecycleServiceActivator.class);
+ Bundle bundleA = installBundle(assembleBundle("lifecycle-service", "/bundles/lifecycle/simple-service", LifecycleService.class));
try
{
assertBundleState(Bundle.INSTALLED, bundleA.getState());
@@ -86,7 +85,7 @@
ServiceReference sref = getSystemBundle().getBundleContext().getServiceReference(LifecycleService.class.getName());
assertNull("Service not available", sref);
- Bundle bundleB = assembleBundle("lifecycle-failstart", "/bundles/lifecycle/fail-on-start", FailOnStartActivator.class);
+ Bundle bundleB = installBundle(assembleBundle("lifecycle-failstart", "/bundles/lifecycle/fail-on-start", FailOnStartActivator.class));
try
{
assertBundleState(Bundle.INSTALLED, bundleB.getState());
@@ -116,13 +115,13 @@
*/
public void testServiceAvailable() throws Exception
{
- Bundle bundleA = assembleBundle("lifecycle-service", "/bundles/lifecycle/simple-service", LifecycleService.class, LifecycleServiceActivator.class);
+ Bundle bundleA = installBundle(assembleBundle("lifecycle-service", "/bundles/lifecycle/simple-service", LifecycleService.class));
try
{
bundleA.start();
assertBundleState(Bundle.ACTIVE, bundleA.getState());
- Bundle bundleB = assembleBundle("lifecycle-failstart", "/bundles/lifecycle/fail-on-start", FailOnStartActivator.class);
+ Bundle bundleB = installBundle(assembleBundle("lifecycle-failstart", "/bundles/lifecycle/fail-on-start", FailOnStartActivator.class));
try
{
bundleB.start();
@@ -146,12 +145,12 @@
*/
public void testServiceMakeAvailable() throws Exception
{
- Bundle bundleA = assembleBundle("lifecycle-service", "/bundles/lifecycle/simple-service", LifecycleService.class, LifecycleServiceActivator.class);
+ Bundle bundleA = installBundle(assembleBundle("lifecycle-service", "/bundles/lifecycle/simple-service", LifecycleService.class));
try
{
assertBundleState(Bundle.INSTALLED, bundleA.getState());
- Bundle bundleB = assembleBundle("lifecycle-failstart", "/bundles/lifecycle/fail-on-start", FailOnStartActivator.class);
+ Bundle bundleB = installBundle(assembleBundle("lifecycle-failstart", "/bundles/lifecycle/fail-on-start", FailOnStartActivator.class));
try
{
assertBundleState(Bundle.INSTALLED, bundleB.getState());
Modified: projects/jboss-osgi/projects/runtime/framework/branches/tdiesler/src/test/java/org/jboss/test/osgi/bundle/BundleUnitTestCase.java
===================================================================
--- projects/jboss-osgi/projects/runtime/framework/branches/tdiesler/src/test/java/org/jboss/test/osgi/bundle/BundleUnitTestCase.java 2009-12-17 08:47:28 UTC (rev 97933)
+++ projects/jboss-osgi/projects/runtime/framework/branches/tdiesler/src/test/java/org/jboss/test/osgi/bundle/BundleUnitTestCase.java 2009-12-17 08:47:52 UTC (rev 97934)
@@ -21,13 +21,19 @@
*/
package org.jboss.test.osgi.bundle;
+import java.io.ByteArrayInputStream;
+import java.io.ByteArrayOutputStream;
import java.util.Dictionary;
import java.util.Hashtable;
import java.util.jar.Attributes;
+import java.util.jar.JarOutputStream;
+import java.util.jar.Manifest;
import junit.framework.Test;
import org.jboss.test.osgi.FrameworkTest;
+import org.jboss.virtual.VFSUtils;
+import org.jboss.virtual.VirtualFile;
import org.osgi.framework.Bundle;
import org.osgi.framework.BundleContext;
import org.osgi.framework.BundleException;
@@ -148,7 +154,37 @@
public void testUpdate() throws Exception
{
- // TODO testUpdate
+ VirtualFile assemble1 = assembleBundle("bundle1", "/bundles/update/update-bundle1");
+ VirtualFile assemble2 = assembleBundle("bundle2", "/bundles/update/update-bundle2");
+
+ Manifest manifest = VFSUtils.getManifest(assemble2);
+ ByteArrayOutputStream baos = new ByteArrayOutputStream();
+ new JarOutputStream(baos, manifest).close();
+ ByteArrayInputStream updateStream = new ByteArrayInputStream(baos.toByteArray());
+
+ // [JBVFS-130] VFSUtils.temp(assembledDirectory) cannot create tmp dir
+ // assemble2 = VFSUtils.temp(assemble2);
+
+ Bundle bundle = installBundle(assemble1);
+ try
+ {
+ int beforeCount = getBundleManager().getBundles().size();
+
+ bundle.start();
+ assertBundleState(Bundle.ACTIVE, bundle.getState());
+ assertEquals("Bundle-Version", "1.0.0", bundle.getHeaders().get(Constants.BUNDLE_VERSION));
+
+ bundle.update(updateStream);
+ assertBundleState(Bundle.ACTIVE, bundle.getState());
+ assertEquals("Bundle-Version", "1.0.1", bundle.getHeaders().get(Constants.BUNDLE_VERSION));
+
+ int afterCount = getBundleManager().getBundles().size();
+ assertEquals("Bundle count", beforeCount, afterCount);
+ }
+ finally
+ {
+ uninstall(bundle);
+ }
}
public void testUninstall() throws Exception
@@ -158,10 +194,10 @@
public void testSingleton() throws Exception
{
- Bundle bundle1 = assembleBundle("bundle1", "/bundles/singleton/singleton1");
+ Bundle bundle1 = installBundle(assembleBundle("bundle1", "/bundles/singleton/singleton1"));
try
{
- Bundle bundle2 = assembleBundle("bundle2", "/bundles/singleton/singleton2");
+ Bundle bundle2 = installBundle(assembleBundle("bundle2", "/bundles/singleton/singleton2"));
uninstall(bundle2);
fail("Should not be here!");
}
@@ -177,10 +213,10 @@
public void testNotSingleton() throws Exception
{
- Bundle bundle1 = assembleBundle("bundle1", "/bundles/singleton/singleton1");
+ Bundle bundle1 = installBundle(assembleBundle("bundle1", "/bundles/singleton/singleton1"));
try
{
- Bundle bundle2 = assembleBundle("not-singleton", "/bundles/singleton/not-singleton");
+ Bundle bundle2 = installBundle(assembleBundle("not-singleton", "/bundles/singleton/not-singleton"));
try
{
assertEquals(bundle1.getSymbolicName(), bundle2.getSymbolicName());
@@ -196,7 +232,7 @@
}
}
- @SuppressWarnings("unchecked")
+ @SuppressWarnings({ "rawtypes", "unchecked" })
public void testGetHeaders() throws Exception
{
// TODO case insensistive
Modified: projects/jboss-osgi/projects/runtime/framework/branches/tdiesler/src/test/java/org/jboss/test/osgi/classloader/RequireBundleUnitTestCase.java
===================================================================
--- projects/jboss-osgi/projects/runtime/framework/branches/tdiesler/src/test/java/org/jboss/test/osgi/classloader/RequireBundleUnitTestCase.java 2009-12-17 08:47:28 UTC (rev 97933)
+++ projects/jboss-osgi/projects/runtime/framework/branches/tdiesler/src/test/java/org/jboss/test/osgi/classloader/RequireBundleUnitTestCase.java 2009-12-17 08:47:52 UTC (rev 97934)
@@ -50,12 +50,12 @@
public void testSimpleRequireBundle() throws Exception
{
- Bundle bundle1 = assembleBundle("bundleA", "/bundles/classloader/bundleA", A.class);
+ Bundle bundle1 = installBundle(assembleBundle("bundleA", "/bundles/classloader/bundleA", A.class));
try
{
bundle1.start();
assertLoadClass(bundle1, A.class);
- Bundle bundle2 = assembleBundle("simplerequirebundleA", "/bundles/classloader/simplerequirebundleA", B.class);
+ Bundle bundle2 = installBundle(assembleBundle("simplerequirebundleA", "/bundles/classloader/simplerequirebundleA", B.class));
try
{
bundle2.start();
@@ -75,12 +75,12 @@
public void testSimpleRequireBundleFails() throws Exception
{
- Bundle bundle1 = assembleBundle("bundleA", "/bundles/classloader/bundleA", A.class);
+ Bundle bundle1 = installBundle(assembleBundle("bundleA", "/bundles/classloader/bundleA", A.class));
try
{
bundle1.start();
assertLoadClass(bundle1, A.class);
- Bundle bundle2 = assembleBundle("simplerequirebundlefails", "/bundles/classloader/simplerequirebundlefails", B.class);
+ Bundle bundle2 = installBundle(assembleBundle("simplerequirebundlefails", "/bundles/classloader/simplerequirebundlefails", B.class));
try
{
bundle2.start();
@@ -103,12 +103,12 @@
public void testVersionRequireBundle() throws Exception
{
- Bundle bundle1 = assembleBundle("bundleA", "/bundles/classloader/bundleA", A.class);
+ Bundle bundle1 = installBundle(assembleBundle("bundleA", "/bundles/classloader/bundleA", A.class));
try
{
bundle1.start();
assertLoadClass(bundle1, A.class);
- Bundle bundle2 = assembleBundle("versionrequirebundleA", "/bundles/classloader/versionrequirebundleA", B.class);
+ Bundle bundle2 = installBundle(assembleBundle("versionrequirebundleA", "/bundles/classloader/versionrequirebundleA", B.class));
try
{
bundle2.start();
@@ -128,12 +128,12 @@
public void testVersionRequireBundleFails() throws Exception
{
- Bundle bundle1 = assembleBundle("bundleA", "/bundles/classloader/bundleA", A.class);
+ Bundle bundle1 = installBundle(assembleBundle("bundleA", "/bundles/classloader/bundleA", A.class));
try
{
bundle1.start();
assertLoadClass(bundle1, A.class);
- Bundle bundle2 = assembleBundle("versionrequirebundlefails", "/bundles/classloader/versionrequirebundlefails", B.class);
+ Bundle bundle2 = installBundle(assembleBundle("versionrequirebundlefails", "/bundles/classloader/versionrequirebundlefails", B.class));
try
{
bundle2.start();
@@ -156,12 +156,12 @@
public void testOptionalRequireBundle() throws Exception
{
- Bundle bundle1 = assembleBundle("bundleA", "/bundles/classloader/bundleA", A.class);
+ Bundle bundle1 = installBundle(assembleBundle("bundleA", "/bundles/classloader/bundleA", A.class));
try
{
bundle1.start();
assertLoadClass(bundle1, A.class);
- Bundle bundle2 = assembleBundle("optionalrequirebundleA", "/bundles/classloader/optionalrequirebundleA", B.class);
+ Bundle bundle2 = installBundle(assembleBundle("optionalrequirebundleA", "/bundles/classloader/optionalrequirebundleA", B.class));
try
{
bundle2.start();
@@ -181,12 +181,12 @@
public void testOptionalRequireBundleFails() throws Exception
{
- Bundle bundle1 = assembleBundle("bundleA", "/bundles/classloader/bundleA", A.class);
+ Bundle bundle1 = installBundle(assembleBundle("bundleA", "/bundles/classloader/bundleA", A.class));
try
{
bundle1.start();
assertLoadClass(bundle1, A.class);
- Bundle bundle2 = assembleBundle("optionalrequirebundlefails", "/bundles/classloader/optionalrequirebundlefails", B.class);
+ Bundle bundle2 = installBundle(assembleBundle("optionalrequirebundlefails", "/bundles/classloader/optionalrequirebundlefails", B.class));
try
{
bundle2.start();
@@ -210,7 +210,7 @@
//Bundle-Version: 1.0.0
//Bundle-SymbolicName: org.jboss.test.osgi.classloader.bundleA;test=x
//Export-Package: org.jboss.test.osgi.classloader.support.a;version=1.0.0;test=x
- Bundle bundle1 = assembleBundle("bundleA", "/bundles/classloader/bundleA", A.class);
+ Bundle bundle1 = installBundle(assembleBundle("bundleA", "/bundles/classloader/bundleA", A.class));
try
{
@@ -221,7 +221,7 @@
//Bundle-SymbolicName: org.jboss.test.osgi.classloader.bundleB
//Require-Bundle: org.jboss.test.osgi.classloader.bundleA;visibility:=reexport
//Export-Package: org.jboss.test.osgi.classloader.support.b
- Bundle bundle2 = assembleBundle("reexportrequirebundleA", "/bundles/classloader/reexportrequirebundleA", B.class);
+ Bundle bundle2 = installBundle(assembleBundle("reexportrequirebundleA", "/bundles/classloader/reexportrequirebundleA", B.class));
try
{
@@ -232,7 +232,7 @@
//Bundle-Name: BundleC
//Bundle-SymbolicName: org.jboss.test.osgi.classloader.bundleC
//Require-Bundle: org.jboss.test.osgi.classloader.bundleB
- Bundle bundle3 = assembleBundle("reexportrequirebundleB", "/bundles/classloader/reexportrequirebundleB");
+ Bundle bundle3 = installBundle(assembleBundle("reexportrequirebundleB", "/bundles/classloader/reexportrequirebundleB"));
try
{
@@ -257,18 +257,18 @@
public void testNoReExportRequireBundle() throws Exception
{
- Bundle bundle1 = assembleBundle("bundleA", "/bundles/classloader/bundleA", A.class);
+ Bundle bundle1 = installBundle(assembleBundle("bundleA", "/bundles/classloader/bundleA", A.class));
try
{
bundle1.start();
assertLoadClass(bundle1, A.class);
- Bundle bundle2 = assembleBundle("noreexportrequirebundleA", "/bundles/classloader/noreexportrequirebundleA", B.class);
+ Bundle bundle2 = installBundle(assembleBundle("noreexportrequirebundleA", "/bundles/classloader/noreexportrequirebundleA", B.class));
try
{
bundle2.start();
assertLoadClass(bundle2, A.class, bundle1);
assertLoadClass(bundle2, B.class, bundle2);
- Bundle bundle3 = assembleBundle("reexportrequirebundleB", "/bundles/classloader/reexportrequirebundleB");
+ Bundle bundle3 = installBundle(assembleBundle("reexportrequirebundleB", "/bundles/classloader/reexportrequirebundleB"));
try
{
assertLoadClassFail(bundle3, A.class);
@@ -292,12 +292,12 @@
public void testAttributeRequireBundle() throws Exception
{
- Bundle bundle1 = assembleBundle("bundleA", "/bundles/classloader/bundleA", A.class);
+ Bundle bundle1 = installBundle(assembleBundle("bundleA", "/bundles/classloader/bundleA", A.class));
try
{
bundle1.start();
assertLoadClass(bundle1, A.class);
- Bundle bundle2 = assembleBundle("attributerequirebundleA", "/bundles/classloader/attributerequirebundleA", B.class);
+ Bundle bundle2 = installBundle(assembleBundle("attributerequirebundleA", "/bundles/classloader/attributerequirebundleA", B.class));
try
{
bundle2.start();
@@ -317,12 +317,12 @@
public void testAttributeRequireBundleFails() throws Exception
{
- Bundle bundle1 = assembleBundle("bundleA", "/bundles/classloader/bundleA", A.class);
+ Bundle bundle1 = installBundle(assembleBundle("bundleA", "/bundles/classloader/bundleA", A.class));
try
{
bundle1.start();
assertLoadClass(bundle1, A.class);
- Bundle bundle2 = assembleBundle("attributerequirebundlefails", "/bundles/classloader/attributerequirebundlefails", B.class);
+ Bundle bundle2 = installBundle(assembleBundle("attributerequirebundlefails", "/bundles/classloader/attributerequirebundlefails", B.class));
try
{
bundle2.start();
Modified: projects/jboss-osgi/projects/runtime/framework/branches/tdiesler/src/test/java/org/jboss/test/osgi/compendium/PackageAdminTestCase.java
===================================================================
--- projects/jboss-osgi/projects/runtime/framework/branches/tdiesler/src/test/java/org/jboss/test/osgi/compendium/PackageAdminTestCase.java 2009-12-17 08:47:28 UTC (rev 97933)
+++ projects/jboss-osgi/projects/runtime/framework/branches/tdiesler/src/test/java/org/jboss/test/osgi/compendium/PackageAdminTestCase.java 2009-12-17 08:47:52 UTC (rev 97934)
@@ -54,7 +54,7 @@
public void testGetBudleFromClass() throws Exception
{
- Bundle bundle = assembleBundle("smoke-assembled", "/bundles/smoke/smoke-assembled", PA.class);
+ Bundle bundle = installBundle(assembleBundle("smoke-assembled", "/bundles/smoke/smoke-assembled", PA.class));
try
{
bundle.start();
@@ -68,7 +68,7 @@
Bundle notFound = pa.getBundle(getClass());
assertNull(notFound);
- Bundle other = assembleBundle("simple", "/bundles/simple/simple-bundle1", Other.class);
+ Bundle other = installBundle(assembleBundle("simple", "/bundles/simple/simple-bundle1", Other.class));
try
{
other.start();
Modified: projects/jboss-osgi/projects/runtime/framework/branches/tdiesler/src/test/java/org/jboss/test/osgi/service/GetServiceReferencesUnitTestCase.java
===================================================================
--- projects/jboss-osgi/projects/runtime/framework/branches/tdiesler/src/test/java/org/jboss/test/osgi/service/GetServiceReferencesUnitTestCase.java 2009-12-17 08:47:28 UTC (rev 97933)
+++ projects/jboss-osgi/projects/runtime/framework/branches/tdiesler/src/test/java/org/jboss/test/osgi/service/GetServiceReferencesUnitTestCase.java 2009-12-17 08:47:52 UTC (rev 97934)
@@ -57,7 +57,7 @@
public void testGetServiceReferences() throws Exception
{
- Bundle bundle1 = assembleBundle("simple1", "/bundles/simple/simple-bundle1", A.class);
+ Bundle bundle1 = installBundle(assembleBundle("simple1", "/bundles/simple/simple-bundle1", A.class));
try
{
bundle1.start();
@@ -174,7 +174,7 @@
public void assertGetServiceReferencesNotAssignable(String className) throws Exception
{
- Bundle bundle1 = assembleBundle("simple1", "/bundles/simple/simple-bundle1", A.class);
+ Bundle bundle1 = installBundle(assembleBundle("simple1", "/bundles/simple/simple-bundle1", A.class));
try
{
bundle1.start();
@@ -191,7 +191,7 @@
ServiceReference reference1 = registration1.getReference();
assertNotNull(reference1);
- Bundle bundle2 = assembleBundle("simple2", "/bundles/simple/simple-bundle2", A.class);
+ Bundle bundle2 = installBundle(assembleBundle("simple2", "/bundles/simple/simple-bundle2", A.class));
try
{
bundle2.start();
@@ -272,7 +272,7 @@
public void assertGetServiceReferencesAssignable(String className) throws Exception
{
- Bundle bundle1 = assembleBundle("service2", "/bundles/service/service-bundle2", A.class);
+ Bundle bundle1 = installBundle(assembleBundle("service2", "/bundles/service/service-bundle2", A.class));
try
{
bundle1.start();
@@ -289,7 +289,7 @@
ServiceReference reference1 = registration1.getReference();
assertNotNull(reference1);
- Bundle bundle2 = assembleBundle("service1", "/bundles/service/service-bundle1");
+ Bundle bundle2 = installBundle(assembleBundle("service1", "/bundles/service/service-bundle1"));
try
{
bundle2.start();
@@ -362,7 +362,7 @@
{
String className = A.class.getName();
- Bundle bundle1 = assembleBundle("service2", "/bundles/service/service-bundle2", A.class);
+ Bundle bundle1 = installBundle(assembleBundle("service2", "/bundles/service/service-bundle2", A.class));
try
{
bundle1.start();
@@ -382,7 +382,7 @@
ServiceReference reference1 = registration1.getReference();
assertNotNull(reference1);
- Bundle bundle2 = assembleBundle("service1", "/bundles/service/service-bundle1");
+ Bundle bundle2 = installBundle(assembleBundle("service1", "/bundles/service/service-bundle1"));
try
{
bundle2.start();
@@ -470,7 +470,7 @@
String className = A.class.getName();
String wrongClassName = B.class.getName();
- Bundle bundle1 = assembleBundle("simple1", "/bundles/simple/simple-bundle1", A.class);
+ Bundle bundle1 = installBundle(assembleBundle("simple1", "/bundles/simple/simple-bundle1", A.class));
try
{
bundle1.start();
Modified: projects/jboss-osgi/projects/runtime/framework/branches/tdiesler/src/test/java/org/jboss/test/osgi/service/ServiceMixUnitTestCase.java
===================================================================
--- projects/jboss-osgi/projects/runtime/framework/branches/tdiesler/src/test/java/org/jboss/test/osgi/service/ServiceMixUnitTestCase.java 2009-12-17 08:47:28 UTC (rev 97933)
+++ projects/jboss-osgi/projects/runtime/framework/branches/tdiesler/src/test/java/org/jboss/test/osgi/service/ServiceMixUnitTestCase.java 2009-12-17 08:47:52 UTC (rev 97934)
@@ -66,7 +66,7 @@
Deployment bean = deployBean("beanA", A.class);
try
{
- Bundle bundle1 = assembleBundle("simple1", "/bundles/service/service-bundle1");
+ Bundle bundle1 = installBundle(assembleBundle("simple1", "/bundles/service/service-bundle1"));
try
{
bundle1.start();
@@ -134,7 +134,7 @@
{
KernelControllerContext kcc = getControllerContext("C", null);
- Bundle bundle1 = assembleBundle("simple2", "/bundles/service/service-bundle3");
+ Bundle bundle1 = installBundle(assembleBundle("simple2", "/bundles/service/service-bundle3"));
try
{
bundle1.start();
@@ -191,7 +191,7 @@
{
KernelControllerContext kcc = getControllerContext("C", null);
- Bundle bundle1 = assembleBundle("simple2", "/bundles/service/service-bundle3");
+ Bundle bundle1 = installBundle(assembleBundle("simple2", "/bundles/service/service-bundle3"));
try
{
bundle1.start();
@@ -249,7 +249,7 @@
Deployment bean = addBean("beanA", C.class, bmd, A.class);
try
{
- Bundle bundle1 = assembleBundle("simple2", "/bundles/service/service-bundle3");
+ Bundle bundle1 = installBundle(assembleBundle("simple2", "/bundles/service/service-bundle3"));
try
{
bundle1.start();
@@ -287,6 +287,7 @@
}
}
+ @SuppressWarnings("rawtypes")
public void testServiceFactoryInjection() throws Throwable
{
BeanMetaDataBuilder builder = BeanMetaDataBuilder.createBuilder("C1", C.class.getName());
@@ -301,7 +302,7 @@
Deployment bean2 = addBean("beanA2", null, bmd);
try
{
- Bundle bundle1 = assembleBundle("simple2", "/bundles/service/service-bundle4");
+ Bundle bundle1 = installBundle(assembleBundle("simple2", "/bundles/service/service-bundle4"));
try
{
bundle1.start();
@@ -358,6 +359,7 @@
}
}
+ @SuppressWarnings("rawtypes")
public void testServiceFactoryMix() throws Throwable
{
BeanMetaDataBuilder builder = BeanMetaDataBuilder.createBuilder("C1", C.class.getName());
@@ -366,7 +368,7 @@
Deployment bean1 = addBean("beanA1", C.class, bmd, A.class, D.class);
try
{
- Bundle bundle1 = assembleBundle("simple2", "/bundles/service/service-bundle4");
+ Bundle bundle1 = installBundle(assembleBundle("simple2", "/bundles/service/service-bundle4"));
try
{
bundle1.start();
@@ -463,7 +465,7 @@
Deployment bean = addBean("beanA", A.class);
try
{
- Bundle bundle1 = assembleBundle("simple2", "/bundles/service/service-bundle1");
+ Bundle bundle1 = installBundle(assembleBundle("simple2", "/bundles/service/service-bundle1"));
try
{
bundle1.start();
Modified: projects/jboss-osgi/projects/runtime/framework/branches/tdiesler/src/test/java/org/jboss/test/osgi/service/ServiceReferenceUnitTestCase.java
===================================================================
--- projects/jboss-osgi/projects/runtime/framework/branches/tdiesler/src/test/java/org/jboss/test/osgi/service/ServiceReferenceUnitTestCase.java 2009-12-17 08:47:28 UTC (rev 97933)
+++ projects/jboss-osgi/projects/runtime/framework/branches/tdiesler/src/test/java/org/jboss/test/osgi/service/ServiceReferenceUnitTestCase.java 2009-12-17 08:47:52 UTC (rev 97934)
@@ -374,7 +374,7 @@
public void testIsAssignableToErrors() throws Exception
{
- Bundle bundle = assembleBundle("simple1", "/bundles/simple/simple-bundle1", A.class);
+ Bundle bundle = installBundle(assembleBundle("simple1", "/bundles/simple/simple-bundle1", A.class));
try
{
bundle.start();
@@ -415,7 +415,7 @@
public void testNotAssignableTo() throws Exception
{
- Bundle bundle = assembleBundle("simple1", "/bundles/simple/simple-bundle1", A.class);
+ Bundle bundle = installBundle(assembleBundle("simple1", "/bundles/simple/simple-bundle1", A.class));
try
{
bundle.start();
@@ -428,7 +428,7 @@
ServiceReference reference = registration.getReference();
assertNotNull(reference);
- Bundle bundle2 = assembleBundle("simple2", "/bundles/simple/simple-bundle2", A.class);
+ Bundle bundle2 = installBundle(assembleBundle("simple2", "/bundles/simple/simple-bundle2", A.class));
try
{
assertFalse(reference.isAssignableTo(bundle2, A.class.getName()));
@@ -454,7 +454,7 @@
//Bundle-Name: Service2
//Bundle-SymbolicName: org.jboss.test.osgi.service2
//Export-Package: org.jboss.test.osgi.service.support.a
- Bundle bundle2 = assembleBundle("service2", "/bundles/service/service-bundle2", A.class);
+ Bundle bundle2 = installBundle(assembleBundle("service2", "/bundles/service/service-bundle2", A.class));
try
{
@@ -465,7 +465,7 @@
//Bundle-Name: Service1
//Bundle-SymbolicName: org.jboss.test.osgi.service1
//Import-Package: org.jboss.test.osgi.service.support.a
- Bundle bundle1 = assembleBundle("service1", "/bundles/service/service-bundle1");
+ Bundle bundle1 = installBundle(assembleBundle("service1", "/bundles/service/service-bundle1"));
try
{
Modified: projects/jboss-osgi/projects/runtime/framework/branches/tdiesler/src/test/java/org/jboss/test/osgi/smoke/OSGiSmokeTestCase.java
===================================================================
--- projects/jboss-osgi/projects/runtime/framework/branches/tdiesler/src/test/java/org/jboss/test/osgi/smoke/OSGiSmokeTestCase.java 2009-12-17 08:47:28 UTC (rev 97933)
+++ projects/jboss-osgi/projects/runtime/framework/branches/tdiesler/src/test/java/org/jboss/test/osgi/smoke/OSGiSmokeTestCase.java 2009-12-17 08:47:52 UTC (rev 97934)
@@ -73,7 +73,7 @@
public void testAssembled() throws Exception
{
- Bundle bundle = assembleBundle("smoke-assembled", "/bundles/smoke/smoke-assembled", A.class);
+ Bundle bundle = installBundle(assembleBundle("smoke-assembled", "/bundles/smoke/smoke-assembled", A.class));
try
{
testBundle(bundle, "smoke-assembled", Bundle.INSTALLED);
16 years
JBoss-OSGI SVN: r97930 - projects/jboss-osgi/projects/runtime/framework/branches.
by jboss-osgi-commits@lists.jboss.org
Author: thomas.diesler(a)jboss.com
Date: 2009-12-17 03:43:46 -0500 (Thu, 17 Dec 2009)
New Revision: 97930
Added:
projects/jboss-osgi/projects/runtime/framework/branches/tdiesler/
Log:
create userbranch
Copied: projects/jboss-osgi/projects/runtime/framework/branches/tdiesler (from rev 97929, projects/jboss-osgi/projects/runtime/framework/trunk)
16 years
JBoss-OSGI SVN: r97901 - in projects/jboss-osgi/projects/spi/trunk/src/main/java/org/jboss/osgi/spi: util and 1 other directory.
by jboss-osgi-commits@lists.jboss.org
Author: thomas.diesler(a)jboss.com
Date: 2009-12-16 12:14:55 -0500 (Wed, 16 Dec 2009)
New Revision: 97901
Modified:
projects/jboss-osgi/projects/spi/trunk/src/main/java/org/jboss/osgi/spi/capability/Capability.java
projects/jboss-osgi/projects/spi/trunk/src/main/java/org/jboss/osgi/spi/util/BundleInfo.java
Log:
BundleException on invalid BundleInfo ctor
Modified: projects/jboss-osgi/projects/spi/trunk/src/main/java/org/jboss/osgi/spi/capability/Capability.java
===================================================================
--- projects/jboss-osgi/projects/spi/trunk/src/main/java/org/jboss/osgi/spi/capability/Capability.java 2009-12-16 16:18:34 UTC (rev 97900)
+++ projects/jboss-osgi/projects/spi/trunk/src/main/java/org/jboss/osgi/spi/capability/Capability.java 2009-12-16 17:14:55 UTC (rev 97901)
@@ -30,6 +30,7 @@
import java.util.Map;
import org.jboss.osgi.spi.util.BundleInfo;
+import org.osgi.framework.BundleException;
/**
* An abstract OSGi capability that can be installed in an {@link OSGiRuntime}.
@@ -137,7 +138,19 @@
protected void addBundle(String location)
{
- BundleInfo info = BundleInfo.createBundleInfo(location);
+ BundleInfo info;
+ try
+ {
+ info = BundleInfo.createBundleInfo(location);
+ }
+ catch (BundleException ex)
+ {
+ Throwable cause = ex.getCause();
+ if (cause instanceof RuntimeException)
+ throw (RuntimeException)cause;
+
+ throw new IllegalArgumentException("Cannot create bundle info for: " + location, ex);
+ }
getBundlesInternal().add(info);
}
Modified: projects/jboss-osgi/projects/spi/trunk/src/main/java/org/jboss/osgi/spi/util/BundleInfo.java
===================================================================
--- projects/jboss-osgi/projects/spi/trunk/src/main/java/org/jboss/osgi/spi/util/BundleInfo.java 2009-12-16 16:18:34 UTC (rev 97900)
+++ projects/jboss-osgi/projects/spi/trunk/src/main/java/org/jboss/osgi/spi/util/BundleInfo.java 2009-12-16 17:14:55 UTC (rev 97901)
@@ -34,6 +34,7 @@
import org.jboss.virtual.VFS;
import org.jboss.virtual.VFSUtils;
import org.jboss.virtual.VirtualFile;
+import org.osgi.framework.BundleException;
import org.osgi.framework.Constants;
import org.osgi.framework.Version;
@@ -58,7 +59,7 @@
private transient VirtualFile rootFile;
private transient Manifest manifest;
- public static BundleInfo createBundleInfo(String location)
+ public static BundleInfo createBundleInfo(String location) throws BundleException
{
if (location == null)
throw new IllegalArgumentException("Location cannot be null");
@@ -70,7 +71,7 @@
return new BundleInfo(toVirtualFile(url), url.toExternalForm());
}
- public static BundleInfo createBundleInfo(URL url)
+ public static BundleInfo createBundleInfo(URL url) throws BundleException
{
if (url == null)
throw new IllegalArgumentException("Null root url");
@@ -78,17 +79,17 @@
return new BundleInfo(toVirtualFile(url), url.toExternalForm());
}
- public static BundleInfo createBundleInfo(VirtualFile root)
+ public static BundleInfo createBundleInfo(VirtualFile root) throws BundleException
{
return new BundleInfo(root, null);
}
- public static BundleInfo createBundleInfo(VirtualFile root, String location)
+ public static BundleInfo createBundleInfo(VirtualFile root, String location) throws BundleException
{
return new BundleInfo(root, location);
}
- private BundleInfo(VirtualFile rootFile, String location)
+ private BundleInfo(VirtualFile rootFile, String location) throws BundleException
{
if (rootFile == null)
throw new IllegalArgumentException("Root file cannot be null");
@@ -101,6 +102,16 @@
location = rootURL.toExternalForm();
this.location = location;
+
+ // Initialize the manifest
+ try
+ {
+ manifest = VFSUtils.getManifest(rootFile);
+ }
+ catch (Exception ex)
+ {
+ throw new BundleException("Cannot get manifest from: " + rootURL, ex);
+ }
symbolicName = getManifestHeader(Constants.BUNDLE_SYMBOLICNAME);
if (symbolicName == null)
@@ -163,7 +174,7 @@
return Version.parseVersion(version);
}
- private Manifest getManifest()
+ private Manifest getManifest()
{
if (manifest == null)
{
@@ -173,7 +184,7 @@
}
catch (Exception ex)
{
- throw new IllegalArgumentException("Cannot get manifest from: " + rootURL, ex);
+ throw new IllegalStateException("Cannot get manifest from: " + rootURL, ex);
}
}
return manifest;
16 years
JBoss-OSGI SVN: r97898 - in projects/jboss-osgi/projects/runtime/framework/trunk/src: main/java/org/jboss/osgi/framework/deployers and 2 other directories.
by jboss-osgi-commits@lists.jboss.org
Author: thomas.diesler(a)jboss.com
Date: 2009-12-16 10:56:20 -0500 (Wed, 16 Dec 2009)
New Revision: 97898
Modified:
projects/jboss-osgi/projects/runtime/framework/trunk/src/main/java/org/jboss/osgi/framework/bundle/AbstractBundleState.java
projects/jboss-osgi/projects/runtime/framework/trunk/src/main/java/org/jboss/osgi/framework/bundle/OSGiBundleContextWrapper.java
projects/jboss-osgi/projects/runtime/framework/trunk/src/main/java/org/jboss/osgi/framework/bundle/OSGiBundleManager.java
projects/jboss-osgi/projects/runtime/framework/trunk/src/main/java/org/jboss/osgi/framework/bundle/OSGiBundleState.java
projects/jboss-osgi/projects/runtime/framework/trunk/src/main/java/org/jboss/osgi/framework/deployers/OSGiBundleActivatorDeployer.java
projects/jboss-osgi/projects/runtime/framework/trunk/src/test/java/org/jboss/test/osgi/bundle/BundleContextUnitTestCase.java
projects/jboss-osgi/projects/runtime/framework/trunk/src/test/resources/bootstrap/jboss-osgi-bootstrap.xml
Log:
Fix exception handling in BundleActivator.stop()
Fix BundleContext reuse issue
Fix SystemBundle storage area location
Modified: projects/jboss-osgi/projects/runtime/framework/trunk/src/main/java/org/jboss/osgi/framework/bundle/AbstractBundleState.java
===================================================================
--- projects/jboss-osgi/projects/runtime/framework/trunk/src/main/java/org/jboss/osgi/framework/bundle/AbstractBundleState.java 2009-12-16 15:46:19 UTC (rev 97897)
+++ projects/jboss-osgi/projects/runtime/framework/trunk/src/main/java/org/jboss/osgi/framework/bundle/AbstractBundleState.java 2009-12-16 15:56:20 UTC (rev 97898)
@@ -166,6 +166,8 @@
public synchronized void destroyBundleContext()
{
+ if (bundleContext != null)
+ ((OSGiBundleContextWrapper)bundleContext).destroyBundleContext();
bundleContext = null;
}
@@ -689,16 +691,12 @@
/**
* Check a bundle context is still valid
- *
- * @return the bundle context
- * @throws IllegalArgumentException when the context is no longer valid
+ * @throws IllegalStateException when the context is no longer valid
*/
- protected synchronized BundleContext checkValidBundleContext()
+ protected synchronized void checkValidBundleContext()
{
- BundleContext result = this.bundleContext;
- if (result == null)
- throw new IllegalStateException("Bundle context is no longer valid: " + getCanonicalName());
- return result;
+ if (bundleContext == null)
+ throw new IllegalStateException("Invalid bundle context: " + getCanonicalName());
}
/**
Modified: projects/jboss-osgi/projects/runtime/framework/trunk/src/main/java/org/jboss/osgi/framework/bundle/OSGiBundleContextWrapper.java
===================================================================
--- projects/jboss-osgi/projects/runtime/framework/trunk/src/main/java/org/jboss/osgi/framework/bundle/OSGiBundleContextWrapper.java 2009-12-16 15:46:19 UTC (rev 97897)
+++ projects/jboss-osgi/projects/runtime/framework/trunk/src/main/java/org/jboss/osgi/framework/bundle/OSGiBundleContextWrapper.java 2009-12-16 15:56:20 UTC (rev 97898)
@@ -21,6 +21,8 @@
*/
package org.jboss.osgi.framework.bundle;
+// $Id: $
+
import java.io.File;
import java.io.InputStream;
import java.util.Dictionary;
@@ -38,15 +40,18 @@
import org.osgi.framework.ServiceRegistration;
/**
- * OSGiBundleContextImpl.
+ * A wrapper around the bundle state that just exposes the BundleContext API.
*
* @author <a href="adrian(a)jboss.com">Adrian Brock</a>
+ * @author Thomas.Diesler(a)jboss.com
* @version $Revision: 1.1 $
*/
public class OSGiBundleContextWrapper implements BundleContext
{
/** The bundle state */
private AbstractBundleState bundleState;
+ /** The bundles canonical name */
+ private String canonicalName;
/**
* Create a new OSGiBundleContextWrapper.
@@ -58,129 +63,169 @@
{
if (bundleState == null)
throw new IllegalArgumentException("Null bundle state");
+
this.bundleState = bundleState;
+ this.canonicalName = bundleState.getCanonicalName();
}
+ void destroyBundleContext()
+ {
+ bundleState = null;
+ }
+
public void addBundleListener(BundleListener listener)
{
+ checkValidBundleContext();
bundleState.addBundleListener(listener);
}
public void addFrameworkListener(FrameworkListener listener)
{
+ checkValidBundleContext();
bundleState.addFrameworkListener(listener);
}
public void addServiceListener(ServiceListener listener, String filter) throws InvalidSyntaxException
{
+ checkValidBundleContext();
bundleState.addServiceListener(listener, filter);
}
public void addServiceListener(ServiceListener listener)
{
+ checkValidBundleContext();
bundleState.addServiceListener(listener);
}
public Filter createFilter(String filter) throws InvalidSyntaxException
{
+ checkValidBundleContext();
return bundleState.createFilter(filter);
}
public ServiceReference[] getAllServiceReferences(String clazz, String filter) throws InvalidSyntaxException
{
+ checkValidBundleContext();
return bundleState.getAllServiceReferences(clazz, filter);
}
public Bundle getBundle()
{
+ checkValidBundleContext();
return bundleState.getBundle();
}
public Bundle getBundle(long id)
{
+ checkValidBundleContext();
return bundleState.getBundle(id);
}
public Bundle[] getBundles()
{
+ checkValidBundleContext();
return bundleState.getBundles();
}
public File getDataFile(String filename)
{
+ checkValidBundleContext();
return bundleState.getDataFile(filename);
}
public String getProperty(String key)
{
+ checkValidBundleContext();
return bundleState.getProperty(key);
}
public Object getService(ServiceReference reference)
{
+ checkValidBundleContext();
return bundleState.getService(reference);
}
public ServiceReference getServiceReference(String clazz)
{
+ checkValidBundleContext();
return bundleState.getServiceReference(clazz);
}
public ServiceReference[] getServiceReferences(String clazz, String filter) throws InvalidSyntaxException
{
+ checkValidBundleContext();
return bundleState.getServiceReferences(clazz, filter);
}
public Bundle installBundle(String location, InputStream input) throws BundleException
{
+ checkValidBundleContext();
return bundleState.installBundle(location, input);
}
public Bundle installBundle(String location) throws BundleException
{
+ checkValidBundleContext();
return bundleState.installBundle(location);
}
public Bundle install(VirtualFile root) throws BundleException
{
+ checkValidBundleContext();
return bundleState.installBundle(root);
}
- @SuppressWarnings("unchecked")
+ @SuppressWarnings("rawtypes")
public ServiceRegistration registerService(String clazz, Object service, Dictionary properties)
{
+ checkValidBundleContext();
return bundleState.registerService(clazz, service, properties);
}
- @SuppressWarnings("unchecked")
+ @SuppressWarnings("rawtypes")
public ServiceRegistration registerService(String[] clazzes, Object service, Dictionary properties)
{
+ checkValidBundleContext();
return bundleState.registerService(clazzes, service, properties);
}
public void removeBundleListener(BundleListener listener)
{
+ checkValidBundleContext();
bundleState.removeBundleListener(listener);
}
public void removeFrameworkListener(FrameworkListener listener)
{
+ checkValidBundleContext();
bundleState.removeFrameworkListener(listener);
}
public void removeServiceListener(ServiceListener listener)
{
+ checkValidBundleContext();
bundleState.removeServiceListener(listener);
}
public boolean ungetService(ServiceReference reference)
{
+ checkValidBundleContext();
return bundleState.ungetService(reference);
}
@Override
public String toString()
{
- return bundleState.toString();
+ return canonicalName;
}
+
+ /**
+ * Check a bundle context is still valid
+ * @throws IllegalStateException when the context is no longer valid
+ */
+ protected synchronized void checkValidBundleContext()
+ {
+ if (bundleState == null)
+ throw new IllegalStateException("Invalid bundle context: " + canonicalName);
+ }
}
Modified: projects/jboss-osgi/projects/runtime/framework/trunk/src/main/java/org/jboss/osgi/framework/bundle/OSGiBundleManager.java
===================================================================
--- projects/jboss-osgi/projects/runtime/framework/trunk/src/main/java/org/jboss/osgi/framework/bundle/OSGiBundleManager.java 2009-12-16 15:46:19 UTC (rev 97897)
+++ projects/jboss-osgi/projects/runtime/framework/trunk/src/main/java/org/jboss/osgi/framework/bundle/OSGiBundleManager.java 2009-12-16 15:56:20 UTC (rev 97898)
@@ -1269,6 +1269,13 @@
DeploymentUnit unit = bundleState.getDeploymentUnit();
deployerClient.change(unit.getName(), DeploymentStages.CLASSLOADER);
deployerClient.checkComplete(unit.getName());
+
+ // The potential BundleException is attached by the OSGiBundleActivatorDeployer
+ BundleException stopEx = unit.removeAttachment(BundleException.class);
+ if (stopEx != null)
+ {
+ throw stopEx;
+ }
}
catch (DeploymentException ex)
{
Modified: projects/jboss-osgi/projects/runtime/framework/trunk/src/main/java/org/jboss/osgi/framework/bundle/OSGiBundleState.java
===================================================================
--- projects/jboss-osgi/projects/runtime/framework/trunk/src/main/java/org/jboss/osgi/framework/bundle/OSGiBundleState.java 2009-12-16 15:46:19 UTC (rev 97897)
+++ projects/jboss-osgi/projects/runtime/framework/trunk/src/main/java/org/jboss/osgi/framework/bundle/OSGiBundleState.java 2009-12-16 15:56:20 UTC (rev 97898)
@@ -324,11 +324,11 @@
// Any listeners registered by this bundle must be removed.
stopInternal();
+ // This bundle's state is set to RESOLVED
+ // A bundle event of type BundleEvent.STOPPED is fired
destroyBundleContext();
changeState(RESOLVED);
- // A bundle event of type BundleEvent.STOPPED is fired
-
if (t instanceof BundleException)
throw (BundleException)t;
@@ -400,14 +400,10 @@
throw new BundleException("Bundle uninstalled during activator stop: " + this);
// This bundle's state is set to RESOLVED
+ // A bundle event of type BundleEvent.STOPPED is fired
destroyBundleContext();
changeState(RESOLVED);
- if (priorState != STOPPING)
- throw new BundleException("Bundle has been uninstalled: " + getCanonicalName());
-
- // [TODO] A bundle event of type BundleEvent.STOPPED is fired
-
if (rethrow != null)
throw new BundleException("Error during stop of bundle: " + this, rethrow);
}
Modified: projects/jboss-osgi/projects/runtime/framework/trunk/src/main/java/org/jboss/osgi/framework/deployers/OSGiBundleActivatorDeployer.java
===================================================================
--- projects/jboss-osgi/projects/runtime/framework/trunk/src/main/java/org/jboss/osgi/framework/deployers/OSGiBundleActivatorDeployer.java 2009-12-16 15:46:19 UTC (rev 97897)
+++ projects/jboss-osgi/projects/runtime/framework/trunk/src/main/java/org/jboss/osgi/framework/deployers/OSGiBundleActivatorDeployer.java 2009-12-16 15:56:20 UTC (rev 97898)
@@ -52,22 +52,25 @@
catch (BundleException ex)
{
// We do not rethrow this exception to the deployer framework.
- // An exception during Bundle.start() is regarded as a normal deployemtn condition and handeled internally by the OSGi layer.
+ // An exception during Bundle.start() is regarded as a normal deployment condition and handeled internally by the OSGi layer.
// The OSGiBundleManager picks up this BundleException and rethrows it if available.
unit.addAttachment(BundleException.class, ex);
}
}
@Override
- public void undeploy(DeploymentUnit unit, OSGiBundleState deployment)
+ public void undeploy(DeploymentUnit unit, OSGiBundleState bundleState)
{
try
{
- deployment.stopInternal();
+ bundleState.stopInternal();
}
catch (BundleException ex)
{
- log.warn("Error stopping bundle: " + deployment, ex);
+ // We do not rethrow this exception to the deployer framework.
+ // An exception during Bundle.start() is regarded as a normal deployment condition and handeled internally by the OSGi layer.
+ // The OSGiBundleManager picks up this BundleException and rethrows it if available.
+ unit.addAttachment(BundleException.class, ex);
}
}
}
Modified: projects/jboss-osgi/projects/runtime/framework/trunk/src/test/java/org/jboss/test/osgi/bundle/BundleContextUnitTestCase.java
===================================================================
--- projects/jboss-osgi/projects/runtime/framework/trunk/src/test/java/org/jboss/test/osgi/bundle/BundleContextUnitTestCase.java 2009-12-16 15:46:19 UTC (rev 97897)
+++ projects/jboss-osgi/projects/runtime/framework/trunk/src/test/java/org/jboss/test/osgi/bundle/BundleContextUnitTestCase.java 2009-12-16 15:56:20 UTC (rev 97898)
@@ -298,49 +298,49 @@
}
bundleContext.addServiceListener(this);
- bundleContext = assertServiceLifecycle(bundle, bundleContext, true);
+ bundleContext = assertServiceLifecycle(bundle, true);
bundleContext.removeServiceListener(this);
bundleContext.addServiceListener(this);
bundleContext.removeServiceListener(this);
- bundleContext = assertServiceLifecycle(bundle, bundleContext, false);
+ bundleContext = assertServiceLifecycle(bundle, false);
bundleContext.addServiceListener(this);
bundleContext.addServiceListener(this);
- bundleContext = assertServiceLifecycle(bundle, bundleContext, true);
+ bundleContext = assertServiceLifecycle(bundle, true);
bundleContext.removeServiceListener(this);
bundleContext.addServiceListener(this, null);
- bundleContext = assertServiceLifecycle(bundle, bundleContext, true);
+ bundleContext = assertServiceLifecycle(bundle, true);
bundleContext.removeServiceListener(this);
bundleContext.addServiceListener(this, null);
bundleContext.removeServiceListener(this);
- bundleContext = assertServiceLifecycle(bundle, bundleContext, false);
+ bundleContext = assertServiceLifecycle(bundle, false);
bundleContext.addServiceListener(this, null);
bundleContext.addServiceListener(this, null);
- bundleContext = assertServiceLifecycle(bundle, bundleContext, true);
+ bundleContext = assertServiceLifecycle(bundle, true);
bundleContext.removeServiceListener(this);
Dictionary<String, Object> properties = new Hashtable<String, Object>();
properties.put("a", "b");
bundleContext.addServiceListener(this, ("(a=b)"));
- bundleContext = assertServiceLifecycle(bundle, bundleContext, properties, true);
+ bundleContext = assertServiceLifecycle(bundle, properties, true);
bundleContext.removeServiceListener(this);
bundleContext.addServiceListener(this, ("(c=d)"));
- bundleContext = assertServiceLifecycle(bundle, bundleContext, properties, false);
+ bundleContext = assertServiceLifecycle(bundle, properties, false);
bundleContext.removeServiceListener(this);
bundleContext.addServiceListener(this, "(a=b)");
bundleContext.removeServiceListener(this);
- bundleContext = assertServiceLifecycle(bundle, bundleContext, properties, false);
+ bundleContext = assertServiceLifecycle(bundle, properties, false);
bundleContext.addServiceListener(this, "(c=d)");
bundleContext.addServiceListener(this, "(a=b)");
- assertServiceLifecycle(bundle, bundleContext, properties, true);
+ bundleContext = assertServiceLifecycle(bundle, properties, true);
bundleContext.removeServiceListener(this);
}
finally
@@ -349,15 +349,16 @@
}
}
- protected BundleContext assertServiceLifecycle(Bundle bundle, BundleContext bundleContext, boolean events) throws Exception
+ protected BundleContext assertServiceLifecycle(Bundle bundle, boolean events) throws Exception
{
- return assertServiceLifecycle(bundle, bundleContext, null, events);
+ return assertServiceLifecycle(bundle, null, events);
}
- protected BundleContext assertServiceLifecycle(Bundle bundle, BundleContext bundleContext, Dictionary<String, Object> properties, boolean events) throws Exception
+ protected BundleContext assertServiceLifecycle(Bundle bundle, Dictionary<String, Object> properties, boolean events) throws Exception
{
assertNoServiceEvent();
+ BundleContext bundleContext = bundle.getBundleContext();
ServiceRegistration registration = bundleContext.registerService(BundleContext.class.getName(), bundleContext, properties);
ServiceReference reference = registration.getReference();
@@ -404,6 +405,7 @@
bundle.start();
bundleContext = bundle.getBundleContext();
assertNotNull(bundleContext);
+
return bundleContext;
}
@@ -438,16 +440,16 @@
}
bundleContext.addBundleListener(this);
- bundleContext = assertBundleLifecycle(bundle, bundleContext, true);
+ bundleContext = assertBundleLifecycle(bundle, true);
bundleContext.removeBundleListener(this);
bundleContext.addBundleListener(this);
bundleContext.removeBundleListener(this);
- bundleContext = assertBundleLifecycle(bundle, bundleContext, false);
+ bundleContext = assertBundleLifecycle(bundle, false);
bundleContext.addBundleListener(this);
bundleContext.addBundleListener(this);
- bundleContext = assertBundleLifecycle(bundle, bundleContext, true);
+ bundleContext = assertBundleLifecycle(bundle, true);
bundleContext.removeBundleListener(this);
bundleContext.addBundleListener(this);
@@ -464,7 +466,7 @@
assertBundleEvent(BundleEvent.UNINSTALLED, bundle);
}
- protected BundleContext assertBundleLifecycle(Bundle bundle, BundleContext bundleContext, boolean events) throws Exception
+ protected BundleContext assertBundleLifecycle(Bundle bundle, boolean events) throws Exception
{
assertNoBundleEvent();
@@ -490,7 +492,7 @@
assertNoBundleEvent();
}
- return bundleContext;
+ return bundle.getBundleContext();
}
public void testFrameworkListener() throws Exception
@@ -549,6 +551,45 @@
}
}
+ public void testStopedBundleContext() throws Exception
+ {
+ Bundle bundle = addBundle("/bundles/simple/", "simple-bundle1");
+ try
+ {
+ bundle.start();
+ BundleContext bundleContext = bundle.getBundleContext();
+ assertNotNull(bundleContext);
+
+ // The context should be illegal to use.
+ bundle.stop();
+ try
+ {
+ bundleContext.getProperty(getClass().getName());
+ fail("Should not be here!");
+ }
+ catch (Throwable t)
+ {
+ checkThrowable(IllegalStateException.class, t);
+ }
+
+ // The context should not become reusable after we restart the bundle
+ bundle.start();
+ try
+ {
+ bundleContext.getProperty(getClass().getName());
+ fail("Should not be here!");
+ }
+ catch (Throwable t)
+ {
+ checkThrowable(IllegalStateException.class, t);
+ }
+ }
+ finally
+ {
+ uninstall(bundle);
+ }
+ }
+
protected void assertSystemProperty(BundleContext bundleContext, String property, String osgiProperty)
{
String expected = System.getProperty(property);
Modified: projects/jboss-osgi/projects/runtime/framework/trunk/src/test/resources/bootstrap/jboss-osgi-bootstrap.xml
===================================================================
--- projects/jboss-osgi/projects/runtime/framework/trunk/src/test/resources/bootstrap/jboss-osgi-bootstrap.xml 2009-12-16 15:46:19 UTC (rev 97897)
+++ projects/jboss-osgi/projects/runtime/framework/trunk/src/test/resources/bootstrap/jboss-osgi-bootstrap.xml 2009-12-16 15:56:20 UTC (rev 97898)
@@ -16,7 +16,7 @@
</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</key><value>target/osgi-store</value></entry>
<entry><key>org.osgi.framework.storage.clean</key><value>onFirstInit</value></entry>
<entry><key>org.osgi.framework.system.packages.extra</key><value>
16 years
JBoss-OSGI SVN: r97895 - projects/jboss-osgi/projects/runtime/framework/trunk/src/main/java/org/jboss/osgi/framework/bundle.
by jboss-osgi-commits@lists.jboss.org
Author: thomas.diesler(a)jboss.com
Date: 2009-12-16 09:00:27 -0500 (Wed, 16 Dec 2009)
New Revision: 97895
Modified:
projects/jboss-osgi/projects/runtime/framework/trunk/src/main/java/org/jboss/osgi/framework/bundle/OSGiBundleManager.java
projects/jboss-osgi/projects/runtime/framework/trunk/src/main/java/org/jboss/osgi/framework/bundle/OSGiBundleState.java
Log:
Move bundle.stop() preconditions to BundleManager.stopBundle()
Add javadoc that descibes how bundle.stop() works
Modified: projects/jboss-osgi/projects/runtime/framework/trunk/src/main/java/org/jboss/osgi/framework/bundle/OSGiBundleManager.java
===================================================================
--- projects/jboss-osgi/projects/runtime/framework/trunk/src/main/java/org/jboss/osgi/framework/bundle/OSGiBundleManager.java 2009-12-16 13:52:10 UTC (rev 97894)
+++ projects/jboss-osgi/projects/runtime/framework/trunk/src/main/java/org/jboss/osgi/framework/bundle/OSGiBundleManager.java 2009-12-16 14:00:27 UTC (rev 97895)
@@ -74,6 +74,7 @@
import org.jboss.metadata.spi.scope.ScopeKey;
import org.jboss.osgi.deployment.deployer.Deployment;
import org.jboss.osgi.deployment.deployer.DeploymentFactory;
+import org.jboss.osgi.framework.deployers.OSGiBundleActivatorDeployer;
import org.jboss.osgi.framework.metadata.OSGiMetaData;
import org.jboss.osgi.framework.metadata.PackageAttribute;
import org.jboss.osgi.framework.metadata.internal.AbstractOSGiMetaData;
@@ -1171,6 +1172,9 @@
* Stating a bundle is done in an attempt to move the bundle's DeploymentUnit to state INSTALLED.
* A failure to resolve the bundle is fatal, the bundle should remain in state INSTALLED.
* A failure in BundleActivator.start() is a normal condition not handled by the deployment layer.
+ *
+ * @see OSGiBundleActivatorDeployer
+ * @see OSGiBundleState#startInternal()
*/
public void startBundle(OSGiBundleState bundleState) throws BundleException
{
@@ -1238,22 +1242,41 @@
/**
* Stop a bundle
*
- * @param bundleState the bundle state
- * @throws BundleException the bundle exception
+ * Stopping a bundle is done in an attempt to move the bundle's DeploymentUnit to state CLASSLOADER.
+ *
+ * @see OSGiBundleActivatorDeployer
+ * @see OSGiBundleState#stopInternal()
*/
public void stopBundle(OSGiBundleState bundleState) throws BundleException
{
+ // If this bundle's state is UNINSTALLED then an IllegalStateException is thrown.
+ if (bundleState.getState() == Bundle.UNINSTALLED)
+ throw new IllegalStateException("Bundle already uninstalled: " + this);
+
+ // [TODO] If this bundle is in the process of being activated or deactivated then this method must wait for activation or deactivation
+ // to complete before continuing. If this does not occur in a reasonable time, a BundleException is thrown to indicate this bundle
+ // was unable to be stopped.
+
+ // [TODO] If the STOP_TRANSIENT option is not set then then set this bundle's persistent autostart setting to to Stopped.
+ // When the Framework is restarted and this bundle's autostart setting is Stopped, this bundle must not be automatically started.
+
+ // If this bundle's state is not STARTING or ACTIVE then this method returns immediately
+ if (bundleState.getState() != Bundle.STARTING && bundleState.getState() != Bundle.ACTIVE)
+ return;
+
try
{
- String name = bundleState.getDeploymentUnit().getName();
- deployerClient.change(name, DeploymentStages.CLASSLOADER);
+ DeploymentUnit unit = bundleState.getDeploymentUnit();
+ deployerClient.change(unit.getName(), DeploymentStages.CLASSLOADER);
+ deployerClient.checkComplete(unit.getName());
}
- catch (DeploymentException e)
+ catch (DeploymentException ex)
{
- Throwable t = e.getCause();
- if (t instanceof BundleException)
- throw (BundleException)t;
- throw new BundleException("Error stopping " + bundleState, e);
+ Throwable cause = ex.getCause();
+ if (cause instanceof BundleException)
+ throw (BundleException)cause;
+
+ throw new BundleException("Error stopping " + bundleState, (cause != null ? cause : ex));
}
}
Modified: projects/jboss-osgi/projects/runtime/framework/trunk/src/main/java/org/jboss/osgi/framework/bundle/OSGiBundleState.java
===================================================================
--- projects/jboss-osgi/projects/runtime/framework/trunk/src/main/java/org/jboss/osgi/framework/bundle/OSGiBundleState.java 2009-12-16 13:52:10 UTC (rev 97894)
+++ projects/jboss-osgi/projects/runtime/framework/trunk/src/main/java/org/jboss/osgi/framework/bundle/OSGiBundleState.java 2009-12-16 14:00:27 UTC (rev 97895)
@@ -255,15 +255,11 @@
getBundleManager().startBundle(this);
}
- // [TODO] options
public void stop(int options) throws BundleException
{
checkInstalled();
checkAdminPermission(AdminPermission.EXECUTE);
- if (getState() != ACTIVE)
- return;
-
getBundleManager().stopBundle(this);
}
@@ -341,25 +337,13 @@
}
/**
- * Stop Internal
+ * Stop Internal.
+ *
+ * This method is triggered by the OSGiBundleActivatorDeployer.
+ * Preconditions are handled in OSGiBundleManager.stopBundle()
*/
public void stopInternal() throws BundleException
{
- // If this bundle's state is UNINSTALLED then an IllegalStateException is thrown.
- if (getState() == Bundle.UNINSTALLED)
- throw new IllegalStateException("Bundle already uninstalled: " + this);
-
- // [TODO] If this bundle is in the process of being activated or deactivated then this method must wait for activation or deactivation
- // to complete before continuing. If this does not occur in a reasonable time, a BundleException is thrown to indicate this bundle
- // was unable to be stopped.
-
- // [TODO] If the STOP_TRANSIENT option is not set then then set this bundle's persistent autostart setting to to Stopped.
- // When the Framework is restarted and this bundle's autostart setting is Stopped, this bundle must not be automatically started.
-
- // If this bundle's state is not STARTING or ACTIVE then this method returns immediately
- if (getState() != Bundle.STARTING && getState() != Bundle.ACTIVE)
- return;
-
// This bundle's state is set to STOPPING
// A bundle event of type BundleEvent.STOPPING is fired
int priorState = getState();
16 years
JBoss-OSGI SVN: r97894 - in projects/jboss-osgi/projects/runtime/framework/trunk: src/main/java/org/jboss/osgi/framework/bundle and 8 other directories.
by jboss-osgi-commits@lists.jboss.org
Author: thomas.diesler(a)jboss.com
Date: 2009-12-16 08:52:10 -0500 (Wed, 16 Dec 2009)
New Revision: 97894
Added:
projects/jboss-osgi/projects/runtime/framework/trunk/src/test/java/org/jboss/test/osgi/bundle/support/b/
projects/jboss-osgi/projects/runtime/framework/trunk/src/test/java/org/jboss/test/osgi/bundle/support/b/LifecycleService.java
projects/jboss-osgi/projects/runtime/framework/trunk/src/test/java/org/jboss/test/osgi/bundle/support/b/LifecycleServiceActivator.java
projects/jboss-osgi/projects/runtime/framework/trunk/src/test/resources/bundles/lifecycle/simple-service/
projects/jboss-osgi/projects/runtime/framework/trunk/src/test/resources/bundles/lifecycle/simple-service/META-INF/
projects/jboss-osgi/projects/runtime/framework/trunk/src/test/resources/bundles/lifecycle/simple-service/META-INF/MANIFEST.MF
Modified:
projects/jboss-osgi/projects/runtime/framework/trunk/pom.xml
projects/jboss-osgi/projects/runtime/framework/trunk/src/main/java/org/jboss/osgi/framework/bundle/OSGiBundleManager.java
projects/jboss-osgi/projects/runtime/framework/trunk/src/main/java/org/jboss/osgi/framework/bundle/OSGiBundleState.java
projects/jboss-osgi/projects/runtime/framework/trunk/src/test/java/org/jboss/test/osgi/bundle/BundleLifecycleTestCase.java
projects/jboss-osgi/projects/runtime/framework/trunk/src/test/java/org/jboss/test/osgi/bundle/support/a/FailOnStartActivator.java
projects/jboss-osgi/projects/runtime/framework/trunk/src/test/resources/bundles/lifecycle/fail-on-start/META-INF/MANIFEST.MF
Log:
Resurrect ServiceMix test case.
Move bundle.start() preconditions to BundleManager.startBundle()
Add javadoc that descibes how bundle.start() works
Modified: projects/jboss-osgi/projects/runtime/framework/trunk/pom.xml
===================================================================
--- projects/jboss-osgi/projects/runtime/framework/trunk/pom.xml 2009-12-16 13:50:03 UTC (rev 97893)
+++ projects/jboss-osgi/projects/runtime/framework/trunk/pom.xml 2009-12-16 13:52:10 UTC (rev 97894)
@@ -12,10 +12,10 @@
<!-- $Id$ -->
<!--
- Set these VM properties in your IDE debugger
-
- -Dlog4j.output.dir=${workspace_loc:jboss-osgi-framework/target}
- -Dorg.jboss.osgi.framework.launch.bootstrapPath=bootstrap/jboss-osgi-bootstrap.xml
+ Set these VM properties in your IDE debugger
+
+ -Dlog4j.output.dir=${workspace_loc:jboss-osgi-framework/target}
+ -Dlog4j.configuration=log4j-console.xml
-->
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
@@ -659,8 +659,9 @@
</property>
</systemProperties>
<excludes>
- <!-- http://community.jboss.org/thread/145863 -->
+ <!-- excludes listed here need to have a jira issue associated
<exclude>org/jboss/test/osgi/service/ServiceMixUnitTestCase.class</exclude>
+ -->
</excludes>
</configuration>
</plugin>
Modified: projects/jboss-osgi/projects/runtime/framework/trunk/src/main/java/org/jboss/osgi/framework/bundle/OSGiBundleManager.java
===================================================================
--- projects/jboss-osgi/projects/runtime/framework/trunk/src/main/java/org/jboss/osgi/framework/bundle/OSGiBundleManager.java 2009-12-16 13:50:03 UTC (rev 97893)
+++ projects/jboss-osgi/projects/runtime/framework/trunk/src/main/java/org/jboss/osgi/framework/bundle/OSGiBundleManager.java 2009-12-16 13:52:10 UTC (rev 97894)
@@ -1166,27 +1166,64 @@
}
/**
- * Start a bundle
+ * Start a bundle.
*
- * @param bundleState the bundle state
- * @throws BundleException the bundle exception
+ * Stating a bundle is done in an attempt to move the bundle's DeploymentUnit to state INSTALLED.
+ * A failure to resolve the bundle is fatal, the bundle should remain in state INSTALLED.
+ * A failure in BundleActivator.start() is a normal condition not handled by the deployment layer.
*/
public void startBundle(OSGiBundleState bundleState) throws BundleException
{
- // Resolve all INSTALLED bundles through the PackageAdmin
- PackageAdmin packageAdmin = getPlugin(PackageAdminPlugin.class);
- packageAdmin.resolveBundles(null);
+ // If this bundle's state is UNINSTALLED then an IllegalStateException is thrown.
+ if (bundleState.getState() == Bundle.UNINSTALLED)
+ throw new IllegalStateException("Bundle already uninstalled: " + this);
+ // [TODO] If this bundle is in the process of being activated or deactivated then this method must wait for activation or deactivation
+ // to complete before continuing. If this does not occur in a reasonable time, a BundleException is thrown to indicate this bundle was
+ // unable to be started.
+
+ // If this bundle's state is ACTIVE then this method returns immediately.
+ if (bundleState.getState() == Bundle.ACTIVE)
+ return;
+
+ // [TODO] If the START_TRANSIENT option is not set then set this bundle's autostart setting to Started with declared activation
+ // if the START_ACTIVATION_POLICY option is set or Started with eager activation if not set. When the Framework is restarted
+ // and this bundle's autostart setting is not Stopped, this bundle must be automatically started.
+
+ // If this bundle's state is not RESOLVED, an attempt is made to resolve this bundle. If the Framework cannot resolve this bundle,
+ // a BundleException is thrown.
+ if (bundleState.getState() != Bundle.RESOLVED)
+ {
+ // Resolve all INSTALLED bundles through the PackageAdmin
+ PackageAdmin packageAdmin = getPlugin(PackageAdminPlugin.class);
+ packageAdmin.resolveBundles(null);
+
+ if (bundleState.getState() != Bundle.RESOLVED)
+ throw new BundleException("Cannot resolve bundle: " + bundleState);
+ }
+
+ // [TODO] If the START_ACTIVATION_POLICY option is set and this bundle's declared activation policy is lazy then:
+ // * If this bundle's state is STARTING then this method returns immediately.
+ // * This bundle's state is set to STARTING.
+ // * A bundle event of type BundleEvent.LAZY_ACTIVATION is fired.
+ // * This method returns immediately and the remaining steps will be followed when this bundle's activation is later triggered.
+
try
{
DeploymentUnit unit = bundleState.getDeploymentUnit();
deployerClient.change(unit.getName(), DeploymentStages.INSTALLED);
deployerClient.checkComplete(unit.getName());
-
+
// The potential BundleException is attached by the OSGiBundleActivatorDeployer
BundleException startEx = unit.removeAttachment(BundleException.class);
if (startEx != null)
+ {
+ // Reset the deployment unit to stage classloader
+ deployerClient.change(unit.getName(), DeploymentStages.CLASSLOADER);
+ deployerClient.checkComplete(unit.getName());
+
throw startEx;
+ }
}
catch (DeploymentException ex)
{
Modified: projects/jboss-osgi/projects/runtime/framework/trunk/src/main/java/org/jboss/osgi/framework/bundle/OSGiBundleState.java
===================================================================
--- projects/jboss-osgi/projects/runtime/framework/trunk/src/main/java/org/jboss/osgi/framework/bundle/OSGiBundleState.java 2009-12-16 13:50:03 UTC (rev 97893)
+++ projects/jboss-osgi/projects/runtime/framework/trunk/src/main/java/org/jboss/osgi/framework/bundle/OSGiBundleState.java 2009-12-16 13:52:10 UTC (rev 97894)
@@ -252,9 +252,6 @@
checkInstalled();
checkAdminPermission(AdminPermission.EXECUTE);
- if (getState() == ACTIVE)
- return;
-
getBundleManager().startBundle(this);
}
@@ -271,55 +268,13 @@
}
/**
- * Start internal
+ * Start internal.
*
- * [TODO] Start Level Service & START_TRANSIENT?
- * [TODO] START_ACTIVATION_POLICY
- * [TODO] LAZY_ACTIVATION
- * [TODO] locks
- * [TODO] options
- *
- * @throws Throwable for any error
+ * This method is triggered by the OSGiBundleActivatorDeployer.
+ * Preconditions are handled in OSGiBundleManager.startBundle()
*/
public void startInternal() throws BundleException
{
- // If this bundle's state is UNINSTALLED then an IllegalStateException is thrown.
- if (getState() == Bundle.UNINSTALLED)
- throw new IllegalStateException("Bundle already uninstalled: " + this);
-
- // [TODO] If this bundle is in the process of being activated or deactivated then this method must wait for activation or deactivation
- // to complete before continuing. If this does not occur in a reasonable time, a BundleException is thrown to indicate this bundle was
- // unable to be started.
-
- // If this bundle's state is ACTIVE then this method returns immediately.
- if (getState() == Bundle.ACTIVE)
- return;
-
- // [TODO] If the START_TRANSIENT option is not set then set this bundle's autostart setting to Started with declared activation
- // if the START_ACTIVATION_POLICY option is set or Started with eager activation if not set. When the Framework is restarted
- // and this bundle's autostart setting is not Stopped, this bundle must be automatically started.
-
- // If this bundle's state is not RESOLVED, an attempt is made to resolve this bundle. If the Framework cannot resolve this bundle,
- // a BundleException is thrown.
- if (getState() != Bundle.RESOLVED)
- {
- try
- {
- getBundleManager().resolveBundle(this, true);
- }
- catch (RuntimeException ex)
- {
- throw new BundleException("Cannot resolve bundle: " + this, ex);
- }
- }
-
- // [TODO] If the START_ACTIVATION_POLICY option is set and this bundle's declared activation policy is lazy then:
- // * If this bundle's state is STARTING then this method returns immediately.
- // * This bundle's state is set to STARTING.
- // * A bundle event of type BundleEvent.LAZY_ACTIVATION is fired.
- // * This method returns immediately and the remaining steps will be followed when this bundle's activation is later triggered.
-
-
// This bundle's state is set to STARTING
// A bundle event of type BundleEvent.STARTING is fired
createBundleContext();
Modified: projects/jboss-osgi/projects/runtime/framework/trunk/src/test/java/org/jboss/test/osgi/bundle/BundleLifecycleTestCase.java
===================================================================
--- projects/jboss-osgi/projects/runtime/framework/trunk/src/test/java/org/jboss/test/osgi/bundle/BundleLifecycleTestCase.java 2009-12-16 13:50:03 UTC (rev 97893)
+++ projects/jboss-osgi/projects/runtime/framework/trunk/src/test/java/org/jboss/test/osgi/bundle/BundleLifecycleTestCase.java 2009-12-16 13:52:10 UTC (rev 97894)
@@ -25,8 +25,11 @@
import org.jboss.test.osgi.FrameworkTest;
import org.jboss.test.osgi.bundle.support.a.FailOnStartActivator;
+import org.jboss.test.osgi.bundle.support.b.LifecycleService;
+import org.jboss.test.osgi.bundle.support.b.LifecycleServiceActivator;
import org.osgi.framework.Bundle;
import org.osgi.framework.BundleException;
+import org.osgi.framework.ServiceReference;
/**
* BundleLifecycleTestCase.
@@ -46,27 +49,141 @@
super(name);
}
- public void testExceptionOnStart() throws Exception
+ /**
+ * Verifies that the service bundle can get started
+ */
+ public void testServiceBundle() throws Exception
{
- Bundle bundle = assembleBundle("fail-on-start", "/bundles/lifecycle/fail-on-start", FailOnStartActivator.class);
+ Bundle bundleA = assembleBundle("lifecycle-service", "/bundles/lifecycle/simple-service", LifecycleService.class, LifecycleServiceActivator.class);
try
{
- assertBundleState(Bundle.INSTALLED, bundle.getState());
+ assertBundleState(Bundle.INSTALLED, bundleA.getState());
+
+ bundleA.start();
+ assertBundleState(Bundle.ACTIVE, bundleA.getState());
+
+ ServiceReference sref = bundleA.getBundleContext().getServiceReference(LifecycleService.class.getName());
+ assertNotNull("Service available", sref);
+ }
+ finally
+ {
+ bundleA.uninstall();
+ assertBundleState(Bundle.UNINSTALLED, bundleA.getState());
+ }
+ }
+
+ /**
+ * Verifies that the bundle state is RESOLVED after a failure in BundleActivator.start()
+ */
+ public void testServiceNotAvailable() throws Exception
+ {
+ Bundle bundleA = assembleBundle("lifecycle-service", "/bundles/lifecycle/simple-service", LifecycleService.class, LifecycleServiceActivator.class);
+ try
+ {
+ assertBundleState(Bundle.INSTALLED, bundleA.getState());
+
+ // BundleA not started - service not available
+ ServiceReference sref = getSystemBundle().getBundleContext().getServiceReference(LifecycleService.class.getName());
+ assertNull("Service not available", sref);
+ Bundle bundleB = assembleBundle("lifecycle-failstart", "/bundles/lifecycle/fail-on-start", FailOnStartActivator.class);
try
{
- bundle.start();
+ assertBundleState(Bundle.INSTALLED, bundleB.getState());
+
+ bundleB.start();
fail("BundleException expected");
}
catch (BundleException ex)
{
- assertBundleState(Bundle.RESOLVED, bundle.getState());
+ assertBundleState(Bundle.RESOLVED, bundleB.getState());
}
+ finally
+ {
+ bundleB.uninstall();
+ assertBundleState(Bundle.UNINSTALLED, bundleB.getState());
+ }
}
finally
{
- //bundle.uninstall();
- //assertBundleState(Bundle.UNINSTALLED, bundle.getState());
+ bundleA.uninstall();
+ assertBundleState(Bundle.UNINSTALLED, bundleA.getState());
}
}
+
+ /**
+ * Verifies that BundleB can get started when the service is available
+ */
+ public void testServiceAvailable() throws Exception
+ {
+ Bundle bundleA = assembleBundle("lifecycle-service", "/bundles/lifecycle/simple-service", LifecycleService.class, LifecycleServiceActivator.class);
+ try
+ {
+ bundleA.start();
+ assertBundleState(Bundle.ACTIVE, bundleA.getState());
+
+ Bundle bundleB = assembleBundle("lifecycle-failstart", "/bundles/lifecycle/fail-on-start", FailOnStartActivator.class);
+ try
+ {
+ bundleB.start();
+ assertBundleState(Bundle.ACTIVE, bundleB.getState());
+ }
+ finally
+ {
+ bundleB.uninstall();
+ assertBundleState(Bundle.UNINSTALLED, bundleB.getState());
+ }
+ }
+ finally
+ {
+ bundleA.uninstall();
+ assertBundleState(Bundle.UNINSTALLED, bundleA.getState());
+ }
+ }
+
+ /**
+ * Verifies that BundleB can get started when the service is made available
+ */
+ public void testServiceMakeAvailable() throws Exception
+ {
+ Bundle bundleA = assembleBundle("lifecycle-service", "/bundles/lifecycle/simple-service", LifecycleService.class, LifecycleServiceActivator.class);
+ try
+ {
+ assertBundleState(Bundle.INSTALLED, bundleA.getState());
+
+ Bundle bundleB = assembleBundle("lifecycle-failstart", "/bundles/lifecycle/fail-on-start", FailOnStartActivator.class);
+ try
+ {
+ assertBundleState(Bundle.INSTALLED, bundleB.getState());
+
+ try
+ {
+ bundleB.start();
+ fail("BundleException expected");
+ }
+ catch (BundleException ex)
+ {
+ assertBundleState(Bundle.RESOLVED, bundleB.getState());
+
+ // Now, make the service available
+ bundleA.start();
+ assertBundleState(Bundle.ACTIVE, bundleA.getState());
+ }
+
+ // BundleB can now be started
+ bundleB.start();
+ assertBundleState(Bundle.ACTIVE, bundleB.getState());
+ }
+ finally
+ {
+ bundleB.uninstall();
+ assertBundleState(Bundle.UNINSTALLED, bundleB.getState());
+ }
+ }
+ finally
+ {
+ bundleA.uninstall();
+ assertBundleState(Bundle.UNINSTALLED, bundleA.getState());
+ }
+ }
}
Modified: projects/jboss-osgi/projects/runtime/framework/trunk/src/test/java/org/jboss/test/osgi/bundle/support/a/FailOnStartActivator.java
===================================================================
--- projects/jboss-osgi/projects/runtime/framework/trunk/src/test/java/org/jboss/test/osgi/bundle/support/a/FailOnStartActivator.java 2009-12-16 13:50:03 UTC (rev 97893)
+++ projects/jboss-osgi/projects/runtime/framework/trunk/src/test/java/org/jboss/test/osgi/bundle/support/a/FailOnStartActivator.java 2009-12-16 13:52:10 UTC (rev 97894)
@@ -23,6 +23,7 @@
import org.osgi.framework.BundleActivator;
import org.osgi.framework.BundleContext;
+import org.osgi.framework.ServiceReference;
/**
* A BundleActivator that fails on start.
@@ -35,7 +36,9 @@
public void start(BundleContext context) throws Exception
{
- throw new IllegalStateException("fail on start");
+ ServiceReference sref = context.getServiceReference("org.jboss.test.osgi.bundle.support.b.LifecycleService");
+ if (sref == null)
+ throw new IllegalStateException("Cannot obtain: LifecycleService");
}
public void stop(BundleContext context) throws Exception
Added: projects/jboss-osgi/projects/runtime/framework/trunk/src/test/java/org/jboss/test/osgi/bundle/support/b/LifecycleService.java
===================================================================
--- projects/jboss-osgi/projects/runtime/framework/trunk/src/test/java/org/jboss/test/osgi/bundle/support/b/LifecycleService.java (rev 0)
+++ projects/jboss-osgi/projects/runtime/framework/trunk/src/test/java/org/jboss/test/osgi/bundle/support/b/LifecycleService.java 2009-12-16 13:52:10 UTC (rev 97894)
@@ -0,0 +1,33 @@
+/*
+* 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.bundle.support.b;
+
+
+/**
+ * A marker service.
+ *
+ * @author thomas.Diesler(a)jboss.com
+ * @since 15-Dec-2009
+ */
+public interface LifecycleService
+{
+}
Added: projects/jboss-osgi/projects/runtime/framework/trunk/src/test/java/org/jboss/test/osgi/bundle/support/b/LifecycleServiceActivator.java
===================================================================
--- projects/jboss-osgi/projects/runtime/framework/trunk/src/test/java/org/jboss/test/osgi/bundle/support/b/LifecycleServiceActivator.java (rev 0)
+++ projects/jboss-osgi/projects/runtime/framework/trunk/src/test/java/org/jboss/test/osgi/bundle/support/b/LifecycleServiceActivator.java 2009-12-16 13:52:10 UTC (rev 97894)
@@ -0,0 +1,44 @@
+/*
+* 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.bundle.support.b;
+
+import org.osgi.framework.BundleActivator;
+import org.osgi.framework.BundleContext;
+
+/**
+ * A BundleActivator that registers the LifecycleService.
+ *
+ * @author thomas.Diesler(a)jboss.com
+ * @since 15-Dec-2009
+ */
+public class LifecycleServiceActivator implements BundleActivator
+{
+
+ public void start(BundleContext context) throws Exception
+ {
+ context.registerService(LifecycleService.class.getName(), new LifecycleService(){}, null);
+ }
+
+ public void stop(BundleContext context) throws Exception
+ {
+ }
+}
Modified: projects/jboss-osgi/projects/runtime/framework/trunk/src/test/resources/bundles/lifecycle/fail-on-start/META-INF/MANIFEST.MF
===================================================================
--- projects/jboss-osgi/projects/runtime/framework/trunk/src/test/resources/bundles/lifecycle/fail-on-start/META-INF/MANIFEST.MF 2009-12-16 13:50:03 UTC (rev 97893)
+++ projects/jboss-osgi/projects/runtime/framework/trunk/src/test/resources/bundles/lifecycle/fail-on-start/META-INF/MANIFEST.MF 2009-12-16 13:52:10 UTC (rev 97894)
@@ -1,4 +1,5 @@
Bundle-ManifestVersion: 2
-Bundle-SymbolicName: org.jboss.test.osgi.failstart
+Bundle-SymbolicName: lifecycle-failstart
+Import-Package: org.jboss.test.osgi.bundle.support.b
Bundle-Activator: org.jboss.test.osgi.bundle.support.a.FailOnStartActivator
Added: projects/jboss-osgi/projects/runtime/framework/trunk/src/test/resources/bundles/lifecycle/simple-service/META-INF/MANIFEST.MF
===================================================================
--- projects/jboss-osgi/projects/runtime/framework/trunk/src/test/resources/bundles/lifecycle/simple-service/META-INF/MANIFEST.MF (rev 0)
+++ projects/jboss-osgi/projects/runtime/framework/trunk/src/test/resources/bundles/lifecycle/simple-service/META-INF/MANIFEST.MF 2009-12-16 13:52:10 UTC (rev 97894)
@@ -0,0 +1,5 @@
+Bundle-ManifestVersion: 2
+Bundle-SymbolicName: lifecycle-service
+Export-Package: org.jboss.test.osgi.bundle.support.b
+Bundle-Activator: org.jboss.test.osgi.bundle.support.b.LifecycleServiceActivator
+
16 years
JBoss-OSGI SVN: r97881 - in projects/jboss-osgi/projects/runtime: jbossas/trunk and 1 other directory.
by jboss-osgi-commits@lists.jboss.org
Author: thomas.diesler(a)jboss.com
Date: 2009-12-16 06:51:28 -0500 (Wed, 16 Dec 2009)
New Revision: 97881
Modified:
projects/jboss-osgi/projects/runtime/framework/trunk/src/main/java/org/jboss/osgi/framework/bundle/OSGiServiceState.java
projects/jboss-osgi/projects/runtime/jbossas/trunk/pom.xml
Log:
Update AS integration
Modified: projects/jboss-osgi/projects/runtime/framework/trunk/src/main/java/org/jboss/osgi/framework/bundle/OSGiServiceState.java
===================================================================
--- projects/jboss-osgi/projects/runtime/framework/trunk/src/main/java/org/jboss/osgi/framework/bundle/OSGiServiceState.java 2009-12-16 11:50:41 UTC (rev 97880)
+++ projects/jboss-osgi/projects/runtime/framework/trunk/src/main/java/org/jboss/osgi/framework/bundle/OSGiServiceState.java 2009-12-16 11:51:28 UTC (rev 97881)
@@ -67,7 +67,6 @@
* @author <a href="ales.justin(a)jboss.org">Ales Justin</a>
* @version $Revision: 1.1 $
*/
-@SuppressWarnings({"ThrowableInstanceNeverThrown"})
public class OSGiServiceState extends AbstractControllerContext implements ServiceReference, ServiceRegistration, InvokeDispatchContext
{
/** The alias constant */
@@ -118,7 +117,7 @@
* @param properties the properties
* @throws IllegalArgumentException for a null parameter
*/
- @SuppressWarnings("unchecked")
+ @SuppressWarnings({ "rawtypes", "unchecked" })
public OSGiServiceState(AbstractBundleState bundleState, String[] clazzes, Object service, Dictionary properties)
{
// name is random / unique, we use aliases
@@ -517,7 +516,7 @@
return result.toArray(new String[result.size()]);
}
- @SuppressWarnings("unchecked")
+ @SuppressWarnings({ "unchecked", "rawtypes" })
public void setProperties(Dictionary properties)
{
checkUnregistered();
Modified: projects/jboss-osgi/projects/runtime/jbossas/trunk/pom.xml
===================================================================
--- projects/jboss-osgi/projects/runtime/jbossas/trunk/pom.xml 2009-12-16 11:50:41 UTC (rev 97880)
+++ projects/jboss-osgi/projects/runtime/jbossas/trunk/pom.xml 2009-12-16 11:51:28 UTC (rev 97881)
@@ -39,7 +39,7 @@
<!-- Properties -->
<properties>
<version.jboss.osgi.jta>1.0.0</version.jboss.osgi.jta>
- <version.jboss.osgi.microcontainer>2.0.9</version.jboss.osgi.microcontainer>
+ <version.jboss.osgi.microcontainer>2.2.0-SNAPSHOT</version.jboss.osgi.microcontainer>
<version.osgi>4.2.0</version.osgi>
</properties>
16 years
JBoss-OSGI SVN: r97880 - in projects/jboss-osgi/trunk: reactor/blueprint/src/test/resources/META-INF and 3 other directories.
by jboss-osgi-commits@lists.jboss.org
Author: thomas.diesler(a)jboss.com
Date: 2009-12-16 06:50:41 -0500 (Wed, 16 Dec 2009)
New Revision: 97880
Modified:
projects/jboss-osgi/trunk/pom.xml
projects/jboss-osgi/trunk/reactor/blueprint/src/test/resources/META-INF/jboss-osgi-bootstrap.xml
projects/jboss-osgi/trunk/testsuite/example/src/test/resources/META-INF/jboss-osgi-bootstrap.xml
projects/jboss-osgi/trunk/testsuite/functional/pom.xml
projects/jboss-osgi/trunk/testsuite/functional/src/test/resources/META-INF/jboss-osgi-bootstrap.xml
Log:
Update to kernel & reflect 2.2.0-SNAPSHOT
Modified: projects/jboss-osgi/trunk/pom.xml
===================================================================
--- projects/jboss-osgi/trunk/pom.xml 2009-12-16 11:22:19 UTC (rev 97879)
+++ projects/jboss-osgi/trunk/pom.xml 2009-12-16 11:50:41 UTC (rev 97880)
@@ -54,15 +54,15 @@
<version.jboss.osgi.common>1.0.3</version.jboss.osgi.common>
<version.jboss.osgi.common.core>2.2.13.GA</version.jboss.osgi.common.core>
<version.jboss.osgi.deployment>1.0.1-SNAPSHOT</version.jboss.osgi.deployment>
- <version.jboss.osgi.framework>1.0.0.Alpha2-SNAPSHOT</version.jboss.osgi.framework>
+ <version.jboss.osgi.framework>1.0.0-SNAPSHOT</version.jboss.osgi.framework>
<version.jboss.osgi.hotdeploy>1.0.3</version.jboss.osgi.hotdeploy>
<version.jboss.osgi.husky>1.0.3-SNAPSHOT</version.jboss.osgi.husky>
<version.jboss.osgi.jaxb>2.1.10.SP3</version.jboss.osgi.jaxb>
<version.jboss.osgi.jmx>1.0.2.SP1</version.jboss.osgi.jmx>
<version.jboss.osgi.jndi>1.0.2</version.jboss.osgi.jndi>
<version.jboss.osgi.jta>1.0.0</version.jboss.osgi.jta>
- <version.jboss.osgi.microcontainer>2.0.9-SNAPSHOT</version.jboss.osgi.microcontainer>
- <version.jboss.osgi.reflect>2.0.2</version.jboss.osgi.reflect>
+ <version.jboss.osgi.microcontainer>2.2.0-SNAPSHOT</version.jboss.osgi.microcontainer>
+ <version.jboss.osgi.reflect>2.2.0-SNAPSHOT</version.jboss.osgi.reflect>
<version.jboss.osgi.runtime.deployers>1.0.4-SNAPSHOT</version.jboss.osgi.runtime.deployers>
<version.jboss.osgi.runtime.equinox>3.5.1</version.jboss.osgi.runtime.equinox>
<version.jboss.osgi.runtime.felix>2.0.2</version.jboss.osgi.runtime.felix>
@@ -70,7 +70,7 @@
<version.jboss.osgi.spi>1.0.4-SNAPSHOT</version.jboss.osgi.spi>
<version.jboss.osgi.webapp>0.7.2</version.jboss.osgi.webapp>
<version.jboss.osgi.webconsole>1.0.2</version.jboss.osgi.webconsole>
- <version.jboss.osgi.xml.binding>2.0.2.Beta3</version.jboss.osgi.xml.binding>
+ <version.jboss.osgi.xml.binding>2.0.2-SNAPSHOT</version.jboss.osgi.xml.binding>
<version.ops4j.pax.web>0.7.2</version.ops4j.pax.web>
<version.osgi>4.2.0</version.osgi>
Modified: projects/jboss-osgi/trunk/reactor/blueprint/src/test/resources/META-INF/jboss-osgi-bootstrap.xml
===================================================================
--- projects/jboss-osgi/trunk/reactor/blueprint/src/test/resources/META-INF/jboss-osgi-bootstrap.xml 2009-12-16 11:22:19 UTC (rev 97879)
+++ projects/jboss-osgi/trunk/reactor/blueprint/src/test/resources/META-INF/jboss-osgi-bootstrap.xml 2009-12-16 11:50:41 UTC (rev 97880)
@@ -12,19 +12,21 @@
<constructor>
<parameter><inject bean="jboss.kernel:service=Kernel" /></parameter>
<parameter><inject bean="MainDeployer" /></parameter>
+ <parameter><inject bean="DeploymentRegistry" /></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>
<entry><key>org.osgi.framework.system.packages.extra</key><value>
-
+
<!-- [JBOSGI-145] JAXB classes are loaded from the system classpath -->
com.sun.xml.internal.bind.v2,
-
- <!-- log4j -->
- org.apache.log4j;version=1.2,
+ <!-- loging -->
+ org.apache.log4j;version=1.2,
+ org.slf4j;version=1.5,
+
<!-- jboss -->
org.jboss.beans.metadata.plugins;version=2.0,
org.jboss.beans.metadata.plugins.builder;version=2.0,
@@ -74,7 +76,6 @@
</bean>
<bean name="OSGiFrameworkEventsPlugin" class="org.jboss.osgi.framework.plugins.internal.FrameworkEventsPluginImpl">
<constructor><parameter><inject bean="OSGiBundleManager" /></parameter></constructor>
- <property name="synchronous">true</property>
</bean>
<bean name="OSGiStoragePlugin" class="org.jboss.osgi.framework.plugins.internal.BundleStoragePluginImpl">
<constructor><parameter><inject bean="OSGiBundleManager" /></parameter></constructor>
@@ -121,6 +122,9 @@
<property name="deployers"><inject bean="Deployers" /></property>
</bean>
+ <!-- The deployment registry -->
+ <bean name="DeploymentRegistry" class="org.jboss.deployers.structure.spi.helpers.AbstractDeploymentRegistry"/>
+
<!-- The holder for deployers that determine structure -->
<bean name="StructuralDeployers" class="org.jboss.deployers.vfs.plugins.structure.VFSStructuralDeployersImpl">
<property name="structureBuilder">
@@ -154,14 +158,19 @@
<constructor>
<parameter class="org.jboss.dependency.spi.Controller"><inject bean="jboss.kernel:service=KernelController" /></parameter>
</constructor>
+ <property name="deploymentRegistry"><inject bean="DeploymentRegistry"/></property>
</bean>
<!-- OSGI Deployment -->
<bean name="OSGiManifestParsingDeployer" class="org.jboss.osgi.framework.deployers.OSGiManifestParsingDeployer" />
- <bean name="OSGiBundleStateDeployer" class="org.jboss.osgi.framework.deployers.OSGiBundleStateDeployer">
+ <bean name="OSGiBundleStateAddDeployer" class="org.jboss.osgi.framework.deployers.OSGiBundleStateAddDeployer">
<constructor><parameter><inject bean="OSGiBundleManager" /></parameter></constructor>
</bean>
+ <bean name="OSGiBundleStateRemoveDeployer" class="org.jboss.osgi.framework.deployers.OSGiBundleStateRemoveDeployer">
+ <constructor><parameter><inject bean="OSGiBundleManager" /></parameter></constructor>
+ </bean>
<bean name="OSGiBundleActivatorDeployer" class="org.jboss.osgi.framework.deployers.OSGiBundleActivatorDeployer" />
+ <bean name="OSGiContextTrackerDeployer" class="org.jboss.osgi.framework.deployers.OSGiContextTrackerDeployer" />
<!--
********************************
Modified: projects/jboss-osgi/trunk/testsuite/example/src/test/resources/META-INF/jboss-osgi-bootstrap.xml
===================================================================
--- projects/jboss-osgi/trunk/testsuite/example/src/test/resources/META-INF/jboss-osgi-bootstrap.xml 2009-12-16 11:22:19 UTC (rev 97879)
+++ projects/jboss-osgi/trunk/testsuite/example/src/test/resources/META-INF/jboss-osgi-bootstrap.xml 2009-12-16 11:50:41 UTC (rev 97880)
@@ -12,6 +12,7 @@
<constructor>
<parameter><inject bean="jboss.kernel:service=Kernel" /></parameter>
<parameter><inject bean="MainDeployer" /></parameter>
+ <parameter><inject bean="DeploymentRegistry" /></parameter>
</constructor>
<property name="properties">
<map keyClass="java.lang.String" valueClass="java.lang.String">
@@ -75,7 +76,6 @@
</bean>
<bean name="OSGiFrameworkEventsPlugin" class="org.jboss.osgi.framework.plugins.internal.FrameworkEventsPluginImpl">
<constructor><parameter><inject bean="OSGiBundleManager" /></parameter></constructor>
- <property name="synchronous">true</property>
</bean>
<bean name="OSGiStoragePlugin" class="org.jboss.osgi.framework.plugins.internal.BundleStoragePluginImpl">
<constructor><parameter><inject bean="OSGiBundleManager" /></parameter></constructor>
@@ -134,6 +134,9 @@
<property name="deployers"><inject bean="Deployers" /></property>
</bean>
+ <!-- The deployment registry -->
+ <bean name="DeploymentRegistry" class="org.jboss.deployers.structure.spi.helpers.AbstractDeploymentRegistry"/>
+
<!-- The holder for deployers that determine structure -->
<bean name="StructuralDeployers" class="org.jboss.deployers.vfs.plugins.structure.VFSStructuralDeployersImpl">
<property name="structureBuilder">
@@ -167,14 +170,19 @@
<constructor>
<parameter class="org.jboss.dependency.spi.Controller"><inject bean="jboss.kernel:service=KernelController" /></parameter>
</constructor>
+ <property name="deploymentRegistry"><inject bean="DeploymentRegistry"/></property>
</bean>
<!-- OSGI Deployment -->
<bean name="OSGiManifestParsingDeployer" class="org.jboss.osgi.framework.deployers.OSGiManifestParsingDeployer" />
- <bean name="OSGiBundleStateDeployer" class="org.jboss.osgi.framework.deployers.OSGiBundleStateDeployer">
+ <bean name="OSGiBundleStateAddDeployer" class="org.jboss.osgi.framework.deployers.OSGiBundleStateAddDeployer">
<constructor><parameter><inject bean="OSGiBundleManager" /></parameter></constructor>
</bean>
+ <bean name="OSGiBundleStateRemoveDeployer" class="org.jboss.osgi.framework.deployers.OSGiBundleStateRemoveDeployer">
+ <constructor><parameter><inject bean="OSGiBundleManager" /></parameter></constructor>
+ </bean>
<bean name="OSGiBundleActivatorDeployer" class="org.jboss.osgi.framework.deployers.OSGiBundleActivatorDeployer" />
+ <bean name="OSGiContextTrackerDeployer" class="org.jboss.osgi.framework.deployers.OSGiContextTrackerDeployer" />
<!--
********************************
Modified: projects/jboss-osgi/trunk/testsuite/functional/pom.xml
===================================================================
--- projects/jboss-osgi/trunk/testsuite/functional/pom.xml 2009-12-16 11:22:19 UTC (rev 97879)
+++ projects/jboss-osgi/trunk/testsuite/functional/pom.xml 2009-12-16 11:50:41 UTC (rev 97880)
@@ -38,7 +38,7 @@
<properties>
<version.javax.ejb>3.0</version.javax.ejb>
<version.jboss.ejb3>1.0.0</version.jboss.ejb3>
- <version.jboss.microcontainer>2.0.9.GA</version.jboss.microcontainer>
+ <version.jboss.aop.mc.int>2.2.0.M2</version.jboss.aop.mc.int>
</properties>
<!-- Dependencies -->
@@ -46,7 +46,13 @@
<dependency>
<groupId>org.jboss.microcontainer</groupId>
<artifactId>jboss-aop-mc-int</artifactId>
- <version>${version.jboss.microcontainer}</version>
+ <version>${version.jboss.aop.mc.int}</version>
+ <exclusions>
+ <exclusion>
+ <groupId>org.jboss.microcontainer</groupId>
+ <artifactId>jboss-kernel</artifactId>
+ </exclusion>
+ </exclusions>
</dependency>
<dependency>
<groupId>javax.ejb</groupId>
Modified: projects/jboss-osgi/trunk/testsuite/functional/src/test/resources/META-INF/jboss-osgi-bootstrap.xml
===================================================================
--- projects/jboss-osgi/trunk/testsuite/functional/src/test/resources/META-INF/jboss-osgi-bootstrap.xml 2009-12-16 11:22:19 UTC (rev 97879)
+++ projects/jboss-osgi/trunk/testsuite/functional/src/test/resources/META-INF/jboss-osgi-bootstrap.xml 2009-12-16 11:50:41 UTC (rev 97880)
@@ -12,6 +12,7 @@
<constructor>
<parameter><inject bean="jboss.kernel:service=Kernel" /></parameter>
<parameter><inject bean="MainDeployer" /></parameter>
+ <parameter><inject bean="DeploymentRegistry" /></parameter>
</constructor>
<property name="properties">
<map keyClass="java.lang.String" valueClass="java.lang.String">
@@ -120,6 +121,9 @@
<property name="deployers"><inject bean="Deployers" /></property>
</bean>
+ <!-- The deployment registry -->
+ <bean name="DeploymentRegistry" class="org.jboss.deployers.structure.spi.helpers.AbstractDeploymentRegistry"/>
+
<!-- The holder for deployers that determine structure -->
<bean name="StructuralDeployers" class="org.jboss.deployers.vfs.plugins.structure.VFSStructuralDeployersImpl">
<property name="structureBuilder">
@@ -153,14 +157,19 @@
<constructor>
<parameter class="org.jboss.dependency.spi.Controller"><inject bean="jboss.kernel:service=KernelController" /></parameter>
</constructor>
+ <property name="deploymentRegistry"><inject bean="DeploymentRegistry"/></property>
</bean>
<!-- OSGI Deployment -->
<bean name="OSGiManifestParsingDeployer" class="org.jboss.osgi.framework.deployers.OSGiManifestParsingDeployer" />
- <bean name="OSGiBundleStateDeployer" class="org.jboss.osgi.framework.deployers.OSGiBundleStateDeployer">
+ <bean name="OSGiBundleStateAddDeployer" class="org.jboss.osgi.framework.deployers.OSGiBundleStateAddDeployer">
<constructor><parameter><inject bean="OSGiBundleManager" /></parameter></constructor>
</bean>
+ <bean name="OSGiBundleStateRemoveDeployer" class="org.jboss.osgi.framework.deployers.OSGiBundleStateRemoveDeployer">
+ <constructor><parameter><inject bean="OSGiBundleManager" /></parameter></constructor>
+ </bean>
<bean name="OSGiBundleActivatorDeployer" class="org.jboss.osgi.framework.deployers.OSGiBundleActivatorDeployer" />
+ <bean name="OSGiContextTrackerDeployer" class="org.jboss.osgi.framework.deployers.OSGiContextTrackerDeployer" />
<!--
********************************
16 years
JBoss-OSGI SVN: r97879 - in projects/jboss-osgi/projects: bundles/jboss-xml-binding/trunk and 6 other directories.
by jboss-osgi-commits@lists.jboss.org
Author: thomas.diesler(a)jboss.com
Date: 2009-12-16 06:22:19 -0500 (Wed, 16 Dec 2009)
New Revision: 97879
Modified:
projects/jboss-osgi/projects/bundles/jboss-reflect/trunk/pom.xml
projects/jboss-osgi/projects/bundles/jboss-xml-binding/trunk/pom.xml
projects/jboss-osgi/projects/bundles/microcontainer/trunk/pom.xml
projects/jboss-osgi/projects/bundles/microcontainer/trunk/src/main/java/org/jboss/osgi/microcontainer/AbstractMicrocontainerDeployerService.java
projects/jboss-osgi/projects/bundles/microcontainer/trunk/src/test/resources/jboss-osgi-framework.properties
projects/jboss-osgi/projects/runtime/deployers/trunk/pom.xml
projects/jboss-osgi/projects/runtime/deployers/trunk/src/main/java/org/jboss/osgi/deployer/BundleContainedBeansDeployer.java
projects/jboss-osgi/projects/runtime/deployment/trunk/pom.xml
Log:
Update to kernel & reflect 2.2.0-SNAPSHOT
Modified: projects/jboss-osgi/projects/bundles/jboss-reflect/trunk/pom.xml
===================================================================
--- projects/jboss-osgi/projects/bundles/jboss-reflect/trunk/pom.xml 2009-12-16 11:09:44 UTC (rev 97878)
+++ projects/jboss-osgi/projects/bundles/jboss-reflect/trunk/pom.xml 2009-12-16 11:22:19 UTC (rev 97879)
@@ -21,7 +21,7 @@
<artifactId>jboss-osgi-reflect</artifactId>
<packaging>bundle</packaging>
- <version>2.0.3-SNAPSHOT</version>
+ <version>2.2.0-SNAPSHOT</version>
<!-- Parent -->
<parent>
@@ -40,8 +40,7 @@
<!-- Properties -->
<properties>
<version.javassist>3.9.0.GA</version.javassist>
- <version.jboss.osgi.common.core>2.2.13.GA</version.jboss.osgi.common.core>
- <version.jboss.reflect>2.0.2.GA</version.jboss.reflect>
+ <version.jboss.reflect>2.2.0-SNAPSHOT</version.jboss.reflect>
</properties>
<!-- Dependencies -->
@@ -59,19 +58,7 @@
<groupId>org.jboss</groupId>
<artifactId>jboss-reflect</artifactId>
<version>${version.jboss.reflect}</version>
- <exclusions>
- <exclusion>
- <groupId>org.jboss</groupId>
- <artifactId>jboss-common-core</artifactId>
- </exclusion>
- </exclusions>
</dependency>
- <dependency>
- <groupId>org.jboss.osgi.bundles</groupId>
- <artifactId>jboss-osgi-common-core</artifactId>
- <version>${version.jboss.osgi.common.core}</version>
- <scope>provided</scope>
- </dependency>
</dependencies>
<build>
@@ -104,7 +91,7 @@
org.jboss.classadapter.spi*;version=${version.jboss.reflect},
org.jboss.config*;version=${version.jboss.reflect},
org.jboss.joinpoint*;version=${version.jboss.reflect},
- org.jboss.reflect.plugins.introspection;version=${version.jboss.reflect},
+ org.jboss.reflect.plugins.*;version=${version.jboss.reflect},
org.jboss.reflect.spi*;version=${version.jboss.reflect},
</_exportcontents>
</instructions>
Modified: projects/jboss-osgi/projects/bundles/jboss-xml-binding/trunk/pom.xml
===================================================================
--- projects/jboss-osgi/projects/bundles/jboss-xml-binding/trunk/pom.xml 2009-12-16 11:09:44 UTC (rev 97878)
+++ projects/jboss-osgi/projects/bundles/jboss-xml-binding/trunk/pom.xml 2009-12-16 11:22:19 UTC (rev 97879)
@@ -21,7 +21,7 @@
<artifactId>jboss-osgi-xml-binding</artifactId>
<packaging>bundle</packaging>
- <version>2.0.3-SNAPSHOT</version>
+ <version>2.0.2-SNAPSHOT</version>
<!-- Parent -->
<parent>
@@ -45,7 +45,7 @@
<version.jboss.osgi.common.core>2.2.13.GA</version.jboss.osgi.common.core>
<version.jboss.osgi.husky>1.0.2</version.jboss.osgi.husky>
<version.jboss.osgi.jaxb>2.1.10.SP3</version.jboss.osgi.jaxb>
- <version.jboss.osgi.reflect>2.0.2</version.jboss.osgi.reflect>
+ <version.jboss.osgi.reflect>2.2.0-SNAPSHOT</version.jboss.osgi.reflect>
<version.jboss.osgi.spi>1.0.3</version.jboss.osgi.spi>
<version.osgi>4.2.0</version.osgi>
</properties>
@@ -172,12 +172,12 @@
org.osgi.util.tracker,
<!-- jboss-osgi-reflect -->
- org.jboss.beans.info.spi;version="[2.0,2.1)",
- org.jboss.config.plugins.property;version="[2.0,2.1)",
- org.jboss.config.spi;version="[2.0,2.1)",
- org.jboss.joinpoint.plugins;version="[2.0,2.1)",
- org.jboss.reflect.plugins.introspection;version="[2.0,2.1)",
- org.jboss.reflect.spi;version="[2.0,2.1)",
+ org.jboss.beans.info.spi;version="[2.2,2.3)",
+ org.jboss.config.plugins.property;version="[2.2,2.3)",
+ org.jboss.config.spi;version="[2.2,2.3)",
+ org.jboss.joinpoint.plugins;version="[2.2,2.3)",
+ org.jboss.reflect.plugins.introspection;version="[2.2,2.3)",
+ org.jboss.reflect.spi;version="[2.2,2.3)",
</Import-Package>
<Embed-Dependency>
jbossxb;inline=false,
Modified: projects/jboss-osgi/projects/bundles/microcontainer/trunk/pom.xml
===================================================================
--- projects/jboss-osgi/projects/bundles/microcontainer/trunk/pom.xml 2009-12-16 11:09:44 UTC (rev 97878)
+++ projects/jboss-osgi/projects/bundles/microcontainer/trunk/pom.xml 2009-12-16 11:22:19 UTC (rev 97879)
@@ -21,7 +21,7 @@
<artifactId>jboss-osgi-microcontainer</artifactId>
<packaging>bundle</packaging>
- <version>2.0.9-SNAPSHOT</version>
+ <version>2.2.0-SNAPSHOT</version>
<!-- Parent -->
<parent>
@@ -40,18 +40,18 @@
<!-- Properties -->
<properties>
<version.jboss.osgi.runtime.felix>2.0.2</version.jboss.osgi.runtime.felix>
- <version.jboss.deployers>2.0.9.GA</version.jboss.deployers>
- <version.jboss.microcontainer>2.0.9.GA</version.jboss.microcontainer>
+ <version.jboss.deployers>2.2.0-SNAPSHOT</version.jboss.deployers>
+ <version.jboss.kernel>2.2.0-SNAPSHOT</version.jboss.kernel>
<version.jboss.osgi.common>1.0.3</version.jboss.osgi.common>
<version.jboss.osgi.common.core>2.2.13.GA</version.jboss.osgi.common.core>
<version.jboss.osgi.deployment>1.0.1-SNAPSHOT</version.jboss.osgi.deployment>
<version.jboss.osgi.husky>1.0.3-SNAPSHOT</version.jboss.osgi.husky>
<version.jboss.osgi.jaxb>2.1.10.SP3</version.jboss.osgi.jaxb>
<version.jboss.osgi.jmx>1.0.2</version.jboss.osgi.jmx>
- <version.jboss.osgi.reflect>2.0.2</version.jboss.osgi.reflect>
+ <version.jboss.osgi.reflect>2.2.0-SNAPSHOT</version.jboss.osgi.reflect>
<version.jboss.osgi.runtime.deployers>1.0.4-SNAPSHOT</version.jboss.osgi.runtime.deployers>
<version.jboss.osgi.spi>1.0.4-SNAPSHOT</version.jboss.osgi.spi>
- <version.jboss.osgi.xml.binding>2.0.2.Beta3</version.jboss.osgi.xml.binding>
+ <version.jboss.osgi.xml.binding>2.0.2-SNAPSHOT</version.jboss.osgi.xml.binding>
<version.osgi>4.2.0</version.osgi>
</properties>
@@ -69,9 +69,9 @@
</exclusions>
</dependency>
<dependency>
- <groupId>org.jboss.microcontainer</groupId>
+ <groupId>org.jboss.kernel</groupId>
<artifactId>jboss-kernel</artifactId>
- <version>${version.jboss.microcontainer}</version>
+ <version>${version.jboss.kernel}</version>
<exclusions>
<exclusion>
<groupId>org.jboss</groupId>
@@ -182,7 +182,7 @@
<Bundle-SymbolicName>${artifactId}</Bundle-SymbolicName>
<Bundle-Activator>org.jboss.osgi.microcontainer.internal.MicrocontainerServiceActivator</Bundle-Activator>
<Export-Package>
- org.jboss.osgi.microcontainer;version=2.0.9
+ org.jboss.osgi.microcontainer;version=${version}
</Export-Package>
<Private-Package>
org.jboss.osgi.microcontainer.internal
@@ -198,11 +198,11 @@
javax.xml.transform*,
javax.xml.validation,
- org.jboss.beans*;version="[2.0,2.1)",
- org.jboss.classadapter.spi;version="[2.0,2.1)",
- org.jboss.config*;version="[2.0,2.1)",
- org.jboss.joinpoint*;version="[2.0,2.1)",
- org.jboss.reflect*;version="[2.0,2.1)",
+ org.jboss.beans*;version="[2.2,2.3)",
+ org.jboss.classadapter.spi;version="[2.2,2.3)",
+ org.jboss.config*;version="[2.2,2.3)",
+ org.jboss.joinpoint*;version="[2.2,2.3)",
+ org.jboss.reflect*;version="[2.2,2.3)",
org.jboss.logging,
@@ -251,11 +251,12 @@
jboss-mdr;inline=false,
jboss-osgi-deployers;inline=false,
jboss-kernel;inline=false,
+ mcann-core;inline=false,
</Embed-Dependency>
<_exportcontents>
- org.jboss.beans.metadata*;version=2.0.9,
- org.jboss.dependency.spi*;version=2.0.9,
- org.jboss.kernel.spi*;version=2.0.9,
+ org.jboss.beans.metadata*;version=${version.jboss.kernel},
+ org.jboss.dependency.spi*;version=${version.jboss.kernel},
+ org.jboss.kernel.spi*;version=${version.jboss.kernel},
</_exportcontents>
</instructions>
</configuration>
Modified: projects/jboss-osgi/projects/bundles/microcontainer/trunk/src/main/java/org/jboss/osgi/microcontainer/AbstractMicrocontainerDeployerService.java
===================================================================
--- projects/jboss-osgi/projects/bundles/microcontainer/trunk/src/main/java/org/jboss/osgi/microcontainer/AbstractMicrocontainerDeployerService.java 2009-12-16 11:09:44 UTC (rev 97878)
+++ projects/jboss-osgi/projects/bundles/microcontainer/trunk/src/main/java/org/jboss/osgi/microcontainer/AbstractMicrocontainerDeployerService.java 2009-12-16 11:22:19 UTC (rev 97879)
@@ -100,17 +100,6 @@
}
}
- private DeployerService getSystemDeployerService() throws InvalidSyntaxException
- {
- BundleContext context = getBundleContext();
- ServiceReference[] srefs = context.getServiceReferences(DeployerService.class.getName(), "(provider=system)");
- if (srefs == null)
- throw new IllegalStateException("Cannot obtain system DeployerService");
-
- DeployerService service = (DeployerService)context.getService(srefs[0]);
- return service;
- }
-
public void deploy(Deployment[] depArr) throws BundleException
{
ClassLoader ctxLoader = Thread.currentThread().getContextClassLoader();
@@ -187,6 +176,17 @@
}
}
+ private DeployerService getSystemDeployerService() throws InvalidSyntaxException
+ {
+ BundleContext context = getBundleContext();
+ ServiceReference[] srefs = context.getServiceReferences(DeployerService.class.getName(), "(provider=system)");
+ if (srefs == null)
+ throw new IllegalStateException("Cannot obtain system DeployerService");
+
+ DeployerService service = (DeployerService)context.getService(srefs[0]);
+ return service;
+ }
+
private VFSDeployment createVFSDeployment(VirtualFile root)
{
if (deploymentFactory == null)
Modified: projects/jboss-osgi/projects/bundles/microcontainer/trunk/src/test/resources/jboss-osgi-framework.properties
===================================================================
--- projects/jboss-osgi/projects/bundles/microcontainer/trunk/src/test/resources/jboss-osgi-framework.properties 2009-12-16 11:09:44 UTC (rev 97878)
+++ projects/jboss-osgi/projects/bundles/microcontainer/trunk/src/test/resources/jboss-osgi-framework.properties 2009-12-16 11:22:19 UTC (rev 97879)
@@ -30,6 +30,7 @@
org.jboss.virtual.plugins.registry;version=2.1, \
org.jboss.virtual.plugins.context.jar;version=2.1, \
org.jboss.virtual.plugins.vfs.helpers;version=2.1, \
+ org.jboss.virtual.plugins.vfs;version=2.1, \
org.jboss.virtual.protocol;version=2.1, \
org.osgi.framework;version=1.5, \
org.slf4j;version=1.5
Modified: projects/jboss-osgi/projects/runtime/deployers/trunk/pom.xml
===================================================================
--- projects/jboss-osgi/projects/runtime/deployers/trunk/pom.xml 2009-12-16 11:09:44 UTC (rev 97878)
+++ projects/jboss-osgi/projects/runtime/deployers/trunk/pom.xml 2009-12-16 11:22:19 UTC (rev 97879)
@@ -30,7 +30,7 @@
</parent>
<properties>
- <version.jboss.deployers>2.0.9.GA</version.jboss.deployers>
+ <version.jboss.deployers>2.2.0-SNAPSHOT</version.jboss.deployers>
<version.jboss.osgi.deployment>1.0.1-SNAPSHOT</version.jboss.osgi.deployment>
<version.jboss.osgi.spi>1.0.4-SNAPSHOT</version.jboss.osgi.spi>
<version.osgi>4.2.0</version.osgi>
Modified: projects/jboss-osgi/projects/runtime/deployers/trunk/src/main/java/org/jboss/osgi/deployer/BundleContainedBeansDeployer.java
===================================================================
--- projects/jboss-osgi/projects/runtime/deployers/trunk/src/main/java/org/jboss/osgi/deployer/BundleContainedBeansDeployer.java 2009-12-16 11:09:44 UTC (rev 97878)
+++ projects/jboss-osgi/projects/runtime/deployers/trunk/src/main/java/org/jboss/osgi/deployer/BundleContainedBeansDeployer.java 2009-12-16 11:22:19 UTC (rev 97879)
@@ -73,7 +73,7 @@
return KernelDeployment.class;
}
- protected List<BeanMetaData> getBeans(KernelDeployment deployment)
+ protected List<BeanMetaData> getComponents(KernelDeployment deployment)
{
return deployment.getBeans();
}
@@ -89,7 +89,7 @@
return BeanMetaData.class;
}
- protected List<BeanMetaData> getBeans(BeanMetaData deployment)
+ protected List<BeanMetaData> getComponents(BeanMetaData deployment)
{
return Collections.singletonList(deployment);
}
Modified: projects/jboss-osgi/projects/runtime/deployment/trunk/pom.xml
===================================================================
--- projects/jboss-osgi/projects/runtime/deployment/trunk/pom.xml 2009-12-16 11:09:44 UTC (rev 97878)
+++ projects/jboss-osgi/projects/runtime/deployment/trunk/pom.xml 2009-12-16 11:22:19 UTC (rev 97879)
@@ -54,10 +54,13 @@
<artifactId>jboss-osgi-spi</artifactId>
<version>${version.jboss.osgi.spi}</version>
</dependency>
+
+ <!-- Provided Dependencies -->
<dependency>
<groupId>org.jboss.deployers</groupId>
<artifactId>jboss-deployers-vfs</artifactId>
<version>${version.jboss.deployers}</version>
+ <scope>provided</scope>
</dependency>
<!-- OSGi Dependencies -->
16 years