use of org.apache.catalina.util.LifecycleMBeanBase in project tomcat70 by apache.
the class MBeanFactory method createValve.
/**
* 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;
}
}
Aggregations