Re: Chaining InitialContexts ???

2009-09-04 Thread David Blevins


On Sep 1, 2009, at 6:07 AM, uglything wrote:



Hello everyone.

After having worked on something else (conception mainly with loads  
of UML2)

I'm coming back to the Plain Old Java Coding...

I'm willing to give a try to the @Remote concepts which I don't know  
at all.
Basically, I have an OpenEJB + Tomcat combo hosting my server  
application
which itself contains many @Remote classes. On the other hand I want  
the
same combo hosting my client application which rely on the remoted  
classes

from the server.

I would like to know if ther is some kind of configuration to "let the
server InitialContext merge into the client InitialContext" might  
sound
ridiculous and/or naïve... Just let me know... but as far as I've  
searched I

don't find anything of interrest...
What I've done so far - 80% of code monkey copy/paste your examples  
- is
starting a OpenEJB + Tomcat server and starting a JUnit test case  
with a
RemoteInitialContextFactory linked to the server through httpejbd (I  
guess)

whithout problem. I can easily hit the remoted beans that works great.
But this initial context does not discover my client ejbs as the
LocalInitialContextFactory does.


If by client ejbs you mean the @LocalClient injection support, then  
right, the RemoteInitialContextFactory doesn't yet support that.  We  
do plan to add support for an @RemoteClient which will work with the  
RemoteInitialContextFactory in a similar way.  There's a jira you can  
watch if you want to keep updated on progress there:


  http://issues.apache.org/jira/browse/OPENEJB-1025
  https://issues.apache.org/jira/secure/ViewIssue.jspa?id=12425175&watch=true 
  (for notifications)



On the other hand, I didn't find anything to tell a
LocalInitialContextFactory to search also into a remote directory...
So far my only guess is to manually create a Locator-like object  
wrapping a
RemoteICF and make manual lookups into it. Maybe it's just the way  
to go...


Right, at the moment a service locator is the best approach.

  http://openejb.apache.org/3.0/service-locator.html

We have some code in the openejb-client jar you can use or copy:

  
http://svn.apache.org/repos/asf/openejb/tags/openejb-3.1.1/server/openejb-client/src/main/java/org/apache/openejb/client/ServiceLocator.java
  
http://svn.apache.org/repos/asf/openejb/tags/openejb-3.1.1/server/openejb-client/src/main/java/org/apache/openejb/client/GenericServiceLocator.java



Another question arises from that...
Is there any support to propagate a transaction started from the  
client to
the server ? It seems that this is an optional requierement of the  
EJB3

specs...


There hasn't been any demand for it, but if you need it we can put it  
on the list.



BTW : Is there any registering to do to post answers to other people's
questions ? I would like to pay back a little for your great support  
by

helping some people here (up to my little knowledge though)


That's fantastic.  We can always use more help on the user list and  
elsewhere.  We're a small team and every bit helps.  Feel free to jump  
in anytime.  You can post through nabble or by sending mail directly  
to the list.



-David



Re: Chaining InitialContexts ???

2009-09-07 Thread uglything

Hello David


David Blevins wrote:
> 
> 
> On Sep 1, 2009, at 6:07 AM, uglything wrote:
> 
>>
>> Hello everyone.
>>
>> After having worked on something else (conception mainly with loads  
>> of UML2)
>> I'm coming back to the Plain Old Java Coding...
>>
>> I'm willing to give a try to the @Remote concepts which I don't know  
>> at all.
>> Basically, I have an OpenEJB + Tomcat combo hosting my server  
>> application
>> which itself contains many @Remote classes. On the other hand I want  
>> the
>> same combo hosting my client application which rely on the remoted  
>> classes
>> from the server.
>>
>> I would like to know if ther is some kind of configuration to "let the
>> server InitialContext merge into the client InitialContext" might  
>> sound
>> ridiculous and/or naïve... Just let me know... but as far as I've  
>> searched I
>> don't find anything of interrest...
>> What I've done so far - 80% of code monkey copy/paste your examples  
>> - is
>> starting a OpenEJB + Tomcat server and starting a JUnit test case  
>> with a
>> RemoteInitialContextFactory linked to the server through httpejbd (I  
>> guess)
>> whithout problem. I can easily hit the remoted beans that works great.
>> But this initial context does not discover my client ejbs as the
>> LocalInitialContextFactory does.
> 
> If by client ejbs you mean the @LocalClient injection support, then  
> right, the RemoteInitialContextFactory doesn't yet support that.  We  
> do plan to add support for an @RemoteClient which will work with the  
> RemoteInitialContextFactory in a similar way.  There's a jira you can  
> watch if you want to keep updated on progress there:
> 
>http://issues.apache.org/jira/browse/OPENEJB-1025
>   
> https://issues.apache.org/jira/secure/ViewIssue.jspa?id=12425175&watch=true 
>(for notifications)
> 
> 

I'll take a closer look to @LocalClient which I overlooked. But as you point
out, this will not apply directly to my issue.


David Blevins wrote:
> 
>> On the other hand, I didn't find anything to tell a
>> LocalInitialContextFactory to search also into a remote directory...
>> So far my only guess is to manually create a Locator-like object  
>> wrapping a
>> RemoteICF and make manual lookups into it. Maybe it's just the way  
>> to go...
> 
> Right, at the moment a service locator is the best approach.
> 
>http://openejb.apache.org/3.0/service-locator.html
> 
> We have some code in the openejb-client jar you can use or copy:
> 
>   
> http://svn.apache.org/repos/asf/openejb/tags/openejb-3.1.1/server/openejb-client/src/main/java/org/apache/openejb/client/ServiceLocator.java
>   
> http://svn.apache.org/repos/asf/openejb/tags/openejb-3.1.1/server/openejb-client/src/main/java/org/apache/openejb/client/GenericServiceLocator.java
> 

Great, these classes seem to fit my needs !
thanks.


David Blevins wrote:
> 
>>
>> Another question arises from that...
>> Is there any support to propagate a transaction started from the  
>> client to
>> the server ? It seems that this is an optional requierement of the  
>> EJB3
>> specs...
> 
> There hasn't been any demand for it, but if you need it we can put it  
> on the list.
> 

Well I think it could be a valuable add to OpenEJB (not mentioning my own
interrest :thinking: ).
If I am allowed to speak my dreams, I can easily think of an embedded
OpenEJB client (with RemoteICF) as a seamless "gate" to the server it links
to... Providing that :
 - the RemoteICF is able to manage it's own EJBs (just like the LocalICF
does)
   and inject them with EJBs coming from the server
 - the server is able to participate in transactions managed by the client

Well this might be a terrible idea, let me know...


David Blevins wrote:
> 
>> BTW : Is there any registering to do to post answers to other people's
>> questions ? I would like to pay back a little for your great support  
>> by
>> helping some people here (up to my little knowledge though)
> 
> That's fantastic.  We can always use more help on the user list and  
> elsewhere.  We're a small team and every bit helps.  Feel free to jump  
> in anytime.  You can post through nabble or by sending mail directly  
> to the list.
> 
> 
> -David
> 

Gr8, I'll try to prove myself useful :-D

Cheers and thanks for your support !

Juan Manuel
-- 
View this message in context: 
http://www.nabble.com/Chaining-InitialContexts-tp25240021p25331122.html
Sent from the OpenEJB User mailing list archive at Nabble.com.