13.07.2015 Views

Java™ Application Development on Linux - Dator

Java™ Application Development on Linux - Dator

Java™ Application Development on Linux - Dator

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

22.2 EJBs: You D<strong>on</strong>’t Know Beans?497public Costdebt(double amt, double rate, double paymnt)throws java.rmi.RemoteExcepti<strong>on</strong>{return SAM<strong>on</strong>ey.debt(amt, rate, paymnt);} // debtpublic voidsetSessi<strong>on</strong>C<strong>on</strong>text(Sessi<strong>on</strong>C<strong>on</strong>text c<strong>on</strong>text){sessi<strong>on</strong>C<strong>on</strong>text = c<strong>on</strong>text;} // setSessi<strong>on</strong>C<strong>on</strong>textpublic voidejbCreate() { }public voidejbRemove() { }public voidejbActivate() { }public voidejbPassivate() { }} // interface M<strong>on</strong>eyEJBean22.2.2 EJBObjectAt the other end of the chain of EJB objects used to accomplish all this distributedcomputing is the object that our applicati<strong>on</strong> is actually going to touch.When our applicati<strong>on</strong> creates an EJB, it, acting as a client, w<strong>on</strong>’t actually getits hands <strong>on</strong> the distant sessi<strong>on</strong> (or entity) bean because that sessi<strong>on</strong> bean isrunning somewhere out in the network. There will be, however, a proxy object,acting <strong>on</strong> behalf of the distant EJB. It is described as the remote interface, becauseit is remote from the EJB (though very close to the applicati<strong>on</strong>). It is aninterface because J2EE supplies a class that does the hidden work of marshalingthe data, c<strong>on</strong>tacting the EJB, sending the data and receiving the results; theapplicati<strong>on</strong> developer <strong>on</strong>ly adds a few additi<strong>on</strong>al applicati<strong>on</strong>-specific methods,via this interface (Example 22.2).

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!