User: starksm Date: 01/11/02 00:38:08 Modified: src/main/org/jboss/resource Tag: Branch_2_4 RARDeployer.java RARMetaData.java Log: Add the RAR jar files to the server MLet class loader on deployment to make the adapapter available to all components. Revision Changes Path No revision No revision 1.3.2.2 +12 -31 jbosscx/src/main/org/jboss/resource/RARDeployer.java Index: RARDeployer.java =================================================================== RCS file: /cvsroot/jboss/jbosscx/src/main/org/jboss/resource/RARDeployer.java,v retrieving revision 1.3.2.1 retrieving revision 1.3.2.2 diff -u -r1.3.2.1 -r1.3.2.2 --- RARDeployer.java 2001/09/30 22:44:26 1.3.2.1 +++ RARDeployer.java 2001/11/02 08:38:06 1.3.2.2 @@ -28,6 +28,7 @@ import java.util.jar.JarFile; import javax.management.Notification; +import javax.management.loading.MLet; import org.jboss.deployment.DeployerMBeanSupport; import org.jboss.deployment.DeploymentException; @@ -46,7 +47,8 @@ * * @author Toby Allsopp ([EMAIL PROTECTED]) * @author <a href="mailto:[EMAIL PROTECTED]">David Jencks</a> - * @version $Revision: 1.3.2.1 $ + * @author [EMAIL PROTECTED] + * @version $Revision: 1.3.2.2 $ * @see org.jboss.resource.ConnectionFactoryLoader <p> * * <b>Revisions:</b> <p> @@ -283,58 +285,38 @@ } Document dd; - try - { - dd = XmlFileLoader.getDocument(ddFile.toURL()); - } - catch (org.jboss.ejb.DeploymentException de) - { - throw new DeploymentException(de.getMessage(), de.getCause()); - } + dd = XmlFileLoader.getDocument(ddFile.toURL()); Element root = dd.getDocumentElement(); RARMetaData metadata = new RARMetaData(); metadata.importXml(root); - // Create a class loader that can load classes from any JARs - // inside the RAR. First, we need to find the JARs. - + // First, we need to find the JARs in the RAR archive Collection jars = new ArrayList(); - FileFilter filter = new FileFilter() { - /** - * #Description of the Method - * - * @param file Description of Parameter - * @return Description of the Returned Value - */ public boolean accept(File file) { return file.getName().endsWith(".jar"); } }; Collection jarFiles = recursiveFind(unpackedDir, filter); + /* We need to make all of the RAR jars available to all components in the + app server so we need to add the jars to the main MLet class loader. + */ + MLet mlet = (MLet) Thread.currentThread().getContextClassLoader(); category.debug("Adding the following URLs to classpath:"); for (Iterator i = jarFiles.iterator(); i.hasNext(); ) { - File file = (File)i.next(); + File file = (File) i.next(); URL jarUrl = file.toURL(); - jars.add(jarUrl); category.debug(jarUrl.toString()); + mlet.addURL(jarUrl); } + metadata.setClassLoader(mlet); - // Ok, now we have the URLs of the JARs contained in the RAR we - // can create a classloader that loads classes from them - - ClassLoader cl = new URLClassLoader( - (URL[])jars.toArray(new URL[0]), - Thread.currentThread().getContextClassLoader()); - - metadata.setClassLoader(cl); - // Let's tell the waiting hordes (of connection factory loaders) // that this resource adapter is available @@ -375,7 +357,6 @@ sendNotification(notification); // Remove the temporary copy - File unpackedDir = info.unpackedDir; if (!recursiveDelete(unpackedDir)) { 1.3.2.2 +10 -22 jbosscx/src/main/org/jboss/resource/RARMetaData.java Index: RARMetaData.java =================================================================== RCS file: /cvsroot/jboss/jbosscx/src/main/org/jboss/resource/RARMetaData.java,v retrieving revision 1.3.2.1 retrieving revision 1.3.2.2 diff -u -r1.3.2.1 -r1.3.2.2 --- RARMetaData.java 2001/09/30 22:44:26 1.3.2.1 +++ RARMetaData.java 2001/11/02 08:38:07 1.3.2.2 @@ -25,7 +25,7 @@ * * @author Toby Allsopp ([EMAIL PROTECTED]) * @see RARDeployer - * @version $Revision: 1.3.2.1 $ + * @version $Revision: 1.3.2.2 $ */ public class RARMetaData // extends Y @@ -278,8 +278,6 @@ private void setConfigProperty(Element element) throws DeploymentException { - try - { Element nameE = MetaData.getUniqueChild(element, "config-property-name"); Element typeE = MetaData.getUniqueChild(element, @@ -295,18 +293,11 @@ p.value = getElementContent(valueE); } properties.put(p.name, p); - } - catch (org.jboss.ejb.DeploymentException de) - { - throw new DeploymentException(de.getMessage(), de.getCause()); - } } private void setLicense(Element element) throws DeploymentException { - try - { Element requiredE = MetaData.getUniqueChild(element, "license-required"); Element descriptionE = MetaData.getOptionalChild(element, @@ -322,11 +313,6 @@ { category.info("License terms present. See deployment descriptor."); } - } - catch (org.jboss.ejb.DeploymentException de) - { - throw new DeploymentException(de.getMessage(), de.getCause()); - } } private void setDescription(Element element) @@ -375,17 +361,19 @@ reauthenticationSupport = Boolean.valueOf(value).booleanValue(); } + private void setSecurityPermission(Element element) + throws DeploymentException + { + Element permSpec = MetaData.getUniqueChild(element, + "security-permission-spec"); + String spec = getElementContent(permSpec); + category.debug("Ignoring security-permission("+spec+")"); + } + private String getElementContent(Element element) throws DeploymentException { - try - { return MetaData.getElementContent(element); - } - catch (org.jboss.ejb.DeploymentException de) - { - throw new DeploymentException(de.getMessage(), de.getCause()); - } } // Y overrides ---------------------------------------------------
_______________________________________________ Jboss-development mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/jboss-development