} else if (container instanceof Context) {
String path = ((Context)container).getPath();
if (path.length() < 1)
path = "/";
Host host = (Host) ((Context)container).getParent();
Engine engine = (Engine) host.getParent();
Service service = engine.getService();
name = new ObjectName(domain + ":type=Resource" +
",resourcetype=Context,path=" + path +
",host=" + host.getName() +
",service=" + service.getName() +
",class=" + resource.getType() +
",name=" + encodedResourceName);
} else if (container instanceof DefaultContext) {
container = ((DefaultContext)container).getParent();
if (container instanceof Host) {
Host host = (Host) container;
Service service = ((Engine)host.getParent()).getService();
name = new ObjectName(domain + ":type=Resource" +
",resourcetype=HostDefaultContext,host=" + host.getName() +
",service=" + service.getName() +
",class=" + resource.getType() +
",name=" + encodedResourceName);
} else if (container instanceof Engine) {
Engine engine = (Engine) container;
Service service = engine.getService();
name = new ObjectName(domain + ":type=Resource" +
",resourcetype=ServiceDefaultContext,service=" + service.getName() +
",class=" + resource.getType() +
",name=" + encodedResourceName);
}