1 / 19

Enterprise JavaBeans

Enterprise JavaBeans. IST 411 Lecture 9 Spring 2004. Enterprise JavaBeans. JavaBeans – refers to a technology used to develop reusable components in Java Sun Microsystems released an API to enable developers to produce components which could be added to an integrated development environment

kholt
Download Presentation

Enterprise JavaBeans

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Enterprise JavaBeans IST 411 Lecture 9 Spring 2004

  2. Enterprise JavaBeans • JavaBeans – refers to a technology used to develop reusable components in Java • Sun Microsystems released an API to enable developers to produce components which could be added to an integrated development environment • Treated like normal Java widgets • They are not Enterprise JavaBeans

  3. Enterprise JavaBeans • Enterprise JavaBeans – • One part of package of middleware software developed by Java • Known as Java 2 Enterprise Edition • Other components include: • RMI • JDBC • Servlets • JavaMail • JMS (Java Messaging System) • Java Transaction Service

  4. Enterprise JavaBeans • Is a component technology • Large-scale components holding business logic are developed, known as business components • Need heavy transactional service to support them provided by a TP monitor, the application server • Components and software glue that connect them are deployed across one or more application servers

  5. Enterprise JavaBeans • Allow developers to reap the benefits of rapid application development by assembling predefined software components to create powerful applications and applets.

  6. Enterprise JavaBeans • Six parts / roles to the development process: • Bean Developer – company has expertise in a domain such as ticket reservation or airline staff scheduling. Company would produce Enterprise JavaBeans that implement application-specific logic (Java classes) • Container Provider – company that supplies low-level software which implements a run-time environment in which Enterprise JavaBeans can execute

  7. Enterprise JavaBeans • Server Provider – company that sells an Enterprise JavaBeans-compliant server which provides transactional services. The container provider and server provider are the same company. • Application Server includes and EJB container, servlet container, provides services such as JNDI (Java Naming and Directory Interface) directories, database connection pooling, integration with distributed systems and resource management • Application Assembler – company that joins Enterprise JavaBeans together.

  8. Enterprise JavaBeans • Deployer – given the code for the beans and glue, will deploy the code across a number of servers. Criteria for determining deployment includes performance, security, and reliability. • System Administrator – individual or collection of individuals who are responsible for ensuring the maintenance of the bean. They are responsible for tuning the bean for performance if requirements change.

  9. From: XML and Java Developing Web Applications, 2nd Edition, H. Maruyama, et. al., Addison Wesley, 2002, pg. 402.

  10. Enterprise JavaBeans • Server that supports EJBs should provide the following functions: • Distributed Transaction Management – administer transactions and ensure that phantom updates and inconsistent retrievals do not occur. • Security – prevent unauthorized access the Enterprise JavaBeans.

  11. Enterprise JavaBeans • Resource Management – provide resource management such as oversight of creation and deletion of threads and file connections. • Persistence - Enterprise JavaBeans sometimes need permanent storage medium. Server should manage this process ensuring that all changes to transient data intended for permanent storage are carried out.

  12. Enterprise JavaBeans • Multiclient Support – manage process of clients connecting to Enterprise JavaBeans and mediate their interaction with the beans. • Location Transparency – server should operate so that clients have no knowledge of physical location of Enterprise JavaBeans.

  13. Enterprise JavaBeans • Two types of Enterprise JavaBeans: • Entity beans – represents stored entity used in an application which requires permanent storage • Examples include bank accounts, flight plans, stock portfolios, insurance policies, and hotel bookings • Normally mapped into a relational database • Map long-lived data

  14. Enterprise JavaBeans • Session beans – performs some business logic; they do not model a stored entity like a bank account • Session bean might: process a debit on a bank account; process an order for e-commerce product; make a stock or share trade. • Only lasts for period when client interacts with the bean • Used by one client at a time

  15. Enterprise JavaBeans • Two types of session beans: • Stateful – maintains a state across a number of method calls such as a bean used to maintain a shopping cart for an e-retailer. • Stateless – processes and then finishes.

  16. Bean Classes • Remote Interface – interface which specifies the methods associated with a bean. • Extends the class javax.ejb.EJBObject • Throws a RemoteException • Home Interface – defines the methods for a bean’s lifecycle. It specifies methods for creating a bean, destroying a bean and locating a bean in a distributed system.

  17. Bean Classes • Bean Class – implements the methods for the bean • Does not implement the remote interface, but must contain methods actually match methods defined in that interface • Must have some methods corresponding to methods which are in the home interface • This class and the remote interface are connected together via the server which contains the bean

  18. Bean Classes • Primary Key Class – provides a key into the database that is used for the beans.

  19. Look at sample program.

More Related