X-Git-Url: http://wamblee.org/gitweb/?a=blobdiff_plain;f=mythtv%2Fwar%2Fsrc%2Fmain%2Fjava%2Forg%2Fwamblee%2Fmythtv%2FPollDirectoryJob.java;fp=mythtv%2Fwar%2Fsrc%2Fmain%2Fjava%2Forg%2Fwamblee%2Fmythtv%2FPollDirectoryJob.java;h=e75ed1191ea01ca87adae9fee15221ac0d082455;hb=84623d9c9d1297b2440b0fd8075ec7c89f2dd502;hp=0000000000000000000000000000000000000000;hpb=aa4e06ab19e030bf82638600d051b71fe847d0f7;p=utils diff --git a/mythtv/war/src/main/java/org/wamblee/mythtv/PollDirectoryJob.java b/mythtv/war/src/main/java/org/wamblee/mythtv/PollDirectoryJob.java new file mode 100644 index 00000000..e75ed119 --- /dev/null +++ b/mythtv/war/src/main/java/org/wamblee/mythtv/PollDirectoryJob.java @@ -0,0 +1,57 @@ +/* + * Copyright 2006 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.wamblee.mythtv; + +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; +import org.quartz.JobExecutionContext; +import org.quartz.JobExecutionException; +import org.quartz.StatefulJob; +import org.wamblee.general.BeanKernel; +import org.wamblee.io.DirectoryMonitor; + +/** + * + */ +public class PollDirectoryJob implements StatefulJob { + + private static final Log LOG = LogFactory.getLog(PollDirectoryJob.class); + + public PollDirectoryJob() { + // Empty + } + + /* + * (non-Javadoc) + * + * @see org.quartz.Job#execute(org.quartz.JobExecutionContext) + */ + public void execute(JobExecutionContext aContext) + throws JobExecutionException { + try { + DirectoryMonitor monitor = BeanKernel.getBeanFactory().find( + DirectoryMonitor.class); + monitor.poll(); + } catch (Throwable t) { + LOG + .error( + "something terrible happend, ignoring it and hoping for the best", + t); + } + } + +}