From: Scott M S. <st...@us...> - 2002-05-24 17:03:23
|
User: starksm Date: 02/05/24 09:27:01 Modified: src/main/org/jboss/deployment Tag: Branch_3_0 SARDeployer.java Log: Register the SAR DeploymentInfo UCL as an mbean and use this as the serivce mbean loader to ensure that services first look to their deployment context for resources. Revision Changes Path No revision No revision 1.8.2.2 +34 -32 jboss-system/src/main/org/jboss/deployment/SARDeployer.java Index: SARDeployer.java =================================================================== RCS file: /cvsroot/jboss/jboss-system/src/main/org/jboss/deployment/SARDeployer.java,v retrieving revision 1.8.2.1 retrieving revision 1.8.2.2 diff -u -r1.8.2.1 -r1.8.2.2 --- SARDeployer.java 13 May 2002 02:34:47 -0000 1.8.2.1 +++ SARDeployer.java 24 May 2002 16:26:54 -0000 1.8.2.2 @@ -66,7 +66,7 @@ * @author <a href="mailto:Dav...@or...">David Maplesden</a> * @author <a href="mailto:d_j...@us...">David Jencks</a> * @author <a href="mailto:ja...@pl...">Jason Dillon</a> - * @version $Revision: 1.8.2.1 $ + * @version $Revision: 1.8.2.2 $ * * <p><b>20010830 marc fleury:</b> * <ul> @@ -167,11 +167,13 @@ File file = new File(di.url.getFile()); // If not directory we watch the package - if (!file.isDirectory()) { + if (!file.isDirectory()) + { di.watch = di.url; } // If directory we watch the xml files - else { + else + { di.watch = new URL(di.url, "META-INF/jboss-service.xml"); } } @@ -187,23 +189,16 @@ //Copy local directory if local-directory element is present NodeList lds = di.document.getElementsByTagName("local-directory"); - if (debug) { - log.debug("about to copy " + lds.getLength() + " local directories"); - } + 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"); - if (debug) { - log.debug("about to copy local directory at " + path); - } + log.debug("about to copy local directory at " + path); // Get the url of the local copy from the classloader. - if (debug) { - log.debug("copying from " + di.localUrl + path + " -> " + dataDir); - } - + log.debug("copying from " + di.localUrl + path + " -> " + dataDir); inflateJar(di.localUrl, dataDir, path); } } @@ -232,25 +227,30 @@ // install the MBeans in this descriptor log.debug("Deploying SAR, create step: url " + di.url); - + // Register the SAR UCL as an mbean so we can use it as the service loader + ObjectName uclName = di.ucl.getObjectName(); + log.debug("Registering service UCL="+uclName); + getServer().registerMBean(di.ucl, uclName); + + // Parse the service definitions List mbeans = di.mbeans; mbeans.clear(); - - mbeans.addAll(serviceController.install(di.document.getDocumentElement())); - + List descriptorMbeans = serviceController.install(di.document.getDocumentElement(), uclName); + mbeans.addAll(descriptorMbeans); // create the services - for (Iterator iter = di.mbeans.iterator(); iter.hasNext(); ) + for (Iterator iter = di.mbeans.iterator(); iter.hasNext(); ) { ObjectName service = (ObjectName)iter.next(); - + // The service won't be created until explicitly dependent mbeans are created - serviceController.create(service); + serviceController.create(service); } } - catch (Exception e) { - log.error("create operation failed for package " + di.url, e); + catch (Exception e) + { + log.error("create operation failed for package " + di.url, e); destroy(di); - throw new DeploymentException(e); + throw new DeploymentException(e); } } @@ -267,23 +267,23 @@ try { // start the services - for (Iterator iter = di.mbeans.iterator(); iter.hasNext(); ) { ObjectName service = (ObjectName)iter.next(); // The service won't be started until explicitely dependent mbeans are started - serviceController.start(service); + serviceController.start(service); } } - catch (Exception e) { - log.error("start operation failed on package " + di.url, e); + catch (Exception e) + { + log.error("start operation failed on package " + di.url, e); stop(di); destroy(di); - throw new DeploymentException(e); + throw new DeploymentException(e); } } - + protected void parseXMLClasspath(DeploymentInfo di) throws DeploymentException { @@ -319,14 +319,15 @@ if (!(codebase.startsWith("http:") || codebase.startsWith("file:"))) { // put the jboss/system base in front of it - try { + try + { codebase = new URL(installURL, codebase).toString(); } catch (MalformedURLException e) { throw new DeploymentException(e); } } - + // Let's make sure the formatting of the codebase ends with the / if (codebase.startsWith("file:") && !codebase.endsWith("/")) { @@ -398,7 +399,8 @@ else if (!archives.equals("")) { // Still no codebase? safeguard - if (codebase.equals("")) { + if (codebase.equals("")) + { codebase = libraryURL.toString(); } |