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 ApplyDestinationAction 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 String idString = (String ) m_Session.getAttribute("currentId"); 61 Integer idInteger = (new Integer (idString)); 62 int id = idInteger.intValue(); 63 64 try { 65 ObjectName oObjectName; 66 ObjectName joramAdapterON = (ObjectName ) JonasManagementRepr.queryNames(JoramObjectName.joramAdapter()).iterator().next(); 67 if (JonasManagementRepr.isRegistered(joramAdapterON)) { 68 oObjectName = joramAdapterON; 69 } else { 70 oObjectName = JoramObjectName.joramAdmin(); 71 } 72 73 Object [] asParam = { 74 idInteger, oForm.getName() 75 }; 76 String [] asSignature = { 77 "int", "java.lang.String" 78 }; 79 String type = oForm.getType(); 80 if (type.equals(m_Resources.getMessage("label.joramplatform.destinations.queue"))) 81 JonasManagementRepr.invoke(oObjectName, "createQueue", asParam, asSignature); 82 else if (type.equals(m_Resources.getMessage("label.joramplatform.destinations.topic"))) 83 JonasManagementRepr.invoke(oObjectName, "createTopic", asParam, asSignature); 84 85 refreshJoramTree(p_Request); 87 88 oForm.reset(p_Mapping, p_Request); 89 90 } catch (Throwable t) { 91 addGlobalError(t); 92 saveErrors(p_Request, m_Errors); 93 return (p_Mapping.findForward("Global Error")); 94 } 95 96 return (p_Mapping.findForward("Create Joram Destination")); 98 } 99 } 100 | Popular Tags |