Java 类org.apache.catalina.startup.HostConfig 实例源码

项目:tomee    文件:TomEEUndeployTest.java   
@Test
public void justAContextStop() throws Exception {
    container.start();
    assertEquals(0, webapps().length);
    final StandardHost standardHost = StandardHost.class.cast(TomcatHelper.getServer().findService("Tomcat").getContainer().findChild("localhost"));
    final HostConfig listener = new HostConfig(); // not done in embedded but that's the way autodeploy works in normal tomcat
    standardHost.addLifecycleListener(listener);
    createWebapp(new File(WORK_DIR, "tomee/webapps/my-webapp"));
    listener.lifecycleEvent(new LifecycleEvent(standardHost, Lifecycle.START_EVENT, standardHost));
    assertEquals(1, webapps().length);
    webapps()[0].stop();
    assertEquals(1, webapps().length);
    webapps()[0].start();
    assertEquals(1, webapps().length);
    assertEquals("test", IO.slurp(new URL("http://localhost:" + http + "/my-webapp/")));
}
项目:tomcat7    文件:MBeanFactory.java   
/**
 * Create a new StandardHost.
 *
 * @param parent MBean Name of the associated parent component
 * @param name Unique name of this Host
 * @param appBase Application base directory name
 * @param autoDeploy Should we auto deploy?
 * @param deployOnStartup Deploy on server startup?
 * @param deployXML Should we deploy Context XML config files property?
 * @param unpackWARs Should we unpack WARs when auto deploying?
 *
 * @exception Exception if an MBean cannot be created or registered
 */
public String createStandardHost(String parent, String name,
                                 String appBase,
                                 boolean autoDeploy,
                                 boolean deployOnStartup,
                                 boolean deployXML,                                       
                                 boolean unpackWARs)
    throws Exception {

    // Create a new StandardHost instance
    StandardHost host = new StandardHost();
    host.setName(name);
    host.setAppBase(appBase);
    host.setAutoDeploy(autoDeploy);
    host.setDeployOnStartup(deployOnStartup);
    host.setDeployXML(deployXML);
    host.setUnpackWARs(unpackWARs);

    // add HostConfig for active reloading
    HostConfig hostConfig = new HostConfig();
    host.addLifecycleListener(hostConfig);

    // Add the new instance to its parent component
    ObjectName pname = new ObjectName(parent);
    Service service = getService(pname);
    Engine engine = (Engine) service.getContainer();
    engine.addChild(host);

    // Return the corresponding MBean name
    return (host.getObjectName().toString());

}
项目:lams    文件:MBeanFactory.java   
/**
 * Create a new StandardHost.
 *
 * @param parent MBean Name of the associated parent component
 * @param name Unique name of this Host
 * @param appBase Application base directory name
 * @param autoDeploy Should we auto deploy?
 * @param deployOnStartup Deploy on server startup?
 * @param deployXML Should we deploy Context XML config files property?
 * @param unpackWARs Should we unpack WARs when auto deploying?
 * @param xmlNamespaceAware Should we turn on/off XML namespace awareness?
 * @param xmlValidation Should we turn on/off XML validation?        
 *
 * @exception Exception if an MBean cannot be created or registered
 */
public String createStandardHost(String parent, String name,
                                 String appBase,
                                 boolean autoDeploy,
                                 boolean deployOnStartup,
                                 boolean deployXML,                                       
                                 boolean unpackWARs,
                                 boolean xmlNamespaceAware,
                                 boolean xmlValidation)
    throws Exception {

    // Create a new StandardHost instance
    StandardHost host = new StandardHost();
    host.setName(name);
    host.setAppBase(appBase);
    host.setAutoDeploy(autoDeploy);
    host.setDeployOnStartup(deployOnStartup);
    host.setDeployXML(deployXML);
    host.setUnpackWARs(unpackWARs);
    host.setXmlNamespaceAware(xmlNamespaceAware);
    host.setXmlValidation(xmlValidation);

    // add HostConfig for active reloading
    HostConfig hostConfig = new HostConfig();
    host.addLifecycleListener(hostConfig);

    // Add the new instance to its parent component
    ObjectName pname = new ObjectName(parent);
    Service service = getService(pname);
    Engine engine = (Engine) service.getContainer();
    engine.addChild(host);

    // Return the corresponding MBean name
    return (host.getObjectName().toString());

}
项目:apache-tomcat-7.0.73-with-comment    文件:MBeanFactory.java   
/**
 * Create a new StandardHost.
 *
 * @param parent MBean Name of the associated parent component
 * @param name Unique name of this Host
 * @param appBase Application base directory name
 * @param autoDeploy Should we auto deploy?
 * @param deployOnStartup Deploy on server startup?
 * @param deployXML Should we deploy Context XML config files property?
 * @param unpackWARs Should we unpack WARs when auto deploying?
 *
 * @exception Exception if an MBean cannot be created or registered
 */
public String createStandardHost(String parent, String name,
                                 String appBase,
                                 boolean autoDeploy,
                                 boolean deployOnStartup,
                                 boolean deployXML,                                       
                                 boolean unpackWARs)
    throws Exception {

    // Create a new StandardHost instance
    StandardHost host = new StandardHost();
    host.setName(name);
    host.setAppBase(appBase);
    host.setAutoDeploy(autoDeploy);
    host.setDeployOnStartup(deployOnStartup);
    host.setDeployXML(deployXML);
    host.setUnpackWARs(unpackWARs);

    // add HostConfig for active reloading
    HostConfig hostConfig = new HostConfig();
    host.addLifecycleListener(hostConfig);

    // Add the new instance to its parent component
    ObjectName pname = new ObjectName(parent);
    Service service = getService(pname);
    Engine engine = (Engine) service.getContainer();
    engine.addChild(host);

    // Return the corresponding MBean name
    return (host.getObjectName().toString());

}
项目:lazycat    文件:MBeanFactory.java   
/**
 * Create a new StandardHost.
 *
 * @param parent
 *            MBean Name of the associated parent component
 * @param name
 *            Unique name of this Host
 * @param appBase
 *            Application base directory name
 * @param autoDeploy
 *            Should we auto deploy?
 * @param deployOnStartup
 *            Deploy on server startup?
 * @param deployXML
 *            Should we deploy Context XML config files property?
 * @param unpackWARs
 *            Should we unpack WARs when auto deploying?
 *
 * @exception Exception
 *                if an MBean cannot be created or registered
 */
public String createStandardHost(String parent, String name, String appBase, boolean autoDeploy,
        boolean deployOnStartup, boolean deployXML, boolean unpackWARs) throws Exception {

    // Create a new StandardHost instance
    StandardHost host = new StandardHost();
    host.setName(name);
    host.setAppBase(appBase);
    host.setAutoDeploy(autoDeploy);
    host.setDeployOnStartup(deployOnStartup);
    host.setDeployXML(deployXML);
    host.setUnpackWARs(unpackWARs);

    // add HostConfig for active reloading
    HostConfig hostConfig = new HostConfig();
    host.addLifecycleListener(hostConfig);

    // Add the new instance to its parent component
    ObjectName pname = new ObjectName(parent);
    Service service = getService(pname);
    Engine engine = (Engine) service.getContainer();
    engine.addChild(host);

    // Return the corresponding MBean name
    return (host.getObjectName().toString());

}
项目:class-guard    文件:MBeanFactory.java   
/**
 * Create a new StandardHost.
 *
 * @param parent MBean Name of the associated parent component
 * @param name Unique name of this Host
 * @param appBase Application base directory name
 * @param autoDeploy Should we auto deploy?
 * @param deployOnStartup Deploy on server startup?
 * @param deployXML Should we deploy Context XML config files property?
 * @param unpackWARs Should we unpack WARs when auto deploying?
 *
 * @exception Exception if an MBean cannot be created or registered
 */
public String createStandardHost(String parent, String name,
                                 String appBase,
                                 boolean autoDeploy,
                                 boolean deployOnStartup,
                                 boolean deployXML,                                       
                                 boolean unpackWARs)
    throws Exception {

    // Create a new StandardHost instance
    StandardHost host = new StandardHost();
    host.setName(name);
    host.setAppBase(appBase);
    host.setAutoDeploy(autoDeploy);
    host.setDeployOnStartup(deployOnStartup);
    host.setDeployXML(deployXML);
    host.setUnpackWARs(unpackWARs);

    // add HostConfig for active reloading
    HostConfig hostConfig = new HostConfig();
    host.addLifecycleListener(hostConfig);

    // Add the new instance to its parent component
    ObjectName pname = new ObjectName(parent);
    Service service = getService(pname);
    Engine engine = (Engine) service.getContainer();
    engine.addChild(host);

    // Return the corresponding MBean name
    return (host.getObjectName().toString());

}
项目:apache-tomcat-7.0.57    文件:MBeanFactory.java   
/**
 * Create a new StandardHost.
 *
 * @param parent MBean Name of the associated parent component
 * @param name Unique name of this Host
 * @param appBase Application base directory name
 * @param autoDeploy Should we auto deploy?
 * @param deployOnStartup Deploy on server startup?
 * @param deployXML Should we deploy Context XML config files property?
 * @param unpackWARs Should we unpack WARs when auto deploying?
 *
 * @exception Exception if an MBean cannot be created or registered
 */
public String createStandardHost(String parent, String name,
                                 String appBase,
                                 boolean autoDeploy,
                                 boolean deployOnStartup,
                                 boolean deployXML,                                       
                                 boolean unpackWARs)
    throws Exception {

    // Create a new StandardHost instance
    StandardHost host = new StandardHost();
    host.setName(name);
    host.setAppBase(appBase);
    host.setAutoDeploy(autoDeploy);
    host.setDeployOnStartup(deployOnStartup);
    host.setDeployXML(deployXML);
    host.setUnpackWARs(unpackWARs);

    // add HostConfig for active reloading
    HostConfig hostConfig = new HostConfig();
    host.addLifecycleListener(hostConfig);

    // Add the new instance to its parent component
    ObjectName pname = new ObjectName(parent);
    Service service = getService(pname);
    Engine engine = (Engine) service.getContainer();
    engine.addChild(host);

    // Return the corresponding MBean name
    return (host.getObjectName().toString());

}
项目:apache-tomcat-7.0.57    文件:MBeanFactory.java   
/**
 * Create a new StandardHost.
 *
 * @param parent MBean Name of the associated parent component
 * @param name Unique name of this Host
 * @param appBase Application base directory name
 * @param autoDeploy Should we auto deploy?
 * @param deployOnStartup Deploy on server startup?
 * @param deployXML Should we deploy Context XML config files property?
 * @param unpackWARs Should we unpack WARs when auto deploying?
 *
 * @exception Exception if an MBean cannot be created or registered
 */
public String createStandardHost(String parent, String name,
                                 String appBase,
                                 boolean autoDeploy,
                                 boolean deployOnStartup,
                                 boolean deployXML,                                       
                                 boolean unpackWARs)
    throws Exception {

    // Create a new StandardHost instance
    StandardHost host = new StandardHost();
    host.setName(name);
    host.setAppBase(appBase);
    host.setAutoDeploy(autoDeploy);
    host.setDeployOnStartup(deployOnStartup);
    host.setDeployXML(deployXML);
    host.setUnpackWARs(unpackWARs);

    // add HostConfig for active reloading
    HostConfig hostConfig = new HostConfig();
    host.addLifecycleListener(hostConfig);

    // Add the new instance to its parent component
    ObjectName pname = new ObjectName(parent);
    Service service = getService(pname);
    Engine engine = (Engine) service.getContainer();
    engine.addChild(host);

    // Return the corresponding MBean name
    return (host.getObjectName().toString());

}
项目:WBSAirback    文件:MBeanFactory.java   
/**
 * Create a new StandardHost.
 *
 * @param parent MBean Name of the associated parent component
 * @param name Unique name of this Host
 * @param appBase Application base directory name
 * @param autoDeploy Should we auto deploy?
 * @param deployOnStartup Deploy on server startup?
 * @param deployXML Should we deploy Context XML config files property?
 * @param unpackWARs Should we unpack WARs when auto deploying?
 *
 * @exception Exception if an MBean cannot be created or registered
 */
public String createStandardHost(String parent, String name,
                                 String appBase,
                                 boolean autoDeploy,
                                 boolean deployOnStartup,
                                 boolean deployXML,                                       
                                 boolean unpackWARs)
    throws Exception {

    // Create a new StandardHost instance
    StandardHost host = new StandardHost();
    host.setName(name);
    host.setAppBase(appBase);
    host.setAutoDeploy(autoDeploy);
    host.setDeployOnStartup(deployOnStartup);
    host.setDeployXML(deployXML);
    host.setUnpackWARs(unpackWARs);

    // add HostConfig for active reloading
    HostConfig hostConfig = new HostConfig();
    host.addLifecycleListener(hostConfig);

    // Add the new instance to its parent component
    ObjectName pname = new ObjectName(parent);
    Service service = getService(pname);
    Engine engine = (Engine) service.getContainer();
    engine.addChild(host);

    // Return the corresponding MBean name
    return (host.getObjectName().toString());

}
项目:tomee    文件:TomEEUndeployTest.java   
@Test
public void tomcatLifecycle() throws Exception {
    container.start();
    assertEquals(0, webapps().length);
    final StandardHost standardHost = StandardHost.class.cast(TomcatHelper.getServer().findService("Tomcat").getContainer().findChild("localhost"));
    final HostConfig listener = new HostConfig(); // not done in embedded but that's the way autodeploy works in normal tomcat
    standardHost.addLifecycleListener(listener);
    createWebapp(new File(WORK_DIR, "tomee/webapps/my-webapp"));
    listener.lifecycleEvent(new LifecycleEvent(standardHost, Lifecycle.START_EVENT, standardHost));
    assertEquals(1, webapps().length);
}
项目:tomee    文件:TomcatWebAppBuilder.java   
private static boolean isReady(final HostConfig deployer) {
    if (deployer != null && HOST_CONFIG_HOST.get() != null) {
        try {
            return HOST_CONFIG_HOST.get().get(deployer) != null;
        } catch (final Exception e) {
            // no-op
        }
    }
    return false;
}
项目:tomee    文件:TomcatWebAppBuilder.java   
/**
 * Creates a new web application builder
 * instance.
 */
public TomcatWebAppBuilder() {
    SystemInstance.get().setComponent(WebAppBuilder.class, this);
    SystemInstance.get().setComponent(TomcatWebAppBuilder.class, this);
    initJEEInfo = "true".equalsIgnoreCase(SystemInstance.get().getProperty(TOMEE_INIT_J2EE_INFO, "true"));

    // TODO: re-write this bit, so this becomes part of the listener, and we register this with the mbean server.

    final StandardServer standardServer = TomcatHelper.getServer();
    globalListenerSupport = new GlobalListenerSupport(standardServer, this);

    //Getting host config listeners
    hosts = new Hosts();
    SystemInstance.get().setComponent(Hosts.class, hosts);
    for (final Service service : standardServer.findServices()) {
        if (service.getContainer() instanceof Engine) {
            final Engine engine = service.getContainer();

            // add the global router if relevant
            final URL globalRouterConf = RouterValve.serverRouterConfigurationURL();
            if (globalRouterConf != null) {
                final RouterValve routerValve = new RouterValve();
                routerValve.setConfigurationPath(globalRouterConf);
                engine.getPipeline().addValve(routerValve);
            }

            parentClassLoader = engine.getParentClassLoader();

            manageCluster(engine.getCluster());
            hosts.setDefault(engine.getDefaultHost());
            addTomEERealm(engine);

            for (final Container engineChild : engine.findChildren()) {
                if (engineChild instanceof StandardHost) {
                    final StandardHost host = (StandardHost) engineChild;
                    manageCluster(host.getCluster());
                    addTomEERealm(host);
                    host.getPipeline().addValve(new OpenEJBSecurityListener.RequestCapturer());
                    hosts.add(host);
                    for (final LifecycleListener listener : host.findLifecycleListeners()) {
                        if (listener instanceof HostConfig) {
                            final HostConfig hostConfig = (HostConfig) listener;
                            deployers.put(host.getName(), hostConfig);
                        }
                    }
                }
            }
        }
    }

    SystemInstance.get().addObserver(new ClusterObserver(clusters));

    final OpenEjbConfigurationFactory component = SystemInstance.get().getComponent(OpenEjbConfigurationFactory.class);
    ConfigurationFactory configurationFactory = ConfigurationFactory.class.isInstance(component) ?
            ConfigurationFactory.class.cast(component) : SystemInstance.get().getComponent(ConfigurationFactory.class);
    if (configurationFactory == null) {
        configurationFactory = new ConfigurationFactory();
    }
    this.configurationFactory = configurationFactory;
    deploymentLoader = new DeploymentLoader();

    servletContextHandler = new ServletContextHandler();
    setComponentsUsedByCDI();

    try { // before tomcat was using ServiceLoader or manually instantiation, now it uses SL for itself so we can be in conflict
        WebSockets.setConfigurator();
    } catch (final Throwable th) {
        // no-op: can be another API impl, normally we are ok, this is really just a safe belt
    }

    noHostCheck = !Boolean.parseBoolean(SystemInstance.get().getProperty("tomee.host.check", "true"));
}
项目:lazycat    文件:Dispatcher.java   
public void register(int port, HostConfig hostConfig) {

    }