Description
Currently, all of the backend impl modes (Direct, EJB and the new SLSB to JDBC) are packaged together inside the ejb.jar. To provide greater flexibility and the ability to support additional back impls, I think we need to re-org the code within Daytrader. I've been brainstorming and have come up with the following...
Create interfaces for the DaytraderServices and each of the access beans (ie. QuoteDataBean, OrderDataBean, etc.)
util.jar (contains the following...)
- Interfaces for access beans - defines interfaces with getters and setters
- DaytraderServices (interface) - defines the high level transactions similar to TradeServices
- Operation return types are based on access bean interfaces (not impls)
- Any other commonly used routines
For the EE4 component impls...
jdbc-impl.jar (depends on util.jar)
- Contains DaytraderJdbcServices class that implements DaytraderServices interface
- Also contains impls for access beans that will be used for all EE4 components
ejb2.1-impl.jar (depends on util.jar and jdbc-impl.jar)
- Contains 2 impls for EJB modes (Session2Jdbc and Session2Entity)
- DaytraderSession2JdbcServices class provides SLSB that wrappers DaytraderJdbcServices
- DaytraderSession2EntityServices class provides SLSB to Enity bean impl
- Both impls depend on access beans defined in jdbc-impl.jar
For the EE5/JPA components
- Define new access beans for EE5 impls based on interfaces
- Also create new impls for DaytraderServices interface
Provide DaytraderServicesFactory class which can...
- Detect which impls a present during initialization using Class.forName()
- Create instances of the desired services given a string parameter (assuming the service available)
- Can either be packaged in the war or another utility jar
- CANNOT go in util.jar to avoid circular dependency
Key points:
- New backend impls are isolated to their own jars
- Backend impl jars can be removed for AppServers lacking support
- Operation return types are based on interfaces (consequently EE4 and EE5 impls could co-exist)
- war servlets and JSPs only know about access bean interfaces
Any thoughts or comments?