Index: org/jboss/deployment/scanner/DeploymentScanner.java =================================================================== RCS file: /cvsroot/jboss/jboss-system/src/main/org/jboss/deployment/scanner/DeploymentScanner.java,v retrieving revision 1.4 diff -u -r1.4 DeploymentScanner.java --- org/jboss/deployment/scanner/DeploymentScanner.java 4 Apr 2002 04:33:59 -0000 1.4 +++ org/jboss/deployment/scanner/DeploymentScanner.java 11 Aug 2005 14:28:22 -0000 @@ -27,6 +27,15 @@ public interface DeploymentScanner extends Service { + /** The JMX notification type sent when a deploy or undeploy failed */ + public static final String URL_DEPLOYMENT_FAILED = "org.jboss.DeploymentScanner.FAILED"; + + /** The JMX notification type sent when a deploy succeed */ + public static final String URL_DEPLOYMENT_DEPLOYED = "org.jboss.DeploymentScanner.DEPLOYED"; + + /** The JMX notification type sent when a undeploy succeed */ + public static final String URL_DEPLOYMENT_UNDEPLOYED = "org.jboss.DeploymentScanner.UNDEPLOYED"; + /** * The ObjectName of the {@link Deployer} which we will use. * Index: org/jboss/deployment/scanner/URLDeploymentScanner.java =================================================================== RCS file: /cvsroot/jboss/jboss-system/src/main/org/jboss/deployment/scanner/URLDeploymentScanner.java,v retrieving revision 1.32.2.4 diff -u -r1.32.2.4 URLDeploymentScanner.java --- org/jboss/deployment/scanner/URLDeploymentScanner.java 8 Aug 2005 13:13:31 -0000 1.32.2.4 +++ org/jboss/deployment/scanner/URLDeploymentScanner.java 11 Aug 2005 14:28:22 -0000 @@ -22,6 +22,7 @@ import java.util.StringTokenizer; import javax.management.MBeanServer; +import javax.management.Notification; import javax.management.ObjectName; import org.jboss.deployment.DefaultDeploymentSorter; @@ -46,7 +47,7 @@ */ public class URLDeploymentScanner extends AbstractDeploymentScanner implements DeploymentScanner, URLDeploymentScannerMBean -{ +{ /** The list of URLs to scan. */ protected List urlList = Collections.synchronizedList(new ArrayList()); @@ -314,16 +315,21 @@ { log.trace("Deploying: " + du); } + // Send a notification about the deployer addition + try { deployer.deploy(du.url); + deployedNotification(du.url); } catch (IncompleteDeploymentException e) { + failedNotification(du.url, e); lastIncompleteDeploymentException = e; } catch (Exception e) { + failedNotification(du.url, e); log.debug("Failed to deploy: " + du, e); } // end of try-catch @@ -348,9 +354,11 @@ } deployer.undeploy(du.url); deployedSet.remove(du); + undeployedNotification(du.url); } catch (Exception e) { + failedNotification(du.url, e); log.error("Failed to undeploy: " + du, e); } } @@ -702,4 +710,30 @@ " }"; } } + + private void undeployedNotification(URL url) + { + Notification msg = new Notification(URL_DEPLOYMENT_UNDEPLOYED, this, getNextNotificationSequenceNumber()); + msg.setUserData(url); + log.debug("sending msg=" + msg); + sendNotification(msg); + } + + private void deployedNotification(URL url) + { + Notification msg = new Notification(URL_DEPLOYMENT_DEPLOYED, this, getNextNotificationSequenceNumber()); + msg.setUserData(url); + log.debug("sending msg=" + msg); + sendNotification(msg); + } + + private void failedNotification(URL url, Exception e) + { + Notification msg = new Notification(URL_DEPLOYMENT_FAILED, this, getNextNotificationSequenceNumber()); + Exception wrapperException = new Exception(url.toString(), e); + msg.setUserData(wrapperException); + log.debug("sending msg=" + msg); + sendNotification(msg); + } + }