EJB Development Considerations and Steps
The steps to developing EJBs can be partitioned along two main lines: server-side and client-side development. Although server-side development of distributed communications servers, such as CORBA and RMI, takes on a somewhat-complicated nature at times, server-side development of EJBs is simplified because much of the communications, state management, resource allocation, and thread management infrastructure coding is provided by the container. These are the main steps employed for server-side EJB development:
Implement EJB standard interfacesAny interfaces required by the standard EJB component model to enable container-based management of the EJB should be implemented.
Implement EJB business-specific interfacesAny business-specific interfaces provided by your EJB and any supporting helper and utility classes should be implemented.
Create client remote interfacesThe remote interface for your EJB that defines all business-specific interfaces to the EJB should be created.
Create client home interfacesThe home interface for your EJB that defines the application-specific methods for creating your EJB, as well as application-specific methods for finding your EJB (if it is an entity bean), should be created.
Compile EJB codeThe EJB implementation, home interface, and remote interface should be compiled.
Configure module deployment descriptorsThe standard EJB deployment descriptor should be configured to define the specific structural characteristics and dependencies of your EJB. Any deployment descriptors needed by your container/server provider should also be configured.
Package EJB into an EJB JAR moduleThe standard EJB deployment descriptor, any vendor-specific deployment descriptors, and one or more of your compiled EJB class files should be packaged into an EJB JAR module.
Configure application deployment descriptorA standard J2EE deployment descriptor should be configured for a cohesive collection of J2EE modules.
Package EJB Modules into a J2EE EAR ApplicationThe standard J2EE deployment descriptor and one or more EJB JAR files should be packaged into a J2EE EAR application.
Deploy the J2EE applicationThe J2EE EAR application should be deployed to a J2EE-compliant application container/server environment.
On the client side, clients must simply be designed to utilize the proper EJB client interfaces and libraries. EJB client development proceeds along the following lines:
Standard client library verificationThe proper EJB client libraries must be established.
EJB client interface generationThe properly compiled interfaces and stubs specific to a particular EJB must also be provided to an EJB client.
Client implementationThe EJB client may be implemented to utilize any interfaces as appropriate.
Client code compilationThe EJB client code should be compiled.
Configure application client deployment descriptors (optional)Any standard J2EE application client deployment descriptor should be configured to define the specific configuration properties of your EJB client.
Package client into application client JAR (optional)The standard J2EE application client deployment descriptor and compiled EJB client class files should be packaged into a J2EE application client JAR.
Launch the J2EE application client (optional)The J2EE application client may be launched within a special J2EE application client container environment.