001: /*
002: * JOnAS: Java(TM) Open Application Server
003: * Copyright (C) 2005 Bull S.A.
004: * Contact: jonas-team@objectweb.org
005: *
006: * This library is free software; you can redistribute it and/or
007: * modify it under the terms of the GNU Lesser General Public
008: * License as published by the Free Software Foundation; either
009: * version 2.1 of the License, or any later version.
010: *
011: * This library is distributed in the hope that it will be useful,
012: * but WITHOUT ANY WARRANTY; without even the implied warranty of
013: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
014: * Lesser General Public License for more details.
015: *
016: * You should have received a copy of the GNU Lesser General Public
017: * License along with this library; if not, write to the Free Software
018: * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
019: * USA
020: *
021: * --------------------------------------------------------------------------
022: * $Id$
023: * --------------------------------------------------------------------------
024: */
025:
026: package org.objectweb.jonas.webapp.jonasadmin.service.webservice;
027:
028: import java.io.IOException;
029: import java.util.ArrayList;
030: import java.util.HashMap;
031:
032: import javax.servlet.ServletException;
033: import javax.servlet.http.HttpServletRequest;
034: import javax.servlet.http.HttpServletResponse;
035:
036: import org.allesta.wsabi.j2ee.PortComponent;
037: import org.allesta.wsabi.j2ee.WebServiceDescription;
038: import org.allesta.wsabi.j2ee.provider.GenericDomainCapableProvider;
039: import org.allesta.wsabi.j2ee.provider.jonas.JonasProvider;
040: import org.apache.struts.action.ActionForm;
041: import org.apache.struts.action.ActionForward;
042: import org.apache.struts.action.ActionMapping;
043: import org.objectweb.jonas.webapp.jonasadmin.JonasBaseAction;
044:
045: /**
046: * @author Vivek Lakshmanan
047: */
048:
049: public class ViewHandlersAction extends JonasBaseAction {
050:
051: public ActionForward executeAction(ActionMapping p_Mapping,
052: ActionForm p_Form, HttpServletRequest p_Request,
053: HttpServletResponse p_Response) throws IOException,
054: ServletException {
055:
056: String wsPCId = p_Request.getParameter("pcselect");
057: // Selected web service description
058: String wsdId = p_Request.getParameter("wsdselect");
059:
060: try {
061: GenericDomainCapableProvider jonasProvider = new JonasProvider();
062: jonasProvider.initialize(m_WhereAreYou
063: .getCurrentJonasServerName(), null);
064: WebServiceDescription wsd = jonasProvider
065: .getWebServiceDescription(wsdId);
066: PortComponent pc = null;
067: int wsdPortComponentCount = wsd.getPortComponentCount();
068: for (int i = 0; i < wsdPortComponentCount; i++) {
069: if (wsPCId.equals(((PortComponent) wsd
070: .getPortComponent(i)).getId())) {
071: pc = (PortComponent) wsd.getPortComponent(i);
072: break;
073: }
074: }
075:
076: ArrayList handlers = new ArrayList();
077: for (int i = 0; i < pc.getHandlerCount(); i++) {
078: handlers.add(pc.getHandler(i));
079: }
080:
081: HashMap map = new HashMap();
082: map.put("wsdselect", wsd.getId());
083: map.put("pcselect", pc.getId());
084: p_Request.setAttribute("paramMap", map);
085: p_Request.setAttribute("portComponent", pc);
086: p_Request.setAttribute("webServiceDescription", wsd);
087: p_Request.setAttribute("handlers", handlers);
088: } catch (Throwable t) {
089: addGlobalError(t);
090: saveErrors(p_Request, m_Errors);
091: return (p_Mapping.findForward("Global Error"));
092: }
093:
094: // Force the node selected in tree
095: //m_WhereAreYou.selectNameNode(getTreeBranchName(DEPTH_SERVER) + WhereAreYou.NODE_SEPARATOR
096: // + "services" + WhereAreYou.NODE_SEPARATOR + "WebService"
097: // + WhereAreYou.NODE_SEPARATOR + oForm.getFile(), true);
098:
099: return (p_Mapping.findForward("Handlers"));
100: }
101:
102: }
|