[jboss-cvs] JBossAS SVN: r102931 - in projects/scanning/trunk/plugins/src/main/java/org/jboss/scanning: web and 2 other directories.

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Wed Mar 24 20:12:08 EDT 2010


Author: alesj
Date: 2010-03-24 20:12:08 -0400 (Wed, 24 Mar 2010)
New Revision: 102931

Added:
   projects/scanning/trunk/plugins/src/main/java/org/jboss/scanning/web/
   projects/scanning/trunk/plugins/src/main/java/org/jboss/scanning/web/plugins/
   projects/scanning/trunk/plugins/src/main/java/org/jboss/scanning/web/plugins/DefaultResourcesIndex.java
   projects/scanning/trunk/plugins/src/main/java/org/jboss/scanning/web/spi/
   projects/scanning/trunk/plugins/src/main/java/org/jboss/scanning/web/spi/ResourcesIndex.java
Log:
Add initial servlet/web support.

Added: projects/scanning/trunk/plugins/src/main/java/org/jboss/scanning/web/plugins/DefaultResourcesIndex.java
===================================================================
--- projects/scanning/trunk/plugins/src/main/java/org/jboss/scanning/web/plugins/DefaultResourcesIndex.java	                        (rev 0)
+++ projects/scanning/trunk/plugins/src/main/java/org/jboss/scanning/web/plugins/DefaultResourcesIndex.java	2010-03-25 00:12:08 UTC (rev 102931)
@@ -0,0 +1,83 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2010, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+
+package org.jboss.scanning.web.plugins;
+
+import java.lang.annotation.Annotation;
+import java.net.URL;
+import java.util.Collections;
+import java.util.Set;
+
+import org.jboss.scanning.plugins.helpers.ResourceOwnerFinder;
+import org.jboss.scanning.web.spi.ResourcesIndex;
+import org.jboss.vfs.VirtualFile;
+
+/**
+ * Default resource index.
+ *
+ * @author <a href="mailto:ales.justin at jboss.org">Ales Justin</a>
+ */
+public class DefaultResourcesIndex implements ResourcesIndex
+{
+   /** The resource owner finder */
+   private ResourceOwnerFinder finder;
+
+   public DefaultResourcesIndex(ResourceOwnerFinder finder)
+   {
+      if (finder == null)
+         throw new IllegalArgumentException("Null finder");
+      this.finder = finder;
+   }
+
+   public Set<Class<?>> getAnnotatedClasses(VirtualFile cpEntry, Class<? extends Annotation> annotationToLookFor)
+   {
+      if (annotationToLookFor == null)
+         throw new IllegalArgumentException("Null annotation class");
+      URL url = toURL(cpEntry);
+
+      return Collections.emptySet();
+   }
+
+   public Set<Class<?>> getInheritedClasses(VirtualFile cpEntry, Class<?> superTypeToLookFor)
+   {
+      if (superTypeToLookFor == null)
+         throw new IllegalArgumentException("Null super type");
+      URL url = toURL(cpEntry);
+
+      return Collections.emptySet();
+   }
+
+   protected static URL toURL(VirtualFile file)
+   {
+      if (file == null)
+         throw new IllegalArgumentException("Null url");
+
+      try
+      {
+         return file.toURL();
+      }
+      catch (Exception e)
+      {
+         throw new RuntimeException(e);
+      }
+   }
+}

Added: projects/scanning/trunk/plugins/src/main/java/org/jboss/scanning/web/spi/ResourcesIndex.java
===================================================================
--- projects/scanning/trunk/plugins/src/main/java/org/jboss/scanning/web/spi/ResourcesIndex.java	                        (rev 0)
+++ projects/scanning/trunk/plugins/src/main/java/org/jboss/scanning/web/spi/ResourcesIndex.java	2010-03-25 00:12:08 UTC (rev 102931)
@@ -0,0 +1,32 @@
+package org.jboss.scanning.web.spi;
+
+import java.lang.annotation.Annotation;
+import java.util.Set;
+
+import org.jboss.vfs.VirtualFile;
+
+/**
+ * Resources index prepared for servlet usage.
+ *
+ * @author <a href="mailto:ales.justin at jboss.org">Ales Justin</a>
+ */
+public interface ResourcesIndex
+{
+   /**
+    * Get annotated classes.
+    *
+    * @param cpEntry the classpath entry
+    * @param annotationToLookFor the annotation to look for
+    * @return set of annotated classes
+    */
+   Set<Class<?>> getAnnotatedClasses(VirtualFile cpEntry, Class<? extends Annotation> annotationToLookFor);
+
+   /**
+    * Get inherited classes.
+    *
+    * @param cpEntry the classpath entry
+    * @param superTypeToLookFor the super type to inherit
+    * @return set of matching inherited classes
+    */
+   Set<Class<?>> getInheritedClasses(VirtualFile cpEntry, Class<?> superTypeToLookFor);
+}




More information about the jboss-cvs-commits mailing list