From 6ba39e7fdf657f36e7f9265b52a066335382989a Mon Sep 17 00:00:00 2001 From: Greg Wilkins Date: Tue, 5 Jan 2010 00:32:37 +0000 Subject: [PATCH] work in progress for OSGi boot to use Deployment manager git-svn-id: svn+ssh://dev.eclipse.org/svnroot/rt/org.eclipse.jetty/jetty/trunk@1177 7e9141cc-0065-0410-87d8-b60c137991c4 --- .../webapp/WebappRegistrationHelper.java | 21 ++++++++++++------- 1 file changed, 13 insertions(+), 8 deletions(-) diff --git a/jetty-osgi/jetty-osgi-boot/src/main/java/org/eclipse/jetty/osgi/boot/internal/webapp/WebappRegistrationHelper.java b/jetty-osgi/jetty-osgi-boot/src/main/java/org/eclipse/jetty/osgi/boot/internal/webapp/WebappRegistrationHelper.java index ea4f9bedde2..d365f78c855 100644 --- a/jetty-osgi/jetty-osgi-boot/src/main/java/org/eclipse/jetty/osgi/boot/internal/webapp/WebappRegistrationHelper.java +++ b/jetty-osgi/jetty-osgi-boot/src/main/java/org/eclipse/jetty/osgi/boot/internal/webapp/WebappRegistrationHelper.java @@ -34,6 +34,7 @@ import java.util.zip.ZipEntry; import org.eclipse.jetty.deploy.AppProvider; import org.eclipse.jetty.deploy.DeploymentManager; import org.eclipse.jetty.osgi.boot.JettyBootstrapActivator; +import org.eclipse.jetty.osgi.boot.OSGiAppProvider; import org.eclipse.jetty.osgi.boot.OSGiWebappConstants; import org.eclipse.jetty.osgi.boot.internal.jsp.TldLocatableURLClassloader; import org.eclipse.jetty.osgi.boot.utils.BundleClassLoaderHelper; @@ -124,6 +125,8 @@ class WebappRegistrationHelper private DeploymentManager _deploymentManager; + private OSGiAppProvider _provider; + public WebappRegistrationHelper(Server server) { _server = server; @@ -362,16 +365,10 @@ class WebappRegistrationHelper System.setProperty("java.naming.factory.url.pkgs","org.eclipse.jetty.jndi"); } + // Get the context handler _ctxtHandler = (ContextHandlerCollection)_server.getChildHandlerByClass(ContextHandlerCollection.class); - if (_ctxtHandler == null) - { - throw new IllegalStateException("ERROR: No ContextHandlerCollection was configured" + " with the server to add applications to." - + "Using a default one is not supported at" + " this point. " + " Please review the jetty.xml file used."); - } - // get a deployerManager - List deployers = _server.getBeans(DeploymentManager.class); if (deployers != null && !deployers.isEmpty()) { @@ -379,10 +376,18 @@ class WebappRegistrationHelper for (AppProvider provider : _deploymentManager.getAppProviders()) { - // if (provider instanceof OSGiAppProvider) + if (provider instanceof OSGiAppProvider) + { + _provider=(OSGiAppProvider)provider; + break; + } } } + if (_ctxtHandler == null || _provider==null) + throw new IllegalStateException("ERROR: No ContextHandlerCollection or OSGiAppProvider configured"); + + } /**