User: d_jencks
  Date: 01/11/18 22:58:56

  Modified:    src/main/org/jboss/resource RARDeployer.java
  Log:
  Cleaned up deployment a bit and enabled jar in sar
  
  Revision  Changes    Path
  1.13      +22 -42    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.12
  retrieving revision 1.13
  diff -u -r1.12 -r1.13
  --- RARDeployer.java  2001/11/10 21:38:03     1.12
  +++ RARDeployer.java  2001/11/19 06:58:56     1.13
  @@ -49,7 +49,7 @@
   *
   * @author     Toby Allsopp ([EMAIL PROTECTED])
   * @author     <a href="mailto:[EMAIL PROTECTED]";>David Jencks</a>
  -* @version    $Revision: 1.12 $
  +* @version    $Revision: 1.13 $
   * @see        org.jboss.resource.ConnectionFactoryLoader <p>
   *
   *      <b>Revisions:</b> <p>
  @@ -139,15 +139,13 @@
       protected Object deploy(URL url)
             throws IOException, DeploymentException
      {
  -      category.info("Attempting to deploy RAR at '" + url + "'");
  -      File localCopy = getLocalCopy(url, null);
  +      getLog().info("Attempting to deploy RAR at '" + url + "'");
  +      RarDeploymentInfo rdi = new RarDeploymentInfo(url);
  +      File localCopy = getLocalCopy(url, rdi);
         URL localUrl =localCopy.toURL();
  -      Collection jars = new ArrayList();
  -      Collection xmls = new ArrayList();
  -      File unpackedDir = recursiveUnpack(localUrl, jars, xmls);
  +      extractPackages(localUrl, rdi);
         URL ddUrl = null;
  -      Iterator i = xmls.iterator();
  -      while (i.hasNext()) 
  +      for (Iterator i = rdi.getXmlUrls().iterator(); i.hasNext();) 
         {
            URL xml = (URL)i.next();
            if (xml.getFile().endsWith("META-INF/ra.xml")) 
  @@ -180,7 +178,7 @@
         metadata.importXml(root);
   
         // Create a class loader that can load classes from any JARs
  -      // inside the RAR. RecursiveUnpack found the JARs.
  +      // inside the RAR. extractPackages found the JARs.
   
   
         // Ok, now we have the URLs of the JARs contained in the RAR we
  @@ -189,9 +187,7 @@
         //will be universally available without unavailable interface 
         //problems!
         //We use the original (uncopied) url as the id key.
  -      ClassLoader cl = new org.jboss.system.URLClassLoader(
  -            (URL[])jars.toArray(new URL[0]), url);
  -
  +      ClassLoader cl = rdi.createClassLoader();
         metadata.setClassLoader(cl);
   
         //set up the RARDeployment mbean for dependency management.
  @@ -217,26 +213,24 @@
            throw new DeploymentException("Problem making RARDeployment MBean", e);  
         } // end of try-catch
   
  -      DeploymentInfo info = new DeploymentInfo();
  -      info.metadata = metadata;
  -      info.unpackedDir = unpackedDir;
  -      return info;
  +      rdi.metadata = metadata;
  +      return rdi;
      }
   
      protected void undeploy(URL url, Object o)
             throws DeploymentException
      {
  -      category.info("Undeploying RAR at '" + url + "'");
  +      getLog().info("Undeploying RAR at '" + url + "'");
   
  -      DeploymentInfo info = (DeploymentInfo)o;
  +      RarDeploymentInfo rdi = (RarDeploymentInfo)o;
   
  -      if (info == null)
  +      if (rdi == null)
         {
            throw new DeploymentException("There doesn't appear to be a RAR " +
                  "deployed at '" + url + "'");
         }
   
  -      RARMetaData metadata = info.metadata;
  +      RARMetaData metadata = rdi.metadata;
         try 
         {
            ObjectName deploymentName = new 
ObjectName("JCA:service=RARDeployment,name=" + metadata.getDisplayName());
  @@ -268,26 +262,7 @@
         }
         metadata.setClassLoader(null);
         // Remove the temporary copy
  -
  -      File unpackedDir = info.unpackedDir;
  -      if (!recursiveDelete(unpackedDir))
  -      {
  -         category.warn("Unable to recursively delete temp directory '" +
  -               unpackedDir + "' - this should be cleaned up either " +
  -               "when the server is shut down or when it restarts.");
  -      }
  -      URL[] urls = cl.getURLs();
  -      for (int i = urls.length - 1; i>=0; i--)
  -      {
  -         File dir = new File(urls[i].getFile());
  -         if (!recursiveDelete(dir))
  -         {
  -            category.warn("Unable to recursively delete temp directory '" +
  -               dir + "' - this should be cleaned up either " +
  -               "when the server is shut down or when it restarts.");
  -         }
  -      }
  - 
  +      rdi.cleanup(getLog());
         
      }
   
  @@ -295,9 +270,14 @@
   
      /**
       */
  -   private static class DeploymentInfo
  +   private static class RarDeploymentInfo extends 
DeployerMBeanSupport.DeploymentInfo
      {
         public RARMetaData metadata;
  -      public File unpackedDir;
  +
  +      public RarDeploymentInfo(URL key)
  +      {
  +         super(key);
  +      }
      }
   }
  +
  
  
  

_______________________________________________
Jboss-development mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/jboss-development

Reply via email to