[jboss-cvs] JBossAS SVN: r105645 - projects/jpa/trunk/vfs3/src/main/java/org/jboss/jpa/deployment/vfs3.
jboss-cvs-commits at lists.jboss.org
jboss-cvs-commits at lists.jboss.org
Thu Jun 3 11:17:28 EDT 2010
Author: ALRubinger
Date: 2010-06-03 11:17:27 -0400 (Thu, 03 Jun 2010)
New Revision: 105645
Modified:
projects/jpa/trunk/vfs3/src/main/java/org/jboss/jpa/deployment/vfs3/PersistenceUnitDeploymentImpl.java
Log:
[JBJPA-29] Remove getPhysicalFile usage from VFS deployments
Modified: projects/jpa/trunk/vfs3/src/main/java/org/jboss/jpa/deployment/vfs3/PersistenceUnitDeploymentImpl.java
===================================================================
--- projects/jpa/trunk/vfs3/src/main/java/org/jboss/jpa/deployment/vfs3/PersistenceUnitDeploymentImpl.java 2010-06-03 14:45:37 UTC (rev 105644)
+++ projects/jpa/trunk/vfs3/src/main/java/org/jboss/jpa/deployment/vfs3/PersistenceUnitDeploymentImpl.java 2010-06-03 15:17:27 UTC (rev 105645)
@@ -22,7 +22,6 @@
*/
package org.jboss.jpa.deployment.vfs3;
-import java.io.IOException;
import java.net.MalformedURLException;
import java.net.URL;
import java.util.List;
@@ -35,8 +34,6 @@
import org.jboss.jpa.deployment.PersistenceUnitDeployment;
import org.jboss.metadata.jpa.spec.PersistenceUnitMetaData;
import org.jboss.vfs.VirtualFile;
-import org.jboss.vfs.VirtualFileVisitor;
-import org.jboss.vfs.VisitorAttributes;
/**
* Instance of PersistenceUnitDeployment that uses VFS2 roots
@@ -71,7 +68,7 @@
try {
VirtualFile metaData = di.getMetaDataFile("persistence.xml");
assert metaData != null : "Can't find persistence.xml in " + di;
- return getJarFileUrl(metaData.getParent().getParent());
+ return metaData.getParent().getParent().toURL();
}
catch (Exception e) {
throw new RuntimeException(e);
@@ -93,45 +90,11 @@
VirtualFile jarFile = baseDir.getChild(jar);
if (jarFile == null)
throw new RuntimeException("could not find child '" + jar + "' on '" + baseDir + "'");
- return getJarFileUrl(jarFile);
+ return jarFile.toURL();
}
catch (Exception e1) {
throw new RuntimeException("could not find relative path: " + jar, e1);
}
}
}
-
- /**
- * This method is a hack. This should be replace with a hook in VFS to fully explode a
- * zip filesystem. Better yet, this should be removed once there is a way to inject a VFS
- * based JarScanner into hibernate.
- */
- private URL getJarFileUrl(VirtualFile virtualFile) throws MalformedURLException, IOException {
- if(virtualFile.isDirectory())
- {
- VirtualFileVisitor visitor = new VirtualFileVisitor()
- {
- public void visit(VirtualFile virtualFile)
- {
- try
- {
- virtualFile.getPhysicalFile();
- }
- catch (IOException e)
- {
- throw new RuntimeException("Failed to force explosion of VirtualFile: " + virtualFile, e);
- }
- }
-
- public VisitorAttributes getAttributes()
- {
- return VisitorAttributes.RECURSE_LEAVES_ONLY;
- }
- };
- virtualFile.visit(visitor);
- return virtualFile.getPhysicalFile().toURI().toURL();
- }
- return virtualFile.toURL();
- }
-
}
More information about the jboss-cvs-commits
mailing list