Add a new Context to be managed by us. Entry point for the admin webapp, and other JMX Context controllers. @param context The context instance
(Context context)
| 1749 | * @param context The context instance |
| 1750 | */ |
| 1751 | public void manageApp(Context context) { |
| 1752 | |
| 1753 | String contextName = context.getName(); |
| 1754 | |
| 1755 | if (deployed.containsKey(contextName)) { |
| 1756 | return; |
| 1757 | } |
| 1758 | |
| 1759 | DeployedApplication deployedApp = new DeployedApplication(contextName, false); |
| 1760 | |
| 1761 | // Add the associated docBase to the redeployed list if it's a WAR |
| 1762 | boolean isWar = false; |
| 1763 | if (context.getDocBase() != null) { |
| 1764 | File docBase = new File(context.getDocBase()); |
| 1765 | if (!docBase.isAbsolute()) { |
| 1766 | docBase = new File(host.getAppBaseFile(), context.getDocBase()); |
| 1767 | } |
| 1768 | deployedApp.redeployResources.put(docBase.getAbsolutePath(), Long.valueOf(docBase.lastModified())); |
| 1769 | if (docBase.getAbsolutePath().toLowerCase(Locale.ENGLISH).endsWith(".war")) { |
| 1770 | isWar = true; |
| 1771 | } |
| 1772 | } |
| 1773 | host.addChild(context); |
| 1774 | // Add the eventual unpacked WAR and all the resources which will be |
| 1775 | // watched inside it |
| 1776 | boolean unpackWAR = unpackWARs; |
| 1777 | if (unpackWAR && context instanceof StandardContext) { |
| 1778 | unpackWAR = ((StandardContext) context).getUnpackWAR(); |
| 1779 | } |
| 1780 | if (isWar && unpackWAR) { |
| 1781 | File docBase = new File(host.getAppBaseFile(), context.getBaseName()); |
| 1782 | deployedApp.redeployResources.put(docBase.getAbsolutePath(), Long.valueOf(docBase.lastModified())); |
| 1783 | addWatchedResources(deployedApp, docBase.getAbsolutePath(), context); |
| 1784 | } else { |
| 1785 | addWatchedResources(deployedApp, null, context); |
| 1786 | } |
| 1787 | deployed.put(contextName, deployedApp); |
| 1788 | } |
| 1789 | |
| 1790 | /** |
| 1791 | * Remove a webapp from our control. Entry point for the admin webapp, and other JMX Context controllers. |
nothing calls this directly
no test coverage detected