You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tuscany.apache.org by rf...@apache.org on 2007/10/05 18:19:11 UTC

svn commit: r582334 - /incubator/tuscany/java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/context/ComponentContextImpl.java

Author: rfeng
Date: Fri Oct  5 09:19:11 2007
New Revision: 582334

URL: http://svn.apache.org/viewvc?rev=582334&view=rev
Log:
Create JavaInterfaceContract instead of clone which will mix the WSDLInterfaceContract and JavaInterface

Modified:
    incubator/tuscany/java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/context/ComponentContextImpl.java

Modified: incubator/tuscany/java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/context/ComponentContextImpl.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/context/ComponentContextImpl.java?rev=582334&r1=582333&r2=582334&view=diff
==============================================================================
--- incubator/tuscany/java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/context/ComponentContextImpl.java (original)
+++ incubator/tuscany/java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/context/ComponentContextImpl.java Fri Oct  5 09:19:11 2007
@@ -317,8 +317,13 @@
         }
         if (!compatible) {
             // The interface is not assignable from the interface contract
-            interfaceContract = (InterfaceContract)interfaceContract.clone();
-            interfaceContract.setInterface(javaInterfaceFactory.createJavaInterface(businessInterface));
+            interfaceContract = javaInterfaceFactory.createJavaInterfaceContract();
+            JavaInterface callInterface = javaInterfaceFactory.createJavaInterface(businessInterface);
+            interfaceContract.setInterface(callInterface);
+            if (callInterface.getCallbackClass() != null) {
+                interfaceContract.setCallbackInterface(javaInterfaceFactory.createJavaInterface(callInterface
+                    .getCallbackClass()));
+            }
         }
 
         return interfaceContract;



---------------------------------------------------------------------
To unsubscribe, e-mail: tuscany-commits-unsubscribe@ws.apache.org
For additional commands, e-mail: tuscany-commits-help@ws.apache.org


Re: svn commit: r582334 - /incubator/tuscany/java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/context/ComponentContextImpl.java

Posted by Simon Laws <si...@googlemail.com>.
On Thu, Jul 29, 2010 at 11:57 AM, kelvin goodson
<ke...@apache.org> wrote:
> Can anyone help me understand this bit of code please?  In particular
> I need to understand what if any are the preconditions for this method
> that imply that -- "The interface is not assignable from the interface
> contract" -- is not an exceptional condition.
>
> On Fri, Oct 5, 2007 at 5:19 PM,  <rf...@apache.org> wrote:
>> Author: rfeng
>> Date: Fri Oct  5 09:19:11 2007
>> New Revision: 582334
>>
>> URL: http://svn.apache.org/viewvc?rev=582334&view=rev
>> Log:
>> Create JavaInterfaceContract instead of clone which will mix the WSDLInterfaceContract and JavaInterface
>>
>> Modified:
>>    incubator/tuscany/java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/context/ComponentContextImpl.java
>>
>> Modified: incubator/tuscany/java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/context/ComponentContextImpl.java
>> URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/context/ComponentContextImpl.java?rev=582334&r1=582333&r2=582334&view=diff
>> ==============================================================================
>> --- incubator/tuscany/java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/context/ComponentContextImpl.java (original)
>> +++ incubator/tuscany/java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/context/ComponentContextImpl.java Fri Oct  5 09:19:11 2007
>> @@ -317,8 +317,13 @@
>>         }
>>         if (!compatible) {
>>             // The interface is not assignable from the interface contract
>> -            interfaceContract = (InterfaceContract)interfaceContract.clone();
>> -            interfaceContract.setInterface(javaInterfaceFactory.createJavaInterface(businessInterface));
>> +            interfaceContract = javaInterfaceFactory.createJavaInterfaceContract();
>> +            JavaInterface callInterface = javaInterfaceFactory.createJavaInterface(businessInterface);
>> +            interfaceContract.setInterface(callInterface);
>> +            if (callInterface.getCallbackClass() != null) {
>> +                interfaceContract.setCallbackInterface(javaInterfaceFactory.createJavaInterface(callInterface
>> +                    .getCallbackClass()));
>> +            }
>>         }
>>
>>         return interfaceContract;
>>
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: tuscany-commits-unsubscribe@ws.apache.org
>> For additional commands, e-mail: tuscany-commits-help@ws.apache.org
>>
>>
>

As you point out it's an old bit of code. It's not clear to me
precisely why it doesn't raise an error when reference interface can't
be assigned to the business interface. A way into this could be to add
some new code that throws an exception when they aren't compatible and
see what fails in the build. This should highlight those situations in
our test cases where they can be incompatible.

Simon

-- 
Apache Tuscany committer: tuscany.apache.org
Co-author of a book about Tuscany and SCA: tuscanyinaction.com

Re: svn commit: r582334 - /incubator/tuscany/java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/context/ComponentContextImpl.java

Posted by kelvin goodson <ke...@apache.org>.
Can anyone help me understand this bit of code please?  In particular
I need to understand what if any are the preconditions for this method
that imply that -- "The interface is not assignable from the interface
contract" -- is not an exceptional condition.

On Fri, Oct 5, 2007 at 5:19 PM,  <rf...@apache.org> wrote:
> Author: rfeng
> Date: Fri Oct  5 09:19:11 2007
> New Revision: 582334
>
> URL: http://svn.apache.org/viewvc?rev=582334&view=rev
> Log:
> Create JavaInterfaceContract instead of clone which will mix the WSDLInterfaceContract and JavaInterface
>
> Modified:
>    incubator/tuscany/java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/context/ComponentContextImpl.java
>
> Modified: incubator/tuscany/java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/context/ComponentContextImpl.java
> URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/context/ComponentContextImpl.java?rev=582334&r1=582333&r2=582334&view=diff
> ==============================================================================
> --- incubator/tuscany/java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/context/ComponentContextImpl.java (original)
> +++ incubator/tuscany/java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/context/ComponentContextImpl.java Fri Oct  5 09:19:11 2007
> @@ -317,8 +317,13 @@
>         }
>         if (!compatible) {
>             // The interface is not assignable from the interface contract
> -            interfaceContract = (InterfaceContract)interfaceContract.clone();
> -            interfaceContract.setInterface(javaInterfaceFactory.createJavaInterface(businessInterface));
> +            interfaceContract = javaInterfaceFactory.createJavaInterfaceContract();
> +            JavaInterface callInterface = javaInterfaceFactory.createJavaInterface(businessInterface);
> +            interfaceContract.setInterface(callInterface);
> +            if (callInterface.getCallbackClass() != null) {
> +                interfaceContract.setCallbackInterface(javaInterfaceFactory.createJavaInterface(callInterface
> +                    .getCallbackClass()));
> +            }
>         }
>
>         return interfaceContract;
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tuscany-commits-unsubscribe@ws.apache.org
> For additional commands, e-mail: tuscany-commits-help@ws.apache.org
>
>