| To: | users@xxxxxxxxxx |
|---|---|
| Subject: | Re: [cinjug-users] Looking for AOP framework |
| From: | Matt Avery <mavery@xxxxxxxxxxxxxxx> |
| Date: | Tue, 11 May 2004 10:35:51 -0400 |
| Delivered-to: | mailing list users@cinjug.org |
| In-reply-to: | <20040511140825.81151.qmail@web42001.mail.yahoo.com> |
| Mailing-list: | contact users-help@cinjug.org; run by ezmlm |
| References: | <20040511140825.81151.qmail@web42001.mail.yahoo.com> |
| User-agent: | Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.6) Gecko/20040113 |
Chris, I'm not using AspectJ yet, but I'm considering using it for the project I'm working on. I'm doing exactly the same thing you described with Hibernate only I'm using OJB. The version of OJB I'm using has a bug in it, so I wrote an object to work around the bug called "BrokerSupport" (think PropertyChangeSupport). Every object that needs to access the database has this code in it: protected BrokerSupport fieldBrokerSupport;
protected PersistenceBroker getBroker()
{
return getBrokerSupport().getBroker();
}
protected BrokerSupport getBrokerSupport()
{
if (fieldBrokerSupport == null)
{
fieldBrokerSupport = new BrokerSupport( );
}
return fieldBrokerSupport;
} protected void closeBroker()
{
getBrokerSupport().closeBroker();
}Since the business objects extend different superclasses, I can't move this code to a single abstract superclass. So much for "once and only once". I was thinking of making a "BrokerSupportAspect" that would intercept the getBroker() and closeBroker() methods in those objects. My question is, what is the best practice for using aspects in a situation like this? Do I just add a blank implementation of getBroker() and closeBroker() to each class and then use the aspect to fill in the guts at runtime, or is there some other technique I should use? Thanks, Chris Nelson wrote: Mike,
|
| <Prev in Thread] | Current Thread | [Next in Thread> |
|---|---|---|
| ||
| Previous by Date: | Re: [cinjug-users] Looking for AOP framework, Chris Nelson |
|---|---|
| Next by Date: | Re: [cinjug-users] Looking for AOP framework, Eric Galluzzo |
| Previous by Thread: | Re: [cinjug-users] Looking for AOP framework, Chris Nelson |
| Next by Thread: | Re: [cinjug-users] Looking for AOP framework, Chris Nelson |
| Indexes: | [Date] [Thread] [Top] [All Lists] |