Search in sources :

Example 1 with StandardStarter

use of org.eclipse.jetty.deploy.bindings.StandardStarter in project jetty.project by eclipse.

the class ServerInstanceWrapper method init.

/* ------------------------------------------------------------ */
/**
     * Must be called after the server is configured. 
     * 
     * It is assumed the server has already been configured with the ContextHandlerCollection structure.
     * 
     */
private void init() {
    // Get the context handler
    _ctxtCollection = (ContextHandlerCollection) _server.getChildHandlerByClass(ContextHandlerCollection.class);
    if (_ctxtCollection == null)
        throw new IllegalStateException("ERROR: No ContextHandlerCollection configured in Server");
    List<String> providerClassNames = new ArrayList<String>();
    // get a deployerManager and some providers
    Collection<DeploymentManager> deployers = _server.getBeans(DeploymentManager.class);
    if (deployers != null && !deployers.isEmpty()) {
        _deploymentManager = deployers.iterator().next();
        for (AppProvider provider : _deploymentManager.getAppProviders()) {
            providerClassNames.add(provider.getClass().getName());
        }
    } else {
        //add some kind of default
        _deploymentManager = new DeploymentManager();
        _deploymentManager.setContexts(_ctxtCollection);
        _server.addBean(_deploymentManager);
    }
    _deploymentManager.setUseStandardBindings(false);
    List<AppLifeCycle.Binding> deploymentLifeCycleBindings = new ArrayList<AppLifeCycle.Binding>();
    deploymentLifeCycleBindings.add(new OSGiDeployer(this));
    deploymentLifeCycleBindings.add(new StandardStarter());
    deploymentLifeCycleBindings.add(new StandardStopper());
    deploymentLifeCycleBindings.add(new OSGiUndeployer(this));
    _deploymentManager.setLifeCycleBindings(deploymentLifeCycleBindings);
    if (!providerClassNames.contains(BundleWebAppProvider.class.getName())) {
        // create it on the fly with reasonable default values.
        try {
            BundleWebAppProvider webAppProvider = new BundleWebAppProvider(this);
            _deploymentManager.addAppProvider(webAppProvider);
        } catch (Exception e) {
            LOG.warn(e);
        }
    }
    if (!providerClassNames.contains(ServiceWebAppProvider.class.getName())) {
        // create it on the fly with reasonable default values.
        try {
            ServiceWebAppProvider webAppProvider = new ServiceWebAppProvider(this);
            _deploymentManager.addAppProvider(webAppProvider);
        } catch (Exception e) {
            LOG.warn(e);
        }
    }
    if (!providerClassNames.contains(BundleContextProvider.class.getName())) {
        try {
            BundleContextProvider contextProvider = new BundleContextProvider(this);
            _deploymentManager.addAppProvider(contextProvider);
        } catch (Exception e) {
            LOG.warn(e);
        }
    }
    if (!providerClassNames.contains(ServiceContextProvider.class.getName())) {
        try {
            ServiceContextProvider contextProvider = new ServiceContextProvider(this);
            _deploymentManager.addAppProvider(contextProvider);
        } catch (Exception e) {
            LOG.warn(e);
        }
    }
}
Also used : StandardStopper(org.eclipse.jetty.deploy.bindings.StandardStopper) BundleContextProvider(org.eclipse.jetty.osgi.boot.BundleContextProvider) DeploymentManager(org.eclipse.jetty.deploy.DeploymentManager) ServiceContextProvider(org.eclipse.jetty.osgi.boot.ServiceContextProvider) ArrayList(java.util.ArrayList) OSGiDeployer(org.eclipse.jetty.osgi.boot.OSGiDeployer) StandardStarter(org.eclipse.jetty.deploy.bindings.StandardStarter) OSGiUndeployer(org.eclipse.jetty.osgi.boot.OSGiUndeployer) BundleWebAppProvider(org.eclipse.jetty.osgi.boot.BundleWebAppProvider) ServiceWebAppProvider(org.eclipse.jetty.osgi.boot.ServiceWebAppProvider) AppProvider(org.eclipse.jetty.deploy.AppProvider) BundleWebAppProvider(org.eclipse.jetty.osgi.boot.BundleWebAppProvider) ServiceWebAppProvider(org.eclipse.jetty.osgi.boot.ServiceWebAppProvider) AppLifeCycle(org.eclipse.jetty.deploy.AppLifeCycle)

Example 2 with StandardStarter

use of org.eclipse.jetty.deploy.bindings.StandardStarter in project jetty.project by eclipse.

the class DeploymentManager method doStart.

@Override
protected void doStart() throws Exception {
    if (getContexts() == null)
        throw new IllegalStateException("No Contexts");
    if (_useStandardBindings) {
        LOG.debug("DeploymentManager using standard bindings");
        addLifeCycleBinding(new StandardDeployer());
        addLifeCycleBinding(new StandardStarter());
        addLifeCycleBinding(new StandardStopper());
        addLifeCycleBinding(new StandardUndeployer());
    }
    // Start all of the AppProviders
    for (AppProvider provider : _providers) {
        startAppProvider(provider);
    }
    super.doStart();
}
Also used : StandardStopper(org.eclipse.jetty.deploy.bindings.StandardStopper) StandardDeployer(org.eclipse.jetty.deploy.bindings.StandardDeployer) StandardStarter(org.eclipse.jetty.deploy.bindings.StandardStarter) StandardUndeployer(org.eclipse.jetty.deploy.bindings.StandardUndeployer)

Aggregations

StandardStarter (org.eclipse.jetty.deploy.bindings.StandardStarter)2 StandardStopper (org.eclipse.jetty.deploy.bindings.StandardStopper)2 ArrayList (java.util.ArrayList)1 AppLifeCycle (org.eclipse.jetty.deploy.AppLifeCycle)1 AppProvider (org.eclipse.jetty.deploy.AppProvider)1 DeploymentManager (org.eclipse.jetty.deploy.DeploymentManager)1 StandardDeployer (org.eclipse.jetty.deploy.bindings.StandardDeployer)1 StandardUndeployer (org.eclipse.jetty.deploy.bindings.StandardUndeployer)1 BundleContextProvider (org.eclipse.jetty.osgi.boot.BundleContextProvider)1 BundleWebAppProvider (org.eclipse.jetty.osgi.boot.BundleWebAppProvider)1 OSGiDeployer (org.eclipse.jetty.osgi.boot.OSGiDeployer)1 OSGiUndeployer (org.eclipse.jetty.osgi.boot.OSGiUndeployer)1 ServiceContextProvider (org.eclipse.jetty.osgi.boot.ServiceContextProvider)1 ServiceWebAppProvider (org.eclipse.jetty.osgi.boot.ServiceWebAppProvider)1