1
2
3
4
5
6
7
8
9
10
11 package psiprobe.controllers.cluster;
12
13 import jakarta.inject.Inject;
14 import jakarta.servlet.http.HttpServletRequest;
15 import jakarta.servlet.http.HttpServletResponse;
16
17 import org.springframework.web.servlet.ModelAndView;
18
19 import psiprobe.TomcatContainer;
20 import psiprobe.beans.ClusterWrapperBean;
21 import psiprobe.controllers.AbstractTomcatContainerController;
22 import psiprobe.model.jmx.Cluster;
23
24
25
26
27 public class BaseClusterStatsController extends AbstractTomcatContainerController {
28
29
30 @Inject
31 private ClusterWrapperBean clusterWrapper;
32
33
34 private boolean loadMembers = true;
35
36
37 private long collectionPeriod;
38
39
40
41
42
43
44 public ClusterWrapperBean getClusterWrapper() {
45 return clusterWrapper;
46 }
47
48
49
50
51
52
53 public void setClusterWrapper(ClusterWrapperBean clusterWrapper) {
54 this.clusterWrapper = clusterWrapper;
55 }
56
57
58
59
60
61
62 public boolean isLoadMembers() {
63 return loadMembers;
64 }
65
66
67
68
69
70
71 public void setLoadMembers(boolean loadMembers) {
72 this.loadMembers = loadMembers;
73 }
74
75
76
77
78
79
80 public long getCollectionPeriod() {
81 return collectionPeriod;
82 }
83
84
85
86
87
88
89 public void setCollectionPeriod(long collectionPeriod) {
90 this.collectionPeriod = collectionPeriod;
91 }
92
93 @Override
94 protected ModelAndView handleRequestInternal(HttpServletRequest request,
95 HttpServletResponse response) throws Exception {
96
97 TomcatContainer container = getContainerWrapper().getTomcatContainer();
98 Cluster cluster = getClusterWrapper().getCluster(container.getName(), container.getHostName(),
99 isLoadMembers());
100 return new ModelAndView(getViewName()).addObject("cluster", cluster)
101 .addObject("collectionPeriod", getCollectionPeriod());
102 }
103
104 }