[jboss-cvs] JBossAS SVN: r97158 - in projects/kernel/trunk: kernel/src/main/java/org/jboss/kernel/plugins/annotations and 1 other directories.
jboss-cvs-commits at lists.jboss.org
jboss-cvs-commits at lists.jboss.org
Mon Nov 30 05:37:49 EST 2009
Author: kabir.khan at jboss.com
Date: 2009-11-30 05:37:49 -0500 (Mon, 30 Nov 2009)
New Revision: 97158
Modified:
projects/kernel/trunk/jmx-aop-mc-int/src/main/java/org/jboss/system/microcontainer/jmx/JMXPropertyAnnotationPlugin.java
projects/kernel/trunk/kernel/src/main/java/org/jboss/kernel/plugins/annotations/AbstractAnnotationPlugin.java
projects/kernel/trunk/kernel/src/main/java/org/jboss/kernel/plugins/annotations/AbstractBeanAnnotationAdapter.java
projects/kernel/trunk/kernel/src/main/java/org/jboss/kernel/plugins/annotations/AbstractMetaDataAnnotationAdapter.java
projects/kernel/trunk/kernel/src/main/java/org/jboss/kernel/plugins/annotations/AnnotationPlugin.java
projects/kernel/trunk/kernel/src/main/java/org/jboss/kernel/plugins/annotations/BaseMetaDataAnnotationPlugin.java
projects/kernel/trunk/kernel/src/main/java/org/jboss/kernel/plugins/annotations/CommonAnnotationAdapter.java
projects/kernel/trunk/kernel/src/main/java/org/jboss/kernel/plugins/annotations/MetaDataAnnotationPlugin.java
projects/kernel/trunk/kernel/src/main/java/org/jboss/kernel/plugins/annotations/PropertyAnnotationPlugin.java
projects/kernel/trunk/kernel/src/main/java/org/jboss/kernel/plugins/annotations/PropertyAware.java
projects/kernel/trunk/kernel/src/main/java/org/jboss/kernel/plugins/annotations/PropertyInstallCallbackAnnotationPlugin.java
projects/kernel/trunk/kernel/src/main/java/org/jboss/kernel/plugins/annotations/PropertyUninstallCallbackAnnotationPlugin.java
projects/kernel/trunk/kernel/src/test/java/org/jboss/test/kernel/annotations/support/TestAnnotationPlugin.java
Log:
[JBKERNEL-64] Don't check that the annotation exists from plugins when adding/cleaning, this has already been done by the CommonAnnotationAdpater
Modified: projects/kernel/trunk/jmx-aop-mc-int/src/main/java/org/jboss/system/microcontainer/jmx/JMXPropertyAnnotationPlugin.java
===================================================================
--- projects/kernel/trunk/jmx-aop-mc-int/src/main/java/org/jboss/system/microcontainer/jmx/JMXPropertyAnnotationPlugin.java 2009-11-30 10:26:41 UTC (rev 97157)
+++ projects/kernel/trunk/jmx-aop-mc-int/src/main/java/org/jboss/system/microcontainer/jmx/JMXPropertyAnnotationPlugin.java 2009-11-30 10:37:49 UTC (rev 97158)
@@ -23,6 +23,7 @@
import java.lang.annotation.ElementType;
+import org.jboss.aop.microcontainer.aspects.jmx.JMX;
import org.jboss.beans.info.spi.PropertyInfo;
import org.jboss.kernel.plugins.annotations.PropertyAware;
@@ -32,7 +33,7 @@
*
* @author <a href="ales.justin at jboss.com">Ales Justin</a>
*/
-public class JMXPropertyAnnotationPlugin extends JMXAnnotationPlugin<PropertyInfo> implements PropertyAware
+public class JMXPropertyAnnotationPlugin extends JMXAnnotationPlugin<PropertyInfo> implements PropertyAware<JMX>
{
protected boolean isElementTypeSupported(ElementType elementType)
{
Modified: projects/kernel/trunk/kernel/src/main/java/org/jboss/kernel/plugins/annotations/AbstractAnnotationPlugin.java
===================================================================
--- projects/kernel/trunk/kernel/src/main/java/org/jboss/kernel/plugins/annotations/AbstractAnnotationPlugin.java 2009-11-30 10:26:41 UTC (rev 97157)
+++ projects/kernel/trunk/kernel/src/main/java/org/jboss/kernel/plugins/annotations/AbstractAnnotationPlugin.java 2009-11-30 10:37:49 UTC (rev 97158)
@@ -98,20 +98,12 @@
return null;
}
- public final void applyAnnotation(T info, MetaData retrieval, MetaDataVisitor visitor) throws Throwable
+ public final void applyAnnotation(T info, C annotation, MetaData retrieval, MetaDataVisitor visitor) throws Throwable
{
boolean trace = log.isTraceEnabled();
if (isCleanupOnly() == false)
{
- Class<C> annotationClass = getAnnotation();
- C annotation = retrieval.getAnnotation(annotationClass);
- if (annotation == null)
- {
- if (trace)
- log.trace("No annotation: " + annotationClass.getName());
- return;
- }
if (isMetaDataAlreadyPresent(info, annotation, visitor.getControllerContext()))
{
if (trace)
@@ -134,25 +126,15 @@
log.trace("Annotation " + getAnnotation() + " is @CleanupOnly, nothing to apply on install.");
}
- public void cleanAnnotation(T info, MetaData retrieval, MetaDataVisitor visitor) throws Throwable
+ public void cleanAnnotation(T info, C annotation, MetaData retrieval, MetaDataVisitor visitor) throws Throwable
{
boolean trace = log.isTraceEnabled();
if (isCleanup())
{
- Class<C> annotationClass = getAnnotation();
- C annotation = retrieval.getAnnotation(annotationClass);
- if (annotation == null)
- {
- if (trace)
- log.trace("No annotation: " + annotationClass.getName());
- }
- else
- {
- if (trace)
- log.trace("Cleaning annotation: " + annotation);
- internalCleanAnnotation(info, retrieval, annotation, visitor.getControllerContext());
- }
+ if (trace)
+ log.trace("Cleaning annotation: " + annotation);
+ internalCleanAnnotation(info, retrieval, annotation, visitor.getControllerContext());
}
else if (trace)
log.trace("Annotation " + getAnnotation() + " is not a @Cleanup annotation.");
Modified: projects/kernel/trunk/kernel/src/main/java/org/jboss/kernel/plugins/annotations/AbstractBeanAnnotationAdapter.java
===================================================================
--- projects/kernel/trunk/kernel/src/main/java/org/jboss/kernel/plugins/annotations/AbstractBeanAnnotationAdapter.java 2009-11-30 10:26:41 UTC (rev 97157)
+++ projects/kernel/trunk/kernel/src/main/java/org/jboss/kernel/plugins/annotations/AbstractBeanAnnotationAdapter.java 2009-11-30 10:37:49 UTC (rev 97158)
@@ -21,6 +21,8 @@
*/
package org.jboss.kernel.plugins.annotations;
+import java.lang.annotation.Annotation;
+
import org.jboss.beans.info.spi.BeanInfo;
import org.jboss.beans.metadata.spi.MetaDataVisitor;
import org.jboss.kernel.Kernel;
@@ -68,15 +70,15 @@
}
@SuppressWarnings("unchecked")
- protected void applyPlugin(AnnotationPlugin plugin, AnnotatedInfo info, MetaData retrieval, MetaDataVisitor handle) throws Throwable
+ protected void applyPlugin(AnnotationPlugin plugin, Annotation annotation, AnnotatedInfo info, MetaData retrieval, MetaDataVisitor handle) throws Throwable
{
- plugin.applyAnnotation(info, retrieval, handle);
+ plugin.applyAnnotation(info, annotation, retrieval, handle);
}
@SuppressWarnings("unchecked")
- protected void cleanPlugin(AnnotationPlugin plugin, AnnotatedInfo info, MetaData retrieval, MetaDataVisitor handle) throws Throwable
+ protected void cleanPlugin(AnnotationPlugin plugin, Annotation annotation, AnnotatedInfo info, MetaData retrieval, MetaDataVisitor handle) throws Throwable
{
- plugin.cleanAnnotation(info, retrieval, handle);
+ plugin.cleanAnnotation(info, annotation, retrieval, handle);
}
protected Object getName(MetaDataVisitor handle)
Modified: projects/kernel/trunk/kernel/src/main/java/org/jboss/kernel/plugins/annotations/AbstractMetaDataAnnotationAdapter.java
===================================================================
--- projects/kernel/trunk/kernel/src/main/java/org/jboss/kernel/plugins/annotations/AbstractMetaDataAnnotationAdapter.java 2009-11-30 10:26:41 UTC (rev 97157)
+++ projects/kernel/trunk/kernel/src/main/java/org/jboss/kernel/plugins/annotations/AbstractMetaDataAnnotationAdapter.java 2009-11-30 10:37:49 UTC (rev 97158)
@@ -21,6 +21,8 @@
*/
package org.jboss.kernel.plugins.annotations;
+import java.lang.annotation.Annotation;
+
import org.jboss.beans.info.spi.BeanInfo;
import org.jboss.beans.metadata.spi.BeanMetaData;
import org.jboss.kernel.spi.annotations.BeanMetaDataAnnotationAdapter;
@@ -40,12 +42,12 @@
}
@SuppressWarnings("unchecked")
- protected void applyPlugin(MetaDataAnnotationPlugin plugin, AnnotatedInfo info, MetaData retrieval, BeanMetaData handle) throws Throwable
+ protected void applyPlugin(MetaDataAnnotationPlugin plugin, Annotation annotation, AnnotatedInfo info, MetaData retrieval, BeanMetaData handle) throws Throwable
{
- plugin.applyAnnotation(info, retrieval, handle);
+ plugin.applyAnnotation(info, annotation, retrieval, handle);
}
- protected void cleanPlugin(MetaDataAnnotationPlugin<?, ?> plugin, AnnotatedInfo info, MetaData retrieval, BeanMetaData handle) throws Throwable
+ protected void cleanPlugin(MetaDataAnnotationPlugin<?, ?> plugin, Annotation annotation, AnnotatedInfo info, MetaData retrieval, BeanMetaData handle) throws Throwable
{
throw new UnsupportedOperationException("Cleanup is not supported on metadata annotation adapter.");
}
Modified: projects/kernel/trunk/kernel/src/main/java/org/jboss/kernel/plugins/annotations/AnnotationPlugin.java
===================================================================
--- projects/kernel/trunk/kernel/src/main/java/org/jboss/kernel/plugins/annotations/AnnotationPlugin.java 2009-11-30 10:26:41 UTC (rev 97157)
+++ projects/kernel/trunk/kernel/src/main/java/org/jboss/kernel/plugins/annotations/AnnotationPlugin.java 2009-11-30 10:37:49 UTC (rev 97158)
@@ -40,19 +40,21 @@
* Apply the check for annotation.
*
* @param info the info
+ * @param annotation the annotation we are adding
* @param retrieval metadata instance
* @param visitor current context visitor
* @throws Throwable for any error
*/
- void applyAnnotation(T info, MetaData retrieval, MetaDataVisitor visitor) throws Throwable;
+ void applyAnnotation(T info, C annotation, MetaData retrieval, MetaDataVisitor visitor) throws Throwable;
/**
* Check if the annotation requires cleaning after itself.
*
* @param info the info
+ * @param annotation the annotation we are cleaning
* @param retrieval metadata instance
* @param visitor current context visitor
* @throws Throwable for any error
*/
- void cleanAnnotation(T info, MetaData retrieval, MetaDataVisitor visitor) throws Throwable;
+ void cleanAnnotation(T info, C annotation, MetaData retrieval, MetaDataVisitor visitor) throws Throwable;
}
Modified: projects/kernel/trunk/kernel/src/main/java/org/jboss/kernel/plugins/annotations/BaseMetaDataAnnotationPlugin.java
===================================================================
--- projects/kernel/trunk/kernel/src/main/java/org/jboss/kernel/plugins/annotations/BaseMetaDataAnnotationPlugin.java 2009-11-30 10:26:41 UTC (rev 97157)
+++ projects/kernel/trunk/kernel/src/main/java/org/jboss/kernel/plugins/annotations/BaseMetaDataAnnotationPlugin.java 2009-11-30 10:37:49 UTC (rev 97158)
@@ -75,20 +75,12 @@
isCleanup = isCleanupOnly || annotation.isAnnotationPresent(Cleanup.class);
}
- public final void applyAnnotation(T info, MetaData retrieval, BeanMetaData beanMetaData) throws Throwable
+ public final void applyAnnotation(T info, C annotation, MetaData retrieval, BeanMetaData beanMetaData) throws Throwable
{
boolean trace = log.isTraceEnabled();
if (isCleanupOnly() == false)
{
- Class<C> annotationClass = getAnnotation();
- C annotation = retrieval.getAnnotation(annotationClass);
- if (annotation == null)
- {
- if (trace)
- log.trace("No annotation: " + annotationClass.getName());
- return;
- }
if (isMetaDataAlreadyPresent(info, annotation, beanMetaData))
{
if (trace)
Modified: projects/kernel/trunk/kernel/src/main/java/org/jboss/kernel/plugins/annotations/CommonAnnotationAdapter.java
===================================================================
--- projects/kernel/trunk/kernel/src/main/java/org/jboss/kernel/plugins/annotations/CommonAnnotationAdapter.java 2009-11-30 10:26:41 UTC (rev 97157)
+++ projects/kernel/trunk/kernel/src/main/java/org/jboss/kernel/plugins/annotations/CommonAnnotationAdapter.java 2009-11-30 10:37:49 UTC (rev 97158)
@@ -160,23 +160,25 @@
* Apply plugin.
*
* @param plugin the plugin
+ * @param annotation the annotation
* @param info the bean info
* @param retrieval the metadata
* @param handle the handle
* @throws Throwable for any error
*/
- protected abstract void applyPlugin(T plugin, AnnotatedInfo info, MetaData retrieval, U handle) throws Throwable;
+ protected abstract void applyPlugin(T plugin, Annotation annotation, AnnotatedInfo info, MetaData retrieval, U handle) throws Throwable;
/**
* Clean plugin.
*
* @param plugin the plugin
+ * @param annotation the annotation
* @param info the bean info
* @param retrieval the metadata
* @param handle the handle
* @throws Throwable for any error
*/
- protected abstract void cleanPlugin(T plugin, AnnotatedInfo info, MetaData retrieval, U handle) throws Throwable;
+ protected abstract void cleanPlugin(T plugin, Annotation annotation, AnnotatedInfo info, MetaData retrieval, U handle) throws Throwable;
/**
* Get the name from handle.
@@ -273,9 +275,9 @@
for(T plugin : getPlugins(ElementType.TYPE, annotation, null, annotationClasses))
{
if (isApplyPhase)
- applyPlugin(plugin, classInfo, retrieval, handle);
+ applyPlugin(plugin, annotation, classInfo, retrieval, handle);
else
- cleanPlugin(plugin, classInfo, retrieval, handle);
+ cleanPlugin(plugin, annotation, classInfo, retrieval, handle);
}
}
// constructors
@@ -293,9 +295,9 @@
for(T plugin : getPlugins(ElementType.CONSTRUCTOR, annotation, null, annotationClasses))
{
if (isApplyPhase)
- applyPlugin(plugin, ci, cmdr, handle);
+ applyPlugin(plugin, annotation, ci, cmdr, handle);
else
- cleanPlugin(plugin, ci, cmdr, handle);
+ cleanPlugin(plugin, annotation, ci, cmdr, handle);
}
}
}
@@ -325,9 +327,9 @@
for(T plugin : getPlugins(ElementType.FIELD, annotation, null, annotationClasses))
{
if (isApplyPhase)
- applyPlugin(plugin, field, cmdr, handle);
+ applyPlugin(plugin, annotation, field, cmdr, handle);
else
- cleanPlugin(plugin, field, cmdr, handle);
+ cleanPlugin(plugin, annotation, field, cmdr, handle);
}
}
}
@@ -365,9 +367,9 @@
for(T plugin : getPlugins(ElementType.METHOD, annotation, METHOD_FILTER, annotationClasses))
{
if (isApplyPhase)
- applyPlugin(plugin, mi, cmdr, handle);
+ applyPlugin(plugin, annotation, mi, cmdr, handle);
else
- cleanPlugin(plugin, mi, cmdr, handle);
+ cleanPlugin(plugin, annotation, mi, cmdr, handle);
}
}
}
@@ -396,9 +398,9 @@
for(T plugin : getPlugins(ElementType.METHOD, annotation, METHOD_FILTER, annotationClasses))
{
if (isApplyPhase)
- applyPlugin(plugin, smi, cmdr, handle);
+ applyPlugin(plugin, annotation, smi, cmdr, handle);
else
- cleanPlugin(plugin, smi, cmdr, handle);
+ cleanPlugin(plugin, annotation, smi, cmdr, handle);
}
}
}
@@ -452,9 +454,9 @@
for(T plugin : getPlugins(ElementType.METHOD, annotation, PROPERTY_FILTER, annotationClasses))
{
if (isApplyPhase)
- applyPlugin(plugin, pi, cmdr, handle);
+ applyPlugin(plugin, annotation, pi, cmdr, handle);
else
- cleanPlugin(plugin, pi, cmdr, handle);
+ cleanPlugin(plugin, annotation, pi, cmdr, handle);
}
}
}
Modified: projects/kernel/trunk/kernel/src/main/java/org/jboss/kernel/plugins/annotations/MetaDataAnnotationPlugin.java
===================================================================
--- projects/kernel/trunk/kernel/src/main/java/org/jboss/kernel/plugins/annotations/MetaDataAnnotationPlugin.java 2009-11-30 10:26:41 UTC (rev 97157)
+++ projects/kernel/trunk/kernel/src/main/java/org/jboss/kernel/plugins/annotations/MetaDataAnnotationPlugin.java 2009-11-30 10:37:49 UTC (rev 97158)
@@ -56,9 +56,10 @@
* Apply annotations to bean metadata.
*
* @param info the annotated info we are checking
+ * @param annotation the annotation we are adding
* @param retrieval the metadata retrieval
* @param beanMetaData the bean metadata
* @throws Throwable for any error
*/
- void applyAnnotation(T info, MetaData retrieval, BeanMetaData beanMetaData) throws Throwable;
+ void applyAnnotation(T info, C annotation, MetaData retrieval, BeanMetaData beanMetaData) throws Throwable;
}
Modified: projects/kernel/trunk/kernel/src/main/java/org/jboss/kernel/plugins/annotations/PropertyAnnotationPlugin.java
===================================================================
--- projects/kernel/trunk/kernel/src/main/java/org/jboss/kernel/plugins/annotations/PropertyAnnotationPlugin.java 2009-11-30 10:26:41 UTC (rev 97157)
+++ projects/kernel/trunk/kernel/src/main/java/org/jboss/kernel/plugins/annotations/PropertyAnnotationPlugin.java 2009-11-30 10:37:49 UTC (rev 97158)
@@ -33,7 +33,7 @@
* @author <a href="mailto:ales.justin at jboss.com">Ales Justin</a>
*/
public abstract class PropertyAnnotationPlugin<C extends Annotation> extends InjectableMemberAnnotationPlugin<PropertyInfo, C>
- implements PropertyAware, Annotation2ValueMetaDataAdapter<C>
+ implements PropertyAware<C>, Annotation2ValueMetaDataAdapter<C>
{
protected PropertyAnnotationPlugin(Class<C> annotation)
{
Modified: projects/kernel/trunk/kernel/src/main/java/org/jboss/kernel/plugins/annotations/PropertyAware.java
===================================================================
--- projects/kernel/trunk/kernel/src/main/java/org/jboss/kernel/plugins/annotations/PropertyAware.java 2009-11-30 10:26:41 UTC (rev 97157)
+++ projects/kernel/trunk/kernel/src/main/java/org/jboss/kernel/plugins/annotations/PropertyAware.java 2009-11-30 10:37:49 UTC (rev 97158)
@@ -21,6 +21,8 @@
*/
package org.jboss.kernel.plugins.annotations;
+import java.lang.annotation.Annotation;
+
import org.jboss.beans.info.spi.PropertyInfo;
import org.jboss.beans.metadata.spi.MetaDataVisitor;
import org.jboss.metadata.spi.MetaData;
@@ -30,7 +32,7 @@
*
* @author <a href="mailto:ales.justin at jboss.com">Ales Justin</a>
*/
-public interface PropertyAware
+public interface PropertyAware<C extends Annotation>
{
- void applyAnnotation(PropertyInfo info, MetaData retrieval, MetaDataVisitor visitor) throws Throwable;
+ void applyAnnotation(PropertyInfo info, C annotation, MetaData retrieval, MetaDataVisitor visitor) throws Throwable;
}
Modified: projects/kernel/trunk/kernel/src/main/java/org/jboss/kernel/plugins/annotations/PropertyInstallCallbackAnnotationPlugin.java
===================================================================
--- projects/kernel/trunk/kernel/src/main/java/org/jboss/kernel/plugins/annotations/PropertyInstallCallbackAnnotationPlugin.java 2009-11-30 10:26:41 UTC (rev 97157)
+++ projects/kernel/trunk/kernel/src/main/java/org/jboss/kernel/plugins/annotations/PropertyInstallCallbackAnnotationPlugin.java 2009-11-30 10:37:49 UTC (rev 97158)
@@ -22,6 +22,7 @@
package org.jboss.kernel.plugins.annotations;
import org.jboss.beans.info.spi.PropertyInfo;
+import org.jboss.beans.metadata.api.annotations.Install;
import org.jboss.beans.metadata.plugins.AbstractCallbackMetaData;
import org.jboss.dependency.spi.CallbackItem;
@@ -30,7 +31,7 @@
*
* @author <a href="mailto:ales.justin at jboss.com">Ales Justin</a>
*/
-public class PropertyInstallCallbackAnnotationPlugin extends InstallCallbackAnnotationPlugin<PropertyInfo> implements PropertyAware
+public class PropertyInstallCallbackAnnotationPlugin extends InstallCallbackAnnotationPlugin<PropertyInfo> implements PropertyAware<Install>
{
public static final PropertyInstallCallbackAnnotationPlugin INSTANCE = new PropertyInstallCallbackAnnotationPlugin();
Modified: projects/kernel/trunk/kernel/src/main/java/org/jboss/kernel/plugins/annotations/PropertyUninstallCallbackAnnotationPlugin.java
===================================================================
--- projects/kernel/trunk/kernel/src/main/java/org/jboss/kernel/plugins/annotations/PropertyUninstallCallbackAnnotationPlugin.java 2009-11-30 10:26:41 UTC (rev 97157)
+++ projects/kernel/trunk/kernel/src/main/java/org/jboss/kernel/plugins/annotations/PropertyUninstallCallbackAnnotationPlugin.java 2009-11-30 10:37:49 UTC (rev 97158)
@@ -22,6 +22,7 @@
package org.jboss.kernel.plugins.annotations;
import org.jboss.beans.info.spi.PropertyInfo;
+import org.jboss.beans.metadata.api.annotations.Uninstall;
import org.jboss.beans.metadata.plugins.AbstractCallbackMetaData;
import org.jboss.dependency.spi.CallbackItem;
@@ -30,7 +31,7 @@
*
* @author <a href="mailto:ales.justin at jboss.com">Ales Justin</a>
*/
-public class PropertyUninstallCallbackAnnotationPlugin extends UninstallCallbackAnnotationPlugin<PropertyInfo> implements PropertyAware
+public class PropertyUninstallCallbackAnnotationPlugin extends UninstallCallbackAnnotationPlugin<PropertyInfo> implements PropertyAware<Uninstall>
{
public static final PropertyUninstallCallbackAnnotationPlugin INSTANCE = new PropertyUninstallCallbackAnnotationPlugin();
Modified: projects/kernel/trunk/kernel/src/test/java/org/jboss/test/kernel/annotations/support/TestAnnotationPlugin.java
===================================================================
--- projects/kernel/trunk/kernel/src/test/java/org/jboss/test/kernel/annotations/support/TestAnnotationPlugin.java 2009-11-30 10:26:41 UTC (rev 97157)
+++ projects/kernel/trunk/kernel/src/test/java/org/jboss/test/kernel/annotations/support/TestAnnotationPlugin.java 2009-11-30 10:37:49 UTC (rev 97158)
@@ -36,7 +36,7 @@
* @param <T> the annotation type
* @author <a href="mailto:ales.justin at jboss.com">Ales Justin</a>
*/
-public class TestAnnotationPlugin<T extends Annotation> extends AbstractAnnotationPlugin<PropertyInfo, T> implements PropertyAware
+public class TestAnnotationPlugin<T extends Annotation> extends AbstractAnnotationPlugin<PropertyInfo, T> implements PropertyAware<T>
{
private boolean applied;
private boolean cleaned;
More information about the jboss-cvs-commits
mailing list