diff options
author | rfeng <rfeng@13f79535-47bb-0310-9956-ffa450edef68> | 2011-02-07 23:07:58 +0000 |
---|---|---|
committer | rfeng <rfeng@13f79535-47bb-0310-9956-ffa450edef68> | 2011-02-07 23:07:58 +0000 |
commit | eeaf84366a7e92085ffdec489f3a2efd3528aa76 (patch) | |
tree | 643312571fbbe399bc739774498bfc2a2c323891 /sca-java-2.x/trunk/modules/implementation-java | |
parent | 1523a8305daba91eb28d1fe65811b2a6bb41cc79 (diff) |
Enable the allowsPassByReference support
git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@1068209 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'sca-java-2.x/trunk/modules/implementation-java')
-rw-r--r-- | sca-java-2.x/trunk/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/ReferenceProcessor.java | 17 |
1 files changed, 13 insertions, 4 deletions
diff --git a/sca-java-2.x/trunk/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/ReferenceProcessor.java b/sca-java-2.x/trunk/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/ReferenceProcessor.java index b5c3806166..225099758d 100644 --- a/sca-java-2.x/trunk/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/ReferenceProcessor.java +++ b/sca-java-2.x/trunk/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/ReferenceProcessor.java @@ -43,6 +43,7 @@ import org.apache.tuscany.sca.interfacedef.java.JavaInterface; import org.apache.tuscany.sca.interfacedef.java.JavaInterfaceContract; import org.apache.tuscany.sca.interfacedef.java.JavaInterfaceFactory; import org.oasisopen.sca.ServiceReference; +import org.oasisopen.sca.annotation.AllowsPassByReference; import org.oasisopen.sca.annotation.Reference; /** @@ -88,7 +89,7 @@ public class ReferenceProcessor extends BaseJavaClassVisitor { removeReference(ref, type); JavaElementImpl element = new JavaElementImpl(method, 0); - org.apache.tuscany.sca.assembly.Reference reference = createReference(element, name); + org.apache.tuscany.sca.assembly.Reference reference = createReference(type, element, name); type.getReferences().add(reference); type.getReferenceMembers().put(name, element); } @@ -128,7 +129,7 @@ public class ReferenceProcessor extends BaseJavaClassVisitor { // Setter method override field if (ref == null) { JavaElementImpl element = new JavaElementImpl(field); - org.apache.tuscany.sca.assembly.Reference reference = createReference(element, name); + org.apache.tuscany.sca.assembly.Reference reference = createReference(type, element, name); type.getReferences().add(reference); type.getReferenceMembers().put(name, element); } @@ -160,7 +161,7 @@ public class ReferenceProcessor extends BaseJavaClassVisitor { } removeReference(ref, type); - org.apache.tuscany.sca.assembly.Reference reference = createReference(parameter, name); + org.apache.tuscany.sca.assembly.Reference reference = createReference(type, parameter, name); type.getReferences().add(reference); type.getReferenceMembers().put(name, parameter); parameter.setClassifer(Reference.class); @@ -169,16 +170,24 @@ public class ReferenceProcessor extends BaseJavaClassVisitor { /** * Create a SCA reference for a java Element + * @param implementation TODO * @param element * @param name * @return * @throws IntrospectionException */ - private org.apache.tuscany.sca.assembly.Reference createReference(JavaElementImpl element, String name) + private org.apache.tuscany.sca.assembly.Reference createReference(JavaImplementation implementation, JavaElementImpl element, String name) throws IntrospectionException { org.apache.tuscany.sca.assembly.Reference reference = assemblyFactory.createReference(); JavaInterfaceContract interfaceContract = javaInterfaceFactory.createJavaInterfaceContract(); reference.setInterfaceContract(interfaceContract); + + AllowsPassByReference pbr = element.getAnnotation(AllowsPassByReference.class); + if (pbr != null) { + reference.setAllowsPassByReference(true); + } else { + reference.setAllowsPassByReference(implementation.isAllowsPassByReference()); + } // reference.setMember((Member)element.getAnchor()); boolean required = true; |