890 likes | 1.11k Views
Enterprise JavaBeans. Lesson 1: Introduction to Server-Side Component Software. Objectives. Define client-server and multi-tier architecture Discuss the benefits and issues of distributed architectures Define software components
E N D
Objectives • Define client-server and multi-tier architecture • Discuss the benefits and issues of distributed architectures • Define software components • Discuss server-side component architecture and architecture solutions • Define J2EE technologies • Define EJB technology
Client-Server andMulti-Tiered Architectures • Scalability • Extensibility • Security • Issues concerning distributed architectures • Complexity • Communication/bandwidth • Maintenance costs
SoftwareComponents • Component architectures • Component development tools • Container • Maintenance deployment tools
ComponentArchitecture Solutions • .NET Enterprise Architecture • CORBA • J2EE
EJB RMI/RMI-IIOP JNDI JDBC JTA/JTS JMS JSP IDL JavaMail Connectors XML J2EETechnologies
EnterpriseJavaBeans • Differences between JavaBeans and Enterprise JavaBeans • EJB development tasks • J2EE product provider • Bean developer • Application assembler • Deployer • System administrator • Tool provider
Summary • Define client-server and multi-tier architecture • Discuss the benefits and issues of distributed architectures • Define software components • Discuss server-side component architecture and architecture solutions • Define J2EE technologies • Define EJB technology
Objectives • Define an EJB server’s main components • Discuss EJB and client interaction • Identify EJB container services • Describe home objects and EJB objects • Compare session beans and entity beans • Define a deployment descriptor • Identify the EJB-JAR file
EJBArchitecture • Primary components • EJB-compliant server • EJB-compliant container • Home object (bean factory) • EJB object (remote interface) • EJB
EJBContainer Services • Distributed transaction management • Persistence • Security • Component resource and life cycle management • Remote accessibility • Transparent location of components • Identification of components
The EJBHome Object • Location transparency
TheEJB Object Stubs Skeletons
Types ofEnterprise JavaBeans • Session beans • Stateful • Stateless • Entity beans
DeploymentDescriptors • An XML document that describes the properties of an EJB
TheEJB-JAR File • Contains the class files for a bean, its home and remote interfaces, and the deployment descriptors
Summary • Define an EJB server’s main components • Discuss EJB and client interaction • Identify EJB container services • Describe home objects and EJB objects • Compare session beans and entity beans • Define a deployment descriptor • Identify the EJB-JAR file
Objectives • Define the methods of the SessionBean interface • Describe the EJBContext and the SessionContext interfaces • Contrast stateful and stateless session beans • Explain how to write business methods for a session bean • Discuss the enterprise bean’s life cycle
Objectives (cont’d) • Create a session bean • Define the EJBHome and EJBObject interfaces and their methods • Discuss the superclass for the home and remote interfaces • Describe system and application exceptions • Deploy and connect to a session bean
Creating theEnterprise Bean Class • ejbCreate methods • The SessionBean interface • The EJBContext interface • The SessionContext interface
Stateless andStateful Session Beans • Stateless session beans • Do not keep track of any information from one method call to the next • Stateful session beans • Can change their state during a conversation with a client
Writing Business Methods for an Enterprise Bean • Each EJB must declare the business methods that define the work that the EJB is designed to perform
The Home Interface • Extends EJBHome • Provides mechanisms to create and remove EJB components
The EJB Object • Extends the EJBObject interface
Exceptions in EJB • System exceptions • Application exceptions
Example:A Session Bean • The Teller bean class • The Teller remote interface • The Teller home interface
The LibraryApplication • The Book entity bean • The Patron entity bean • The CheckOutRecord entity bean • The CheckOut session bean • The CheckIn session bean
Introduction toEJB Deployment • The deployment descriptor • DD XML tags • Environment data • Environment property XML tags • Accessing environment data • Using bean references • EJB reference XML tags • Using the EJB reference • Using resource factories • Factory resource XML tags
AdditionalDeployment Concepts • Assembler/deployer roles with the deployment descriptor • EJB deployment in an EJB server
Summary • Define the methods of the SessionBean interface • Describe the EJBContext and the SessionContext interfaces • Contrast stateful and stateless session beans • Explain how to write business methods for a session bean • Discuss the enterprise bean’s life cycle
Summary (cont’d) • Create a session bean • Define the EJBHome and EJBObject interfaces and their methods • Discuss the superclass for the home and remote interfaces • Describe system and application exceptions • Deploy and connect to a session bean
Objectives • Discuss entity beans and their persistence management techniques • Identify the methods of the EntityBean and EntityContext interfaces • Define primary keys and their use • Describe the mechanics involved in entity beans • Use finder methods • Write an entity bean and its required interfaces
What Is an Entity Bean? • The EntityBean interface • The EntityContext interface • Primary keys
Entity BeanArchitecture • Creating entity beans • Invoking business methods on entity beans • Swapping entity beans • Invoking remove( ) on an entity bean • Life cycle of an entity bean instance
Bean-ManagedPersistence • Using JDBC • Using a resource factory to connect to a database
Entity Bean Methods • The ejbCreate( ) method • The ejbPostCreate( ) method • The ejbRemove( ) method • The ejbLoad( ) method • The ejbStore( ) method
UsingFinder Methods • The ejbFindByPrimaryKey( ) method • Multiple row finders
The Remote Interface • All remote interfaces extend javax.ejb.EJBObject