01: /*
02: * (C) Copyright 2000 - 2005 Nabh Information Systems, Inc.
03: *
04: * This program is free software; you can redistribute it and/or
05: * modify it under the terms of the GNU General Public License
06: * as published by the Free Software Foundation; either version 2
07: * of the License, or (at your option) any later version.
08: *
09: * This program is distributed in the hope that it will be useful,
10: * but WITHOUT ANY WARRANTY; without even the implied warranty of
11: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12: * GNU General Public License for more details.
13: *
14: * You should have received a copy of the GNU General Public License
15: * along with this program; if not, write to the Free Software
16: * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
17: *
18: */
19: package com.nabhinc.portlet.wsadmin;
20:
21: import java.util.List;
22:
23: import javax.portlet.PortletException;
24: import javax.portlet.PortletRequest;
25:
26: import com.nabhinc.portlet.mvcportlet.core.FormFieldPopulator;
27: import com.nabhinc.portlet.mvcportlet.core.ValueAndLabel;
28: import com.nabhinc.portlet.mvcportlet.populator.BasePopulator;
29: import com.nabhinc.ws.core.WebServiceException;
30: import com.nabhinc.ws.server.WebServiceInfo;
31: import com.nabhinc.ws.server.WebServiceManager;
32:
33: /**
34: * Web Services list.
35: *
36: * @author Padmanabh Dabke
37: * (c) 2005 Nabh Information Systems, Inc. All Rights Reserved.
38: */
39: public class ServiceList extends BasePopulator implements
40: FormFieldPopulator {
41:
42: /* (non-Javadoc)
43: * @see com.nabhinc.portlet.mvcportlet.core.FormFieldPopulator#getValue(javax.portlet.PortletRequest)
44: */
45: public Object getValue(PortletRequest req) throws PortletException {
46: try {
47: List wsList = WebServiceManager.getWebServiceInfoList();
48: ValueAndLabel[] returnValue = new ValueAndLabel[wsList
49: .size()];
50: for (int i = 0; i < wsList.size(); i++) {
51: WebServiceInfo cInfo = (WebServiceInfo) wsList.get(i);
52: returnValue[i] = new ValueAndLabel(cInfo.name,
53: cInfo.displayName);
54:
55: }
56: return returnValue;
57: } catch (WebServiceException e) {
58: throw new PortletException(e.getMessage(), e.getCause());
59: }
60: }
61:
62: }
|