-
1. Re: -----> SESSION FACADE v/s BUSINESS DELEGATE <-----
mefesto78 Nov 8, 2002 2:52 PM (in response to aswin_n)From what I understand they are quite similar. Usually a BusinessDelegate will wrap a session facade, and if any exceptions are thrown by the session facade (RemoteException or whatever), the businessdelegate will catch them and throw application specific exceptions.
This will keep the presentation tier completely seperate from the backend tier.
[Example]
MySessionFacade has methods:
public User locateUser(Integer uid) throws RemoteException, NoSuchUserException
MyBusinessDelegate wraps all the facades methods like this:
public User locateUser(Integer uid) throws NoSuchUserException, MyLowLevelAppException {
MySessionFacade sessFacade = null;
try{
... get initialcontext and obtain facadehome ref ...
sessFacade = home.create();
return sessFacade.locateUser(uid);
}catch(NamingException e){
throw new MyLowLevelAppException(e);
}catch(CreateException e){
throw new MyLowLevelAppException(e);
}catch(RemoteException e){
throw new MyLowLevelAppException(e);
}finally{
try{ if(sessFacade != null) sessFacade.remove(); }
catch(Exception e){}
}
}
If you plan on implementing the SessionFacade, its usually a good thing to wrap it in a Proxy or BusinessDelegate to keep the two tiers independent.
Hopes this helps. -
2. Re: -----> SESSION FACADE v/s BUSINESS DELEGATE <-----
aswin_n Nov 12, 2002 6:19 AM (in response to aswin_n)Thanks for your input. That is along the lines of what I had in mind.
Aswin