[jboss-cvs] JBossAS SVN: r88712 - in projects/microcontainer/trunk/kernel/src/main/java/org/jboss: kernel/plugins/dependency and 1 other directory.

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Tue May 12 06:05:43 EDT 2009


Author: alesj
Date: 2009-05-12 06:05:43 -0400 (Tue, 12 May 2009)
New Revision: 88712

Added:
   projects/microcontainer/trunk/kernel/src/main/java/org/jboss/beans/metadata/api/annotations/DependencyBuilderFactory.java
Removed:
   projects/microcontainer/trunk/kernel/src/main/java/org/jboss/beans/metadata/api/annotations/IgnoreAOP.java
Modified:
   projects/microcontainer/trunk/kernel/src/main/java/org/jboss/kernel/plugins/dependency/DescribeAction.java
Log:
Try to do a single MD lookup.

Copied: projects/microcontainer/trunk/kernel/src/main/java/org/jboss/beans/metadata/api/annotations/DependencyBuilderFactory.java (from rev 88710, projects/microcontainer/trunk/kernel/src/main/java/org/jboss/beans/metadata/api/annotations/IgnoreAOP.java)
===================================================================
--- projects/microcontainer/trunk/kernel/src/main/java/org/jboss/beans/metadata/api/annotations/DependencyBuilderFactory.java	                        (rev 0)
+++ projects/microcontainer/trunk/kernel/src/main/java/org/jboss/beans/metadata/api/annotations/DependencyBuilderFactory.java	2009-05-12 10:05:43 UTC (rev 88712)
@@ -0,0 +1,56 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2008, 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.beans.metadata.api.annotations;
+
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+import org.jboss.kernel.spi.dependency.DependencyBuilder;
+import org.jboss.kernel.spi.dependency.helpers.AbstractDependencyBuilder;
+
+/**
+ * Define dependency builder instance.
+ *
+ * @author <a href="mailto:kabir.khan at jboss.org">Kabir Khan</a>
+ * @author <a href="mailto:ales.justin at jboss.org">Ales Justin</a>
+ */
+ at Target(ElementType.TYPE)
+ at Retention(RetentionPolicy.RUNTIME)
+public @interface DependencyBuilderFactory
+{
+   /**
+    * The dependency builder class to use.
+    *
+    * @return the dependency builder class
+    */
+   Class<? extends DependencyBuilder> value() default AbstractDependencyBuilder.class;
+
+   /**
+    * Should we check metadata for dependency builder instance.
+    * This allows us for more configurable instance.
+    *
+    * @return true if we should check metadata for dependency builder, false otherwise
+    */
+   boolean checkMetaDataForBuilderInstance() default false;
+}
\ No newline at end of file

Deleted: projects/microcontainer/trunk/kernel/src/main/java/org/jboss/beans/metadata/api/annotations/IgnoreAOP.java
===================================================================
--- projects/microcontainer/trunk/kernel/src/main/java/org/jboss/beans/metadata/api/annotations/IgnoreAOP.java	2009-05-12 09:41:58 UTC (rev 88711)
+++ projects/microcontainer/trunk/kernel/src/main/java/org/jboss/beans/metadata/api/annotations/IgnoreAOP.java	2009-05-12 10:05:43 UTC (rev 88712)
@@ -1,39 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2008, 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.beans.metadata.api.annotations;
-
-import java.lang.annotation.ElementType;
-import java.lang.annotation.Retention;
-import java.lang.annotation.RetentionPolicy;
-import java.lang.annotation.Target;
-
-/**
- * Ignore any AOP mechanism on this bean.
- *
- * @author <a href="mailto:kabir.khan at jboss.org">Kabir Khan</a>
- * @author <a href="mailto:ales.justin at jboss.org">Ales Justin</a>
- */
- at Target(ElementType.TYPE)
- at Retention(RetentionPolicy.RUNTIME)
-public @interface IgnoreAOP
-{
-}
\ No newline at end of file

Modified: projects/microcontainer/trunk/kernel/src/main/java/org/jboss/kernel/plugins/dependency/DescribeAction.java
===================================================================
--- projects/microcontainer/trunk/kernel/src/main/java/org/jboss/kernel/plugins/dependency/DescribeAction.java	2009-05-12 09:41:58 UTC (rev 88711)
+++ projects/microcontainer/trunk/kernel/src/main/java/org/jboss/kernel/plugins/dependency/DescribeAction.java	2009-05-12 10:05:43 UTC (rev 88712)
@@ -24,7 +24,7 @@
 import java.util.List;
 
 import org.jboss.beans.info.spi.BeanInfo;
-import org.jboss.beans.metadata.api.annotations.IgnoreAOP;
+import org.jboss.beans.metadata.api.annotations.DependencyBuilderFactory;
 import org.jboss.dependency.spi.ControllerState;
 import org.jboss.kernel.Kernel;
 import org.jboss.kernel.spi.config.KernelConfig;
@@ -68,20 +68,35 @@
     */
    protected DependencyBuilder getDependencyBuilder(MetaData md, Kernel kernel) throws Throwable
    {
-      DependencyBuilder dependencyBuilder = md.getMetaData(DependencyBuilder.class);
-      if (dependencyBuilder == null)
+      DependencyBuilder dependencyBuilder = null;
+      DependencyBuilderFactory factory = md.getAnnotation(DependencyBuilderFactory.class);
+      if (factory != null)
       {
-         IgnoreAOP ignoreAOP = md.getAnnotation(IgnoreAOP.class);
-         if (ignoreAOP != null)
+         if (factory.checkMetaDataForBuilderInstance())
          {
-            dependencyBuilder = basicDependencyBuilder;
+            // still allow for more configurable DependencyBuilder
+            dependencyBuilder = md.getMetaData(DependencyBuilder.class);
          }
          else
          {
-            KernelConfig config = kernel.getConfig();
-            dependencyBuilder = config.getDependencyBuilder();
+            Class<? extends DependencyBuilder> value = factory.value();
+            if (basicDependencyBuilder.getClass().equals(value))
+            {
+               dependencyBuilder = basicDependencyBuilder;   
+            }
+            else
+            {
+               dependencyBuilder = value.newInstance();
+            }
          }
       }
+
+      if (dependencyBuilder == null)
+      {
+         KernelConfig config = kernel.getConfig();
+         dependencyBuilder = config.getDependencyBuilder();
+      }
+
       return dependencyBuilder;
    }
 




More information about the jboss-cvs-commits mailing list