1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 package org.kuali.rice.krms.impl.provider.repository;
17
18 import org.kuali.rice.krms.api.engine.ExecutionEnvironment;
19 import org.kuali.rice.krms.api.repository.agenda.AgendaDefinition;
20 import org.kuali.rice.krms.framework.engine.AgendaTree;
21
22
23
24
25
26
27
28 public final class LazyAgendaTree implements AgendaTree {
29
30 private final Object mutex = new Object();
31 private final AgendaDefinition agendaDefinition;
32 private final RepositoryToEngineTranslator translator;
33
34 private AgendaTree agendaTree;
35
36 public LazyAgendaTree(AgendaDefinition agendaDefinition, RepositoryToEngineTranslator translator) {
37 this.agendaDefinition = agendaDefinition;
38 this.translator = translator;
39 }
40
41 public void execute(ExecutionEnvironment environment) {
42 initialize();
43 agendaTree.execute(environment);
44 }
45
46 public void initialize() {
47
48 synchronized (mutex) {
49 if (agendaTree == null) {
50 agendaTree = translator.translateAgendaDefinitionToAgendaTree(agendaDefinition);
51 }
52 }
53 }
54
55 }