1 23 24 package com.sun.enterprise.server; 25 26 import com.sun.enterprise.admin.event.AdminEventListener; 27 import com.sun.enterprise.admin.event.jms.*; 28 import com.sun.enterprise.admin.event.AdminEventListenerException; 29 import com.sun.enterprise.config.serverbeans.*; 30 import com.sun.enterprise.config.*; 31 import com.sun.enterprise.connectors.*; 32 import com.sun.enterprise.connectors.system.*; 33 34 35 40 public class JmsServiceEventListener implements 41 com.sun.enterprise.admin.event.jms.JmsServiceEventListener { 42 43 private ConnectorRegistry registry = ConnectorRegistry.getInstance(); 44 45 54 public void handleDelete(JmsServiceEvent event) 55 throws AdminEventListenerException { 56 } 57 58 68 public void handleUpdate(JmsServiceEvent event) 69 throws AdminEventListenerException { 70 try { 71 JmsService service = getJmsService(event); 72 ActiveJmsResourceAdapter ajr = (ActiveJmsResourceAdapter) 73 registry.getActiveResourceAdapter(ConnectorRuntime.DEFAULT_JMS_ADAPTER); 74 if (ajr != null) { 75 ajr.reloadRA(service); 76 } 77 JmsService oldService = ServerBeansFactory.getJmsServiceBean( 78 event.getOldConfigContext()); 79 if(!oldService.getType().equals(service.getType())) 80 throw new AdminEventListenerException 81 ("jms type is not dynamically configured"); 82 } catch (ConnectorRuntimeException cre) { 83 AdminEventListenerException ale = 84 new AdminEventListenerException(cre.getMessage()); 85 ale.initCause(cre); 86 throw ale; 87 } catch (Exception ce) { 88 AdminEventListenerException ale = 89 new AdminEventListenerException(ce.getMessage()); 90 ale.initCause(ce); 91 throw ale; 92 } 93 } 94 95 104 public void handleCreate(JmsServiceEvent event) 105 throws AdminEventListenerException { 106 } 107 108 private JmsService getJmsService(JmsServiceEvent event) throws ConfigException { 109 ConfigContext context = event.getConfigContext(); 110 return ServerBeansFactory.getJmsServiceBean(context); 111 } 112 } 113 | Popular Tags |