1 | package de.uka.ipd.sdq.reliability.core; |
2 | |
3 | import de.uka.ipd.sdq.pcm.repository.Interface; |
4 | import de.uka.ipd.sdq.pcm.repository.Role; |
5 | import de.uka.ipd.sdq.pcm.repository.Signature; |
6 | import de.uka.ipd.sdq.pcm.resourceenvironment.ResourceContainer; |
7 | import de.uka.ipd.sdq.pcm.resourcetype.ProcessingResourceType; |
8 | |
9 | /** |
10 | * Represents a failure type for a failure-on-demand occurrence due to an |
11 | * unavailable hardware resource. |
12 | * |
13 | * @author brosch |
14 | * |
15 | */ |
16 | public class MarkovHardwareInducedFailureType extends MarkovFailureType { |
17 | |
18 | /** |
19 | * A default id for new failure types. |
20 | */ |
21 | private static String HARDWARE_ID = "Hardware-induced failure"; |
22 | |
23 | /** |
24 | * A default name for new failure types. |
25 | */ |
26 | private static String HARDWARE_NAME = "Hardware-induced failure"; |
27 | |
28 | /** |
29 | * Creates an external hardware-induced failure type. |
30 | * |
31 | * @param evaluationType |
32 | * the degree of differentiation between failure types |
33 | * @param resoureType |
34 | * the failure causing processing resource type |
35 | * @param signature |
36 | * the system-required signature that exhibits the failure type |
37 | * @param role |
38 | * the system-required role that exhibits the failure type |
39 | * @param iface |
40 | * the system-required interface that exhibits the failure type |
41 | * @return the created failure type |
42 | */ |
43 | public static MarkovHardwareInducedFailureType createExternalFailureType( |
44 | final MarkovEvaluationType evaluationType, |
45 | final ProcessingResourceType resoureType, |
46 | final Signature signature, final Role role, final Interface iface) { |
47 | return new MarkovHardwareInducedFailureType(evaluationType, resoureType |
48 | .getId(), resoureType.getEntityName(), signature.getId(), |
49 | signature.getEntityName(), role.getId(), role.getEntityName(), |
50 | iface.getId(), iface.getEntityName()); |
51 | } |
52 | |
53 | /** |
54 | * Creates an external hardware-induced failure type. |
55 | * |
56 | * @param evaluationType |
57 | * the degree of differentiation between failure types |
58 | * @param resourceTypeId |
59 | * the ID of the resource type, as specified for a |
60 | * ProcessingResourceType in a PCM ResourceRepository model |
61 | * @param signatureId |
62 | * the ID of a signature, as specified for a system-required role |
63 | * in a PCM Repository model |
64 | * @param systemRequiredRoleId |
65 | * the ID of the system-required role, as specified in a PCM |
66 | * System model |
67 | * @return the created failure type |
68 | */ |
69 | public static MarkovHardwareInducedFailureType createExternalFailureType( |
70 | final MarkovEvaluationType evaluationType, |
71 | final String resourceTypeId, final String signatureId, |
72 | final String systemRequiredRoleId) { |
73 | return new MarkovHardwareInducedFailureType(evaluationType, |
74 | resourceTypeId, "", signatureId, "", systemRequiredRoleId, "", |
75 | "", ""); |
76 | } |
77 | |
78 | // |
79 | // /** |
80 | // * Creates an external hardware-induced failure type. |
81 | // * |
82 | // * @param resourceTypeId |
83 | // * the ID of the resource type, as specified for a |
84 | // * ProcessingResourceType in a PCM ResourceRepository model |
85 | // * @param resourceTypeName |
86 | // * the name of the resource type, as specified for a |
87 | // * ProcessingResourceType in a PCM ResourceRepository model |
88 | // * @param signatureId |
89 | // * the ID of a signature, as specified for a system-required role |
90 | // * in a PCM Repository model |
91 | // * @param signatureName |
92 | // * the name of a signature, as specified for a system-required |
93 | // * role in a PCM Repository model |
94 | // * @param systemRequiredRoleId |
95 | // * the ID of the system-required role, as specified in a PCM |
96 | // * System model |
97 | // * @param systemRequiredRoleName |
98 | // * the name of the system-required role, as specified in a PCM |
99 | // * System model |
100 | // * @return the created failure type |
101 | // */ |
102 | // public static MarkovHardwareInducedFailureType createExternalFailureType( |
103 | // final String resourceTypeId, final String resourceTypeName, |
104 | // final String signatureId, final String signatureName, |
105 | // final String systemRequiredRoleId, |
106 | // final String systemRequiredRoleName) { |
107 | // return new MarkovHardwareInducedFailureType(resourceTypeId, |
108 | // resourceTypeName, signatureId, signatureName, |
109 | // systemRequiredRoleId, systemRequiredRoleName, "", ""); |
110 | // } |
111 | |
112 | /** |
113 | * Creates an internal hardware-induced failure type. |
114 | * |
115 | * @param evaluationType |
116 | * the degree of differentiation between failure types |
117 | * @param resourceContainer |
118 | * the failure causing resource container |
119 | * @param resourceType |
120 | * the failure causing processing resource type |
121 | * @return the created failure type |
122 | */ |
123 | public static MarkovHardwareInducedFailureType createInternalFailureType( |
124 | final MarkovEvaluationType evaluationType, |
125 | final ResourceContainer resourceContainer, |
126 | final ProcessingResourceType resourceType) { |
127 | return new MarkovHardwareInducedFailureType(evaluationType, |
128 | resourceContainer.getId(), resourceContainer.getEntityName(), |
129 | resourceType.getId(), resourceType.getEntityName()); |
130 | } |
131 | |
132 | /** |
133 | * Creates an internal hardware-induced failure type. |
134 | * |
135 | * @param evaluationType |
136 | * the degree of differentiation between failure types |
137 | * @param resourceContainerId |
138 | * the ID of the surrounding resource container, as specified for |
139 | * a ResourceContainer in a PCM ResourceEnvironment model |
140 | * @param resourceTypeId |
141 | * the ID of the resource type, as specified for a |
142 | * ProcessingResourceType in a PCM ResourceRepository model |
143 | * @return the created failure type |
144 | */ |
145 | public static MarkovHardwareInducedFailureType createInternalFailureType( |
146 | final MarkovEvaluationType evaluationType, |
147 | final String resourceContainerId, final String resourceTypeId) { |
148 | return new MarkovHardwareInducedFailureType(evaluationType, |
149 | resourceContainerId, "", resourceTypeId, ""); |
150 | } |
151 | |
152 | // /** |
153 | // * Creates an internal hardware-induced failure type. |
154 | // * |
155 | // * @param resourceContainerId |
156 | // * the ID of the surrounding resource container, as specified for |
157 | // * a ResourceContainer in a PCM ResourceEnvironment model |
158 | // * @param resourceContainerName |
159 | // * the name of the surrounding resource container, as specified |
160 | // * for a ResourceContainer in a PCM ResourceEnvironment model |
161 | // * @param resourceTypeId |
162 | // * the ID of the resource type, as specified for a |
163 | // * ProcessingResourceType in a PCM ResourceRepository model |
164 | // * @param resourceTypeName |
165 | // * the name of the resource type, as specified for a |
166 | // * ProcessingResourceType in a PCM ResourceRepository model |
167 | // * @return the created failure type |
168 | // */ |
169 | // public static MarkovHardwareInducedFailureType createInternalFailureType( |
170 | // final String resourceContainerId, |
171 | // final String resourceContainerName, final String resourceTypeId, |
172 | // final String resourceTypeName) { |
173 | // return new MarkovHardwareInducedFailureType(resourceContainerId, |
174 | // resourceContainerName, resourceTypeId, resourceTypeName); |
175 | // } |
176 | |
177 | /** |
178 | * The ID of the surrounding resource container, as specified for a |
179 | * ResourceContainer in a PCM ResourceEnvironment model. |
180 | */ |
181 | private String resourceContainerId = ""; |
182 | |
183 | /** |
184 | * The name of the surrounding resource container, as specified for a |
185 | * ResourceContainer in a PCM ResourceEnvironment model. |
186 | */ |
187 | private String resourceContainerName = ""; |
188 | |
189 | /** |
190 | * The ID of the resource type, as specified for a ProcessingResourceType in |
191 | * a PCM ResourceRepository. |
192 | */ |
193 | private String resourceTypeId = ""; |
194 | |
195 | /** |
196 | * The name of the resource type, as specified for a ProcessingResourceType |
197 | * in a PCM ResourceRepository. |
198 | */ |
199 | private String resourceTypeName = ""; |
200 | |
201 | /** |
202 | * The constructor. |
203 | * |
204 | * @param evaluationType |
205 | * the degree of differentiation between failure types |
206 | * @param resourceContainerId |
207 | * the ID of the surrounding resource container, as specified for |
208 | * a ResourceContainer in a PCM ResourceEnvironment model |
209 | * @param resourceContainerName |
210 | * the name of the surrounding resource container, as specified |
211 | * for a ResourceContainer in a PCM ResourceEnvironment model |
212 | * @param resourceTypeId |
213 | * the ID of the resource type, as specified for a |
214 | * ProcessingResourceType in a PCM ResourceRepository model |
215 | * @param resourceTypeName |
216 | * the name of the resource type, as specified for a |
217 | * ProcessingResourceType in a PCM ResourceRepository model |
218 | */ |
219 | private MarkovHardwareInducedFailureType( |
220 | final MarkovEvaluationType evaluationType, |
221 | final String resourceContainerId, |
222 | final String resourceContainerName, final String resourceTypeId, |
223 | final String resourceTypeName) { |
224 | switch (evaluationType) { |
225 | case POINTSOFFAILURE: |
226 | this.id = resourceContainerId + "/" + resourceTypeId; |
227 | this.name = resourceContainerName + "/" + resourceTypeName |
228 | + " (system-internal hardware-induced failure)"; |
229 | break; |
230 | case TYPES: |
231 | this.id = resourceTypeId; |
232 | this.name = resourceTypeName + " (hardware-induced failure)"; |
233 | break; |
234 | case CLASSES: |
235 | this.id = HARDWARE_ID; |
236 | this.name = HARDWARE_NAME; |
237 | break; |
238 | default: |
239 | this.id = DEFAULT_ID; |
240 | this.name = DEFAULT_NAME; |
241 | } |
242 | this.evaluationType = evaluationType; |
243 | this.resourceContainerId = resourceContainerId; |
244 | this.resourceContainerName = resourceContainerName; |
245 | this.resourceTypeId = resourceTypeId; |
246 | this.resourceTypeName = resourceTypeName; |
247 | this.resourceTypeId = resourceTypeId; |
248 | this.systemExternal = false; |
249 | } |
250 | |
251 | /** |
252 | * The constructor for resource failures outside the system, as annotated to |
253 | * system-external calls. |
254 | * |
255 | * @param evaluationType |
256 | * the degree of differentiation between failure types |
257 | * @param resourceTypeId |
258 | * the ID of the resource type, as specified for a |
259 | * ProcessingResourceType in a PCM ResourceRepository model |
260 | * @param resourceTypeName |
261 | * the name of the resource type, as specified for a |
262 | * ProcessingResourceType in a PCM ResourceRepository model |
263 | * @param signatureId |
264 | * the ID of a signature, as specified for a system-required role |
265 | * in a PCM Repository model |
266 | * @param signatureName |
267 | * the name of a signature, as specified for a system-required |
268 | * role in a PCM Repository model |
269 | * @param systemRequiredRoleId |
270 | * the ID of the system-required role, as specified in a PCM |
271 | * System model |
272 | * @param systemRequiredRoleName |
273 | * the name of the system-required role, as specified in a PCM |
274 | * System model |
275 | * @param interfaceId |
276 | * the id of the associated system-required service interface as |
277 | * specified in the PCM Repository model |
278 | * @param interfaceName |
279 | * the name of the associated system-required service interface |
280 | * as specified in the PCM Repository model |
281 | */ |
282 | private MarkovHardwareInducedFailureType( |
283 | final MarkovEvaluationType evaluationType, |
284 | final String resourceTypeId, final String resourceTypeName, |
285 | final String signatureId, final String signatureName, |
286 | final String systemRequiredRoleId, |
287 | final String systemRequiredRoleName, final String interfaceId, |
288 | final String interfaceName) { |
289 | switch (evaluationType) { |
290 | case POINTSOFFAILURE: |
291 | this.id = systemRequiredRoleId + "/" + signatureId + "/" |
292 | + resourceTypeId; |
293 | this.name = systemRequiredRoleName + "/" + signatureName + "/" |
294 | + resourceTypeName |
295 | + " (system-external hardware-induced failure)"; |
296 | break; |
297 | case TYPES: |
298 | this.id = resourceTypeId; |
299 | this.name = resourceTypeName + " (hardware-induced failure)"; |
300 | break; |
301 | case CLASSES: |
302 | this.id = HARDWARE_ID; |
303 | this.name = HARDWARE_NAME; |
304 | break; |
305 | default: |
306 | this.id = DEFAULT_ID; |
307 | this.name = DEFAULT_NAME; |
308 | } |
309 | this.evaluationType = evaluationType; |
310 | this.resourceTypeId = resourceTypeId; |
311 | this.resourceTypeName = resourceTypeName; |
312 | this.signatureId = signatureId; |
313 | this.signatureName = signatureName; |
314 | this.roleId = systemRequiredRoleId; |
315 | this.roleName = systemRequiredRoleName; |
316 | this.interfaceId = interfaceId; |
317 | this.interfaceName = interfaceName; |
318 | this.systemExternal = true; |
319 | } |
320 | |
321 | /** |
322 | * Retrieves the ID of the resource container. |
323 | * |
324 | * @return the ID of the resource container |
325 | */ |
326 | public String getResourceContainerId() { |
327 | return resourceContainerId; |
328 | } |
329 | |
330 | /** |
331 | * Retrieves the name of the resource container. |
332 | * |
333 | * @return the resource type container |
334 | */ |
335 | public String getResourceContainerName() { |
336 | return resourceContainerName; |
337 | } |
338 | |
339 | /** |
340 | * Retrieves the ID of the resource type. |
341 | * |
342 | * @return the resource type ID |
343 | */ |
344 | public String getResourceTypeId() { |
345 | return resourceTypeId; |
346 | } |
347 | |
348 | /** |
349 | * Retrieves the name of the resource type. |
350 | * |
351 | * @return the resource type name |
352 | */ |
353 | public String getResourceTypeName() { |
354 | return resourceTypeName; |
355 | } |
356 | } |