|
2 | 2 |
|
3 | 3 | /** |
4 | 4 | * |
5 | | - * The Business Delegate pattern adds an abstraction layer between the presentation and business tiers. |
6 | | - * By using the pattern we gain loose coupling between the tiers. The Business Delegate encapsulates |
7 | | - * knowledge about how to locate, connect to, and interact with the business objects that make up |
8 | | - * the application. |
| 5 | + * The Business Delegate pattern adds an abstraction layer between the presentation and business |
| 6 | + * tiers. By using the pattern we gain loose coupling between the tiers. The Business Delegate |
| 7 | + * encapsulates knowledge about how to locate, connect to, and interact with the business objects |
| 8 | + * that make up the application. |
9 | 9 | * <p> |
10 | | - * Some of the services the Business Delegate uses are instantiated directly, and some can be retrieved |
11 | | - * through service lookups. The Business Delegate itself may contain business logic too potentially tying |
12 | | - * together multiple service calls, exception handling, retrying etc. |
| 10 | + * Some of the services the Business Delegate uses are instantiated directly, and some can be |
| 11 | + * retrieved through service lookups. The Business Delegate itself may contain business logic too |
| 12 | + * potentially tying together multiple service calls, exception handling, retrying etc. |
13 | 13 | * <p> |
14 | | - * In this example the client ({@link Client}) utilizes a business delegate ({@link BusinessDelegate}) to execute a task. |
15 | | - * The Business Delegate then selects the appropriate service and makes the service call. |
| 14 | + * In this example the client ({@link Client}) utilizes a business delegate ( |
| 15 | + * {@link BusinessDelegate}) to execute a task. The Business Delegate then selects the appropriate |
| 16 | + * service and makes the service call. |
16 | 17 | * |
17 | 18 | */ |
18 | 19 | public class App { |
19 | | - |
20 | | - /** |
21 | | - * Program entry point |
22 | | - * @param args command line args |
23 | | - */ |
24 | | - public static void main(String[] args) { |
25 | | - |
26 | | - BusinessDelegate businessDelegate = new BusinessDelegate(); |
27 | | - businessDelegate.setServiceType(ServiceType.EJB); |
28 | 20 |
|
29 | | - Client client = new Client(businessDelegate); |
30 | | - client.doTask(); |
| 21 | + /** |
| 22 | + * Program entry point |
| 23 | + * |
| 24 | + * @param args command line args |
| 25 | + */ |
| 26 | + public static void main(String[] args) { |
31 | 27 |
|
32 | | - businessDelegate.setServiceType(ServiceType.JMS); |
33 | | - client.doTask(); |
34 | | - } |
| 28 | + BusinessDelegate businessDelegate = new BusinessDelegate(); |
| 29 | + businessDelegate.setServiceType(ServiceType.EJB); |
| 30 | + |
| 31 | + Client client = new Client(businessDelegate); |
| 32 | + client.doTask(); |
| 33 | + |
| 34 | + businessDelegate.setServiceType(ServiceType.JMS); |
| 35 | + client.doTask(); |
| 36 | + } |
35 | 37 | } |