1 25 26 package org.objectweb.jonas.webapp.jonasadmin.logging; 27 28 import java.io.IOException ; 29 import java.util.ArrayList ; 30 import java.util.Arrays ; 31 32 import javax.management.ObjectName ; 33 import javax.servlet.ServletException ; 34 import javax.servlet.http.HttpServletRequest ; 35 import javax.servlet.http.HttpServletResponse ; 36 37 import org.apache.struts.action.ActionForm; 38 import org.apache.struts.action.ActionForward; 39 import org.apache.struts.action.ActionMapping; 40 import org.objectweb.jonas.jmx.JonasManagementRepr; 41 import org.objectweb.jonas.jmx.JonasObjectName; 42 import org.objectweb.jonas.webapp.jonasadmin.Jlists; 43 import org.objectweb.jonas.webapp.jonasadmin.JonasBaseAction; 44 import org.objectweb.jonas.webapp.jonasadmin.WhereAreYou; 45 46 49 50 public class EditLoggingJonasAction extends JonasBaseAction { 51 52 54 public ActionForward executeAction(ActionMapping p_Mapping, ActionForm p_Form 55 , HttpServletRequest p_Request, HttpServletResponse p_Response) 56 throws IOException , ServletException { 57 58 m_WhereAreYou.selectNameNode(getTreeBranchName(DEPTH_SERVER) 60 + WhereAreYou.NODE_SEPARATOR 61 + "logging" 62 + WhereAreYou.NODE_SEPARATOR 63 + LoggerItem.LOGGER_JONAS, true); 64 65 LoggingJonasForm oForm = (LoggingJonasForm) p_Form; 67 try { 68 ObjectName oObjectName = null; 69 oObjectName = JonasObjectName.logService("trace"); 70 String [] asTopic = (String []) JonasManagementRepr.getAttribute(oObjectName, "Topics"); 71 72 ArrayList alTopic = new ArrayList (Arrays.asList(asTopic)); 73 int iPos = alTopic.indexOf("root"); 74 if (iPos > -1) { 75 alTopic.remove(iPos); 76 alTopic.add(0, "root"); 77 Object [] ao = alTopic.toArray(); 78 for (int i = 0; i < ao.length; i++) { 79 asTopic[i] = ao[i].toString(); 80 } 81 } 82 83 String [] asParam = new String [1]; 85 String [] asSignature = new String [1]; 86 asSignature[0] = "java.lang.String"; 87 String sLevel = null; 88 ArrayList al = new ArrayList (); 89 String [] asLevel = new String [asTopic.length]; 90 for (int i = 0; i < asTopic.length; i++) { 91 asParam[0] = asTopic[i]; 92 sLevel = (String ) JonasManagementRepr.invoke(oObjectName, "getTopicLevel", asParam 93 , asSignature); 94 asLevel[i] = sLevel; 95 al.add(new TopicLevel(asTopic[i], sLevel)); 96 } 97 oForm.setTopicLevelList(al); 98 oForm.setTopics(asTopic); 99 oForm.setLoggerJonasLevels(Jlists.getLoggerJonasLevels()); 100 } 101 catch (Throwable t) { 102 addGlobalError(t); 103 saveErrors(p_Request, m_Errors); 104 return (p_Mapping.findForward("Global Error")); 105 } 106 return (p_Mapping.findForward("Logging Jonas")); 108 } 109 } 110 | Popular Tags |