On Fri, 14 Jul 2000 11:05:40 -0700, J. Matthew Pryor <[EMAIL PROTECTED]>
wrote:

>OK well here is my thinking (which I am happy to discover may be flawed ;-)
>
>BusinessObjectB does not meet the criteria for a "remotable" interface does
>it ? in RMI ? in CORBA ?

Do the methods throw RemoteException? Are the parameters valid RMI
classes? Then the interface as such is not a remote interface, of
course, but it can be by extending it in the way you describe.

>So how can I return BOB from a method that may be invoked remotely ?
>
>I'll state my need in another way
>
>What if I wish to write an implementation object that doesn't know or care
>if it is using RMI or CORBA or RMI/IIOP at runtime or not? The code need to
>know about generic "remoteness" issues, but shouldn't need to know about Tie
>delegates or UnicastRemoteObject etc. I'd like that to be determined at
>runtime.

Absolutely. So, it all comes down to what requirements there are on how
to construct these interfaces. RMI/JRMP and RMI/IIOP have the same
requirements, but I don't know about CORBA. Then again, RMI/IIOP might
take care of this anyway.

>When it comes time to write the implementation code, it seems to me that the
>way I have designed the interfaces has implications.
>
>Here is my attempt
>
>public interface BusinessInterfaceB
>{
>        String getName() throws java.rmi.RemoteException;
>}
>
>public interface BusinessInterfaceA
>{
>        String getName() throws java.rmi.RemoteException;
>        BusinessInterfaceB getMyOldFriendB() throws java.rmi.RemoteException;
>}
>
>public interface RemoteBusinessInterfaceB extends BusinessInterfaceB,
>java.lang.Remote
>{
>}
>
>public interface RemoteBusinessInterfaceA extends BusinessInterfaceA,
>java.lang.Remote
>{
>}
>
>public class RemoteBusinessInterfaceAImpl
>implements RemoteBusinessInterfaceA
>{
>        public String getName() { return "RemoteBusinessInterfaceA";}
>
>        public BusinessInterfaceB getMyOldFriendB()
>        {
>                // how can this be returned from a remotely invoked method ?
>                // what do the marshaling mechanisms for CORBA & RMI expect ?
>                // don't I have to declare this method to return 
>RemoteBusinessInterfaceB
>        }
>}

Why? RMI doesn't care about what you have declared, it ONLY cares about
what you are actually sending. If the object implements java.rmi.Remote,
it will replace it with the stub.

The problem you describe doesn't exist.

>Also there is an issue here to do with class inheritance
>
>I don't want to have to inherit from CORBA generated classes XXXBaseImpl or
>from UnicastRemoteObject since that makes me RMI/CORBA specific and also
>means I can't use inheritance for other (more useful) things.

I don't know about CORBA, but at least in RMI there is no requirement to
extend from UnicastRemoteObject (and personally I never make my remote
objects do that, for the reason you mention).

>Is what I am trying to do possible. I know that RMI/IIOP somewhat makes this
>moot, but that is really nascent and also potentially has limitation
>(depending on the app server etc) like not offering full JTS context
>propagation etc
>
>I am not sure if I have explained my issue explicitly enough but I leave it
>there for now

The original question was (I think): can I let my business methods
return BOB instead of RBOB? And the answer is definitely yes.

/Rickard

--
Rickard �berg

@home: +46 13 177937
Email: [EMAIL PROTECTED]
http://www.telkel.com
http://www.jboss.org
http://www.dreambean.com

===========================================================================
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff EJB-INTEREST".  For general help, send email to
[EMAIL PROTECTED] and include in the body of the message "help".

Reply via email to