当前位置: 首页>>代码示例>>Java>>正文


Java Service.getContainer方法代码示例

本文整理汇总了Java中org.apache.catalina.Service.getContainer方法的典型用法代码示例。如果您正苦于以下问题:Java Service.getContainer方法的具体用法?Java Service.getContainer怎么用?Java Service.getContainer使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.apache.catalina.Service的用法示例。


在下文中一共展示了Service.getContainer方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: getDomain

import org.apache.catalina.Service; //导入方法依赖的package包/类
/**
 * Determine the name of the domain to register MBeans for from a given
 * Service.
 * 
 * @param service
 *
 * @deprecated To be removed since to creates a circular dependency. Will be
 *             replaced in Tomcat 8 by a new method on {@link Service}.
 */
@Deprecated
public static String getDomain(Service service) {

	// Null service -> return null
	if (service == null) {
		return null;
	}

	String domain = null;

	Container engine = service.getContainer();

	// Use the engine name first
	if (engine != null) {
		domain = engine.getName();
	}

	// No engine or no engine name, use the service name
	if (domain == null) {
		domain = service.getName();
	}

	// No service name, use null
	return domain;
}
 
开发者ID:how2j,项目名称:lazycat,代码行数:35,代码来源:MBeanUtils.java

示例2: createMBeans

import org.apache.catalina.Service; //导入方法依赖的package包/类
/**
 * Create the MBeans for the specified Service and its nested components.
 *
 * @param service Service for which to create MBeans
 *
 * @exception Exception if an exception is thrown during MBean creation
 */
protected void createMBeans(Service service) throws Exception {

    // Create the MBean for the Service itself
    if (log.isDebugEnabled())
        log.debug("Creating MBean for Service " + service);
    //MBeanUtils.createMBean(service);
    if (service instanceof StandardService) {
        ((StandardService) service).addPropertyChangeListener(this);
    }

    // Create the MBeans for the corresponding Connectors
    Connector connectors[] = service.findConnectors();
    for (int j = 0; j < connectors.length; j++) {
        createMBeans(connectors[j]);
    }

    // Create the MBean for the associated Engine and friends
    Engine engine = (Engine) service.getContainer();
    if (engine != null) {
        createMBeans(engine);
    }

}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:31,代码来源:ServerLifecycleListener.java

示例3: destroyMBeans

import org.apache.catalina.Service; //导入方法依赖的package包/类
/**
     * Deregister the MBeans for the specified Service and its nested
     * components.
     *
     * @param service Service for which to destroy MBeans
     *
     * @exception Exception if an exception is thrown during MBean destruction
     */
    protected void destroyMBeans(Service service) throws Exception {

        // Deregister the MBeans for the associated Engine
        Engine engine = (Engine) service.getContainer();
        if (engine != null) {
            //destroyMBeans(engine);
        }

//        // Deregister the MBeans for the corresponding Connectors
//        Connector connectors[] = service.findConnectors();
//        for (int j = 0; j < connectors.length; j++) {
//            destroyMBeans(connectors[j], service);
//        }

        // Deregister the MBean for the Service itself
        if (log.isDebugEnabled()) {
            log.debug("Destroying MBean for Service " + service);
        }
        //MBeanUtils.destroyMBean(service);
        if (service instanceof StandardService) {
            ((StandardService) service).removePropertyChangeListener(this);
        }

    }
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:33,代码来源:ServerLifecycleListener.java

示例4: removeHost

import org.apache.catalina.Service; //导入方法依赖的package包/类
/**
 * Remove an existing Host.
 *
 * @param name MBean Name of the comonent to remove
 *
 * @exception Exception if a component cannot be removed
 */
public void removeHost(String name) throws Exception {

    // Acquire a reference to the component to be removed
    ObjectName oname = new ObjectName(name);
    String hostName = oname.getKeyProperty("host");
    Service service = getService(oname);
    Engine engine = (Engine) service.getContainer();
    Host host = (Host) engine.findChild(hostName);

    // Remove this component from its parent component
    if(host!=null) {
        if(host instanceof StandardHost)
            ((StandardHost)host).destroy();
        else
            engine.removeChild(host);
    }

}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:26,代码来源:MBeanFactory.java

示例5: createMBeans

import org.apache.catalina.Service; //导入方法依赖的package包/类
/**
 * Create the MBeans for the specified Service and its nested components.
 *
 * @param service Service for which to create MBeans
 *
 * @exception Exception if an exception is thrown during MBean creation
 */
protected void createMBeans(Service service) throws Exception {

    // Create the MBean for the Service itself
    if (debug >= 2)
        log("Creating MBean for Service " + service);
    MBeanUtils.createMBean(service);
    if (service instanceof StandardService) {
        ((StandardService) service).addPropertyChangeListener(this);
    }

    // Create the MBeans for the corresponding Connectors
    Connector connectors[] = service.findConnectors();
    for (int j = 0; j < connectors.length; j++) {
        createMBeans(connectors[j]);
    }

    // Create the MBean for the associated Engine and friends
    Engine engine = (Engine) service.getContainer();
    if (engine != null) {
        createMBeans(engine);
    }

}
 
开发者ID:c-rainstorm,项目名称:jerrydog,代码行数:31,代码来源:ServerLifecycleListener.java

示例6: getDomain

import org.apache.catalina.Service; //导入方法依赖的package包/类
/**
 * Determine the name of the domain to register MBeans for from a given
 * Service.
 * 
 * @param service 
 *
 * @deprecated  To be removed since to creates a circular dependency. Will
 *              be replaced in Tomcat 8 by a new method on {@link
 *              Service}.
 */
@Deprecated
public static String getDomain(Service service) {
    
    // Null service -> return null
    if (service == null) {
        return null;
    }
    
    String domain = null;
    
    Container engine = service.getContainer();
    
    // Use the engine name first
    if (engine != null) {
        domain = engine.getName();
    }
    
    // No engine or no engine name, use the service name 
    if (domain == null) {
        domain = service.getName();
    }
    
    // No service name, use null
    return domain;
}
 
开发者ID:sunmingshuai,项目名称:apache-tomcat-7.0.73-with-comment,代码行数:36,代码来源:MBeanUtils.java

示例7: removeHost

import org.apache.catalina.Service; //导入方法依赖的package包/类
/**
 * Remove an existing Host.
 *
 * @param name MBean Name of the comonent to remove
 *
 * @exception Exception if a component cannot be removed
 */
public void removeHost(String name) throws Exception {

    // Acquire a reference to the component to be removed
    ObjectName oname = new ObjectName(name);
    String serviceName = oname.getKeyProperty("service");
    String hostName = oname.getKeyProperty("host");
    Server server = ServerFactory.getServer();
    Service service = server.findService(serviceName);
    Engine engine = (Engine) service.getContainer();
    Host host = (Host) engine.findChild(hostName);

    // Remove this component from its parent component
    engine.removeChild(host);

}
 
开发者ID:c-rainstorm,项目名称:jerrydog,代码行数:23,代码来源:MBeanFactory.java

示例8: createStandardHost

import org.apache.catalina.Service; //导入方法依赖的package包/类
/**
 * 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());

}
 
开发者ID:liaokailin,项目名称:tomcat7,代码行数:45,代码来源:MBeanFactory.java

示例9: removeHost

import org.apache.catalina.Service; //导入方法依赖的package包/类
/**
 * Remove an existing Host.
 *
 * @param name MBean Name of the component to remove
 *
 * @exception Exception if a component cannot be removed
 */
public void removeHost(String name) throws Exception {

    // Acquire a reference to the component to be removed
    ObjectName oname = new ObjectName(name);
    String hostName = oname.getKeyProperty("host");
    Service service = getService(oname);
    Engine engine = (Engine) service.getContainer();
    Host host = (Host) engine.findChild(hostName);

    // Remove this component from its parent component
    if(host!=null) {
        engine.removeChild(host);
    }
}
 
开发者ID:liaokailin,项目名称:tomcat7,代码行数:22,代码来源:MBeanFactory.java

示例10: registerListenersForServer

import org.apache.catalina.Service; //导入方法依赖的package包/类
private void registerListenersForServer(Server server) {
    for (Service service : server.findServices()) {
        Engine engine = (Engine) service.getContainer();
        engine.addContainerListener(this);
        registerListenersForEngine(engine);
    }

}
 
开发者ID:liaokailin,项目名称:tomcat7,代码行数:9,代码来源:ThreadLocalLeakPreventionListener.java

示例11: createStandardHost

import org.apache.catalina.Service; //导入方法依赖的package包/类
/**
 * 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());

}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:51,代码来源:MBeanFactory.java

示例12: createDefaultContext

import org.apache.catalina.Service; //导入方法依赖的package包/类
/**
 * Create a new DefaultContext.
 *
 * @param parent MBean Name of the associated parent component
 *
 * @exception Exception if an MBean cannot be created or registered
 */
public String createDefaultContext(String parent)
    throws Exception {

    // Create a new StandardDefaultContext instance
    StandardDefaultContext context = new StandardDefaultContext();

    // Add the new instance to its parent component
    ObjectName pname = new ObjectName(parent);
    String type = pname.getKeyProperty("type");
    Server server = ServerFactory.getServer();
    String serviceName = pname.getKeyProperty("service");
    if (serviceName == null) {
        serviceName = pname.getKeyProperty("name");
    }
    Service service = server.findService(serviceName);
    Engine engine = (Engine) service.getContainer();
    String hostName = pname.getKeyProperty("host");
    if (hostName == null) { //if DefaultContext is nested in Engine
        context.setParent(engine);
        engine.addDefaultContext(context);
    } else {                // if DefaultContext is nested in Host
        Host host = (Host) engine.findChild(hostName);
        context.setParent(host);
        host.addDefaultContext(context);
    }

    // Return the corresponding MBean name
    ManagedBean managed = registry.findManagedBean("DefaultContext");
    ObjectName oname =
        MBeanUtils.createObjectName(managed.getDomain(), context);
    return (oname.toString());

}
 
开发者ID:c-rainstorm,项目名称:jerrydog,代码行数:41,代码来源:MBeanFactory.java

示例13: registerListenersForServer

import org.apache.catalina.Service; //导入方法依赖的package包/类
private void registerListenersForServer(Server server) {
	for (Service service : server.findServices()) {
		Engine engine = (Engine) service.getContainer();
		engine.addContainerListener(this);
		registerListenersForEngine(engine);
	}

}
 
开发者ID:how2j,项目名称:lazycat,代码行数:9,代码来源:ThreadLocalLeakPreventionListener.java

示例14: createStandardHost

import org.apache.catalina.Service; //导入方法依赖的package包/类
/**
 * 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 deployXML Should we deploy Context XML config files property?
 * @param liveDeploy Should we live deploy?
 * @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 deployXML, boolean liveDeploy,
                                 boolean unpackWARs)
    throws Exception {

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

    // Add the new instance to its parent component
    ObjectName pname = new ObjectName(parent);
    Server server = ServerFactory.getServer();
    Service service = server.findService(pname.getKeyProperty("service"));
    Engine engine = (Engine) service.getContainer();
    engine.addChild(host);

    // Return the corresponding MBean name
    ManagedBean managed = registry.findManagedBean("StandardHost");
    ObjectName oname =
        MBeanUtils.createObjectName(managed.getDomain(), host);
    return (oname.toString());

}
 
开发者ID:c-rainstorm,项目名称:jerrydog,代码行数:43,代码来源:MBeanFactory.java

示例15: createStandardHost

import org.apache.catalina.Service; //导入方法依赖的package包/类
/**
 * 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());

}
 
开发者ID:how2j,项目名称:lazycat,代码行数:48,代码来源:MBeanFactory.java


注:本文中的org.apache.catalina.Service.getContainer方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。