[jboss-cvs] JBossAS SVN: r102633 - in projects/scanning/trunk: scanning-impl/src/main/java/org/jboss/scanning/plugins and 1 other directory.

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Fri Mar 19 14:28:26 EDT 2010


Author: alesj
Date: 2010-03-19 14:28:25 -0400 (Fri, 19 Mar 2010)
New Revision: 102633

Added:
   projects/scanning/trunk/plugins/src/main/java/org/jboss/scanning/annotations/plugins/AnnotationsScanningPluginFactory.java
   projects/scanning/trunk/scanning-impl/src/main/java/org/jboss/scanning/plugins/DeploymentScanningPluginFactory.java
Log:
Add factory -- useful for incallback

Added: projects/scanning/trunk/plugins/src/main/java/org/jboss/scanning/annotations/plugins/AnnotationsScanningPluginFactory.java
===================================================================
--- projects/scanning/trunk/plugins/src/main/java/org/jboss/scanning/annotations/plugins/AnnotationsScanningPluginFactory.java	                        (rev 0)
+++ projects/scanning/trunk/plugins/src/main/java/org/jboss/scanning/annotations/plugins/AnnotationsScanningPluginFactory.java	2010-03-19 18:28:25 UTC (rev 102633)
@@ -0,0 +1,47 @@
+/*
+ * 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.annotations.plugins;
+
+import org.jboss.deployers.structure.spi.DeploymentUnit;
+import org.jboss.scanning.annotations.spi.AnnotationRepository;
+import org.jboss.scanning.plugins.DeploymentScanningPluginFactory;
+import org.jboss.scanning.plugins.visitor.JavassistReflectProvider;
+import org.jboss.scanning.plugins.visitor.ReflectProvider;
+import org.jboss.scanning.spi.ScanningPlugin;
+
+/**
+ * Annotations scanning plugin factory.
+ *
+ * @author <a href="mailto:ales.justin at jboss.org">Ales Justin</a>
+ */
+public class AnnotationsScanningPluginFactory implements DeploymentScanningPluginFactory<DefaultAnnotationRepository, AnnotationRepository>
+{
+   public ScanningPlugin<DefaultAnnotationRepository, AnnotationRepository> create(DeploymentUnit unit)
+   {
+      ReflectProvider provider = unit.getAttachment(ReflectProvider.class);
+      if (provider == null)
+         provider = new JavassistReflectProvider();
+
+      return new AnnotationsScanningPlugin(provider, unit.getClassLoader());
+   }
+}
\ No newline at end of file

Added: projects/scanning/trunk/scanning-impl/src/main/java/org/jboss/scanning/plugins/DeploymentScanningPluginFactory.java
===================================================================
--- projects/scanning/trunk/scanning-impl/src/main/java/org/jboss/scanning/plugins/DeploymentScanningPluginFactory.java	                        (rev 0)
+++ projects/scanning/trunk/scanning-impl/src/main/java/org/jboss/scanning/plugins/DeploymentScanningPluginFactory.java	2010-03-19 18:28:25 UTC (rev 102633)
@@ -0,0 +1,23 @@
+package org.jboss.scanning.plugins;
+
+import org.jboss.deployers.structure.spi.DeploymentUnit;
+import org.jboss.scanning.spi.ScanningHandle;
+import org.jboss.scanning.spi.ScanningPlugin;
+
+/**
+ * Deployment based scanning plugin factory.
+ * Used for incallback automatching.
+ *
+ * @param <T> exact handle type
+ * @author <a href="mailto:ales.justin at jboss.org">Ales Justin</a>
+ */
+public interface DeploymentScanningPluginFactory<T extends ScanningHandle, U>
+{
+   /**
+    * Create scanning plugin from deployment unit.
+    *
+    * @param unit the deployment unit
+    * @return new scanning plugin
+    */
+   ScanningPlugin<T, U> create(DeploymentUnit unit);
+}




More information about the jboss-cvs-commits mailing list