HOME

TheInfoList



OR:

Business delegate is a
Java EE Jakarta EE, formerly Java Platform, Enterprise Edition (Java EE) and Java 2 Platform, Enterprise Edition (J2EE), is a set of specifications, extending Java SE with specifications for enterprise features such as distributed computing and web serv ...
design pattern. This pattern is directed towards reducing the
coupling A coupling is a device used to connect two shafts together at their ends for the purpose of transmitting power. The primary purpose of couplings is to join two pieces of rotating equipment while permitting some degree of misalignment or end mo ...
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.


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 structures, 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 maintainability 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 concerns can be considered: * Maintenance due to 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 facade pattern, is provided below. Resource Delegate: public class ResourceDelegate


See also

*
service locator pattern The service locator pattern is a design pattern used in software development to encapsulate the processes involved in obtaining a service with a strong abstraction layer. This pattern uses a central registry known as the "service locator", which ...
* Proxy pattern *
Adapter pattern In software engineering, the adapter pattern is a software design pattern (also known as wrapper, an alternative naming shared with the decorator pattern) that allows the interface of an existing class to be used as another interface. It is oft ...
* Broker Pattern


References

{{Design Patterns Patterns Software design patterns Articles with example Java code