[jboss-cvs] JBossAS SVN: r95275 - in projects/mc-ann/trunk: core/src/main/java/org/jboss/mcann/scanner and 1 other directories.
jboss-cvs-commits at lists.jboss.org
jboss-cvs-commits at lists.jboss.org
Wed Oct 21 07:23:49 EDT 2009
Author: alesj
Date: 2009-10-21 07:23:49 -0400 (Wed, 21 Oct 2009)
New Revision: 95275
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
projects/mc-ann/trunk/indexer/src/main/java/org/jboss/mcann/indexer/Main.java
Log:
Fix how we do a mcann.ser check.
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 10:57:13 UTC (rev 95274)
+++ projects/mc-ann/trunk/core/src/main/java/org/jboss/mcann/AnnotationRepository.java 2009-10-21 11:23:49 UTC (rev 95275)
@@ -42,8 +42,8 @@
*/
public interface AnnotationRepository
{
- /** The Papaki indexed file */
- static final String PAPAKI_METADATA_BINARY = "papaki.ser";
+ /** The McAnn indexed file */
+ static final String MCANN_METADATA_BINARY = "mcann.ser";
/**
* 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 10:57:13 UTC (rev 95274)
+++ projects/mc-ann/trunk/core/src/main/java/org/jboss/mcann/scanner/AbstractAnnotationScanner.java 2009-10-21 11:23:49 UTC (rev 95275)
@@ -21,17 +21,18 @@
*/
package org.jboss.mcann.scanner;
+import java.io.IOException;
import java.io.InputStream;
import java.io.ObjectInputStream;
import java.net.URL;
+import java.net.URLConnection;
import java.util.ArrayList;
import java.util.List;
import java.util.zip.GZIPInputStream;
+import org.jboss.logging.Logger;
import org.jboss.mcann.AnnotationRepository;
import org.jboss.mcann.AnnotationScanner;
-import org.jboss.virtual.VFS;
-import org.jboss.virtual.VirtualFile;
/**
* Abstract annotation scanner.
@@ -41,6 +42,8 @@
*/
public abstract class AbstractAnnotationScanner<T extends AnnotationRepository> implements AnnotationScanner
{
+ protected static final Logger log = Logger.getLogger(AnnotationScanner.class);
+
public AnnotationRepository scan(ClassLoader classLoader, URL... urls) throws Exception
{
if (urls == null)
@@ -56,10 +59,9 @@
List<URL> list = new ArrayList<URL>();
for (URL url : urls)
{
- VFS vfs = VFS.getVFS(url);
- VirtualFile file = vfs.getChild("META-INF/" + AnnotationRepository.PAPAKI_METADATA_BINARY);
- if (file != null)
- reattach(repository, file, classLoader);
+ InputStream is = getMcAnnInputStream(url);
+ if (is != null)
+ reattach(repository, is);
else
list.add(url);
}
@@ -75,9 +77,28 @@
}
}
- protected void reattach(T repo, VirtualFile papaki, ClassLoader classLoader) throws Exception
+ protected InputStream getMcAnnInputStream(URL url)
{
- InputStream is = papaki.openStream();
+ 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;
+ }
+ catch (IOException e)
+ {
+ if (log.isTraceEnabled())
+ log.trace("No such mcann.ser file: " + e);
+ return null;
+ }
+ }
+
+ protected void reattach(T repo, InputStream is) throws Exception
+ {
ObjectInputStream ois;
try
{
Modified: projects/mc-ann/trunk/indexer/src/main/java/org/jboss/mcann/indexer/Main.java
===================================================================
--- projects/mc-ann/trunk/indexer/src/main/java/org/jboss/mcann/indexer/Main.java 2009-10-21 10:57:13 UTC (rev 95274)
+++ projects/mc-ann/trunk/indexer/src/main/java/org/jboss/mcann/indexer/Main.java 2009-10-21 11:23:49 UTC (rev 95275)
@@ -65,7 +65,7 @@
if (directory == null || !directory.exists())
throw new IllegalArgumentException("Directory is null");
- File file = new File(directory, AnnotationRepository.PAPAKI_METADATA_BINARY);
+ File file = new File(directory, AnnotationRepository.MCANN_METADATA_BINARY);
FileOutputStream fos = new FileOutputStream(file);
BufferedOutputStream bos = new BufferedOutputStream(fos);
GZIPOutputStream gos = new GZIPOutputStream(bos);
More information about the jboss-cvs-commits
mailing list