1 25 26 package org.objectweb.jonas.webapp.jonasadmin.joramplatform; 27 28 import java.io.IOException ; 29 30 import javax.management.ObjectName ; 31 import javax.servlet.ServletException ; 32 import javax.servlet.http.HttpServletRequest ; 33 import javax.servlet.http.HttpServletResponse ; 34 35 import org.apache.struts.action.ActionForm; 36 import org.apache.struts.action.ActionForward; 37 import org.apache.struts.action.ActionMapping; 38 import org.objectweb.jonas.jmx.JonasManagementRepr; 39 import org.objectweb.jonas.jmx.JonasObjectName; 40 import org.objectweb.jonas.jmx.JoramObjectName; 41 import org.objectweb.jonas.webapp.jonasadmin.WhereAreYou; 42 import org.objectweb.jonas.webapp.jonasadmin.deploy.BaseDeployAction; 43 44 45 49 50 public class ApplyLocalDestinationAction extends BaseDeployAction { 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 JoramDestinationForm oForm = (JoramDestinationForm) p_Form; 60 61 try { 62 ObjectName oObjectName; 63 ObjectName joramAdapterON = (ObjectName ) JonasManagementRepr.queryNames(JoramObjectName.joramAdapter()).iterator().next(); 64 if (JonasManagementRepr.isRegistered(joramAdapterON)) { 65 oObjectName = joramAdapterON; 66 } else { 67 oObjectName = JoramObjectName.joramAdmin(); 68 } 69 70 String [] asParam = { 71 oForm.getName() 72 }; 73 String [] asSignature = { 74 "java.lang.String" 75 }; 76 String type = oForm.getType(); 77 if (type.equals(m_Resources.getMessage("label.joramplatform.destinations.queue"))) 78 JonasManagementRepr.invoke(oObjectName, "createQueue", asParam, asSignature); 79 else if (type.equals(m_Resources.getMessage("label.joramplatform.destinations.topic"))) 80 JonasManagementRepr.invoke(oObjectName, "createTopic", asParam, asSignature); 81 82 refreshJoramTree(p_Request); 84 85 oForm.reset(p_Mapping, p_Request); 86 87 } catch (Throwable t) { 88 addGlobalError(t); 89 saveErrors(p_Request, m_Errors); 90 return (p_Mapping.findForward("Global Error")); 91 } 92 93 return (p_Mapping.findForward("ActionEditJoramServer")); 95 } 96 } 97 | Popular Tags |