|
From: Ivan R. <iv...@we...> - 2003-10-09 23:25:30
|
Kopylenko, Dmitry wrote:
> Ivan,
>
> would it make sense to make SpringExecWrapper a bean, that is, expose its
> properties (i.e bean, event, methodName, args) so they could be configured
> through an application context and also make it implement
> ApplicationContextAware interface, so the ApplicationContext would be
> provided to it by the BeanFactory ?
Interesting idea. I always thought about creating a class such as
SpringAwareCronScheduler and then configuring it via parameters.
Your approach may be better, but I'd rather create a new class
for that then use the wrapper itself.
How would this class know which scheduler to use? Look it up by
name ('scheduler') or have a setter method accepting a scheduler
instance? I would go with the setter method: you first create your
beans, then the schedule, and then create as many tasks as needed.
Besides, it would also work with the auto-wire feature ;)
BTW, the biggest problem I had when I was trying to create an
interface for various scheduling implementations was the way
schedules are specified. At best we will have to accept that
a schedule is specified with a single string.
I could refactor RecurringSchedule to accept something like
this on input:
"rate=5000ms, repeatCount=10"
--
ModSecurity (http://www.modsecurity.org)
[ Open source IDS for Web applications ]
|