Upload
to-the-new-technology
View
84
Download
0
Embed Size (px)
Citation preview
1.Quick presentation on how to use
2.Task Artifact
3.Bootstrap of Plugin
4.QuartzGrailsPlugin MetaData
5.Plugin Events and Application Reloading
Agenda
● Artefact is used to refer to a Groovy file that fulfil s a certain concept.
–Controller, Bootstrap, Codec, Service, Domain, TagLib
● For each artefact type, the GrailsApplication class provides dynamic methods to access the artefacts of that
–grailsApplication.getControllerClasses()
–Dynamic finders on Domain
What is Grails Artefact?
● Created by Quartz-plugin to model the idea of a job● Created TaskArtefactHandler class byextending
ArtefactHandlerAdapter class● Provided implementation for boolean isArtefactClass() method● Made Grails aware of the new Artifact as
–def artefacts =[new TaskArtefactHandler()]
Task Artefact
Now the statements like this can be used application.taskClasses.each{
GrailsTaskClass tc ->//------------------
}
Task Artefact Cond...
● participation in the runtime configuration of Grails’ underlying Spring ApplicationContext
–creating beans, binding hibernate sessionetc
Do With Spring
● Merges DefaultQuartzConfig and QuartzConfig into appications main config file
● Bind Hibernate Session to each Job's thread usingSessionBinderJobListener class
● Create bean quartzScheduler which is an instance of SchedulerFactoryBean
Do With Spring Cond...
● Executed after the construction of the ApplicationContext.– Usage example - provide new behavior to Grails classes
Do With Dynamic Methods
● Injects the following static methods to TaskArtefact classes -–Schedule–TriggerNow–RemoveJob
● e.g. FileUsageMonitorJob.triggerNow()● calling the
Instead of injecting qartzScheduler bean andtriggerNow with job details
Do With Dynamic Methods cond...
● Executed after Grails’ ApplicationContext has been constructed
● This closure is passed applicationContext asfirst arg
–Add all jobs to quartzScheduler–Schedules job for each trigger
Do With Application Context
● A plugin can essentially listen for three core events:
● onChange● onConfigChange● onShutdown
Plugin Events and Application Reloading
● Changes to resources being watched by the plugin
● def watchedResources =[”...**/*Job.groovy”]● Quartz plugin creates new bean(after removing if
it is already there) and register all the triggers for each changed job class.
On Change
Contact us
Our Office
Client Location
Click Here To Know More!
Have more queries on Grails? Talk to our GRAILS experts Now!
Talk To Our Experts
Here's how the world's biggest Grails team is building enterprise applications on Grails!