[JBoss-dev] CVS update: jboss/src/main/org/jboss/deployment ServiceDeployer.java
User: user57 Date: 02/01/03 16:16:41 Modified:src/main/org/jboss/deployment ServiceDeployer.java Log: o change info to debug messages about deplying, the unified/universal deployer or some other hihgerlevel entry point will make a nice info log (once that has been written). Revision ChangesPath 1.23 +85 -53jboss/src/main/org/jboss/deployment/ServiceDeployer.java Index: ServiceDeployer.java === RCS file: /cvsroot/jboss/jboss/src/main/org/jboss/deployment/ServiceDeployer.java,v retrieving revision 1.22 retrieving revision 1.23 diff -u -r1.22 -r1.23 --- ServiceDeployer.java 2002/01/03 04:00:57 1.22 +++ ServiceDeployer.java 2002/01/04 00:16:41 1.23 @@ -22,6 +22,7 @@ import java.util.ListIterator; import java.util.Map; import java.util.StringTokenizer; + import javax.management.InstanceNotFoundException; import javax.management.MBeanException; import javax.management.MBeanServer; @@ -30,18 +31,22 @@ import javax.management.ReflectionException; import javax.management.RuntimeErrorException; import javax.management.RuntimeMBeanException; + import javax.xml.parsers.DocumentBuilder; import javax.xml.parsers.DocumentBuilderFactory; import javax.xml.parsers.ParserConfigurationException; -import org.jboss.system.Service; -import org.jboss.system.ServiceLibraries; -import org.jboss.system.ServiceMBeanSupport; + import org.w3c.dom.Document; import org.w3c.dom.Element; import org.w3c.dom.NodeList; import org.xml.sax.InputSource; import org.xml.sax.SAXException; +import org.jboss.system.Service; +import org.jboss.system.ServiceLibraries; +import org.jboss.system.ServiceMBeanSupport; +import org.jboss.system.ConfigurationException; + /** * This is the main Service Deployer API. * @@ -49,7 +54,7 @@ * @author a href=mailto:[EMAIL PROTECTED];Marc Fleury/a * @author a href=mailto:[EMAIL PROTECTED];David Maplesden/a * @author a href=mailto:[EMAIL PROTECTED];David Jencks/a - * @version $Revision: 1.22 $ p + * @version $Revision: 1.23 $ p * * b20010830 marc fleury:/b * ulinitial import @@ -70,7 +75,7 @@ *deploy. Made undeploy work, and implemented sar dependency management *and recursive deploy/undeploy. * /ol - + * * pb20010907 david maplesden:/b * ul * liAdded support for depends tag @@ -128,7 +133,7 @@ * @param dir Directory of candidate file. * @param filename Filename of candidate file. * @return Whether candidate file should be deployed by - * this deployer. + * this deployer. */ public boolean accept(File dir, String filename) { @@ -162,11 +167,16 @@ public Object deploy(URL url) throws MalformedURLException, IOException, DeploymentException { + boolean debug = log.isDebugEnabled(); + ServiceDeploymentInfo sdi = getSdi(url, true); if (sdi.state == ServiceDeploymentInfo.MBEANSLOADED) { - log.debug(document + url + is already deployed, undeploy first if you wish to redeploy); + if (debug) { +log.debug(document + url + +is already deployed, undeploy first if you wish to redeploy); + } return sdi; } @@ -189,19 +199,25 @@ try { NodeList lds = sdi.dd.getElementsByTagName(local-directory); -log.debug(about to copy + lds.getLength() + local directories); + +if (debug) + log.debug(about to copy + lds.getLength() + local directories); for (int i = 0; i lds.getLength(); i++) { Element ld = (Element)lds.item(i); String path = ld.getAttribute(path); - log.debug(about to copy local directory at + path); + + if (debug) log.debug(about to copy local directory at + path); log.warn(using jboss.system.home property); File jbossHomeDir = new File(System.getProperty(jboss.system.home)); - File localBaseDir = new File(jbossHomeDir, db+File.separator); - //Get the url of the local copy from the classloader. + File localBaseDir = new File(jbossHomeDir, db); + + // Get the url of the local copy from the classloader. URL localUrl = (URL)sdi.getClassUrls().get(0); - log.debug(copying from + localUrl.toString() + path); - log.debug(copying to + localBaseDir); + if (debug) { + log.debug(copying from +
[JBoss-dev] CVS update: jboss/src/main/org/jboss/deployment ServiceDeployer.java
User: starksm Date: 01/12/29 13:57:20 Modified:src/main/org/jboss/deployment ServiceDeployer.java Log: Fix the invalid file URL constructs that were using the platform dependent path seperator rather than '/'. Revision ChangesPath 1.21 +3 -3 jboss/src/main/org/jboss/deployment/ServiceDeployer.java Index: ServiceDeployer.java === RCS file: /cvsroot/jboss/jboss/src/main/org/jboss/deployment/ServiceDeployer.java,v retrieving revision 1.20 retrieving revision 1.21 diff -u -r1.20 -r1.21 --- ServiceDeployer.java 2001/12/20 06:11:12 1.20 +++ ServiceDeployer.java 2001/12/29 21:57:20 1.21 @@ -49,7 +49,7 @@ * @author a href=mailto:[EMAIL PROTECTED];Marc Fleury/a * @author a href=mailto:[EMAIL PROTECTED];David Maplesden/a * @author a href=mailto:[EMAIL PROTECTED];David Jencks/a -* @version $Revision: 1.20 $ p +* @version $Revision: 1.21 $ p * * b20010830 marc fleury:/b * ulinitial import @@ -406,9 +406,9 @@ } // Let's make sure the formatting of the codebase ends with the / -if (codebase.startsWith(file:) !codebase.endsWith(File.separator)) +if (codebase.startsWith(file:) !codebase.endsWith(/)) { - codebase += File.separator; + codebase += /; } else if (codebase.startsWith(http:) !codebase.endsWith(/)) { ___ Jboss-development mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/jboss-development
[JBoss-dev] CVS update: jboss/src/main/org/jboss/deployment ServiceDeployer.java ServiceDeploymentInfo.java
User: d_jencks Date: 01/12/19 17:22:49 Modified:src/main/org/jboss/deployment ServiceDeployer.java ServiceDeploymentInfo.java Log: Made undeploy work a little better Revision ChangesPath 1.19 +25 -6 jboss/src/main/org/jboss/deployment/ServiceDeployer.java Index: ServiceDeployer.java === RCS file: /cvsroot/jboss/jboss/src/main/org/jboss/deployment/ServiceDeployer.java,v retrieving revision 1.18 retrieving revision 1.19 diff -u -r1.18 -r1.19 --- ServiceDeployer.java 2001/12/19 03:36:11 1.18 +++ ServiceDeployer.java 2001/12/20 01:22:49 1.19 @@ -49,7 +49,7 @@ * @author a href=mailto:[EMAIL PROTECTED];Marc Fleury/a * @author a href=mailto:[EMAIL PROTECTED];David Maplesden/a * @author a href=mailto:[EMAIL PROTECTED];David Jencks/a -* @version $Revision: 1.18 $ p +* @version $Revision: 1.19 $ p * * b20010830 marc fleury:/b * ulinitial import @@ -289,8 +289,8 @@ if(url.toString().endsWith(/)) { sdi.addClassUrl(url); - sdi.createClassLoader(); - sdi.state = ServiceDeploymentInfo.CLASSESLOADED; + sdi.createClassLoader();//sets state also. + //sdi.state = ServiceDeploymentInfo.CLASSESLOADED; } else // That service is a file { @@ -334,7 +334,7 @@ } // end of for () throw new DeploymentException(No META-INF/jboss-service.xml found in alleged sar!); } - sdi.state = ServiceDeploymentInfo.CLASSESLOADED; + //sdi.state = ServiceDeploymentInfo.CLASSESLOADED; log.debug(got document jboss-service.xml from cl); } @@ -343,7 +343,7 @@ || localFile.getName().endsWith(.zip)) { sdi.createClassLoader(); - sdi.state = ServiceDeploymentInfo.CLASSESLOADED; + //sdi.state = ServiceDeploymentInfo.CLASSESLOADED; } //Not for us. else @@ -592,6 +592,7 @@ // FIXME track the dependencies in the service libraries ServiceLibraries.getLibraries().removeClassLoader(sdi.removeClassLoader()); + //set the state - we've removed the Cl //delete the copied directories if possible. sdi.cleanup(getLog()); @@ -691,8 +692,26 @@ { ObjectName name = (ObjectName)i.previous(); log.debug(undeploying mbean + name); + invoke(getServiceControllerName(), +stop, +new Object[] {name}, +new String[] {javax.management.ObjectName}); + } + for (ListIterator i = services.listIterator(lastService); i.hasPrevious();) + { + ObjectName name = (ObjectName)i.previous(); + log.debug(undeploying mbean + name); + invoke(getServiceControllerName(), +destroy, +new Object[] {name}, +new String[] {javax.management.ObjectName}); + } + for (ListIterator i = services.listIterator(lastService); i.hasPrevious();) + { + ObjectName name = (ObjectName)i.previous(); + log.debug(undeploying mbean + name); invoke(getServiceControllerName(), -undeploy, +remove, new Object[] {name}, new String[] {javax.management.ObjectName}); //we don't supply it any more, maybe someone else will later. 1.3 +16 -1 jboss/src/main/org/jboss/deployment/ServiceDeploymentInfo.java Index: ServiceDeploymentInfo.java === RCS file: /cvsroot/jboss/jboss/src/main/org/jboss/deployment/ServiceDeploymentInfo.java,v retrieving revision 1.2 retrieving revision 1.3 diff -u -r1.2 -r1.3 --- ServiceDeploymentInfo.java2001/12/19 06:58:43 1.2 +++ ServiceDeploymentInfo.java2001/12/20 01:22:49 1.3 @@ -28,7 +28,7 @@ * @author a href=mailto:[EMAIL PROTECTED];Marc Fleury/a * @author a href=mailto:[EMAIL PROTECTED];David Maplesden/a * @author a href=mailto:[EMAIL PROTECTED];David Jencks/a -* @version $Revision: 1.2 $ p +* @version $Revision: 1.3 $ p * * b20011211 marc fleury:/b * ul @@ -109,17 +109,32 @@ + /** +* The codecreateClassLoader/code method creates a classloader for the urls in the +* package this sdi represents and sets the state to CLASSESLOADED. +* +* @return an codeURLClassLoader/code value +*/ public URLClassLoader createClassLoader() { URL[] urlArray
[JBoss-dev] CVS update: jboss/src/main/org/jboss/deployment ServiceDeployer.java
User: d_jencks Date: 01/12/19 22:11:12 Modified:src/main/org/jboss/deployment ServiceDeployer.java Log: fixed logging a bit Revision ChangesPath 1.20 +4 -4 jboss/src/main/org/jboss/deployment/ServiceDeployer.java Index: ServiceDeployer.java === RCS file: /cvsroot/jboss/jboss/src/main/org/jboss/deployment/ServiceDeployer.java,v retrieving revision 1.19 retrieving revision 1.20 diff -u -r1.19 -r1.20 --- ServiceDeployer.java 2001/12/20 01:22:49 1.19 +++ ServiceDeployer.java 2001/12/20 06:11:12 1.20 @@ -49,7 +49,7 @@ * @author a href=mailto:[EMAIL PROTECTED];Marc Fleury/a * @author a href=mailto:[EMAIL PROTECTED];David Maplesden/a * @author a href=mailto:[EMAIL PROTECTED];David Jencks/a -* @version $Revision: 1.19 $ p +* @version $Revision: 1.20 $ p * * b20010830 marc fleury:/b * ulinitial import @@ -691,7 +691,7 @@ for (ListIterator i = services.listIterator(lastService); i.hasPrevious();) { ObjectName name = (ObjectName)i.previous(); - log.debug(undeploying mbean + name); + log.debug(stopping mbean + name); invoke(getServiceControllerName(), stop, new Object[] {name}, @@ -700,7 +700,7 @@ for (ListIterator i = services.listIterator(lastService); i.hasPrevious();) { ObjectName name = (ObjectName)i.previous(); - log.debug(undeploying mbean + name); + log.debug(destroying mbean + name); invoke(getServiceControllerName(), destroy, new Object[] {name}, @@ -709,7 +709,7 @@ for (ListIterator i = services.listIterator(lastService); i.hasPrevious();) { ObjectName name = (ObjectName)i.previous(); - log.debug(undeploying mbean + name); + log.debug(removing mbean + name); invoke(getServiceControllerName(), remove, new Object[] {name}, ___ Jboss-development mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/jboss-development
[JBoss-dev] CVS update: jboss/src/main/org/jboss/deployment ServiceDeployer.java
User: mnf999 Date: 01/12/18 19:36:12 Modified:src/main/org/jboss/deployment ServiceDeployer.java Log: Factored out the ServiceDeploymentInfo, rewrote the deployer to do create and start as part of the page deployment Revision ChangesPath 1.18 +476 -553 jboss/src/main/org/jboss/deployment/ServiceDeployer.java Index: ServiceDeployer.java === RCS file: /cvsroot/jboss/jboss/src/main/org/jboss/deployment/ServiceDeployer.java,v retrieving revision 1.17 retrieving revision 1.18 diff -u -r1.17 -r1.18 --- ServiceDeployer.java 2001/12/09 05:24:25 1.17 +++ ServiceDeployer.java 2001/12/19 03:36:11 1.18 @@ -1,9 +1,9 @@ /* - * 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; @@ -43,289 +43,307 @@ import org.xml.sax.SAXException; /** - * This is the main Service Deployer API. - * - * @see org.jboss.system.Service - * @author a href=mailto:[EMAIL PROTECTED];Marc Fleury/a - * @author a href=mailto:[EMAIL PROTECTED];David Maplesden/a - * @author a href=mailto:[EMAIL PROTECTED];David Jencks/a - * @version $Revision: 1.17 $ p - * - * b20010830 marc fleury:/b - * ulinitial import - *li - * /ul - * - * pb20010905 david maplesden:/b - * ul - * liChanged deployment procedure to deploy all listed mbeans, then - * initialise them all before finally starting them all. Changed services - * sets to lists to maintain ordering. - * /ul - * - * b20010908 david jencks/b - * ol - *li fixed tabs to spaces and log4j logging. Made the urlToServiceSet - *map actually use the url supplied to deploy. Made postRegister use - *deploy. Made undeploy work, and implemented sar dependency management - *and recursive deploy/undeploy. - * /ol - * - * pb20010907 david maplesden:/b - * ul - * liAdded support for depends tag - * /ul - * - */ +* This is the main Service Deployer API. +* +* @see org.jboss.system.Service +* @author a href=mailto:[EMAIL PROTECTED];Marc Fleury/a +* @author a href=mailto:[EMAIL PROTECTED];David Maplesden/a +* @author a href=mailto:[EMAIL PROTECTED];David Jencks/a +* @version $Revision: 1.18 $ p +* +* b20010830 marc fleury:/b +* ulinitial import +*li +* /ul +* +* pb20010905 david maplesden:/b +* ul +* liChanged deployment procedure to deploy all listed mbeans, then +* initialise them all before finally starting them all. Changed services +* sets to lists to maintain ordering. +* /ul +* +* b20010908 david jencks/b +* ol +*li fixed tabs to spaces and log4j logging. Made the urlToServiceSet +*map actually use the url supplied to deploy. Made postRegister use +*deploy. Made undeploy work, and implemented sar dependency management +*and recursive deploy/undeploy. +* /ol +* +* pb20010907 david maplesden:/b +* ul +* liAdded support for depends tag +* /ul +* +* pb20011210 marc fleury:/b +* ul +* liRemoving the classpath dependency to explicit jars +* /ul +* pb20011211 marc fleury:/b +* ul +* lirewrite +* /ul +*/ public class ServiceDeployer - extends DeployerMBeanSupport - implements ServiceDeployerMBean +extends DeployerMBeanSupport +implements ServiceDeployerMBean { // Attributes private ObjectName objectName; - + //Find all the deployment info for a url - private final Map urlToSarDeploymentInfoMap = new HashMap(); - + private final Map urlToServiceDeploymentInfoMap = new HashMap(); + //Find what package an mbean came from. private final Map objectNameToSupplyingPackageMap = new HashMap(); - - - + + + // Public - + /** -* Gets the Name of the ServiceDeployer object -* -* @return returns ServiceDeployer -*/ + * Gets the Name of the ServiceDeployer object + * + * @return returns ServiceDeployer + */ public String getName() { return ServiceDeployer; } - + /** -* Gets the FilenameFilter that the AutoDeployer uses to decide which files -* will be deployed by the ServiceDeployer. Currently .jsr, .sar, and files -* ending in service.xml are accepted. -* -* @return
[JBoss-dev] CVS update: jboss/src/main/org/jboss/deployment ServiceDeployer.java
User: dmaplesden Date: 01/11/26 11:47:19 Modified:src/main/org/jboss/deployment ServiceDeployer.java Log: Slight change to allow directories to be added to the classpath as well as jars and zips Revision ChangesPath 1.16 +144 -118 jboss/src/main/org/jboss/deployment/ServiceDeployer.java Index: ServiceDeployer.java === RCS file: /cvsroot/jboss/jboss/src/main/org/jboss/deployment/ServiceDeployer.java,v retrieving revision 1.15 retrieving revision 1.16 diff -u -r1.15 -r1.16 --- ServiceDeployer.java 2001/11/24 19:46:42 1.15 +++ ServiceDeployer.java 2001/11/26 19:47:19 1.16 @@ -49,17 +49,17 @@ * @author a href=mailto:[EMAIL PROTECTED];Marc Fleury/a * @author a href=mailto:[EMAIL PROTECTED];David Maplesden/a * @author a href=mailto:[EMAIL PROTECTED];David Jencks/a - * @version $Revision: 1.15 $ p + * @version $Revision: 1.16 $ p * * b20010830 marc fleury:/b * ulinitial import *li * /ul - * + * * pb20010905 david maplesden:/b * ul - * liChanged deployment procedure to deploy all listed mbeans, then - * initialise them all before finally starting them all. Changed services + * liChanged deployment procedure to deploy all listed mbeans, then + * initialise them all before finally starting them all. Changed services * sets to lists to maintain ordering. * /ul * @@ -70,7 +70,7 @@ *deploy. Made undeploy work, and implemented sar dependency management *and recursive deploy/undeploy. * /ol - * + * * pb20010907 david maplesden:/b * ul * liAdded support for depends tag @@ -136,15 +136,15 @@ /** * Deploys a package identified by a url string. This stops if a previous -* version exists. The package can be a *service.xml file, a sar service +* version exists. The package can be a *service.xml file, a sar service * archive, or a plain jar or zip file with no deployment descriptor. -* In any case, all classes found in the package or sar subpackages are -* added to the extensible classloader. If there are classpath elements -* in the configuration file, the named packages are loaded -* (in separate classloaders) unless they have been explicitly undeployed, +* In any case, all classes found in the package or sar subpackages are +* added to the extensible classloader. If there are classpath elements +* in the configuration file, the named packages are loaded +* (in separate classloaders) unless they have been explicitly undeployed, * in which case deployment of this package is suspended until they have been -* redeployed. Then the mbeans named in the configuration file are created -* using the ServiceController. Dependencies between mbeans are handled by +* redeployed. Then the mbeans named in the configuration file are created +* using the ServiceController. Dependencies between mbeans are handled by * the ServiceController. * * @param urlString The location of the package to deploy @@ -164,23 +164,23 @@ return sdi; } - if (sdi.state == EMPTY || sdi.state == GHOST) + if (sdi.state == EMPTY || sdi.state == GHOST) { - deployLocalClasses(url, null, true); + deployLocalClasses(url, null, true); //Let others waiting on our classes finish deploying. resolveSuspensions(url, sdi); } // end of if () - + if(sdi.dd != null){ boolean suspended = deployNeededPackages(url, sdi); //Copy local directory if local-directory element is present - try + try { NodeList lds = sdi.dd.getElementsByTagName(local-directory); log.debug(about to copy + lds.getLength() + local directories); -for (int i = 0; i lds.getLength(); i++) +for (int i = 0; i lds.getLength(); i++) { Element ld = (Element)lds.item(i); String path = ld.getAttribute(path); @@ -194,14 +194,14 @@ inflateJar(localUrl, localBaseDir, path); } // end of for () - + - } catch (Exception e) + } catch (Exception e) { log.error(Problem copying local directory, e); } // end of try-catch //if we are suspended, we must wait till all classes are available. - if (!suspended) + if (!suspended) { addMBeans(url, sdi); } // end of if () @@ -210,104 +210,114 @@ return sdi; }
RE: [JBoss-dev] CVS update: jboss/src/main/org/jboss/deployment ServiceDeployer.java
thanks David, you just broke a record of speed in fixing something marcf |-Original Message- |From: [EMAIL PROTECTED] |[mailto:[EMAIL PROTECTED]]On Behalf Of David |Maplesden |Sent: Monday, November 26, 2001 2:47 PM |To: [EMAIL PROTECTED] |Subject: [JBoss-dev] CVS update: jboss/src/main/org/jboss/deployment |ServiceDeployer.java | | | User: dmaplesden | Date: 01/11/26 11:47:19 | | Modified:src/main/org/jboss/deployment ServiceDeployer.java | Log: | Slight change to allow directories to be added to the classpath |as well as jars and zips | | Revision ChangesPath | 1.16 +144 -118 |jboss/src/main/org/jboss/deployment/ServiceDeployer.java | | Index: ServiceDeployer.java | === | RCS file: |/cvsroot/jboss/jboss/src/main/org/jboss/deployment/ServiceDeployer.java,v | retrieving revision 1.15 | retrieving revision 1.16 | diff -u -r1.15 -r1.16 | --- ServiceDeployer.java 2001/11/24 19:46:42 1.15 | +++ ServiceDeployer.java 2001/11/26 19:47:19 1.16 | @@ -49,17 +49,17 @@ |* @author a href=mailto:[EMAIL PROTECTED];Marc Fleury/a |* @author a href=mailto:[EMAIL PROTECTED];David |Maplesden/a |* @author a |href=mailto:[EMAIL PROTECTED];David Jencks/a | - * @version $Revision: 1.15 $ p | + * @version $Revision: 1.16 $ p |* |* b20010830 marc fleury:/b |* ulinitial import |*li |* /ul | - * | + * |* pb20010905 david maplesden:/b |* ul | - * liChanged deployment procedure to deploy all listed |mbeans, then | - * initialise them all before finally starting them all. |Changed services | + * liChanged deployment procedure to deploy all listed |mbeans, then | + * initialise them all before finally starting them all. |Changed services |* sets to lists to maintain ordering. |* /ul |* | @@ -70,7 +70,7 @@ |*deploy. Made undeploy work, and implemented sar |dependency management |*and recursive deploy/undeploy. |* /ol | - * | + * |* pb20010907 david maplesden:/b |* ul |* liAdded support for depends tag | @@ -136,15 +136,15 @@ | | /** | * Deploys a package identified by a url string. This stops |if a previous | -* version exists. The package can be a *service.xml file, a |sar service | +* version exists. The package can be a *service.xml file, a |sar service | * archive, or a plain jar or zip file with no deployment descriptor. | -* In any case, all classes found in the package or sar |subpackages are | -* added to the extensible classloader. If there are |classpath elements | -* in the configuration file, the named packages are loaded | -* (in separate classloaders) unless they have been |explicitly undeployed, | +* In any case, all classes found in the package or sar |subpackages are | +* added to the extensible classloader. If there are |classpath elements | +* in the configuration file, the named packages are loaded | +* (in separate classloaders) unless they have been |explicitly undeployed, | * in which case deployment of this package is suspended |until they have been | -* redeployed. Then the mbeans named in the configuration |file are created | -* using the ServiceController. Dependencies between mbeans |are handled by | +* redeployed. Then the mbeans named in the configuration |file are created | +* using the ServiceController. Dependencies between mbeans |are handled by | * the ServiceController. | * | * @param urlString The location of the |package to deploy | @@ -164,23 +164,23 @@ |return sdi; | } | | - if (sdi.state == EMPTY || sdi.state == GHOST) | + if (sdi.state == EMPTY || sdi.state == GHOST) | { | - deployLocalClasses(url, null, true); | + deployLocalClasses(url, null, true); |//Let others waiting on our classes finish deploying. |resolveSuspensions(url, sdi); | } // end of if () | - | | + | if(sdi.dd != null){ |boolean suspended = deployNeededPackages(url, sdi); | |//Copy local directory if local-directory element is present | - try | + try |{ | NodeList lds = |sdi.dd.getElementsByTagName(local-directory); | log.debug(about to copy + lds.getLength() + |local directories); | -for (int i = 0; i lds.getLength(); i++) | +for (int i = 0; i lds.getLength(); i++) | { | Element ld = (Element)lds.item(i); | String path = ld.getAttribute(path); | @@ -194,14 +194,14 @@ | | inflateJar(localUrl, localBaseDir, path); | } // end of for () | - | + | | - } catch (Exception e) | + } catch
RE: [JBoss-dev] CVS update: jboss/src/main/org/jboss/deployment ServiceDeployer.java
| - * @author a href=[EMAIL PROTECTED]David David, your mailto is fscked up marcf ___ Jboss-development mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/jboss-development
[JBoss-dev] CVS update: jboss/src/main/org/jboss/deployment ServiceDeployer.java
User: d_jencks Date: 01/09/20 11:23:40 Modified:src/main/org/jboss/deployment ServiceDeployer.java Log: fixed my mailto address Revision ChangesPath 1.9 +9 -1 jboss/src/main/org/jboss/deployment/ServiceDeployer.java Index: ServiceDeployer.java === RCS file: /cvsroot/jboss/jboss/src/main/org/jboss/deployment/ServiceDeployer.java,v retrieving revision 1.8 retrieving revision 1.9 diff -u -r1.8 -r1.9 --- ServiceDeployer.java 2001/09/12 22:11:51 1.8 +++ ServiceDeployer.java 2001/09/20 18:23:40 1.9 @@ -61,7 +61,7 @@ * @authora href=mailto:[EMAIL PROTECTED];Marc Fleury/a * @author a href=mailto:[EMAIL PROTECTED];David Maplesden/a * @authora href=[EMAIL PROTECTED]David Jencks/a - * @version $Revision: 1.8 $ p + * @version $Revision: 1.9 $ p * * b20010830 marc fleury:/b * ulinitial import @@ -738,6 +738,14 @@ log.error(problem removing classloader + cl, e); } } +else +{ + log.debug(not undeploying classloader + cl + , remaining urls: + urls); +} + + +} // end of else + } } } ___ Jboss-development mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/jboss-development
Re: [JBoss-dev] CVS update: jboss/src/main/org/jboss/deployment ServiceDeployer.java
On 2001.09.20 13:36:00 -0400 marc fleury wrote: | - * @author a href=[EMAIL PROTECTED]David David, your mailto is fscked up marcf Thanks marc, fixed, welcome back david jencks ___ Jboss-development mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/jboss-development ___ Jboss-development mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/jboss-development
[JBoss-dev] CVS update: jboss/src/main/org/jboss/deployment ServiceDeployer.java
User: d_jencks Date: 01/09/20 11:36:31 Modified:src/main/org/jboss/deployment ServiceDeployer.java Log: oops, here's the mailto fix Revision ChangesPath 1.10 +1 -4 jboss/src/main/org/jboss/deployment/ServiceDeployer.java Index: ServiceDeployer.java === RCS file: /cvsroot/jboss/jboss/src/main/org/jboss/deployment/ServiceDeployer.java,v retrieving revision 1.9 retrieving revision 1.10 diff -u -r1.9 -r1.10 --- ServiceDeployer.java 2001/09/20 18:23:40 1.9 +++ ServiceDeployer.java 2001/09/20 18:36:31 1.10 @@ -60,8 +60,8 @@ * @see org.jboss.system.Service * @authora href=mailto:[EMAIL PROTECTED];Marc Fleury/a * @author a href=mailto:[EMAIL PROTECTED];David Maplesden/a - * @authora href=[EMAIL PROTECTED]David Jencks/a - * @version $Revision: 1.9 $ p + * @authora href=mailto:[EMAIL PROTECTED];David Jencks/a + * @version $Revision: 1.10 $ p * * b20010830 marc fleury:/b * ulinitial import @@ -742,9 +742,6 @@ { log.debug(not undeploying classloader + cl + , remaining urls: + urls); } - - -} // end of else } } ___ Jboss-development mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/jboss-development
[JBoss-dev] CVS update: jboss/src/main/org/jboss/deployment ServiceDeployer.java
User: d_jencks Date: 01/09/12 15:11:51 Modified:src/main/org/jboss/deployment ServiceDeployer.java Log: Slight refactoring (method extraction) to improve clarity Revision ChangesPath 1.8 +68 -126 jboss/src/main/org/jboss/deployment/ServiceDeployer.java Index: ServiceDeployer.java === RCS file: /cvsroot/jboss/jboss/src/main/org/jboss/deployment/ServiceDeployer.java,v retrieving revision 1.7 retrieving revision 1.8 diff -u -r1.7 -r1.8 --- ServiceDeployer.java 2001/09/11 18:34:59 1.7 +++ ServiceDeployer.java 2001/09/12 22:11:51 1.8 @@ -61,7 +61,7 @@ * @authora href=mailto:[EMAIL PROTECTED];Marc Fleury/a * @author a href=mailto:[EMAIL PROTECTED];David Maplesden/a * @authora href=[EMAIL PROTECTED]David Jencks/a - * @version $Revision: 1.7 $ p + * @version $Revision: 1.8 $ p * * b20010830 marc fleury:/b * ulinitial import @@ -93,9 +93,11 @@ extends ServiceMBeanSupport implements ServiceDeployerMBean { - + private static final String SERVICE_CONTROLLER_NAME = JBOSS-SYSTEM:spine=ServiceController; // Attributes + private ObjectName serviceControllerName; + // each url can spawn a series of MLet classloaders that are specific to it and cycled private Map urlToClassLoadersSetMap; @@ -529,8 +531,6 @@ return deployedMBeans; } - //log.debug(adding URLClassLoader for url archive + dependency); - //URLClassLoader cl1 = new URLClassLoader(new URL[]{dependency}); if (!isDeployed(dependencyString)) { log.debug(recursively deploying + dependency); @@ -566,123 +566,40 @@ { Element mbean = (Element)nl.item(i); - -try -{ - log.debug(deploying with ServiceController mbean + mbean); - ObjectName service = (ObjectName)server.invoke( - new ObjectName(JBOSS-SYSTEM:spine=ServiceController), +log.debug(deploying with ServiceController mbean + mbean); +ObjectName service = (ObjectName)invoke(getServiceControllerName(), deploy, new Object[]{mbean}, new String[]{org.w3c.dom.Element}); - - // marcf: I don't think we should keep track and undeploy... - //david jencks what do you mean by this??? +// marcf: I don't think we should keep track and undeploy... +//david jencks what do you mean by this??? +if (service != null) +{ services.add(service); deployedMBeans.add(service); } -catch (MBeanException mbe) -{ - log.error(Mbean exception while creating mbean, mbe.getTargetException()); -} -catch (RuntimeMBeanException rbe) -{ - log.error(Runtime Mbean exception while creating mbean, rbe.getTargetException()); -} -catch (MalformedObjectNameException mone) -{ - log.error(MalformedObjectNameException while creating mbean, mone); -} -catch (ReflectionException re) -{ - log.error(ReflectionException while creating mbean, re); -} -catch (InstanceNotFoundException re) -{ - log.error(InstanceNotFoundException while creating mbean, re); -} -catch (Exception e) -{ - log.error(Exception while creating mbean, e); -} } //init the mbeans in our package for (Iterator it = services.iterator(); it.hasNext(); ) { ObjectName service = (ObjectName)it.next(); - -try -{ - server.invoke( - new ObjectName(JBOSS-SYSTEM:spine=ServiceController), +invoke(getServiceControllerName(), init, new Object[]{service}, new String[]{javax.management.ObjectName}); -} -catch (MBeanException mbe) -{ - log.error(Mbean exception while creating mbean, mbe.getTargetException()); -} -catch (RuntimeMBeanException rbe) -{ - log.error(Runtime Mbean exception while creating mbean, rbe.getTargetException()); -} -catch (MalformedObjectNameException mone) -
[JBoss-dev] CVS update: jboss/src/main/org/jboss/deployment ServiceDeployer.java
User: dmaplesden Date: 01/09/10 19:46:13 Modified:src/main/org/jboss/deployment ServiceDeployer.java Log: Added support for depends elements in service.xml files. Revision ChangesPath 1.6 +245 -45 jboss/src/main/org/jboss/deployment/ServiceDeployer.java Index: ServiceDeployer.java === RCS file: /cvsroot/jboss/jboss/src/main/org/jboss/deployment/ServiceDeployer.java,v retrieving revision 1.5 retrieving revision 1.6 diff -u -r1.5 -r1.6 --- ServiceDeployer.java 2001/09/09 05:40:47 1.5 +++ ServiceDeployer.java 2001/09/11 02:46:13 1.6 @@ -17,6 +17,8 @@ import java.net.MalformedURLException; import java.net.URL; import java.util.ArrayList; +import java.util.LinkedList; + import java.util.Collections; import java.util.HashMap; import java.util.HashSet; @@ -58,13 +60,22 @@ * * @see org.jboss.system.Service * @authora href=mailto:[EMAIL PROTECTED];Marc Fleury/a + * @author a href=mailto:[EMAIL PROTECTED];David Maplesden/a * @authora href=[EMAIL PROTECTED]David Jencks/a - * @version $Revision: 1.5 $ p + * @version $Revision: 1.6 $ p * * b20010830 marc fleury:/b * ulinitial import *li * /ul + * + * pb20010905 david maplesden:/b + * ul + * liChanged deployment procedure to deploy all listed mbeans, then + * initialise them all before finally starting them all. Changed services + * sets to lists to maintain ordering. + * /ul + * * b20010908 david jencks/b * ol *li fixed tabs to spaces and log4j logging. Made the urlToServiceSet @@ -72,6 +83,11 @@ *deploy. Made undeploy work, and implemented sar dependency management *and recursive deploy/undeploy. * /ol + * + * pb20010907 david maplesden:/b + * ul + * liAdded support for depends tag + * /ul * */ public class ServiceDeployer @@ -102,6 +118,16 @@ //To keep track of services suspended when we undeploy a jsr private Map suspendedUrlDependencyMap; + + // each url is associated with an xml document + private Map urlToDocumentMap; + + // each url specifies a number of services it is dependent on + private Map urlToDependsSetMap; + + // maps mbeans to the urls that are dependent on them. + private Map mbeanToURLSetMap; + // JMX private MBeanServer server; @@ -177,27 +203,188 @@ * @exception DeploymentExceptionThrown if the package could not be * deployed. */ - public void deploy(String urlString) + public void deploy(String url) throws MalformedURLException, IOException, DeploymentException { - log.debug(deploying document + urlString); + log.debug(deploying document + url); - if (isDeployed(urlString)) + if (isDeployed(url)) { - undeploy(urlString); - log.debug(undeployed previous version of document + urlString); + undeploy(url); + log.debug(undeployed previous version of document + url); } + // The Document describing the service + Document document = null; + + /** + * First register the classloaders for this deployment If it is a jsr, the + * jsr points to itself If it is a something-service.xml then it looks for + * classpathcodebasehttp://bla.com (or file://bla.com)/codebase + * default is system library dir archivesbla.jar, bla2.jar, bla3.jar + * /archiveswhere bla is relative to codebase/classpath + */ + + // Support for the new packaged format + try + { + if (url.endsWith(.jsr) +|| url.endsWith(.sar)) + { +//use java.net.URLClassLoader here +ClassLoader cl = new java.net.URLClassLoader(new URL[]{new URL(url)}); +document = getDocument(META-INF/jboss-service.xml, cl); +log.debug(got document jboss-service.xml from cl); + } + + //no mbeans to deploy for jars + else if(url.endsWith(.jar) + || url.endsWith(.zip)) + { +document = null; + } + + // We can deploy bare xml files as well + else if (url.endsWith(service.xml)) + { +document = getDocument(url, null); + } + else + { +throw new Exception(not a deployable file type); + } + + } + catch (Exception ignored) + { + log.error(Problem deploying url + url + , no valid service.xml file found., ignored); + throw new DeploymentException(No valid service.xml file found +
[JBoss-dev] CVS update: jboss/src/main/org/jboss/deployment ServiceDeployer.java
User: d_jencks Date: 01/09/08 21:13:53 Modified:src/main/org/jboss/deployment ServiceDeployer.java Log: fixed redeployment bug for jars Revision ChangesPath 1.4 +278 -271 jboss/src/main/org/jboss/deployment/ServiceDeployer.java Index: ServiceDeployer.java === RCS file: /cvsroot/jboss/jboss/src/main/org/jboss/deployment/ServiceDeployer.java,v retrieving revision 1.3 retrieving revision 1.4 diff -u -r1.3 -r1.4 --- ServiceDeployer.java 2001/09/08 17:08:32 1.3 +++ ServiceDeployer.java 2001/09/09 04:13:52 1.4 @@ -56,10 +56,10 @@ /** * This is the main Service Deployer API. * - * @see org.jboss.system.Service - * @author a href=mailto:[EMAIL PROTECTED];Marc Fleury/a - * @author a href=[EMAIL PROTECTED]David Jencks/a - * @version $Revision: 1.3 $ p + * @see org.jboss.system.Service + * @authora href=mailto:[EMAIL PROTECTED];Marc Fleury/a + * @authora href=[EMAIL PROTECTED]David Jencks/a + * @version $Revision: 1.4 $ p * * b20010830 marc fleury:/b * ulinitial import @@ -69,8 +69,8 @@ * ol *li fixed tabs to spaces and log4j logging. Made the urlToServiceSet *map actually use the url supplied to deploy. Made postRegister use - *deploy. Made undeploy work, and implemented sar dependency - *management and recursive deploy/undeploy. + *deploy. Made undeploy work, and implemented sar dependency management + *and recursive deploy/undeploy. * /ol * */ @@ -110,7 +110,7 @@ /** * Gets the Name of the ServiceDeployer object * -* @return returns ServiceDeployer +* @return returns ServiceDeployer */ public String getName() { @@ -122,7 +122,7 @@ * will be deployed by the ServiceDeployer. Currently .jsr, .sar, and files * ending in service.xml are accepted. * -* @return The FileNameFilter for use by the AutoDeployer. +* @return The FileNameFilter for use by the AutoDeployer. */ public FilenameFilter getDeployableFilter() { @@ -132,10 +132,10 @@ /** * Determines which files are accepted by the Deployer. * - * @param dir Directory of candidate file. - * @param filename Filename of candidate file. - * @return Whether candidate file should be deployed by this - * deployer. + * @param dir Directory of candidate file. + * @param filename Filename of candidate file. + * @return Whether candidate file should be deployed by + * this deployer. */ public boolean accept(File dir, String filename) { @@ -150,9 +150,10 @@ /** * Determines if the urlString references a currently deployed package * -* @param urlString url string for package -* @return Whether the package is currently deployed. -* @exception MalformedURLException Thrown if a malformed url string is +* @param urlString url string for package +* @return Whether the package is currently +* deployed. +* @exception MalformedURLException Thrown if a malformed url string is * supplied. */ public boolean isDeployed(String urlString) @@ -169,11 +170,11 @@ * them (if not suspended by an undeploy, adds this package to the * ServiceLibraries classpath, and loads the mbeans specified. * -* @param urlString The location of the package to deploy -* @exception MalformedURLException Thrown if a malformed url string is +* @param urlString The location of the package to deploy +* @exception MalformedURLException Thrown if a malformed url string is * supplied. -* @exception IOException Thrown if some read operation failed. -* @exception DeploymentException Thrown if the package could not be +* @exception IOExceptionThrown if some read operation failed. +* @exception DeploymentExceptionThrown if the package could not be * deployed. */ public void deploy(String urlString) @@ -208,10 +209,10 @@ // Support for the new packaged format try { - if (urlString.endsWith(.jsr) - || urlString.endsWith(.sar) - ||urlString.endsWith(.jar) - || urlString.endsWith(.zip)) + if (urlString.endsWith(.jsr) +|| urlString.endsWith(.sar) +|| urlString.endsWith(.jar) +|| urlString.endsWith(.zip)) { URLClassLoader cl = new URLClassLoader(new
[JBoss-dev] CVS update: jboss/src/main/org/jboss/deployment ServiceDeployer.java
User: d_jencks Date: 01/09/08 22:40:47 Modified:src/main/org/jboss/deployment ServiceDeployer.java Log: added missing hsql-default-service.xml and a couple of fixes. Revision ChangesPath 1.5 +114 -107 jboss/src/main/org/jboss/deployment/ServiceDeployer.java Index: ServiceDeployer.java === RCS file: /cvsroot/jboss/jboss/src/main/org/jboss/deployment/ServiceDeployer.java,v retrieving revision 1.4 retrieving revision 1.5 diff -u -r1.4 -r1.5 --- ServiceDeployer.java 2001/09/09 04:13:52 1.4 +++ ServiceDeployer.java 2001/09/09 05:40:47 1.5 @@ -59,7 +59,7 @@ * @see org.jboss.system.Service * @authora href=mailto:[EMAIL PROTECTED];Marc Fleury/a * @authora href=[EMAIL PROTECTED]David Jencks/a - * @version $Revision: 1.4 $ p + * @version $Revision: 1.5 $ p * * b20010830 marc fleury:/b * ulinitial import @@ -253,137 +253,144 @@ log.debug(found *service.xml file for url + url); // The service.xml file can define jar the classes it contains depend on // We should only have one codebase (or none at all) - Element classpath = (Element)document.getElementsByTagName(classpath).item(0); - log.debug(found classpath + classpath); - String codebase = ; - String archives = ; - - //Does it specify a codebase? - if (classpath != null) + //And why is that?? + NodeList classpaths = document.getElementsByTagName(classpath); + for (int i = 0; i classpaths.getLength(); i++) { -log.debug(setting up classpath + classpath); -// Load the codebase -codebase = classpath.getAttribute(codebase).trim(); +Element classpath = (Element)classpaths.item(i); +log.debug(found classpath + classpath); +String codebase = ; +String archives = ; -//if codebase is ., construct codebase from current url. -if (..equals(codebase)) +//Does it specify a codebase? +if (classpath != null) { - //does this work with http??? - codebase = new File(urlString).getParent(); -} + log.debug(setting up classpath + classpath); + // Load the codebase + codebase = classpath.getAttribute(codebase).trim(); -// Let's make sure the formatting of the codebase ends with the / -if (codebase.startsWith(file:) !codebase.endsWith(File.separator)) -{ - codebase += File.separator; -} -else if (codebase.startsWith(http:) !codebase.endsWith(/)) -{ - codebase += /; + //if codebase is ., construct codebase from current url. + if (..equals(codebase)) + { + //does this work with http??? + codebase = new File(urlString).getParent(); + } + + // Let's make sure the formatting of the codebase ends with the / + if (codebase.startsWith(file:) !codebase.endsWith(File.separator)) + { + codebase += File.separator; + } + else if (codebase.startsWith(http:) !codebase.endsWith(/)) + { + codebase += /; + } + log.debug(codebase is + codebase); + //Load the archives + archives = classpath.getAttribute(archives).trim(); + log.debug(archives are + archives); } -log.debug(codebase is + codebase); -//Load the archives -archives = classpath.getAttribute(archives).trim(); -log.debug(archives are + archives); - } - if (codebase.startsWith(file:) archives.equals()) - { -try +if (codebase.startsWith(file:) archives.equals()) { - File dir = new File(codebase.substring(5)); - // The patchDir can only be a File one, local - File[] jars = dir.listFiles( - new java.io.FileFilter() - { - /** - * filters for jar and zip files in the local directory. - * - * @param pathname Path to the candidate file. - * @return True if the file is a jar or zip file. - */ - public boolean accept(File pathname) + try + { + File dir = new
[JBoss-dev] CVS update: jboss/src/main/org/jboss/deployment ServiceDeployer.java
User: dmaplesden Date: 01/09/04 18:49:44 Modified:src/main/org/jboss/deployment ServiceDeployer.java Log: Change deploy code to create all mbeans, then initialise all mbeans and finally start all mbeans referred to by an URL. Also change undeploy to stop and destroy mbeans it is undeploying. Fix deploy code to store mbean list against url. Revision ChangesPath 1.2 +141 -27 jboss/src/main/org/jboss/deployment/ServiceDeployer.java Index: ServiceDeployer.java === RCS file: /cvsroot/jboss/jboss/src/main/org/jboss/deployment/ServiceDeployer.java,v retrieving revision 1.1 retrieving revision 1.2 diff -u -r1.1 -r1.2 --- ServiceDeployer.java 2001/08/29 22:47:27 1.1 +++ ServiceDeployer.java 2001/09/05 01:49:44 1.2 @@ -21,6 +21,8 @@ import java.util.Map; import java.util.HashSet; import java.util.Set; +import java.util.List; +import java.util.ArrayList; import java.util.Iterator; import java.util.HashMap; import java.util.Collections; @@ -57,7 +59,7 @@ * @author a href=mailto:[EMAIL PROTECTED];Marc Fleury/a * @see org.jboss.system.Service * -* @version $Revision: 1.1 $ +* @version $Revision: 1.2 $ * * pb20010830 marc fleury:/b * ul @@ -74,8 +76,8 @@ // each url can spawn a series of MLet classloaders that are specific to it and cycled private Map urlToClassLoadersSetMap; - // each url can describe many Services, we keep the ObjectNames in here - private Map urlToServicesSetMap; + // each url can describe many Services, we keep the ObjectNames in here, order is important so use list + private Map urlToServicesListMap; // JMX private MBeanServer server; @@ -120,7 +122,7 @@ // Support for the new packaged format try { - if (url.endsWith(.jsr)) { + if (url.endsWith(.jsr) || url.endsWith(.sar)) { URLClassLoader cl = new URLClassLoader(new URL[] {new URL(url)}); @@ -207,6 +209,15 @@ // The libraries are loaded we can now load the mbeans + // marcf: I don't think we should keep track and undeploy... + List services = (List) urlToServicesListMap.get(url); + + if (services == null) + { + services = Collections.synchronizedList(new ArrayList()); + urlToServicesListMap.put(url, services); + } + NodeList nl = document.getElementsByTagName(mbean); for (int i = 0 ; i nl.getLength() ; i++) { @@ -221,15 +232,6 @@ new Object[] {mbean}, new String[] {org.w3c.dom.Element}); - // marcf: I don't think we should keep track and undeploy... - Set services = (Set) urlToServicesSetMap.get(System.getProperty(jboss.system.configurationDirectory) + jboss-service.xml); - - if (services == null) - { - services = Collections.synchronizedSet(new HashSet()); - urlToServicesSetMap.put(System.getProperty(jboss.system.configurationDirectory) + jboss-service.xml, services); - } - services.add(service); } catch (MBeanException mbe) {mbe.getTargetException().printStackTrace();} @@ -239,19 +241,90 @@ catch (InstanceNotFoundException re) {} catch (Exception e) {e.printStackTrace();} } + + //iterate through services and init. + for(Iterator it = services.iterator();it.hasNext();) + { + ObjectName service = (ObjectName)it.next(); + + try { + server.invoke( + new ObjectName(JBOSS-SYSTEM:spine=ServiceController), + init, + new Object[] {service}, + new String[] {javax.management.ObjectName}); + } + catch (MBeanException mbe) {mbe.getTargetException().printStackTrace();} + catch (RuntimeMBeanException rbe)
[JBoss-dev] CVS update: jboss/src/main/org/jboss/deployment ServiceDeployer.java ServiceDeployerMBean.java
User: mnf999 Date: 01/08/29 15:47:27 Added: src/main/org/jboss/deployment ServiceDeployer.java ServiceDeployerMBean.java Log: The brand new ServiceDeployer Revision ChangesPath 1.1 jboss/src/main/org/jboss/deployment/ServiceDeployer.java Index: ServiceDeployer.java === /* * JBoss, the OpenSource J2EE server * * Distributable under LGPL license. * See terms of license at gnu.org. */ package org.jboss.deployment; import java.io.File; import java.io.IOException; import java.io.FilenameFilter; import java.io.BufferedReader; import java.io.InputStream; import java.io.InputStreamReader; import java.io.StringReader; import java.net.MalformedURLException; import java.net.URL; import java.util.Map; import java.util.HashSet; import java.util.Set; import java.util.Iterator; import java.util.HashMap; import java.util.Collections; import java.util.StringTokenizer; import javax.management.ObjectName; import javax.management.MBeanServer; import javax.management.MBeanException; import javax.management.RuntimeMBeanException; import javax.management.MalformedObjectNameException; import javax.management.ReflectionException; import javax.management.InstanceNotFoundException; import javax.management.loading.MLet; import javax.xml.parsers.DocumentBuilder; import javax.xml.parsers.DocumentBuilderFactory; import javax.xml.parsers.ParserConfigurationException; import org.w3c.dom.Element; import org.w3c.dom.Document; import org.w3c.dom.NodeList; import org.xml.sax.InputSource; import org.xml.sax.SAXException; import org.jboss.system.Service; import org.jboss.system.URLClassLoader; import org.jboss.system.MBeanClassLoader; import org.jboss.system.ServiceMBeanSupport; /** * This is the main Service Deployer API. * * @author a href=mailto:[EMAIL PROTECTED];Marc Fleury/a * @see org.jboss.system.Service * * @version $Revision: 1.1 $ * * pb20010830 marc fleury:/b * ul * initial import * li * /ul */ public class ServiceDeployer extends ServiceMBeanSupport implements ServiceDeployerMBean { // Attributes // each url can spawn a series of MLet classloaders that are specific to it and cycled private Map urlToClassLoadersSetMap; // each url can describe many Services, we keep the ObjectNames in here private Map urlToServicesSetMap; // JMX private MBeanServer server; // Public public String getName() {return ServiceDeployer;} public FilenameFilter getDeployableFilter() { return new FilenameFilter() { public boolean accept(File dir, String filename) { filename=filename.toLowerCase(); return (filename.endsWith(.jsr) ||filename.endsWith(service.xml)); } }; } public void deploy (String url) throws MalformedURLException, IOException, DeploymentException { // System.out.println(THE DOCUMENT LOAD +url); if (isDeployed(url)) undeploy(url); // The Document describing the service Document document = null; /** * First register the classloaders for this deployment * If it is a jsr, the jsr points to itself * If it is a something-service.xml then it looks for * classpath * codebasehttp://bla.com (or file://bla.com)/codebase default is system library dir * archives bla.jar, bla2.jar, bla3.jar /archives where bla is relative to codebase * /classpath * */ // Support for the new packaged format try { if (url.endsWith(.jsr)) { URLClassLoader cl = new URLClassLoader(new URL[] {new URL(url)}); document = getDocument(META-INF/jboss-service.xml, cl); } // We can deploy bare xml files as well else if (url.endsWith(service.xml)) { document = getDocument(url, null);