1 25 26 package org.objectweb.jonas.webapp.jonasadmin.service.webservice; 27 28 import java.io.IOException ; 29 import java.util.ArrayList ; 30 import java.util.Collection ; 31 import java.util.HashMap ; 32 33 import javax.servlet.ServletException ; 34 import javax.servlet.http.HttpServletRequest ; 35 import javax.servlet.http.HttpServletResponse ; 36 37 import org.allesta.wsabi.j2ee.Handler; 38 import org.allesta.wsabi.j2ee.PortComponent; 39 import org.allesta.wsabi.j2ee.WebServiceDescription; 40 import org.allesta.wsabi.j2ee.provider.GenericDomainCapableProvider; 41 import org.allesta.wsabi.j2ee.provider.jonas.JonasProvider; 42 import org.apache.struts.action.ActionForm; 43 import org.apache.struts.action.ActionForward; 44 import org.apache.struts.action.ActionMapping; 45 import org.objectweb.jonas.webapp.jonasadmin.JonasBaseAction; 46 import org.objectweb.jonas.webapp.jonasadmin.WhereAreYou; 47 48 51 52 public class HandlersDetailsAction extends JonasBaseAction { 53 54 public ActionForward executeAction(ActionMapping p_Mapping, 55 ActionForm p_Form, HttpServletRequest p_Request, 56 HttpServletResponse p_Response) throws IOException , 57 ServletException { 58 String wsPCId = p_Request.getParameter("pcselect"); 60 String wsdId = p_Request.getParameter("wsdselect"); 62 String handlerId = p_Request.getParameter("handlerselect"); 64 65 try { 66 GenericDomainCapableProvider jonasProvider = new JonasProvider(); 67 jonasProvider.initialize(m_WhereAreYou.getCurrentJonasServerName(), 68 null); 69 WebServiceDescription wsd = jonasProvider 70 .getWebServiceDescription(wsdId); 71 PortComponent pc = null; 72 int wsdPortComponentCount = wsd.getPortComponentCount(); 73 for (int i = 0; i < wsdPortComponentCount; i++) { 75 if (wsPCId.equals(((PortComponent) wsd.getPortComponent(i)) 76 .getId())) { 77 pc = (PortComponent) wsd.getPortComponent(i); 78 break; 79 } 80 } 81 Handler handler = null; 82 for (int i = 0; i < pc.getHandlerCount(); i++) { 83 if (pc.getHandler(i).getId().equals(handlerId)) { 84 handler = pc.getHandler(i); 85 } 86 } 87 HashMap forwardMap = new HashMap (); 90 forwardMap.put("pcselect", wsPCId); 91 forwardMap.put("wsdselect", wsdId); 92 p_Request.setAttribute("paramMap", forwardMap); 93 94 ArrayList soapHeaders = new ArrayList (); 97 for (int i = 0; i < handler.getSoapHeaderCount(); i++) { 98 soapHeaders.add(handler.getSoapHeader(i).toString()); 99 } 100 101 ArrayList soapRoles = new ArrayList (); 102 for (int i = 0; i < handler.getSoapRoleCount(); i++) { 103 soapRoles.add(handler.getSoapRole(i)); 104 } 105 106 ArrayList initParams = new ArrayList (); 107 for (int i = 0; i < handler.getInitParamCount(); i++) { 108 initParams.add(handler.getInitParam(i)); 109 } 110 111 p_Request.setAttribute("portComponent", pc); 112 p_Request.setAttribute("webServiceDescription", wsd); 113 p_Request.setAttribute("handler", handler); 114 p_Request.setAttribute("soapHeaders", soapHeaders); 115 p_Request.setAttribute("soapRoles", soapRoles); 116 p_Request.setAttribute("initParams", initParams); 117 m_WhereAreYou.selectNameNode(getTreeBranchName(DEPTH_SERVER) 119 + WhereAreYou.NODE_SEPARATOR + "services" 120 + WhereAreYou.NODE_SEPARATOR + "WebService" 121 + WhereAreYou.NODE_SEPARATOR + wsd.getId() 122 + WhereAreYou.NODE_SEPARATOR + pc.getId() 123 + WhereAreYou.NODE_SEPARATOR + handler.getId(), true); 124 125 } catch (Throwable t) { 126 addGlobalError(t); 127 saveErrors(p_Request, m_Errors); 128 return (p_Mapping.findForward("Global Error")); 129 } 130 131 return (p_Mapping.findForward("Handlers Details")); 133 } 134 135 } 136 | Popular Tags |