diff options
Diffstat (limited to 'sca-java-2.x/trunk/modules/implementation-java/src')
2 files changed, 21 insertions, 53 deletions
diff --git a/sca-java-2.x/trunk/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/AbstractPropertyProcessor.java b/sca-java-2.x/trunk/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/AbstractPropertyProcessor.java index 13c677ac1d..635375a4ed 100644 --- a/sca-java-2.x/trunk/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/AbstractPropertyProcessor.java +++ b/sca-java-2.x/trunk/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/AbstractPropertyProcessor.java @@ -29,18 +29,12 @@ import java.util.Map; import org.apache.tuscany.sca.assembly.Property; import org.apache.tuscany.sca.core.ExtensionPointRegistry; -import org.apache.tuscany.sca.core.UtilityExtensionPoint; -import org.apache.tuscany.sca.databinding.Mediator; import org.apache.tuscany.sca.implementation.java.IntrospectionException; import org.apache.tuscany.sca.implementation.java.JavaElementImpl; import org.apache.tuscany.sca.implementation.java.JavaImplementation; import org.apache.tuscany.sca.implementation.java.JavaParameterImpl; import org.apache.tuscany.sca.implementation.java.introspect.BaseJavaClassVisitor; import org.apache.tuscany.sca.implementation.java.introspect.JavaIntrospectionHelper; -import org.apache.tuscany.sca.interfacedef.DataType; -import org.apache.tuscany.sca.interfacedef.impl.DataTypeImpl; -import org.apache.tuscany.sca.interfacedef.util.JavaXMLMapper; -import org.apache.tuscany.sca.interfacedef.util.XMLType; /** * Base class for ImplementationProcessors that handle annotations that add @@ -50,26 +44,10 @@ import org.apache.tuscany.sca.interfacedef.util.XMLType; */ public abstract class AbstractPropertyProcessor<A extends Annotation> extends BaseJavaClassVisitor { private final Class<A> annotationClass; - private Mediator mediator; protected AbstractPropertyProcessor(ExtensionPointRegistry registry, Class<A> annotationClass) { super(registry); this.annotationClass = annotationClass; - UtilityExtensionPoint utilityExtensionPoint = registry.getExtensionPoint(UtilityExtensionPoint.class); - this.mediator = utilityExtensionPoint.getUtility(Mediator.class); - } - - /** - * Introspect the property - * @param javaElement - * @return - */ - private DataType<?> introspect(Property property, JavaElementImpl javaElement) { - XMLType xmlType = new XMLType(property.getXSDElement(), property.getXSDType()); - DataType<XMLType> dt = - new DataTypeImpl<XMLType>(null, javaElement.getType(), javaElement.getGenericType(), xmlType); - mediator.getDataBindings().introspectType(dt, null); - return dt; } private static boolean removeProperty(JavaElementImpl prop, JavaImplementation type) { @@ -219,28 +197,12 @@ public abstract class AbstractPropertyProcessor<A extends Annotation> extends Ba properties.put(name, parameter); } } - - protected abstract String getName(A annotation); - protected abstract boolean getRequired(A annotation); - - protected abstract void initProperty(Property property, A annotation) throws IntrospectionException; - + protected Property createProperty(String name, JavaElementImpl element) throws IntrospectionException { Property property = assemblyFactory.createProperty(); property.setName(name); - DataType dt = introspect(property, element); - property.setDataType(dt); - if(dt.getLogical() instanceof XMLType) { - XMLType xmlType = (XMLType) dt.getLogical(); - property.setXSDType(xmlType.getTypeName()); - property.setXSDElement(xmlType.getElementName()); - } else { - Class<?> baseType = JavaIntrospectionHelper.getBaseType(element.getType(), element.getGenericType()); - property.setXSDType(JavaXMLMapper.getXMLType(baseType)); - } - Class<?> javaType = element.getType(); if (javaType.isArray() || Collection.class.isAssignableFrom(javaType)) { property.setMany(true); @@ -249,4 +211,10 @@ public abstract class AbstractPropertyProcessor<A extends Annotation> extends Ba } + protected abstract String getName(A annotation); + protected abstract boolean getRequired(A annotation); + + protected abstract void initProperty(Property property, A annotation) throws IntrospectionException; + + } diff --git a/sca-java-2.x/trunk/modules/implementation-java/src/main/resources/META-INF/services/org.apache.tuscany.sca.implementation.java.introspect.JavaClassVisitor b/sca-java-2.x/trunk/modules/implementation-java/src/main/resources/META-INF/services/org.apache.tuscany.sca.implementation.java.introspect.JavaClassVisitor index 2760b94e39..676dd272e1 100644 --- a/sca-java-2.x/trunk/modules/implementation-java/src/main/resources/META-INF/services/org.apache.tuscany.sca.implementation.java.introspect.JavaClassVisitor +++ b/sca-java-2.x/trunk/modules/implementation-java/src/main/resources/META-INF/services/org.apache.tuscany.sca.implementation.java.introspect.JavaClassVisitor @@ -17,17 +17,17 @@ #
# NOTE: The ranking attribute is important for the JavaClassVistors
# Some visitors need to be called after the others
-org.apache.tuscany.sca.implementation.java.introspect.impl.ConstructorProcessor;ranking=200
-org.apache.tuscany.sca.implementation.java.introspect.impl.AllowsPassByReferenceProcessor;ranking=190
-org.apache.tuscany.sca.implementation.java.introspect.impl.ComponentNameProcessor;ranking=180
-org.apache.tuscany.sca.implementation.java.introspect.impl.ContextProcessor;ranking=170
-org.apache.tuscany.sca.implementation.java.introspect.impl.DestroyProcessor;ranking=160
-org.apache.tuscany.sca.implementation.java.introspect.impl.EagerInitProcessor;ranking=150
-org.apache.tuscany.sca.implementation.java.introspect.impl.InitProcessor;ranking=140
-org.apache.tuscany.sca.implementation.java.introspect.impl.PropertyProcessor;ranking=130
-org.apache.tuscany.sca.implementation.java.introspect.impl.ReferenceProcessor;ranking=120
-org.apache.tuscany.sca.implementation.java.introspect.impl.ResourceProcessor;ranking=110
-org.apache.tuscany.sca.implementation.java.introspect.impl.ScopeProcessor;ranking=100
-org.apache.tuscany.sca.implementation.java.introspect.impl.ServiceProcessor;ranking=90
-org.apache.tuscany.sca.implementation.java.introspect.impl.HeuristicPojoProcessor;ranking=80
-org.apache.tuscany.sca.implementation.java.introspect.impl.PolicyProcessor;ranking=70
+org.apache.tuscany.sca.implementation.java.introspect.impl.ConstructorProcessor;ranking=2000
+org.apache.tuscany.sca.implementation.java.introspect.impl.AllowsPassByReferenceProcessor;ranking=1900
+org.apache.tuscany.sca.implementation.java.introspect.impl.ComponentNameProcessor;ranking=1800
+org.apache.tuscany.sca.implementation.java.introspect.impl.ContextProcessor;ranking=1700
+org.apache.tuscany.sca.implementation.java.introspect.impl.DestroyProcessor;ranking=1600
+org.apache.tuscany.sca.implementation.java.introspect.impl.EagerInitProcessor;ranking=1500
+org.apache.tuscany.sca.implementation.java.introspect.impl.InitProcessor;ranking=1400
+org.apache.tuscany.sca.implementation.java.introspect.impl.PropertyProcessor;ranking=1300
+org.apache.tuscany.sca.implementation.java.introspect.impl.ReferenceProcessor;ranking=1200
+org.apache.tuscany.sca.implementation.java.introspect.impl.ResourceProcessor;ranking=1100
+org.apache.tuscany.sca.implementation.java.introspect.impl.ScopeProcessor;ranking=1000
+org.apache.tuscany.sca.implementation.java.introspect.impl.ServiceProcessor;ranking=900
+org.apache.tuscany.sca.implementation.java.introspect.impl.HeuristicPojoProcessor;ranking=800
+org.apache.tuscany.sca.implementation.java.introspect.impl.PolicyProcessor;ranking=700
|