1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17 package com.philemonworks.selfdiagnose.check;
18
19 import org.xml.sax.Attributes;
20
21 import com.philemonworks.selfdiagnose.DiagnoseException;
22 import com.philemonworks.selfdiagnose.DiagnoseUtil;
23 import com.philemonworks.selfdiagnose.ExecutionContext;
24 import com.philemonworks.selfdiagnose.PatternMatchingTask;
25
26
27
28
29
30 public abstract class CheckProperty extends PatternMatchingTask {
31 private static final long serialVersionUID = -1701980048760932884L;
32
33 protected static final String PARAMETER_PROPERTY = "property";
34
35
36 protected String property;
37
38
39
40
41
42
43 public void initializeFromAttributes(Attributes attributes) {
44
45 super.initializeFromAttributes(attributes);
46 this.setProperty(attributes.getValue(PARAMETER_PROPERTY));
47 }
48
49 public void setUp(ExecutionContext ctx) throws DiagnoseException {
50 super.setUp(ctx);
51 this.checkPropertyAccess();
52 }
53
54 protected void checkPropertyAccess() throws DiagnoseException {
55 DiagnoseUtil.verifyNonEmptyString(PARAMETER_PROPERTY, property,this.getClass());
56 }
57
58
59
60
61 public String getProperty() {
62 return property;
63 }
64
65
66
67
68 public void setProperty(String string) {
69 property = string;
70 }
71
72
73
74 public boolean isThisRequested(){
75 return "this".equals(property);
76 }
77 }