I have checked in the ModelLifetime object and associated changes.  I
left it with a single method, discard().  Since the Controller objects
are the ones that generate the model (returning "this" is just one
possibility), it's not really possible for the framework to know when
the model is "set up".
 
Let us know if you have any problems with it.
 
Maxis is pretty neat.  It's way more fun than the Yet Another Business
Application companies I have worked for in the past, but I get the
feeling that it's been "corporatized" quite a bit in the last few years.
Oh well :-)  Hey, whatever happened to Berkeley Systems?
 
Jeff Schnitzer
[EMAIL PROTECTED] <mailto:[EMAIL PROTECTED]> 

        -----Original Message----- 
        From: Dan Finkelstein 
        Sent: Mon 3/18/2002 10:27 AM 
        To: [EMAIL PROTECTED] 
        Cc: 
        Subject: RE: [Mav-user] 2.0rc works fine and a "preDiscard"
question
        
        

        Right, I think that's the right approach.  You know, the
creation of the
        connection to the database can be handled through the current
architecture
        using the controller's constructor.  But to keep things
symmetric, maybe
        ModelLifetime could expose two methods: something like setup()
and
        teardown().  This notification on initialization and
finalization would
        make clear the tasks.  Thanks for your attention to this,
        
        Best,
        Dan
        
        PS.  Have fun at Maxis.  I worked for a few years at Berkeley
Systems,
        which was a blast.  :-)
        
        At 09:41 AM 3/17/02 -0800, Jeff Schnitzer wrote:
        >Ah, I see.  Something like this interface that a model can
optionally
        >implement:
        >
        >public interface ModelLifetime
        >{
        >         public void discard();
        >}
        >
        >I have no objection to adding it, although be aware that this
is
        >probably an anti-pattern... usually you want to have all your
data
        >access completed by the time perform() returns.
        >
        >Since the RC seems to be solid, we want to build the final
release of
        >Maverick 2.0 RSN, probably tomorrow.  I'll probably slip this
change in
        >anyways since it doesn't require any refactoring.
        >
        >Sound good?
        >
        >BTW, if I'm slow to respond to mail, it's because I just
started a short
        >contract at Maxis doing WebLogic development and they're
keeping me
        >occupied.  That, and I'm still couch-surfing, so I'm either
busy or
        >don't have a stable net connection available :-)
        >
        >Jeff Schnitzer
        >[EMAIL PROTECTED]
        >
        > > -----Original Message-----
        > > From: Dan Finkelstein [ mailto:[EMAIL PROTECTED]]
        > > Sent: Saturday, March 16, 2002 8:26 PM
        > > To: [EMAIL PROTECTED]
        > > Subject: RE: [Mav-user] 2.0rc works fine and a "preDiscard"
question
        > >
        > > Hi Jeff,
        > >
        > > Let me try to explain.  In my controller (which is _not_
        > > ControllerSingleton), I have a perform() method which opens
a database
        > > connection.  This controller might be used by a number of
templates
        >and
        > > have methods which might be used by some and not others,
methods like
        > > getPerformers(), getServices(), etc.  Each of these methods
uses the
        >open
        > > database connection.  I'm using JDO and like other systems,
it wants
        >me to
        > > close my database connection.
        > >
        > > So, as I understand it, the flow is something like this:
        > >          1.  Mav calls perform()...and within it, I open the
database
        > > connection
        > >          2.  Mav processes my velocity templates, which call
methods
        >in my
        > > controller, using $model.performers
        > >          3.  Mav deletes the controller object
        > >
        > > What I would like is notification between steps 2 and 3 of
the pending
        > > deletion so I can close the database connection.  Does this
make more
        > > sense?
        > >
        > > Thanks,
        > > Dan
        > >
        > > At 07:13 AM 3/13/02 -0800, Jeff Schnitzer wrote:
        > > >I'm not quite sure what you mean.  Why not just at the end
of your
        > > >perform() method?  Or are you using a ControllerSingleton,
and you
        >want
        > > >to be notified when a new configuration is loaded and the
old is
        >being
        > > >discarded?
        > > >
        > > >Jeff Schnitzer
        > > >[EMAIL PROTECTED]
        > > >
        > > > > -----Original Message-----
        > > > > From: Dan Finkelstein [ mailto:[EMAIL PROTECTED]]
        > > > > Sent: Thursday, March 14, 2002 9:35 PM
        > > > > To: [EMAIL PROTECTED]
        > > > > Subject: [Mav-user] 2.0rc works fine and a "preDiscard"
question
        > > > >
        > > > > Just a little feedback... I'm now on 2.0rc and am not
having any
        > > > > problems.... Great work!!
        > > > >
        > > > > One question though:  In my controller objects, I would
like to be
        > > > > notified
        > > > > when an instance is about to be deleted.  I'd like to
use this
        > > >opportunity
        > > > > to "clean-up", in this case closing a database
connection.
        > > > >
        > > > > Can you suggest a way to do this? I would like something
more
        >reliable
        > > > > than
        > > > > Java's finalize() method.  Or can an overidable method
be easily
        >added
        > > >at
        > > > > this point in the release cycle?
        > > > >
        > > > > Thanks,
        > > > > Dan
        > > > >
        > > > >
        > > > > _______________________________________________
        > > > > Mav-user mailing list
        > > > > [EMAIL PROTECTED]
        > > > > https://lists.sourceforge.net/lists/listinfo/mav-user
        > > >
        > > >_______________________________________________
        > > >Mav-user mailing list
        > > >[EMAIL PROTECTED]
        > > > https://lists.sourceforge.net/lists/listinfo/mav-user
        > >
        > >
        > > _______________________________________________
        > > Mav-user mailing list
        > > [EMAIL PROTECTED]
        > > https://lists.sourceforge.net/lists/listinfo/mav-user
        >
        >_______________________________________________
        >Mav-user mailing list
        >[EMAIL PROTECTED]
        > https://lists.sourceforge.net/lists/listinfo/mav-user
        
        
        _______________________________________________
        Mav-user mailing list
        [EMAIL PROTECTED]
        https://lists.sourceforge.net/lists/listinfo/mav-user
        

<<winmail.dat>>

Reply via email to