[JBoss-dev] CVS update: jboss/src/main/org/jboss/deployment AutoDeployer.java
User: ejort Date: 02/01/02 09:06:54 Modified:src/main/org/jboss/deployment AutoDeployer.java Log: Removed some unguarded trace statements. Revision ChangesPath 1.8 +5 -3 jboss/src/main/org/jboss/deployment/AutoDeployer.java Index: AutoDeployer.java === RCS file: /cvsroot/jboss/jboss/src/main/org/jboss/deployment/AutoDeployer.java,v retrieving revision 1.7 retrieving revision 1.8 diff -u -r1.7 -r1.8 --- AutoDeployer.java 2001/12/09 05:24:25 1.7 +++ AutoDeployer.java 2002/01/02 17:06:54 1.8 @@ -58,7 +58,7 @@ * @author a href=mailto:[EMAIL PROTECTED];Toby Allsopp/a * @author a href=mailto:[EMAIL PROTECTED];David Maplesden/a * @author a href=mailto:[EMAIL PROTECTED];Andreas Schaefer/a - * @version $Revision: 1.7 $ + * @version $Revision: 1.8 $ */ public class AutoDeployer extends ServiceMBeanSupport @@ -260,7 +260,8 @@ } catch (InterruptedException e) { - log.debug(interrupted; ignoring, e); + if (log.isDebugEnabled()) + log.debug(interrupted; ignoring, e); } } @@ -602,7 +603,8 @@ protected void scanWatchedDirectories() throws MalformedURLException { - log.trace(Scanning watched directories); + if (log.isTraceEnabled()) +log.trace(Scanning watched directories); for (int i = 0; i watchedDirectories.size(); i++) { ___ Jboss-development mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/jboss-development
[JBoss-dev] CVS update: jboss/src/main/org/jboss/deployment AutoDeployer.java DeployerMBeanSupport.java J2eeDeployer.java J2eeDeployerMBean.java ServiceDeployer.java ServiceDeployerMBean.java
User: user57 Date: 02/01/02 20:00:57 Modified:src/main/org/jboss/deployment AutoDeployer.java DeployerMBeanSupport.java J2eeDeployer.java J2eeDeployerMBean.java ServiceDeployer.java ServiceDeployerMBean.java Log: o migrated all components to a new JMX domain name model. jboss.system is now where to core/spine components live. moved all components that were in JBOSS-SYSTEM that did not move into a jboss.* domain into jboss (where the server is now registered). The point was to limit the members of jboss.system to core bits only. o Created org.jboss.system.Server, which does the work of initialization that org.jboss.Main used to do. Main now only parses the command line, sets up basic legecy properties and creates a Server instance. o Moved functionality of Shutdown (component not cl tool) into Server ( which is bound as jboss.system:service=Server) o Moved more Runtime access from Info into Server. Exposed memory info as attributes. o Logging a WARN everywhere that uses System.getProperty(jboss.system.home) as that should go away soon/eventually. o Initialized the invokerMap in the harmi impl to avoid NPE o Made getopt.jar a member of the lib/* dir instead of adding it to the run.jar and shutdown.jars each time. o Minor cosmetic changes along the way. Revision ChangesPath 1.9 +3 -9 jboss/src/main/org/jboss/deployment/AutoDeployer.java Index: AutoDeployer.java === RCS file: /cvsroot/jboss/jboss/src/main/org/jboss/deployment/AutoDeployer.java,v retrieving revision 1.8 retrieving revision 1.9 diff -u -r1.8 -r1.9 --- AutoDeployer.java 2002/01/02 17:06:54 1.8 +++ AutoDeployer.java 2002/01/03 04:00:57 1.9 @@ -4,6 +4,7 @@ * Distributable under LGPL license. * See terms of license at gnu.org. */ + package org.jboss.deployment; import java.io.File; @@ -58,15 +59,12 @@ * @author a href=mailto:[EMAIL PROTECTED];Toby Allsopp/a * @author a href=mailto:[EMAIL PROTECTED];David Maplesden/a * @author a href=mailto:[EMAIL PROTECTED];Andreas Schaefer/a - * @version $Revision: 1.8 $ + * @version $Revision: 1.9 $ */ public class AutoDeployer extends ServiceMBeanSupport implements AutoDeployerMBean, NotificationListener, Runnable { - // Constants - - // Attributes - /** * Callback to the JMX agent. */ @@ -143,7 +141,7 @@ */ public AutoDeployer(String urlList) { - this(J2EE:service=J2eeDeployer, urlList); + this(jboss.j2ee:service=J2eeDeployer, urlList); } /** @@ -592,8 +590,6 @@ } } - // Protected - - /** * Scan the watched directories list, add new deployement entires for each * that does not already exist in the watched urls map. @@ -729,8 +725,6 @@ throw e.getTargetError(); } } - - // Inner classes - /** * This class holds info about a deployement, such as the URL and the last 1.16 +96 -101 jboss/src/main/org/jboss/deployment/DeployerMBeanSupport.java Index: DeployerMBeanSupport.java === RCS file: /cvsroot/jboss/jboss/src/main/org/jboss/deployment/DeployerMBeanSupport.java,v retrieving revision 1.15 retrieving revision 1.16 diff -u -r1.15 -r1.16 --- DeployerMBeanSupport.java 2001/12/18 22:59:37 1.15 +++ DeployerMBeanSupport.java 2002/01/03 04:00:57 1.16 @@ -1,9 +1,10 @@ /* -* JBoss, the OpenSource J2EE webOS -* -* Distributable under LGPL license. -* See terms of license at gnu.org. -*/ + * JBoss, the OpenSource J2EE webOS + * + * Distributable under LGPL license. + * See terms of license at gnu.org. + */ + package org.jboss.deployment; import java.io.File; @@ -30,35 +31,38 @@ import java.util.List; /** -* An abstract base class for deployer service implementations. -* -* @author a href=mailto:[EMAIL PROTECTED];Toby Allsopp/a -* @author a href=mailto:[EMAIL PROTECTED];David Jencks/a -* @author a href=mailto:[EMAIL PROTECTED];Marc Fleury/a -* @version $Revision: 1.15 $ -* -* pbRevisions:/b -* -* pb20010725 Toby Allsopp (patch from David Jencks)/b -* ulliAdded codegetDeployments/code method so that subclasses -* can find out what has been deployed./li/ul -* pb20011219 Marc Fleury/b -* ulliFactored out inner class for deployment info/li/ul -*/ + * An abstract base class for deployer service implementations.
[JBoss-dev] CVS update: jboss/src/main/org/jboss/deployment AutoDeployer.java
User: starksm Date: 01/12/28 16:06:50 Modified:src/main/org/jboss/deployment Tag: Branch_2_4 AutoDeployer.java Log: Fix problem with double deployment of unpackage archives when the archive is explictly listed in the deployer url list and a child directory in a directoy of the url list. Revision ChangesPath No revision No revision 1.7.2.2 +30 -36jboss/src/main/org/jboss/deployment/AutoDeployer.java Index: AutoDeployer.java === RCS file: /cvsroot/jboss/jboss/src/main/org/jboss/deployment/AutoDeployer.java,v retrieving revision 1.7.2.1 retrieving revision 1.7.2.2 diff -u -r1.7.2.1 -r1.7.2.2 --- AutoDeployer.java 2001/12/10 02:35:36 1.7.2.1 +++ AutoDeployer.java 2001/12/29 00:06:50 1.7.2.2 @@ -46,7 +46,7 @@ * @author Rickard Öberg ([EMAIL PROTECTED]) * @author Toby Allsopp ([EMAIL PROTECTED]) * @author [EMAIL PROTECTED] - * @version $Revision: 1.7.2.1 $ + * @version $Revision: 1.7.2.2 $ */ public class AutoDeployer extends ServiceMBeanSupport @@ -73,11 +73,8 @@ // Watch these directories for new files ArrayList watchedDirectories = new ArrayList(); - // These URL's have been deployed. Check for new timestamp - HashMap deployedURLs = new HashMap(); - // These URL's are being watched - ArrayList watchedURLs = new ArrayList(); + HashMap watchedURLs = new HashMap(); // URL list String urlList = ; @@ -166,56 +163,53 @@ File[] files = dir.listFiles(); for (int idx = 0; idx files.length; idx++) { - URL fileUrl = files[idx].toURL(); + URL fileURL = files[idx].toURL(); // Check if it's a deployable file for (int j=0; jdeployerNames.length; ++j) { - if (!deployableFilters[j].accept(null, fileUrl.getFile())) + if (!deployableFilters[j].accept(null, fileURL.getFile())) continue; // Was not deployable - skip it... - - if (deployedURLs.get(fileUrl) == null) - { -// This file has not been seen before -// Add to list of files to deploy automatically -watchedURLs.add(new DeploymentInfo(fileUrl)); -deployedURLs.put(fileUrl, fileUrl); - } + if( watchedURLs.containsKey(fileURL) == false ) +watchedURLs.put(fileURL, new DeploymentInfo(fileURL)); } } } // undeploy removed jars -Iterator iterator = watchedURLs.iterator(); +Iterator iterator = watchedURLs.values().iterator(); -while (iterator.hasNext()) { - DeploymentInfo deployment = (DeploymentInfo)iterator.next(); +while (iterator.hasNext()) +{ + DeploymentInfo deployment = (DeploymentInfo) iterator.next(); URL url = deployment.url; // if the url is a file that doesn't exist // TODO: real urls - if (url.getProtocol().startsWith(file) ! new File(url.getFile()).exists()) { - + if (url.getProtocol().startsWith(file) ! new File(url.getFile()).exists()) + { // the file does not exist anymore. undeploy log.info(Auto undeploy of +url); - try { + try + { undeploy(url.toString(), deployment.deployerName); - } catch (Exception e) { + } + catch (Exception e) + { log.error(Undeployment failed, e); } - deployedURLs.remove(url); // this should be the safe way to call watchedURLS.remove iterator.remove(); } } - // Check watched URLs -for (int i = 0; i watchedURLs.size(); i++) +iterator = watchedURLs.values().iterator(); +while (iterator.hasNext()) { - DeploymentInfo deployment = (DeploymentInfo)watchedURLs.get(i); + DeploymentInfo deployment = (DeploymentInfo) iterator.next(); // Get last modified timestamp long lm; @@ -308,9 +302,8 @@ }; } } - - StringTokenizer urls = new StringTokenizer(urlList, ,); +
[JBoss-dev] CVS update: jboss/src/main/org/jboss/deployment AutoDeployer.java DeployerMBeanSupport.java ServiceDeployer.java
User: user57 Date: 01/12/08 21:24:25 Modified:src/main/org/jboss/deployment AutoDeployer.java DeployerMBeanSupport.java ServiceDeployer.java Log: o minor logging changes; trying to make the default configuration less verbose on console, enable debug on console Revision ChangesPath 1.7 +86 -52jboss/src/main/org/jboss/deployment/AutoDeployer.java Index: AutoDeployer.java === RCS file: /cvsroot/jboss/jboss/src/main/org/jboss/deployment/AutoDeployer.java,v retrieving revision 1.6 retrieving revision 1.7 diff -u -r1.6 -r1.7 --- AutoDeployer.java 2001/11/24 19:46:41 1.6 +++ AutoDeployer.java 2001/12/09 05:24:25 1.7 @@ -49,19 +49,20 @@ * MBeanServer). * * If another Auto Deployer is deployed by an AutoDeployer then the initial deployment - * must be switched of to avoid the auto deployment to hang (see {@link #setWithInitialRun - * setWithInitialRun()}). + * must be switched of to avoid the auto deployment to hang (see + * {@link #setWithInitialRun()}). * * @see org.jboss.deployment.J2eeDeployer + * * @author a href=mailto:[EMAIL PROTECTED];Rickard Öberg/a * @author a href=mailto:[EMAIL PROTECTED];Toby Allsopp/a * @author a href=mailto:[EMAIL PROTECTED];David Maplesden/a * @author a href=mailto:[EMAIL PROTECTED];Andreas Schaefer/a - * @version $Revision: 1.6 $ + * @version $Revision: 1.7 $ */ public class AutoDeployer extends ServiceMBeanSupport - implements AutoDeployerMBean, NotificationListener,Runnable + implements AutoDeployerMBean, NotificationListener, Runnable { // Constants - // Attributes @@ -280,16 +281,15 @@ // TODO: real urls if (url.getProtocol().startsWith(file) !new File(url.getFile()).exists()) { - // the file does not exist anymore. undeploy - log.info(Auto undeploy of + url); + log.info(Auto undeploying: + url); try { undeploy(url.toString(), deployment.deployerName); } catch (Exception e) { - log.error(Undeployment failed, e); + log.error(Undeployment failed: + url, e); } deployedURLs.remove(url); @@ -319,7 +319,7 @@ // Check old timestamp -- always deploy if first check if ((deployment.lastModified == 0) || (deployment.lastModified lm)) { - log.info(Auto deploy of + deployment.url); + log.info(Auto deploying: + deployment.url); deployment.lastModified = lm; try { @@ -327,8 +327,7 @@ } catch (Throwable e) { - log.error(Deployment failed: + deployment.url, e); - + log.error(Deployment failed: + deployment.url, e); // Deployment failed - won't retry until updated } } @@ -336,7 +335,8 @@ } catch (Exception e) { -log.fatal(auto deployer failure; can not continue, e); +log.fatal(can not continue; exiting main loop, e); + // Stop auto deployer running = false; } @@ -366,6 +366,8 @@ protected void startService() throws Exception { + boolean debug = log.isDebugEnabled(); + // Save JMX names of configured deployers StringTokenizer deployers = new StringTokenizer(deployerList, ;); deployerNames = new ObjectName[deployers.countTokens()]; @@ -379,8 +381,7 @@ } catch (MalformedObjectNameException mfone) { -log.warn(The string ' + deployerName + 'is not a valid + - object name - ignoring it.); +log.warn(Ignoring invalid object name: + deployerName); continue; } @@ -393,18 +394,14 @@ } catch (ReflectionException re) { -log.info(Deployer ' + deployerNames[i] + ' doesn't provide a + - filter - will try to deploy all files); -deployableFilters[i] = - new FilenameFilter() - { - /** - * #Description of the Method - * - * @param dir Description of Parameter - * @param filename
[JBoss-dev] CVS update: jboss/src/main/org/jboss/deployment AutoDeployer.java AutoDeployerMBean.java
User: schaefera Date: 01/11/12 11:59:18 Modified:src/main/org/jboss/deployment AutoDeployer.java AutoDeployerMBean.java Log: Finished 1. Version of the JBoss Farm. Now it uses the AutoDeployer and therefore FarmAutoDeployer became obsolete. The Farm now support also undeployment, copies a deployed file back to /deploy/farm when on a remote node and also removes it from there when undeployed on a remote node. Revision ChangesPath 1.5 +25 -4 jboss/src/main/org/jboss/deployment/AutoDeployer.java Index: AutoDeployer.java === RCS file: /cvsroot/jboss/jboss/src/main/org/jboss/deployment/AutoDeployer.java,v retrieving revision 1.4 retrieving revision 1.5 diff -u -r1.4 -r1.5 --- AutoDeployer.java 2001/09/11 18:34:59 1.4 +++ AutoDeployer.java 2001/11/12 19:59:18 1.5 @@ -49,11 +49,16 @@ * will not be deployed until that deployer does exist (is registered with main * MBeanServer). * + * If another Auto Deployer is deployed by an AutoDeployer then the initial deployment + * must be switched of to avoid the auto deployment to hang (see {@link #setWithInitialRun + * setWithInitialRun()}). + * * @see org.jboss.deployment.J2eeDeployer * @author a href=mailto:[EMAIL PROTECTED];Rickard Öberg/a * @author a href=mailto:[EMAIL PROTECTED];Toby Allsopp/a * @author a href=mailto:[EMAIL PROTECTED];David Maplesden/a - * @version $Revision: 1.4 $ + * @author a href=mailto:[EMAIL PROTECTED];Andreas Schaefer/a + * @version $Revision: 1.5 $ */ public class AutoDeployer extends ServiceMBeanSupport @@ -108,6 +113,12 @@ int timeout = 3000; /** +* WithInitialRun indicates if a deployment should be performed by the +* starting thread or not. Default is true. +*/ + boolean withInitialRun = true; + + /** * Filters, one per configured deployer, to decide which files are deployable * and which should be ignored. */ @@ -207,6 +218,14 @@ return timeout; } + public boolean isWithInitialRun() { + return withInitialRun; + } + + public void setWithInitialRun( boolean pWithInitialRun ) { + withInitialRun = pWithInitialRun; + } + // ServiceMBeanSupport overrides - /** @@ -484,9 +503,11 @@ // during the pre-deploy are not missed. server.addNotificationListener(new ObjectName(JMImplementation:type=MBeanServerDelegate),this,null,null); - // Pre-deploy. This is done so that deployments available - // on start of container is deployed ASAP - run(); + if( withInitialRun ) { + // Pre-deploy. This is done so that deployments available + // on start of container is deployed ASAP + run(); + } // Start auto deploy thread running = true; 1.2 +19 -1 jboss/src/main/org/jboss/deployment/AutoDeployerMBean.java Index: AutoDeployerMBean.java === RCS file: /cvsroot/jboss/jboss/src/main/org/jboss/deployment/AutoDeployerMBean.java,v retrieving revision 1.1 retrieving revision 1.2 diff -u -r1.1 -r1.2 --- AutoDeployerMBean.java2001/08/29 22:52:05 1.1 +++ AutoDeployerMBean.java2001/11/12 19:59:18 1.2 @@ -16,7 +16,7 @@ * * @author a href=mailto:[EMAIL PROTECTED];Rickard Öberg/a * @author a href=mailto:[EMAIL PROTECTED];Toby Allsopp/a - * @version $Revision: 1.1 $ + * @version $Revision: 1.2 $ */ public interface AutoDeployerMBean extends ServiceMBean @@ -67,6 +67,24 @@ * @return The timeout in miliseconds */ int getTimeout(); + + /** +* @return True if this Auto Deployer runs a initial deployment in the starting +* thread +**/ + public boolean isWithInitialRun(); + + /** +* Set if the AutoDeployer should run an intial deployment in the starting +* thread or wait until the deployer thread picks it up. This is important +* to be set to false when the AutoDeployer is deployed within a service +* deployed by the AutoDeployer because this causes the entire auto deployment +* to hand. +* +* @param pWithInitialRun True if the initial run should be performed by the +*starting thread. +**/ + public void setWithInitialRun( boolean pWithInitialRun ); } ___ Jboss-development mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/jboss-development
[JBoss-dev] CVS update: jboss/src/main/org/jboss/deployment AutoDeployer.java DeployerMBeanSupport.java Installer.java J2eeDeployer.java ServiceDeployer.java
User: starksm Date: 01/09/11 11:34:59 Modified:src/main/org/jboss/deployment AutoDeployer.java DeployerMBeanSupport.java Installer.java J2eeDeployer.java ServiceDeployer.java Log: Convert all logging to org.jboss.logging.Logger which is a subclass of org.apache.log4j.Category. Revision ChangesPath 1.4 +1 -6 jboss/src/main/org/jboss/deployment/AutoDeployer.java Index: AutoDeployer.java === RCS file: /cvsroot/jboss/jboss/src/main/org/jboss/deployment/AutoDeployer.java,v retrieving revision 1.3 retrieving revision 1.4 diff -u -r1.3 -r1.4 --- AutoDeployer.java 2001/09/11 02:45:45 1.3 +++ AutoDeployer.java 2001/09/11 18:34:59 1.4 @@ -28,7 +28,6 @@ import javax.management.NotificationListener; import javax.management.Notification; import javax.management.MBeanServerNotification; -import org.jboss.logging.log4j.JBossCategory; import org.jboss.system.ServiceMBeanSupport; @@ -54,7 +53,7 @@ * @author a href=mailto:[EMAIL PROTECTED];Rickard Öberg/a * @author a href=mailto:[EMAIL PROTECTED];Toby Allsopp/a * @author a href=mailto:[EMAIL PROTECTED];David Maplesden/a - * @version $Revision: 1.3 $ + * @version $Revision: 1.4 $ */ public class AutoDeployer extends ServiceMBeanSupport @@ -62,10 +61,6 @@ { // Constants - // Attributes - - /** Instance logger. */ - private JBossCategory log = (JBossCategory) - JBossCategory.getInstance(this.getClass()); /** * Callback to the JMX agent. 1.6 +3 -3 jboss/src/main/org/jboss/deployment/DeployerMBeanSupport.java Index: DeployerMBeanSupport.java === RCS file: /cvsroot/jboss/jboss/src/main/org/jboss/deployment/DeployerMBeanSupport.java,v retrieving revision 1.5 retrieving revision 1.6 diff -u -r1.5 -r1.6 --- DeployerMBeanSupport.java 2001/08/29 22:53:00 1.5 +++ DeployerMBeanSupport.java 2001/09/11 18:34:59 1.6 @@ -19,7 +19,7 @@ * An abstract base class for deployer service implementations. * * @author a href=mailto:[EMAIL PROTECTED];Toby Allsopp/a - * @version $Revision: 1.5 $ + * @version $Revision: 1.6 $ * * pbRevisions:/b * @@ -60,7 +60,7 @@ } catch (Throwable t) { - log.exception(t); + log.error(undeploy failed, t); if (t instanceof Exception) { if (t instanceof IOException) throw (IOException) t; @@ -78,7 +78,7 @@ } catch (Throwable t) { -log.exception(t); +log.error(deploy failed, t); if (t instanceof Exception) { if (t instanceof IOException) throw (IOException) t; 1.14 +1 -2 jboss/src/main/org/jboss/deployment/Installer.java Index: Installer.java === RCS file: /cvsroot/jboss/jboss/src/main/org/jboss/deployment/Installer.java,v retrieving revision 1.13 retrieving revision 1.14 diff -u -r1.13 -r1.14 --- Installer.java2001/09/06 18:48:28 1.13 +++ Installer.java2001/09/11 18:34:59 1.14 @@ -39,7 +39,6 @@ import javax.management.JMException; import javax.management.ObjectName; -import org.jboss.logging.Log; import org.jboss.util.MBeanProxy; import org.jboss.system.ServiceMBeanSupport; @@ -57,7 +56,7 @@ * * @see related * @author a href=mailto:[EMAIL PROTECTED];Daniel Schulze/a - * @version $Revision: 1.13 $ + * @version $Revision: 1.14 $ */ public class Installer { 1.41 +34 -35jboss/src/main/org/jboss/deployment/J2eeDeployer.java Index: J2eeDeployer.java === RCS file: /cvsroot/jboss/jboss/src/main/org/jboss/deployment/J2eeDeployer.java,v retrieving revision 1.40 retrieving revision 1.41 diff -u -r1.40 -r1.41 --- J2eeDeployer.java 2001/08/29 22:53:00 1.40 +++ J2eeDeployer.java 2001/09/11 18:34:59 1.41 @@ -41,9 +41,10 @@ import javax.management.RuntimeMBeanException; import javax.management.RuntimeErrorException; -import org.jboss.logging.Log; -import org.jboss.util.MBeanProxy; + +import org.jboss.logging.Logger; import org.jboss.system.ServiceMBeanSupport; +import org.jboss.util.MBeanProxy; import org.jboss.ejb.DeploymentException; import org.jboss.ejb.ContainerFactoryMBean; @@ -66,11 +67,11 @@ * @author a href=mailto:[EMAIL PROTECTED];Daniel Schulze/a * @author a
[JBoss-dev] CVS update: jboss/src/main/org/jboss/deployment AutoDeployer.java
User: dmaplesden Date: 01/09/10 19:45:46 Modified:src/main/org/jboss/deployment AutoDeployer.java Log: Altered so that the AutoDeployer can be deployed before the individual deployers it uses. Revision ChangesPath 1.3 +90 -19jboss/src/main/org/jboss/deployment/AutoDeployer.java Index: AutoDeployer.java === RCS file: /cvsroot/jboss/jboss/src/main/org/jboss/deployment/AutoDeployer.java,v retrieving revision 1.2 retrieving revision 1.3 diff -u -r1.2 -r1.3 --- AutoDeployer.java 2001/09/08 17:08:32 1.2 +++ AutoDeployer.java 2001/09/11 02:45:45 1.3 @@ -24,6 +24,10 @@ import javax.management.ReflectionException; import javax.management.RuntimeErrorException; import javax.management.RuntimeMBeanException; +import javax.management.InstanceNotFoundException; +import javax.management.NotificationListener; +import javax.management.Notification; +import javax.management.MBeanServerNotification; import org.jboss.logging.log4j.JBossCategory; import org.jboss.system.ServiceMBeanSupport; @@ -40,19 +44,29 @@ * that directory will be watched separately. p * * When a file is to be deployed, the AutoDeployer will use the configured - * deployer to deploy it. + * deployer to deploy it. p * + * If a given deployer mbean does not exist at startup, files for that deployer + * will not be deployed until that deployer does exist (is registered with main + * MBeanServer). + * * @see org.jboss.deployment.J2eeDeployer * @author a href=mailto:[EMAIL PROTECTED];Rickard Öberg/a * @author a href=mailto:[EMAIL PROTECTED];Toby Allsopp/a - * @author a href=mailto:[EMAIL PROTECTED];Jason Dillon/a - * @version $Revision: 1.2 $ + * @author a href=mailto:[EMAIL PROTECTED];David Maplesden/a + * @version $Revision: 1.3 $ */ public class AutoDeployer extends ServiceMBeanSupport - implements AutoDeployerMBean, Runnable + implements AutoDeployerMBean, NotificationListener,Runnable { + // Constants - + // Attributes + /** Instance logger. */ + private JBossCategory log = (JBossCategory) + JBossCategory.getInstance(this.getClass()); + /** * Callback to the JMX agent. */ @@ -103,18 +117,7 @@ * and which should be ignored. */ FilenameFilter[] deployableFilters; - // Constants - - // Attributes - - /** -* Instance logger. -*/ - private JBossCategory log = (JBossCategory) - JBossCategory.getInstance(this.getClass()); - - // = null; - // Static // Constructors -- @@ -395,6 +398,12 @@ } }; } + catch (InstanceNotFoundException e) + { +log.info(Deployer ' + deployerNames[i] + ' isn't yet registered + +files for this deployer will not be deployed until it is deployed.); +deployableFilters[i] = null; + } } StringTokenizer urls = new StringTokenizer(urlList, ,); @@ -475,6 +484,11 @@ } } + // listen for the deployers to be deployed or undeployed + // has to be done before the pre-deploy below so that deployers deployed + // during the pre-deploy are not missed. + server.addNotificationListener(new ObjectName(JMImplementation:type=MBeanServerDelegate),this,null,null); + // Pre-deploy. This is done so that deployments available // on start of container is deployed ASAP run(); @@ -482,8 +496,65 @@ // Start auto deploy thread running = true; new Thread(this, AutoDeployer).start(); + } + public void handleNotification(Notification notification, Object handback) + { + String type = notification.getType(); + if(type.equals(MBeanServerNotification.REGISTRATION_NOTIFICATION)) + { + ObjectName mbean = ((MBeanServerNotification)notification).getMBeanName(); + + log.debug(Received notification of mbean +mbean+'s deployment.); + + for(int i=0; ideployerNames.length; i++) + { +if(deployerNames[i].equals(mbean)) +{ + log.info(Deployer ' + deployerNames[i] + ' deployed, + + now available for deployments.); + try + { + deployableFilters[i] = (FilenameFilter) server.invoke( +