-
Notifications
You must be signed in to change notification settings - Fork 311
/
CrystalQuartzOptions.cs
163 lines (133 loc) · 5.58 KB
/
CrystalQuartzOptions.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
namespace CrystalQuartz.Application
{
using System;
using System.Globalization;
using CrystalQuartz.Core.Domain.ObjectInput;
using CrystalQuartz.Core.Domain.ObjectTraversing;
/// <summary>
/// Public Crystal Quartz Panel options.
/// </summary>
public class CrystalQuartzOptions
{
public static RegisteredInputType[] CreateDefaultJobDataMapInputTypes()
{
var cultureInfo = CultureInfo.InvariantCulture;
return new[]
{
new RegisteredInputType(
new InputType("String"), null),
new RegisteredInputType(
new InputType("Int"), new StandardInputTypeConverter(cultureInfo, TypeCode.Int32)),
new RegisteredInputType(
new InputType("Long"), new StandardInputTypeConverter(cultureInfo, TypeCode.Int64)),
new RegisteredInputType(
new InputType("Float"), new StandardInputTypeConverter(cultureInfo, TypeCode.Single)),
new RegisteredInputType(
new InputType("Double"), new StandardInputTypeConverter(cultureInfo, TypeCode.Double)),
new RegisteredInputType(
new InputType("Boolean"),
new StandardInputTypeConverter(cultureInfo, TypeCode.Boolean),
new FixedInputVariantsProvider(
new InputVariant(true.ToString(cultureInfo), "True"),
new InputVariant(false.ToString(cultureInfo), "False")))
};
}
/// <summary>
/// Gets or sets Panel URL path. Default is "/quartz"
/// </summary>
public string Path { get; set; }
public string CustomCssUrl { get; set; }
/// <summary>
/// Gets or sets a flag indicating whether CrystalQuartz Panel should be
/// initialized immediately after application start (<code>false</code>) or
/// after first call of panel services (<code>true</code>).
/// </summary>
public bool LazyInit { get; set; } = false;
public TimeSpan TimelineSpan { get; set; } = TimeSpan.FromMinutes(60);
/// <summary>
/// Gets or sets options that control Job Details objects graph display.
/// </summary>
public JobDataMapDisplayOptions JobDataMapDisplayOptions { get; set; }
public RegisteredInputType[] JobDataMapInputTypes { get; set; } = CreateDefaultJobDataMapInputTypes();
/// <summary>
/// Gets or sets options for jobs failure detection.
/// </summary>
public ErrorDetectionOptions ErrorDetectionOptions { get; set; }
/// <summary>
/// Gets or sets options for job result analyzing.
/// </summary>
public JobResultAnalyserOptions JobResultAnalyserOptions { get; set; }
/// <summary>
/// It is not safe to allow the user to schedule an arbitrary job. This
/// list defines the job types allowed to be scheduled. Any jobs
/// scheduled in code assumed to be allowed and not required to be
/// present in the list.
/// </summary>
public Type[] AllowedJobTypes { get; set; }
public Action<Exception> OnUnhandledPanelException { get; set; }
}
public class ConfigurableTraversingOptions
{
public int MaxGraphDepth { get; set; } = 3;
public int MaxPropertiesCount { get; set; } = 10;
public int MaxEnumerableLength { get; set; } = 10;
internal TraversingOptions ToTraversingOptions()
{
return new TraversingOptions(MaxGraphDepth, MaxPropertiesCount, MaxEnumerableLength);
}
}
public class JobDataMapDisplayOptions : ConfigurableTraversingOptions { }
public class ErrorDetectionOptions
{
/// <summary>
/// Gets or sets a sources of error detection.
/// </summary>
public ErrorExtractionSource Source { get; set; } = ErrorExtractionSource.UnhandledExceptions | ErrorExtractionSource.JobResult;
/// <summary>
/// Gets or sets verbocity level for exception messages.
/// </summary>
public ErrorVerbosityLevel VerbosityLevel { get; set; } = ErrorVerbosityLevel.Minimal;
/// <summary>
/// Maximum length of exception message to store.
/// </summary>
public int ExceptionMessageLengthLimit { get; set; } = 200;
}
public abstract class JobResultAnalyserOptions { }
public class DictionaryJobResultAnalyzerOptions : JobResultAnalyserOptions
{
public string SuccessKey { get; set; } = "Success";
public string FailedKey { get; set; } = "Failed";
public string ExceptionKey { get; set; } = "Error";
}
[Flags]
public enum ErrorExtractionSource : short
{
/// <summary>
/// Do not extract and store exceptions.
/// </summary>
None = 0,
/// <summary>
/// Extract only unhandled jobs exceptions reported by scheduler.
/// </summary>
UnhandledExceptions = 1,
/// <summary>
/// Extract exceptions from job results.
/// </summary>
JobResult = 2
}
public enum ErrorVerbosityLevel
{
/// <summary>
/// Only mark the fire as failed without any error details.
/// </summary>
None,
/// <summary>
/// Provide message of top-level exception, trancate it if too long.
/// </summary>
Minimal,
/// <summary>
/// Provide recursive messages for all the inner exceptions.
/// </summary>
Detailed
}
}