Win a copy of Murach's MySQL this week in the JDBC and Relational Databases forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Please explain the logic

 
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
pie sneak
Posts: 4727
Mac VI Editor Ruby
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Sheriff
Posts: 67745
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
"Vidhu V S", please check your private messages for an important administrative matter.
 
I don't get it. A whale wearing overalls? How does that even work? It's like a tiny ad wearing overalls.
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic