410 likes | 531 Views
EJB Design. Server-side components. Perform complex algorithms high volume transactions Run in highly available environment (365 days/year) fault tolerant transactional secure. Basic Philosophy. Enterprise applications are complex As they grow, specialization is a necessity
E N D
Server-side components • Perform • complex algorithms • high volume transactions • Run in • highly available environment (365 days/year) • fault tolerant • transactional • secure
Basic Philosophy • Enterprise applications are complex • As they grow, specialization is a necessity • Local control should be more focused on business/application specific issues • Infrastructure issues should be left to specialists • Many application issues are common • Buying and assembling is better when possible • Scalability is beyond the scope of most developers
Bean Provider java beans EJB Application Assembler uses beans to build builds user interfaces and additional beans Deployer performance and secxurity Systems Admin handles problems of day-to-day running Container and Server Provider Tool Provider IDEs testing build Persistence manager Players in EJB System
User Interface Our Focus Business Logic Database (infrastructure)
3 -layer • Separate for independence as in any layer design • Application specific logic in business layer • Reuse and scale business and infrastrucure layers without impacting the others • As new interface technologies emerge, logic doesn’t (e.g., cell phone internet access)
How do the components interact? • Most of the communication between layers, both interlayer and intralayer are some type of remote procedure call. • Lots of technologies all basically the same • RPC • RMI • Corba • DCOM • Also a need to preserve connectors to legacy system for evolution/migration needs
Main components • Servers to manage complexity in first slide • Servers are housed in containers • Two containers • EJB • Web • Database/infrastructure • Input from java apps, web interfaces, legacy and related technologies (Corba).
Input Container • Manages two main technologies • JSP • Servlets • Handles issues of scalability, security, fault-tolerance, etc.
EJB container • Entity Beans • data objects • typically connected to database entries • Session Beans • logic operations • stateful and stateless • Message Beans • asynchronous message exchange between beans • like mail senders, readers
Remote calls • Allows for execution of logic on a machine other than the one caller executes on • Requires using a stub for initiating and receiving the call. • Takes the caller and creates • caller and calling stub • Takes the procedure and creates • receiving stub and procedure
Call appears local! Worries about socket calls parameter packaging Worries about receiving socket calls unpackaging parameters
Container simplifies Bean Typical business function interaction would be
Container simplifies Bean Business bean interaction would preferably be Hertz used to say “leave the driving to us”. Containers would say “leave the rest to us”.
Smart! Knows everything else Dumb! Only knows business logic.
To Deploy Must Use JAR • Contents include everything the container will need to manage it • Class files • Deployment descriptors • Zip format
Hello World Our first example!
REMOTE INTERFACE Remember it’s an interface (prototype) Insert prototype for the functionality you need .. hello()
HOME INTERFACE Remember it’s an interface (prototype) Insert prototype for the functionality you need .. hello()