本文整理汇总了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);
}
示例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;
}
示例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);
}
}
示例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;
}
示例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);
}
示例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);
}
示例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);
}
}
示例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;
}
示例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);
}
}
示例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);
}
}
示例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;
}
}
示例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);
}
}
}
示例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;
}
示例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));
}
}