public interface ISchedulerFactory
{
/// <summary>
/// Returns handles to all known Schedulers (made by any SchedulerFactory
/// within this app domain.).
/// </summary>
ICollection<IScheduler> AllSchedulers { get; }
/// <summary>
/// Returns a client-usable handle to a <see cref="IScheduler" />.
/// </summary>
IScheduler GetScheduler();
/// <summary>
/// Returns a handle to the Scheduler with the given name, if it exists.
/// </summary>
IScheduler GetScheduler(string schedName);
}
2.JobDetailImpl:传递给定作业实例的详细信息属性。
/// <summary>
/// 获取或设置与<see cref =“IJob”/>相关联的<see cref =“JobDataMap”/>。
/// </summary>
public virtual JobDataMap JobDataMap
{
get
{
if (jobDataMap == null)
{
jobDataMap = new JobDataMap();
}
return jobDataMap;
}
set { jobDataMap = value; }
}
3.JobKey:键由名称和组组成,名称必须是唯一的,在组内。 如果只指定一个组,则默认组将使用名称。
[Serializable]
public sealed class JobKey : Key<JobKey>
{
public JobKey(string name) : base(name, null)
{
}
public JobKey(string name, string group) : base(name, group)
{
}
public static JobKey Create(string name)
{
return new JobKey(name, null);
}
public static JobKey Create(string name, string group)
{
return new JobKey(name, group);
}
}
4.StdSchedulerFactory.Initialize():
/// <summary>
/// 使用初始化<see cref =“ISchedulerFactory”/>
///给定键值集合对象的内容。
/// </summary>
public virtual void Initialize(NameValueCollection props)
{
cfg = new PropertiesParser(props);
ValidateConfiguration();
}
protected virtual void ValidateConfiguration()
{
if (!cfg.GetBooleanProperty(PropertyCheckConfiguration, true))
{
// should not validate
return;
}
// determine currently supported configuration keys via reflection
List<string> supportedKeys = new List<string>();
List<FieldInfo> fields = new List<FieldInfo>(GetType().GetFields(BindingFlags.Static | BindingFlags.Public | BindingFlags.FlattenHierarchy));
// choose constant string fields
fields = fields.FindAll(field => field.FieldType == typeof (string));
// read value from each field
foreach (FieldInfo field in fields)
{
string value = (string) field.GetValue(null);
if (value != null && value.StartsWith(ConfigurationKeyPrefix) && value != ConfigurationKeyPrefix)
{
supportedKeys.Add(value);
}
}
// now check against allowed
foreach (string configurationKey in cfg.UnderlyingProperties.AllKeys)
{
if (!configurationKey.StartsWith(ConfigurationKeyPrefix) || configurationKey.StartsWith(ConfigurationKeyPrefixServer))
{
// don't bother if truly unknown property
continue;
}
bool isMatch = false;
foreach (string supportedKey in supportedKeys)
{
if (configurationKey.StartsWith(supportedKey, StringComparison.InvariantCulture))
{
isMatch = true;
break;
}
}
if (!isMatch)
{
throw new SchedulerConfigException("Unknown configuration property '" + configurationKey + "'");
}
}
}








