1 |
| |
2 |
| |
3 |
| |
4 |
| |
5 |
| |
6 |
| |
7 |
| |
8 |
| |
9 |
| |
10 |
| |
11 |
| |
12 |
| |
13 |
| |
14 |
| |
15 |
| package org.apache.hivemind.impl; |
16 |
| |
17 |
| import org.apache.commons.logging.Log; |
18 |
| import org.apache.commons.logging.LogFactory; |
19 |
| import org.apache.hivemind.ErrorLog; |
20 |
| import org.apache.hivemind.internal.ExtensionPoint; |
21 |
| import org.apache.hivemind.internal.Module; |
22 |
| import org.apache.hivemind.internal.Visibility; |
23 |
| import org.apache.hivemind.util.ToStringBuilder; |
24 |
| |
25 |
| |
26 |
| |
27 |
| |
28 |
| |
29 |
| |
30 |
| public abstract class AbstractExtensionPoint extends BaseLocatable implements ExtensionPoint |
31 |
| { |
32 |
| private Module _module; |
33 |
| |
34 |
| private String _extensionPointId; |
35 |
| |
36 |
| |
37 |
| private Visibility _visibility; |
38 |
| |
39 |
| |
40 |
| |
41 |
| private ErrorLog _errorLog; |
42 |
| |
43 |
2
| public synchronized String toString()
|
44 |
| { |
45 |
2
| ToStringBuilder builder = new ToStringBuilder(this);
|
46 |
2
| builder.append("extensionPointId", _extensionPointId);
|
47 |
2
| builder.append("visibility", _visibility);
|
48 |
| |
49 |
2
| extendDescription(builder);
|
50 |
| |
51 |
2
| return builder.toString();
|
52 |
| } |
53 |
| |
54 |
| |
55 |
| |
56 |
| |
57 |
| protected abstract void extendDescription(ToStringBuilder builder); |
58 |
| |
59 |
3617
| public void setExtensionPointId(String extensionPointId)
|
60 |
| { |
61 |
3617
| _extensionPointId = extensionPointId;
|
62 |
| } |
63 |
| |
64 |
12019
| public String getExtensionPointId()
|
65 |
| { |
66 |
12021
| return _extensionPointId;
|
67 |
| } |
68 |
| |
69 |
3618
| public void setModule(Module module)
|
70 |
| { |
71 |
3618
| _module = module;
|
72 |
| } |
73 |
| |
74 |
4984
| public Module getModule()
|
75 |
| { |
76 |
4984
| return _module;
|
77 |
| } |
78 |
| |
79 |
| |
80 |
| |
81 |
| |
82 |
3613
| public void setVisibility(Visibility visibility)
|
83 |
| { |
84 |
3613
| _visibility = visibility;
|
85 |
| } |
86 |
| |
87 |
| |
88 |
| |
89 |
| |
90 |
| |
91 |
| |
92 |
| |
93 |
| |
94 |
| |
95 |
| |
96 |
9680
| public boolean visibleToModule(Module module)
|
97 |
| { |
98 |
9678
| if (_visibility == Visibility.PUBLIC)
|
99 |
7830
| return true;
|
100 |
| |
101 |
1848
| return _module.equals(module);
|
102 |
| } |
103 |
| |
104 |
| |
105 |
2582
| public Log getLog()
|
106 |
| { |
107 |
2582
| return LogFactory.getLog(getExtensionPointId());
|
108 |
| } |
109 |
| |
110 |
| |
111 |
1161
| public synchronized ErrorLog getErrorLog()
|
112 |
| { |
113 |
1161
| if (_errorLog == null)
|
114 |
1018
| _errorLog = new ErrorLogImpl(_module.getErrorHandler(), getLog());
|
115 |
| |
116 |
1161
| return _errorLog;
|
117 |
| } |
118 |
| } |