What are Enterprise Java Beans?

Dorothea Beringer, Feb. 20, 1999, internal paper

References used for this summary:
- the following white papers and articles from java.sun.com/products/ejb/
- book on CORBA (for OTS):
- www.ejbhome.com

Why EJB?

When building a system our of (distributed) building blocks, we can distinguish be different sets of functionality:
- the service/component itself containing the business logic (e.g. database access, computation, ....)
- QoS-helper services that quarantee the necessary quality of the service (transaction managament, availability, information about the service, ....)
- the connection protocol to the service (CORBA, IIOP, RMI, HTTP, ...)
These helper services can be factored out, so the business component provider can focus on the actual functionality the component should provide. EJB defines a specific component model, consisting of a set of requirements for the component execution system and the components and an interface towards the business components. Every system complying to that interface and the requirements can serve as a server and container (component execution system)  in which business components, the EJBs, can be plugged in. Being Java, this is done by providing a set of classes that define these interfaces and contain lot's of the necessary general functionality for building EJBs, so the developer can start writing EJBs right away.

This allows:

  • separation of concern (one company provides the servers, another the business components)
  • reuse (it is possible to make reusable business components that fit into different kind of servers, adapted to different needs)

  •  

     
     
     
     
     

    So far each component execution system has defined its own component model, with the consequence that components could only be sold and reused for once specific brand and kind of systems, hindering and effective market for business components. With EJB, Java tries to change it. I think there are at least two points why that could be successful: the EJB only defines the interface between the component execution system and the business components, not the interface between the component execution system and the client using such a system, thus allowing different types of exeuction systems with different characteristics. This allows a much broader reuse of business components. Secondly, they might have luck that the market is ready to embrace a new standard, and that Java is strong enough to help it break through.

    State, roadmap: EJBs is out, the first books have been written, the first execution systems are available and many more are to come. The finalisation of the specification as well as the implementation of a refence implementation take place throughout 1999. Certain enhancements are foreseen in phase two and three, mainly enhancing the portabilitiy of EJBs not only across different comonent execution systems, but also across different underlying databases, directory servers, transaction services (i.e. the interface between the beans and the rest of the enterprise services used by the beans).

    Main characteristics of EJB

    Today, more and more developers want to write distributed  transactional applications for the enterprise, and leverage the speed, security, and reliability of server-side technology. One  approach is to use a multitiered model where a thin-client  application invokes business logic that executes on the server.

    The basic architecture is a multi-tier system, with a thin client, a component execution system in the middle tier that supports things like transactions, high-volume throughput, load-balancing, state management, multithreading, resource pooling, and other complex low-level details, and then the EJBs and whatever system the EJBs use, e.g. database systems. The client is thin, i.e. it contains no business and data access logic, just presentation logic. EJB architectures make such application easy to write because the EJB server takes care of the low-level details, and the application programming just concentrates on writing EJBs for the business logic.

    Reuse model for the EJB components: EJB components are bought, copied and installed in the company building up the overall system. CHAIMS: the whole system composed by having one component exeuction system and a set of Beans might offer autonomous services, but the EJB components are not autonomous in our sense, they are very similar to the graphical Java Beans. They brought and integrated into the target system. Reuse of both, the component execution system and the Beans is enabled by having the EJB interface. Moreover, because the two are disentangled, Beans can be used within different kind of exeuction systems, thus being reused within system in totally different domains with differing requirements.
    EJBs are encapsulations. The EJB component model defines the basic architecture of the beans, the structure of their interface (they have to extend specific interface classes), the mechanism by which the component interacts with the container of the component execution system  and with other beans.
    Beans can be customized by the purchaser who integrates them into his system. Customization does not touch the code, instead a bean provides external property values that can be set by an integrator.

    A component execution system for EJBs consists of a server, the EJB server,  and a container containing the EJBs, the EJB container. It offers runtime services like:
    - multi-threading, concurrency control
    - persistency management, life-cycle management of beans,
    - transaction management with commit, rollback, nested transactions,
    - state management, security
    - resource-sharing, resource pooling
    These services can be split up into the services provided by the EJB server and the onces provided by the EJB container, and, theoretically, these could be two seperate systems.

    Entity beans versus session beans:

    Entity beans
    Session beans
    Represent data in databases and related processes, e.g. "bank account" Represent stateful dialogs between a business server and a client
    Implements business entity. Implements business task.
    is transactional  may be aware of transactions
    One entity bean serves multiple client; shares access for multiple users One session bean serves one client; handles database access for one client
    survive crashes do not survive crashes
    always persistent, kept in persistent storage; corresponds to life of data in database typically transient;  corresponds to life of client

    Database access can be done directly from session beans, or session beans can be clients of entity beans that then access databases.

    Typical architectures:

    browser <-->  servlet <--> ejb server with entity and session beans <--> database
     
     
     
     
     

    Roles in composing and providing EJBs:

    Bean Provider,
            Application Assembler ,
    the Deployer
     
     

    The Deployment Descriptor:

    The information is stored in XML-format.
    Information provided by the Bean Provider: name of the bean, class, interfaces, bean type, ....
    Information provided by the Application Assembler: security roles, transactional behaviour, ...
     
     
     

    How to make EJBs?

     

     
     
     
     
     
     
     

    Supporting systems for EJB?

    Possible systems that can be component execution systems for EJBs are:
    - TP Monitors
    - application servers, e.g. weblogic, oracle application server, netscape application server,
    - CORBA runtime systems
    - COM runtime systems
    - database systems, e.g. oracle8i, informix dynamic server,
    - web servers
    Of course, these systems have then their corresponding interface towards the client.
     

    CORBA-OTS and EJB?

     

     
     
     
     
     
     
     

    Definitions

    Disclaimer: words like he, his, him etc. are used in this document gender neutral, and apply to any human being able to perform the tasks described.