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.HashMap;
030:
031: import javax.servlet.ServletException;
032: import javax.servlet.http.HttpServletRequest;
033: import javax.servlet.http.HttpServletResponse;
034:
035: import org.allesta.wsabi.j2ee.PortComponent;
036: import org.allesta.wsabi.j2ee.WebServiceDescription;
037: import org.allesta.wsabi.j2ee.provider.GenericDomainCapableProvider;
038: import org.allesta.wsabi.j2ee.provider.jonas.JonasProvider;
039: import org.apache.struts.action.ActionForm;
040: import org.apache.struts.action.ActionForward;
041: import org.apache.struts.action.ActionMapping;
042: import org.objectweb.jonas.webapp.jonasadmin.JonasBaseAction;
043: import org.objectweb.jonas.webapp.jonasadmin.WhereAreYou;
044:
045: /**
046: * @author Vivek Lakshmanan
047: */
048:
049: public class PortComponentsDetailsAction extends JonasBaseAction {
050:
051: // --------------------------------------------------------- Public Methods
052:
053: public ActionForward executeAction(ActionMapping p_Mapping,
054: ActionForm p_Form, HttpServletRequest p_Request,
055: HttpServletResponse p_Response) throws IOException,
056: ServletException {
057: // The webservice description selected by the user.
058: String wsdId = p_Request.getParameter("wsdselect");
059: // The port component selected by the user.
060: String pcId = p_Request.getParameter("pcselect");
061:
062: try {
063: GenericDomainCapableProvider jonasProvider = new JonasProvider();
064: jonasProvider.initialize(m_WhereAreYou
065: .getCurrentJonasServerName(), null);
066: WebServiceDescription wsd = jonasProvider
067: .getWebServiceDescription(wsdId);
068: PortComponent pc = null;
069: for (int i = 0; i < wsd.getPortComponentCount(); i++) {
070: if (wsd.getPortComponent(i).getId().equals(pcId)) {
071: pc = wsd.getPortComponent(i);
072: break;
073: }
074: }
075:
076: // Set the selected description in the request.
077: p_Request
078: .setAttribute("selectedWebServiceDescription", wsd);
079: p_Request.setAttribute("selectedPortComponent", pc);
080: p_Request.setAttribute("implBean", pc.getServiceImplBean());
081: HashMap map = new HashMap();
082: map.put("wsdselect", wsd.getId());
083: map.put("pcselect", pc.getId());
084: p_Request.setAttribute("paramMap", map);
085:
086: // Force the node selected in tree
087: m_WhereAreYou.selectNameNode(
088: getTreeBranchName(DEPTH_SERVER)
089: + WhereAreYou.NODE_SEPARATOR + "services"
090: + WhereAreYou.NODE_SEPARATOR + "WebService"
091: + WhereAreYou.NODE_SEPARATOR + wsd.getId()
092: + WhereAreYou.NODE_SEPARATOR + pc.getId(),
093: true);
094: } catch (Throwable t) {
095: addGlobalError(t);
096: saveErrors(p_Request, m_Errors);
097: return (p_Mapping.findForward("Global Error"));
098: }
099: // Forward to the jsp.
100:
101: return (p_Mapping.findForward("PortComponents Details"));
102: }
103:
104: }
|