Update of /cvsroot/springnet/Spring.Net.Integration/projects/Spring.Scheduling.Quartz/src/Spring/Spring.Scheduling.Quartz/Scheduling/Quartz
In directory sc8-pr-cvs8.sourceforge.net:/tmp/cvs-serv19671/Scheduling/Quartz
Modified Files:
CronTriggerObject.cs JobDetailObject.cs MethodInvokingJob.cs
MethodInvokingJobDetailFactoryObject.cs
SchedulerFactoryObject.cs SimpleTriggerObject.cs
SpringObjectJobFactory.cs
Log Message:
Documentation fixes, updates to properly override JobDetail properties
Index: JobDetailObject.cs
===================================================================
RCS file: /cvsroot/springnet/Spring.Net.Integration/projects/Spring.Scheduling.Quartz/src/Spring/Spring.Scheduling.Quartz/Scheduling/Quartz/JobDetailObject.cs,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** JobDetailObject.cs 10 Sep 2007 21:34:10 -0000 1.1
--- JobDetailObject.cs 12 Sep 2007 18:40:46 -0000 1.2
***************
*** 37,41 ****
public class JobDetailObject : JobDetail, IObjectNameAware, IApplicationContextAware, IInitializingObject
{
! private Type actualJobClass;
private string objectName;
private IApplicationContext applicationContext;
--- 37,41 ----
public class JobDetailObject : JobDetail, IObjectNameAware, IApplicationContextAware, IInitializingObject
{
! private Type actualJobType;
private string objectName;
private IApplicationContext applicationContext;
***************
*** 47,53 ****
/// </summary>
/// <seealso cref="SchedulerFactoryObject.JobFactory" />
! public virtual Type JobClass
{
! get { return (actualJobClass != null ? actualJobClass : JobType); }
set
--- 47,53 ----
/// </summary>
/// <seealso cref="SchedulerFactoryObject.JobFactory" />
! public override Type JobType
{
! get { return (actualJobType != null ? actualJobType : base.JobType); }
set
***************
*** 55,64 ****
if (value != null && !typeof (IJob).IsAssignableFrom(value))
{
! JobType = typeof (DelegatingJob);
! actualJobClass = value;
}
else
{
! JobType = value;
}
}
--- 55,64 ----
if (value != null && !typeof (IJob).IsAssignableFrom(value))
{
! base.JobType = typeof (DelegatingJob);
! actualJobType = value;
}
else
{
! base.JobType = value;
}
}
***************
*** 80,104 ****
public virtual IDictionary JobDataAsMap
{
- set { JobDataMap.PutAll(value); }
- }
-
- /// <summary>
- /// Set a list of JobListener names for this job, referring to
- /// non-global JobListeners registered with the Scheduler.
- /// </summary>
- /// <remarks>
- /// A JobListener name always refers to the name returned
- /// by the JobListener implementation.
- /// </remarks>
- /// <seealso cref="SchedulerFactoryObject.JobListeners" />
- /// <seealso cref="IJobListener.Name" />
- public virtual string[] JobListenerNamesAsSetProperty
- {
set
{
! for (int i = 0; i < value.Length; i++)
! {
! AddJobListener(value[i]);
! }
}
}
--- 80,90 ----
public virtual IDictionary JobDataAsMap
{
set
{
! if (value == null)
! {
! throw new ArgumentException("Value cannot be null", "value");
! }
! JobDataMap.PutAll(value);
}
}
***************
*** 221,225 ****
if (applicationContext == null)
{
! throw new SystemException("JobDetailObject needs to be set up in an IApplicationContext " +
"to be able to handle an 'applicationContextJobDataKey'");
}
--- 207,211 ----
if (applicationContext == null)
{
! throw new ArgumentException("JobDetailObject needs to be set up in an IApplicationContext " +
"to be able to handle an 'applicationContextJobDataKey'");
}
Index: CronTriggerObject.cs
===================================================================
RCS file: /cvsroot/springnet/Spring.Net.Integration/projects/Spring.Scheduling.Quartz/src/Spring/Spring.Scheduling.Quartz/Scheduling/Quartz/CronTriggerObject.cs,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** CronTriggerObject.cs 11 Sep 2007 09:33:50 -0000 1.2
--- CronTriggerObject.cs 12 Sep 2007 18:40:46 -0000 1.3
***************
*** 55,59 ****
private JobDetail jobDetail;
private string objectName;
! private readonly Constants constants = new Constants(typeof(CronTrigger));
--- 55,59 ----
private JobDetail jobDetail;
private string objectName;
! private readonly Constants constants = new Constants(typeof(MisfirePolicy.CronTrigger), typeof(MisfirePolicy));
***************
*** 178,199 ****
internal class Constants
{
! private readonly Type type;
! public Constants(Type reflectedType)
{
! type = reflectedType;
}
public int AsNumber(string field)
{
! FieldInfo fi = type.GetField(field, BindingFlags.Static);
! if (fi != null)
! {
! return Convert.ToInt32(fi.GetValue(null));
! }
! else
{
! throw new Exception(string.Format("Unknown field '{0}'", field));
}
}
}
--- 178,201 ----
internal class Constants
{
! private readonly Type[] types;
! public Constants(params Type[] reflectedTypes)
{
! types = reflectedTypes;
}
public int AsNumber(string field)
{
! foreach (Type type in types)
{
! FieldInfo fi = type.GetField(field);
! if (fi != null)
! {
! return Convert.ToInt32(fi.GetValue(null));
! }
}
+
+ // not found
+ throw new Exception(string.Format("Unknown field '{0}'", field));
}
}
Index: SpringObjectJobFactory.cs
===================================================================
RCS file: /cvsroot/springnet/Spring.Net.Integration/projects/Spring.Scheduling.Quartz/src/Spring/Spring.Scheduling.Quartz/Scheduling/Quartz/SpringObjectJobFactory.cs,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** SpringObjectJobFactory.cs 10 Sep 2007 21:34:10 -0000 1.1
--- SpringObjectJobFactory.cs 12 Sep 2007 18:40:46 -0000 1.2
***************
*** 86,90 ****
{
string propName = ignoredUnknownProperties[i];
! if (pvs.Contains(propName) && !ow.GetPropertyInfo(propName).CanWrite)
{
pvs.Remove(propName);
--- 86,90 ----
{
string propName = ignoredUnknownProperties[i];
! if (pvs.Contains(propName))
{
pvs.Remove(propName);
Index: SchedulerFactoryObject.cs
===================================================================
RCS file: /cvsroot/springnet/Spring.Net.Integration/projects/Spring.Scheduling.Quartz/src/Spring/Spring.Scheduling.Quartz/Scheduling/Quartz/SchedulerFactoryObject.cs,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** SchedulerFactoryObject.cs 11 Sep 2007 09:33:50 -0000 1.2
--- SchedulerFactoryObject.cs 12 Sep 2007 18:40:46 -0000 1.3
***************
*** 73,76 ****
--- 73,77 ----
/// </remarks>
/// <author>Juergen Hoeller</author>
+ /// <author>Marko Lahma (.NET)</author>
/// <seealso cref="IScheduler" />
/// <seealso cref="ISchedulerFactory" />
***************
*** 88,92 ****
/// Property name for thread count in thread pool.
/// </summary>
! public const string PROP_THREAD_COUNT = "org.quartz.threadPool.threadCount";
/// <summary>
--- 89,93 ----
/// Property name for thread count in thread pool.
/// </summary>
! public const string PROP_THREAD_COUNT = "quartz.threadPool.threadCount";
/// <summary>
***************
*** 108,112 ****
private bool overwriteExistingJobs = false;
private NameValueCollection quartzProperties;
! private IScheduler scheduler;
private IDictionary schedulerContextMap;
private Type schedulerFactoryType;
--- 109,113 ----
private bool overwriteExistingJobs = false;
private NameValueCollection quartzProperties;
! private IScheduler scheduler;
private IDictionary schedulerContextMap;
private Type schedulerFactoryType;
***************
*** 148,152 ****
if (value == null || !typeof (ISchedulerFactory).IsAssignableFrom(value))
{
! throw new ArgumentException("schedulerFactoryType must implement [org.quartz.SchedulerFactory]");
}
schedulerFactoryType = value;
--- 149,153 ----
if (value == null || !typeof (ISchedulerFactory).IsAssignableFrom(value))
{
! throw new ArgumentException("schedulerFactoryType must implement [Quartz.ISchedulerFactory]");
}
schedulerFactoryType = value;
***************
*** 301,305 ****
public virtual string JobSchedulingDataLocation
{
! set { jobSchedulingDataLocations = new String[] {value}; }
}
--- 302,306 ----
public virtual string JobSchedulingDataLocation
{
! set { jobSchedulingDataLocations = new string[] {value}; }
}
***************
*** 1044,1069 ****
private class AnonymousClassThread : QuartzThread
{
! private SchedulerFactoryObject encInstance;
public AnonymousClassThread(SchedulerFactoryObject enclosingInstance)
{
! InitBlock(enclosingInstance);
! }
!
! public SchedulerFactoryObject Enclosing_Instance
! {
! get { return encInstance; }
! }
!
! private void InitBlock(SchedulerFactoryObject enclosingInstance)
! {
! encInstance = enclosingInstance;
}
public override void Run()
{
try
{
! Thread.Sleep(new TimeSpan(10000*Enclosing_Instance.startupDelay*1000));
}
catch (ThreadInterruptedException)
--- 1045,1061 ----
private class AnonymousClassThread : QuartzThread
{
! private readonly SchedulerFactoryObject schedulerFactoryObject;
public AnonymousClassThread(SchedulerFactoryObject enclosingInstance)
{
! schedulerFactoryObject = enclosingInstance;
}
+
public override void Run()
{
try
{
! Thread.Sleep(schedulerFactoryObject.startupDelay*1000);
}
catch (ThreadInterruptedException)
***************
*** 1071,1083 ****
// simply proceed
}
! if (Enclosing_Instance.logger.IsInfoEnabled)
{
! Enclosing_Instance.logger.Info("Starting Quartz Scheduler now, after delay of " +
! Enclosing_Instance.startupDelay +
" seconds");
}
try
{
! Enclosing_Instance.scheduler.Start();
}
catch (SchedulerException ex)
--- 1063,1075 ----
// simply proceed
}
! if (schedulerFactoryObject.logger.IsInfoEnabled)
{
! schedulerFactoryObject.logger.Info("Starting Quartz Scheduler now, after delay of " +
! schedulerFactoryObject.startupDelay +
" seconds");
}
try
{
! schedulerFactoryObject.scheduler.Start();
}
catch (SchedulerException ex)
Index: MethodInvokingJob.cs
===================================================================
RCS file: /cvsroot/springnet/Spring.Net.Integration/projects/Spring.Scheduling.Quartz/src/Spring/Spring.Scheduling.Quartz/Scheduling/Quartz/MethodInvokingJob.cs,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** MethodInvokingJob.cs 10 Sep 2007 21:34:10 -0000 1.1
--- MethodInvokingJob.cs 12 Sep 2007 18:40:46 -0000 1.2
***************
*** 43,46 ****
--- 43,50 ----
set
{
+ if (value == null)
+ {
+ throw new ArgumentException("Method invoker cannot be null", "value");
+ }
methodInvoker = value;
errorMessage =
***************
*** 57,60 ****
--- 61,68 ----
protected override void ExecuteInternal(JobExecutionContext context)
{
+ if (methodInvoker == null)
+ {
+ throw new JobExecutionException("Could not execute job when method invoker is null");
+ }
try
{
***************
*** 75,79 ****
logger.Warn(errorMessage, ex);
throw new JobExecutionException(errorMessage, ex);
-
}
}
--- 83,86 ----
Index: MethodInvokingJobDetailFactoryObject.cs
===================================================================
RCS file: /cvsroot/springnet/Spring.Net.Integration/projects/Spring.Scheduling.Quartz/src/Spring/Spring.Scheduling.Quartz/Scheduling/Quartz/MethodInvokingJobDetailFactoryObject.cs,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** MethodInvokingJobDetailFactoryObject.cs 11 Sep 2007 09:33:50 -0000 1.2
--- MethodInvokingJobDetailFactoryObject.cs 12 Sep 2007 18:40:46 -0000 1.3
***************
*** 145,149 ****
/// </returns>
/// <remarks>
! /// <note type="caution">
/// If this method is being called in the context of an enclosing IoC container and
/// returns <see langword="null"/>, the IoC container will consider this factory
--- 145,149 ----
/// </returns>
/// <remarks>
! /// <note type="caution">
/// If this method is being called in the context of an enclosing IoC container and
/// returns <see langword="null"/>, the IoC container will consider this factory
***************
*** 212,219 ****
// Consider the concurrent flag to choose between stateful and stateless job.
! Type jobClass = (concurrent ? typeof (MethodInvokingJob) : typeof (StatefulMethodInvokingJob));
// Build JobDetail instance.
! jobDetail = new JobDetail(jobDetailName, group, jobClass);
jobDetail.JobDataMap.Put("methodInvoker", this);
jobDetail.Volatile = true;
--- 212,219 ----
// Consider the concurrent flag to choose between stateful and stateless job.
! Type jobType = (concurrent ? typeof (MethodInvokingJob) : typeof (StatefulMethodInvokingJob));
// Build JobDetail instance.
! jobDetail = new JobDetail(jobDetailName, group, jobType);
jobDetail.JobDataMap.Put("methodInvoker", this);
jobDetail.Volatile = true;
Index: SimpleTriggerObject.cs
===================================================================
RCS file: /cvsroot/springnet/Spring.Net.Integration/projects/Spring.Scheduling.Quartz/src/Spring/Spring.Scheduling.Quartz/Scheduling/Quartz/SimpleTriggerObject.cs,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** SimpleTriggerObject.cs 11 Sep 2007 09:33:50 -0000 1.2
--- SimpleTriggerObject.cs 12 Sep 2007 18:40:46 -0000 1.3
***************
*** 55,59 ****
private JobDetail jobDetail;
private string objectName;
! private readonly Constants constants = new Constants(typeof(SimpleTrigger));
/// <summary>
--- 55,59 ----
private JobDetail jobDetail;
private string objectName;
! private readonly Constants constants = new Constants(typeof(MisfirePolicy.SimpleTrigger), typeof(MisfirePolicy));
/// <summary>
***************
*** 98,122 ****
/// <summary>
- /// Set a list of TriggerListener names for this job, referring to
- /// non-global TriggerListeners registered with the Scheduler.
- /// <p>
- /// A TriggerListener name always refers to the name returned
- /// by the TriggerListener implementation.
- /// </p>
- /// </summary>
- /// <seealso cref="SchedulerFactoryObject.TriggerListeners" />
- /// <seealso cref="ITriggerListener.Name" />
- public virtual string[] SetTriggerListenerNames
- {
- set
- {
- for (int i = 0; i < value.Length; i++)
- {
- AddTriggerListener(value[i]);
- }
- }
- }
-
- /// <summary>
/// Set the delay before starting the job for the first time.
/// The given number of milliseconds will be added to the current
--- 98,101 ----
|