An Introduction to Enterprise Java Beans

Master of Information System. Management. From The Java EE Tutorial … Management. SOAP and Java EE. Slide from JAXM/JMS tutorial at Sun Microsystems …

More PDF Content

An Introduction to Enterprise Java Beans
Benefits of Enterprise Beans(1)

  • Simplify development of large, distributed applications.
  • The developer can concentrate on business problems.
  • The EJB container handles transaction management, security, and authorization.
  • Portable – may be moved to other Java EE containers.
  • Scalable – the components may be distributed across many machines.
  • Support for Location Transparency
    the client need not be concerned with the location of the bean.
  • Support for Transaction management – ensures data integrity (over concurrent access of shared resources).
  • Promotes thin clients and web services

Enterprise Java Beans

  • Part of Java EE Enterprise Application Technologies
  • Currently at EJB3.0 (Big simplification of code with annotations – less concern with configuration files)
  • Server-side managed components
  • Server-Side EJB objects may offer a remote view (via a remote procedure call protocol) a local view (direct procedure call) or both
  • Managed EJB container services are more involved than the plain old JVM
  • Components distributed in binary format and are configurable

Server-Side Implications

  • In order to pull off the RPC trick we need:
  • A naming service
    – Recall how RMI clients make requests on the
    rmiregistry.
    – A stand alone EJB client would use a global JNDI
    name.
    InitialContext ic = new InitialContext(); // provider properties
    Foo foo = (Foo) ic.lookup(\”FooEJB\”); // and address of
    // naming service
    // found in
    // jndi.properties
  • RPC proxies
    – communications code along with the appropriate interface

Managed: EJB Container Services

  • Object Persistence
  • Declarative Security Control
  • Declarative Transaction Control
  • Concurrency Management
  • Scalability Management

EJB Types

  • Entity Beans
  • Session Beans
  • Message-Driven Beans

Entity Beans (1)

  • Represent a row of a relation. O/R mapping.
  • Represent real world entities (customers, orders, etc.).
  • Persistent objects typically stored in a relational database using CMP (Container Managed Persistence) or BMP (Bean Managed Persistence).
  • The client sees no difference between CMP and BMP beans.
  • CMP promotes component portability (more reliant on the container to handle detail).
  • CMP uses its own Query Language EJB QL.
  • CMP relies on an Abstract Schema in the deployment descriptor.
  • Define a primary key class:
    –  Required for entity beans.
    –  Provides a pointer into the database.
    –  Must implement Java.io.Serializable.
  • The EJB instance represents a particular row in the corresponding database table.
  • The home interface for the entity EJB represents the table as a whole (has finder methods.)
  • The primary key can be used by the client to locate the bean
  • Rows may have columns that reference other entity beans (e.g. an order has a buyer)
  • These relationships may be managed by the bean or by the container (container managed relationships)

Session Beans
Are an extension of the client application. Manage processes or tasks. Are not persistent. Often employ several different kinds of entity beans.

  • Implement business logic.
  • May be used as a web service.
  • Come in two types:
    –  Stateless session beans (no memory between calls) purchase(severalIems,creditCardNo);
    –  Stateful session beans (remember earlier calls) addToCart(item);

Message-Driven Beans (1)

  • Work in cooperation with Java Messaging System (JMS).
  • JMS is an abstraction API on top of Message-Oriented Middleware (MOM) – like JDBC is an abstraction API on top of SQL databases or like JAXR is an abstraction API on different types of XML registries or like JNDI is an abstraction API on directories.
  • Each MOM vendor implements things differently.
  • MDB’s allow the developer to program using the publish-subscribe messaging model based on asynchronous, distributed message queues.
  • The MOM vendor need only provide a service provider for JMS (IBM’s MQSeries or Progress’ 95-702 SonicMQ).
Download An Introduction to Enterprise Java Beans pdf from www.andrew.cmu.edu, 42 pages, 355.58KB.
Related Books

One Response to “An Introduction to Enterprise Java Beans”

  1. I always was concerned in this topic and stock still am, regards for putting up.

Leave a Reply