Define StdSchedulerFactory as service and then
use the service-property ObjectProvider to call the getService-Method:

<service-point id="SchedulerFactory" interface="org.quartz.StdSchedulerFactory">
        <invoke-factory>
            <construct class="org.quartz.StdSchedulerFactory" />
        </invoke-factory>
    </service-point>

    <service-point id="Scheduler" interface="com. ...MyScheduler">
        <invoke-factory model="pooled">
<construct class="com....impl.MySchedulerImpl" initialize-method="mystart">
                <set-object property="quartzScheduler"
                   value="service-property:SchedulerFactory:scheduler"/>
            </construct>
        </invoke-factory>
    </service-point>

The MyScheduler class will have to call the start method of the
quartz scheduler in its mystart method.

Bye
Achim Huegen

Am Thu, 17 Nov 2005 05:04:03 +0100 schrieb Colin Taylor <[EMAIL PROTECTED]>:

Hi there,

can anyone share the best way of invoking an existing factory to use with
the set-object directive?
I'm trying to integrate quartz, whose scheduler is commonly constructed :

StdSchedulerFactory schedFactory = new StdSchedulerFactory();
try {
quartz = (org.quartz.Scheduler) schedFactory.getScheduler();
quartz.start();
}


I would like to use the existing StdSchedulerFactory with set-object rather than create a new factory or create a service to invoke the existing factory
which would be complete overkill considering I'm only going to make one
quartz object. Is this possible?

I've got as far as:

<service-point id="Scheduler" interface="com. ...MyScheduler">
<invoke-factory model="pooled">
<construct class="com....impl.MySchedulerImpl">
<set-object property="quartzScheduler" value="???"/>
</construct>
</invoke-factory>
</service-point>


One nice way I thought of was having groovy configuration scraps in the xml.

so :
<service-point id="Scheduler" interface="com. ...MyScheduler">
<invoke-factory model="pooled">
<construct class="com....impl.MySchedulerImpl">
<set-object property="quartzScheduler"
<groovy>
schedFactory = new org.quartz.StdSchedulerFactory();
quartz =schedFactory.getScheduler();
quartz.start();
return quartz; /// put as value attribute on set-object
</groovy>
</set-object>
</construct>
</invoke-factory>
</service-point>






As an aside having a dtd or xsd would be a big addition to Hiveminds rather
opaque documentation.

Cheers
Colin.



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to