You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomee.apache.org by siegfried <si...@heintze.com> on 2009/05/26 09:48:32 UTC

Why two interfaces for CalculatorImpl.java

I'm studying
openejb-examples-3.1\simple-stateless\src\main\java\org\superbiz\calculator\
CalculatorImpl.java
 
(1) Why does CalculatorImpl need to implement two identical interfaces? Is
this necessary? Is this because we might want to expose additional
functionallity to other server side functions that are not available to
clients?
 
(2) In c++ one would have to implement function sum twice: one for
    each interface. Does the single implementation of function "add"
    satisfy both ancestor interfaces?
 

    


Re: Why two interfaces for CalculatorImpl.java

Posted by Jonathan Gallimore <jo...@gmail.com>.
On Tue, May 26, 2009 at 8:48 AM, siegfried <si...@heintze.com> wrote:

> I'm studying
>
> openejb-examples-3.1\simple-stateless\src\main\java\org\superbiz\calculator\
> CalculatorImpl.java
>
> (1) Why does CalculatorImpl need to implement two identical interfaces? Is
> this necessary? Is this because we might want to expose additional
> functionallity to other server side functions that are not available to
> clients?


CalculatorLocal is a local business interface, which can be used for calls
where the bean you are calling is in the same JVM as the caller. The remote
business (CalculatorRemote) interface on the other hand will work across
JVMs. You can also specify @Remote and @Local on the same business
interface, but I personally prefer using different interfaces for remote
calls to local ones.

I've never tried having different methods in the different interfaces, but I
can't see why it wouldn't work.


>
>
> (2) In c++ one would have to implement function sum twice: one for
>    each interface. Does the single implementation of function "add"
>    satisfy both ancestor interfaces?
>
>
>
Yes it does.

Cheers

Jon