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