|
From: Ivan R. <iv...@we...> - 2003-10-10 21:34:42
|
> 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 ?
I've made some changes, introducing the SpringBeanTask class for use
in the configuration file. Here is how you would use it:
-------------
<!-- the bean to be called at a schedule -->
<bean id="job1" class="SomeJob"/>
<!-- the scheduler instance -->
<bean id="scheduler" class="com.webkreator.chronos.CronScheduler"
init-method="start" />
<!-- task #1, bean method call with arguments on the command line -->
<bean id="job1task1" class="com.webkreator.chronos.SpringBeanTask">
<property name="bean"><value>
job1.test "testing 123"
</value></property>
<property name="schedule"><value>*/1</value></property>
<property name="scheduler"><ref bean="scheduler"/></property>
</bean>
<!-- task #2, method call with multiple arguments -->
<bean id="job1task2" class="com.webkreator.chronos.SpringBeanTask">
<property name="bean"><value>job1.test</value></property>
<property name="schedule"><value>*/1</value></property>
<property name="scheduler"><ref bean="scheduler"/></property>
<property name="arguments">
<list>
<value>arg1</value>
<value>arg2</value>
</list>
</property>
</bean>
-------------
I have also removed SpringExecWrapper since I haven't found it useful
at all (ExecWrapper works just as well) but left a part of its
functionality in the SpringEventWrapper (publishes events to
the application context at a given schedule).
The only thing that bothers me is the schedule resolution. Cron works
with minutes but that may be too long for some uses. Should seconds
and milliseconds be supported?
--
ModSecurity (http://www.modsecurity.org)
[ Open source IDS for Web applications ]
|