Deploy WAR files. @param appBase The base path for applications @param files The WARs to deploy
(File appBase, String[] files)
| 706 | * @param files The WARs to deploy |
| 707 | */ |
| 708 | protected void deployWARs(File appBase, String[] files) { |
| 709 | |
| 710 | if (files == null) { |
| 711 | return; |
| 712 | } |
| 713 | |
| 714 | ExecutorService es = host.getStartStopExecutor(); |
| 715 | List<Future<?>> results = new ArrayList<>(); |
| 716 | |
| 717 | for (String file : files) { |
| 718 | if (file.equalsIgnoreCase("META-INF")) { |
| 719 | continue; |
| 720 | } |
| 721 | if (file.equalsIgnoreCase("WEB-INF")) { |
| 722 | continue; |
| 723 | } |
| 724 | |
| 725 | File war = new File(appBase, file); |
| 726 | if (file.toLowerCase(Locale.ENGLISH).endsWith(".war") && war.isFile() && !invalidWars.contains(file)) { |
| 727 | ContextName cn = new ContextName(file, true); |
| 728 | if (tryAddServiced(cn.getName())) { |
| 729 | try { |
| 730 | if (deploymentExists(cn.getName())) { |
| 731 | DeployedApplication app = deployed.get(cn.getName()); |
| 732 | boolean unpackWAR = unpackWARs; |
| 733 | if (unpackWAR && host.findChild(cn.getName()) instanceof StandardContext) { |
| 734 | unpackWAR = ((StandardContext) host.findChild(cn.getName())).getUnpackWAR(); |
| 735 | } |
| 736 | if (!unpackWAR && app != null) { |
| 737 | // Need to check for a directory that should not be |
| 738 | // there |
| 739 | File dir = new File(appBase, cn.getBaseName()); |
| 740 | if (dir.exists()) { |
| 741 | if (!app.loggedDirWarning) { |
| 742 | log.warn(sm.getString("hostConfig.deployWar.hiddenDir", dir.getAbsoluteFile(), |
| 743 | war.getAbsoluteFile())); |
| 744 | app.loggedDirWarning = true; |
| 745 | } |
| 746 | } else { |
| 747 | app.loggedDirWarning = false; |
| 748 | } |
| 749 | } |
| 750 | removeServiced(cn.getName()); |
| 751 | continue; |
| 752 | } |
| 753 | |
| 754 | // DeployWAR will call removeServiced |
| 755 | results.add(es.submit(new DeployWar(this, cn, war))); |
| 756 | } catch (Throwable t) { |
| 757 | ExceptionUtils.handleThrowable(t); |
| 758 | removeServiced(cn.getName()); |
| 759 | throw t; |
| 760 | } |
| 761 | } |
| 762 | } |
| 763 | } |
| 764 | |
| 765 | for (Future<?> result : results) { |
no test coverage detected