1 17 18 19 20 package org.apache.lenya.cms.scheduler; 21 22 import org.apache.log4j.Category; 23 24 25 28 public final class ServletJobFactory { 29 30 33 private ServletJobFactory() { 34 } 35 36 private static Category log = Category.getInstance(ServletJobFactory.class); 37 38 43 public static ServletJob createJob(String jobClassName) { 44 try { 45 Class cl = Class.forName(jobClassName); 46 47 return createJob(cl); 48 } catch (Exception e) { 49 log.error("Cannot create Job instance: " + e); 50 51 return null; 52 } 53 } 54 55 62 public static ServletJob createJob(Class cl) { 63 try { 64 ServletJob job = (ServletJob) cl.newInstance(); 65 66 return job; 67 } catch (Exception e) { 68 log.error("Cannot create Job instance: " + e); 69 70 return null; 71 } 72 } 73 74 } 75 | Popular Tags |