Enterprise Java Beans I

download Enterprise Java Beans I

of 21

Transcript of Enterprise Java Beans I

  • 8/14/2019 Enterprise Java Beans I

    1/21

    Enterprise Java Beans

    CS-422

  • 8/14/2019 Enterprise Java Beans I

    2/21

  • 8/14/2019 Enterprise Java Beans I

    3/21

  • 8/14/2019 Enterprise Java Beans I

    4/21

    J2EE Industry Acceptance

    To be successful J2EE must have wide industry acceptance

    APIs would be useless if infrastructure vendors dont implement support

    for the J2EE APIs

    Sun made alliances with many Industry leaders to insure the success ofJ2EE

    Transaction Management

    IBM, Compaq/Tandem, BEA Systems

    Persistence Management

    Oracle, Sybase, Informix

    Directory Services

    HP, Netscape, IBM

  • 8/14/2019 Enterprise Java Beans I

    5/21

    J2EE APIs

    Enterprise Java Bean (EJB) API

    Java Naming and Directory Interface (JNDI)

    Remote Method Invocation/Internet Inter-ORB Protocol

    Java IDL

    Servlets and JSP

    Java Messaging Service (JMS)

    Java Transaction Service JTS)

    Java Transaction API (JTA) Java Database Connectivity (JDBC)

  • 8/14/2019 Enterprise Java Beans I

    6/21

    EJB API

    The EJB API defines a server component model

    provides portability across application servers

    implements automatic services on behalf of the application components

  • 8/14/2019 Enterprise Java Beans I

    7/21

    JNDI API

    Provides access to naming and directory services

    DNS, NDS, NIS+, LDAP, COS

    used to look up interfaces used to create EJBs, JDBC connections and

    other things

  • 8/14/2019 Enterprise Java Beans I

    8/21

    RMI/IIOP

    Allows the creation of remote interfaces for distributed computing

    default protocol (JRMP, Java Remote Method Protocol) is proprietary,

    based on Javas serialization APIs

    RMI-IIOP a JDK 1.3 extension of RMI that allows the use of IIOP(Internet Inter ORB Protocol) for RMI communication. J2EE Spec

    requires this as the standard protocol for communications between the

    different tiers of the J2EE architecture.

  • 8/14/2019 Enterprise Java Beans I

    9/21

    Java IDL

    Creates remote interfaces to support CORBA communications in the

    Java platform

    includes IDL compiler and a lightweight ORB

    allows the integration of non-Java based components

  • 8/14/2019 Enterprise Java Beans I

    10/21

    Servlets and JSP

    Used for creation of thin client interfaces for the presentation of

    information and collection of user inputs

    Support the dynamic HTML generation and session management for

    browser based clients

  • 8/14/2019 Enterprise Java Beans I

    11/21

  • 8/14/2019 Enterprise Java Beans I

    12/21

    JTA

    Provides a transaction demarcation API

    provides the infrastructure for transaction management

    open, committ, roll back

    if the transaction spans multiple beans deployed on the same server or on

    widely dispersed servers, the server vendor is responsible for proper

    implementation od transaction control

    transactions spanning multiple servers require the propigation of

    transaction context between servers over IIOP

  • 8/14/2019 Enterprise Java Beans I

    13/21

    JTS API

    Defines a distributed transaction management service based on

    CORBAs Object Transaction Service

  • 8/14/2019 Enterprise Java Beans I

    14/21

    JDBC

    Provides uniform access to relational databases such as DB2, Oracle,

    SQL Server and Sybase

    Provides provides interfaces to RDBMs both for data definition and

    query/insert/update/delete

    latest version provides for database connection pooling

  • 8/14/2019 Enterprise Java Beans I

    15/21

    Where we stand on J2EE...

    In CS-328 we covered the following APIs: JDBC

    RMI

    JavaIDL

    HTTP and the Web

    JNDI

    In CS-422 weve covered:

    Servlets and JSP

    Whats left:

    JMS (to be covered in CS-328)

    JTA (some day)

    JTS (some day)

    EJB

  • 8/14/2019 Enterprise Java Beans I

    16/21

    What is Enterprise Java Beans

    Defines a model for the development and deployment of reusable Java

    server components

    Components are pre-developed pieces of applications code that can be

    assembled into working application systems The EJB Architecture logically extends the Java Beans component

    model to support server components

    Server components run in an application server

    A Java application server provides an optimized execution

    environment for server-side Java application components by combining traditional OLTP (On-line Transaction Processing)

    technologies with a Java application server delivers a high performance,

    highly scalable, robust execution environment specifically suited to

    support Internet enabled application systems

  • 8/14/2019 Enterprise Java Beans I

    17/21

    Containers

    J2EE doesnt specify how a J2EE runtime should be built, but instead

    provides an abstraction of the runtime infrastructure as a container

    Component contract

    Container Service APIs Declaritive services

    Other container services

    The EJB Specification defines 4 types of containers:

    an applet container to run applets

    an application-client containerfor running standard Java application

    clients

    a Web Containerfor hosting Java servlets and JSPs

    anEJB Containerfor hosting Enterprise Java Beans

  • 8/14/2019 Enterprise Java Beans I

    18/21

    J2EE Applicatiuon Server

    Web Container

    J2EE Container Architecture

    Applet Container

    Application Client

    Container

    EJB Container

    RMI/IIOP

    JNDI

    JTA

    JDBC

    JMS

    JavaMail

    JAF

    RMI/IIOP

    JNDI

    JTA

    JDBC

    JMS

    JavaMail

    JAF

    Java Servlets

    JSP Pages

    Databases and

    Other Resources

    JMS

    JDB

    C

    EJBs

    App.Client

    Applet

  • 8/14/2019 Enterprise Java Beans I

    19/21

    The EJB Container

    An EJB server must provide one or more EJB containers which

    provide homes for the enterprise beans

    The EJB container manages the beans housed in it

    responsible of registering the bean

    providing a remote interface for it

    creating and destroying object instances

    checking security

    coordinate distributed trancactions

    can optionally manage persistent data within the object

    any number of EJB claees can be installed in a particular conrainer but

    each class can only be assigned to a particular container

  • 8/14/2019 Enterprise Java Beans I

    20/21

    EJB Container

    Client

    EJB Object

    (Client view)

    EJB Home

    (bean identifier)

    Enterprise Bean

    Deployment

    Descriptor

    Environment

    The EJB Object interface intercepts all method calls

    and implements transactions, state management,persistence,and security services for the bean based

    on deployment descriptor settings

    The EJB Home interface is accessible through JNDI

    and implements all lifecycle services for the bean.

  • 8/14/2019 Enterprise Java Beans I

    21/21

    Transient and Persistent Objects

    Session Beans (transient object) session beans are created and exist usually for a single user session

    performs operations on behalf of the client

    may be transactional but are not usually recoverable after a system crash

    can be stateless or can maintain conversational state across methods and

    transactions

    container manages the conversational state of a session bean if it needs to

    be evicted from memory

    must manage its own persistent data

    Entity Bean (persistent object)

    an object representation of persistent data that are maintained in apermanent data store (like a database)

    a primary key identifies each instance of the entity bean

    are transactional and are recoverable following a system crash