How javieryeow/merlionhotelreservation works
Project type and purpose
• This is a multi-module Java EE hotel reservation system (“MerlionHotelReservation”) consisting of:
– An EJB application (“MerlionHotelReservation-ejb”) providing business logic and a JAX-WS endpoint.
– A shared library module with JPA entities and remote EJB interfaces.
– Several Java SE application-client modules that drive the system:
• HolidayReservationSystem (core reservation client)
• MerlionHotelManagementClient (back-office client)
• HolidayReservationSystemSeClient (SOAP client for the PartnerWebService)
• MerlionHotelReservationClient (generic Java client)
• The system’s goal is to manage customers, employees, reservations and rooms, expose functionality via EJB session beans and a web service, and allow multiple client UIs to interact.
File structure
– Top-level modules under NetBeansProjects/MerlionHotelReservation:
• MerlionHotelReservation-ejb: EJB3.1 session beans, persistence.xml, GlassFish resource setup
• MerlionHotelReservationLibrary: remote interfaces, entity classes, custom exceptions
• HolidayReservationSystem, MerlionHotelManagementClient, MerlionHotelReservationClient: Java SE application-clients with application-client.xml
• HolidayReservationSystemSeClient: JAX-WS client consuming PartnerWebService WSDL
– Build scripts (build.xml) and NetBeans project descriptors (nbproject) in each module
– EJB module exposes both stateless/session beans and a singleton bean; also publishes a JAX-WS web service (PartnerWebService).
README
– README is empty (“# orbital”)—no architecture details here. All insights come from the file tree.
Main components & their interactions
a. Component list
1) EJB Container (GlassFish) hosting:
• Session Beans (stateless & singleton) implementing business operations (CreateCustomer, RoomSessionBean, AllocatingRoomSessionBean, etc.)
• JAX-WS endpoint (PartnerWebService) wrapping selected session beans
• JPA Persistence layer (persistence.xml → database tables for Customer, Room, Reservation, etc.)
2) Shared Library Module (MERLION-Library) loaded by both EJB and clients – contains:
• Entity classes
• Remote and local EJB interfaces
• Exception definitions
3) Java SE Application-Clients:
• HolidayReservationSystem (invokes remote EJB interfaces over RMI)
• MerlionHotelManagementClient (similar EJB lookups for management tasks)
• MerlionHotelReservationClient (general client stub)
4) SOAP Client (HolidayReservationSystemSeClient) consuming the PartnerWebService WSDL exposed by the EJB module
5) External Database (e.g., MySQL/Derby) holding persistent state
6) (Optionally) External Partner Web Service endpoints if the system invokes outside services
b. Relationships & Data Flow
• Application-Client → EJB Container: remote JNDI lookups → Session Bean methods → JPA → DB
• SOAP Client → HTTP/SOAP → EJB’s PartnerWebService → delegates to Session Beans → JPA → DB
• EJB Container manages transactions, security, and resource pooling
Architectural patterns & principles
– Layered architecture: Presentation (clients) → Business (EJB session beans) → Persistence (JPA entities) → Data (DB)
– Service-oriented: JAX-WS web service for integration with partners
– Separation of concerns: Shared library defines contracts (interfaces/entities), EJB module implements them, clients consume them
– Enterprise design patterns:
• Session Façade (stateless beans group business calls)
• Singleton Session Bean for application-wide data caching (DataInSessionBean)
• Service Locator pattern in clients for JNDI lookups
Essential elements
• Clear labels on all components and interfaces
• Optional: list of major technologies near each component (EJB 3.1, JPA, JAX-WS, Java SE)