[jboss-cvs] JBossAS SVN: r87802 - in projects/jboss-seam-int/trunk: jbossas/src/main/java/org/jboss/seam/integration/jbossas and 2 other directories.

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Fri Apr 24 10:46:38 EDT 2009


Author: alesj
Date: 2009-04-24 10:46:37 -0400 (Fri, 24 Apr 2009)
New Revision: 87802

Added:
   projects/jboss-seam-int/trunk/jbossas/src/main/java/org/jboss/seam/integration/jbossas/vfs/FileModifiableResource.java
   projects/jboss-seam-int/trunk/jbossas/src/main/java/org/jboss/seam/integration/jbossas/vfs/ModifiableResource.java
   projects/jboss-seam-int/trunk/jbossas/src/main/java/org/jboss/seam/integration/jbossas/vfs/VirtualFileModifiableResource.java
Removed:
   projects/jboss-seam-int/trunk/jbossas/src/main/java/org/jboss/seam/integration/jbossas/servlet/
   projects/jboss-seam-int/trunk/jbossas/src/main/java/org/jboss/seam/integration/jbossas/vdf/
   projects/jboss-seam-int/trunk/microcontainer/src/main/java/org/jboss/seam/integration/microcontainer/vdf/
Modified:
   projects/jboss-seam-int/trunk/jbossas/src/main/java/org/jboss/seam/integration/jbossas/vfs/VFSScanner.java
   projects/jboss-seam-int/trunk/pom.xml
Log:
Remove VDF int - it was already moved to another project.
Handle new Seam AbstractScanner via reflection.

Added: projects/jboss-seam-int/trunk/jbossas/src/main/java/org/jboss/seam/integration/jbossas/vfs/FileModifiableResource.java
===================================================================
--- projects/jboss-seam-int/trunk/jbossas/src/main/java/org/jboss/seam/integration/jbossas/vfs/FileModifiableResource.java	                        (rev 0)
+++ projects/jboss-seam-int/trunk/jbossas/src/main/java/org/jboss/seam/integration/jbossas/vfs/FileModifiableResource.java	2009-04-24 14:46:37 UTC (rev 87802)
@@ -0,0 +1,53 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2008, 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.seam.integration.jbossas.vfs;
+
+import java.io.File;
+import java.io.IOException;
+
+/**
+ * File delegate to ModifieableResource.
+ *
+ * @author <a href="mailto:ales.justin at jboss.org">Ales Justin</a>
+ */
+public class FileModifiableResource implements ModifiableResource
+{
+   private File file;
+
+   protected File getFile()
+   {
+      if (file == null)
+         throw new IllegalArgumentException("No file set.");
+
+      return file;
+   }
+
+   public void setFile(File file)
+   {
+      this.file = file;
+   }
+
+   public long getLastModified() throws IOException
+   {
+      return getFile().lastModified();
+   }
+}
\ No newline at end of file

Added: projects/jboss-seam-int/trunk/jbossas/src/main/java/org/jboss/seam/integration/jbossas/vfs/ModifiableResource.java
===================================================================
--- projects/jboss-seam-int/trunk/jbossas/src/main/java/org/jboss/seam/integration/jbossas/vfs/ModifiableResource.java	                        (rev 0)
+++ projects/jboss-seam-int/trunk/jbossas/src/main/java/org/jboss/seam/integration/jbossas/vfs/ModifiableResource.java	2009-04-24 14:46:37 UTC (rev 87802)
@@ -0,0 +1,40 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2008, 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.seam.integration.jbossas.vfs;
+
+import java.io.IOException;
+
+/**
+ * We can check this resource for last modified timestamp.
+ *
+ * @author <a href="mailto:ales.justin at jboss.org">Ales Justin</a>
+ */
+public interface ModifiableResource
+{
+   /**
+    * Get last modified timestamp.
+    *
+    * @return the last modified timestamp
+    * @throws IOException for any error
+    */
+   long getLastModified() throws IOException;
+}

Modified: projects/jboss-seam-int/trunk/jbossas/src/main/java/org/jboss/seam/integration/jbossas/vfs/VFSScanner.java
===================================================================
--- projects/jboss-seam-int/trunk/jbossas/src/main/java/org/jboss/seam/integration/jbossas/vfs/VFSScanner.java	2009-04-24 14:29:31 UTC (rev 87801)
+++ projects/jboss-seam-int/trunk/jbossas/src/main/java/org/jboss/seam/integration/jbossas/vfs/VFSScanner.java	2009-04-24 14:46:37 UTC (rev 87802)
@@ -3,6 +3,7 @@
 
 import java.io.File;
 import java.io.IOException;
+import java.lang.reflect.Method;
 import java.net.URL;
 import java.util.Enumeration;
 import java.util.List;
@@ -25,6 +26,7 @@
 {
    protected final LogProvider log = Logging.getLogProvider(getClass());
 
+   protected static Method handleMethod;
    private long timestamp;
 
    public VFSScanner(DeploymentStrategy deploymentStrategy)
@@ -32,6 +34,19 @@
       super(deploymentStrategy);
    }
 
+   static
+   {
+      try
+      {
+         handleMethod = AbstractScanner.class.getDeclaredMethod("handle", String.class);
+         handleMethod.setAccessible(true);
+      }
+      catch (Throwable t)
+      {
+         handleMethod = null;
+      }
+   }
+
    /**
     * Get the virtual file root.
     *
@@ -138,18 +153,27 @@
          }
       }
 
+      // one wrapper delegate per invocation
+      FileModifiableResource delegate = new FileModifiableResource();
+
       log.trace("Handling directory: " + file);
-      for (File child: file.listFiles())
+      for (File child : file.listFiles())
       {
-         String newPath = path==null ? child.getName() : path + '/' + child.getName();
+         String newPath = (path == null) ? child.getName() : path + '/' + child.getName();
          if (child.isDirectory())
          {
             handleDirectory(child, newPath, excludedDirectories);
          }
          else
          {
-            touchTimestamp(child);
-            handleItemIgnoreErrors(newPath);
+            delegate.setFile(child);
+            try
+            {
+               handleItem(delegate, newPath);
+            }
+            catch (IOException ignored)
+            {
+            }
          }
       }
    }
@@ -186,13 +210,18 @@
     */
    protected void handleRoot(VirtualFile root) throws IOException
    {
+      // one wrapper delegate per invocation
+      VirtualFileModifiableResource delegate = new VirtualFileModifiableResource();
+
       if (root.isLeaf())
       {
-         touchTimestamp(root);
+         delegate.setFile(root);
+         touchTimestamp(delegate);
          handleItemIgnoreErrors(root.getPathName());
       }
       else
       {
+         boolean isArchive = root.isArchive();
          String rootPathName = root.getPathName();
          int rootPathNameLength = rootPathName.length();
          List<VirtualFile> children = root.getChildrenRecursively(LeafVirtualFileFilter.INSTANCE);
@@ -203,13 +232,58 @@
             int length = rootPathNameLength;
             if (name.charAt(length) == '/')
                length++;
-            touchTimestamp(child);
-            handleItemIgnoreErrors(name.substring(length));
+
+            String path = name.substring(length);
+
+            if (isArchive)
+            {
+               // don't timestamp check zip entries, just handle them
+               handleItemIgnoreErrors(path);
+            }
+            else
+            {
+               // check if we need to touch
+               delegate.setFile(child);
+               handleItem(delegate, path);
+            }
          }
       }
    }
 
    /**
+    * Handle item.
+    *
+    * @param resource the item's resource
+    * @param name the item name
+    * @throws IOException for any error
+    */
+   protected void handleItem(ModifiableResource resource, String name) throws IOException
+   {
+      boolean doTouch = true;
+      try
+      {
+         if (handleMethod != null)
+            doTouch = (Boolean)handleMethod.invoke(this, name);
+      }
+      catch (Exception e)
+      {
+         IOException ioe = new IOException();
+         ioe.initCause(e);
+         throw ioe;
+      }
+
+      if (doTouch)
+      {
+         touchTimestamp(resource);
+      }
+      // we haven't handled it before
+      if (handleMethod == null)
+      {
+         handleItemIgnoreErrors(name);
+      }
+   }
+
+   /**
     * Handle item, ignore any errors.
     *
     * @param name the item name
@@ -232,28 +306,9 @@
     * @param file the file to check
     * @throws IOException for any error
     */
-   private void touchTimestamp(VirtualFile file) throws IOException
+   private void touchTimestamp(ModifiableResource file) throws IOException
    {
-      touchTimestamp(file.getLastModified());
-   }
-
-   /**
-    * Update timestamp.
-    *
-    * @param file the file to check
-    */
-   private void touchTimestamp(File file)
-   {
-      touchTimestamp(file.lastModified());
-   }
-
-   /**
-    * Update timestamp.
-    *
-    * @param lastModified the timestamp to check
-    */
-   private void touchTimestamp(long lastModified)
-   {
+      long lastModified = file.getLastModified();
       if (lastModified > timestamp)
       {
          timestamp = lastModified;

Added: projects/jboss-seam-int/trunk/jbossas/src/main/java/org/jboss/seam/integration/jbossas/vfs/VirtualFileModifiableResource.java
===================================================================
--- projects/jboss-seam-int/trunk/jbossas/src/main/java/org/jboss/seam/integration/jbossas/vfs/VirtualFileModifiableResource.java	                        (rev 0)
+++ projects/jboss-seam-int/trunk/jbossas/src/main/java/org/jboss/seam/integration/jbossas/vfs/VirtualFileModifiableResource.java	2009-04-24 14:46:37 UTC (rev 87802)
@@ -0,0 +1,54 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2008, 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.seam.integration.jbossas.vfs;
+
+import java.io.IOException;
+
+import org.jboss.virtual.VirtualFile;
+
+/**
+ * VirtualFile delegate to ModifieableResource.
+ *
+ * @author <a href="mailto:ales.justin at jboss.org">Ales Justin</a>
+ */
+public class VirtualFileModifiableResource implements ModifiableResource
+{
+   private VirtualFile file;
+
+   protected VirtualFile getFile()
+   {
+      if (file == null)
+         throw new IllegalArgumentException("No file set.");
+
+      return file;
+   }
+
+   public void setFile(VirtualFile file)
+   {
+      this.file = file;
+   }
+
+   public long getLastModified() throws IOException
+   {
+      return getFile().getLastModified();
+   }
+}

Modified: projects/jboss-seam-int/trunk/pom.xml
===================================================================
--- projects/jboss-seam-int/trunk/pom.xml	2009-04-24 14:29:31 UTC (rev 87801)
+++ projects/jboss-seam-int/trunk/pom.xml	2009-04-24 14:46:37 UTC (rev 87802)
@@ -28,16 +28,16 @@
   
   <properties>
     <version.jboss.seam>2.1.1-SNAPSHOT</version.jboss.seam>
-    <version.jboss.vfs>2.2.0.M1</version.jboss.vfs>
-    <version.jboss.man>2.0.0.GA</version.jboss.man>
-    <version.jboss.microcontainer>2.2.0.M1</version.jboss.microcontainer>
-    <version.jboss.cl>2.2.0.M2</version.jboss.cl>
-    <version.jboss.deployers>2.2.0.M1</version.jboss.deployers>
-    <version.jboss.common.core>2.2.12.GA</version.jboss.common.core>
+    <version.jboss.vfs>2.1.1.GA</version.jboss.vfs>
+    <version.jboss.man>2.1.0.CR8</version.jboss.man>
+    <version.jboss.microcontainer>2.0.5.GA</version.jboss.microcontainer>
+    <version.jboss.cl>2.0.5.GA</version.jboss.cl>
+    <version.jboss.deployers>2.0.6.GA</version.jboss.deployers>
+    <version.jboss.common.core>2.2.13.GA</version.jboss.common.core>
     <version.jboss.logging.spi>2.0.5.GA</version.jboss.logging.spi>
     <version.jboss.classloading.spi>5.0.3.GA</version.jboss.classloading.spi>
-    <version.jboss.metadata>1.0.0.CR17</version.jboss.metadata>
-    <version.jbossxb>2.0.1.Beta3</version.jbossxb>
+    <version.jboss.metadata>1.0.0.CR18</version.jboss.metadata>
+    <version.jbossxb>2.0.1.GA</version.jbossxb>
     <version.servlet.api>2.5</version.servlet.api>
     <version.org.jboss.test>1.1.1.GA</version.org.jboss.test>
     <version.junit>4.4</version.junit>




More information about the jboss-cvs-commits mailing list