[jboss-cvs] JBossAS SVN: r79421 - in projects/jboss-seam-int/branches/Branch_5_0: jbossas/src/main/java/org/jboss/seam/integration/jbossas/vfs and 1 other directories.
jboss-cvs-commits at lists.jboss.org
jboss-cvs-commits at lists.jboss.org
Mon Oct 13 15:41:13 EDT 2008
Author: alesj
Date: 2008-10-13 15:41:12 -0400 (Mon, 13 Oct 2008)
New Revision: 79421
Modified:
projects/jboss-seam-int/branches/Branch_5_0/jbossas/
projects/jboss-seam-int/branches/Branch_5_0/jbossas/src/main/java/org/jboss/seam/integration/jbossas/vfs/VFSScanner.java
projects/jboss-seam-int/branches/Branch_5_0/microcontainer/src/main/java/org/jboss/seam/integration/microcontainer/deployers/SeamUrlIntegrationDeployer.java
Log:
Move diff from trunk to branch.
Property changes on: projects/jboss-seam-int/branches/Branch_5_0/jbossas
___________________________________________________________________
Name: svn:ignore
- target
jboss-seam-int-jbossas.iml
.classpath
.project
+ target
jboss-seam-int-jbossas.iml
Modified: projects/jboss-seam-int/branches/Branch_5_0/jbossas/src/main/java/org/jboss/seam/integration/jbossas/vfs/VFSScanner.java
===================================================================
--- projects/jboss-seam-int/branches/Branch_5_0/jbossas/src/main/java/org/jboss/seam/integration/jbossas/vfs/VFSScanner.java 2008-10-13 19:32:20 UTC (rev 79420)
+++ projects/jboss-seam-int/branches/Branch_5_0/jbossas/src/main/java/org/jboss/seam/integration/jbossas/vfs/VFSScanner.java 2008-10-13 19:41:12 UTC (rev 79421)
@@ -1,189 +1,196 @@
-package org.jboss.seam.integration.jbossas.vfs;
-
-
-import java.io.File;
-import java.io.IOException;
-import java.net.URL;
-import java.util.Enumeration;
-import java.util.List;
-
-import org.jboss.seam.deployment.AbstractScanner;
-import org.jboss.seam.deployment.DeploymentStrategy;
-import org.jboss.seam.log.LogProvider;
-import org.jboss.seam.log.Logging;
-import org.jboss.virtual.VFS;
-import org.jboss.virtual.VirtualFile;
-
-/**
- * JBoss VSF aware scanner.
- *
- * @author <a href="mailto:ales.justin at jboss.com">Ales Justin</a>
- * @author Pete Muir
- */
-public class VFSScanner extends AbstractScanner
-{
- private static final LogProvider log = Logging.getLogProvider(VFSScanner.class);
-
- private long timestamp;
-
- public VFSScanner(DeploymentStrategy deploymentStrategy)
- {
- super(deploymentStrategy);
- }
-
- /**
- * Get the virtual file root.
- *
- * @param url the root URL
- * @param parentDepth level of parent depth
- * @return actual virtual file from url param
- * @throws IOException for any error
- */
- protected static VirtualFile getRoot(URL url, int parentDepth) throws IOException
- {
- log.trace("Root url: " + url);
-
- String urlString = url.toString();
- // TODO - this should go away once we figure out why -exp.war is part of CL resources
- if (urlString.startsWith("vfs") == false)
- return null;
-
- int p = urlString.indexOf(":");
- String file = urlString.substring(p + 1);
- URL vfsurl = null;
- String relative;
- File fp = new File(file);
-
- log.trace("File: " + fp);
-
- if (fp.exists())
- {
- vfsurl = fp.getParentFile().toURL();
- relative = fp.getName();
- }
- else
- {
- File curr = fp;
- relative = fp.getName();
- while ((curr = curr.getParentFile()) != null)
- {
- if (curr.exists())
- {
- vfsurl = curr.toURL();
- break;
- }
- else
- {
- relative = curr.getName() + "/" + relative;
- }
- }
- }
-
- log.trace("URL: " + vfsurl + ", relative: " + relative);
-
- VirtualFile top = VFS.getRoot(vfsurl);
- top = top.getChild(relative);
- while(parentDepth > 0)
- {
- if (top == null)
- throw new IllegalArgumentException("Null parent: " + vfsurl + ", relative: " + relative);
- top = top.getParent();
- parentDepth--;
- }
-
- log.trace("Top: " + top);
-
- return top;
- }
-
- public void scanDirectories(File[] directories)
- {
- for (File dir : directories)
- {
- try
- {
- VirtualFile root = getRoot(dir.toURL(), 0);
- if (root != null)
- handleRoot(root);
- else
- log.trace("Null root: " + dir);
- }
- catch (IOException e)
- {
- log.warn("Cannot scan directory " + dir, e);
- }
- }
- }
-
- public void scanResources(String[] resources)
- {
- for (String resourceName : resources)
- {
- try
- {
- Enumeration<URL> urlEnum = getDeploymentStrategy().getClassLoader().getResources(resourceName);
- while (urlEnum.hasMoreElements())
- {
- URL url = urlEnum.nextElement();
- VirtualFile root = getRoot(url, resourceName.lastIndexOf('/') > 0 ? 2 : 1);
- if (root != null)
- handleRoot(root);
- else
- log.trace("Null root: " + url);
- }
- }
- catch (IOException ioe)
- {
- log.warn("Cannot read resource: " + resourceName, ioe);
- }
- }
- }
-
- /**
- * Handle virtual file root.
- *
- * @param root the virtual file root
- * @throws IOException for any error
- */
- protected void handleRoot(VirtualFile root) throws IOException
- {
- if (root.isLeaf())
- {
- touchTimestamp(root);
- getDeploymentStrategy().handle(root.getPathName());
- }
- else
- {
- String rootPathName = root.getPathName();
- int rootPathNameLength = rootPathName.length();
- List<VirtualFile> children = root.getChildrenRecursively();
- for (VirtualFile child : children)
- {
- if (child.isLeaf())
- {
- String name = child.getPathName();
- // move past '/'
- int length = rootPathNameLength;
- if (name.charAt(length) == '/')
- length++;
- touchTimestamp(child);
- getDeploymentStrategy().handle(name.substring(length));
- }
- }
- }
- }
-
- private void touchTimestamp(VirtualFile file) throws IOException
- {
- if (file.getLastModified() > timestamp)
- {
- timestamp = file.getLastModified();
- }
- }
-
- @Override
- public long getTimestamp()
- {
- return timestamp;
- }
-}
+package org.jboss.seam.integration.jbossas.vfs;
+
+
+import java.io.File;
+import java.io.IOException;
+import java.net.URL;
+import java.util.Enumeration;
+import java.util.List;
+
+import org.jboss.seam.deployment.AbstractScanner;
+import org.jboss.seam.deployment.DeploymentStrategy;
+import org.jboss.seam.log.LogProvider;
+import org.jboss.seam.log.Logging;
+import org.jboss.virtual.VFS;
+import org.jboss.virtual.VirtualFile;
+
+/**
+ * JBoss VSF aware scanner.
+ *
+ * @author <a href="mailto:ales.justin at jboss.com">Ales Justin</a>
+ * @author Pete Muir
+ */
+public class VFSScanner extends AbstractScanner
+{
+ private static final LogProvider log = Logging.getLogProvider(VFSScanner.class);
+
+ private long timestamp;
+
+ public VFSScanner(DeploymentStrategy deploymentStrategy)
+ {
+ super(deploymentStrategy);
+ }
+
+ /**
+ * Get the virtual file root.
+ *
+ * @param url the root URL
+ * @param parentDepth level of parent depth
+ * @return actual virtual file from url param
+ * @throws IOException for any error
+ */
+ protected static VirtualFile getRoot(URL url, int parentDepth) throws IOException
+ {
+ log.trace("Root url: " + url);
+
+ String urlString = url.toString();
+ // TODO - this should go away once we figure out why -exp.war is part of CL resources
+ if (urlString.startsWith("vfs") == false)
+ return null;
+
+ int p = urlString.indexOf(":");
+ String file = urlString.substring(p + 1);
+ URL vfsurl = null;
+ String relative;
+ File fp = new File(file);
+
+ log.trace("File: " + fp);
+
+ if (fp.exists())
+ {
+ vfsurl = fp.getParentFile().toURL();
+ relative = fp.getName();
+ }
+ else
+ {
+ File curr = fp;
+ relative = fp.getName();
+ while ((curr = curr.getParentFile()) != null)
+ {
+ if (curr.exists())
+ {
+ vfsurl = curr.toURL();
+ break;
+ }
+ else
+ {
+ relative = curr.getName() + "/" + relative;
+ }
+ }
+ }
+
+ log.trace("URL: " + vfsurl + ", relative: " + relative);
+
+ VirtualFile top = VFS.getRoot(vfsurl);
+ top = top.getChild(relative);
+ while(parentDepth > 0)
+ {
+ if (top == null)
+ throw new IllegalArgumentException("Null parent: " + vfsurl + ", relative: " + relative);
+ top = top.getParent();
+ parentDepth--;
+ }
+
+ log.trace("Top: " + top);
+
+ return top;
+ }
+
+ public void scanDirectories(File[] directories)
+ {
+ for (File dir : directories)
+ {
+ try
+ {
+ VirtualFile root = getRoot(dir.toURL(), 0);
+ if (root != null)
+ handleRoot(root);
+ else
+ log.trace("Null root: " + dir);
+ }
+ catch (IOException e)
+ {
+ log.warn("Cannot scan directory " + dir, e);
+ }
+ }
+ }
+
+ public void scanResources(String[] resources)
+ {
+ for (String resourceName : resources)
+ {
+ try
+ {
+ Enumeration<URL> urlEnum = getDeploymentStrategy().getClassLoader().getResources(resourceName);
+ while (urlEnum.hasMoreElements())
+ {
+ URL url = urlEnum.nextElement();
+ VirtualFile root = getRoot(url, resourceName.lastIndexOf('/') > 0 ? 2 : 1);
+ if (root != null)
+ handleRoot(root);
+ else
+ log.trace("Null root: " + url);
+ }
+ }
+ catch (IOException ioe)
+ {
+ log.warn("Cannot read resource: " + resourceName, ioe);
+ }
+ }
+ }
+
+ /**
+ * Handle virtual file root.
+ *
+ * @param root the virtual file root
+ * @throws IOException for any error
+ */
+ protected void handleRoot(VirtualFile root) throws IOException
+ {
+ if (root.isLeaf())
+ {
+ touchTimestamp(root);
+ getDeploymentStrategy().handle(root.getPathName());
+ }
+ else
+ {
+ String rootPathName = root.getPathName();
+ int rootPathNameLength = rootPathName.length();
+ List<VirtualFile> children = root.getChildrenRecursively();
+ for (VirtualFile child : children)
+ {
+ if (child.isLeaf())
+ {
+ String name = child.getPathName();
+ // move past '/'
+ int length = rootPathNameLength;
+ if (name.charAt(length) == '/')
+ length++;
+ touchTimestamp(child);
+ getDeploymentStrategy().handle(name.substring(length));
+ }
+ }
+ }
+ }
+
+ /**
+ * Update timestamp.
+ *
+ * @param file the file to check
+ * @throws IOException for any error
+ */
+ private void touchTimestamp(VirtualFile file) throws IOException
+ {
+ long lastModified = file.getLastModified();
+ if (lastModified > timestamp)
+ {
+ timestamp = lastModified;
+ }
+ }
+
+ @Override
+ public long getTimestamp()
+ {
+ return timestamp;
+ }
+}
Modified: projects/jboss-seam-int/branches/Branch_5_0/microcontainer/src/main/java/org/jboss/seam/integration/microcontainer/deployers/SeamUrlIntegrationDeployer.java
===================================================================
--- projects/jboss-seam-int/branches/Branch_5_0/microcontainer/src/main/java/org/jboss/seam/integration/microcontainer/deployers/SeamUrlIntegrationDeployer.java 2008-10-13 19:32:20 UTC (rev 79420)
+++ projects/jboss-seam-int/branches/Branch_5_0/microcontainer/src/main/java/org/jboss/seam/integration/microcontainer/deployers/SeamUrlIntegrationDeployer.java 2008-10-13 19:41:12 UTC (rev 79421)
@@ -39,7 +39,13 @@
{
super(input);
setIntegrationURL(getURL());
- setFiles(new String[]{"seam.properties", "META-INF/seam.properties", "META-INF/components.xml"});
+ setFiles(new String[]{
+ "seam.properties",
+ "META-INF/seam.properties",
+ "WEB-INF/classes/seam.properties",
+ "META-INF/components.xml",
+ "WEB-INF/classes/META-INF/components.xml"}
+ );
}
/**
More information about the jboss-cvs-commits
mailing list