[jboss-cvs] JBossAS SVN: r95278 - in projects/mc-ann/trunk/core/src/main/java/org/jboss/mcann: scanner and 1 other directory.
jboss-cvs-commits at lists.jboss.org
jboss-cvs-commits at lists.jboss.org
Wed Oct 21 07:53:38 EDT 2009
Author: alesj
Date: 2009-10-21 07:53:38 -0400 (Wed, 21 Oct 2009)
New Revision: 95278
Modified:
projects/mc-ann/trunk/core/src/main/java/org/jboss/mcann/AnnotationRepository.java
projects/mc-ann/trunk/core/src/main/java/org/jboss/mcann/scanner/AbstractAnnotationScanner.java
Log:
Fix how we do a mcann.ser check #2.
Modified: projects/mc-ann/trunk/core/src/main/java/org/jboss/mcann/AnnotationRepository.java
===================================================================
--- projects/mc-ann/trunk/core/src/main/java/org/jboss/mcann/AnnotationRepository.java 2009-10-21 11:45:34 UTC (rev 95277)
+++ projects/mc-ann/trunk/core/src/main/java/org/jboss/mcann/AnnotationRepository.java 2009-10-21 11:53:38 UTC (rev 95278)
@@ -45,6 +45,9 @@
/** The McAnn indexed file */
static final String MCANN_METADATA_BINARY = "mcann.ser";
+ /** The full McAnn file path */
+ static final String MCANN_PATH = "META-INF" + MCANN_METADATA_BINARY;
+
/**
* Merge repositories.
*
Modified: projects/mc-ann/trunk/core/src/main/java/org/jboss/mcann/scanner/AbstractAnnotationScanner.java
===================================================================
--- projects/mc-ann/trunk/core/src/main/java/org/jboss/mcann/scanner/AbstractAnnotationScanner.java 2009-10-21 11:45:34 UTC (rev 95277)
+++ projects/mc-ann/trunk/core/src/main/java/org/jboss/mcann/scanner/AbstractAnnotationScanner.java 2009-10-21 11:53:38 UTC (rev 95278)
@@ -33,6 +33,8 @@
import org.jboss.logging.Logger;
import org.jboss.mcann.AnnotationRepository;
import org.jboss.mcann.AnnotationScanner;
+import org.jboss.virtual.VirtualFile;
+import org.jboss.virtual.plugins.vfs.VirtualFileURLConnection;
/**
* Abstract annotation scanner.
@@ -81,18 +83,29 @@
{
try
{
- String urlString = url.toExternalForm();
- if (urlString.endsWith("/") == false)
- urlString += "/";
- urlString += "META-INF/" + AnnotationRepository.MCANN_METADATA_BINARY;
- URL mcannURL = new URL(urlString);
- URLConnection conn = mcannURL.openConnection();
- return (conn != null) ? conn.getInputStream() : null;
+ URLConnection conn = url.openConnection();
+ // a bit of a hack; making vfs and vfsmemory work as well
+ if (conn instanceof VirtualFileURLConnection)
+ {
+ VirtualFileURLConnection vfConn = VirtualFileURLConnection.class.cast(conn);
+ VirtualFile file = vfConn.getContent();
+ VirtualFile mcann = file.getChild(AnnotationRepository.MCANN_PATH);
+ return (mcann != null) ? mcann.openStream() : null;
+ }
+ else
+ {
+ String urlString = url.toExternalForm();
+ if (urlString.endsWith("/") == false)
+ urlString += "/";
+ urlString += AnnotationRepository.MCANN_PATH;
+ URL mcannURL = new URL(urlString);
+ return mcannURL.openStream();
+ }
}
catch (IOException e)
{
if (log.isTraceEnabled())
- log.trace("No such mcann.ser file: " + e);
+ log.trace("Cannot access mcann.ser file: " + e);
return null;
}
}
More information about the jboss-cvs-commits
mailing list