String type = pname.getKeyProperty("type");
Server server = ServerFactory.getServer();
Service service = server.findService(pname.getKeyProperty("service"));
Engine engine = (Engine) service.getContainer();
if (type.equals("Context")) {
Host host = (Host) engine.findChild(pname.getKeyProperty("host"));
String pathStr = getPathStr(pname.getKeyProperty("path"));
Context context = (Context) host.findChild(pathStr);
((StandardContext)context).addValve(valve);
} else if (type.equals("Engine")) {
((StandardEngine)engine).addValve(valve);
} else if (type.equals("Host")) {
Host host = (Host) engine.findChild(pname.getKeyProperty("host"));
((StandardHost)host).addValve(valve);
}
// Return the corresponding MBean name
ManagedBean managed = registry.findManagedBean("RequestDumperValve");