This week's book giveaways are in the Refactoring and Agile forums.
We're giving away four copies each of Re-engineering Legacy Software and Docker in Action and have the authors on-line!
See this thread and this one for details.
Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Cloud/Virtualization forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Please explain the logic

 
Vidhu V S
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
Marc Peabody
pie sneak
Sheriff
Posts: 4727
Mac Ruby VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
Vidhu V S
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Pie
Posts: 64629
86
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
"Vidhu V S", please check your private messages for an important administrative matter.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic