GeeCON Prague 2014*
The moose likes Other Application Frameworks and the fly likes Please explain the logic Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


JavaRanch » Java Forums » Frameworks » Other Application Frameworks
Bookmark "Please explain the logic" Watch "Please explain the logic" New topic
Author

Please explain the logic

Vidhu V S
Greenhorn

Joined: Aug 27, 2008
Posts: 5
Hi
I got the following Xml file from your forum and it is executing fine. But I can't understand what is happening, ie not able to understand the logic behind it. Here in the xml it refers the myScheduler bean first. Can you explain how the xml parser will decide which bean to refer first. Can you please explain the whole logic behind this with an example.



This is the Xml file:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN//EN"
"http://www.springframework.org/dtd/spring-beans.dtd">
<beans>

<bean name="myJob" class="org.springframework.scheduling.quartz.JobDetailBean">
<property name="jobClass">
<value>com.syntel.springapi.scheduler.MyJobHandler</value>
</property>
<property name="jobDataAsMap">
<map>
<entry key="job"><ref bean="myJobImpl" />
</entry>
</map></property>
</bean>

<bean id="mySimpleTrigger1" class="org.springframework.scheduling.quartz.SimpleTriggerBean">
<property name="jobDetail"><ref bean="myJob" />
</property>
<property name="startDelay">
<value>20000</value>
</property>
<property name="repeatInterval">
<value>10000</value>
</property></bean>

<bean id="exampleJobDetail2" class="org.springframework.scheduling.quartz.MethodInvokingJobDetailFactoryBean">
<property name="targetObject" ref="exampleJob" />
<property name="targetMethod" value="doForMe" /></bean>

<bean id="mySimpleTrigger2" class="org.springframework.scheduling.quartz.SimpleTriggerBean">
<property name="jobDetail"><ref bean="exampleJobDetail2" />
</property>
<property name="startDelay">
<value>2000</value>
</property>
<property name="repeatInterval">
<value>1000</value>
</property></bean>

<bean id="exampleJob" class="com.syntel.springapi.scheduler.ExampleJob "/>

<bean id="myScheduler" class="org.springframework.scheduling.quartz.SchedulerFactoryBean">
<property name="triggers">
<list>
<ref bean="mySimpleTrigger1"/>
<ref bean="mySimpleTrigger2"/>
</list>
</property>
</bean>

<bean id="myJobImpl" class="com.syntel.springapi.scheduler.MyJobImpl">
<property name="greeting">
<value>Have a great day !!</value>
</property>
</bean>
</beans>


Thanks and regards

Vidhu V S
Syntel Ltd


Vidhu VS
Marc Peabody
pie sneak
Sheriff

Joined: Feb 05, 2003
Posts: 4727

Originally posted by Vidhu V S:
But I can't understand what is happening, ie not able to understand the logic behind it. Here in the xml it refers the myScheduler bean first. Can you explain how the xml parser will decide which bean to refer first. Can you please explain the whole logic behind this with an example.

When you say you don't understand the logic, are you saying:
1)you don't understand the end result (Dependency Injection)
or
2)you understand the end result completely but don't understand how it happens


A good workman is known by his tools.
Vidhu V S
Greenhorn

Joined: Aug 27, 2008
Posts: 5
Originally posted by Marc Peabody:

When you say you don't understand the logic, are you saying:
1)you don't understand the end result (Dependency Injection)
or
2)you understand the end result completely but don't understand how it happens
Vidhu V S
Greenhorn

Joined: Aug 27, 2008
Posts: 5
Hi,

This is the reply to the message posted by Mr. Mac Peabody
I understand the end result completely but don't understand how it happens. Can you please explain that.
This is the Xml File:



<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN//EN"
"http://www.springframework.org/dtd/spring-beans.dtd">
<beans>

<bean name="myJob" class="org.springframework.scheduling.quartz.JobDetailBean">
<property name="jobClass">
<value>com.syntel.spring.scheduler.MyJobHandler</value>
</property>
<property name="jobDataAsMap">
<map>
<entry key="job"><ref bean="myJobImpl" />
</entry>
</map></property>
</bean>

<bean id="mySimpleTrigger1" class="org.springframework.scheduling.quartz.SimpleTriggerBean">
<property name="jobDetail"><ref bean="myJob" />
</property>
<property name="startDelay">
<value>20000</value>
</property>
<property name="repeatInterval">
<value>10000</value>
</property></bean>

<bean id="exampleJobDetail2" class="org.springframework.scheduling.quartz.MethodInvokingJobDetailFactoryBean">
<property name="targetObject" ref="exampleJob" />
<property name="targetMethod" value="doForMe" /></bean>

<bean id="mySimpleTrigger2" class="org.springframework.scheduling.quartz.SimpleTriggerBean">
<property name="jobDetail"><ref bean="exampleJobDetail2" />
</property>
<property name="startDelay">
<value>2000</value>
</property>
<property name="repeatInterval">
<value>1000</value>
</property></bean>

<bean id="exampleJob" class="com.syntel.spring.scheduler.ExampleJob "/>

<bean id="myScheduler" class="org.springframework.scheduling.quartz.SchedulerFactoryBean">
<property name="triggers">
<list>
<ref bean="mySimpleTrigger1"/>
<ref bean="mySimpleTrigger2"/>
</list>
</property>
</bean>

<bean id="myJobImpl" class="com.syntel.spring.scheduler.MyJobImpl">
<property name="greeting">
<value>Have a great day !!</value>
</property>
</bean>
</beans>

Thanks and regards
Vidhu V S
Syntel Ltd
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61304
    
  66

"Vidhu V S", please check your private messages for an important administrative matter.


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
 
GeeCON Prague 2014
 
subject: Please explain the logic