[jboss-cvs] JBossAS SVN: r96075 - in projects/jboss-deployers/branches/vfs3: deployers-core/src/main/java/org/jboss/deployers/plugins/structure and 6 other directories.

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Thu Nov 5 21:18:49 EST 2009


Author: johnbailey
Date: 2009-11-05 21:18:48 -0500 (Thu, 05 Nov 2009)
New Revision: 96075

Removed:
   projects/jboss-deployers/branches/vfs3/deployers-vfs/src/main/java/org/jboss/deployers/vfs/plugins/structure/VFSHandleCleanupTask.java
Modified:
   projects/jboss-deployers/branches/vfs3/deployers-core-spi/src/main/java/org/jboss/deployers/spi/structure/ContextInfo.java
   projects/jboss-deployers/branches/vfs3/deployers-core/src/main/java/org/jboss/deployers/plugins/structure/ContextInfoImpl.java
   projects/jboss-deployers/branches/vfs3/deployers-structure-spi/src/main/java/org/jboss/deployers/structure/spi/DeploymentContext.java
   projects/jboss-deployers/branches/vfs3/deployers-structure-spi/src/main/java/org/jboss/deployers/structure/spi/helpers/AbstractDeploymentContext.java
   projects/jboss-deployers/branches/vfs3/deployers-structure-spi/src/main/java/org/jboss/deployers/structure/spi/helpers/AbstractStructuralDeployers.java
   projects/jboss-deployers/branches/vfs3/deployers-structure-spi/src/main/java/org/jboss/deployers/structure/spi/helpers/AbstractStructureBuilder.java
   projects/jboss-deployers/branches/vfs3/deployers-structure-spi/src/main/java/org/jboss/deployers/structure/spi/helpers/ComponentDeploymentContext.java
   projects/jboss-deployers/branches/vfs3/deployers-vfs/src/main/java/org/jboss/deployers/vfs/plugins/structure/jar/JARStructure.java
   projects/jboss-deployers/branches/vfs3/deployers-vfs/src/test/java/org/jboss/test/deployers/vfs/structure/file/test/CombinedFileStructureUnitTestCase.java
   projects/jboss-deployers/branches/vfs3/pom.xml
Log:
Cleaned up changes from r95237.

Modified: projects/jboss-deployers/branches/vfs3/deployers-core/src/main/java/org/jboss/deployers/plugins/structure/ContextInfoImpl.java
===================================================================
--- projects/jboss-deployers/branches/vfs3/deployers-core/src/main/java/org/jboss/deployers/plugins/structure/ContextInfoImpl.java	2009-11-06 02:01:48 UTC (rev 96074)
+++ projects/jboss-deployers/branches/vfs3/deployers-core/src/main/java/org/jboss/deployers/plugins/structure/ContextInfoImpl.java	2009-11-06 02:18:48 UTC (rev 96075)
@@ -64,9 +64,6 @@
 
    /** The modification type */
    private ModificationType modificationType;
-   
-   /** Cleanup Task */
-   private Runnable cleanupTask;
 
    /**
     * Create a new ContextInfoImpl.
@@ -244,15 +241,7 @@
    {
       this.modificationType = modificationType;
    }
-   
-   public Runnable getCleanupTask() {
-      return cleanupTask;
-   }
 
-   public void setCleanupTask(Runnable cleanupTask) {
-      this.cleanupTask = cleanupTask;
-   }
-
    @Override
    public String toString()
    {

Modified: projects/jboss-deployers/branches/vfs3/deployers-core-spi/src/main/java/org/jboss/deployers/spi/structure/ContextInfo.java
===================================================================
--- projects/jboss-deployers/branches/vfs3/deployers-core-spi/src/main/java/org/jboss/deployers/spi/structure/ContextInfo.java	2009-11-06 02:01:48 UTC (rev 96074)
+++ projects/jboss-deployers/branches/vfs3/deployers-core-spi/src/main/java/org/jboss/deployers/spi/structure/ContextInfo.java	2009-11-06 02:18:48 UTC (rev 96075)
@@ -125,18 +125,4 @@
     * @param modificationType the modification type
     */
    void setModificationType(ModificationType modificationType);
-   
-   /**
-    * A task to be run during deployment cleanup
-    * 
-    * @return the cleanup task
-    */
-   Runnable getCleanupTask();
-   
-   /**
-    * Set a task to be run during deployment cleanup.
-    * 
-    * @param cleanupTask the cleanup task
-    */
-   void setCleanupTask(Runnable cleanupTask);
 }

Modified: projects/jboss-deployers/branches/vfs3/deployers-structure-spi/src/main/java/org/jboss/deployers/structure/spi/DeploymentContext.java
===================================================================
--- projects/jboss-deployers/branches/vfs3/deployers-structure-spi/src/main/java/org/jboss/deployers/structure/spi/DeploymentContext.java	2009-11-06 02:01:48 UTC (rev 96074)
+++ projects/jboss-deployers/branches/vfs3/deployers-structure-spi/src/main/java/org/jboss/deployers/structure/spi/DeploymentContext.java	2009-11-06 02:18:48 UTC (rev 96075)
@@ -407,11 +407,4 @@
     * Cleanup the deployment context
     */
    void cleanup();
-    
-   /**
-    * Additional tasks to run during cleanup
-    * 
-    * @param cleanupTasks
-    */
-   void setCleanTasks(List<Runnable> cleanupTasks);
 }

Modified: projects/jboss-deployers/branches/vfs3/deployers-structure-spi/src/main/java/org/jboss/deployers/structure/spi/helpers/AbstractDeploymentContext.java
===================================================================
--- projects/jboss-deployers/branches/vfs3/deployers-structure-spi/src/main/java/org/jboss/deployers/structure/spi/helpers/AbstractDeploymentContext.java	2009-11-06 02:01:48 UTC (rev 96074)
+++ projects/jboss-deployers/branches/vfs3/deployers-structure-spi/src/main/java/org/jboss/deployers/structure/spi/helpers/AbstractDeploymentContext.java	2009-11-06 02:18:48 UTC (rev 96075)
@@ -160,9 +160,6 @@
    /** The required stage */
    private DeploymentStage requiredStage = DeploymentStages.INSTALLED;
    
-   /** Tasks to run at cleanup */
-   private List<Runnable> cleanupTasks;
-   
    /**
     * Get the scope builder for a deployment context
     * 
@@ -997,14 +994,6 @@
    public void cleanup()
    {
       cleanupRepository(this);
-      
-      if(cleanupTasks != null) 
-      {
-         for(Runnable task : cleanupTasks) 
-         {
-            task.run();
-         }
-      }
    }
 
    public ObjectName preRegister(MBeanServer server, ObjectName name) throws Exception
@@ -1027,11 +1016,6 @@
    public void postDeregister()
    {
    }
-   
-   public void setCleanTasks(List<Runnable> cleanupTasks) 
-   {
-      this.cleanupTasks = cleanupTasks;
-   }
 
    /**
     * Register mbeans

Modified: projects/jboss-deployers/branches/vfs3/deployers-structure-spi/src/main/java/org/jboss/deployers/structure/spi/helpers/AbstractStructuralDeployers.java
===================================================================
--- projects/jboss-deployers/branches/vfs3/deployers-structure-spi/src/main/java/org/jboss/deployers/structure/spi/helpers/AbstractStructuralDeployers.java	2009-11-06 02:01:48 UTC (rev 96074)
+++ projects/jboss-deployers/branches/vfs3/deployers-structure-spi/src/main/java/org/jboss/deployers/structure/spi/helpers/AbstractStructuralDeployers.java	2009-11-06 02:18:48 UTC (rev 96075)
@@ -21,12 +21,9 @@
  */
 package org.jboss.deployers.structure.spi.helpers;
 
-import java.util.List;
-
 import org.jboss.deployers.client.spi.Deployment;
 import org.jboss.deployers.spi.DeploymentException;
 import org.jboss.deployers.spi.attachments.Attachments;
-import org.jboss.deployers.spi.structure.ContextInfo;
 import org.jboss.deployers.spi.structure.StructureMetaData;
 import org.jboss.deployers.spi.structure.StructureMetaDataFactory;
 import org.jboss.deployers.structure.spi.DeploymentContext;
@@ -81,41 +78,19 @@
          }
          catch (DeploymentException e)
          {
-            cleanup(structureMetaData);
             throw e;
          }
          catch (Throwable t)
          {
-            cleanup(structureMetaData);
             throw DeploymentException.rethrowAsDeploymentException("Exception determining structure: " + deployment, t);
          }
       }
-      try {
-         return structureBuilder.populateContext(deployment, structureMetaData);
-      } catch(DeploymentException deploymentException) {
-         cleanup(structureMetaData);
-         throw deploymentException;
-      }
+      
+      return structureBuilder.populateContext(deployment, structureMetaData);
    }
    
    protected void determineStructure(Deployment deployment, StructureMetaData structure) throws Exception
    {
       // NOTHING
    }
-   
-   protected void cleanup(StructureMetaData structureMetaData) {
-      if(structureMetaData != null) {
-         List<ContextInfo> contexts = structureMetaData.getContexts();
-         if(contexts != null) {
-            for(ContextInfo context : contexts) {
-               cleanup(context);
-            }
-         }
-      }
-   }
-      
-   protected void cleanup(ContextInfo contextInfo) {
-      if(contextInfo.getCleanupTask() != null) 
-         contextInfo.getCleanupTask().run();
-   }
 }

Modified: projects/jboss-deployers/branches/vfs3/deployers-structure-spi/src/main/java/org/jboss/deployers/structure/spi/helpers/AbstractStructureBuilder.java
===================================================================
--- projects/jboss-deployers/branches/vfs3/deployers-structure-spi/src/main/java/org/jboss/deployers/structure/spi/helpers/AbstractStructureBuilder.java	2009-11-06 02:01:48 UTC (rev 96074)
+++ projects/jboss-deployers/branches/vfs3/deployers-structure-spi/src/main/java/org/jboss/deployers/structure/spi/helpers/AbstractStructureBuilder.java	2009-11-06 02:18:48 UTC (rev 96075)
@@ -22,7 +22,6 @@
 package org.jboss.deployers.structure.spi.helpers;
 
 import java.lang.reflect.Field;
-import java.util.Collections;
 import java.util.Comparator;
 import java.util.List;
 
@@ -80,10 +79,7 @@
 
          applyStructureMetaData(result, metaData);
          contextInfo.setPredeterminedManagedObjects(deployment.getPredeterminedManagedObjects());
-         
          applyContextInfo(result, contextInfo);
-         
-         
       }
       catch (Throwable t)
       {
@@ -216,9 +212,6 @@
 
       if (structureProcessor != null)
          structureProcessor.applyContextInfo(context, contextInfo);
-      
-      if(contextInfo.getCleanupTask() != null)
-         context.setCleanTasks(Collections.singletonList(contextInfo.getCleanupTask()));
    }
 
    /**

Modified: projects/jboss-deployers/branches/vfs3/deployers-structure-spi/src/main/java/org/jboss/deployers/structure/spi/helpers/ComponentDeploymentContext.java
===================================================================
--- projects/jboss-deployers/branches/vfs3/deployers-structure-spi/src/main/java/org/jboss/deployers/structure/spi/helpers/ComponentDeploymentContext.java	2009-11-06 02:01:48 UTC (rev 96074)
+++ projects/jboss-deployers/branches/vfs3/deployers-structure-spi/src/main/java/org/jboss/deployers/structure/spi/helpers/ComponentDeploymentContext.java	2009-11-06 02:18:48 UTC (rev 96075)
@@ -105,9 +105,6 @@
    /** The mutable scope */
    private ScopeKey mutableScope;
    
-   /** The cleanup tasks */
-   private List<Runnable> cleanupTasks;
-   
    /**
     * For serialization
     */
@@ -641,13 +638,6 @@
    public void cleanup()
    {
       AbstractDeploymentContext.cleanupRepository(this);
-      if(cleanupTasks != null) 
-      {
-         for(Runnable task : cleanupTasks) 
-         {
-            task.run();
-         }
-      }
    }
 
    public ObjectName preRegister(MBeanServer server, ObjectName name) throws Exception
@@ -670,10 +660,6 @@
    public void postDeregister()
    {
    }
-   
-   public void setCleanTasks(List<Runnable> cleanupTasks) {
-      this.cleanupTasks = cleanupTasks;
-   }
 
    /**
     * Register mbeans

Deleted: projects/jboss-deployers/branches/vfs3/deployers-vfs/src/main/java/org/jboss/deployers/vfs/plugins/structure/VFSHandleCleanupTask.java
===================================================================
--- projects/jboss-deployers/branches/vfs3/deployers-vfs/src/main/java/org/jboss/deployers/vfs/plugins/structure/VFSHandleCleanupTask.java	2009-11-06 02:01:48 UTC (rev 96074)
+++ projects/jboss-deployers/branches/vfs3/deployers-vfs/src/main/java/org/jboss/deployers/vfs/plugins/structure/VFSHandleCleanupTask.java	2009-11-06 02:18:48 UTC (rev 96075)
@@ -1,54 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2009, Red Hat Middleware LLC, and individual contributors
- * as indicated by the @author tags. See the copyright.txt file in the
- * distribution for a full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.jboss.deployers.vfs.plugins.structure;
-
-import java.io.Closeable;
-import java.util.List;
-
-import org.jboss.vfs.VFSUtils;
-
-/**
- * VFSHandleCleanupTask - 
- * 
- * Task used to close VFS handles.
- * 
- * @author <a href="baileyje at gmail.com">John Bailey</a>
- * @version $Revision: 1.1 $
- */
-public class VFSHandleCleanupTask implements Runnable {
-   /** The Handles  */
-   private final List<Closeable> handles;
-
-   /**
-    * Constructs a new VFSHandleContext 
-    * 
-    * @param handles List of VFS handles
-    */
-   public VFSHandleCleanupTask(List<Closeable> handles) {
-      this.handles = handles;
-   }
-
-   public void run() {
-      VFSUtils.safeClose(handles);
-   }
-   
-}

Modified: projects/jboss-deployers/branches/vfs3/deployers-vfs/src/main/java/org/jboss/deployers/vfs/plugins/structure/jar/JARStructure.java
===================================================================
--- projects/jboss-deployers/branches/vfs3/deployers-vfs/src/main/java/org/jboss/deployers/vfs/plugins/structure/jar/JARStructure.java	2009-11-06 02:01:48 UTC (rev 96074)
+++ projects/jboss-deployers/branches/vfs3/deployers-vfs/src/main/java/org/jboss/deployers/vfs/plugins/structure/jar/JARStructure.java	2009-11-06 02:18:48 UTC (rev 96075)
@@ -21,13 +21,9 @@
 */
 package org.jboss.deployers.vfs.plugins.structure.jar;
 
-import java.io.Closeable;
-import java.io.IOException;
-import java.util.ArrayList;
-import java.util.HashSet;
-import java.util.List;
 import java.util.Set;
-import java.util.concurrent.ScheduledExecutorService;
+import java.util.Collections;
+import java.util.HashSet;
 
 import org.jboss.beans.metadata.api.annotations.Install;
 import org.jboss.beans.metadata.api.annotations.Uninstall;
@@ -35,11 +31,7 @@
 import org.jboss.deployers.spi.deployer.matchers.JarExtensionProvider;
 import org.jboss.deployers.spi.structure.ContextInfo;
 import org.jboss.deployers.vfs.plugins.structure.AbstractVFSStructureDeployer;
-import org.jboss.deployers.vfs.plugins.structure.VFSHandleCleanupTask;
 import org.jboss.deployers.vfs.spi.structure.StructureContext;
-import org.jboss.vfs.TempFileProvider;
-import org.jboss.vfs.VFS;
-import org.jboss.vfs.VFSUtils;
 import org.jboss.vfs.VirtualFile;
 
 /**
@@ -51,29 +43,14 @@
  */
 public class JARStructure extends AbstractVFSStructureDeployer
 {
-   public static final Set<String> DEFAULT_SUFFIXES = new HashSet<String>(); 
-   static {
-      
-      DEFAULT_SUFFIXES.add(".zip");
-      DEFAULT_SUFFIXES.add(".ear");
-      DEFAULT_SUFFIXES.add(".jar");
-      DEFAULT_SUFFIXES.add(".rar");
-      DEFAULT_SUFFIXES.add(".war");
-      DEFAULT_SUFFIXES.add(".sar");
-      DEFAULT_SUFFIXES.add(".har");
-      DEFAULT_SUFFIXES.add(".aop");
-   }
-   
-   private final Set<String> suffixes = new HashSet<String>();//Collections.synchronizedSet(new HashSet<String>());
+   private final Set<String> suffixes = Collections.synchronizedSet(new HashSet<String>());
 
-   private ScheduledExecutorService scheduledExecutorService;
-   
    /**
     * Create a new JARStructure. with the default suffixes
     */
    public JARStructure()
    {
-      this(DEFAULT_SUFFIXES);
+      this(null);
    }
 
    /**
@@ -87,28 +64,8 @@
          setSuffixes(suffixes);
       setRelativeOrder(10000);
    }
-   
-   /**
-    * Get the scheduled executor service.
-    *
-    * @return the scheduled executor service
-    */
-   public ScheduledExecutorService getScheduledExecutorService()
-   {
-      return scheduledExecutorService;
-   }
 
    /**
-    * Set the scheduled executor service.
-    *
-    * @param scheduledExecutorService the scheduled executor service
-    */
-   public void setScheduledExecutorService(final ScheduledExecutorService scheduledExecutorService)
-   {
-      this.scheduledExecutorService = scheduledExecutorService;
-   }
-
-   /**
     * Gets the set of suffixes recognised as jars
     * 
     * @return the set of suffixes
@@ -145,21 +102,26 @@
    }
 
    private boolean isArchive(String name) {
-      int idx = name.lastIndexOf('.');
-      if(idx == -1)
-         return false;
-      return suffixes.contains(name.substring(idx).toLowerCase());
+      int i = name.length() - 1;
+      for (;;) {
+         i = name.lastIndexOf('.', i);
+         if (i == -1) {
+            return false;
+         }
+         if (suffixes.contains(name.substring(i))) {
+            return true;
+         }
+      }
    }
 
    public boolean determineStructure(StructureContext structureContext) throws DeploymentException
    {
       ContextInfo context = null;
       VirtualFile file = structureContext.getFile();
-      final List<Closeable> handles = new ArrayList<Closeable>();
       try
       {
          boolean trace = log.isTraceEnabled();
-         
+
          if (isLeaf(file) == false)
          {
             // For non top level directories that don't look like jars
@@ -169,7 +131,7 @@
                if (structureContext.isTopLevel() == false)
                {
                   VirtualFile child = file.getChild("META-INF");
-                  if (child.exists())
+                  if (child != null)
                   {
                      if (trace)
                         log.trace("... ok - non top level directory has a META-INF subdirectory");
@@ -195,12 +157,6 @@
          {
             if (trace)
                log.trace("... ok - its an archive or at least pretending to be.");
-            
-            try {
-               handles.add(VFS.mountZipExpanded(file, file, TempFileProvider.create(file.getName(), scheduledExecutorService)));
-            } catch (IOException e) {
-               DeploymentException.rethrowAsDeploymentException("Failed to mount JAR archive", e);
-            }
          }
          else
          {
@@ -232,16 +188,11 @@
 
             // We try all the children as potential subdeployments
             addAllChildren(structureContext);
-            
-            context.setCleanupTask(new VFSHandleCleanupTask(handles));
          }
          return valid;
       }
       catch (Exception e)
       {
-         // Undo all mounts
-         VFSUtils.safeClose(handles);
-         
          // Remove the invalid context
          if(context != null)
             structureContext.removeChild(context);

Modified: projects/jboss-deployers/branches/vfs3/deployers-vfs/src/test/java/org/jboss/test/deployers/vfs/structure/file/test/CombinedFileStructureUnitTestCase.java
===================================================================
--- projects/jboss-deployers/branches/vfs3/deployers-vfs/src/test/java/org/jboss/test/deployers/vfs/structure/file/test/CombinedFileStructureUnitTestCase.java	2009-11-06 02:01:48 UTC (rev 96074)
+++ projects/jboss-deployers/branches/vfs3/deployers-vfs/src/test/java/org/jboss/test/deployers/vfs/structure/file/test/CombinedFileStructureUnitTestCase.java	2009-11-06 02:18:48 UTC (rev 96075)
@@ -48,8 +48,7 @@
    public void testDirectory() throws Throwable
    {
       // The jar deployer recognises the directory in the combined test
-      VFSDeploymentContext vfsDeploymentContext = assertDeployNoChildren("/structure/file", "directory");
-      assertNotNull(vfsDeploymentContext.getVfsHandles());
+      assertDeployNoChildren("/structure/file", "directory");
    }
 
    public void testNotKnownInSubdirectory() throws Throwable

Modified: projects/jboss-deployers/branches/vfs3/pom.xml
===================================================================
--- projects/jboss-deployers/branches/vfs3/pom.xml	2009-11-06 02:01:48 UTC (rev 96074)
+++ projects/jboss-deployers/branches/vfs3/pom.xml	2009-11-06 02:18:48 UTC (rev 96075)
@@ -28,8 +28,8 @@
     <version.jboss.classloader>2.2.0-SNAPSHOT</version.jboss.classloader>
     <version.jboss.classloading.spi>5.1.0.SP1</version.jboss.classloading.spi>
     <version.jboss.common.core>2.2.14.GA</version.jboss.common.core>
-    <version.jboss.logging.spi>2.2.0.CR1</version.jboss.logging.spi>
-    <version.jboss.logging.log4j>2.2.0.CR1</version.jboss.logging.log4j>
+    <version.jboss.logging.spi>2.0.5.GA</version.jboss.logging.spi>
+    <version.jboss.logging.log4j>2.0.5.GA</version.jboss.logging.log4j>
     <version.jbossxb>2.0.2-SNAPSHOT</version.jbossxb>
     <version.jboss.aop>2.1.0.CR3</version.jboss.aop>
     <version.org.jboss.test>1.1.1.GA</version.org.jboss.test>




More information about the jboss-cvs-commits mailing list