DeserializationAgentVMClassCheck.java
2.31 KB
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
/*
* Decompiled with CFR 0_118.
*
* Could not load the following classes:
* org.apache.felix.scr.annotations.Component
* org.apache.felix.scr.annotations.Properties
* org.apache.felix.scr.annotations.Property
* org.apache.felix.scr.annotations.Reference
* org.apache.felix.scr.annotations.Service
* org.apache.sling.hc.api.HealthCheck
* org.apache.sling.hc.api.Result
* org.apache.sling.hc.api.ResultLog
* org.apache.sling.hc.util.FormattingResultLog
*/
package com.adobe.cq.deserfw.impl.healthcheck;
import com.adobe.cq.deserfw.impl.intapi.DeserializationFirewallStatus;
import org.apache.felix.scr.annotations.Component;
import org.apache.felix.scr.annotations.Properties;
import org.apache.felix.scr.annotations.Property;
import org.apache.felix.scr.annotations.Reference;
import org.apache.felix.scr.annotations.Service;
import org.apache.sling.hc.api.HealthCheck;
import org.apache.sling.hc.api.Result;
import org.apache.sling.hc.api.ResultLog;
import org.apache.sling.hc.util.FormattingResultLog;
@Service(value={HealthCheck.class})
@Component
@Properties(value={@Property(name="hc.name", value={"Deserialization Firewall Attach API Readiness"}), @Property(name="hc.tags", value={"deserialization", "security"}), @Property(name="hc.mbean.name", value={"Deserialization Firewall Attach API Readiness"})})
public class DeserializationAgentVMClassCheck
implements HealthCheck {
@Reference
private DeserializationFirewallStatus firewall;
public Result execute() {
FormattingResultLog log = new FormattingResultLog();
if (this.firewall.isVMClassReady(log)) {
log.info("Deserialization firewall Attach API Readiness is in an acceptable state", new Object[0]);
} else {
log.healthCheckError("Deserialization firewall was not able to detect the VirtualMachine class of the Attach API. Please see error log for nested exception details.", new Object[0]);
}
return new Result((ResultLog)log);
}
protected void bindFirewall(DeserializationFirewallStatus deserializationFirewallStatus) {
this.firewall = deserializationFirewallStatus;
}
protected void unbindFirewall(DeserializationFirewallStatus deserializationFirewallStatus) {
if (this.firewall == deserializationFirewallStatus) {
this.firewall = null;
}
}
}