/
ProcessEngineConfigurationImpl.java
3722 lines (3012 loc) · 142 KB
/
ProcessEngineConfigurationImpl.java
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
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
/* 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.camunda.bpm.engine.impl.cfg;
import static org.camunda.bpm.engine.impl.util.EnsureUtil.ensureNotNull;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.Reader;
import java.nio.charset.Charset;
import java.sql.Connection;
import java.sql.DatabaseMetaData;
import java.sql.SQLException;
import java.text.ParseException;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Map.Entry;
import java.util.Properties;
import java.util.Set;
import java.util.concurrent.CopyOnWriteArraySet;
import javax.naming.InitialContext;
import javax.sql.DataSource;
import org.apache.ibatis.builder.xml.XMLConfigBuilder;
import org.apache.ibatis.datasource.pooled.PooledDataSource;
import org.apache.ibatis.mapping.Environment;
import org.apache.ibatis.session.Configuration;
import org.apache.ibatis.session.SqlSessionFactory;
import org.apache.ibatis.session.defaults.DefaultSqlSessionFactory;
import org.apache.ibatis.transaction.TransactionFactory;
import org.apache.ibatis.transaction.jdbc.JdbcTransactionFactory;
import org.apache.ibatis.transaction.managed.ManagedTransactionFactory;
import org.camunda.bpm.dmn.engine.DmnEngine;
import org.camunda.bpm.dmn.engine.DmnEngineConfiguration;
import org.camunda.bpm.dmn.engine.impl.DefaultDmnEngineConfiguration;
import org.camunda.bpm.engine.ArtifactFactory;
import org.camunda.bpm.engine.AuthorizationService;
import org.camunda.bpm.engine.CaseService;
import org.camunda.bpm.engine.DecisionService;
import org.camunda.bpm.engine.ExternalTaskService;
import org.camunda.bpm.engine.FilterService;
import org.camunda.bpm.engine.FormService;
import org.camunda.bpm.engine.HistoryService;
import org.camunda.bpm.engine.IdentityService;
import org.camunda.bpm.engine.ManagementService;
import org.camunda.bpm.engine.ProcessEngine;
import org.camunda.bpm.engine.ProcessEngineConfiguration;
import org.camunda.bpm.engine.ProcessEngineException;
import org.camunda.bpm.engine.RepositoryService;
import org.camunda.bpm.engine.RuntimeService;
import org.camunda.bpm.engine.TaskService;
import org.camunda.bpm.engine.authorization.Permission;
import org.camunda.bpm.engine.authorization.Permissions;
import org.camunda.bpm.engine.impl.AuthorizationServiceImpl;
import org.camunda.bpm.engine.impl.DecisionServiceImpl;
import org.camunda.bpm.engine.impl.DefaultArtifactFactory;
import org.camunda.bpm.engine.impl.ExternalTaskServiceImpl;
import org.camunda.bpm.engine.impl.FilterServiceImpl;
import org.camunda.bpm.engine.impl.FormServiceImpl;
import org.camunda.bpm.engine.impl.HistoryServiceImpl;
import org.camunda.bpm.engine.impl.IdentityServiceImpl;
import org.camunda.bpm.engine.impl.ManagementServiceImpl;
import org.camunda.bpm.engine.impl.ModificationBatchJobHandler;
import org.camunda.bpm.engine.impl.PriorityProvider;
import org.camunda.bpm.engine.impl.ProcessEngineImpl;
import org.camunda.bpm.engine.impl.RepositoryServiceImpl;
import org.camunda.bpm.engine.impl.RestartProcessInstancesJobHandler;
import org.camunda.bpm.engine.impl.RuntimeServiceImpl;
import org.camunda.bpm.engine.impl.ServiceImpl;
import org.camunda.bpm.engine.impl.TaskServiceImpl;
import org.camunda.bpm.engine.impl.application.ProcessApplicationManager;
import org.camunda.bpm.engine.impl.batch.BatchJobHandler;
import org.camunda.bpm.engine.impl.batch.BatchMonitorJobHandler;
import org.camunda.bpm.engine.impl.batch.BatchSeedJobHandler;
import org.camunda.bpm.engine.impl.batch.deletion.DeleteHistoricProcessInstancesJobHandler;
import org.camunda.bpm.engine.impl.batch.deletion.DeleteProcessInstancesJobHandler;
import org.camunda.bpm.engine.impl.batch.externaltask.SetExternalTaskRetriesJobHandler;
import org.camunda.bpm.engine.impl.batch.job.SetJobRetriesJobHandler;
import org.camunda.bpm.engine.impl.bpmn.behavior.ExternalTaskActivityBehavior;
import org.camunda.bpm.engine.impl.bpmn.deployer.BpmnDeployer;
import org.camunda.bpm.engine.impl.bpmn.parser.BpmnParseListener;
import org.camunda.bpm.engine.impl.bpmn.parser.BpmnParser;
import org.camunda.bpm.engine.impl.calendar.BusinessCalendarManager;
import org.camunda.bpm.engine.impl.calendar.CycleBusinessCalendar;
import org.camunda.bpm.engine.impl.calendar.DueDateBusinessCalendar;
import org.camunda.bpm.engine.impl.calendar.DurationBusinessCalendar;
import org.camunda.bpm.engine.impl.calendar.MapBusinessCalendarManager;
import org.camunda.bpm.engine.impl.cfg.auth.AuthorizationCommandChecker;
import org.camunda.bpm.engine.impl.cfg.auth.DefaultAuthorizationProvider;
import org.camunda.bpm.engine.impl.cfg.auth.ResourceAuthorizationProvider;
import org.camunda.bpm.engine.impl.cfg.multitenancy.TenantCommandChecker;
import org.camunda.bpm.engine.impl.cfg.multitenancy.TenantIdProvider;
import org.camunda.bpm.engine.impl.cfg.standalone.StandaloneTransactionContextFactory;
import org.camunda.bpm.engine.impl.cmmn.CaseServiceImpl;
import org.camunda.bpm.engine.impl.cmmn.deployer.CmmnDeployer;
import org.camunda.bpm.engine.impl.cmmn.entity.repository.CaseDefinitionManager;
import org.camunda.bpm.engine.impl.cmmn.entity.runtime.CaseExecutionManager;
import org.camunda.bpm.engine.impl.cmmn.entity.runtime.CaseSentryPartManager;
import org.camunda.bpm.engine.impl.cmmn.handler.DefaultCmmnElementHandlerRegistry;
import org.camunda.bpm.engine.impl.cmmn.transformer.CmmnTransformFactory;
import org.camunda.bpm.engine.impl.cmmn.transformer.CmmnTransformListener;
import org.camunda.bpm.engine.impl.cmmn.transformer.CmmnTransformer;
import org.camunda.bpm.engine.impl.cmmn.transformer.DefaultCmmnTransformFactory;
import org.camunda.bpm.engine.impl.db.DbIdGenerator;
import org.camunda.bpm.engine.impl.db.entitymanager.DbEntityManagerFactory;
import org.camunda.bpm.engine.impl.db.entitymanager.cache.DbEntityCacheKeyMapping;
import org.camunda.bpm.engine.impl.db.sql.DbSqlPersistenceProviderFactory;
import org.camunda.bpm.engine.impl.db.sql.DbSqlSessionFactory;
import org.camunda.bpm.engine.impl.delegate.DefaultDelegateInterceptor;
import org.camunda.bpm.engine.impl.digest.Default16ByteSaltGenerator;
import org.camunda.bpm.engine.impl.digest.PasswordEncryptor;
import org.camunda.bpm.engine.impl.digest.PasswordManager;
import org.camunda.bpm.engine.impl.digest.SaltGenerator;
import org.camunda.bpm.engine.impl.digest.Sha512HashDigest;
import org.camunda.bpm.engine.impl.dmn.configuration.DmnEngineConfigurationBuilder;
import org.camunda.bpm.engine.impl.dmn.deployer.DecisionDefinitionDeployer;
import org.camunda.bpm.engine.impl.dmn.deployer.DecisionRequirementsDefinitionDeployer;
import org.camunda.bpm.engine.impl.dmn.entity.repository.DecisionDefinitionManager;
import org.camunda.bpm.engine.impl.dmn.entity.repository.DecisionRequirementsDefinitionManager;
import org.camunda.bpm.engine.impl.el.CommandContextFunctionMapper;
import org.camunda.bpm.engine.impl.el.DateTimeFunctionMapper;
import org.camunda.bpm.engine.impl.el.ExpressionManager;
import org.camunda.bpm.engine.impl.event.CompensationEventHandler;
import org.camunda.bpm.engine.impl.event.ConditionalEventHandler;
import org.camunda.bpm.engine.impl.event.EventHandler;
import org.camunda.bpm.engine.impl.event.EventHandlerImpl;
import org.camunda.bpm.engine.impl.event.EventType;
import org.camunda.bpm.engine.impl.event.SignalEventHandler;
import org.camunda.bpm.engine.impl.externaltask.DefaultExternalTaskPriorityProvider;
import org.camunda.bpm.engine.impl.form.engine.FormEngine;
import org.camunda.bpm.engine.impl.form.engine.HtmlFormEngine;
import org.camunda.bpm.engine.impl.form.engine.JuelFormEngine;
import org.camunda.bpm.engine.impl.form.type.AbstractFormFieldType;
import org.camunda.bpm.engine.impl.form.type.BooleanFormType;
import org.camunda.bpm.engine.impl.form.type.DateFormType;
import org.camunda.bpm.engine.impl.form.type.FormTypes;
import org.camunda.bpm.engine.impl.form.type.LongFormType;
import org.camunda.bpm.engine.impl.form.type.StringFormType;
import org.camunda.bpm.engine.impl.form.validator.FormFieldValidator;
import org.camunda.bpm.engine.impl.form.validator.FormValidators;
import org.camunda.bpm.engine.impl.form.validator.MaxLengthValidator;
import org.camunda.bpm.engine.impl.form.validator.MaxValidator;
import org.camunda.bpm.engine.impl.form.validator.MinLengthValidator;
import org.camunda.bpm.engine.impl.form.validator.MinValidator;
import org.camunda.bpm.engine.impl.form.validator.ReadOnlyValidator;
import org.camunda.bpm.engine.impl.form.validator.RequiredValidator;
import org.camunda.bpm.engine.impl.history.HistoryLevel;
import org.camunda.bpm.engine.impl.history.event.HistoricDecisionInstanceManager;
import org.camunda.bpm.engine.impl.history.handler.DbHistoryEventHandler;
import org.camunda.bpm.engine.impl.history.handler.HistoryEventHandler;
import org.camunda.bpm.engine.impl.history.parser.HistoryParseListener;
import org.camunda.bpm.engine.impl.history.producer.CacheAwareCmmnHistoryEventProducer;
import org.camunda.bpm.engine.impl.history.producer.CacheAwareHistoryEventProducer;
import org.camunda.bpm.engine.impl.history.producer.CmmnHistoryEventProducer;
import org.camunda.bpm.engine.impl.history.producer.DefaultDmnHistoryEventProducer;
import org.camunda.bpm.engine.impl.history.producer.DmnHistoryEventProducer;
import org.camunda.bpm.engine.impl.history.producer.HistoryEventProducer;
import org.camunda.bpm.engine.impl.history.transformer.CmmnHistoryTransformListener;
import org.camunda.bpm.engine.impl.identity.ReadOnlyIdentityProvider;
import org.camunda.bpm.engine.impl.identity.WritableIdentityProvider;
import org.camunda.bpm.engine.impl.identity.db.DbIdentityServiceProvider;
import org.camunda.bpm.engine.impl.incident.DefaultIncidentHandler;
import org.camunda.bpm.engine.impl.incident.IncidentHandler;
import org.camunda.bpm.engine.impl.interceptor.CommandContextFactory;
import org.camunda.bpm.engine.impl.interceptor.CommandExecutor;
import org.camunda.bpm.engine.impl.interceptor.CommandExecutorImpl;
import org.camunda.bpm.engine.impl.interceptor.CommandInterceptor;
import org.camunda.bpm.engine.impl.interceptor.DelegateInterceptor;
import org.camunda.bpm.engine.impl.interceptor.SessionFactory;
import org.camunda.bpm.engine.impl.jobexecutor.AsyncContinuationJobHandler;
import org.camunda.bpm.engine.impl.jobexecutor.DefaultFailedJobCommandFactory;
import org.camunda.bpm.engine.impl.jobexecutor.DefaultJobExecutor;
import org.camunda.bpm.engine.impl.jobexecutor.DefaultJobPriorityProvider;
import org.camunda.bpm.engine.impl.jobexecutor.FailedJobCommandFactory;
import org.camunda.bpm.engine.impl.jobexecutor.JobDeclaration;
import org.camunda.bpm.engine.impl.jobexecutor.JobExecutor;
import org.camunda.bpm.engine.impl.jobexecutor.JobHandler;
import org.camunda.bpm.engine.impl.jobexecutor.NotifyAcquisitionRejectedJobsHandler;
import org.camunda.bpm.engine.impl.jobexecutor.ProcessEventJobHandler;
import org.camunda.bpm.engine.impl.jobexecutor.RejectedJobsHandler;
import org.camunda.bpm.engine.impl.jobexecutor.TimerActivateJobDefinitionHandler;
import org.camunda.bpm.engine.impl.jobexecutor.TimerActivateProcessDefinitionHandler;
import org.camunda.bpm.engine.impl.jobexecutor.TimerCatchIntermediateEventJobHandler;
import org.camunda.bpm.engine.impl.jobexecutor.TimerExecuteNestedActivityJobHandler;
import org.camunda.bpm.engine.impl.jobexecutor.TimerStartEventJobHandler;
import org.camunda.bpm.engine.impl.jobexecutor.TimerStartEventSubprocessJobHandler;
import org.camunda.bpm.engine.impl.jobexecutor.TimerSuspendJobDefinitionHandler;
import org.camunda.bpm.engine.impl.jobexecutor.TimerSuspendProcessDefinitionHandler;
import org.camunda.bpm.engine.impl.jobexecutor.historycleanup.HistoryCleanupBatch;
import org.camunda.bpm.engine.impl.jobexecutor.historycleanup.HistoryCleanupHelper;
import org.camunda.bpm.engine.impl.jobexecutor.historycleanup.HistoryCleanupJobHandler;
import org.camunda.bpm.engine.impl.metrics.MetricsRegistry;
import org.camunda.bpm.engine.impl.metrics.MetricsReporterIdProvider;
import org.camunda.bpm.engine.impl.metrics.SimpleIpBasedProvider;
import org.camunda.bpm.engine.impl.metrics.parser.MetricsBpmnParseListener;
import org.camunda.bpm.engine.impl.metrics.parser.MetricsCmmnTransformListener;
import org.camunda.bpm.engine.impl.metrics.reporter.DbMetricsReporter;
import org.camunda.bpm.engine.impl.migration.DefaultMigrationActivityMatcher;
import org.camunda.bpm.engine.impl.migration.DefaultMigrationInstructionGenerator;
import org.camunda.bpm.engine.impl.migration.MigrationActivityMatcher;
import org.camunda.bpm.engine.impl.migration.MigrationInstructionGenerator;
import org.camunda.bpm.engine.impl.migration.batch.MigrationBatchJobHandler;
import org.camunda.bpm.engine.impl.migration.validation.activity.MigrationActivityValidator;
import org.camunda.bpm.engine.impl.migration.validation.activity.NoCompensationHandlerActivityValidator;
import org.camunda.bpm.engine.impl.migration.validation.activity.SupportedActivityValidator;
import org.camunda.bpm.engine.impl.migration.validation.activity.SupportedPassiveEventTriggerActivityValidator;
import org.camunda.bpm.engine.impl.migration.validation.instance.AsyncAfterMigrationValidator;
import org.camunda.bpm.engine.impl.migration.validation.instance.AsyncMigrationValidator;
import org.camunda.bpm.engine.impl.migration.validation.instance.AsyncProcessStartMigrationValidator;
import org.camunda.bpm.engine.impl.migration.validation.instance.MigratingActivityInstanceValidator;
import org.camunda.bpm.engine.impl.migration.validation.instance.MigratingCompensationInstanceValidator;
import org.camunda.bpm.engine.impl.migration.validation.instance.MigratingTransitionInstanceValidator;
import org.camunda.bpm.engine.impl.migration.validation.instance.NoUnmappedCompensationStartEventValidator;
import org.camunda.bpm.engine.impl.migration.validation.instance.NoUnmappedLeafInstanceValidator;
import org.camunda.bpm.engine.impl.migration.validation.instance.SupportedActivityInstanceValidator;
import org.camunda.bpm.engine.impl.migration.validation.instance.VariableConflictActivityInstanceValidator;
import org.camunda.bpm.engine.impl.migration.validation.instruction.AdditionalFlowScopeInstructionValidator;
import org.camunda.bpm.engine.impl.migration.validation.instruction.CannotAddMultiInstanceBodyValidator;
import org.camunda.bpm.engine.impl.migration.validation.instruction.CannotAddMultiInstanceInnerActivityValidator;
import org.camunda.bpm.engine.impl.migration.validation.instruction.CannotRemoveMultiInstanceInnerActivityValidator;
import org.camunda.bpm.engine.impl.migration.validation.instruction.ConditionalEventUpdateEventTriggerValidator;
import org.camunda.bpm.engine.impl.migration.validation.instruction.GatewayMappingValidator;
import org.camunda.bpm.engine.impl.migration.validation.instruction.MigrationInstructionValidator;
import org.camunda.bpm.engine.impl.migration.validation.instruction.OnlyOnceMappedActivityInstructionValidator;
import org.camunda.bpm.engine.impl.migration.validation.instruction.SameBehaviorInstructionValidator;
import org.camunda.bpm.engine.impl.migration.validation.instruction.SameEventScopeInstructionValidator;
import org.camunda.bpm.engine.impl.migration.validation.instruction.SameEventTypeValidator;
import org.camunda.bpm.engine.impl.migration.validation.instruction.UpdateEventTriggersValidator;
import org.camunda.bpm.engine.impl.persistence.GenericManagerFactory;
import org.camunda.bpm.engine.impl.persistence.deploy.Deployer;
import org.camunda.bpm.engine.impl.persistence.deploy.cache.CacheFactory;
import org.camunda.bpm.engine.impl.persistence.deploy.cache.DefaultCacheFactory;
import org.camunda.bpm.engine.impl.persistence.deploy.cache.DeploymentCache;
import org.camunda.bpm.engine.impl.persistence.entity.AttachmentManager;
import org.camunda.bpm.engine.impl.persistence.entity.AuthorizationManager;
import org.camunda.bpm.engine.impl.persistence.entity.BatchManager;
import org.camunda.bpm.engine.impl.persistence.entity.ByteArrayManager;
import org.camunda.bpm.engine.impl.persistence.entity.CommentManager;
import org.camunda.bpm.engine.impl.persistence.entity.DeploymentManager;
import org.camunda.bpm.engine.impl.persistence.entity.EventSubscriptionManager;
import org.camunda.bpm.engine.impl.persistence.entity.ExecutionManager;
import org.camunda.bpm.engine.impl.persistence.entity.ExternalTaskManager;
import org.camunda.bpm.engine.impl.persistence.entity.FilterManager;
import org.camunda.bpm.engine.impl.persistence.entity.HistoricActivityInstanceManager;
import org.camunda.bpm.engine.impl.persistence.entity.HistoricBatchManager;
import org.camunda.bpm.engine.impl.persistence.entity.HistoricCaseActivityInstanceManager;
import org.camunda.bpm.engine.impl.persistence.entity.HistoricCaseInstanceManager;
import org.camunda.bpm.engine.impl.persistence.entity.HistoricDetailManager;
import org.camunda.bpm.engine.impl.persistence.entity.HistoricExternalTaskLogManager;
import org.camunda.bpm.engine.impl.persistence.entity.HistoricIdentityLinkLogManager;
import org.camunda.bpm.engine.impl.persistence.entity.HistoricIncidentManager;
import org.camunda.bpm.engine.impl.persistence.entity.HistoricJobLogManager;
import org.camunda.bpm.engine.impl.persistence.entity.HistoricProcessInstanceManager;
import org.camunda.bpm.engine.impl.persistence.entity.HistoricStatisticsManager;
import org.camunda.bpm.engine.impl.persistence.entity.HistoricTaskInstanceManager;
import org.camunda.bpm.engine.impl.persistence.entity.HistoricVariableInstanceManager;
import org.camunda.bpm.engine.impl.persistence.entity.IdentityInfoManager;
import org.camunda.bpm.engine.impl.persistence.entity.IdentityLinkManager;
import org.camunda.bpm.engine.impl.persistence.entity.IncidentManager;
import org.camunda.bpm.engine.impl.persistence.entity.JobDefinitionManager;
import org.camunda.bpm.engine.impl.persistence.entity.JobManager;
import org.camunda.bpm.engine.impl.persistence.entity.MeterLogManager;
import org.camunda.bpm.engine.impl.persistence.entity.ProcessDefinitionManager;
import org.camunda.bpm.engine.impl.persistence.entity.PropertyManager;
import org.camunda.bpm.engine.impl.persistence.entity.ReportManager;
import org.camunda.bpm.engine.impl.persistence.entity.ResourceManager;
import org.camunda.bpm.engine.impl.persistence.entity.StatisticsManager;
import org.camunda.bpm.engine.impl.persistence.entity.TableDataManager;
import org.camunda.bpm.engine.impl.persistence.entity.TaskManager;
import org.camunda.bpm.engine.impl.persistence.entity.TaskReportManager;
import org.camunda.bpm.engine.impl.persistence.entity.TenantManager;
import org.camunda.bpm.engine.impl.persistence.entity.UserOperationLogManager;
import org.camunda.bpm.engine.impl.persistence.entity.VariableInstanceManager;
import org.camunda.bpm.engine.impl.runtime.CorrelationHandler;
import org.camunda.bpm.engine.impl.runtime.DefaultCorrelationHandler;
import org.camunda.bpm.engine.impl.scripting.ScriptFactory;
import org.camunda.bpm.engine.impl.scripting.engine.BeansResolverFactory;
import org.camunda.bpm.engine.impl.scripting.engine.ResolverFactory;
import org.camunda.bpm.engine.impl.scripting.engine.ScriptBindingsFactory;
import org.camunda.bpm.engine.impl.scripting.engine.ScriptingEngines;
import org.camunda.bpm.engine.impl.scripting.engine.VariableScopeResolverFactory;
import org.camunda.bpm.engine.impl.scripting.env.ScriptEnvResolver;
import org.camunda.bpm.engine.impl.scripting.env.ScriptingEnvironment;
import org.camunda.bpm.engine.impl.util.IoUtil;
import org.camunda.bpm.engine.impl.util.ReflectUtil;
import org.camunda.bpm.engine.impl.variable.ValueTypeResolverImpl;
import org.camunda.bpm.engine.impl.variable.serializer.BooleanValueSerializer;
import org.camunda.bpm.engine.impl.variable.serializer.ByteArrayValueSerializer;
import org.camunda.bpm.engine.impl.variable.serializer.DateValueSerializer;
import org.camunda.bpm.engine.impl.variable.serializer.DefaultVariableSerializers;
import org.camunda.bpm.engine.impl.variable.serializer.DoubleValueSerializer;
import org.camunda.bpm.engine.impl.variable.serializer.FileValueSerializer;
import org.camunda.bpm.engine.impl.variable.serializer.IntegerValueSerializer;
import org.camunda.bpm.engine.impl.variable.serializer.JavaObjectSerializer;
import org.camunda.bpm.engine.impl.variable.serializer.LongValueSerlializer;
import org.camunda.bpm.engine.impl.variable.serializer.NullValueSerializer;
import org.camunda.bpm.engine.impl.variable.serializer.ShortValueSerializer;
import org.camunda.bpm.engine.impl.variable.serializer.StringValueSerializer;
import org.camunda.bpm.engine.impl.variable.serializer.TypedValueSerializer;
import org.camunda.bpm.engine.impl.variable.serializer.VariableSerializerFactory;
import org.camunda.bpm.engine.impl.variable.serializer.VariableSerializers;
import org.camunda.bpm.engine.impl.variable.serializer.jpa.EntityManagerSession;
import org.camunda.bpm.engine.impl.variable.serializer.jpa.EntityManagerSessionFactory;
import org.camunda.bpm.engine.impl.variable.serializer.jpa.JPAVariableSerializer;
import org.camunda.bpm.engine.management.Metrics;
import org.camunda.bpm.engine.repository.DeploymentBuilder;
import org.camunda.bpm.engine.runtime.Incident;
import org.camunda.bpm.engine.test.mock.MocksResolverFactory;
import org.camunda.bpm.engine.variable.Variables;
import org.camunda.bpm.engine.variable.type.ValueType;
/**
* @author Tom Baeyens
*/
public abstract class ProcessEngineConfigurationImpl extends ProcessEngineConfiguration {
protected final static ConfigurationLogger LOG = ConfigurationLogger.CONFIG_LOGGER;
public static final String DB_SCHEMA_UPDATE_CREATE = "create";
public static final String DB_SCHEMA_UPDATE_DROP_CREATE = "drop-create";
public static final int HISTORYLEVEL_NONE = HistoryLevel.HISTORY_LEVEL_NONE.getId();
public static final int HISTORYLEVEL_ACTIVITY = HistoryLevel.HISTORY_LEVEL_ACTIVITY.getId();
public static final int HISTORYLEVEL_AUDIT = HistoryLevel.HISTORY_LEVEL_AUDIT.getId();
public static final int HISTORYLEVEL_FULL = HistoryLevel.HISTORY_LEVEL_FULL.getId();
public static final String DEFAULT_WS_SYNC_FACTORY = "org.camunda.bpm.engine.impl.webservice.CxfWebServiceClientFactory";
public static final String DEFAULT_MYBATIS_MAPPING_FILE = "org/camunda/bpm/engine/impl/mapping/mappings.xml";
public static final int DEFAULT_FAILED_JOB_LISTENER_MAX_RETRIES = 3;
public static SqlSessionFactory cachedSqlSessionFactory;
// SERVICES /////////////////////////////////////////////////////////////////
protected RepositoryService repositoryService = new RepositoryServiceImpl();
protected RuntimeService runtimeService = new RuntimeServiceImpl();
protected HistoryService historyService = new HistoryServiceImpl();
protected IdentityService identityService = new IdentityServiceImpl();
protected TaskService taskService = new TaskServiceImpl();
protected FormService formService = new FormServiceImpl();
protected ManagementService managementService = new ManagementServiceImpl();
protected AuthorizationService authorizationService = new AuthorizationServiceImpl();
protected CaseService caseService = new CaseServiceImpl();
protected FilterService filterService = new FilterServiceImpl();
protected ExternalTaskService externalTaskService = new ExternalTaskServiceImpl();
protected DecisionService decisionService = new DecisionServiceImpl();
// COMMAND EXECUTORS ////////////////////////////////////////////////////////
// Command executor and interceptor stack
/**
* the configurable list which will be {@link #initInterceptorChain(java.util.List) processed} to build the {@link #commandExecutorTxRequired}
*/
protected List<CommandInterceptor> customPreCommandInterceptorsTxRequired;
protected List<CommandInterceptor> customPostCommandInterceptorsTxRequired;
protected List<CommandInterceptor> commandInterceptorsTxRequired;
/**
* this will be initialized during the configurationComplete()
*/
protected CommandExecutor commandExecutorTxRequired;
/**
* the configurable list which will be {@link #initInterceptorChain(List) processed} to build the {@link #commandExecutorTxRequiresNew}
*/
protected List<CommandInterceptor> customPreCommandInterceptorsTxRequiresNew;
protected List<CommandInterceptor> customPostCommandInterceptorsTxRequiresNew;
protected List<CommandInterceptor> commandInterceptorsTxRequiresNew;
/**
* this will be initialized during the configurationComplete()
*/
protected CommandExecutor commandExecutorTxRequiresNew;
/**
* Separate command executor to be used for db schema operations. Must always use NON-JTA transactions
*/
protected CommandExecutor commandExecutorSchemaOperations;
// SESSION FACTORIES ////////////////////////////////////////////////////////
protected List<SessionFactory> customSessionFactories;
protected DbSqlSessionFactory dbSqlSessionFactory;
protected Map<Class<?>, SessionFactory> sessionFactories;
// DEPLOYERS ////////////////////////////////////////////////////////////////
protected List<Deployer> customPreDeployers;
protected List<Deployer> customPostDeployers;
protected List<Deployer> deployers;
protected DeploymentCache deploymentCache;
// CACHE ////////////////////////////////////////////////////////////////////
protected CacheFactory cacheFactory;
protected int cacheCapacity = 1000;
protected boolean enableFetchProcessDefinitionDescription = true;
// JOB EXECUTOR /////////////////////////////////////////////////////////////
protected List<JobHandler> customJobHandlers;
protected Map<String, JobHandler> jobHandlers;
protected JobExecutor jobExecutor;
protected PriorityProvider<JobDeclaration<?, ?>> jobPriorityProvider;
// EXTERNAL TASK /////////////////////////////////////////////////////////////
protected PriorityProvider<ExternalTaskActivityBehavior> externalTaskPriorityProvider;
// MYBATIS SQL SESSION FACTORY //////////////////////////////////////////////
protected SqlSessionFactory sqlSessionFactory;
protected TransactionFactory transactionFactory;
// ID GENERATOR /////////////////////////////////////////////////////////////
protected IdGenerator idGenerator;
protected DataSource idGeneratorDataSource;
protected String idGeneratorDataSourceJndiName;
// INCIDENT HANDLER /////////////////////////////////////////////////////////
protected Map<String, IncidentHandler> incidentHandlers;
protected List<IncidentHandler> customIncidentHandlers;
// BATCH ////////////////////////////////////////////////////////////////////
protected Map<String, BatchJobHandler<?>> batchHandlers;
protected List<BatchJobHandler<?>> customBatchJobHandlers;
/**
* Number of jobs created by a batch seed job invocation
*/
protected int batchJobsPerSeed = 100;
/**
* Number of invocations executed by a single batch job
*/
protected int invocationsPerBatchJob = 1;
/**
* seconds to wait between polling for batch completion
*/
protected int batchPollTime = 30;
/**
* default priority for batch jobs
*/
protected long batchJobPriority = DefaultJobPriorityProvider.DEFAULT_PRIORITY;
// OTHER ////////////////////////////////////////////////////////////////////
protected List<FormEngine> customFormEngines;
protected Map<String, FormEngine> formEngines;
protected List<AbstractFormFieldType> customFormTypes;
protected FormTypes formTypes;
protected FormValidators formValidators;
protected Map<String, Class<? extends FormFieldValidator>> customFormFieldValidators;
protected List<TypedValueSerializer> customPreVariableSerializers;
protected List<TypedValueSerializer> customPostVariableSerializers;
protected VariableSerializers variableSerializers;
protected VariableSerializerFactory fallbackSerializerFactory;
protected String defaultSerializationFormat = Variables.SerializationDataFormats.JAVA.getName();
protected String defaultCharsetName = null;
protected Charset defaultCharset = null;
protected ExpressionManager expressionManager;
protected ScriptingEngines scriptingEngines;
protected List<ResolverFactory> resolverFactories;
protected ScriptingEnvironment scriptingEnvironment;
protected List<ScriptEnvResolver> scriptEnvResolvers;
protected ScriptFactory scriptFactory;
protected boolean autoStoreScriptVariables = false;
protected boolean enableScriptCompilation = true;
protected boolean enableScriptEngineCaching = true;
protected boolean enableFetchScriptEngineFromProcessApplication = true;
protected boolean cmmnEnabled = true;
protected boolean dmnEnabled = true;
protected boolean enableGracefulDegradationOnContextSwitchFailure = true;
protected BusinessCalendarManager businessCalendarManager;
protected String wsSyncFactoryClassName = DEFAULT_WS_SYNC_FACTORY;
protected CommandContextFactory commandContextFactory;
protected TransactionContextFactory transactionContextFactory;
protected BpmnParseFactory bpmnParseFactory;
// cmmn
protected CmmnTransformFactory cmmnTransformFactory;
protected DefaultCmmnElementHandlerRegistry cmmnElementHandlerRegistry;
// dmn
protected DefaultDmnEngineConfiguration dmnEngineConfiguration;
protected DmnEngine dmnEngine;
protected HistoryLevel historyLevel;
/**
* a list of supported history levels
*/
protected List<HistoryLevel> historyLevels;
/**
* a list of supported custom history levels
*/
protected List<HistoryLevel> customHistoryLevels;
protected List<BpmnParseListener> preParseListeners;
protected List<BpmnParseListener> postParseListeners;
protected List<CmmnTransformListener> customPreCmmnTransformListeners;
protected List<CmmnTransformListener> customPostCmmnTransformListeners;
protected Map<Object, Object> beans;
protected boolean isDbIdentityUsed = true;
protected boolean isDbHistoryUsed = true;
protected DelegateInterceptor delegateInterceptor;
protected CommandInterceptor actualCommandExecutor;
protected RejectedJobsHandler customRejectedJobsHandler;
protected Map<String, EventHandler> eventHandlers;
protected List<EventHandler> customEventHandlers;
protected FailedJobCommandFactory failedJobCommandFactory;
protected String databaseTablePrefix = "";
/**
* In some situations you want to set the schema to use for table checks / generation if the database metadata
* doesn't return that correctly, see https://jira.codehaus.org/browse/ACT-1220,
* https://jira.codehaus.org/browse/ACT-1062
*/
protected String databaseSchema = null;
protected boolean isCreateDiagramOnDeploy = false;
protected ProcessApplicationManager processApplicationManager;
protected CorrelationHandler correlationHandler;
/**
* session factory to be used for obtaining identity provider sessions
*/
protected SessionFactory identityProviderSessionFactory;
protected PasswordEncryptor passwordEncryptor;
protected List<PasswordEncryptor> customPasswordChecker;
protected PasswordManager passwordManager;
protected SaltGenerator saltGenerator;
protected Set<String> registeredDeployments;
protected ResourceAuthorizationProvider resourceAuthorizationProvider;
protected List<ProcessEnginePlugin> processEnginePlugins = new ArrayList<ProcessEnginePlugin>();
protected HistoryEventProducer historyEventProducer;
protected CmmnHistoryEventProducer cmmnHistoryEventProducer;
protected DmnHistoryEventProducer dmnHistoryEventProducer;
protected HistoryEventHandler historyEventHandler;
protected boolean isExecutionTreePrefetchEnabled = true;
/**
* If true the process engine will attempt to acquire an exclusive lock before
* creating a deployment.
*/
protected boolean isDeploymentLockUsed = true;
/**
* If true then several deployments will be processed strictly sequentally. When false they may be processed in parallel.
*/
protected boolean isDeploymentSynchronized = true;
/**
* Allows setting whether the process engine should try reusing the first level entity cache.
* Default setting is false, enabling it improves performance of asynchronous continuations.
*/
protected boolean isDbEntityCacheReuseEnabled = false;
protected boolean isInvokeCustomVariableListeners = true;
/**
* The process engine created by this configuration.
*/
protected ProcessEngineImpl processEngine;
/**
* used to create instances for listeners, JavaDelegates, etc
*/
protected ArtifactFactory artifactFactory;
protected DbEntityCacheKeyMapping dbEntityCacheKeyMapping = DbEntityCacheKeyMapping.defaultEntityCacheKeyMapping();
/**
* the metrics registry
*/
protected MetricsRegistry metricsRegistry;
protected DbMetricsReporter dbMetricsReporter;
protected boolean isMetricsEnabled = true;
protected boolean isDbMetricsReporterActivate = true;
protected MetricsReporterIdProvider metricsReporterIdProvider;
/**
* handling of expressions submitted via API; can be used as guards against remote code execution
*/
protected boolean enableExpressionsInAdhocQueries = false;
protected boolean enableExpressionsInStoredQueries = true;
/**
* If true, user operation log entries are only written if there is an
* authenticated user present in the context. If false, user operation log
* entries are written regardless of authentication state.
*/
protected boolean restrictUserOperationLogToAuthenticatedUsers = true;
protected boolean disableStrictCallActivityValidation = false;
protected boolean isBpmnStacktraceVerbose = false;
protected boolean forceCloseMybatisConnectionPool = true;
protected TenantIdProvider tenantIdProvider = null;
protected List<CommandChecker> commandCheckers = null;
// Migration
protected MigrationActivityMatcher migrationActivityMatcher;
protected List<MigrationActivityValidator> customPreMigrationActivityValidators;
protected List<MigrationActivityValidator> customPostMigrationActivityValidators;
protected MigrationInstructionGenerator migrationInstructionGenerator;
protected List<MigrationInstructionValidator> customPreMigrationInstructionValidators;
protected List<MigrationInstructionValidator> customPostMigrationInstructionValidators;
protected List<MigrationInstructionValidator> migrationInstructionValidators;
protected List<MigratingActivityInstanceValidator> customPreMigratingActivityInstanceValidators;
protected List<MigratingActivityInstanceValidator> customPostMigratingActivityInstanceValidators;
protected List<MigratingActivityInstanceValidator> migratingActivityInstanceValidators;
protected List<MigratingTransitionInstanceValidator> migratingTransitionInstanceValidators;
protected List<MigratingCompensationInstanceValidator> migratingCompensationInstanceValidators;
// Default user permission for task
protected Permission defaultUserPermissionForTask;
protected boolean isUseSharedSqlSessionFactory = false;
//History cleanup configuration
private String historyCleanupBatchWindowStartTime;
private String historyCleanupBatchWindowEndTime = "00:00";
private Date historyCleanupBatchWindowStartTimeAsDate;
private Date historyCleanupBatchWindowEndTimeAsDate;
/**
* Size of batch in which history cleanup data will be deleted. {@link HistoryCleanupBatch#MAX_BATCH_SIZE} must be respected.
*/
private int historyCleanupBatchSize = 500;
/**
* Indicates the minimal amount of data to trigger the history cleanup.
*/
private int historyCleanupBatchThreshold = 10;
private int failedJobListenerMaxRetries = DEFAULT_FAILED_JOB_LISTENER_MAX_RETRIES;
// buildProcessEngine ///////////////////////////////////////////////////////
@Override
public ProcessEngine buildProcessEngine() {
init();
processEngine = new ProcessEngineImpl(this);
invokePostProcessEngineBuild(processEngine);
return processEngine;
}
// init /////////////////////////////////////////////////////////////////////
protected void init() {
invokePreInit();
initDefaultCharset();
initHistoryLevel();
initHistoryEventProducer();
initCmmnHistoryEventProducer();
initDmnHistoryEventProducer();
initHistoryEventHandler();
initExpressionManager();
initBeans();
initArtifactFactory();
initFormEngines();
initFormTypes();
initFormFieldValidators();
initScripting();
initDmnEngine();
initBusinessCalendarManager();
initCommandContextFactory();
initTransactionContextFactory();
initCommandExecutors();
initServices();
initIdGenerator();
initDeployers();
initJobProvider();
initExternalTaskPriorityProvider();
initBatchHandlers();
initJobExecutor();
initDataSource();
initTransactionFactory();
initSqlSessionFactory();
initIdentityProviderSessionFactory();
initSessionFactories();
initValueTypeResolver();
initSerialization();
initJpa();
initDelegateInterceptor();
initEventHandlers();
initFailedJobCommandFactory();
initProcessApplicationManager();
initCorrelationHandler();
initIncidentHandlers();
initPasswordDigest();
initDeploymentRegistration();
initResourceAuthorizationProvider();
initMetrics();
initMigration();
initCommandCheckers();
initDefaultUserPermissionForTask();
initHistoryCleanup();
invokePostInit();
}
public void initHistoryCleanup() {
if (historyCleanupBatchWindowStartTime != null) {
initHistoryCleanupBatchWindowStartTime();
}
if (historyCleanupBatchWindowEndTime != null) {
initHistoryCleanupBatchWindowEndTime();
}
if (historyCleanupBatchSize > HistoryCleanupBatch.MAX_BATCH_SIZE) {
throw LOG.invalidPropertyValue("historyCleanupBatchSize", String.valueOf(historyCleanupBatchSize),
String.format("maximum value for batch size is %s", HistoryCleanupBatch.MAX_BATCH_SIZE));
}
}
private void initHistoryCleanupBatchWindowEndTime() {
try {
historyCleanupBatchWindowEndTimeAsDate = HistoryCleanupHelper.parseTimeConfiguration(historyCleanupBatchWindowEndTime);
} catch (ParseException e) {
throw LOG.invalidPropertyValue("historyCleanupBatchWindowEndTime", historyCleanupBatchWindowEndTime);
}
}
private void initHistoryCleanupBatchWindowStartTime() {
try {
historyCleanupBatchWindowStartTimeAsDate = HistoryCleanupHelper.parseTimeConfiguration(historyCleanupBatchWindowStartTime);
} catch (ParseException e) {
throw LOG.invalidPropertyValue("historyCleanupBatchWindowStartTime", historyCleanupBatchWindowStartTime);
}
}
protected void invokePreInit() {
for (ProcessEnginePlugin plugin : processEnginePlugins) {
LOG.pluginActivated(plugin.toString(), getProcessEngineName());
plugin.preInit(this);
}
}
protected void invokePostInit() {
for (ProcessEnginePlugin plugin : processEnginePlugins) {
plugin.postInit(this);
}
}
protected void invokePostProcessEngineBuild(ProcessEngine engine) {
for (ProcessEnginePlugin plugin : processEnginePlugins) {
plugin.postProcessEngineBuild(engine);
}
}
// failedJobCommandFactory ////////////////////////////////////////////////////////
protected void initFailedJobCommandFactory() {
if (failedJobCommandFactory == null) {
failedJobCommandFactory = new DefaultFailedJobCommandFactory();
}
}
// incident handlers /////////////////////////////////////////////////////////////
protected void initIncidentHandlers() {
if (incidentHandlers == null) {
incidentHandlers = new HashMap<String, IncidentHandler>();
DefaultIncidentHandler failedJobIncidentHandler = new DefaultIncidentHandler(Incident.FAILED_JOB_HANDLER_TYPE);
incidentHandlers.put(failedJobIncidentHandler.getIncidentHandlerType(), failedJobIncidentHandler);
DefaultIncidentHandler failedExternalTaskIncidentHandler = new DefaultIncidentHandler(Incident.EXTERNAL_TASK_HANDLER_TYPE);
incidentHandlers.put(failedExternalTaskIncidentHandler.getIncidentHandlerType(), failedExternalTaskIncidentHandler);
}
if (customIncidentHandlers != null) {
for (IncidentHandler incidentHandler : customIncidentHandlers) {
incidentHandlers.put(incidentHandler.getIncidentHandlerType(), incidentHandler);
}
}
}
// batch ///////////////////////////////////////////////////////////////////////
protected void initBatchHandlers() {
if (batchHandlers == null) {
batchHandlers = new HashMap<String, BatchJobHandler<?>>();
MigrationBatchJobHandler migrationHandler = new MigrationBatchJobHandler();
batchHandlers.put(migrationHandler.getType(), migrationHandler);
ModificationBatchJobHandler modificationHandler = new ModificationBatchJobHandler();
batchHandlers.put(modificationHandler.getType(), modificationHandler);
DeleteProcessInstancesJobHandler deleteProcessJobHandler = new DeleteProcessInstancesJobHandler();
batchHandlers.put(deleteProcessJobHandler.getType(), deleteProcessJobHandler);
DeleteHistoricProcessInstancesJobHandler deleteHistoricProcessInstancesJobHandler = new DeleteHistoricProcessInstancesJobHandler();
batchHandlers.put(deleteHistoricProcessInstancesJobHandler.getType(), deleteHistoricProcessInstancesJobHandler);
SetJobRetriesJobHandler setJobRetriesJobHandler = new SetJobRetriesJobHandler();
batchHandlers.put(setJobRetriesJobHandler.getType(), setJobRetriesJobHandler);
SetExternalTaskRetriesJobHandler setExternalTaskRetriesJobHandler = new SetExternalTaskRetriesJobHandler();
batchHandlers.put(setExternalTaskRetriesJobHandler.getType(), setExternalTaskRetriesJobHandler);
RestartProcessInstancesJobHandler restartProcessInstancesJobHandler = new RestartProcessInstancesJobHandler();
batchHandlers.put(restartProcessInstancesJobHandler.getType(), restartProcessInstancesJobHandler);
}
if (customBatchJobHandlers != null) {
for (BatchJobHandler<?> customBatchJobHandler : customBatchJobHandlers) {
batchHandlers.put(customBatchJobHandler.getType(), customBatchJobHandler);
}
}
}
// command executors ////////////////////////////////////////////////////////
protected abstract Collection<? extends CommandInterceptor> getDefaultCommandInterceptorsTxRequired();
protected abstract Collection<? extends CommandInterceptor> getDefaultCommandInterceptorsTxRequiresNew();
protected void initCommandExecutors() {
initActualCommandExecutor();
initCommandInterceptorsTxRequired();
initCommandExecutorTxRequired();
initCommandInterceptorsTxRequiresNew();
initCommandExecutorTxRequiresNew();
initCommandExecutorDbSchemaOperations();
}
protected void initActualCommandExecutor() {
actualCommandExecutor = new CommandExecutorImpl();
}
protected void initCommandInterceptorsTxRequired() {
if (commandInterceptorsTxRequired == null) {
if (customPreCommandInterceptorsTxRequired != null) {
commandInterceptorsTxRequired = new ArrayList<CommandInterceptor>(customPreCommandInterceptorsTxRequired);
} else {
commandInterceptorsTxRequired = new ArrayList<CommandInterceptor>();
}
commandInterceptorsTxRequired.addAll(getDefaultCommandInterceptorsTxRequired());
if (customPostCommandInterceptorsTxRequired != null) {
commandInterceptorsTxRequired.addAll(customPostCommandInterceptorsTxRequired);
}
commandInterceptorsTxRequired.add(actualCommandExecutor);
}
}
protected void initCommandInterceptorsTxRequiresNew() {
if (commandInterceptorsTxRequiresNew == null) {
if (customPreCommandInterceptorsTxRequiresNew != null) {
commandInterceptorsTxRequiresNew = new ArrayList<CommandInterceptor>(customPreCommandInterceptorsTxRequiresNew);
} else {
commandInterceptorsTxRequiresNew = new ArrayList<CommandInterceptor>();
}
commandInterceptorsTxRequiresNew.addAll(getDefaultCommandInterceptorsTxRequiresNew());
if (customPostCommandInterceptorsTxRequiresNew != null) {
commandInterceptorsTxRequiresNew.addAll(customPostCommandInterceptorsTxRequiresNew);
}
commandInterceptorsTxRequiresNew.add(actualCommandExecutor);
}
}
protected void initCommandExecutorTxRequired() {
if (commandExecutorTxRequired == null) {
commandExecutorTxRequired = initInterceptorChain(commandInterceptorsTxRequired);
}
}
protected void initCommandExecutorTxRequiresNew() {
if (commandExecutorTxRequiresNew == null) {
commandExecutorTxRequiresNew = initInterceptorChain(commandInterceptorsTxRequiresNew);
}
}
protected void initCommandExecutorDbSchemaOperations() {
if (commandExecutorSchemaOperations == null) {
// in default case, we use the same command executor for DB Schema Operations as for runtime operations.
// configurations that Use JTA Transactions should override this method and provide a custom command executor
// that uses NON-JTA Transactions.
commandExecutorSchemaOperations = commandExecutorTxRequired;
}
}
protected CommandInterceptor initInterceptorChain(List<CommandInterceptor> chain) {
if (chain == null || chain.isEmpty()) {
throw new ProcessEngineException("invalid command interceptor chain configuration: " + chain);
}
for (int i = 0; i < chain.size() - 1; i++) {
chain.get(i).setNext(chain.get(i + 1));
}
return chain.get(0);
}
// services /////////////////////////////////////////////////////////////////
protected void initServices() {
initService(repositoryService);
initService(runtimeService);
initService(historyService);
initService(identityService);
initService(taskService);
initService(formService);
initService(managementService);
initService(authorizationService);
initService(caseService);
initService(filterService);
initService(externalTaskService);
initService(decisionService);
}
protected void initService(Object service) {
if (service instanceof ServiceImpl) {
((ServiceImpl) service).setCommandExecutor(commandExecutorTxRequired);
}
if (service instanceof RepositoryServiceImpl) {
((RepositoryServiceImpl) service).setDeploymentCharset(getDefaultCharset());
}
}
// DataSource ///////////////////////////////////////////////////////////////
protected void initDataSource() {
if (dataSource == null) {
if (dataSourceJndiName != null) {
try {
dataSource = (DataSource) new InitialContext().lookup(dataSourceJndiName);
} catch (Exception e) {
throw new ProcessEngineException("couldn't lookup datasource from " + dataSourceJndiName + ": " + e.getMessage(), e);
}
} else if (jdbcUrl != null) {
if ((jdbcDriver == null) || (jdbcUrl == null) || (jdbcUsername == null)) {