©


Core J2EE Pattern Catalog

© CoreJ2EEPatterns
All Rights Reserved.

Last Updated:
January 29, 2006 8:54 PM

 

In Association with Amazon.com


Transfer Object Assembler

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

Problem

You want to obtain an application model that aggregates transfer objects from several business components.

Forces

  • You want to encapsulate business logic in a centralized manner and prevent implementing it in the client.
  • You want to minimize the network calls to remote objects when building a data representation of the business-tier object model.
  • You want to create a complex model to hand over to the client for presentation purposes.
  • You want the clients to be independent of the complexity of model implementation, and you want to reduce coupling between the client and the business components.

Solution

Use a Transfer Object Assembler to build an application model as a composite Transfer Object. The Transfer Object Assembler aggregates multiple Transfer Objects from various business components and services, and returns it to the client.

Class Diagram

Sequence Diagram

Strategies

  • POJO Transfer Object Assembler Strategy
  • Session Bean Transfer Object Assembler Strategy

Consequences

  • Separates business logic, simplifies client logic
  • Reduces coupling between clients and the application model
  • Improves network performance
  • Improves client performance
  • Can introduce stale data

Related Patterns

  • Transfer Object
    The Transfer Object Assembler uses Transfer Objects to create and transport data to the client. The created Transfer Objects carry the data representing the application model from the business tier to the clients requesting the data.
  • Business Object
    The Transfer Object Assembler uses the required Business Objects to obtain data to build the required application model.
  • Composite Entity
    Composite Entity produces composite transfer objects from its own data. On the other hand, Transfer Object Assembler constructs the application model by obtaining data from different sources, such as Session Façades, Business Objects, Application Services, Data Access Objects, and other services.
  • Session Façade
    When Transfer Object Assembler is implemented as a session bean, you could view it as a limited special application of the Session Façade. If the client needs to update the business components that supply the application model data, it accesses a Session Façade (session bean) that provides that update service.
  • Data Access Object
    A Transfer Object Assembler can obtain certain data directly from the data store using a Data Access Object.
  • Service Locator
    The Transfer Object Assembler uses a Service Locator to locate and use various business components.
Contact Us © CoreJ2EEPatterns.com. All Rights Reserved. Terms of use