當前位置: 首頁>>代碼示例>>Java>>正文


Java Container類代碼示例

本文整理匯總了Java中org.apache.catalina.Container的典型用法代碼示例。如果您正苦於以下問題:Java Container類的具體用法?Java Container怎麽用?Java Container使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


Container類屬於org.apache.catalina包,在下文中一共展示了Container類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: destroyMBean

import org.apache.catalina.Container; //導入依賴的package包/類
/**
 * Deregister the MBean for this
 * <code>Valve</code> object.
 *
 * @param valve The Valve to be managed
 *
 * @exception Exception if an MBean cannot be deregistered
 */
public static void destroyMBean(Valve valve, Container container)
    throws Exception {

    ((Contained)valve).setContainer(container);
    String mname = createManagedName(valve);
    ManagedBean managed = registry.findManagedBean(mname);
    if (managed == null) {
        return;
    }
    String domain = managed.getDomain();
    if (domain == null)
        domain = mserver.getDefaultDomain();
    ObjectName oname = createObjectName(domain, valve);
    try {
        ((Contained)valve).setContainer(null);
    } catch (Throwable t) {
    ;
    }
    mserver.unregisterMBean(oname);

}
 
開發者ID:c-rainstorm,項目名稱:jerrydog,代碼行數:30,代碼來源:MBeanUtils.java

示例2: getServer

import org.apache.catalina.Container; //導入依賴的package包/類
/**
 * Return the Server object that is the ultimate parent for the container
 * with which this Realm is associated. If the server cannot be found (eg
 * because the container hierarchy is not complete), <code>null</code> is
 * returned.
 */
protected Server getServer() {
    Container c = container;
    if (c instanceof Context) {
        c = c.getParent();
    }
    if (c instanceof Host) {
        c = c.getParent();
    }
    if (c instanceof Engine) {
        Service s = ((Engine)c).getService();
        if (s != null) {
            return s.getServer();
        }
    }
    return null;
}
 
開發者ID:sunmingshuai,項目名稱:apache-tomcat-7.0.73-with-comment,代碼行數:23,代碼來源:RealmBase.java

示例3: setContainer

import org.apache.catalina.Container; //導入依賴的package包/類
/**
 * Set the Container with which this Logger has been associated.
 *
 * @param container The associated Container
 */
@Override
public void setContainer(Container container) {

    // Deregister from the old Container (if any)
    if ((this.container != null) && (this.container instanceof Context))
        ((Context) this.container).removePropertyChangeListener(this);

    // Process this property change
    Container oldContainer = this.container;
    this.container = container;
    support.firePropertyChange("container", oldContainer, this.container);

    // Register with the new Container (if any)
    if ((this.container != null) && (this.container instanceof Context)) {
        setReloadable( ((Context) this.container).getReloadable() );
        ((Context) this.container).addPropertyChangeListener(this);
    }

}
 
開發者ID:liaokailin,項目名稱:tomcat7,代碼行數:25,代碼來源:WebappLoader.java

示例4: getName

import org.apache.catalina.Container; //導入依賴的package包/類
/**
 * @return the name for this instance (built from container name)
 */
public String getName() {
	if (name == null) {
		Container container = manager.getContainer();
		String contextName = container.getName();
		if (!contextName.startsWith("/")) {
			contextName = "/" + contextName;
		}
		String hostName = "";
		String engineName = "";

		if (container.getParent() != null) {
			Container host = container.getParent();
			hostName = host.getName();
			if (host.getParent() != null) {
				engineName = host.getParent().getName();
			}
		}
		name = "/" + engineName + "/" + hostName + contextName;
	}
	return name;
}
 
開發者ID:how2j,項目名稱:lazycat,代碼行數:25,代碼來源:JDBCStore.java

示例5: processContainerAddValve

import org.apache.catalina.Container; //導入依賴的package包/類
/**
 * Process the addition of a new Valve to a Container.
 *
 * @param container The affected Container
 * @param valve The new Valve
 */
protected void processContainerAddValve(Container container,
                                        Valve valve)
    throws Exception {

    if (debug >= 1) {
        log("Process addValve[container=" + container + ",valve=" +
            valve + "]");
    }

    if (debug >= 4) {
        log("Creating MBean for Valve " + valve);
    }
    MBeanUtils.createMBean(valve);

}
 
開發者ID:c-rainstorm,項目名稱:jerrydog,代碼行數:22,代碼來源:ServerLifecycleListener.java

示例6: begin

import org.apache.catalina.Container; //導入依賴的package包/類
/**
 * Handle the beginning of an XML element.
 *
 * @param attributes The attributes of this element
 *
 * @exception Exception if a processing error occurs
 */
@Override
public void begin(String namespace, String name, Attributes attributes)
    throws Exception {

    if (digester.getLogger().isDebugEnabled())
        digester.getLogger().debug("Copying parent class loader");
    Container child = (Container) digester.peek(0);
    Object parent = digester.peek(1);
    Method method =
        parent.getClass().getMethod("getParentClassLoader", new Class[0]);
    ClassLoader classLoader =
        (ClassLoader) method.invoke(parent, new Object[0]);
    child.setParentClassLoader(classLoader);

}
 
開發者ID:liaokailin,項目名稱:tomcat7,代碼行數:23,代碼來源:CopyParentClassLoaderRule.java

示例7: containerEvent

import org.apache.catalina.Container; //導入依賴的package包/類
/**
 * Handle a <code>ContainerEvent</code> from one of the Containers we are
 * interested in.
 *
 * @param event The event that has occurred
 */
public void containerEvent(ContainerEvent event) {

    try {
        String type = event.getType();
        if (Container.ADD_CHILD_EVENT.equals(type)) {
            processContainerAddChild(event.getContainer(),
                                     (Container) event.getData());
        } else if (Container.ADD_VALVE_EVENT.equals(type)) {
            processContainerAddValve(event.getContainer(),
                                     (Valve) event.getData());
        } else if (Container.REMOVE_CHILD_EVENT.equals(type)) {
            processContainerRemoveChild(event.getContainer(),
                                        (Container) event.getData());
        } else if (Container.REMOVE_VALVE_EVENT.equals(type)) {
            processContainerRemoveValve(event.getContainer(),
                                        (Valve) event.getData());
        }
    } catch (Exception e) {
        log("Exception processing event " + event, e);
    }

}
 
開發者ID:c-rainstorm,項目名稱:jerrydog,代碼行數:29,代碼來源:ServerLifecycleListener.java

示例8: getName

import org.apache.catalina.Container; //導入依賴的package包/類
/**
 * @return the name for this instance (built from container name)
 */
public String getName() {
    if (name == null) {
        Container container = manager.getContainer();
        String contextName = container.getName();
        if (!contextName.startsWith("/")) {
            contextName = "/" + contextName;
        }
        String hostName = "";
        String engineName = "";

        if (container.getParent() != null) {
            Container host = container.getParent();
            hostName = host.getName();
            if (host.getParent() != null) {
                engineName = host.getParent().getName();
            }
        }
        name = "/" + engineName + "/" + hostName + contextName;
    }
    return name;
}
 
開發者ID:sunmingshuai,項目名稱:apache-tomcat-7.0.73-with-comment,代碼行數:25,代碼來源:JDBCStore.java

示例9: destroyMBean

import org.apache.catalina.Container; //導入依賴的package包/類
/**
 * Deregister the MBean for this
 * <code>Valve</code> object.
 *
 * @param valve The Valve to be managed
 *
 * @exception Exception if an MBean cannot be deregistered
 * @deprecated  Unused. Will be removed in Tomcat 8.0.x
 */
@Deprecated
static void destroyMBean(Valve valve, Container container)
    throws Exception {

    ((Contained)valve).setContainer(container);
    String mname = createManagedName(valve);
    ManagedBean managed = registry.findManagedBean(mname);
    if (managed == null) {
        return;
    }
    String domain = managed.getDomain();
    if (domain == null)
        domain = mserver.getDefaultDomain();
    ObjectName oname = createObjectName(domain, valve);
    try {
        ((Contained)valve).setContainer(null);
    } catch (Throwable t) {
        ExceptionUtils.handleThrowable(t);
    }
    if( mserver.isRegistered(oname) ) {
        mserver.unregisterMBean(oname);
    }

}
 
開發者ID:sunmingshuai,項目名稱:apache-tomcat-7.0.73-with-comment,代碼行數:34,代碼來源:MBeanUtils.java

示例10: setContainer

import org.apache.catalina.Container; //導入依賴的package包/類
@Override
public void setContainer(Container container) {
	super.setContainer(container);

	if (appName == null) {
		String name = container.getName();
		if (!name.startsWith("/")) {
			name = "/" + name;
		}
		name = makeLegalForJAAS(name);

		appName = name;

		log.info("Set JAAS app name " + appName);
	}
}
 
開發者ID:how2j,項目名稱:lazycat,代碼行數:17,代碼來源:JAASRealm.java

示例11: createValve

import org.apache.catalina.Container; //導入依賴的package包/類
/**
 * Create a new Valve and associate it with a {@link Container}.
 *
 * @param className The fully qualified class name of the {@link Valve} to
 *                  create
 * @param parent    The MBean name of the associated parent
 *                  {@link Container}.
 *
 * @return  The MBean name of the {@link Valve} that was created or
 *          <code>null</code> if the {@link Valve} does not implement
 *          {@link LifecycleMBeanBase}.
 */
public String createValve(String className, String parent)
        throws Exception {

    // Look for the parent
    ObjectName parentName = new ObjectName(parent);
    Container container = getParentContainerFromParent(parentName);

    if (container == null) {
        // TODO
        throw new IllegalArgumentException();
    }

    Valve valve = (Valve) Class.forName(className).newInstance();

    container.getPipeline().addValve(valve);

    if (valve instanceof LifecycleMBeanBase) {
        return ((LifecycleMBeanBase) valve).getObjectName().toString();
    } else {
        return null;
    }
}
 
開發者ID:sunmingshuai,項目名稱:apache-tomcat-7.0.73-with-comment,代碼行數:35,代碼來源:MBeanFactory.java

示例12: startInternal

import org.apache.catalina.Container; //導入依賴的package包/類
@Override
public void startInternal() throws LifecycleException {

    setState(LifecycleState.STARTING);

    // Find any components that have already been initialized since the
    // MBean listener won't be notified as those components will have
    // already registered their MBeans
    findDefaultHost();

    Engine engine = (Engine) connector.getService().getContainer();
    addListeners(engine);

    Container[] conHosts = engine.findChildren();
    for (Container conHost : conHosts) {
        Host host = (Host) conHost;
        if (!LifecycleState.NEW.equals(host.getState())) {
            // Registering the host will register the context and wrappers
            registerHost(host);
        }
    }
}
 
開發者ID:liaokailin,項目名稱:tomcat7,代碼行數:23,代碼來源:MapperListener.java

示例13: getConfigBaseFile

import org.apache.catalina.Container; //導入依賴的package包/類
private static File getConfigBaseFile(Host host) {
    String path = null;
    if (host.getXmlBase() != null) {
        path = host.getXmlBase();
    } else {
        StringBuilder xmlDir = new StringBuilder("conf");
        Container parent = host.getParent();
        if (parent instanceof Engine) {
            xmlDir.append('/');
            xmlDir.append(parent.getName());
        }
        xmlDir.append('/');
        xmlDir.append(host.getName());
        path = xmlDir.toString();
    }
    
    return getCanonicalPath(path);
}
 
開發者ID:sunmingshuai,項目名稱:apache-tomcat-7.0.73-with-comment,代碼行數:19,代碼來源:TestHostConfigAutomaticDeployment.java

示例14: getDomain

import org.apache.catalina.Container; //導入依賴的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:liaokailin,項目名稱:tomcat7,代碼行數:36,代碼來源:MBeanUtils.java

示例15: registerHost

import org.apache.catalina.Container; //導入依賴的package包/類
/**
 * Register host.
 */
private void registerHost(Host host) {

    String[] aliases = host.findAliases();
    mapper.addHost(host.getName(), aliases, host);

    for (Container container : host.findChildren()) {
        if (container.getState().isAvailable()) {
            registerContext((Context) container);
        }
    }
    if(log.isDebugEnabled()) {
        log.debug(sm.getString("mapperListener.registerHost",
                host.getName(), domain, connector));
    }
}
 
開發者ID:sunmingshuai,項目名稱:apache-tomcat-7.0.73-with-comment,代碼行數:19,代碼來源:MapperListener.java


注:本文中的org.apache.catalina.Container類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。