本文整理汇总了Java中org.apache.catalina.Loader类的典型用法代码示例。如果您正苦于以下问题:Java Loader类的具体用法?Java Loader怎么用?Java Loader使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Loader类属于org.apache.catalina包,在下文中一共展示了Loader类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: createMBean
import org.apache.catalina.Loader; //导入依赖的package包/类
/**
* Create, register, and return an MBean for this
* <code>Loader</code> object.
*
* @param loader The Loader to be managed
*
* @exception Exception if an MBean cannot be created or registered
*
* @deprecated Unused. Will be removed in Tomcat 8.0.x
*/
@Deprecated
static DynamicMBean createMBean(Loader loader)
throws Exception {
String mname = createManagedName(loader);
ManagedBean managed = registry.findManagedBean(mname);
if (managed == null) {
Exception e = new Exception("ManagedBean is not found with "+mname);
throw new MBeanException(e);
}
String domain = managed.getDomain();
if (domain == null)
domain = mserver.getDefaultDomain();
DynamicMBean mbean = managed.createMBean(loader);
ObjectName oname = createObjectName(domain, loader);
if( mserver.isRegistered( oname )) {
// side effect: stop it
mserver.unregisterMBean( oname );
}
mserver.registerMBean(mbean, oname);
return (mbean);
}
示例2: destroyMBean
import org.apache.catalina.Loader; //导入依赖的package包/类
/**
* Deregister the MBean for this
* <code>Loader</code> object.
*
* @param loader The Loader 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(Loader loader)
throws Exception {
String mname = createManagedName(loader);
ManagedBean managed = registry.findManagedBean(mname);
if (managed == null) {
return;
}
String domain = managed.getDomain();
if (domain == null)
domain = mserver.getDefaultDomain();
ObjectName oname = createObjectName(domain, loader);
if( mserver.isRegistered(oname) )
mserver.unregisterMBean(oname);
}
示例3: createMBean
import org.apache.catalina.Loader; //导入依赖的package包/类
/**
* Create, register, and return an MBean for this
* <code>Loader</code> object.
*
* @param loader The Loader to be managed
*
* @exception Exception if an MBean cannot be created or registered
*/
static DynamicMBean createMBean(Loader loader)
throws Exception {
String mname = createManagedName(loader);
ManagedBean managed = registry.findManagedBean(mname);
if (managed == null) {
Exception e = new Exception("ManagedBean is not found with "+mname);
throw new MBeanException(e);
}
String domain = managed.getDomain();
if (domain == null)
domain = mserver.getDefaultDomain();
DynamicMBean mbean = managed.createMBean(loader);
ObjectName oname = createObjectName(domain, loader);
if( mserver.isRegistered( oname )) {
// side effect: stop it
mserver.unregisterMBean( oname );
}
mserver.registerMBean(mbean, oname);
return (mbean);
}
示例4: destroyMBean
import org.apache.catalina.Loader; //导入依赖的package包/类
/**
* Deregister the MBean for this
* <code>Loader</code> object.
*
* @param loader The Loader to be managed
*
* @exception Exception if an MBean cannot be deregistered
*/
static void destroyMBean(Loader loader)
throws Exception {
String mname = createManagedName(loader);
ManagedBean managed = registry.findManagedBean(mname);
if (managed == null) {
return;
}
String domain = managed.getDomain();
if (domain == null)
domain = mserver.getDefaultDomain();
ObjectName oname = createObjectName(domain, loader);
if( mserver.isRegistered(oname) )
mserver.unregisterMBean(oname);
}
示例5: begin
import org.apache.catalina.Loader; //导入依赖的package包/类
public void begin(Attributes attributes) throws Exception {
// Look up the required parent class loader
Container container = (Container) digester.peek();
ClassLoader parentClassLoader = container.getParentClassLoader();
// Instantiate a new Loader implementation object
String className = loaderClass;
if (attributeName != null) {
String value = attributes.getValue(attributeName);
if (value != null)
className = value;
}
Class clazz = Class.forName(className);
Class types[] = { ClassLoader.class };
Object args[] = { parentClassLoader };
Constructor constructor = clazz.getDeclaredConstructor(types);
Loader loader = (Loader) constructor.newInstance(args);
// Push the new loader onto the stack
digester.push(loader);
if (digester.getDebug() >= 1)
digester.log("new " + loader.getClass().getName());
}
示例6: createMBean
import org.apache.catalina.Loader; //导入依赖的package包/类
/**
* Create, register, and return an MBean for this
* <code>Loader</code> object.
*
* @param loader The Loader to be managed
*
* @exception Exception if an MBean cannot be created or registered
*/
public static ModelMBean createMBean(Loader loader)
throws Exception {
String mname = createManagedName(loader);
ManagedBean managed = registry.findManagedBean(mname);
if (managed == null) {
Exception e = new Exception("ManagedBean is not found with "+mname);
throw new MBeanException(e);
}
String domain = managed.getDomain();
if (domain == null)
domain = mserver.getDefaultDomain();
ModelMBean mbean = managed.createMBean(loader);
ObjectName oname = createObjectName(domain, loader);
mserver.registerMBean(mbean, oname);
return (mbean);
}
示例7: destroyMBean
import org.apache.catalina.Loader; //导入依赖的package包/类
/**
* Deregister the MBean for this
* <code>Loader</code> object.
*
* @param loader The Loader to be managed
*
* @exception Exception if an MBean cannot be deregistered
*/
public static void destroyMBean(Loader loader)
throws Exception {
String mname = createManagedName(loader);
ManagedBean managed = registry.findManagedBean(mname);
if (managed == null) {
return;
}
String domain = managed.getDomain();
if (domain == null)
domain = mserver.getDefaultDomain();
ObjectName oname = createObjectName(domain, loader);
mserver.unregisterMBean(oname);
}
示例8: isDefaultLoader
import org.apache.catalina.Loader; //导入依赖的package包/类
/**
* Is this an instance of the default <code>Loader</code> configuration,
* with all-default properties?
*
* @param loader Loader to be tested
*/
private boolean isDefaultLoader(Loader loader) {
if (!(loader instanceof WebappLoader)) {
return (false);
}
WebappLoader wloader = (WebappLoader) loader;
if ((wloader.getCheckInterval() != 15) ||
(wloader.getDebug() != 0) ||
(wloader.getDelegate() != false) ||
!wloader.getLoaderClass().equals
("org.apache.catalina.loader.WebappClassLoader")) {
return (false);
}
return (true);
}
示例9: initializeSerializer
import org.apache.catalina.Loader; //导入依赖的package包/类
private void initializeSerializer() throws ClassNotFoundException, IllegalAccessException, InstantiationException {
log.info("Attempting to use serializer :" + serializationStrategyClass);
serializer = (Serializer) Class.forName(serializationStrategyClass).newInstance();
Loader loader = null;
/* 默认支持tomcat7.x
if (getContainer() != null) {
loader = getContainer().getLoader();
}
*/
// 修改为支持tomcat8.x
Context context = this.getContext();
if (context != null) {
loader = context.getLoader();
}
ClassLoader classLoader = null;
if (loader != null) {
classLoader = loader.getClassLoader();
}
serializer.setClassLoader(classLoader);
}
示例10: initializeSerializer
import org.apache.catalina.Loader; //导入依赖的package包/类
void initializeSerializer() throws ReflectiveOperationException {
log.info("Attempting to use serializer :" + serializationStrategyClass);
serializer = (Serializer) Class.forName(serializationStrategyClass).newInstance();
Loader loader = null;
if (getContext() != null) {
loader = getContext().getLoader();
}
ClassLoader classLoader = null;
if (loader != null) {
classLoader = loader.getClassLoader();
}
serializer.setClassLoader(classLoader);
}
示例11: createMBean
import org.apache.catalina.Loader; //导入依赖的package包/类
/**
* Create, register, and return an MBean for this <code>Loader</code>
* object.
*
* @param loader
* The Loader to be managed
*
* @exception Exception
* if an MBean cannot be created or registered
*
* @deprecated Unused. Will be removed in Tomcat 8.0.x
*/
@Deprecated
static DynamicMBean createMBean(Loader loader) throws Exception {
String mname = createManagedName(loader);
ManagedBean managed = registry.findManagedBean(mname);
if (managed == null) {
Exception e = new Exception("ManagedBean is not found with " + mname);
throw new MBeanException(e);
}
String domain = managed.getDomain();
if (domain == null)
domain = mserver.getDefaultDomain();
DynamicMBean mbean = managed.createMBean(loader);
ObjectName oname = createObjectName(domain, loader);
if (mserver.isRegistered(oname)) {
// side effect: stop it
mserver.unregisterMBean(oname);
}
mserver.registerMBean(mbean, oname);
return (mbean);
}
示例12: destroyMBean
import org.apache.catalina.Loader; //导入依赖的package包/类
/**
* Deregister the MBean for this <code>Loader</code> object.
*
* @param loader
* The Loader 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(Loader loader) throws Exception {
String mname = createManagedName(loader);
ManagedBean managed = registry.findManagedBean(mname);
if (managed == null) {
return;
}
String domain = managed.getDomain();
if (domain == null)
domain = mserver.getDefaultDomain();
ObjectName oname = createObjectName(domain, loader);
if (mserver.isRegistered(oname))
mserver.unregisterMBean(oname);
}
示例13: initializeSerializer
import org.apache.catalina.Loader; //导入依赖的package包/类
private void initializeSerializer() throws ClassNotFoundException, IllegalAccessException, InstantiationException {
log.info("Attempting to use serializer :" + serializationStrategyClass);
serializer = (Serializer) Class.forName(serializationStrategyClass).newInstance();
Loader loader = null;
Context context = this.getContext();
if (context != null) {
loader = context.getLoader();
}
/*
* if (getContainer() != null) {
loader = getContainer().getLoader();
}*/
ClassLoader classLoader = null;
if (loader != null) {
classLoader = loader.getClassLoader();
}
serializer.setClassLoader(classLoader);
}
示例14: initializeSerializer
import org.apache.catalina.Loader; //导入依赖的package包/类
/**
* 初始化序列化
* @throws ClassNotFoundException
* @throws IllegalAccessException
* @throws InstantiationException
*/
private void initializeSerializer() throws ClassNotFoundException, IllegalAccessException, InstantiationException {
log.info("Attempting to use serializer :" + serializationStrategyClass);
serializer = (Serializer) Class.forName(serializationStrategyClass).newInstance();
Loader loader = null;
if (getContainer() != null) {
loader = getContainer().getLoader();
}
ClassLoader classLoader = null;
if (loader != null) {
classLoader = loader.getClassLoader();
}
serializer.setClassLoader(classLoader);
}
示例15: createObjectName
import org.apache.catalina.Loader; //导入依赖的package包/类
/**
* Create an <code>ObjectName</code> for this
* <code>Loader</code> object.
*
* @param domain Domain in which this name is to be created
* @param loader The Loader to be named
*
* @exception MalformedObjectNameException if a name cannot be created
*/
static ObjectName createObjectName(String domain,
Loader loader)
throws MalformedObjectNameException {
ObjectName name = null;
Container container = loader.getContainer();
if (container instanceof Engine) {
name = new ObjectName(domain + ":type=Loader");
} else if (container instanceof Host) {
name = new ObjectName(domain + ":type=Loader,host=" +
container.getName());
} else if (container instanceof Context) {
Context context = ((Context)container);
ContextName cn = new ContextName(context.getName(), false);
Container host = context.getParent();
name = new ObjectName(domain + ":type=Loader,context=" +
cn.getDisplayName() + ",host=" + host.getName());
}
return (name);
}