01: package org.objectweb.jonas.webapp.jonasadmin.jonasmqconnect;
02:
03: import java.io.IOException;
04: import java.util.ArrayList;
05: import java.util.Collections;
06:
07: import javax.management.ObjectName;
08: import javax.servlet.ServletException;
09: import javax.servlet.http.HttpServletRequest;
10: import javax.servlet.http.HttpServletResponse;
11:
12: import org.apache.struts.action.ActionForm;
13: import org.apache.struts.action.ActionForward;
14: import org.apache.struts.action.ActionMapping;
15: import org.objectweb.jonas.webapp.jonasadmin.JonasBaseAction;
16: import org.objectweb.jonas.webapp.jonasadmin.WhereAreYou;
17: import org.objectweb.jonas.webapp.jonasadmin.jonasmqconnect.util.MqObjectNames;
18: import org.objectweb.jonas.webapp.jonasadmin.jonasmqconnect.util.PropertiesComparator;
19: import org.objectweb.jonas.webapp.jonasadmin.jonasmqconnect.util.PropertiesUtil;
20:
21: public class MdbEditAction extends JonasBaseAction {
22:
23: public ActionForward executeAction(ActionMapping mapping,
24: ActionForm form, HttpServletRequest request,
25: HttpServletResponse response) throws IOException,
26: ServletException {
27:
28: MdbEditForm fBean = (MdbEditForm) form;
29: String name = fBean.getName();
30: ArrayList properties;
31: ObjectName mbName;
32:
33: WhereAreYou oWhere = (WhereAreYou) request.getSession()
34: .getAttribute(WhereAreYou.SESSION_NAME);
35: String serverName = oWhere.getCurrentJonasServerName();
36: String domainName = oWhere.getCurrentDomainName();
37:
38: try {
39: ObjectName connectorON = MqObjectNames
40: .getConnectorONByName(domainName,
41: (String) m_Session
42: .getAttribute("mqconnector"));
43: mbName = MqObjectNames.getMdbON(connectorON, name,
44: serverName);
45: ArrayList propertiesName = new ArrayList();
46: propertiesName.add("Destination");
47: propertiesName.add("DestinationType");
48: propertiesName.add("DestinationProperties");
49: propertiesName.add("MessageSelector");
50: propertiesName.add("SubscriptionDurability");
51: propertiesName.add("SubscriptionName");
52: propertiesName.add("AcknowledgeMode");
53: propertiesName.add("MaxMessages");
54: propertiesName.add("PoolSize");
55: propertiesName.add("InitPoolSize");
56: propertiesName.add("MaxNumberOfWorks");
57: propertiesName.add("MdbName");
58: propertiesName.add("UserName");
59: propertiesName.add("Password");
60: propertiesName.add("ReconnectInterval");
61: propertiesName.add("MaxReconnect");
62: properties = PropertiesUtil.getProperties(mbName,
63: "getProperty", propertiesName, serverName);
64: Collections.sort(properties, new PropertiesComparator());
65: } catch (Throwable t) {
66: addGlobalError(t);
67: saveErrors(request, m_Errors);
68: return (mapping.findForward("Global Error"));
69: }
70: fBean.setProperties(properties);
71: return mapping.findForward("JonasMqConnectMdbEdit");
72: }
73: }
|