markt 2004/02/10 15:16:56 Modified: webapps/admin/WEB-INF/classes/org/apache/webapp/admin/defaultcontext EditDefaultContextAction.java Log: Part of fix for bug 14193. - Set parent as this is required during save after editing. - Check for loader and manager elements and use defaults if not present. Revision Changes Path 1.3 +47 -34 jakarta-tomcat-4.0/webapps/admin/WEB-INF/classes/org/apache/webapp/admin/defaultcontext/EditDefaultContextAction.java Index: EditDefaultContextAction.java =================================================================== RCS file: /home/cvs/jakarta-tomcat-4.0/webapps/admin/WEB-INF/classes/org/apache/webapp/admin/defaultcontext/EditDefaultContextAction.java,v retrieving revision 1.2 retrieving revision 1.3 diff -u -r1.2 -r1.3 --- EditDefaultContextAction.java 19 Sep 2002 22:56:05 -0000 1.2 +++ EditDefaultContextAction.java 10 Feb 2004 23:16:56 -0000 1.3 @@ -62,28 +62,21 @@ package org.apache.webapp.admin.defaultcontext; import java.io.IOException; -import java.util.Iterator; -import java.util.List; import java.util.Locale; -import java.util.ArrayList; import javax.servlet.ServletException; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpSession; import org.apache.struts.action.Action; -import org.apache.struts.action.ActionErrors; import org.apache.struts.action.ActionForm; import org.apache.struts.action.ActionForward; import org.apache.struts.action.ActionMapping; import org.apache.struts.util.MessageResources; import javax.management.MBeanServer; -import javax.management.ObjectInstance; import javax.management.ObjectName; -import javax.management.JMException; import org.apache.webapp.admin.ApplicationServlet; -import org.apache.webapp.admin.LabelValueBean; import org.apache.webapp.admin.Lists; import org.apache.webapp.admin.TomcatTreeBuilder; @@ -214,6 +207,12 @@ DefaultContextForm defaultContextFm = new DefaultContextForm(); session.setAttribute("defaultContextForm", defaultContextFm); defaultContextFm.setAdminAction("Edit"); + + StringBuffer parent = new StringBuffer(TomcatTreeBuilder.SERVICE_TYPE); + parent.append(",name="); + parent.append(cname.getKeyProperty("service")); + defaultContextFm.setParentObjectName(parent.toString()); + defaultContextFm.setObjectName(cname.toString()); defaultContextFm.setLoaderObjectName(lname.toString()); defaultContextFm.setManagerObjectName(mname.toString()); @@ -224,7 +223,6 @@ String attribute = null; try { - // Copy scalar properties attribute = "cookies"; defaultContextFm.setCookies @@ -243,30 +241,45 @@ (((Boolean) mBServer.getAttribute(cname, attribute)).toString()); // loader properties - attribute = "debug"; - defaultContextFm.setLdrDebugLvl - (((Integer) mBServer.getAttribute(lname, attribute)).toString()); - attribute = "checkInterval"; - defaultContextFm.setLdrCheckInterval - (((Integer) mBServer.getAttribute(lname, attribute)).toString()); - attribute = "reloadable"; - defaultContextFm.setLdrReloadable - (((Boolean) mBServer.getAttribute(lname, attribute)).toString()); + if (mBServer.isRegistered(lname)) { + attribute = "debug"; + defaultContextFm.setLdrDebugLvl + (((Integer) mBServer.getAttribute(lname, attribute)).toString()); + attribute = "checkInterval"; + defaultContextFm.setLdrCheckInterval + (((Integer) mBServer.getAttribute(lname, attribute)).toString()); + attribute = "reloadable"; + defaultContextFm.setLdrReloadable + (((Boolean) mBServer.getAttribute(lname, attribute)).toString()); + } else { + // Default loader initialisation + defaultContextFm.setLdrCheckInterval("15"); + defaultContextFm.setLdrDebugLvl("0"); + defaultContextFm.setLdrReloadable("false"); + } // manager properties - attribute = "debug"; - defaultContextFm.setMgrDebugLvl - (((Integer) mBServer.getAttribute(mname, attribute)).toString()); - attribute = "entropy"; - defaultContextFm.setMgrSessionIDInit - ((String) mBServer.getAttribute(mname, attribute)); - attribute = "maxActiveSessions"; - defaultContextFm.setMgrMaxSessions - (((Integer) mBServer.getAttribute(mname, attribute)).toString()); - attribute = "checkInterval"; - defaultContextFm.setMgrCheckInterval - (((Integer) mBServer.getAttribute(mname, attribute)).toString()); - + if (mBServer.isRegistered(mname)) { + attribute = "debug"; + defaultContextFm.setMgrDebugLvl + (((Integer) mBServer.getAttribute(mname, attribute)).toString()); + attribute = "entropy"; + defaultContextFm.setMgrSessionIDInit + ((String) mBServer.getAttribute(mname, attribute)); + attribute = "maxActiveSessions"; + defaultContextFm.setMgrMaxSessions + (((Integer) mBServer.getAttribute(mname, attribute)).toString()); + attribute = "checkInterval"; + defaultContextFm.setMgrCheckInterval + (((Integer) mBServer.getAttribute(mname, attribute)).toString()); + } + else{ + // Default manager initialization + defaultContextFm.setMgrCheckInterval("60"); + defaultContextFm.setMgrDebugLvl("0"); + defaultContextFm.setMgrMaxSessions("-1"); + defaultContextFm.setMgrSessionIDInit(""); + } } catch (Throwable t) { getServlet().log (resources.getMessage(locale, "users.error.attribute.get",
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]