Author: sgoeschl
Date: Wed Nov  3 00:41:13 2010
New Revision: 1030305

URL: http://svn.apache.org/viewvc?rev=1030305&view=rev
Log:
If the handler implements "LogEnabled" we set a logger.

Modified:
    
turbine/fulcrum/trunk/quartz/src/java/org/apache/fulcrum/quartz/impl/QuartzSchedulerImpl.java

Modified: 
turbine/fulcrum/trunk/quartz/src/java/org/apache/fulcrum/quartz/impl/QuartzSchedulerImpl.java
URL: 
http://svn.apache.org/viewvc/turbine/fulcrum/trunk/quartz/src/java/org/apache/fulcrum/quartz/impl/QuartzSchedulerImpl.java?rev=1030305&r1=1030304&r2=1030305&view=diff
==============================================================================
--- 
turbine/fulcrum/trunk/quartz/src/java/org/apache/fulcrum/quartz/impl/QuartzSchedulerImpl.java
 (original)
+++ 
turbine/fulcrum/trunk/quartz/src/java/org/apache/fulcrum/quartz/impl/QuartzSchedulerImpl.java
 Wed Nov  3 00:41:13 2010
@@ -26,6 +26,7 @@ import org.apache.avalon.framework.confi
 import org.apache.avalon.framework.configuration.Configuration;
 import org.apache.avalon.framework.configuration.ConfigurationException;
 import org.apache.avalon.framework.logger.AbstractLogEnabled;
+import org.apache.avalon.framework.logger.LogEnabled;
 import org.apache.avalon.framework.parameters.Parameters;
 import org.apache.avalon.framework.service.ServiceException;
 import org.apache.avalon.framework.service.ServiceManager;
@@ -183,13 +184,22 @@ public class QuartzSchedulerImpl
     }
 
     /**
-     * Calls service() on Job instance if it implements Serviceable
+     * Hook to support jobs implementing Avalon interface such as
+     * LogEnabled and Serviceable.
      *
      * @see 
org.quartz.JobListener#jobToBeExecuted(org.quartz.JobExecutionContext)
      */
     public void jobToBeExecuted(JobExecutionContext context)
     {
         Job job = context.getJobInstance();
+
+        // inject a logger instance
+        if(job instanceof LogEnabled)
+        {
+            ((LogEnabled) job).enableLogging(getLogger());
+        }
+
+        // inject a ServiceManager instance
         if (job instanceof Serviceable)
         {
             try
@@ -257,7 +267,7 @@ public class QuartzSchedulerImpl
                 }
                 else
                 {
-                    buffer.append("unknown");
+                    buffer.append("no trigger defined");
                 }
 
                 getLogger().info(buffer.toString());


Reply via email to