1 23 24 package com.sun.enterprise.server; 25 26 import com.sun.enterprise.admin.event.AdminEventListener; 27 import com.sun.enterprise.admin.event.AdminEventListenerException; 28 import com.sun.enterprise.admin.event.jms.*; 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 36 41 public class JmsHostEventListener implements 42 com.sun.enterprise.admin.event.jms.JmsHostEventListener { 43 44 private ConnectorRegistry registry = ConnectorRegistry.getInstance(); 45 46 55 public void handleDelete(JmsHostEvent event) 56 throws AdminEventListenerException { 57 reloadRA(event); 58 } 60 61 71 public void handleUpdate(JmsHostEvent event) 72 throws AdminEventListenerException { 73 reloadRA(event); 74 } 76 77 86 public void handleCreate(JmsHostEvent event) 87 throws AdminEventListenerException { 88 reloadRA(event); 89 } 91 92 private void reloadRA(JmsHostEvent event) throws AdminEventListenerException { 93 try { 94 JmsService service = (JmsService) getJmsService(event); 95 ActiveJmsResourceAdapter aja = getAdapter(); 96 if (aja != null) { 97 getAdapter().reloadRA(service); 98 } 99 } catch (ConnectorRuntimeException cre) { 100 AdminEventListenerException ale = 101 new AdminEventListenerException(cre.getMessage()); 102 ale.initCause(cre); 103 throw ale; 104 } catch (ConfigException ce) { 105 AdminEventListenerException ale = 106 new AdminEventListenerException(ce.getMessage()); 107 ale.initCause(ce); 108 throw ale; 109 } 110 } 111 112 private ActiveJmsResourceAdapter getAdapter(){ 113 return (ActiveJmsResourceAdapter) 114 registry.getActiveResourceAdapter(ConnectorRuntime.DEFAULT_JMS_ADAPTER); 115 } 116 117 private JmsService getJmsService(JmsHostEvent event) throws ConfigException{ 118 ConfigContext context = event.getConfigContext(); 119 return ServerBeansFactory.getJmsServiceBean(context); 120 } 121 } 122 | Popular Tags |