©


Core J2EE Pattern Catalog

© CoreJ2EEPatterns
All Rights Reserved.

Last Updated:
January 29, 2006 8:54 PM

 

In Association with Amazon.com


Session Façade

See Core J2EE Patterns, 2nd Edition for full description of this pattern and its strategies.

Problem

You want to expose business components and services to remote clients.

Forces

  • You want to avoid giving clients direct access to business-tier components, to prevent tight coupling with the clients.
  • You want to provide a remote access layer to your Business Objects (374) and other business-tier components.
  • You want to aggregate and expose your Application Services (357) and other services to remote clients.
  • You want to centralize and aggregate all business logic that needs to be exposed to remote clients.
  • You want to hide the complex interactions and interdependencies between business components and services to improve manageability, centralize logic, increase flexibility, and improve ability to cope with changes.

Solution

Use a Session Façade to encapsulate business-tier components and expose a coarse-grained service to remote clients. Clients access a Session Façade instead of accessing business components directly.

Class Diagram

Sequence Diagram

Strategies

  • Stateless Session Façade Strategy
  • Stateful Session Façade Strategy

Consequences

  • Introduces a layer that provides services to remote clients
  • Exposes a uniform coarse-grained interface
  • Reduces coupling between the tiers
  • Promotes layering, increases flexibility and maintainability
  • Reduces complexity
  • Improves performance, reduces fine-grained remote methods
  • Centralizes security management
  • Centralizes transaction control
  • Exposes fewer remote interfaces to clients

Related Patterns

  • Business Delegate
    The Business Delegate is the client-side abstraction for a Session Façade. The Business Delegate proxies or adapts the client request to a Session Façade that provides the requested service.
  • Business Object
    The Session Façade encapsulates complex interactions of Business Objects that participate in processing a use case request.
  • Application Service
    In some applications, Application Services are used to encapsulate complex business logic and business rules. In these applications, the Session Façade implementations become simpler because they mostly delegate to Application Services and Business Objects.
  • Data Access Object
    The Session Façade might sometimes access a Data Access Object directly to obtain and store data. This is typical in simpler applications that do not use Business Objects. The Session Façades encapsulate trivial business logic and use Data Access Objects to facilitate persistence.
  • Service Locator
    The Session Façade can use a Service Locator to look up other business components, such as entity beans and session beans. This reduces the code complexity in the facade and leverages the benefits of the Service Locator pattern.
  • Broker [POSA1]
    The Session Façade performs the role of a Broker to decouple the Business Objects (374) and fine-grained services from their client tier.
  • Facade [GoF]
    The Session Façade is based on the Facade design pattern.
Contact Us © CoreJ2EEPatterns.com. All Rights Reserved. Terms of use