1 | package de.uka.ipd.sdq.pcm.transformations.builder.connectors; |
2 | |
3 | import de.uka.ipd.sdq.pcm.core.composition.AssemblyConnector; |
4 | import de.uka.ipd.sdq.pcm.resourceenvironment.ResourceContainer; |
5 | import de.uka.ipd.sdq.pcm.transformations.builder.IComponentBuilder; |
6 | import de.uka.ipd.sdq.pcm.transformations.builder.infrastructure.DelayMiddlewareComponentBuilder; |
7 | import de.uka.ipd.sdq.pcm.transformations.builder.infrastructure.IMiddlewareInteractingComponentBuilder; |
8 | import de.uka.ipd.sdq.pcm.transformations.builder.util.PCMAndCompletionModelHolder; |
9 | |
10 | /** |
11 | * Implementation of an InnerConnectorCompletionBuilder which adds dummy components on both sides |
12 | * causing themselfs a CPU demand according to the passed StoEx. |
13 | * @author Snowball |
14 | * |
15 | */ |
16 | public class DelayInnerConnectorCompletionBuilder |
17 | extends AbstractClientServerConnectorCompletionBuilder { |
18 | |
19 | private String delaySpec; |
20 | |
21 | public DelayInnerConnectorCompletionBuilder( |
22 | PCMAndCompletionModelHolder models, |
23 | AssemblyConnector connector, |
24 | ResourceContainer fromResourceContainer, |
25 | ResourceContainer toResourceContainer, |
26 | IComponentBuilder innerBuilder, |
27 | String delaySpec) { |
28 | super(models, connector, fromResourceContainer, toResourceContainer, innerBuilder, "DelayInnerConnectorCompletion"); |
29 | if (delaySpec == null) |
30 | throw new IllegalArgumentException("Stoex cannot be null"); |
31 | this.delaySpec = delaySpec; |
32 | } |
33 | |
34 | /** |
35 | * By default, a dummy component is created which does nothing besides delegating the call. |
36 | * Override if more actions are needed |
37 | * @return |
38 | */ |
39 | @Override |
40 | protected IMiddlewareInteractingComponentBuilder createClientSideBuilder() { |
41 | return new DelayMiddlewareComponentBuilder( |
42 | myModels, |
43 | this.connectorToReplace.getRequiredRole_AssemblyConnector().getRequiredInterface__OperationRequiredRole(), |
44 | this.connectorToReplace.getRequiredRole_AssemblyConnector().getRequiredInterface__OperationRequiredRole(), |
45 | this.middlewareInterface, |
46 | this.fromResourceContainer, |
47 | delaySpec); |
48 | } |
49 | |
50 | /** |
51 | * By default, a dummy component is created which does nothing besides delegating the call. |
52 | * Override if more actions are needed |
53 | * @return |
54 | */ |
55 | @Override |
56 | protected IMiddlewareInteractingComponentBuilder createServerSideBuilder() { |
57 | return new DelayMiddlewareComponentBuilder( |
58 | myModels, |
59 | this.connectorToReplace.getRequiredRole_AssemblyConnector().getRequiredInterface__OperationRequiredRole(), |
60 | this.connectorToReplace.getRequiredRole_AssemblyConnector().getRequiredInterface__OperationRequiredRole(), |
61 | this.middlewareInterface, |
62 | this.toResourceContainer, |
63 | delaySpec); |
64 | } |
65 | } |