#89 Added comments to the example code

This commit is contained in:
Ilkka Seppala
2015-07-23 00:01:39 +03:00
parent 61573e9ef2
commit 642cf925c6
8 changed files with 50 additions and 0 deletions

View File

@ -1,5 +1,20 @@
package com.iluwatar;
/**
*
* The Business Delegate pattern adds an abstraction layer between presentation and business tiers.
* By using the pattern we gain loose coupling between the tiers. The Business Delegate encapsulates
* knowledge about how to locate, connect to, and interact with the business objects that make up
* the application.
*
* Some of the services the Business Delegate uses are instantiated directly, and some can be retrieved
* through service lookups. The Business Delegate itself may contain business logic too potentially tying
* together multiple service calls, exception handling, retrying etc.
*
* In this example the client (Client) utilizes a business delegate (BusinessDelegate) to execute a task.
* The Business Delegate then selects the appropriate service and makes the service call.
*
*/
public class App {
public static void main(String[] args) {

View File

@ -1,5 +1,10 @@
package com.iluwatar;
/**
*
* BusinessDelegate separates presentation and business tiers
*
*/
public class BusinessDelegate {
private BusinessLookup lookupService = new BusinessLookup();

View File

@ -1,5 +1,10 @@
package com.iluwatar;
/**
*
* Class for performing service lookups
*
*/
public class BusinessLookup {
public BusinessService getBusinessService(ServiceType serviceType) {

View File

@ -1,5 +1,10 @@
package com.iluwatar;
/**
*
* Interface for service implementations
*
*/
public interface BusinessService {
void doProcessing();

View File

@ -1,5 +1,10 @@
package com.iluwatar;
/**
*
* Client utilizes BusinessDelegate to call the business tier
*
*/
public class Client {
private BusinessDelegate businessDelegate;

View File

@ -1,5 +1,10 @@
package com.iluwatar;
/**
*
* Service EJB implementation
*
*/
public class EjbService implements BusinessService {
@Override

View File

@ -1,5 +1,10 @@
package com.iluwatar;
/**
*
* Service JMS implementation
*
*/
public class JmsService implements BusinessService {
@Override

View File

@ -1,5 +1,10 @@
package com.iluwatar;
/**
*
* Enumeration for service types
*
*/
public enum ServiceType {
EJB, JMS;