Java Mailing List Archive

http://www.junlu.com/

Google
Google
Mailing List
Home
Forum Home
JBoss - Java Application Server
Tomcat - JSP/Servlet container
Struts - A MVC web framework
iText - An open source PDF Java Library
JDOM - JDOM XML Parser
J2EE - A mailing list for Java(tm) 2 Platform, Enterprise Edition
JSP - A mailing list about Java Server Pages specification and reference
J2EE Pattern - An interest list for Sun Java Center J2EE Pattern Catalog
Servlet - A mailing list for discussion about Sun Microsystem's Java Servlet API Technology
Struts & Hibernate
Subjects
JSP editor plugin for eclipse ?
org apache jasper JasperException: Unable to compile class for JSP
Tomcat: Connection reset by peer: socket write error
Cannot retrieve definition for form bean null
Struts Tiles Tutorial (free Struts training)
Where do I download Tomcat 4 0 6?
Data Access Object (DAO) pattern, example DAO 's
Where to download Tomcat v 4 1 24 from?
Tomcat 5 0 16 Requested resource not available
Oracle Connection Pooling in 3 2 2
Servlet : Session invalidate
Servlet action is currently unavailable
Tomcat/Struts Unicode Encoding/Decoding problems
Tomcat and webapplication specific java library path
Running a Simple JMS Example
Mapping in workers2 properties
org apache jasper JasperException
Cannot find message resources under key org apache struts action
   MESSAGE
problem with html:text bean throwing exception
Cannot find message resources under key org apache struts action MESSAGE
invalid direct reference problem with solution
Tool for jsp debug Try Sysdeo Eclipse Plugin
Tomcat 5 Cannot load JDBC driver class 'null ' SQL state: null
weblogic ejbc
java properties file
Jboss 3 2 3 Coyote Can 't re
Tomcat 5, Apache2 and mod jk2 integration problem
JBoss example problem new to J2EE
url string for connecting jboss to oracle
Value attribute of <html:checkbox
javax servlet ServletException: BeanUtils populate
HTTP Status 404 The requested resource is not available
5 0 18: Windows XP Pro vs Windows 2000
 
Business Delegate

Business Delegate

2004-04-16       - By George Maggessy

 Back
Reply:     1     2     3     4     5     6     7     8     9     10     >>  

I think this sample could clear things out...

public class MasterDelegateHandler
  extends DelegateHandler {

  private static MasterDelegateHandler instance = null;
  private static MasterSessionHome home;

  /**
   * Constructor
   */
  private MasterDelegateHandler() throws LookupException {

     Reloj cron = new Reloj();
     cron.start();

     home =
(MasterSessionHome)ServiceLocator.getHomeSession(
        GeneralConstants.JNDI_MAESTRAS_SESSION);

     LogUtility.log(MasterDelegateHandler.class,
                    "Tiempo lookup MasterSession " +

Reloj.formatTime(cron.getElapsedTime()),
                    Log4JConstants.DEBUG);
  }

  public static synchronized MasterDelegateHandler
getInstance() {

     if (home == null) {
        try {
           instance = new MasterDelegateHandler();
        } catch (LookupException ex) {
           ex.printStackTrace();
        }
     }
     return instance;
  }

  private MasterSession getEJB() {

     MasterSession remote = null;
     try {
        remote = (MasterSession)home.create();
     } catch (RemoteException ex) {
        ex.printStackTrace();
     } catch (CreateException ex) {
        ex.printStackTrace();
     }
     return remote;
  }

  public ResponseVO getAllIra() {
     ResponseVO response = new ResponseVO(null);
     try {
        response = getEJB().getAllIra();
     } catch (Exception ex) {
        LogUtility.log(MasterDelegateHandler.class,
                       ex.getMessage(),
                       Log4JConstants.FATAL);
        return new ResponseVO(null,
                              new
MessageVO(MessageVO.ERROR,

PropertyManager.getInstance().
                                            getProperty(
           GeneralConstants.FILE_MESSAGES,
ErrorCode.COMUN_ERROR_GENERAL)));
     }
     return response;
  }

...

Did I help u?


--- Ricardo de Souza Moura <ricsouzamoura@(protected)>
wrote:
> I would like very much. thank you.
>
> But I was thinking about construct my Business
> Delegate(BD) not like a EJB.
> The BD would be a normal class. therefore my web tier
> don't need to worry
> about look up or RemoteException for example. Only my Bd
> would need to worry
> about this. is it OK ? Do you agree ?
>
> About to do cache I have some doubts.
> My ServletContainer an my EJBContainer are in two
> differents machines. If
> only the EJBContainer stop what happen with my cache at
> the ServletConainer
> ? it won't work anymore, will it ?
>
>
> >From: George Maggessy <gmaggess@(protected)>
> >Reply-To: gjr@(protected)
> >To: J2EEPATTERNS-INTEREST@(protected)
> >Subject: Re: Business Delegate
> >Date: Fri, 16 Apr 2004 12:20:35 -0700
> >
> >Hi Ricardo,
> >
> >Yes. This is a good structure. In fact, I use this
> patterns
> >and my app works fine. The only thing you have to worry
> >about is the business delegate or delegate handler.
> There
> >are diferent types for diferent session beans.  Like...
> >Cache the EJB Handle for stateful beans or cache the
> >EJBHome for stateless beans... I could send u a sample
> if u
> >want.
> >
> >Cheers,
> >George Maggessy
> >
> >
> >--- Ricardo de Souza Moura <ricsouzamoura@(protected)>
> >wrote:
> > > Hi folks,
> > > I have a doubt.
> > >
> > > I am projecting my application with the structure
> below:
> > >
> > > web tier => business Delegate(BD) =>
> ServiceLocator(SL)
> > > => Session
> > > Facade(SF) => EJBs
> > >
> > > The web tier use the BD to call business methos.
> > > The BD use the SL to get a SF
> > > The BD use the SF to call business methods
> > > SF is a Session Bean and use Entity Beans and others
> > > Session Beans to do its
> > > work.
> > >
> > > Is this strutcture a good practice ?
> > >
> > > Does Somebody have another suggestion ?
> > >
> > > Thanks
> > >
> > >
>
>__ ____ ____ ____ ____ ____ ____ ____ ____ ____ ____ ____ ____ __
> > > MSN Hotmail, o maior webmail do Brasil.
> > > http://www.hotmail.com
> > >
> > >
>
>====================================================================
> > > Companion Site: http://www.corej2eepatterns.com
> > > J2EE BluePrints:
> > > http://java.sun.com/blueprints/corej2eepatterns
> > > List Archive:
> > >
>
>http://archives.java.sun.com/archives/j2eepatterns-interest.html
> > > Unsubscribing: email "signoff J2EEPATTERNS-INTEREST"
> to
> >listserv@(protected)
> >
> >
> >
> >
> >
> >__ ____ ____ ____ ____ ____ ______
> >Do you Yahoo!?
> >Yahoo! Tax Center - File online by April 15th
> >http://taxes.yahoo.com/filing.html
> >
>
>====================================================================
> >Companion Site: http://www.corej2eepatterns.com
> >J2EE BluePrints:
> http://java.sun.com/blueprints/corej2eepatterns
> >List Archive:
>
>http://archives.java.sun.com/archives/j2eepatterns-interest.html
> >Unsubscribing: email "signoff J2EEPATTERNS-INTEREST" to
> >listserv@(protected)
>
>
__ ____ ____ ____ ____ ____ ____ ____ ____ ____ ____ ____ ____ __
> MSN Messenger: converse com os seus amigos online.
> http://messenger.msn.com.br
>
>
====================================================================
> Companion Site: http://www.corej2eepatterns.com
> J2EE BluePrints:
> http://java.sun.com/blueprints/corej2eepatterns
> List Archive:
>
http://archives.java.sun.com/archives/j2eepatterns-interest.html
> Unsubscribing: email "signoff J2EEPATTERNS-INTEREST" to
listserv@(protected)





__ ____ ____ ____ ____ ____ ______
Do you Yahoo!?
Yahoo! Tax Center - File online by April 15th
http://taxes.yahoo.com/filing.html

====================================================================
Companion Site: http://www.corej2eepatterns.com
J2EE BluePrints: http://java.sun.com/blueprints/corej2eepatterns
List Archive: http://archives.java.sun.com/archives/j2eepatterns-interest.html
Unsubscribing: email "signoff J2EEPATTERNS-INTEREST" to listserv@(protected)

©2008 junlu.com - Jax Systems, LLC, U.S.A.