EJB Roles and Responsibilities

image with no caption

EJB Role: Bean Provider

Deliverable: ejb-jar files (that include one or more beans and an XML deployment descriptor)

Primary responsibility: Design and program enterprise javabeans. In other words, write the bean code.

Characteristics: Knows the business logic that should be in a particular type of component, for a particular domain.

image with no caption

EJB Role: Application Assembler

Deliverable: ejb-jar files (that include one or more beans and an XML deployment descriptor with Bean Provider info as well as application assembly info). May also create clients or define interaction between other components (such as JSPs).

Primary responsibility: Combine one or more enterprise beans into a larger application. May sometimes wear the Bean Provider hat, mixing new and existing beans together to build an app.Defines the security and transaction behavior for the application.

Characteristics: Definitely a domain expert. Might not do as much coding as the Bean Provider.

Watch it!

The exam covers subtle differences between roles.

Pay very close attention to any mention of EJB roles in this book, especially when we cover more details of the deployment descriptor. Count on being tested on who does what, and count on those questions being subtle. The App Assembler and Bean Provider overlap in several areas, as does the Deployer and the App Assembler. For the exam, you need to know which role has the primary responsibility for a particular task (usually having to do with the deployment descriptor information).The stuff on this page and the next are just a start...

image with no caption

EJB Role: Deployer

Deliverable: Enterprise beans that have been customized for a specific operational environment, and deployed into the server.

Primary responsibility: Take the Application Assembler’s deliverable, study the deployment descriptor, and resolve any external dependencies. For example, if the bean relies on a particular resource, the deployer must map the logical name from the Bean Provider to the actual name of the resource on the server. Remember, when Bill wrote the bean code he didn’t know it would end up on Dick’s server. Bill had to make up a ‘fake’ name for the database, and Dick has to bind the fake name to something real.

Characteristics: An expert in a specific operational domain. Knows the security users and roles for this system, knows what’s configured into the server, and understands how to interpret the deployment descriptor info from the Bean Provider and App Assembler.

image with no caption

EJB Role: Container and Server Provider

Deliverable: EJB 2.0-compliant server, deployment tools, runtime environment for enterprise beans.

Primary responsibility: Implementing the spec.

Characteristics: Experts in distributed objects and transactions, and other low-level system services.

Get Head First EJB now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.