1 16 17 package org.springframework.scheduling.quartz; 18 19 import java.io.IOException ; 20 import java.io.InputStream ; 21 22 import org.quartz.xml.JobSchedulingDataProcessor; 23 24 import org.springframework.context.ResourceLoaderAware; 25 import org.springframework.core.io.DefaultResourceLoader; 26 import org.springframework.core.io.ResourceLoader; 27 import org.springframework.scheduling.SchedulingException; 28 29 37 public class ResourceJobSchedulingDataProcessor extends JobSchedulingDataProcessor 38 implements ResourceLoaderAware { 39 40 private ResourceLoader resourceLoader = new DefaultResourceLoader(); 41 42 43 public void setResourceLoader(ResourceLoader resourceLoader) { 44 this.resourceLoader = (resourceLoader != null ? resourceLoader : new DefaultResourceLoader()); 45 } 46 47 48 protected InputStream getInputStream(String fileName) { 49 try { 50 return this.resourceLoader.getResource(fileName).getInputStream(); 51 } 52 catch (IOException ex) { 53 throw new SchedulingException("Could not load job scheduling data XML file", ex); 54 } 55 } 56 57 } 58 | Popular Tags |