Iterator iterator = sortedContextPathsMap.entrySet().iterator();
boolean isHighlighted = true;
+ boolean isDeployed = true;
String highlightColor = null;
while (iterator.hasNext()) {
}
if (context != null ) {
+ try {
+ isDeployed = isDeployed(contextPath);
+ } catch (Exception e) {
+ // Assume false on failure for safety
+ isDeployed = false;
+ }
+
args = new Object[6];
args[0] = displayPath;
args[1] = context.getDisplayName();
if (context.getPath().equals(this.context.getPath())) {
writer.print(MessageFormat.format(
MANAGER_APP_ROW_BUTTON_SECTION, args));
- } else if (context.getAvailable()) {
+ } else if (context.getAvailable() && isDeployed) {
+ writer.print(MessageFormat.format(
+ STARTED_DEPLOYED_APPS_ROW_BUTTON_SECTION, args));
+ } else if (context.getAvailable() && !isDeployed) {
writer.print(MessageFormat.format(
- STARTED_APPS_ROW_BUTTON_SECTION, args));
+ STARTED_NONDEPLOYED_APPS_ROW_BUTTON_SECTION, args));
+ } else if (!context.getAvailable() && isDeployed) {
+ writer.print(MessageFormat.format(
+ STOPPED_DEPLOYED_APPS_ROW_BUTTON_SECTION, args));
} else {
writer.print(MessageFormat.format(
- STOPPED_APPS_ROW_BUTTON_SECTION, args));
+ STOPPED_NONDEPLOYED_APPS_ROW_BUTTON_SECTION, args));
}
}
" </td>\n" +
"</tr>\n";
- private static final String STARTED_APPS_ROW_BUTTON_SECTION =
+ private static final String STARTED_DEPLOYED_APPS_ROW_BUTTON_SECTION =
" <td class=\"row-left\" bgcolor=\"{8}\">\n" +
" <small>\n" +
" {1} \n" +
" </td>\n" +
"</tr>\n";
- private static final String STOPPED_APPS_ROW_BUTTON_SECTION =
+ private static final String STOPPED_DEPLOYED_APPS_ROW_BUTTON_SECTION =
" <td class=\"row-left\" bgcolor=\"{8}\">\n" +
" <small>\n" +
" <a href=\"{0}\" onclick=\"return(confirm('''Are you sure?'''))\">{1}</a> \n" +
" </td>\n" +
"</tr>\n";
+ private static final String STARTED_NONDEPLOYED_APPS_ROW_BUTTON_SECTION =
+ " <td class=\"row-left\" bgcolor=\"{8}\">\n" +
+ " <small>\n" +
+ " {1} \n" +
+ " <a href=\"{2}\" onclick=\"return(confirm('''Are you sure?'''))\">{3}</a> \n" +
+ " <a href=\"{4}\" onclick=\"return(confirm('''Are you sure?'''))\">{5}</a> \n" +
+ " {7} \n" +
+ " </small>\n" +
+ " </td>\n" +
+ "</tr>\n";
+
+ private static final String STOPPED_NONDEPLOYED_APPS_ROW_BUTTON_SECTION =
+ " <td class=\"row-left\" bgcolor=\"{8}\">\n" +
+ " <small>\n" +
+ " <a href=\"{0}\" onclick=\"return(confirm('''Are you sure?'''))\">{1}</a> \n" +
+ " {3} \n" +
+ " {5} \n" +
+ " {7} \n" +
+ " </small>\n" +
+ " </td>\n" +
+ "</tr>\n";
+
private static final String DEPLOY_SECTION =
"</table>\n" +
"<br>\n" +
managerServlet.noRole=FAIL - User does not possess role {0}
managerServlet.noSelf=FAIL - The manager can not reload, undeploy, stop, or undeploy itself
managerServlet.noWrapper=Container has not called setWrapper() for this servlet
+managerServlet.notDeployed=FAIL - Context {0} is defined in server.xml and may not be undeployed
managerServlet.reloaded=OK - Reloaded application at context path {0}
managerServlet.undeployd=OK - Undeployed application at context path {0}
managerServlet.resourcesAll=OK - Listed global resources of all types
}
}
+ if (!isDeployed(path)) {
+ writer.println(sm.getString("managerServlet.notDeployed",
+ RequestUtil.filter(displayPath)));
+ return;
+ }
+
if (!isServiced(path)) {
addServiced(path);
try {
/**
+ * Invoke the isDeployed method on the deployer.
+ */
+ protected boolean isDeployed(String name)
+ throws Exception {
+ String[] params = { name };
+ String[] signature = { "java.lang.String" };
+ Boolean result =
+ (Boolean) mBeanServer.invoke(oname, "isDeployed", params, signature);
+ return result.booleanValue();
+ }
+
+
+ /**
* Invoke the check method on the deployer.
*/
protected void check(String name)
/**
- * Invoke the check method on the deployer.
+ * Invoke the isServiced method on the deployer.
*/
protected boolean isServiced(String name)
throws Exception {
/**
- * Invoke the check method on the deployer.
+ * Invoke the addServiced method on the deployer.
*/
protected void addServiced(String name)
throws Exception {
/**
- * Invoke the check method on the deployer.
+ * Invoke the removeServiced method on the deployer.
*/
protected void removeServiced(String name)
throws Exception {
}
+ /**
+ * Has the specified application been deployed? Note applications defined
+ * in server.xml will not have been deployed.
+ * @return <code>true</code> if the application has been deployed and
+ * <code>false</code> if the applciation has not been deployed or does not
+ * exist
+ */
+ public boolean isDeployed(String name) {
+ DeployedApplication app = (DeployedApplication) deployed.get(name);
+ if (app == null) {
+ return false;
+ } else {
+ return true;
+ }
+ }
+
+
// ------------------------------------------------------ Protected Methods
if (files == null)
return;
- boolean checkAdditionalDeployments = false;
-
for (int i = 0; i < files.length; i++) {
if (files[i].equalsIgnoreCase("META-INF"))