ObjectName oname = new ObjectName(name);
String type = oname.getKeyProperty("type");
String serviceName = oname.getKeyProperty("service");
Server server = ServerFactory.getServer();
Service service = server.findService(serviceName);
Engine engine = (Engine) service.getContainer();
String hostName = oname.getKeyProperty("host");
if ((type != null) && (type.equals("Manager"))) {
String contextName = getPathStr(oname.getKeyProperty("path"));
Host host = (Host) engine.findChild(hostName);
Context context = (Context) host.findChild(contextName);
// Remove this component from its parent component
context.setManager(null);
} else if ((type != null) && (type.equals("DefaultManager"))) {
DefaultContext defaultContext = null;
if (hostName == null) {
defaultContext = engine.getDefaultContext();
} else {
Host host = (Host) engine.findChild(hostName);
defaultContext = host.getDefaultContext();
}
if (defaultContext != null) {
// Remove this component from its parent component
defaultContext.setManager(null);