-
1. Re: Local and Remote interfaces required in EJB3
alrubinger Oct 16, 2006 3:35 PM (in response to hardy.ferentschik)The EJB3 spec eliminated the "Home" interfaces for obtaining a reference to a bean's proxy invoker.
The reason that the Remote and Local interfaces are required is because clients of an EJB3 Bean obtain a reference to (and invoke methods on) this proxy object, generated by the container, which implements the Remote or Local interface as configured. The actual implementation instances reside on the server, and also implement the Local/Remote interfaces.
S,
ALR -
2. Re: Local and Remote interfaces required in EJB3
hardy.ferentschik Oct 16, 2006 4:06 PM (in response to hardy.ferentschik)Sure, I understand that the client only gets a proxy to some interfaces and the bean implementation has of course to stay on the server. What I don't understand is why this interfaces could not be generated dynamically.
For example using some imaginary annoations here:@Stateful @Local (interface="FooLocal") public class FooBean { @LocalMethod public void foo(); @LocalMethod public void bar(); }
Wouldn't this be enough information for creating the client interface:public interface FooLocal { public void foo(); public void bar(); }
Given you would stick to some sort of naming standard you could provide even default values for the names of the local and remote interfaces.
Of course FooBean does not implement an interface now anymore, but invocations could be handled by some sort of dynamic proxy, right?
--Hardy -
3. Re: Local and Remote interfaces required in EJB3
alrubinger Oct 16, 2006 4:36 PM (in response to hardy.ferentschik)Sure...but wouldn't the generated interfaces have to be created at pre-compile time? And annotations provide metadata that's part of the compiled code...
Of course FooBean does not implement an interface now anymore, but invocations could be handled by some sort of dynamic proxy, right?
OK, but when you do your lookup to the proxy that doesn't implement an interface, how would you cast it or call methods on it?InitialContext ctx = new InitialContext(props); Object obj = ctx.lookup("jndiAddress"); ((FooLocal)obj).foo(); // < You wouldn't be able to cast or invoke if the proxy doesn't implement an interface
Sounds like you'd just like an XDoclet-esque step for generating Java source before compilation?
S,
ALR -
4. Re: Local and Remote interfaces required in EJB3
hardy.ferentschik Oct 16, 2006 5:20 PM (in response to hardy.ferentschik)
Sounds like you'd just like an XDoclet-esque step for generating Java source before compilation?
Yeah, sounds like it. I hoped that there would be no need for XDoclet anymore with EJB3, but it seems there actually is. I guess 'my imaginary' annoatations would in this case become XDoclet annotations which generate the interfaces pre-compliation.
Nevertheless, it would just feel right to get rid of the local and remote interfaces.
Thanks for your clarifications though.
--Hardy -
5. Re: Local and Remote interfaces required in EJB3
bill.burke Oct 16, 2006 5:38 PM (in response to hardy.ferentschik)
Wouldn't this be enough information for creating the client interface:
Um, with Intellij or Eclipse, its really easy to extract an interface. So instead of typing @LocalMethod, just let your ide create an interface for you. Easier, less typing.