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