[jboss-cvs] JBossAS SVN: r94693 - in projects/jboss-deployers/branches/vfs3/deployers-vfs/src/main/java/org/jboss/deployers/vfs/plugins: structure and 4 other directories.
jboss-cvs-commits at lists.jboss.org
jboss-cvs-commits at lists.jboss.org
Mon Oct 12 15:30:44 EDT 2009
Author: david.lloyd at jboss.com
Date: 2009-10-12 15:30:43 -0400 (Mon, 12 Oct 2009)
New Revision: 94693
Modified:
projects/jboss-deployers/branches/vfs3/deployers-vfs/src/main/java/org/jboss/deployers/vfs/plugins/classloader/InMemoryClassesDeployer.java
projects/jboss-deployers/branches/vfs3/deployers-vfs/src/main/java/org/jboss/deployers/vfs/plugins/structure/VFSDeploymentResourceLoaderImpl.java
projects/jboss-deployers/branches/vfs3/deployers-vfs/src/main/java/org/jboss/deployers/vfs/plugins/structure/file/FileStructure.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/main/java/org/jboss/deployers/vfs/plugins/structure/war/WARStructure.java
projects/jboss-deployers/branches/vfs3/deployers-vfs/src/main/java/org/jboss/deployers/vfs/plugins/vfs/VirtualFileSerializator.java
Log:
More API usage fixes
Modified: projects/jboss-deployers/branches/vfs3/deployers-vfs/src/main/java/org/jboss/deployers/vfs/plugins/classloader/InMemoryClassesDeployer.java
===================================================================
--- projects/jboss-deployers/branches/vfs3/deployers-vfs/src/main/java/org/jboss/deployers/vfs/plugins/classloader/InMemoryClassesDeployer.java 2009-10-12 19:01:18 UTC (rev 94692)
+++ projects/jboss-deployers/branches/vfs3/deployers-vfs/src/main/java/org/jboss/deployers/vfs/plugins/classloader/InMemoryClassesDeployer.java 2009-10-12 19:30:43 UTC (rev 94693)
@@ -29,7 +29,6 @@
import org.jboss.deployers.vfs.spi.deployer.AbstractVFSRealDeployer;
import org.jboss.deployers.vfs.spi.structure.VFSDeploymentUnit;
import org.jboss.util.id.GUID;
-import org.jboss.vfs.MemoryFileFactory;
import org.jboss.vfs.VirtualFile;
/**
Modified: projects/jboss-deployers/branches/vfs3/deployers-vfs/src/main/java/org/jboss/deployers/vfs/plugins/structure/VFSDeploymentResourceLoaderImpl.java
===================================================================
--- projects/jboss-deployers/branches/vfs3/deployers-vfs/src/main/java/org/jboss/deployers/vfs/plugins/structure/VFSDeploymentResourceLoaderImpl.java 2009-10-12 19:01:18 UTC (rev 94692)
+++ projects/jboss-deployers/branches/vfs3/deployers-vfs/src/main/java/org/jboss/deployers/vfs/plugins/structure/VFSDeploymentResourceLoaderImpl.java 2009-10-12 19:30:43 UTC (rev 94693)
@@ -57,14 +57,7 @@
public VirtualFile getFile(String path)
{
- try
- {
- return root.getChild(path);
- }
- catch (IOException e)
- {
- return null;
- }
+ return root.getChild(path);
}
public URL getResource(String name)
@@ -74,10 +67,6 @@
VirtualFile child = root.getChild(name);
return child != null ? child.toURL() : null;
}
- catch (URISyntaxException e)
- {
- return null;
- }
catch (MalformedURLException e)
{
return null;
@@ -102,10 +91,6 @@
else
return null;
}
- catch (URISyntaxException e)
- {
- return null;
- }
catch (MalformedURLException e)
{
return null;
Modified: projects/jboss-deployers/branches/vfs3/deployers-vfs/src/main/java/org/jboss/deployers/vfs/plugins/structure/file/FileStructure.java
===================================================================
--- projects/jboss-deployers/branches/vfs3/deployers-vfs/src/main/java/org/jboss/deployers/vfs/plugins/structure/file/FileStructure.java 2009-10-12 19:01:18 UTC (rev 94692)
+++ projects/jboss-deployers/branches/vfs3/deployers-vfs/src/main/java/org/jboss/deployers/vfs/plugins/structure/file/FileStructure.java 2009-10-12 19:30:43 UTC (rev 94693)
@@ -22,6 +22,7 @@
package org.jboss.deployers.vfs.plugins.structure.file;
import java.util.Set;
+import java.util.Arrays;
import java.util.concurrent.CopyOnWriteArraySet;
import org.jboss.beans.metadata.api.annotations.Install;
@@ -47,20 +48,16 @@
public class FileStructure extends AbstractVFSStructureDeployer implements VirtualFileFilter
{
/** The file suffixes */
- private static Set<String> fileSuffixes = new CopyOnWriteArraySet<String>();
+ private static Set<String> fileSuffixes = new CopyOnWriteArraySet<String>(Arrays.asList(new String[] {
+ "-service.xml",
+ "-beans.xml",
+ "-ds.xml",
+ "-aop.xml",
+ }));
/** The file matchers */
private Set<FileMatcher> fileMatchers = new CopyOnWriteArraySet<FileMatcher>();
- // Initialise known suffixes
- static
- {
- fileSuffixes.add("-service.xml");
- fileSuffixes.add("-beans.xml");
- fileSuffixes.add("-ds.xml");
- fileSuffixes.add("-aop.xml");
- }
-
/**
* Create a new FileStructure.
*/
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-10-12 19:01:18 UTC (rev 94692)
+++ projects/jboss-deployers/branches/vfs3/deployers-vfs/src/main/java/org/jboss/deployers/vfs/plugins/structure/jar/JARStructure.java 2009-10-12 19:30:43 UTC (rev 94693)
@@ -21,8 +21,9 @@
*/
package org.jboss.deployers.vfs.plugins.structure.jar;
-import java.io.IOException;
import java.util.Set;
+import java.util.Collections;
+import java.util.HashSet;
import org.jboss.beans.metadata.api.annotations.Install;
import org.jboss.beans.metadata.api.annotations.Uninstall;
@@ -32,7 +33,6 @@
import org.jboss.deployers.vfs.plugins.structure.AbstractVFSStructureDeployer;
import org.jboss.deployers.vfs.spi.structure.StructureContext;
import org.jboss.vfs.VirtualFile;
-import org.jboss.vfs.plugins.context.jar.JarUtils;
/**
* JARStructure.
@@ -43,6 +43,8 @@
*/
public class JARStructure extends AbstractVFSStructureDeployer
{
+ private static final Set<String> JAR_SUFFIXES = Collections.synchronizedSet(new HashSet<String>());
+
/**
* Create a new JARStructure. with the default suffixes
*/
@@ -70,7 +72,7 @@
*/
public Set<String> getSuffixes()
{
- return JarUtils.getSuffixes();
+ return JAR_SUFFIXES;
}
/**
* Gets the set of suffixes recognised as jars
@@ -79,7 +81,8 @@
*/
public void setSuffixes(Set<String> suffixes)
{
- JarUtils.setJarSuffixes(suffixes);
+ JAR_SUFFIXES.retainAll(suffixes);
+ JAR_SUFFIXES.addAll(suffixes);
}
@Install
@@ -87,7 +90,7 @@
{
String extension = provider.getJarExtension();
if (extension != null)
- JarUtils.addJarSuffix(extension);
+ JAR_SUFFIXES.add(extension);
}
@Uninstall
@@ -95,9 +98,22 @@
{
String extension = provider.getJarExtension();
if (extension != null)
- JarUtils.removeJarSuffix(extension);
+ JAR_SUFFIXES.remove(extension);
}
+ private static boolean isArchive(String name) {
+ int i = name.length() - 1;
+ for (;;) {
+ i = name.lastIndexOf('.', i);
+ if (i == -1) {
+ return false;
+ }
+ if (JAR_SUFFIXES.contains(name.substring(i))) {
+ return true;
+ }
+ }
+ }
+
public boolean determineStructure(StructureContext structureContext) throws DeploymentException
{
ContextInfo context = null;
@@ -110,28 +126,20 @@
{
// For non top level directories that don't look like jars
// we require a META-INF otherwise each subdirectory would be a subdeployment
- if (JarUtils.isArchive(file.getName()) == false)
+ if (isArchive(file.getName()) == false)
{
if (structureContext.isTopLevel() == false)
{
- try
+ VirtualFile child = file.getChild("META-INF");
+ if (child != null)
{
- VirtualFile child = file.getChild("META-INF");
- if (child != null)
- {
- if (trace)
- log.trace("... ok - non top level directory has a META-INF subdirectory");
- }
- else
- {
- if (trace)
- log.trace("... no - doesn't look like a jar and no META-INF subdirectory.");
- return false;
- }
+ if (trace)
+ log.trace("... ok - non top level directory has a META-INF subdirectory");
}
- catch (IOException e)
+ else
{
- log.warn("Exception while checking if file is a jar: " + e);
+ if (trace)
+ log.trace("... no - doesn't look like a jar and no META-INF subdirectory.");
return false;
}
}
@@ -145,7 +153,7 @@
log.trace("... ok - its an archive or at least pretending to be");
}
}
- else if (JarUtils.isArchive(file.getName()))
+ else if (isArchive(file.getName()))
{
if (trace)
log.trace("... ok - its an archive or at least pretending to be.");
Modified: projects/jboss-deployers/branches/vfs3/deployers-vfs/src/main/java/org/jboss/deployers/vfs/plugins/structure/war/WARStructure.java
===================================================================
--- projects/jboss-deployers/branches/vfs3/deployers-vfs/src/main/java/org/jboss/deployers/vfs/plugins/structure/war/WARStructure.java 2009-10-12 19:01:18 UTC (rev 94692)
+++ projects/jboss-deployers/branches/vfs3/deployers-vfs/src/main/java/org/jboss/deployers/vfs/plugins/structure/war/WARStructure.java 2009-10-12 19:30:43 UTC (rev 94693)
@@ -32,7 +32,7 @@
import org.jboss.vfs.VirtualFile;
import org.jboss.vfs.VirtualFileFilter;
import org.jboss.vfs.VisitorAttributes;
-import org.jboss.vfs.plugins.vfs.helpers.SuffixMatchFilter;
+import org.jboss.vfs.util.SuffixMatchFilter;
/**
* WARStructure.
@@ -133,24 +133,16 @@
// We require either a WEB-INF or the name ends in .war
if (file.getName().endsWith(".war") == false)
{
- try
+ webinf = file.getChild("WEB-INF");
+ if (webinf != null)
{
- webinf = file.getChild("WEB-INF");
- if (webinf != null)
- {
- if (trace)
- log.trace("... ok - directory has a WEB-INF subdirectory");
- }
- else
- {
- if (trace)
- log.trace("... no - doesn't look like a war and no WEB-INF subdirectory.");
- return false;
- }
+ if (trace)
+ log.trace("... ok - directory has a WEB-INF subdirectory");
}
- catch (IOException e)
+ else
{
- log.warn("Exception while checking if file is a war: " + e);
+ if (trace)
+ log.trace("... no - doesn't look like a war and no WEB-INF subdirectory.");
return false;
}
}
@@ -164,20 +156,11 @@
// Check for WEB-INF/classes
VirtualFile classes = null;
- try
- {
- // The classpath contains WEB-INF/classes
- classes = file.getChild("WEB-INF/classes");
-
- // Check for a META-INF for metadata
- if (classes != null)
- metaDataLocations.add("WEB-INF/classes/META-INF");
- }
- catch(IOException e)
- {
- log.warn("Exception while looking for classes, " + file.getPathName() + ", " + e);
- }
-
+ // The classpath contains WEB-INF/classes
+ classes = file.getChild("WEB-INF/classes");
+ // Check for a META-INF for metadata
+ if (classes != null)
+ metaDataLocations.add("WEB-INF/classes/META-INF");
// Check for jars in WEB-INF/lib
List<VirtualFile> archives = null;
try
Modified: projects/jboss-deployers/branches/vfs3/deployers-vfs/src/main/java/org/jboss/deployers/vfs/plugins/vfs/VirtualFileSerializator.java
===================================================================
--- projects/jboss-deployers/branches/vfs3/deployers-vfs/src/main/java/org/jboss/deployers/vfs/plugins/vfs/VirtualFileSerializator.java 2009-10-12 19:01:18 UTC (rev 94692)
+++ projects/jboss-deployers/branches/vfs3/deployers-vfs/src/main/java/org/jboss/deployers/vfs/plugins/vfs/VirtualFileSerializator.java 2009-10-12 19:30:43 UTC (rev 94693)
@@ -119,7 +119,7 @@
if (file == null)
{
VirtualFile root = VFS.getRoot(rootUrl);
- file = root.findChild(path);
+ file = root.getChild(path);
}
return file;
}
@@ -131,7 +131,7 @@
if (url == null)
{
VFS vfs = getFile().getVFS();
- url = vfs.getRoot().toURL();
+ url = vfs.getRootVirtualFile().toURL();
}
String pathName = path;
if (pathName == null)
More information about the jboss-cvs-commits
mailing list