Programming restrictions on EJB
Learn to write reliable and portable EJB 1.1 components
Enterprise JavaBeans (EJB) is a specification and architecture for the development and deployment of distributed server-side,
transactional, and secure business application components. The EJB architecture is the basis and core of the Java 2 Enterprise
Edition (J2EE), which defines an entire standardized application development architecture as well as a deployment environment.
In this architecture, application developers focus on encapsulating the business logic and business rules and leave the infrastructural
service-related issues or plumbing to the application container and server.
Further, the runtime properties of the application components pertaining to transactions, persistence, security, and so on
are customizable in the deployment environment, using the highly flexible declarative approach. The architecture defines a
container and server model -- the container is the environment in which application component instances live and execute,
while containers are in turn housed within a server. The J2EE platform thus provides a simplified development model, industrial-strength
scalability, support for legacy integration, flexible deployment, application server and vendor independence, and generally
tends to make proprietary application servers and proprietary distributed object frameworks almost archaic.
EJB roles and responsibilities
The EJB specification defines several standard roles and responsibilities as listed below:
- EJB Server provider provides the EJB application server, and it is an expert in distributed transaction management, system services, and so on.
- EJB Container provider provides the runtime environment for the EJB components' instances as well as the deployment tools. EJB Server/Container
providers are typically OS vendors, database vendors, and application server vendors. The EJB server and EJB container are
assumed to be provided by the same vendor because no interfaces between them have been defined in the specification -- both
in the current EJB 1.1 (final version) as well as the EJB 2.0 public-draft version, which is currently under review.
- Bean provider, or EJB developer, develops EJB components that contain business logic and business functionality. The EJB developer provides
for each EJB component: the EJB implementation containing all obligatory component-container contract methods, such as
ejbRemove(), and so on, as well as the business methods; the
Home interface; the
Remote interface; and helper classes if necessary. The
Home interface provides the signature for the methods that create, remove, and find EJB instances. The
Remote interface defines the signatures for the business methods.
- Application Assembler takes a set of EJB components developed by the Bean provider and assembles them into a complete J2EE application.
- Deployer is an expert in the target production environment in which the application is to be deployed. The deployer installs the application
components on the application server and configures their transactional, data persistence, and security aspects. Thus, you
can declaratively address and manage complex issues such as transactions, concurrency, persistence, and security.
- Systems Administrator is responsible for the server's configuration and administration, runtime monitoring, and load balancing.
- Application Client/User Interface developer is responsible for the user interface and presentation logic.
The focus of this article is on the Bean provider/EJB developer and the programming restrictions that apply to the EJB components'