Supriya Ghosh (Editor)

Business delegate pattern

Updated on
Edit
Like
Comment
Share on FacebookTweet on TwitterShare on LinkedInShare on Reddit

Business delegate is a Java EE design pattern. This pattern is directing to reduce the coupling in between business services and the connected presentation-tier, and to hide the implementation details of services (including lookup and accessibility of EJB architecture. Business delegates acts as an adaptor to invoke business objects from the presentation tier.

Contents

Structure

Requests to access underlying business services are sent from clients, and lookup services are used by business delegates to locate the business service components.

Components

Basic components are Business delegate, Lookup service and business service.

Business delegate

Control and protection are provided through business delegate which can have two types of constructures, without ID and with ID, where ID is a string version of the reference to a remote object such as EJBHome or EJBObject.

Lookup Service

Business service is located by lookup service which is used by the business delegate. the implementation details of business service lookup is encapsulated by lookup service.

Business Service

This a business-tier component, such as an enterprise bean or a JMS component, which provides the required service to the client.

Consequences

Some consequences are as follows:

  • More flexibility and maintanability as intermediate business delegate layer decouples the business layer from the presentation layer.
  • Business delegate exposes a uniform API to the presentation tier to access business logic.
  • Concerns

    Following concers can be considered:

  • Maintenance due the extra layer that increases the number of classes in the application.
  • Business delegate should take care of the changes of the remote business object interfaces, and these types of changes are rare.
  • Sample code

    A sample code for a Professional Services Application (PSA), where a Web-tier client needs to access a session bean that implements the session façade pattern, is provided below.

    Resource Delegate:

    Remote interface for ResouceSession:

    References

    Business delegate pattern Wikipedia


    Similar Topics