/** * @see org.osgi.util.tracker.ServiceTrackerCustomizer#modifiedService(org.osgi.framework.ServiceReference, java.lang.Object) */ @Override public void modifiedService(ServiceReference reference, Object service) { removedService(reference, service); addingService(reference); }
/** * Setup a new jetty Server, registers it as a service. Setup the Service * tracker for the jetty ContextHandlers that are in charge of deploying the * webapps. Setup the BundleListener that supports the extender pattern for * the jetty ContextHandler. * * @param context the bundle context */ @Override public void start(final BundleContext context) throws Exception { ServiceReference[] references = context.getAllServiceReferences("org.eclipse.jetty.http.HttpFieldPreEncoder", null); if (references == null || references.length==0) LOG.warn("OSGi support for java.util.ServiceLoader may not be present. You may experience runtime errors."); INSTANCE = this; // track other bundles and fragments attached to this bundle that we // should activate. _packageAdminServiceTracker = new PackageAdminServiceTracker(context); // track jetty Server instances that we should support as deployment targets _jettyServerServiceTracker = new ServiceTracker(context, context.createFilter("(objectclass=" + Server.class.getName() + ")"), new JettyServerServiceTracker()); _jettyServerServiceTracker.open(); // Create a default jetty instance right now. DefaultJettyAtJettyHomeHelper.startJettyAtJettyHome(context); }