1 package com.guinetik.hexafun.examples.sysmon;
2
3 import com.guinetik.hexafun.HexaApp;
4 import com.guinetik.hexafun.hexa.UseCaseHandler;
5
6
7
8
9
10
11
12
13
14
15
16
17 public final class SysmonHandlers {
18
19 private SysmonHandlers() {}
20
21
22
23
24 public static class GetCpuHandler extends UseCaseHandler<Void, Double> {
25
26 public GetCpuHandler(HexaApp app) {
27 super(app);
28 }
29
30 @Override
31 public Double apply(Void input) {
32 return port(MetricsProvider.class).getCpuUsage();
33 }
34 }
35
36
37
38
39 public static class GetMemoryHandler extends UseCaseHandler<Void, Double> {
40
41 public GetMemoryHandler(HexaApp app) {
42 super(app);
43 }
44
45 @Override
46 public Double apply(Void input) {
47 return port(MetricsProvider.class).getMemoryUsage();
48 }
49 }
50
51
52
53
54 public static class GetDiskHandler extends UseCaseHandler<Void, Double> {
55
56 public GetDiskHandler(HexaApp app) {
57 super(app);
58 }
59
60 @Override
61 public Double apply(Void input) {
62 return port(MetricsProvider.class).getDiskUsage();
63 }
64 }
65
66
67
68
69
70
71 public static class GetAllMetricsHandler extends UseCaseHandler<Void, SystemMetrics> {
72
73 public GetAllMetricsHandler(HexaApp app) {
74 super(app);
75 }
76
77 @Override
78 public SystemMetrics apply(Void input) {
79 return port(MetricsProvider.class).getAllMetrics();
80 }
81 }
82 }