()
| 406 | |
| 407 | |
| 408 | @Override |
| 409 | public void init() throws ServletException { |
| 410 | |
| 411 | // Ensure that our ContainerServlet properties have been set |
| 412 | if (wrapper == null || context == null) { |
| 413 | throw new UnavailableException(sm.getString("managerServlet.noWrapper")); |
| 414 | } |
| 415 | |
| 416 | // Set our properties from the initialization parameters |
| 417 | String value = getServletConfig().getInitParameter("debug"); |
| 418 | if (value != null) { |
| 419 | try { |
| 420 | debug = Integer.parseInt(value); |
| 421 | } catch (NumberFormatException e) { |
| 422 | // Ignore |
| 423 | debug = 0; |
| 424 | } |
| 425 | } |
| 426 | |
| 427 | // Acquire global JNDI resources if available |
| 428 | Service service = Container.getService(host); |
| 429 | if (service != null) { |
| 430 | Server server = service.getServer(); |
| 431 | if (server != null) { |
| 432 | global = server.getGlobalNamingContext(); |
| 433 | } |
| 434 | } |
| 435 | |
| 436 | // Calculate the directory into which we will be deploying applications |
| 437 | versioned = (File) getServletContext().getAttribute(ServletContext.TEMPDIR); |
| 438 | |
| 439 | configBase = new File(context.getCatalinaBase(), "conf"); |
| 440 | Container container = context; |
| 441 | Container host = null; |
| 442 | Container engine = null; |
| 443 | while (container != null) { |
| 444 | if (container instanceof Host) { |
| 445 | host = container; |
| 446 | } |
| 447 | if (container instanceof Engine) { |
| 448 | engine = container; |
| 449 | } |
| 450 | container = container.getParent(); |
| 451 | } |
| 452 | if (engine != null) { |
| 453 | configBase = new File(configBase, engine.getName()); |
| 454 | } |
| 455 | if (host != null) { |
| 456 | configBase = new File(configBase, host.getName()); |
| 457 | } |
| 458 | // Note: The directory must exist for this to work. |
| 459 | |
| 460 | // Log debugging messages as necessary |
| 461 | if (debug >= 1) { |
| 462 | log("init: Associated with Deployer '" + oname + "'"); |
| 463 | if (global != null) { |
| 464 | log("init: Global resources are available"); |
| 465 | } |
nothing calls this directly
no test coverage detected