• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Paul Clapham
  • Tim Cooke
  • Ron McLeod
  • Liutauras Vilda
Sheriffs:
  • Jeanne Boyarsky
  • Devaka Cooray
  • Junilu Lacar
Saloon Keepers:
  • Tim Holloway
  • Carey Brown
  • Stephan van Hulst
  • Peter Rooke
  • Mikalai Zaikin
Bartenders:
  • Himai Minh

Narrow Casting

 
Greenhorn
Posts: 28
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,
Can one please clarify on why we will go for narrow casting for home stub. Is it like with narrow casting will get the stub that implements the interface ( home interface). Please clarify me with one example.

Thanks & Regards,
Parvathi.
 
Ranch Hand
Posts: 182
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Please note that Home is a remote object and you need a stub at the client side to communicate with it.Hence what we expect back is a stub object so we can communicate with the home.right.
 
Parvathi G
Greenhorn
Posts: 28
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,
When we register the home reference in the JNDI, it is the stub reference not the home object reference. Is it like, if we are refereing to any remote object reference in JNDI then we need to do a narrow casting instead of normal casting. Please correct if I am wrong any where.


Thanks & Regards,
Parvathi.
 
Rajan Murugan
Ranch Hand
Posts: 182
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Parvathi G:
Hi,
When we register the home reference in the JNDI, it is the stub reference not the home object reference. Is it like, if we are refereing to any remote object reference in JNDI then we need to do a narrow casting instead of normal casting. Please correct if I am wrong any where.


Thanks & Regards,
Parvathi.



Where did you got the info that the home reference/object is registered in the JNDI? Is it in the spec.kindly mention the page number.Did you assumed it is home because of the client code?

When we are refering to any remote and if it is rmi then normal casting works.The reason for narrow casting here is for not only casting but also for doing certain other things.
 
Parvathi G
Greenhorn
Posts: 28
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,
Please have look on the Head First EJB book from page number 91 (Chapter 2).


Thanks & Regards,
Parvathi.
 
Rajan Murugan
Ranch Hand
Posts: 182
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
hi,
what we are really registering in the JNDI is the AdviceBean with the name "advisor".if you see the client code in page no 57 we are doing a lookup with that name.

After being deployed the server seems to be creating a home object and registering with JNDI.My understanding is the stub might also created and associated with the jndi.when the client does a lookup the home stub is sent back.Otherwise what is the point of Home object? Where will it be? and what purpose it will be serving? It should be Home Object and not Home Object stub that will be registered with JNDI.Stub is basically for the client to communicate with the home object.stub acts as proxy for home object.isn't it.

so in the next step when we call create on the home,really we are calling create on the stub which communicates the call to the home object.
 
Parvathi G
Greenhorn
Posts: 28
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi..
Thanks for the Correction.
It is the Bean name what actually we refere through the JNDI.
And that reference is giving the home stub.
I actually made a conclusion depending on the diagaram.
Thanks a lot

Regards,
Parvathi.
 
Rajan Murugan
Ranch Hand
Posts: 182
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Most Welcome.
[ November 02, 2006: Message edited by: Rajan Murugan ]
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic