Where exactly in this code you need access to .properties ? Here is a way with normal j.u.c Executor: java.util.concurrent.ThreadPoolExecutor.beforeExecute(Thread t, Runnable r) {
if (r instanceof MyRunnable) { MyRunnable mr = (MyRunnable) r; mr.setApplication(Application.get()); } } abstract class MyRunnable implements Runnable { private Application app; public void setApplication(Application a) {app = a;} public abstract void onRun(); public void run() { try { Application.set(app); onRun(); } finally { Application.unset(); } } } And don't forget to shutdown the executor on Application#onDestroy() On Tue, Aug 10, 2010 at 9:52 PM, rmattler <robertmatt...@gmail.com> wrote: > > I'm struggling with how to get access to the properties file from a quartz > job bean. I'm creating a pdf report that will then be emailed. I want to > get access to the properties file to tell me where to write the file along > with other information. Here is my quartz job code. Thanks in advance. > > package com.paybridgeusa.jobs; > > public class SendEmail extends QuartzJobBean { > > public void executeInternal(JobExecutionContext context) throws > JobExecutionException { > > try { > // get all tpas > TPAUsersDAO usersDAO = (TPAUsersDAO) > getApplicationContext(context).getBean("TPAUsersDAO"); > List<Tpausers> users = usersDAO.getAll(); > for (Tpausers user : users) { > String emailAddressTo = user.getEmail(); > } > } catch (Exception e) { > System.out.println(e.getLocalizedMessage()); > } > } > > private static final String APPLICATION_CONTEXT_KEY = > "applicationContext"; > > public ApplicationContext getApplicationContext(JobExecutionContext > context) throws Exception { > ApplicationContext applicationContext = null; > applicationContext = (ApplicationContext) > context.getScheduler().getContext().get(APPLICATION_CONTEXT_KEY); > if (applicationContext == null) { > throw new JobExecutionException("No application > context available in > scheduler context for key \"" + APPLICATION_CONTEXT_KEY + "\""); > } > return applicationContext; > } > > } > > > application context xml > > <!-- QUARTZ BEANS --> > <!-- SEND TERMINATION EMAILS JOB --> > <bean name="sendTermsEmail" > class="org.springframework.scheduling.quartz.JobDetailBean"> > <property name="jobClass" > value="com.paybridgeusa.jobs.SendTermsEmail"/> > <property name="name" value="sendTermsEmail"/> > </bean> > <bean id="cronTriggerSendTermsEmail" > class="org.springframework.scheduling.quartz.CronTriggerBean"> > <property name="jobDetail" ref="sendTermsEmail"/> > <!-- run every 1 minutes --> > <property name="cronExpression" value="0 0/1 * * * ?"/> > </bean> > <!-- END SEND TERMINATION EMAILS JOB --> > > <bean > class="org.springframework.scheduling.quartz.SchedulerFactoryBean"> > <property name="triggers"> > <list> > <ref bean="cronTriggerSendTermsEmail" /> > </list> > </property> > <property name="applicationContextSchedulerContextKey"> > <value>applicationContext</value> > </property> > </bean> > <!-- END QUARTZ BEANS --> > -- > View this message in context: > http://apache-wicket.1842946.n4.nabble.com/quartz-job-bean-access-to-properties-file-tp2320367p2320367.html > Sent from the Wicket - User mailing list archive at Nabble.com. > > --------------------------------------------------------------------- > To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org > For additional commands, e-mail: users-h...@wicket.apache.org > >