Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSimone Bordet2015-01-06 11:30:43 -0500
committerSimone Bordet2015-01-06 11:30:43 -0500
commit379f9f6c432a0a1b2e0b93d93b98197489752ddd (patch)
tree397df6579685a38a1114ec1e0de272df221da9d0 /jetty-osgi/jetty-osgi-boot/src
parent200b3a3e6440cf45506b0c206aa395baaadc9df6 (diff)
parent3abfbe26b391a7486fd3eb68586dad981bf77de8 (diff)
downloadorg.eclipse.jetty.project-379f9f6c432a0a1b2e0b93d93b98197489752ddd.tar.gz
org.eclipse.jetty.project-379f9f6c432a0a1b2e0b93d93b98197489752ddd.tar.xz
org.eclipse.jetty.project-379f9f6c432a0a1b2e0b93d93b98197489752ddd.zip
Merged branch 'jetty-9.2.x' into 'master'.
Diffstat (limited to 'jetty-osgi/jetty-osgi-boot/src')
-rw-r--r--jetty-osgi/jetty-osgi-boot/src/main/java/org/eclipse/jetty/osgi/boot/OSGiDeployer.java31
-rw-r--r--jetty-osgi/jetty-osgi-boot/src/main/java/org/eclipse/jetty/osgi/boot/OSGiUndeployer.java22
-rw-r--r--jetty-osgi/jetty-osgi-boot/src/main/java/org/eclipse/jetty/osgi/boot/internal/serverfactory/ServerInstanceWrapper.java4
3 files changed, 51 insertions, 6 deletions
diff --git a/jetty-osgi/jetty-osgi-boot/src/main/java/org/eclipse/jetty/osgi/boot/OSGiDeployer.java b/jetty-osgi/jetty-osgi-boot/src/main/java/org/eclipse/jetty/osgi/boot/OSGiDeployer.java
index eab610f066..46af4885d9 100644
--- a/jetty-osgi/jetty-osgi-boot/src/main/java/org/eclipse/jetty/osgi/boot/OSGiDeployer.java
+++ b/jetty-osgi/jetty-osgi-boot/src/main/java/org/eclipse/jetty/osgi/boot/OSGiDeployer.java
@@ -21,6 +21,7 @@ package org.eclipse.jetty.osgi.boot;
import org.eclipse.jetty.deploy.App;
import org.eclipse.jetty.deploy.bindings.StandardDeployer;
import org.eclipse.jetty.deploy.graph.Node;
+import org.eclipse.jetty.osgi.boot.internal.serverfactory.ServerInstanceWrapper;
import org.eclipse.jetty.osgi.boot.utils.EventSender;
@@ -34,6 +35,15 @@ import org.eclipse.jetty.osgi.boot.utils.EventSender;
public class OSGiDeployer extends StandardDeployer
{
+ private ServerInstanceWrapper _server;
+
+ /* ------------------------------------------------------------ */
+ public OSGiDeployer (ServerInstanceWrapper server)
+ {
+ _server = server;
+ }
+
+
/* ------------------------------------------------------------ */
public void processBinding(Node node, App app) throws Exception
{
@@ -41,14 +51,14 @@ public class OSGiDeployer extends StandardDeployer
//OSGi Enterprise Spec only wants an event sent if its a webapp bundle (ie not a ContextHandler)
if (!(app instanceof AbstractOSGiApp))
{
- super.processBinding(node,app);
+ doProcessBinding(node,app);
}
else
{
EventSender.getInstance().send(EventSender.DEPLOYING_EVENT, ((AbstractOSGiApp)app).getBundle(), app.getContextPath());
try
{
- super.processBinding(node,app);
+ doProcessBinding(node,app);
((AbstractOSGiApp)app).registerAsOSGiService();
EventSender.getInstance().send(EventSender.DEPLOYED_EVENT, ((AbstractOSGiApp)app).getBundle(), app.getContextPath());
}
@@ -58,6 +68,21 @@ public class OSGiDeployer extends StandardDeployer
throw e;
}
}
-
+ }
+
+
+ /* ------------------------------------------------------------ */
+ protected void doProcessBinding (Node node, App app) throws Exception
+ {
+ ClassLoader old = Thread.currentThread().getContextClassLoader();
+ Thread.currentThread().setContextClassLoader(_server.getParentClassLoaderForWebapps());
+ try
+ {
+ super.processBinding(node,app);
+ }
+ finally
+ {
+ Thread.currentThread().setContextClassLoader(old);
+ }
}
}
diff --git a/jetty-osgi/jetty-osgi-boot/src/main/java/org/eclipse/jetty/osgi/boot/OSGiUndeployer.java b/jetty-osgi/jetty-osgi-boot/src/main/java/org/eclipse/jetty/osgi/boot/OSGiUndeployer.java
index 314a87a0ce..645723af5a 100644
--- a/jetty-osgi/jetty-osgi-boot/src/main/java/org/eclipse/jetty/osgi/boot/OSGiUndeployer.java
+++ b/jetty-osgi/jetty-osgi-boot/src/main/java/org/eclipse/jetty/osgi/boot/OSGiUndeployer.java
@@ -21,6 +21,7 @@ package org.eclipse.jetty.osgi.boot;
import org.eclipse.jetty.deploy.App;
import org.eclipse.jetty.deploy.bindings.StandardUndeployer;
import org.eclipse.jetty.deploy.graph.Node;
+import org.eclipse.jetty.osgi.boot.internal.serverfactory.ServerInstanceWrapper;
import org.eclipse.jetty.osgi.boot.utils.EventSender;
@@ -35,11 +36,30 @@ import org.eclipse.jetty.osgi.boot.utils.EventSender;
*/
public class OSGiUndeployer extends StandardUndeployer
{
+ private ServerInstanceWrapper _server;
+
+
+ /* ------------------------------------------------------------ */
+ public OSGiUndeployer (ServerInstanceWrapper server)
+ {
+ _server = server;
+ }
+
+
/* ------------------------------------------------------------ */
public void processBinding(Node node, App app) throws Exception
{
EventSender.getInstance().send(EventSender.UNDEPLOYING_EVENT, ((AbstractOSGiApp)app).getBundle(), app.getContextPath());
- super.processBinding(node,app);
+ ClassLoader old = Thread.currentThread().getContextClassLoader();
+ Thread.currentThread().setContextClassLoader(_server.getParentClassLoaderForWebapps());
+ try
+ {
+ super.processBinding(node,app);
+ }
+ finally
+ {
+ Thread.currentThread().setContextClassLoader(old);
+ }
EventSender.getInstance().send(EventSender.UNDEPLOYED_EVENT, ((AbstractOSGiApp)app).getBundle(), app.getContextPath());
((AbstractOSGiApp)app).deregisterAsOSGiService();
}
diff --git a/jetty-osgi/jetty-osgi-boot/src/main/java/org/eclipse/jetty/osgi/boot/internal/serverfactory/ServerInstanceWrapper.java b/jetty-osgi/jetty-osgi-boot/src/main/java/org/eclipse/jetty/osgi/boot/internal/serverfactory/ServerInstanceWrapper.java
index dc94d6d2f5..e142d39116 100644
--- a/jetty-osgi/jetty-osgi-boot/src/main/java/org/eclipse/jetty/osgi/boot/internal/serverfactory/ServerInstanceWrapper.java
+++ b/jetty-osgi/jetty-osgi-boot/src/main/java/org/eclipse/jetty/osgi/boot/internal/serverfactory/ServerInstanceWrapper.java
@@ -376,10 +376,10 @@ public class ServerInstanceWrapper
_deploymentManager.setUseStandardBindings(false);
List<AppLifeCycle.Binding> deploymentLifeCycleBindings = new ArrayList<AppLifeCycle.Binding>();
- deploymentLifeCycleBindings.add(new OSGiDeployer());
+ deploymentLifeCycleBindings.add(new OSGiDeployer(this));
deploymentLifeCycleBindings.add(new StandardStarter());
deploymentLifeCycleBindings.add(new StandardStopper());
- deploymentLifeCycleBindings.add(new OSGiUndeployer());
+ deploymentLifeCycleBindings.add(new OSGiUndeployer(this));
_deploymentManager.setLifeCycleBindings(deploymentLifeCycleBindings);
if (!providerClassNames.contains(BundleWebAppProvider.class.getName()))

Back to the top