[jboss-cvs] JBossAS SVN: r63332 - in projects/microcontainer/trunk: kernel/src/main/org/jboss/beans/metadata/plugins and 8 other directories.
jboss-cvs-commits at lists.jboss.org
jboss-cvs-commits at lists.jboss.org
Mon Jun 4 08:21:46 EDT 2007
Author: alesj
Date: 2007-06-04 08:21:45 -0400 (Mon, 04 Jun 2007)
New Revision: 63332
Added:
projects/microcontainer/trunk/kernel/src/main/org/jboss/beans/metadata/spi/AutowireType.java
projects/microcontainer/trunk/kernel/src/resources/tests/org/jboss/test/kernel/deployment/xml/test/BeanWithAbstract.xml
projects/microcontainer/trunk/kernel/src/resources/tests/org/jboss/test/kernel/deployment/xml/test/BeanWithAutowire.xml
projects/microcontainer/trunk/kernel/src/resources/tests/org/jboss/test/kernel/deployment/xml/test/BeanWithParent.xml
Removed:
projects/microcontainer/trunk/kernel/src/main/org/jboss/beans/metadata/plugins/InjectionType.java
Modified:
projects/microcontainer/trunk/build/pom.xml
projects/microcontainer/trunk/kernel/src/main/org/jboss/beans/metadata/plugins/AbstractBeanMetaData.java
projects/microcontainer/trunk/kernel/src/main/org/jboss/beans/metadata/plugins/AbstractInjectionValueMetaData.java
projects/microcontainer/trunk/kernel/src/main/org/jboss/beans/metadata/plugins/InjectionOption.java
projects/microcontainer/trunk/kernel/src/main/org/jboss/beans/metadata/spi/BeanMetaData.java
projects/microcontainer/trunk/kernel/src/main/org/jboss/kernel/plugins/deployment/xml/BeanHandler.java
projects/microcontainer/trunk/kernel/src/main/org/jboss/kernel/plugins/deployment/xml/BeanSchemaBinding.java
projects/microcontainer/trunk/kernel/src/main/org/jboss/kernel/plugins/deployment/xml/InjectionHandler.java
projects/microcontainer/trunk/kernel/src/resources/main/schema/bean-deployer_2_0.xsd
projects/microcontainer/trunk/kernel/src/tests/org/jboss/test/kernel/config/test/ConfigureAttributeFromStringTestCase.java
projects/microcontainer/trunk/kernel/src/tests/org/jboss/test/kernel/deployment/support/NullClassLoader.java
projects/microcontainer/trunk/kernel/src/tests/org/jboss/test/kernel/deployment/xml/test/BeanTestCase.java
projects/microcontainer/trunk/spring-int/src/main/org/jboss/spring/deployment/xml/SpringBeanHandler.java
Log:
Parent, abstract, autowire metadata introduced to BeanMetaData.
Fixing NullDeployer test, ignoring AnnotationCallbackTests.
Modified: projects/microcontainer/trunk/build/pom.xml
===================================================================
--- projects/microcontainer/trunk/build/pom.xml 2007-06-04 10:14:42 UTC (rev 63331)
+++ projects/microcontainer/trunk/build/pom.xml 2007-06-04 12:21:45 UTC (rev 63332)
@@ -49,6 +49,9 @@
<includes>
<include>org/jboss/test/**/*TestCase.java</include>
</includes>
+ <excludes>
+ <exclude>org/jboss/test/**/*AnnotationCallbackTestCase.java</exclude>
+ </excludes>
</configuration>
</plugin>
<plugin>
Modified: projects/microcontainer/trunk/kernel/src/main/org/jboss/beans/metadata/plugins/AbstractBeanMetaData.java
===================================================================
--- projects/microcontainer/trunk/kernel/src/main/org/jboss/beans/metadata/plugins/AbstractBeanMetaData.java 2007-06-04 10:14:42 UTC (rev 63331)
+++ projects/microcontainer/trunk/kernel/src/main/org/jboss/beans/metadata/plugins/AbstractBeanMetaData.java 2007-06-04 12:21:45 UTC (rev 63332)
@@ -29,6 +29,7 @@
import java.util.List;
import java.util.Set;
+import org.jboss.beans.metadata.spi.AutowireType;
import org.jboss.beans.metadata.spi.BeanMetaData;
import org.jboss.beans.metadata.spi.BeanMetaDataFactory;
import org.jboss.beans.metadata.spi.CallbackMetaData;
@@ -73,6 +74,15 @@
/** The aliases */
protected Set<Object> aliases;
+ /** The parent */
+ protected String parent;
+
+ /** Is abstract */
+ protected boolean isAbstract;
+
+ /** Autowire type */
+ protected AutowireType autowireType;
+
/** The mode */
protected ControllerMode mode;
@@ -340,6 +350,51 @@
this.aliases = aliases;
}
+ public String getParent()
+ {
+ return parent;
+ }
+
+ /**
+ * Set the parent.
+ *
+ * @param parent the parent name
+ */
+ public void setParent(String parent)
+ {
+ this.parent = parent;
+ }
+
+ public boolean isAbstract()
+ {
+ return isAbstract;
+ }
+
+ /**
+ * Set abstract.
+ *
+ * @param anAbstract is abstract
+ */
+ public void setAbstract(boolean anAbstract)
+ {
+ isAbstract = anAbstract;
+ }
+
+ public AutowireType getAutowireType()
+ {
+ return autowireType;
+ }
+
+ /**
+ * Set autowire type.
+ *
+ * @param autowireType the type
+ */
+ public void setAutowireType(AutowireType autowireType)
+ {
+ this.autowireType = autowireType;
+ }
+
public ControllerMode getMode()
{
return mode;
Modified: projects/microcontainer/trunk/kernel/src/main/org/jboss/beans/metadata/plugins/AbstractInjectionValueMetaData.java
===================================================================
--- projects/microcontainer/trunk/kernel/src/main/org/jboss/beans/metadata/plugins/AbstractInjectionValueMetaData.java 2007-06-04 10:14:42 UTC (rev 63331)
+++ projects/microcontainer/trunk/kernel/src/main/org/jboss/beans/metadata/plugins/AbstractInjectionValueMetaData.java 2007-06-04 12:21:45 UTC (rev 63332)
@@ -21,6 +21,7 @@
*/
package org.jboss.beans.metadata.plugins;
+import org.jboss.beans.metadata.spi.AutowireType;
import org.jboss.beans.metadata.spi.MetaDataVisitor;
import org.jboss.beans.metadata.spi.MetaDataVisitorNode;
import org.jboss.dependency.plugins.AttributeCallbackItem;
@@ -41,12 +42,12 @@
{
private static final long serialVersionUID = 2L;
- protected InjectionType injectionType = InjectionType.BY_CLASS;
+ protected AutowireType injectionType = AutowireType.BY_CLASS;
protected InjectionOption injectionOption = InjectionOption.STRICT;
/**
- * Simplyifies things with InjectionType.BY_NAME
+ * Simplyifies things with AutowireType.BY_NAME
*/
protected AbstractPropertyMetaData propertyMetaData;
@@ -78,12 +79,12 @@
super(value, property);
}
- public InjectionType getInjectionType()
+ public AutowireType getInjectionType()
{
return injectionType;
}
- public void setInjectionType(InjectionType injectionType)
+ public void setInjectionType(AutowireType injectionType)
{
this.injectionType = injectionType;
}
@@ -168,7 +169,7 @@
log.warn("Ignoring property - contextual injection: " + this);
}
- if (InjectionType.BY_NAME.equals(injectionType))
+ if (AutowireType.BY_NAME.equals(injectionType))
{
if (propertyMetaData == null)
throw new IllegalArgumentException("Illegal usage of type ByName - injection not used with property = " + this);
@@ -191,7 +192,7 @@
// no bean and not by_name
if (getUnderlyingValue() == null)
{
- if (InjectionType.BY_CLASS.equals(injectionType))
+ if (AutowireType.BY_CLASS.equals(injectionType))
{
context = visitor.getControllerContext();
Modified: projects/microcontainer/trunk/kernel/src/main/org/jboss/beans/metadata/plugins/InjectionOption.java
===================================================================
--- projects/microcontainer/trunk/kernel/src/main/org/jboss/beans/metadata/plugins/InjectionOption.java 2007-06-04 10:14:42 UTC (rev 63331)
+++ projects/microcontainer/trunk/kernel/src/main/org/jboss/beans/metadata/plugins/InjectionOption.java 2007-06-04 12:21:45 UTC (rev 63332)
@@ -64,7 +64,7 @@
* Or exception if no matching type.
*
* @param optionString type
- * @return InjectionType instance
+ * @return InjectionOption instance
*/
public static InjectionOption getInstance(String optionString)
{
Deleted: projects/microcontainer/trunk/kernel/src/main/org/jboss/beans/metadata/plugins/InjectionType.java
===================================================================
--- projects/microcontainer/trunk/kernel/src/main/org/jboss/beans/metadata/plugins/InjectionType.java 2007-06-04 10:14:42 UTC (rev 63331)
+++ projects/microcontainer/trunk/kernel/src/main/org/jboss/beans/metadata/plugins/InjectionType.java 2007-06-04 12:21:45 UTC (rev 63332)
@@ -1,128 +0,0 @@
-/*
-* JBoss, Home of Professional Open Source
-* Copyright 2005, 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;
-
-import java.io.Serializable;
-
-import org.jboss.util.JBossObject;
-import org.jboss.util.JBossStringBuilder;
-
-/**
- * Injection type:
- * * ByClass - matching the class type of value (default)
- * * ByName - matching the property name
- * * Constructor - matching the constructor args
- * * Auto - matching constructor or by type
- * * None - do not autowire
- *
- * @author <a href="mailto:ales.justin at genera-lynx.com">Ales Justin</a>
- */
-public class InjectionType extends JBossObject
- implements Serializable
-{
- private static final long serialVersionUID = 2L;
-
- /** None */
- public static final InjectionType NONE = new InjectionType("None");
-
- /** Strict */
- public static final InjectionType BY_CLASS = new InjectionType("ByClass");
-
- /** Loose */
- public static final InjectionType BY_NAME = new InjectionType("ByName");
-
- /** Constructor */
- public static final InjectionType CONSTRUCTOR = new InjectionType("Constructor");
-
- /** Auto */
- public static final InjectionType AUTO = new InjectionType("Auto");
-
- /** Array */
- public static final InjectionType[] TYPES = new InjectionType[]{
- NONE,
- BY_CLASS,
- BY_NAME,
- CONSTRUCTOR,
- AUTO,
- };
-
- /** The type string */
- protected final String typeString;
-
- /**
- * Create a new state
- *
- * @param typeString the string representation
- */
- private InjectionType(String typeString)
- {
- if (typeString == null)
- throw new IllegalArgumentException("Null type string");
- this.typeString = typeString;
- }
-
- /**
- * Return injection type.
- * Or NONE if no matching type.
- *
- * @param typeString type
- * @return InjectionType instance
- */
- public static InjectionType getInstance(String typeString)
- {
- for(InjectionType type : TYPES)
- {
- if (type.getTypeString().equalsIgnoreCase(typeString))
- return type;
- }
- return NONE;
- }
-
- /**
- * Get the state string
- *
- * @return the state string
- */
- public String getTypeString()
- {
- return typeString;
- }
-
- public boolean equals(Object object)
- {
- if (object == null || object instanceof InjectionType == false)
- return false;
- InjectionType other = (InjectionType) object;
- return typeString.equals(other.getTypeString());
- }
-
- public void toString(JBossStringBuilder buffer)
- {
- buffer.append(typeString);
- }
-
- protected int getHashCode()
- {
- return typeString.hashCode();
- }
-
-}
Copied: projects/microcontainer/trunk/kernel/src/main/org/jboss/beans/metadata/spi/AutowireType.java (from rev 63325, projects/microcontainer/trunk/kernel/src/main/org/jboss/beans/metadata/plugins/InjectionType.java)
===================================================================
--- projects/microcontainer/trunk/kernel/src/main/org/jboss/beans/metadata/spi/AutowireType.java (rev 0)
+++ projects/microcontainer/trunk/kernel/src/main/org/jboss/beans/metadata/spi/AutowireType.java 2007-06-04 12:21:45 UTC (rev 63332)
@@ -0,0 +1,128 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2005, 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.spi;
+
+import java.io.Serializable;
+
+import org.jboss.util.JBossObject;
+import org.jboss.util.JBossStringBuilder;
+
+/**
+ * Autowire type:
+ * * ByClass - matching the class type of value (default)
+ * * ByName - matching the property name
+ * * Constructor - matching the constructor args
+ * * Auto - matching constructor or by type
+ * * None - do not autowire
+ *
+ * @author <a href="mailto:ales.justin at genera-lynx.com">Ales Justin</a>
+ */
+public class AutowireType extends JBossObject
+ implements Serializable
+{
+ private static final long serialVersionUID = 1L;
+
+ /** None */
+ public static final AutowireType NONE = new AutowireType("None");
+
+ /** Strict */
+ public static final AutowireType BY_CLASS = new AutowireType("ByClass");
+
+ /** Loose */
+ public static final AutowireType BY_NAME = new AutowireType("ByName");
+
+ /** Constructor */
+ public static final AutowireType CONSTRUCTOR = new AutowireType("Constructor");
+
+ /** Auto */
+ public static final AutowireType AUTO = new AutowireType("Auto");
+
+ /** Array */
+ public static final AutowireType[] TYPES = new AutowireType[]{
+ NONE,
+ BY_CLASS,
+ BY_NAME,
+ CONSTRUCTOR,
+ AUTO,
+ };
+
+ /** The type string */
+ protected final String typeString;
+
+ /**
+ * Create a new state
+ *
+ * @param typeString the string representation
+ */
+ private AutowireType(String typeString)
+ {
+ if (typeString == null)
+ throw new IllegalArgumentException("Null type string");
+ this.typeString = typeString;
+ }
+
+ /**
+ * Return injection type.
+ * Or NONE if no matching type.
+ *
+ * @param typeString type
+ * @return AutowireType instance
+ */
+ public static AutowireType getInstance(String typeString)
+ {
+ for(AutowireType type : TYPES)
+ {
+ if (type.getTypeString().equalsIgnoreCase(typeString))
+ return type;
+ }
+ return NONE;
+ }
+
+ /**
+ * Get the state string
+ *
+ * @return the state string
+ */
+ public String getTypeString()
+ {
+ return typeString;
+ }
+
+ public boolean equals(Object object)
+ {
+ if (object == null || object instanceof AutowireType == false)
+ return false;
+ AutowireType other = (AutowireType) object;
+ return typeString.equals(other.getTypeString());
+ }
+
+ public void toString(JBossStringBuilder buffer)
+ {
+ buffer.append(typeString);
+ }
+
+ protected int getHashCode()
+ {
+ return typeString.hashCode();
+ }
+
+}
Modified: projects/microcontainer/trunk/kernel/src/main/org/jboss/beans/metadata/spi/BeanMetaData.java
===================================================================
--- projects/microcontainer/trunk/kernel/src/main/org/jboss/beans/metadata/spi/BeanMetaData.java 2007-06-04 10:14:42 UTC (rev 63331)
+++ projects/microcontainer/trunk/kernel/src/main/org/jboss/beans/metadata/spi/BeanMetaData.java 2007-06-04 12:21:45 UTC (rev 63332)
@@ -25,7 +25,6 @@
import java.util.Set;
import org.jboss.dependency.spi.ControllerMode;
-import org.jboss.dependency.spi.ControllerState;
/**
* Metadata about a bean.
@@ -61,9 +60,30 @@
*
* @return the aliases or null if there are no aliases
*/
- Set<Object> getAliases();
+ Set<Object> getAliases();
/**
+ * Get the parent.
+ *
+ * @return the parent
+ */
+ String getParent();
+
+ /**
+ * Is abstract metadata.
+ *
+ * @return is abstract
+ */
+ boolean isAbstract();
+
+ /**
+ * Get the autowire type.
+ *
+ * @return the autowire type
+ */
+ AutowireType getAutowireType();
+
+ /**
* Get the mode
*
* @return the mode
Modified: projects/microcontainer/trunk/kernel/src/main/org/jboss/kernel/plugins/deployment/xml/BeanHandler.java
===================================================================
--- projects/microcontainer/trunk/kernel/src/main/org/jboss/kernel/plugins/deployment/xml/BeanHandler.java 2007-06-04 10:14:42 UTC (rev 63331)
+++ projects/microcontainer/trunk/kernel/src/main/org/jboss/kernel/plugins/deployment/xml/BeanHandler.java 2007-06-04 12:21:45 UTC (rev 63332)
@@ -25,6 +25,7 @@
import javax.xml.namespace.QName;
import org.jboss.beans.metadata.plugins.AbstractBeanMetaData;
+import org.jboss.beans.metadata.spi.AutowireType;
import org.jboss.beans.metadata.spi.ConstructorMetaData;
import org.jboss.dependency.spi.ControllerMode;
import org.jboss.xb.binding.sunday.unmarshalling.DefaultElementHandler;
@@ -59,6 +60,12 @@
bean.setBean(attrs.getValue(i));
else if ("mode".equals(localName))
bean.setMode(new ControllerMode(attrs.getValue(i)));
+ else if ("parent".equals(localName))
+ bean.setParent(attrs.getValue(i));
+ else if ("abstract".equals(localName))
+ bean.setAbstract(Boolean.parseBoolean(attrs.getValue(i)));
+ else if ("autowire-type".equals(localName))
+ bean.setAutowireType(AutowireType.getInstance(attrs.getValue(i)));
else if ("autowire-candidate".equals(localName))
bean.setAutowireCandidate(Boolean.parseBoolean(attrs.getValue(i)));
}
@@ -67,7 +74,7 @@
public Object endElement(Object o, QName qName, ElementBinding element)
{
AbstractBeanMetaData bean = (AbstractBeanMetaData) o;
- if (bean.getBean() == null)
+ if (bean.getBean() == null && bean.isAbstract() == false && bean.getParent() == null)
{
ConstructorMetaData constructor = bean.getConstructor();
if (constructor == null)
Modified: projects/microcontainer/trunk/kernel/src/main/org/jboss/kernel/plugins/deployment/xml/BeanSchemaBinding.java
===================================================================
--- projects/microcontainer/trunk/kernel/src/main/org/jboss/kernel/plugins/deployment/xml/BeanSchemaBinding.java 2007-06-04 10:14:42 UTC (rev 63331)
+++ projects/microcontainer/trunk/kernel/src/main/org/jboss/kernel/plugins/deployment/xml/BeanSchemaBinding.java 2007-06-04 12:21:45 UTC (rev 63332)
@@ -46,9 +46,9 @@
import org.jboss.beans.metadata.plugins.AbstractSupplyMetaData;
import org.jboss.beans.metadata.plugins.AbstractValueMetaData;
import org.jboss.beans.metadata.plugins.InjectionOption;
-import org.jboss.beans.metadata.plugins.InjectionType;
import org.jboss.beans.metadata.plugins.StringValueMetaData;
import org.jboss.beans.metadata.plugins.factory.GenericBeanFactoryMetaData;
+import org.jboss.beans.metadata.spi.AutowireType;
import org.jboss.beans.metadata.spi.BeanMetaDataFactory;
import org.jboss.beans.metadata.spi.DemandMetaData;
import org.jboss.beans.metadata.spi.DependencyMetaData;
@@ -1044,7 +1044,7 @@
else if ("whenRequired".equals(localName))
injection.setWhenRequiredState(new ControllerState(attrs.getValue(i)));
else if ("type".equals(localName))
- injection.setInjectionType(InjectionType.getInstance(attrs.getValue(i)));
+ injection.setInjectionType(AutowireType.getInstance(attrs.getValue(i)));
else if ("option".equals(localName))
injection.setInjectionOption(InjectionOption.getInstance(attrs.getValue(i)));
}
Modified: projects/microcontainer/trunk/kernel/src/main/org/jboss/kernel/plugins/deployment/xml/InjectionHandler.java
===================================================================
--- projects/microcontainer/trunk/kernel/src/main/org/jboss/kernel/plugins/deployment/xml/InjectionHandler.java 2007-06-04 10:14:42 UTC (rev 63331)
+++ projects/microcontainer/trunk/kernel/src/main/org/jboss/kernel/plugins/deployment/xml/InjectionHandler.java 2007-06-04 12:21:45 UTC (rev 63332)
@@ -10,7 +10,7 @@
import org.jboss.beans.metadata.plugins.AbstractInjectionValueMetaData;
import org.jboss.beans.metadata.plugins.AbstractPropertyMetaData;
import org.jboss.beans.metadata.plugins.InjectionOption;
-import org.jboss.beans.metadata.plugins.InjectionType;
+import org.jboss.beans.metadata.spi.AutowireType;
import org.jboss.dependency.spi.ControllerState;
import org.jboss.xb.binding.sunday.unmarshalling.DefaultElementHandler;
import org.jboss.xb.binding.sunday.unmarshalling.ElementBinding;
@@ -53,7 +53,7 @@
else if ("whenRequired".equals(localName))
injection.setWhenRequiredState(new ControllerState(attrs.getValue(i)));
else if ("type".equals(localName))
- injection.setInjectionType(InjectionType.getInstance(attrs.getValue(i)));
+ injection.setInjectionType(AutowireType.getInstance(attrs.getValue(i)));
else if ("option".equals(localName))
injection.setInjectionOption(InjectionOption.getInstance(attrs.getValue(i)));
}
Modified: projects/microcontainer/trunk/kernel/src/resources/main/schema/bean-deployer_2_0.xsd
===================================================================
--- projects/microcontainer/trunk/kernel/src/resources/main/schema/bean-deployer_2_0.xsd 2007-06-04 10:14:42 UTC (rev 63331)
+++ projects/microcontainer/trunk/kernel/src/resources/main/schema/bean-deployer_2_0.xsd 2007-06-04 12:21:45 UTC (rev 63332)
@@ -106,6 +106,9 @@
<xsd:attribute name="name" type="xsd:string" use="optional"/>
<xsd:attribute name="class" type="xsd:token" use="optional"/>
<xsd:attribute name="mode" type="controllerModeType" use="optional"/>
+ <xsd:attribute name="parent" type="xsd:string" use="optional"/>
+ <xsd:attribute name="abstract" type="xsd:boolean" use="optional"/>
+ <xsd:attribute name="autowire-type" type="autowireTypeType" use="optional"/>
<xsd:attribute name="autowire-candidate" type="xsd:boolean" use="optional"/>
</xsd:complexType>
@@ -389,7 +392,7 @@
<xsd:attribute name="property" type="xsd:string" use="optional"/>
<xsd:attribute name="state" type="controllerStateType" use="optional"/>
<xsd:attribute name="whenRequired" type="controllerStateType" use="optional"/>
- <xsd:attribute name="type" type="injectionTypeType" use="optional" default="ByClass"/>
+ <xsd:attribute name="type" type="autowireTypeType" use="optional" default="ByClass"/>
<xsd:attribute name="option" type="optionType" use="optional" default="Strict"/>
</xsd:complexType>
@@ -944,14 +947,17 @@
</xsd:restriction>
</xsd:simpleType>
- <xsd:simpleType name="injectionTypeType">
+ <xsd:simpleType name="autowireTypeType">
<xsd:annotation>
<xsd:documentation>
<![CDATA[
You can set the type of lookup requirement - class type (ByClass) or property name (ByName)
Valid values include:
+ None
ByClass (default)
ByName
+ Constructor
+ Auto
]]>
</xsd:documentation>
</xsd:annotation>
Added: projects/microcontainer/trunk/kernel/src/resources/tests/org/jboss/test/kernel/deployment/xml/test/BeanWithAbstract.xml
===================================================================
--- projects/microcontainer/trunk/kernel/src/resources/tests/org/jboss/test/kernel/deployment/xml/test/BeanWithAbstract.xml (rev 0)
+++ projects/microcontainer/trunk/kernel/src/resources/tests/org/jboss/test/kernel/deployment/xml/test/BeanWithAbstract.xml 2007-06-04 12:21:45 UTC (rev 63332)
@@ -0,0 +1,3 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<bean xmlns="urn:jboss:bean-deployer:2.0" abstract="true"/>
Added: projects/microcontainer/trunk/kernel/src/resources/tests/org/jboss/test/kernel/deployment/xml/test/BeanWithAutowire.xml
===================================================================
--- projects/microcontainer/trunk/kernel/src/resources/tests/org/jboss/test/kernel/deployment/xml/test/BeanWithAutowire.xml (rev 0)
+++ projects/microcontainer/trunk/kernel/src/resources/tests/org/jboss/test/kernel/deployment/xml/test/BeanWithAutowire.xml 2007-06-04 12:21:45 UTC (rev 63332)
@@ -0,0 +1,3 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<bean xmlns="urn:jboss:bean-deployer:2.0" class="Dummy" autowire-type="Constructor"/>
Added: projects/microcontainer/trunk/kernel/src/resources/tests/org/jboss/test/kernel/deployment/xml/test/BeanWithParent.xml
===================================================================
--- projects/microcontainer/trunk/kernel/src/resources/tests/org/jboss/test/kernel/deployment/xml/test/BeanWithParent.xml (rev 0)
+++ projects/microcontainer/trunk/kernel/src/resources/tests/org/jboss/test/kernel/deployment/xml/test/BeanWithParent.xml 2007-06-04 12:21:45 UTC (rev 63332)
@@ -0,0 +1,3 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<bean xmlns="urn:jboss:bean-deployer:2.0" parent="OldDummy"/>
Modified: projects/microcontainer/trunk/kernel/src/tests/org/jboss/test/kernel/config/test/ConfigureAttributeFromStringTestCase.java
===================================================================
--- projects/microcontainer/trunk/kernel/src/tests/org/jboss/test/kernel/config/test/ConfigureAttributeFromStringTestCase.java 2007-06-04 10:14:42 UTC (rev 63331)
+++ projects/microcontainer/trunk/kernel/src/tests/org/jboss/test/kernel/config/test/ConfigureAttributeFromStringTestCase.java 2007-06-04 12:21:45 UTC (rev 63332)
@@ -25,7 +25,6 @@
import java.math.BigInteger;
import junit.framework.Test;
-
import org.jboss.beans.info.spi.BeanInfo;
import org.jboss.beans.metadata.plugins.AbstractPropertyMetaData;
import org.jboss.beans.metadata.plugins.StringValueMetaData;
@@ -54,7 +53,7 @@
public void testStringAttribute() throws Throwable
{
- Object value = new String("StringValue");
+ Object value = "StringValue";
SimpleBean bean = configureSimpleBean("AString", value);
assertEquals(value, bean.getAString());
}
@@ -118,7 +117,7 @@
public void testDateAttribute() throws Throwable
{
- Object value = createDate(2001, 01, 01);
+ Object value = createDate(2001, 1, 1);
SimpleBean bean = configureSimpleBean("ADate", value);
assertEquals(value, bean.getADate());
}
Modified: projects/microcontainer/trunk/kernel/src/tests/org/jboss/test/kernel/deployment/support/NullClassLoader.java
===================================================================
--- projects/microcontainer/trunk/kernel/src/tests/org/jboss/test/kernel/deployment/support/NullClassLoader.java 2007-06-04 10:14:42 UTC (rev 63331)
+++ projects/microcontainer/trunk/kernel/src/tests/org/jboss/test/kernel/deployment/support/NullClassLoader.java 2007-06-04 12:21:45 UTC (rev 63332)
@@ -26,4 +26,9 @@
*/
public class NullClassLoader extends ClassLoader
{
+ public Class<?> findClass(String name) throws ClassNotFoundException
+ {
+ Thread thread = Thread.currentThread();
+ return thread.getContextClassLoader().loadClass(name);
+ }
}
Modified: projects/microcontainer/trunk/kernel/src/tests/org/jboss/test/kernel/deployment/xml/test/BeanTestCase.java
===================================================================
--- projects/microcontainer/trunk/kernel/src/tests/org/jboss/test/kernel/deployment/xml/test/BeanTestCase.java 2007-06-04 10:14:42 UTC (rev 63331)
+++ projects/microcontainer/trunk/kernel/src/tests/org/jboss/test/kernel/deployment/xml/test/BeanTestCase.java 2007-06-04 12:21:45 UTC (rev 63332)
@@ -26,6 +26,7 @@
import junit.framework.Test;
import org.jboss.beans.metadata.plugins.AbstractBeanMetaData;
+import org.jboss.beans.metadata.spi.AutowireType;
import org.jboss.dependency.spi.ControllerMode;
/**
@@ -727,8 +728,94 @@
{
AbstractBeanMetaData bean = unmarshalBean("BeanWithCandidate.xml");
assertFalse(bean.isAutowireCandidate());
+ assertNull(bean.getName());
+ assertEquals("Dummy", bean.getBean());
+ assertNull(bean.getMode());
+ assertNull(bean.getAnnotations());
+ assertNull(bean.getClassLoader());
+ assertNull(bean.getConstructor());
+ assertNull(bean.getProperties());
+ assertNull(bean.getCreate());
+ assertNull(bean.getStart());
+ assertNull(bean.getStop());
+ assertNull(bean.getDestroy());
+ assertNull(bean.getDemands());
+ assertNull(bean.getSupplies());
+ assertNull(bean.getInstalls());
+ assertNull(bean.getUninstalls());
+ assertNull(bean.getInstallCallbacks());
+ assertNull(bean.getUninstallCallbacks());
}
+ public void testBeanWithParent() throws Exception
+ {
+ AbstractBeanMetaData bean = unmarshalBean("BeanWithParent.xml");
+ assertEquals("OldDummy", bean.getParent());
+ assertNull(bean.getName());
+ assertNull(bean.getBean());
+ assertNull(bean.getMode());
+ assertNull(bean.getAnnotations());
+ assertNull(bean.getClassLoader());
+ assertNull(bean.getConstructor());
+ assertNull(bean.getProperties());
+ assertNull(bean.getCreate());
+ assertNull(bean.getStart());
+ assertNull(bean.getStop());
+ assertNull(bean.getDestroy());
+ assertNull(bean.getDemands());
+ assertNull(bean.getSupplies());
+ assertNull(bean.getInstalls());
+ assertNull(bean.getUninstalls());
+ assertNull(bean.getInstallCallbacks());
+ assertNull(bean.getUninstallCallbacks());
+ }
+
+ public void testBeanWithAbstract() throws Exception
+ {
+ AbstractBeanMetaData bean = unmarshalBean("BeanWithAbstract.xml");
+ assertTrue(bean.isAbstract());
+ assertNull(bean.getName());
+ assertNull(bean.getBean());
+ assertNull(bean.getMode());
+ assertNull(bean.getAnnotations());
+ assertNull(bean.getClassLoader());
+ assertNull(bean.getConstructor());
+ assertNull(bean.getProperties());
+ assertNull(bean.getCreate());
+ assertNull(bean.getStart());
+ assertNull(bean.getStop());
+ assertNull(bean.getDestroy());
+ assertNull(bean.getDemands());
+ assertNull(bean.getSupplies());
+ assertNull(bean.getInstalls());
+ assertNull(bean.getUninstalls());
+ assertNull(bean.getInstallCallbacks());
+ assertNull(bean.getUninstallCallbacks());
+ }
+
+ public void testBeanWithAutowire() throws Exception
+ {
+ AbstractBeanMetaData bean = unmarshalBean("BeanWithAutowire.xml");
+ assertEquals(AutowireType.CONSTRUCTOR, bean.getAutowireType());
+ assertNull(bean.getName());
+ assertEquals("Dummy", bean.getBean());
+ assertNull(bean.getMode());
+ assertNull(bean.getAnnotations());
+ assertNull(bean.getClassLoader());
+ assertNull(bean.getConstructor());
+ assertNull(bean.getProperties());
+ assertNull(bean.getCreate());
+ assertNull(bean.getStart());
+ assertNull(bean.getStop());
+ assertNull(bean.getDestroy());
+ assertNull(bean.getDemands());
+ assertNull(bean.getSupplies());
+ assertNull(bean.getInstalls());
+ assertNull(bean.getUninstalls());
+ assertNull(bean.getInstallCallbacks());
+ assertNull(bean.getUninstallCallbacks());
+ }
+
public static Test suite()
{
return suite(BeanTestCase.class);
Modified: projects/microcontainer/trunk/spring-int/src/main/org/jboss/spring/deployment/xml/SpringBeanHandler.java
===================================================================
--- projects/microcontainer/trunk/spring-int/src/main/org/jboss/spring/deployment/xml/SpringBeanHandler.java 2007-06-04 10:14:42 UTC (rev 63331)
+++ projects/microcontainer/trunk/spring-int/src/main/org/jboss/spring/deployment/xml/SpringBeanHandler.java 2007-06-04 12:21:45 UTC (rev 63332)
@@ -34,6 +34,7 @@
import org.jboss.beans.metadata.plugins.AbstractDemandMetaData;
import org.jboss.beans.metadata.plugins.AbstractDependencyValueMetaData;
import org.jboss.beans.metadata.plugins.AbstractLifecycleMetaData;
+import org.jboss.beans.metadata.spi.AutowireType;
import org.jboss.beans.metadata.spi.ConstructorMetaData;
import org.jboss.beans.metadata.spi.DemandMetaData;
import org.jboss.beans.metadata.spi.ParameterMetaData;
@@ -83,6 +84,12 @@
bean.setCreate(new AbstractLifecycleMetaData(attrs.getValue(i)));
else if ("lazy-init".equals(localName) && Boolean.parseBoolean(attrs.getValue(i)) == true)
bean.setMode(ControllerMode.ON_DEMAND);
+ else if ("parent".equals(localName))
+ bean.setParent(attrs.getValue(i));
+ else if ("abstract".equals(localName))
+ bean.setAbstract(Boolean.parseBoolean(attrs.getValue(i)));
+ else if ("autowire".equals(localName))
+ bean.setAutowireType(AutowireType.getInstance(attrs.getValue(i)));
else if ("autowire-candidate".equals(localName))
bean.setAutowireCandidate(Boolean.parseBoolean(attrs.getValue(i)));
else if ("destroy-method".equals(localName))
More information about the jboss-cvs-commits
mailing list