[jboss-cvs] JBossAS SVN: r64428 - in projects/microcontainer/trunk/kernel/src: main/org/jboss/kernel/plugins/annotations and 2 other directories.
jboss-cvs-commits at lists.jboss.org
jboss-cvs-commits at lists.jboss.org
Thu Aug 2 10:02:07 EDT 2007
Author: alesj
Date: 2007-08-02 10:02:06 -0400 (Thu, 02 Aug 2007)
New Revision: 64428
Added:
projects/microcontainer/trunk/kernel/src/main/org/jboss/beans/metadata/plugins/annotations/ExternalInstall.java
projects/microcontainer/trunk/kernel/src/main/org/jboss/beans/metadata/plugins/annotations/ExternalInstalls.java
projects/microcontainer/trunk/kernel/src/main/org/jboss/beans/metadata/plugins/annotations/ExternalUninstalls.java
projects/microcontainer/trunk/kernel/src/main/org/jboss/kernel/plugins/annotations/ExternalInstallAnnotationPlugin.java
projects/microcontainer/trunk/kernel/src/main/org/jboss/kernel/plugins/annotations/ExternalInstallationAnnotationPlugin.java
projects/microcontainer/trunk/kernel/src/main/org/jboss/kernel/plugins/annotations/ExternalUninstallAnnotationPlugin.java
Removed:
projects/microcontainer/trunk/kernel/src/main/org/jboss/kernel/plugins/annotations/ParametersAnnotationPlugin.java
Modified:
projects/microcontainer/trunk/kernel/src/main/org/jboss/kernel/plugins/annotations/AbstractAnnotationPlugin.java
projects/microcontainer/trunk/kernel/src/main/org/jboss/kernel/plugins/annotations/BasicBeanAnnotationAdapter.java
projects/microcontainer/trunk/kernel/src/main/org/jboss/kernel/plugins/annotations/ValueFactoryAnnotationPlugin.java
projects/microcontainer/trunk/kernel/src/tests/org/jboss/test/kernel/dependency/support/ExternalInstallSimpleBeanImpl.java
projects/microcontainer/trunk/kernel/src/tests/org/jboss/test/kernel/dependency/test/DependencyTestSuite.java
projects/microcontainer/trunk/kernel/src/tests/org/jboss/test/kernel/dependency/test/InstallDependencyAnnotationTestCase.java
Log:
Other bean installation method execution via annotations.
Added: projects/microcontainer/trunk/kernel/src/main/org/jboss/beans/metadata/plugins/annotations/ExternalInstall.java
===================================================================
--- projects/microcontainer/trunk/kernel/src/main/org/jboss/beans/metadata/plugins/annotations/ExternalInstall.java (rev 0)
+++ projects/microcontainer/trunk/kernel/src/main/org/jboss/beans/metadata/plugins/annotations/ExternalInstall.java 2007-08-02 14:02:06 UTC (rev 64428)
@@ -0,0 +1,43 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2006, JBoss Inc., and individual contributors as indicated
+* by the @authors tag. See the copyright.txt 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.plugins.annotations;
+
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+import java.lang.annotation.ElementType;
+
+/**
+ * @author <a href="mailto:ales.justin at jboss.com">Ales Justin</a>
+ */
+ at Retention(RetentionPolicy.RUNTIME)
+ at Target({ElementType.ANNOTATION_TYPE})
+public @interface ExternalInstall
+{
+ String bean();
+
+ String method();
+
+ String dependantState() default "";
+
+ Value[] parameters() default {};
+}
Added: projects/microcontainer/trunk/kernel/src/main/org/jboss/beans/metadata/plugins/annotations/ExternalInstalls.java
===================================================================
--- projects/microcontainer/trunk/kernel/src/main/org/jboss/beans/metadata/plugins/annotations/ExternalInstalls.java (rev 0)
+++ projects/microcontainer/trunk/kernel/src/main/org/jboss/beans/metadata/plugins/annotations/ExternalInstalls.java 2007-08-02 14:02:06 UTC (rev 64428)
@@ -0,0 +1,37 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2006, JBoss Inc., and individual contributors as indicated
+* by the @authors tag. See the copyright.txt 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.plugins.annotations;
+
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+import java.lang.annotation.ElementType;
+
+/**
+ * @author <a href="mailto:ales.justin at jboss.com">Ales Justin</a>
+ */
+ at Retention(RetentionPolicy.RUNTIME)
+ at Target({ElementType.TYPE})
+public @interface ExternalInstalls
+{
+ ExternalInstall[] value();
+}
Added: projects/microcontainer/trunk/kernel/src/main/org/jboss/beans/metadata/plugins/annotations/ExternalUninstalls.java
===================================================================
--- projects/microcontainer/trunk/kernel/src/main/org/jboss/beans/metadata/plugins/annotations/ExternalUninstalls.java (rev 0)
+++ projects/microcontainer/trunk/kernel/src/main/org/jboss/beans/metadata/plugins/annotations/ExternalUninstalls.java 2007-08-02 14:02:06 UTC (rev 64428)
@@ -0,0 +1,37 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2006, JBoss Inc., and individual contributors as indicated
+* by the @authors tag. See the copyright.txt 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.plugins.annotations;
+
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+import java.lang.annotation.ElementType;
+
+/**
+ * @author <a href="mailto:ales.justin at jboss.com">Ales Justin</a>
+ */
+ at Retention(RetentionPolicy.RUNTIME)
+ at Target({ElementType.TYPE})
+public @interface ExternalUninstalls
+{
+ ExternalInstall[] value();
+}
Modified: projects/microcontainer/trunk/kernel/src/main/org/jboss/kernel/plugins/annotations/AbstractAnnotationPlugin.java
===================================================================
--- projects/microcontainer/trunk/kernel/src/main/org/jboss/kernel/plugins/annotations/AbstractAnnotationPlugin.java 2007-08-02 12:54:35 UTC (rev 64427)
+++ projects/microcontainer/trunk/kernel/src/main/org/jboss/kernel/plugins/annotations/AbstractAnnotationPlugin.java 2007-08-02 14:02:06 UTC (rev 64428)
@@ -24,33 +24,32 @@
import java.lang.annotation.Annotation;
import java.lang.annotation.ElementType;
import java.lang.annotation.Target;
-import java.util.Stack;
-import java.util.Iterator;
-import java.util.Set;
-import java.util.HashSet;
import java.util.Arrays;
import java.util.Collections;
+import java.util.HashSet;
+import java.util.Iterator;
import java.util.List;
+import java.util.Set;
+import java.util.Stack;
-import org.jboss.kernel.spi.dependency.KernelControllerContext;
-import org.jboss.metadata.spi.retrieval.AnnotationItem;
-import org.jboss.metadata.spi.retrieval.MetaDataRetrieval;
-import org.jboss.reflect.spi.AnnotatedInfo;
+import org.jboss.beans.metadata.spi.BeanMetaData;
import org.jboss.beans.metadata.spi.MetaDataVisitor;
import org.jboss.beans.metadata.spi.MetaDataVisitorNode;
-import org.jboss.beans.metadata.spi.BeanMetaData;
+import org.jboss.dependency.spi.CallbackItem;
import org.jboss.dependency.spi.ControllerState;
import org.jboss.dependency.spi.DependencyItem;
-import org.jboss.dependency.spi.CallbackItem;
-import org.jboss.logging.Logger;
+import org.jboss.kernel.spi.dependency.KernelControllerContext;
+import org.jboss.metadata.spi.retrieval.AnnotationItem;
+import org.jboss.metadata.spi.retrieval.MetaDataRetrieval;
+import org.jboss.reflect.spi.AnnotatedInfo;
+import org.jboss.util.JBossObject;
/**
* @param <T> info type
* @author <a href="mailto:ales.justin at jboss.com">Ales Justin</a>
*/
-public abstract class AbstractAnnotationPlugin<T extends AnnotatedInfo, C extends Annotation> implements AnnotationPlugin<T, C>
+public abstract class AbstractAnnotationPlugin<T extends AnnotatedInfo, C extends Annotation> extends JBossObject implements AnnotationPlugin<T, C>
{
- protected Logger log = Logger.getLogger(getClass());
private Class<C> annotation;
private Set<ElementType> types;
Modified: projects/microcontainer/trunk/kernel/src/main/org/jboss/kernel/plugins/annotations/BasicBeanAnnotationAdapter.java
===================================================================
--- projects/microcontainer/trunk/kernel/src/main/org/jboss/kernel/plugins/annotations/BasicBeanAnnotationAdapter.java 2007-08-02 12:54:35 UTC (rev 64427)
+++ projects/microcontainer/trunk/kernel/src/main/org/jboss/kernel/plugins/annotations/BasicBeanAnnotationAdapter.java 2007-08-02 14:02:06 UTC (rev 64428)
@@ -82,6 +82,8 @@
addAnnotationPlugin(new DependsAnnotationPlugin());
addAnnotationPlugin(new SupplysAnnotationPlugin());
addAnnotationPlugin(new ClassFactoryAnnotationPlugin(adapters));
+ addAnnotationPlugin(new ExternalInstallAnnotationPlugin());
+ addAnnotationPlugin(new ExternalUninstallAnnotationPlugin());
/*
addAnnotationPlugin(new InjectConstructorValueAnnotationPlugin());
addAnnotationPlugin(new StringValueConstructorValueAnnotationPlugin());
Added: projects/microcontainer/trunk/kernel/src/main/org/jboss/kernel/plugins/annotations/ExternalInstallAnnotationPlugin.java
===================================================================
--- projects/microcontainer/trunk/kernel/src/main/org/jboss/kernel/plugins/annotations/ExternalInstallAnnotationPlugin.java (rev 0)
+++ projects/microcontainer/trunk/kernel/src/main/org/jboss/kernel/plugins/annotations/ExternalInstallAnnotationPlugin.java 2007-08-02 14:02:06 UTC (rev 64428)
@@ -0,0 +1,58 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2006, JBoss Inc., and individual contributors as indicated
+* by the @authors tag. See the copyright.txt 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.kernel.plugins.annotations;
+
+import java.util.List;
+import java.util.ArrayList;
+
+import org.jboss.beans.metadata.plugins.annotations.ExternalInstalls;
+import org.jboss.beans.metadata.plugins.annotations.ExternalInstall;
+import org.jboss.beans.metadata.plugins.AbstractBeanMetaData;
+import org.jboss.beans.metadata.spi.BeanMetaData;
+import org.jboss.beans.metadata.spi.InstallMetaData;
+
+/**
+ * @author <a href="mailto:ales.justin at jboss.com">Ales Justin</a>
+ */
+public class ExternalInstallAnnotationPlugin extends ExternalInstallationAnnotationPlugin<ExternalInstalls>
+{
+ protected ExternalInstallAnnotationPlugin()
+ {
+ super(ExternalInstalls.class);
+ }
+
+ protected List<InstallMetaData> getExistingInstallMetaData(BeanMetaData beanMetaData)
+ {
+ List<InstallMetaData> list = beanMetaData.getInstalls();
+ if (list == null)
+ {
+ list = new ArrayList<InstallMetaData>();
+ ((AbstractBeanMetaData)beanMetaData).setInstalls(list);
+ }
+ return list;
+ }
+
+ protected ExternalInstall[] getExternalInstalls(ExternalInstalls annotation)
+ {
+ return annotation.value();
+ }
+}
Added: projects/microcontainer/trunk/kernel/src/main/org/jboss/kernel/plugins/annotations/ExternalInstallationAnnotationPlugin.java
===================================================================
--- projects/microcontainer/trunk/kernel/src/main/org/jboss/kernel/plugins/annotations/ExternalInstallationAnnotationPlugin.java (rev 0)
+++ projects/microcontainer/trunk/kernel/src/main/org/jboss/kernel/plugins/annotations/ExternalInstallationAnnotationPlugin.java 2007-08-02 14:02:06 UTC (rev 64428)
@@ -0,0 +1,162 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2006, JBoss Inc., and individual contributors as indicated
+* by the @authors tag. See the copyright.txt 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.kernel.plugins.annotations;
+
+import java.lang.annotation.Annotation;
+import java.util.ArrayList;
+import java.util.List;
+
+import org.jboss.beans.metadata.plugins.AbstractInstallMetaData;
+import org.jboss.beans.metadata.plugins.AbstractParameterMetaData;
+import org.jboss.beans.metadata.plugins.annotations.ExternalInstall;
+import org.jboss.beans.metadata.plugins.annotations.Value;
+import org.jboss.beans.metadata.spi.BeanMetaData;
+import org.jboss.beans.metadata.spi.InstallMetaData;
+import org.jboss.beans.metadata.spi.ParameterMetaData;
+import org.jboss.beans.metadata.spi.ValueMetaData;
+import org.jboss.dependency.spi.ControllerState;
+import org.jboss.kernel.spi.dependency.KernelControllerContext;
+import org.jboss.reflect.spi.ClassInfo;
+
+/**
+ * @param <C> annotation type
+ * @author <a href="mailto:ales.justin at jboss.com">Ales Justin</a>
+ */
+public abstract class ExternalInstallationAnnotationPlugin<C extends Annotation> extends ClassAnnotationPlugin<C>
+{
+ protected ExternalInstallationAnnotationPlugin(Class<C> annotation)
+ {
+ super(annotation);
+ }
+
+ protected abstract List<InstallMetaData> getExistingInstallMetaData(BeanMetaData beanMetaData);
+
+ protected abstract ExternalInstall[] getExternalInstalls(C annotation);
+
+ protected List<InstallMetaData> getInstallMetaData(C annotation)
+ {
+ List<InstallMetaData> installs = new ArrayList<InstallMetaData>();
+ for(ExternalInstall install : getExternalInstalls(annotation))
+ {
+ installs.add(createInstallMetaData(install));
+ }
+ return installs;
+ }
+
+ protected InstallMetaData createInstallMetaData(ExternalInstall install)
+ {
+ AbstractInstallMetaData installMetaData = new AbstractInstallMetaData();
+ installMetaData.setBean(install.bean());
+ installMetaData.setMethodName(install.method());
+ if (isAttributePresent(install.dependantState()))
+ installMetaData.setDependentState(new ControllerState(install.dependantState()));
+ for (Value value : install.parameters())
+ {
+ List<ParameterMetaData> parameters = installMetaData.getParameters();
+ if (parameters == null)
+ {
+ parameters = new ArrayList<ParameterMetaData>();
+ installMetaData.setParameters(parameters);
+ }
+ AbstractParameterMetaData parameter = new AbstractParameterMetaData(ValueUtil.createValueMetaData(value));
+ if (isAttributePresent(value.type()))
+ parameter.setType(value.type());
+ parameters.add(parameter);
+ }
+ return installMetaData;
+ }
+
+ protected void internalApplyAnnotation(ClassInfo info, C annotation, KernelControllerContext context) throws Throwable
+ {
+ BeanMetaData beanMetaData = context.getBeanMetaData();
+ List<InstallMetaData> existing = getExistingInstallMetaData(beanMetaData);
+ if (existing == null)
+ throw new IllegalArgumentException("Must set empty Set to installs/uninstalls!");
+
+ List<InstallMetaData> installs = getInstallMetaData(annotation);
+ if (installs != null && installs.isEmpty() == false)
+ {
+ for(InstallMetaData install : installs)
+ {
+ boolean doAdd = true;
+ for(InstallMetaData existingInstall : existing)
+ {
+ if (isDifferent(install, existingInstall) == false)
+ {
+ doAdd = false;
+ break;
+ }
+ }
+ if (doAdd)
+ {
+ existing.add(install);
+ executeVisit(context, install);
+ }
+ }
+ }
+ }
+
+ protected static boolean isDifferent(InstallMetaData first, InstallMetaData second)
+ {
+ if (notEqual(first.getBean(), second.getBean()))
+ return true;
+
+ if (notEqual(first.getMethodName(), second.getMethodName()))
+ return true;
+
+ List<ParameterMetaData> fstParameters = first.getParameters();
+ List<ParameterMetaData> sndParameters = second.getParameters();
+ int fstSize = fstParameters != null ? fstParameters.size() : 0;
+ int sndSize = sndParameters != null ? sndParameters.size() : 0;
+ if (fstSize != sndSize)
+ return true;
+
+ for(int i = 0; i < fstSize; i++)
+ {
+ ParameterMetaData fstParameter = fstParameters.get(i);
+ ParameterMetaData sndParameter = sndParameters.get(i);
+ // types
+ if (notEqual(fstParameter.getType(), sndParameter.getType()))
+ return true;
+ // values
+ ValueMetaData fstValue = fstParameter.getValue();
+ ValueMetaData sndValue = sndParameter.getValue();
+ Class fstClass = fstValue != null ? fstValue.getClass() : null;
+ Class sndClass = sndValue != null ? sndValue.getClass() : null;
+ // class guess
+ if (notEqual(fstClass, sndClass))
+ return true;
+
+ Object fstObject = fstValue != null ? fstValue.getUnderlyingValue() : null;
+ Object sndObject = sndValue != null ? sndValue.getUnderlyingValue() : null;
+ // underlying value guess - only on both being non-null
+ // e.g. since those who already passed have their underlying value set,
+ // those who didn't, don't have it, but they are the 'same' install
+ // see ThisValueMetaData
+ if ((fstObject != null && sndObject != null) && notEqual(fstObject, sndObject))
+ return true;
+ }
+
+ return false;
+ }
+
+}
Added: projects/microcontainer/trunk/kernel/src/main/org/jboss/kernel/plugins/annotations/ExternalUninstallAnnotationPlugin.java
===================================================================
--- projects/microcontainer/trunk/kernel/src/main/org/jboss/kernel/plugins/annotations/ExternalUninstallAnnotationPlugin.java (rev 0)
+++ projects/microcontainer/trunk/kernel/src/main/org/jboss/kernel/plugins/annotations/ExternalUninstallAnnotationPlugin.java 2007-08-02 14:02:06 UTC (rev 64428)
@@ -0,0 +1,58 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2006, JBoss Inc., and individual contributors as indicated
+* by the @authors tag. See the copyright.txt 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.kernel.plugins.annotations;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.jboss.beans.metadata.plugins.annotations.ExternalInstall;
+import org.jboss.beans.metadata.plugins.annotations.ExternalUninstalls;
+import org.jboss.beans.metadata.plugins.AbstractBeanMetaData;
+import org.jboss.beans.metadata.spi.BeanMetaData;
+import org.jboss.beans.metadata.spi.InstallMetaData;
+
+/**
+ * @author <a href="mailto:ales.justin at jboss.com">Ales Justin</a>
+ */
+public class ExternalUninstallAnnotationPlugin extends ExternalInstallationAnnotationPlugin<ExternalUninstalls>
+{
+ protected ExternalUninstallAnnotationPlugin()
+ {
+ super(ExternalUninstalls.class);
+ }
+
+ protected List<InstallMetaData> getExistingInstallMetaData(BeanMetaData beanMetaData)
+ {
+ List<InstallMetaData> list = beanMetaData.getUninstalls();
+ if (list == null)
+ {
+ list = new ArrayList<InstallMetaData>();
+ ((AbstractBeanMetaData)beanMetaData).setUninstalls(list);
+ }
+ return list;
+ }
+
+ protected ExternalInstall[] getExternalInstalls(ExternalUninstalls annotation)
+ {
+ return annotation.value();
+ }
+}
Deleted: projects/microcontainer/trunk/kernel/src/main/org/jboss/kernel/plugins/annotations/ParametersAnnotationPlugin.java
===================================================================
--- projects/microcontainer/trunk/kernel/src/main/org/jboss/kernel/plugins/annotations/ParametersAnnotationPlugin.java 2007-08-02 12:54:35 UTC (rev 64427)
+++ projects/microcontainer/trunk/kernel/src/main/org/jboss/kernel/plugins/annotations/ParametersAnnotationPlugin.java 2007-08-02 14:02:06 UTC (rev 64428)
@@ -1,44 +0,0 @@
-/*
-* JBoss, Home of Professional Open Source
-* Copyright 2006, JBoss Inc., and individual contributors as indicated
-* by the @authors tag. See the copyright.txt 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.kernel.plugins.annotations;
-
-import java.lang.annotation.Annotation;
-
-import org.jboss.beans.metadata.plugins.annotations.Parameter;
-import org.jboss.beans.metadata.spi.ValueMetaData;
-
-/**
- * @param <C> annotation type
- * @author <a href="mailto:ales.justin at jboss.com">Ales Justin</a>
- */
-public abstract class ParametersAnnotationPlugin<C extends Annotation> extends PropertyAnnotationPlugin<C>
-{
- public ParametersAnnotationPlugin(Class<C> annotation)
- {
- super(annotation);
- }
-
- protected ValueMetaData createValueMetaData(Parameter parameter)
- {
- return ValueUtil.createValueMetaData(parameter);
- }
-}
Modified: projects/microcontainer/trunk/kernel/src/main/org/jboss/kernel/plugins/annotations/ValueFactoryAnnotationPlugin.java
===================================================================
--- projects/microcontainer/trunk/kernel/src/main/org/jboss/kernel/plugins/annotations/ValueFactoryAnnotationPlugin.java 2007-08-02 12:54:35 UTC (rev 64427)
+++ projects/microcontainer/trunk/kernel/src/main/org/jboss/kernel/plugins/annotations/ValueFactoryAnnotationPlugin.java 2007-08-02 14:02:06 UTC (rev 64428)
@@ -35,7 +35,7 @@
/**
* @author <a href="mailto:ales.justin at jboss.com">Ales Justin</a>
*/
-public class ValueFactoryAnnotationPlugin extends ParametersAnnotationPlugin<ValueFactory>
+public class ValueFactoryAnnotationPlugin extends PropertyAnnotationPlugin<ValueFactory>
{
static ValueFactoryAnnotationPlugin INSTANCE = new ValueFactoryAnnotationPlugin();
Modified: projects/microcontainer/trunk/kernel/src/tests/org/jboss/test/kernel/dependency/support/ExternalInstallSimpleBeanImpl.java
===================================================================
--- projects/microcontainer/trunk/kernel/src/tests/org/jboss/test/kernel/dependency/support/ExternalInstallSimpleBeanImpl.java 2007-08-02 12:54:35 UTC (rev 64427)
+++ projects/microcontainer/trunk/kernel/src/tests/org/jboss/test/kernel/dependency/support/ExternalInstallSimpleBeanImpl.java 2007-08-02 14:02:06 UTC (rev 64428)
@@ -23,11 +23,19 @@
import java.io.Serializable;
+import org.jboss.beans.metadata.plugins.annotations.ExternalInstall;
+import org.jboss.beans.metadata.plugins.annotations.ExternalInstalls;
+import org.jboss.beans.metadata.plugins.annotations.ExternalUninstalls;
+import org.jboss.beans.metadata.plugins.annotations.ThisValue;
+import org.jboss.beans.metadata.plugins.annotations.Value;
+
/**
* A simple bean
*
* @author <a href="ales.justin at jboss.com">Ales Justin</a>
*/
+ at ExternalInstalls({@ExternalInstall(bean = "Name1", method = "addSimpleBean", parameters = {@Value(thisValue = @ThisValue)})})
+ at ExternalUninstalls({@ExternalInstall(bean = "Name1", method = "removeSimpleBean", parameters = {@Value(thisValue = @ThisValue)})})
public class ExternalInstallSimpleBeanImpl implements Serializable, SimpleBean
{
// Constants -----------------------------------------------------
Modified: projects/microcontainer/trunk/kernel/src/tests/org/jboss/test/kernel/dependency/test/DependencyTestSuite.java
===================================================================
--- projects/microcontainer/trunk/kernel/src/tests/org/jboss/test/kernel/dependency/test/DependencyTestSuite.java 2007-08-02 12:54:35 UTC (rev 64427)
+++ projects/microcontainer/trunk/kernel/src/tests/org/jboss/test/kernel/dependency/test/DependencyTestSuite.java 2007-08-02 14:02:06 UTC (rev 64428)
@@ -79,7 +79,7 @@
suite.addTest(KernelControllerContextAwareAnnotationTestCase.suite());
suite.addTest(InstallDependencyTestCase.suite());
suite.addTest(InstallDependencyXMLTestCase.suite());
-// suite.addTest(InstallDependencyAnnotationTestCase.suite()); // TODO
+ suite.addTest(InstallDependencyAnnotationTestCase.suite());
suite.addTest(GenericBeanFactoryInstallDependencyTestCase.suite());
suite.addTest(GenericBeanFactoryInstallDependencyXMLTestCase.suite());
suite.addTest(InstallSelfDependencyTestCase.suite());
Modified: projects/microcontainer/trunk/kernel/src/tests/org/jboss/test/kernel/dependency/test/InstallDependencyAnnotationTestCase.java
===================================================================
--- projects/microcontainer/trunk/kernel/src/tests/org/jboss/test/kernel/dependency/test/InstallDependencyAnnotationTestCase.java 2007-08-02 12:54:35 UTC (rev 64427)
+++ projects/microcontainer/trunk/kernel/src/tests/org/jboss/test/kernel/dependency/test/InstallDependencyAnnotationTestCase.java 2007-08-02 14:02:06 UTC (rev 64428)
@@ -22,6 +22,10 @@
package org.jboss.test.kernel.dependency.test;
import junit.framework.Test;
+import org.jboss.beans.metadata.plugins.AbstractBeanMetaData;
+import org.jboss.beans.metadata.spi.BeanMetaData;
+import org.jboss.test.kernel.dependency.support.SimpleBeanRepository;
+import org.jboss.test.kernel.dependency.support.ExternalInstallSimpleBeanImpl;
/**
* Install Dependency Test Case.
@@ -40,12 +44,10 @@
super(name);
}
-/*
protected void setupBeanMetaDatas() throws Throwable
{
AbstractBeanMetaData metaData1 = new AbstractBeanMetaData("Name1", SimpleBeanRepository.class.getName());
AbstractBeanMetaData metaData2 = new AbstractBeanMetaData("Name2", ExternalInstallSimpleBeanImpl.class.getName());
setBeanMetaDatas(new BeanMetaData[] { metaData1, metaData2 });
}
-*/
}
More information about the jboss-cvs-commits
mailing list