1 | package de.uka.ipd.sdq.pcm.transformations.builder.connectors; |
2 | |
3 | import de.uka.ipd.sdq.completions.Completion; |
4 | import de.uka.ipd.sdq.completions.CompletionsFactory; |
5 | import de.uka.ipd.sdq.pcm.core.composition.AssemblyConnector; |
6 | import de.uka.ipd.sdq.pcm.core.composition.CompositionFactory; |
7 | import de.uka.ipd.sdq.pcm.repository.RepositoryComponent; |
8 | import de.uka.ipd.sdq.pcm.transformations.builder.abstractbuilder.AbstractCompositeStructureBuilder; |
9 | import de.uka.ipd.sdq.pcm.transformations.builder.util.PCMAndCompletionModelHolder; |
10 | |
11 | public abstract class AbstractConnectorCompletionBuilder |
12 | extends AbstractCompositeStructureBuilder { |
13 | |
14 | protected AssemblyConnector connectorToReplace; |
15 | private static long contextID = 0; |
16 | |
17 | public AbstractConnectorCompletionBuilder(PCMAndCompletionModelHolder models, AssemblyConnector con, String componentName){ |
18 | super(models, componentName); |
19 | this.connectorToReplace = con; |
20 | } |
21 | |
22 | @Override |
23 | protected RepositoryComponent createComponent(String componentName) { |
24 | Completion completion = CompletionsFactory.eINSTANCE.createCompletion(); |
25 | completion.setEntityName("ConnectorCompletion_"+componentName+getNextCounter() ); |
26 | |
27 | return completion; |
28 | } |
29 | |
30 | @Override |
31 | public void build() { |
32 | super.build(); |
33 | myOperationProvidedRole = addOperationProvidedRole(connectorToReplace.getRequiredRole_AssemblyConnector().getRequiredInterface__OperationRequiredRole(),"ProvidedRole"); |
34 | myOperationRequiredRole = addOperationRequiredRole(connectorToReplace.getRequiredRole_AssemblyConnector().getRequiredInterface__OperationRequiredRole(),"RequiredRole"); |
35 | |
36 | myAssemblyContext = CompositionFactory.eINSTANCE.createAssemblyContext(); |
37 | myAssemblyContext.setEntityName("CompletionComponentContext"+contextID); |
38 | contextID++; |
39 | myAssemblyContext.setEncapsulatedComponent__AssemblyContext(myComponent); |
40 | } |
41 | |
42 | } |