Solved

what design pattern is this?

Posted on 2006-11-25
7
228 Views
Last Modified: 2013-11-24
hi experts,

From a java class(Action class) we are accessing the business delegate. The code is written in such a way that we are able to access/use  only the Business Delegate interfaces and the actual Business Delegate implimentation is hidden behind the Business Delegate interfaces. The main objective of the Business Delegate implimentation is to get a remote object(EJB object).

What Design pattern does the above statement represent?


thanks
J
0
Comment
Question by:jaggernat
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2
  • 2
  • +1
7 Comments
 
LVL 10

Expert Comment

by:ADSLMark
ID: 18012011
Façade Pattern i think?

http://en.wikipedia.org/wiki/Fa%C3%A7ade_pattern

Mark
0
 
LVL 23

Expert Comment

by:Ajay-Singh
ID: 18012025
Adapter pattern
0
 
LVL 10

Assisted Solution

by:ADSLMark
ADSLMark earned 100 total points
ID: 18012079
My link is a bit weird, dont know why anyway let me try again:

http://en.wikipedia.org/wiki/Façade_pattern

So the question becomes, what's the difference.. look here:

Question: So the way to tell the difference between the Adapter pattern and the Facade pattern is that the Adapter wraps one class and the Facade may represent many classes?
Answer: No! Remember, the Adapter pattern changes the interface of one or more classes into one interface that a client is expecting. While most textbook examples show the adapter adapting one class, you may need to adapt many classes to provide the interface a client is coded to. Likewise, a Facade may provide a simplified interface to a single class with a very complex interface. The difference between the two is not in terms of how many classes they "wrap", it is in their intent. [Head First Design Patterns, p260]

(source: http://home.earthlink.net/~huston2/dp/facade.html)

Mark
0
PeopleSoft Has Never Been Easier

PeopleSoft Adoption Made Smooth & Simple!

On-The-Job Training Is made Intuitive & Easy With WalkMe's On-Screen Guidance Tool.  Claim Your Free WalkMe Account Now

 
LVL 10

Author Comment

by:jaggernat
ID: 18012108
This is my actual scenario in j2ee project:

I have a scenario where I have this code in Action class
_____________________
OrderInfoDelegate orderInfoDelegate = (OrderInfoDelegate) DelegateFactory .getInstance().getDelegate("OrderInfo");
____________________

Where “OrderInfoDelegate”  is an interface which has this method
public interface OrderInfoDelegate
{
     public ControllingOrderVO saveOrderInfo(ControllingOrderVO conVO);

}
_________________________
And the actual implementation is in another class called LocalDelegateOrderInfo which goes like :

public class LocalDelegateOrderInfo extends BaseDelegate implements OrderInfoDelegate
{

private OrderInfoLocal local;
private OrderInfoLocalHome home;

public LocalDelegateOrderInfo(String jndiServiceHomeName) {
          try {
               home =
                    (OrderInfoLocalHome) ServiceLocator.getInstance().getLocalHome(
                         jndiServiceHomeName);
               local = home.create();
          } catch (ServiceLocatorException ex) {
               ex.printStackTrace();
          } catch (CreateException ex) {
               ex.printStackTrace();
          }
     }    

     public ControllingOrderVO saveOrderInfo(ControllingOrderVO conVO) {

          //ControllingOrderVO coVO = null;
               try {
                    conVO = (ControllingOrderVO) local.saveOrderInfo(conVO);
               } catch (EJBException ejbExp) {
                    throw logExceptionFromEJB(ejbExp, FFMLoggingLevels.DEBUG);
               }
               return conVO;
          }



}
_______________________

so when i am transitioning from action class to delegate , i am just calling the Delegate interface in my Action class.
So is it Adapter pattern or Facade?
0
 
LVL 23

Assisted Solution

by:Ajay-Singh
Ajay-Singh earned 100 total points
ID: 18012112
Façade simplifies the ways entities communicate, whereas Adapter may NOT. Adapter allows two or more previously incompatible objects to interact.
0
 
LVL 10

Author Comment

by:jaggernat
ID: 18015007
>>>Adapter allows two or more previously incompatible objects to interact.


in my case the two objects are compatible.
0
 
LVL 8

Accepted Solution

by:
reach2piyush earned 280 total points
ID: 18016967
Perfect fit - J2EE Business Delegate pattern

Close - Proxy Pattern

Business Delgates can be used as Adapters when the Business Services that it invokes is not a part of the same system.
But in this case the Business Delegate is acting more as a remote proxy for the Session Beans

0

Featured Post

What Is Transaction Monitoring and who needs it?

Synthetic Transaction Monitoring that you need for the day to day, which ensures your business website keeps running optimally, and that there is no downtime to impact your customer experience.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This was posted to the Netbeans forum a Feb, 2010 and I also sent it to Verisign. Who didn't help much in my struggles to get my application signed. ------------------------- Start The idea here is to target your cell phones with the correct…
Are you developing a Java application and want to create Excel Spreadsheets? You have come to the right place, this article will describe how you can create Excel Spreadsheets from a Java Application. For the purposes of this article, I will be u…
This tutorial covers a step-by-step guide to install VisualVM launcher in eclipse.
This theoretical tutorial explains exceptions, reasons for exceptions, different categories of exception and exception hierarchy.

724 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question