/** * Enable sharing of the "best" class-loader with 3rd party. * * @return the class-loader user be the helper. */ public ClassLoader getClassLoader() { return (this.bestCandidate == null) ? Thread.currentThread().getContextClassLoader() : this.bestCandidate.getClassLoader(); }
/** * Enable sharing of the "best" class-loader with 3rd party. * * @return the class-loader user be the helper. */ public ClassLoader getClassLoader() { return (this.bestCandidate == null) ? Thread.currentThread().getContextClassLoader() : this.bestCandidate.getClassLoader(); }
/** * Enable sharing of the class-loader with 3rd party (e.g. digester). * * @return the class-loader user be the helper. */ public ClassLoader getClassLoader() { return (this.bestCandidate == null) ? Thread.currentThread().getContextClassLoader() : this.bestCandidate.getClassLoader(); }
/** * Enable sharing of the class-loader with 3rd party (e.g. digester). * * @return the class-loader user be the helper. */ public ClassLoader getClassLoader() { return (this.bestCandidate == null) ? Thread.currentThread().getContextClassLoader() : this.bestCandidate.getClassLoader(); }
@SuppressWarnings("unchecked") private boolean isJobConcurrentExectionDisallowed(String jobClassName) { boolean jobConcurrentExectionDisallowed = false; try { Class<Job> jobClass = (Class<Job>) loadHelper.getClassLoader().loadClass(jobClassName); jobConcurrentExectionDisallowed = ClassUtils.isAnnotationPresent(jobClass, DisallowConcurrentExecution.class); } catch (Exception ex) { log.error("could not determine whether class: " + jobClassName + " is JobConcurrentExectionDisallowed annotated"); } return jobConcurrentExectionDisallowed; }
@SuppressWarnings("unchecked") private boolean isPersistJobDataAfterExecution(String jobClassName) { boolean persistJobDataAfterExecution = false; try { Class<Job> jobClass = (Class<Job>) loadHelper.getClassLoader().loadClass(jobClassName); persistJobDataAfterExecution = ClassUtils.isAnnotationPresent(jobClass, PersistJobDataAfterExecution.class); } catch (Exception ex) { log.error("could not determine whether class: " + jobClassName + " is PersistJobDataAfterExecution annotated"); } return persistJobDataAfterExecution; }
public JobDetail retrieveJob(JobKey jobKey) throws JobPersistenceException { DBObject dbObject = retrieveJobDBObject(jobKey); try { Class<Job> jobClass = (Class<Job>) loadHelper.getClassLoader().loadClass((String)dbObject.get(JOB_CLASS)); JobBuilder builder = JobBuilder.newJob(jobClass) .withIdentity((String)dbObject.get(JOB_KEY_NAME), (String)dbObject.get(JOB_KEY_GROUP)) .withDescription((String)dbObject.get(JOB_KEY_NAME)); JobDataMap jobData = new JobDataMap(); for (String key : dbObject.keySet()) { if (!key.equals(JOB_KEY_NAME) && !key.equals(JOB_KEY_GROUP) && !key.equals(JOB_CLASS) && !key.equals(JOB_DESCRIPTION) && !key.equals("_id")) { jobData.put(key, dbObject.get(key)); } } return builder.usingJobData(jobData).build(); } catch (ClassNotFoundException e) { throw new JobPersistenceException("Could not load job class " + dbObject.get(JOB_CLASS), e); } }
/** * Retrieves job from redis. * * @param jobKey the job key * @param jedis thread-safe redis connection * @return the job detail * @throws JobPersistenceException */ @SuppressWarnings("unchecked") private JobDetail retrieveJob(JobKey jobKey, Jedis jedis) throws JobPersistenceException, ClassNotFoundException { String jobHashkey = createJobHashKey(jobKey.getGroup(), jobKey.getName()); String jobDataMapHashKey = createJobDataMapHashKey(jobKey.getGroup(), jobKey.getName()); if (!jedis.exists(jobHashkey)) { log.warn("job: " + jobHashkey + " does not exist"); return null; } Class<Job> jobClass = (Class<Job>) loadHelper.getClassLoader().loadClass(jedis.hget(jobHashkey, JOB_CLASS)); JobBuilder jobBuilder = JobBuilder.newJob(jobClass) .withIdentity(jobKey) .withDescription(jedis.hget(jobHashkey, DESCRIPTION)) .storeDurably(Boolean.getBoolean(jedis.hget(jobHashkey, IS_DURABLE))); Set<String> jobDataMapFields = jedis.hkeys(jobDataMapHashKey); if (!jobDataMapFields.isEmpty()) { for (String jobDataMapField : jobDataMapFields) jobBuilder.usingJobData(jobDataMapField, jedis.hget(jobDataMapHashKey, jobDataMapField)); } return jobBuilder.build(); }
/** * Initializes the digester. * * @param validating whether or not to validate XML. * @param validatingSchema whether or not to validate XML schema. */ protected void initDigester(boolean validating, boolean validatingSchema) { digester = new Digester(); digester.setNamespaceAware(true); digester.setClassLoader(this.classLoadHelper.getClassLoader()); digester.setValidating(validating); initSchemaValidation(validatingSchema); digester.setEntityResolver(this); digester.setErrorHandler(this); if (addCustomDigesterRules(digester)) { addDefaultDigesterRules(digester); } }
/** * Initializes the digester. * * @param validating whether or not to validate XML. * @param validatingSchema whether or not to validate XML schema. */ protected void initDigester(boolean validating, boolean validatingSchema) { digester = new Digester(); digester.setNamespaceAware(true); digester.setClassLoader(this.classLoadHelper.getClassLoader()); digester.setValidating(validating); initSchemaValidation(validatingSchema); digester.setEntityResolver(this); digester.setErrorHandler(this); if (addCustomDigesterRules(digester)) { addDefaultDigesterRules(digester); } }
protected OperableTrigger toTrigger(TriggerKey triggerKey, DBObject dbObject) throws JobPersistenceException { OperableTrigger trigger; try { Class<OperableTrigger> triggerClass = (Class<OperableTrigger>) loadHelper.getClassLoader().loadClass((String)dbObject.get(TRIGGER_CLASS)); trigger = triggerClass.newInstance(); } catch (ClassNotFoundException e) {