1 | package de.uka.ipd.sdq.reliability.core; |
2 | |
3 | import de.uka.ipd.sdq.pcm.core.composition.AssemblyContext; |
4 | import de.uka.ipd.sdq.pcm.repository.BasicComponent; |
5 | import de.uka.ipd.sdq.pcm.repository.PassiveResource; |
6 | |
7 | /** |
8 | * Represents a failure type for a failure-on-demand occurrence due to a timeout |
9 | * while requesting a passive resource. |
10 | * |
11 | * @author brosch |
12 | * |
13 | */ |
14 | public class MarkovResourceTimeoutFailureType extends MarkovFailureType { |
15 | |
16 | /** |
17 | * A default id for new failure types. |
18 | */ |
19 | private static String RESOURCE_ID = "Passive resource timeout failure"; |
20 | |
21 | /** |
22 | * A default name for new failure types. |
23 | */ |
24 | private static String RESOURCE_NAME = "Passive resource timeout failure"; |
25 | |
26 | /** |
27 | * Creates a new resource timeout failure type. |
28 | * |
29 | * @param evaluationType |
30 | * the degree of differentiation between failure types |
31 | * @param assemblyContext |
32 | * the assemblyContext in which the passive resource is |
33 | * instantiated |
34 | * @param component |
35 | * the component to which the passive resource belongs |
36 | * @param passiveResource |
37 | * the passive resource |
38 | * @return the new failure type |
39 | */ |
40 | public static MarkovResourceTimeoutFailureType createResourceTimeoutFailureType( |
41 | final MarkovEvaluationType evaluationType, |
42 | final AssemblyContext assemblyContext, |
43 | final BasicComponent component, |
44 | final PassiveResource passiveResource) { |
45 | return new MarkovResourceTimeoutFailureType(evaluationType, |
46 | assemblyContext.getId(), assemblyContext.getEntityName(), |
47 | component.getId(), component.getEntityName(), passiveResource |
48 | .getId(), passiveResource.getEntityName()); |
49 | } |
50 | |
51 | /** |
52 | * Creates a new resource timeout failure type. |
53 | * |
54 | * @param evaluationType |
55 | * the degree of differentiation between failure types |
56 | * @param assemblyContextId |
57 | * the ID of the component instance containing the passive |
58 | * resource, as specified through an AssemblyContext in a PCM |
59 | * System model |
60 | * @param passiveResourceId |
61 | * the resource ID, as specified through a PassiveResource in a |
62 | * PCM Repository model |
63 | * @return the new failure type |
64 | */ |
65 | public static MarkovResourceTimeoutFailureType createResourceTimeoutFailureType( |
66 | final MarkovEvaluationType evaluationType, |
67 | final String assemblyContextId, final String passiveResourceId) { |
68 | return new MarkovResourceTimeoutFailureType(evaluationType, |
69 | assemblyContextId, "", "", "", passiveResourceId, ""); |
70 | } |
71 | |
72 | // /** |
73 | // * Creates a new resource timeout failure type. |
74 | // * |
75 | // * @param assemblyContextId |
76 | // * the ID of the component instance containing the passive |
77 | // * resource, as specified through an AssemblyContext in a PCM |
78 | // * System model |
79 | // * @param componentId |
80 | // * the id of the associated software component as specified in |
81 | // * the PCM Repository model |
82 | // * @param passiveResourceId |
83 | // * the resource ID, as specified through a PassiveResource in a |
84 | // * PCM Repository model |
85 | // * @return the new failure type |
86 | // */ |
87 | // public static MarkovResourceTimeoutFailureType |
88 | // createResourceTimeoutFailureType( |
89 | // final String assemblyContextId, final String componentId, |
90 | // final String passiveResourceId) { |
91 | // return new MarkovResourceTimeoutFailureType(assemblyContextId, "", |
92 | // componentId, "", passiveResourceId, ""); |
93 | // } |
94 | |
95 | // /** |
96 | // * Creates a new resource timeout failure type. |
97 | // * |
98 | // * @param assemblyContextId |
99 | // * the ID of the component instance containing the passive |
100 | // * resource, as specified through an AssemblyContext in a PCM |
101 | // * System model |
102 | // * @param assemblyContextName |
103 | // * the name of the component instance containing the passive |
104 | // * resource, as specified through an AssemblyContext in a PCM |
105 | // * System model |
106 | // * @param componentId |
107 | // * the id of the associated software component as specified in |
108 | // * the PCM Repository model |
109 | // * @param componentName |
110 | // * the name of the associated software component as specified in |
111 | // * the PCM Repository model |
112 | // * @param passiveResourceId |
113 | // * the resource ID, as specified through a PassiveResource in a |
114 | // * PCM Repository model |
115 | // * @param passiveResourceName |
116 | // * the resource name, as specified through a PassiveResource in a |
117 | // * PCM Repository model |
118 | // * @return the new failure type |
119 | // */ |
120 | // public static MarkovResourceTimeoutFailureType |
121 | // createResourceTimeoutFailureType( |
122 | // final String assemblyContextId, final String assemblyContextName, |
123 | // final String componentId, final String componentName, |
124 | // final String passiveResourceId, final String passiveResourceName) { |
125 | // return new MarkovResourceTimeoutFailureType(assemblyContextId, |
126 | // assemblyContextName, componentId, componentName, |
127 | // passiveResourceId, passiveResourceName); |
128 | // } |
129 | |
130 | /** |
131 | * The ID of the component instance containing the passive resource, as |
132 | * specified through an AssemblyContext in a PCM System model. |
133 | */ |
134 | private String assemblyContextId = ""; |
135 | |
136 | /** |
137 | * The name of the component instance containing the passive resource, as |
138 | * specified through an AssemblyContext in a PCM System model. |
139 | */ |
140 | private String assemblyContextName = ""; |
141 | |
142 | /** |
143 | * The id of the component which exhibits the failure. |
144 | */ |
145 | private String componentId = ""; |
146 | |
147 | /** |
148 | * The name of the component which exhibits the failure. |
149 | */ |
150 | private String componentName = ""; |
151 | |
152 | /** |
153 | * The resource ID, as specified for a PassiveResource in a PCM Repository |
154 | * model. |
155 | */ |
156 | private String passiveResourceId = ""; |
157 | |
158 | /** |
159 | * The resource name, as specified for a PassiveResource in a PCM Repository |
160 | * model. |
161 | */ |
162 | private String passiveResourceName = ""; |
163 | |
164 | /** |
165 | * The constructor. |
166 | * |
167 | * @param evaluationType |
168 | * the degree of differentiation between failure types |
169 | * @param assemblyContextId |
170 | * the ID of the component instance containing the passive |
171 | * resource, as specified through an AssemblyContext in a PCM |
172 | * System model |
173 | * @param assemblyContextName |
174 | * the name of the component instance containing the passive |
175 | * resource, as specified through an AssemblyContext in a PCM |
176 | * System model |
177 | * @param componentId |
178 | * the id of the associated software component as specified in |
179 | * the PCM Repository model |
180 | * @param componentName |
181 | * the name of the associated software component as specified in |
182 | * the PCM Repository model |
183 | * @param passiveResourceId |
184 | * the resource ID, as specified through a PassiveResource in a |
185 | * PCM Repository model |
186 | * @param passiveResourceName |
187 | * the resource name, as specified through a PassiveResource in a |
188 | * PCM Repository model |
189 | */ |
190 | private MarkovResourceTimeoutFailureType( |
191 | final MarkovEvaluationType evaluationType, |
192 | final String assemblyContextId, final String assemblyContextName, |
193 | final String componentId, final String componentName, |
194 | final String passiveResourceId, final String passiveResourceName) { |
195 | switch (evaluationType) { |
196 | case POINTSOFFAILURE: |
197 | this.id = assemblyContextId + "/" + passiveResourceId; |
198 | this.name = assemblyContextName + "/" + passiveResourceName |
199 | + " (system-internal passive resource timeout failure)"; |
200 | break; |
201 | case TYPES: |
202 | this.id = passiveResourceId; |
203 | this.name = passiveResourceName |
204 | + " (passive resource timeout failure)"; |
205 | break; |
206 | case CLASSES: |
207 | this.id = RESOURCE_ID; |
208 | this.name = RESOURCE_NAME; |
209 | break; |
210 | default: |
211 | this.id = DEFAULT_ID; |
212 | this.name = DEFAULT_NAME; |
213 | } |
214 | this.evaluationType = evaluationType; |
215 | this.assemblyContextId = assemblyContextId; |
216 | this.assemblyContextName = assemblyContextName; |
217 | this.componentId = componentId; |
218 | this.componentName = componentName; |
219 | this.passiveResourceId = passiveResourceId; |
220 | this.passiveResourceName = passiveResourceName; |
221 | this.systemExternal = false; |
222 | } |
223 | |
224 | /** |
225 | * Retrieves the assembly context ID. |
226 | * |
227 | * @return the assembly context ID |
228 | */ |
229 | public String getAssemblyContextId() { |
230 | return assemblyContextId; |
231 | } |
232 | |
233 | /** |
234 | * Retrieves the assembly context name. |
235 | * |
236 | * @return the assembly context name |
237 | */ |
238 | public String getAssemblyContextName() { |
239 | return assemblyContextName; |
240 | } |
241 | |
242 | /** |
243 | * Retrieves the id of the component which exhibits the failure. |
244 | * |
245 | * @return the component id |
246 | */ |
247 | public String getComponentId() { |
248 | return componentId; |
249 | } |
250 | |
251 | /** |
252 | * Retrieves the name of the component which exhibits the failure. |
253 | * |
254 | * @return the component name |
255 | */ |
256 | public String getComponentName() { |
257 | return componentName; |
258 | } |
259 | |
260 | /** |
261 | * Retrieves the passive resource ID. |
262 | * |
263 | * @return the passive resource ID |
264 | */ |
265 | public String getPassiveResourceId() { |
266 | return passiveResourceId; |
267 | } |
268 | |
269 | /** |
270 | * Retrieves the passive resource name. |
271 | * |
272 | * @return the passive resource name |
273 | */ |
274 | public String getPassiveResourceName() { |
275 | return passiveResourceName; |
276 | } |
277 | } |