[JBoss-dev] CVS update: jboss/src/main/org/jboss/ejb AutoDeployer.java AutoDeployerMBean.java
User: starksm Date: 01/11/09 02:36:41 Modified:src/main/org/jboss/ejb Tag: Branch_2_4 AutoDeployer.java AutoDeployerMBean.java Log: Externalize the deployment timeout check Revision ChangesPath No revision No revision 1.17.4.2 +25 -2 jboss/src/main/org/jboss/ejb/Attic/AutoDeployer.java Index: AutoDeployer.java === RCS file: /cvsroot/jboss/jboss/src/main/org/jboss/ejb/Attic/AutoDeployer.java,v retrieving revision 1.17.4.1 retrieving revision 1.17.4.2 diff -u -r1.17.4.1 -r1.17.4.2 --- AutoDeployer.java 2001/10/20 22:13:22 1.17.4.1 +++ AutoDeployer.java 2001/11/09 10:36:41 1.17.4.2 @@ -46,7 +46,7 @@ * @see org.jboss.deployment.J2eeDeployer * @author Rickard Öberg ([EMAIL PROTECTED]) * @author Toby Allsopp ([EMAIL PROTECTED]) - * @version $Revision: 1.17.4.1 $ + * @version $Revision: 1.17.4.2 $ */ public class AutoDeployer extends ServiceMBeanSupport @@ -64,6 +64,8 @@ /** JMX names of the configured deployers */ ObjectName[] deployerNames; + /** Deployment check interval */ + int timeout = 3000; // The watch thread boolean running = false; @@ -113,6 +115,27 @@ return urlList; } + /** +* Gets the Timeout attribute of the AutoDeployer object +* +* @return The Timeout value +*/ + public int getTimeout() + { + return timeout; + } + + /** +* Sets the Timeout attribute of the AutoDeployer object +* +* @param to The new Timeout value +*/ + public void setTimeout(int to) + { + this.timeout = to; + } + + public void setDeployers(String deployers) { this.deployerList = deployers; @@ -131,7 +154,7 @@ // Sleep if (running) { -try { Thread.sleep(3); } catch (InterruptedException e) {} +try { Thread.sleep(timeout); } catch (InterruptedException e) {} } try 1.4.4.1 +3 -1 jboss/src/main/org/jboss/ejb/Attic/AutoDeployerMBean.java Index: AutoDeployerMBean.java === RCS file: /cvsroot/jboss/jboss/src/main/org/jboss/ejb/Attic/AutoDeployerMBean.java,v retrieving revision 1.4 retrieving revision 1.4.4.1 diff -u -r1.4 -r1.4.4.1 --- AutoDeployerMBean.java2001/04/16 06:03:51 1.4 +++ AutoDeployerMBean.java2001/11/09 10:36:41 1.4.4.1 @@ -15,7 +15,7 @@ * @see AutoDeployer * @author Rickard Öberg ([EMAIL PROTECTED]) * @author Toby Allsopp ([EMAIL PROTECTED]) - * @version $Revision: 1.4 $ + * @version $Revision: 1.4.4.1 $ */ public interface AutoDeployerMBean extends ServiceMBean @@ -26,6 +26,8 @@ // Public public void setURLs(String urlList); public String getURLs(); + public int getTimeout(); + public void setTimeout(int timeoutMS); public void setDeployers(String deployers); public String getDeployers(); } ___ Jboss-development mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/jboss-development
[JBoss-dev] CVS update: jboss/src/main/org/jboss/ejb AutoDeployer.java
User: user57 Date: 01/08/16 14:24:48 Modified:src/main/org/jboss/ejb AutoDeployer.java Log: o changed Category to JBossCategory and the Wait for... message priority to trace. o factored directory scanning out of run() into scanDirectories() and scanDirectory(). o changed startService() to scanDirectory() on each watched directory, so that deployments can be ordered (at least with respect to other urls that are specified). Revision ChangesPath 1.22 +95 -56jboss/src/main/org/jboss/ejb/AutoDeployer.java Index: AutoDeployer.java === RCS file: /cvsroot/jboss/jboss/src/main/org/jboss/ejb/AutoDeployer.java,v retrieving revision 1.21 retrieving revision 1.22 diff -u -r1.21 -r1.22 --- AutoDeployer.java 2001/08/15 15:13:45 1.21 +++ AutoDeployer.java 2001/08/16 21:24:48 1.22 @@ -25,9 +25,8 @@ import javax.management.RuntimeErrorException; import javax.management.RuntimeMBeanException; -import org.apache.log4j.Category; - import org.jboss.util.ServiceMBeanSupport; +import org.jboss.logging.log4j.JBossCategory; /** * The AutoDeployer is used to automatically deploy applications or @@ -44,10 +43,11 @@ *configured deployer to deploy it. * * @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.21 $ + * @version $Revision: 1.22 $ */ public class AutoDeployer extends ServiceMBeanSupport @@ -58,42 +58,46 @@ // Attributes /** Instance logger. */ - private Category log = Category.getInstance(this.getClass()); + private JBossCategory log = (JBossCategory) + JBossCategory.getInstance(this.getClass()); - // Callback to the JMX agent + /** Callback to the JMX agent. */ MBeanServer server; - // in case more then one J2eeDeployers are available + /** In case more then one J2eeDeployers are available. */ String deployerList = ; /** JMX names of the configured deployers */ ObjectName[] deployerNames; - // The watch thread + /** The watch thread. */ boolean running = false; - // Watch these directories for new files + /** Watch these directories for new files. */ ArrayList watchedDirectories = new ArrayList(); - // These URL's have been deployed. Check for new timestamp + /** These URL's have been deployed. Check for new timestamp. */ HashMap deployedURLs = new HashMap(); - // These URL's are being watched + /** These URL's are being watched. */ ArrayList watchedURLs = new ArrayList(); - // URL list + /** URL list. */ String urlList = ; - // TimeOut that in case of big ears to deploy should be set high enough + /** TimeOut that in case of big ears to deploy should be set high enough. */ int timeout = 3000; - /** Filters, one per configured deployer, to decide which files are - deployable and which should be ignored */ - FilenameFilter[] deployableFilters = null; + /** +* Filters, one per configured deployer, to decide which files are +* deployable and which should be ignored. +*/ + FilenameFilter[] deployableFilters; // = null; // Static // Constructors -- + public AutoDeployer() { this(); @@ -101,7 +105,7 @@ public AutoDeployer(String urlList) { - this (J2EE:service=J2eeDeployer, urlList); + this(J2EE:service=J2eeDeployer, urlList); } public AutoDeployer(String _namedDeployer, String urlList) @@ -141,6 +145,7 @@ } // Public + public void run() { do @@ -150,41 +155,21 @@ { try { - if (log.isDebugEnabled()) log.debug(Wait for +timeout / 1000 + seconds); + if (log.isTraceEnabled()) { + log.trace(Wait for +timeout / 1000 + seconds); + } Thread.sleep(timeout); -} catch (InterruptedException e) {} +} catch (InterruptedException e) { + log.debug(interrupted; ignoring, e); +} } try { // Check directories - add new entries to list of files -for (int i = 0; i watchedDirectories.size(); i++) -{ - File dir = (File)watchedDirectories.get(i); -
[JBoss-dev] CVS update: jboss/src/main/org/jboss/ejb AutoDeployer.java
User: user57 Date: 01/08/16 17:19:23 Modified:src/main/org/jboss/ejb AutoDeployer.java Log: o log an info message when scanDirectory finds a file to deploy Revision ChangesPath 1.23 +2 -1 jboss/src/main/org/jboss/ejb/AutoDeployer.java Index: AutoDeployer.java === RCS file: /cvsroot/jboss/jboss/src/main/org/jboss/ejb/AutoDeployer.java,v retrieving revision 1.22 retrieving revision 1.23 diff -u -r1.22 -r1.23 --- AutoDeployer.java 2001/08/16 21:24:48 1.22 +++ AutoDeployer.java 2001/08/17 00:19:23 1.23 @@ -47,7 +47,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];Jason Dillon/a - * @version $Revision: 1.22 $ + * @version $Revision: 1.23 $ */ public class AutoDeployer extends ServiceMBeanSupport @@ -411,6 +411,7 @@ // Add to list of files to deploy automatically watchedURLs.add(new Deployment(fileUrl)); deployedURLs.put(fileUrl, fileUrl); + log.info(Auto-deploying + fileUrl); } } } ___ Jboss-development mailing list [EMAIL PROTECTED] http://lists.sourceforge.net/lists/listinfo/jboss-development
[JBoss-dev] CVS update: jboss/src/main/org/jboss/ejb AutoDeployer.java AutoDeployerMBean.java
User: vharcq Date: 01/08/15 08:13:45 Modified:src/main/org/jboss/ejb AutoDeployer.java AutoDeployerMBean.java Log: Parametrize the timeout that the deployer takes before coming again looking at the directory for new Xars to deploy. Revision ChangesPath 1.21 +19 -2 jboss/src/main/org/jboss/ejb/AutoDeployer.java Index: AutoDeployer.java === RCS file: /cvsroot/jboss/jboss/src/main/org/jboss/ejb/AutoDeployer.java,v retrieving revision 1.20 retrieving revision 1.21 diff -u -r1.20 -r1.21 --- AutoDeployer.java 2001/08/03 17:15:43 1.20 +++ AutoDeployer.java 2001/08/15 15:13:45 1.21 @@ -47,7 +47,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];Jason Dillon/a - * @version $Revision: 1.20 $ + * @version $Revision: 1.21 $ */ public class AutoDeployer extends ServiceMBeanSupport @@ -84,6 +84,9 @@ // URL list String urlList = ; + // TimeOut that in case of big ears to deploy should be set high enough + int timeout = 3000; + /** Filters, one per configured deployer, to decide which files are deployable and which should be ignored */ FilenameFilter[] deployableFilters = null; @@ -127,6 +130,16 @@ return deployerList; } + public void setTimeout(int to) + { + this.timeout = to; + } + + public int getTimeout() + { + return timeout; + } + // Public public void run() { @@ -135,7 +148,11 @@ // Sleep if (running) { -try { Thread.sleep(3000); } catch (InterruptedException e) {} +try +{ + if (log.isDebugEnabled()) log.debug(Wait for +timeout / 1000 + seconds); + Thread.sleep(timeout); +} catch (InterruptedException e) {} } try 1.8 +18 -1 jboss/src/main/org/jboss/ejb/AutoDeployerMBean.java Index: AutoDeployerMBean.java === RCS file: /cvsroot/jboss/jboss/src/main/org/jboss/ejb/AutoDeployerMBean.java,v retrieving revision 1.7 retrieving revision 1.8 diff -u -r1.7 -r1.8 --- AutoDeployerMBean.java2001/08/03 17:15:43 1.7 +++ AutoDeployerMBean.java2001/08/15 15:13:45 1.8 @@ -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.7 $ + * @version $Revision: 1.8 $ */ public interface AutoDeployerMBean extends ServiceMBean @@ -51,5 +51,22 @@ * @return The list of deployers that is currently being used. */ String getDeployers(); + + /** +* Set the time in milli seconds the AutoDeployer have to sleep before +* looking again for new files. +* +* @param to Timeout in miliseconds +*/ + void setTimeout(int to); + + /** +* Return the time in milli seconds the AutoDeployer have to sleep before +* looking again for new files. +* +* @return The timeout in miliseconds +*/ + int getTimeout(); + } ___ Jboss-development mailing list [EMAIL PROTECTED] http://lists.sourceforge.net/lists/listinfo/jboss-development
[JBoss-dev] CVS update: jboss/src/main/org/jboss/ejb AutoDeployer.java
User: user57 Date: 01/07/09 21:41:29 Modified:src/main/org/jboss/ejb AutoDeployer.java Log: o using log4j Revision ChangesPath 1.19 +36 -34jboss/src/main/org/jboss/ejb/AutoDeployer.java Index: AutoDeployer.java === RCS file: /cvsroot/jboss/jboss/src/main/org/jboss/ejb/AutoDeployer.java,v retrieving revision 1.18 retrieving revision 1.19 diff -u -r1.18 -r1.19 --- AutoDeployer.java 2001/06/18 20:01:21 1.18 +++ AutoDeployer.java 2001/07/10 04:41:29 1.19 @@ -25,28 +25,29 @@ import javax.management.RuntimeErrorException; import javax.management.RuntimeMBeanException; -import org.jboss.logging.Log; -import org.jboss.util.ServiceMBeanSupport; +import org.apache.log4j.Category; +import org.jboss.util.ServiceMBeanSupport; /** - * The AutoDeployer is used to automatically deploy applications or - * components thereof. + * The AutoDeployer is used to automatically deploy applications or + * components thereof. * - * p It can be used on either .jar or .xml files. The AutoDeployer - * can be configured to watch one or more files. If they are - * updated they will be redeployed. + * pIt can be used on either .jar or .xml files. The AutoDeployer + *can be configured to watch one or more files. If they are + *updated they will be redeployed. * - * p If it is set to watch a directory instead of a single file, - * all files within that directory will be watched separately. + * pIf it is set to watch a directory instead of a single file, + *all files within that directory will be watched separately. * - * p When a file is to be deployed, the AutoDeployer will use the - * configured deployer to deploy it. + * pWhen a file is to be deployed, the AutoDeployer will use the + *configured deployer to deploy it. * - * @see org.jboss.deployment.J2eeDeployer - * @author a href=mailto:[EMAIL PROTECTED];Rickard Öberg/a - * @author a href=mailto:[EMAIL PROTECTED];Toby Allsopp/a - * @version $Revision: 1.18 $ + * @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.19 $ */ public class AutoDeployer extends ServiceMBeanSupport @@ -56,6 +57,9 @@ // Attributes + /** Instance logger. */ + private Category log = Category.getInstance(this.getClass()); + // Callback to the JMX agent MBeanServer server; @@ -175,12 +179,11 @@ if (url.getProtocol().startsWith(file) ! new File(url.getFile()).exists()) { // the file does not exist anymore. undeploy - log.log(Auto undeploy of +url); + log.info(Auto undeploy of +url); try { undeploy(url.toString(), deployment.deployerName); } catch (Exception e) { - log.error(Undeployment failed); - log.exception(e); + log.error(Undeployment failed, e); } deployedURLs.remove(url); @@ -210,15 +213,14 @@ // Check old timestamp -- always deploy if first check if ((deployment.lastModified == 0) || (deployment.lastModified lm)) { - log.log(Auto deploy of +deployment.url); + log.info(Auto deploy of +deployment.url); deployment.lastModified = lm; try { deploy(deployment.url.toString(), deployment.deployerName); } catch (Throwable e) { - log.error(Deployment failed:+deployment.url); - log.exception(e); + log.error(Deployment failed:+deployment.url, e); // Deployment failed - won't retry until updated } @@ -226,22 +228,22 @@ } } catch (Exception e) { -e.printStackTrace(System.err); - - // Stop auto deployer +log.fatal(auto deployer failure; can not continue, e); +// Stop auto deployer running = false; } } while(running); } // ServiceMBeanSupport overrides - + public String getName() { return Auto deploy; } protected ObjectName getObjectName(MBeanServer server, ObjectName name) - throws
[JBoss-dev] CVS update: jboss/src/main/org/jboss/ejb AutoDeployer.java
User: tobyallsopp Date: 01/04/21 22:50:00 Modified:src/main/org/jboss/ejb AutoDeployer.java Log: I must be going crazy. That last commit didn't even compile, let alone run. Revision ChangesPath 1.16 +11 -9 jboss/src/main/org/jboss/ejb/AutoDeployer.java Index: AutoDeployer.java === RCS file: /cvsroot/jboss/jboss/src/main/org/jboss/ejb/AutoDeployer.java,v retrieving revision 1.15 retrieving revision 1.16 diff -u -r1.15 -r1.16 --- AutoDeployer.java 2001/04/22 05:28:25 1.15 +++ AutoDeployer.java 2001/04/22 05:50:00 1.16 @@ -6,22 +6,24 @@ */ package org.jboss.ejb; -import java.net.URL; -import java.net.URLClassLoader; -import java.net.MalformedURLException; import java.io.File; import java.io.FilenameFilter; import java.io.IOException; +import java.net.MalformedURLException; +import java.net.URL; +import java.net.URLClassLoader; +import java.util.ArrayList; +import java.util.HashMap; import java.util.Iterator; import java.util.StringTokenizer; -import java.util.HashMap; -import java.util.ArrayList; -import javax.management.MBeanServer; + import javax.management.MBeanException; +import javax.management.MBeanServer; +import javax.management.MalformedObjectNameException; +import javax.management.ObjectName; import javax.management.ReflectionException; import javax.management.RuntimeErrorException; import javax.management.RuntimeMBeanException; -import javax.management.ObjectName; import org.jboss.logging.Log; import org.jboss.util.ServiceMBeanSupport; @@ -44,7 +46,7 @@ * @see org.jboss.deployment.J2eeDeployer * @author Rickard Öberg ([EMAIL PROTECTED]) * @author Toby Allsopp ([EMAIL PROTECTED]) - * @version $Revision: 1.15 $ + * @version $Revision: 1.16 $ */ public class AutoDeployer extends ServiceMBeanSupport @@ -243,7 +245,7 @@ throws javax.management.MalformedObjectNameException { this.server = server; - return new ObjectName(OBJECT_NAME+deployerList); + return name==null ? new ObjectName(OBJECT_NAME) : name; } protected void startService() ___ Jboss-development mailing list [EMAIL PROTECTED] http://lists.sourceforge.net/lists/listinfo/jboss-development
[JBoss-dev] CVS update: jboss/src/main/org/jboss/ejb AutoDeployer.java
User: tobyallsopp Date: 01/04/21 23:02:08 Modified:src/main/org/jboss/ejb AutoDeployer.java Log: And now I'm using TABs for indenting. Will the horror never end? Revision ChangesPath 1.17 +20 -21jboss/src/main/org/jboss/ejb/AutoDeployer.java Index: AutoDeployer.java === RCS file: /cvsroot/jboss/jboss/src/main/org/jboss/ejb/AutoDeployer.java,v retrieving revision 1.16 retrieving revision 1.17 diff -u -r1.16 -r1.17 --- AutoDeployer.java 2001/04/22 05:50:00 1.16 +++ AutoDeployer.java 2001/04/22 06:02:08 1.17 @@ -46,7 +46,7 @@ * @see org.jboss.deployment.J2eeDeployer * @author Rickard Öberg ([EMAIL PROTECTED]) * @author Toby Allsopp ([EMAIL PROTECTED]) - * @version $Revision: 1.16 $ + * @version $Revision: 1.17 $ */ public class AutoDeployer extends ServiceMBeanSupport @@ -91,34 +91,33 @@ { this(); } - + public AutoDeployer(String urlList) { -this (J2EE:service=J2eeDeployer, urlList); + this (J2EE:service=J2eeDeployer, urlList); } - public AutoDeployer(String _namedDeployer, String urlList) { -setDeployers(_namedDeployer); -setURLs(urlList); + setDeployers(_namedDeployer); + setURLs(urlList); } - public void setURLs(String urlList) - { + public void setURLs(String urlList) + { this.urlList = urlList; } - + public String getURLs() { return urlList; } - + public void setDeployers(String deployers) { this.deployerList = deployers; } - + public String getDeployers() { return deployerList; @@ -258,16 +257,16 @@ for (int i=0; ideployerNames.length deployers.hasMoreTokens(); ++i) { String deployerName = deployers.nextToken().trim(); - try - { - deployerNames[i] = new ObjectName(deployerName); - } - catch (MalformedObjectNameException mfone) - { - log.warning(The string ' + deployerName + 'is not a valid + - object name - ignoring it.); - continue; - } + try + { +deployerNames[i] = new ObjectName(deployerName); + } + catch (MalformedObjectNameException mfone) + { +log.warning(The string ' + deployerName + 'is not a valid + +object name - ignoring it.); +continue; + } // Ask the deployer for a filter to detect deployable files try ___ Jboss-development mailing list [EMAIL PROTECTED] http://lists.sourceforge.net/lists/listinfo/jboss-development
[JBoss-dev] CVS update: jboss/src/main/org/jboss/ejb AutoDeployer.java
User: tobyallsopp Date: 01/04/21 22:28:25 Modified:src/main/org/jboss/ejb AutoDeployer.java Log: Changed the default deployer for AutoDeployer to a valid object name. Now having an invalid object name in the list of deployers will not cause the rest of the list to be discarded. Revision ChangesPath 1.15 +12 -3 jboss/src/main/org/jboss/ejb/AutoDeployer.java Index: AutoDeployer.java === RCS file: /cvsroot/jboss/jboss/src/main/org/jboss/ejb/AutoDeployer.java,v retrieving revision 1.14 retrieving revision 1.15 diff -u -r1.14 -r1.15 --- AutoDeployer.java 2001/04/16 06:03:50 1.14 +++ AutoDeployer.java 2001/04/22 05:28:25 1.15 @@ -44,7 +44,7 @@ * @see org.jboss.deployment.J2eeDeployer * @author Rickard Öberg ([EMAIL PROTECTED]) * @author Toby Allsopp ([EMAIL PROTECTED]) - * @version $Revision: 1.14 $ + * @version $Revision: 1.15 $ */ public class AutoDeployer extends ServiceMBeanSupport @@ -92,7 +92,7 @@ public AutoDeployer(String urlList) { -this (Default, urlList); +this (J2EE:service=J2eeDeployer, urlList); } @@ -256,7 +256,16 @@ for (int i=0; ideployerNames.length deployers.hasMoreTokens(); ++i) { String deployerName = deployers.nextToken().trim(); - deployerNames[i] = new ObjectName(deployerName); + try + { + deployerNames[i] = new ObjectName(deployerName); + } + catch (MalformedObjectNameException mfone) + { + log.warning(The string ' + deployerName + 'is not a valid + + object name - ignoring it.); + continue; + } // Ask the deployer for a filter to detect deployable files try ___ Jboss-development mailing list [EMAIL PROTECTED] http://lists.sourceforge.net/lists/listinfo/jboss-development
[JBoss-dev] CVS update: jboss/src/main/org/jboss/ejb AutoDeployer.java AutoDeployerMBean.java
User: tobyallsopp Date: 01/04/15 23:03:51 Modified:src/main/org/jboss/ejb AutoDeployer.java AutoDeployerMBean.java Log: Further to the recent AutoDeployer mods, this adds support to AutoDeployer for using multiple deployers so that a single AutoDeployer service can watch for all supported application components. What this means is that now you can deploy RARs by dropping them in deploy and you can deploy other types of component at server startup by putting them in deploy/lib (they get copied there from src/etc/edploy). Revision ChangesPath 1.14 +114 -102 jboss/src/main/org/jboss/ejb/AutoDeployer.java Index: AutoDeployer.java === RCS file: /cvsroot/jboss/jboss/src/main/org/jboss/ejb/AutoDeployer.java,v retrieving revision 1.13 retrieving revision 1.14 diff -u -r1.13 -r1.14 --- AutoDeployer.java 2001/04/15 05:41:21 1.13 +++ AutoDeployer.java 2001/04/16 06:03:50 1.14 @@ -44,7 +44,7 @@ * @see org.jboss.deployment.J2eeDeployer * @author Rickard Öberg ([EMAIL PROTECTED]) * @author Toby Allsopp ([EMAIL PROTECTED]) - * @version $Revision: 1.13 $ + * @version $Revision: 1.14 $ */ public class AutoDeployer extends ServiceMBeanSupport @@ -54,33 +54,33 @@ // Attributes - // Callback to the JMX agent + // Callback to the JMX agent MBeanServer server; - // in case more then one J2eeDeployers are available - String namedDeployer = ""; + // in case more then one J2eeDeployers are available + String deployerList = ""; - // JMX name of the ContainerFactory - ObjectName factoryName; + /** JMX names of the configured deployers */ + ObjectName[] deployerNames; - // The watch thread + // The watch thread boolean running = false; - // Watch these directories for new files + // Watch these directories for new files ArrayList watchedDirectories = new ArrayList(); - // These URL's have been deployed. Check for new timestamp + // These URL's have been deployed. Check for new timestamp HashMap deployedURLs = new HashMap(); - // These URL's are being watched + // These URL's are being watched ArrayList watchedURLs = new ArrayList(); // URL list String urlList = ""; - /** Filter to decide which files are deployable and which should be - ignored */ - FilenameFilter deployableFilter = null; + /** Filters, one per configured deployer, to decide which files are + deployable and which should be ignored */ + FilenameFilter[] deployableFilters = null; // Static @@ -98,7 +98,7 @@ public AutoDeployer(String _namedDeployer, String urlList) { -setDeployer(_namedDeployer); +setDeployers(_namedDeployer); setURLs(urlList); } @@ -112,14 +112,14 @@ return urlList; } - public void setDeployer(String deployer) + public void setDeployers(String deployers) { - this.namedDeployer = deployer; + this.deployerList = deployers; } - public String getDeployer() + public String getDeployers() { - return namedDeployer; + return deployerList; } // Public @@ -145,44 +145,48 @@ URL fileUrl = files[idx].toURL(); // Check if it's a deployable file - if (!deployableFilter.accept(null, fileUrl.getFile())) - continue; // Was not deployable - skip it... - - if (deployedURLs.get(fileUrl) == null) + for (int j=0; jdeployerNames.length; ++j) { - // This file has not been seen before - // Add to list of files to deploy automatically - watchedURLs.add(new Deployment(fileUrl, deployableFilter)); - deployedURLs.put(fileUrl, fileUrl); + 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 Deployment(fileUrl)); +deployedURLs.put(fileUrl, fileUrl); + } } } }
[JBoss-dev] CVS update: jboss/src/main/org/jboss/ejb AutoDeployer.java
User: tobyallsopp Date: 01/04/14 22:41:21 Modified:src/main/org/jboss/ejb AutoDeployer.java Log: Modified AutoDeployer so that it can be configured to deploy RARs (inspired by Patch #415321 from David Jencks). - added jboss-deployer target to build.xml that builds dist/external/jboss-deployer.jar which contains the classes required by deployers that implement org.jboss.deployment.DeployerMBean. - added a method to DeployerMBean: getDeployableFilter that returns a java.io.FilenameFilter that AutoDeployer uses to decide what it can deploy rather than using a hardcoded list of filename extensions. - made J2eeDeployerMBean extend DeployerMBean and added an implementation of getDeployableFilter to J2eeDeployer. - updated JBossCX jar so that RARDeployer implements getDeployableFilter. - added an AutoDeployer watching deploy/lib and using RARDeployer to jboss.jcml. - changed the JBossCX examples in jboss.jcml to use the Minerva resource adapters bundled with JBoss instead of the BlackBox adapters. - temporarily removed the Minerva XA resource adapter until Aaron fixes it. - some minor cosmetic changesto jboss.jcml. Revision ChangesPath 1.13 +46 -39jboss/src/main/org/jboss/ejb/AutoDeployer.java Index: AutoDeployer.java === RCS file: /cvsroot/jboss/jboss/src/main/org/jboss/ejb/AutoDeployer.java,v retrieving revision 1.12 retrieving revision 1.13 diff -u -r1.12 -r1.13 --- AutoDeployer.java 2001/03/25 20:27:04 1.12 +++ AutoDeployer.java 2001/04/15 05:41:21 1.13 @@ -10,6 +10,7 @@ import java.net.URLClassLoader; import java.net.MalformedURLException; import java.io.File; +import java.io.FilenameFilter; import java.io.IOException; import java.util.Iterator; import java.util.StringTokenizer; @@ -17,30 +18,33 @@ import java.util.ArrayList; import javax.management.MBeanServer; import javax.management.MBeanException; +import javax.management.ReflectionException; import javax.management.RuntimeErrorException; import javax.management.RuntimeMBeanException; import javax.management.ObjectName; import org.jboss.logging.Log; -import org.jboss.util.MBeanProxy; import org.jboss.util.ServiceMBeanSupport; -import org.jboss.deployment.J2eeDeployerMBean; /** - * The AutoDeployer is used to automatically deploy EJB-jars. - * It can be used on either .jar or .xml files. The AutoDeployer can - * be configured to "watch" one or more files. If they are updated they will - * be redeployed. + * The AutoDeployer is used to automatically deploy applications or + * components thereof. * - * If it is set to watch a directory instead of a single file, all files within that - * directory will be watched separately. + * p It can be used on either .jar or .xml files. The AutoDeployer + * can be configured to "watch" one or more files. If they are + * updated they will be redeployed. * - * When a jar is to be deployed, the AutoDeployer will use a ContainerFactory to deploy it. + * p If it is set to watch a directory instead of a single file, + * all files within that directory will be watched separately. * - * @see ContainerFactory + * p When a file is to be deployed, the AutoDeployer will use the + * configured deployer to deploy it. + * + * @see org.jboss.deployment.J2eeDeployer * @author Rickard Öberg ([EMAIL PROTECTED]) - * @version $Revision: 1.12 $ + * @author Toby Allsopp ([EMAIL PROTECTED]) + * @version $Revision: 1.13 $ */ public class AutoDeployer extends ServiceMBeanSupport @@ -74,6 +78,10 @@ // URL list String urlList = ""; + /** Filter to decide which files are deployable and which should be + ignored */ + FilenameFilter deployableFilter = null; + // Static // Constructors -- @@ -136,18 +144,15 @@ { URL fileUrl = files[idx].toURL(); - // Check if it's a JAR or zip or ear or war - if (!(fileUrl.getFile().endsWith(".jar") || -fileUrl.getFile().endsWith(".ear") || -fileUrl.getFile().endsWith(".war") || -fileUrl.getFile().endsWith(".zip"))) - continue; // Was not a JAR or zip - skip it... + // Check if it's a deployable file + if (!deployableFilter.accept(null, fileUrl.getFile())) + continue; // Was not deployable - skip it... if (deployedURLs.get(fileUrl) == null) {