1 | package de.uka.ipd.sdq.pcm.transformations.builder.abstractbuilder; |
2 | |
3 | import de.uka.ipd.sdq.pcm.core.composition.AssemblyConnector; |
4 | import de.uka.ipd.sdq.pcm.core.composition.AssemblyContext; |
5 | import de.uka.ipd.sdq.pcm.core.composition.ComposedStructure; |
6 | import de.uka.ipd.sdq.pcm.core.composition.CompositionFactory; |
7 | import de.uka.ipd.sdq.pcm.core.composition.ProvidedDelegationConnector; |
8 | import de.uka.ipd.sdq.pcm.core.composition.RequiredDelegationConnector; |
9 | import de.uka.ipd.sdq.pcm.repository.OperationProvidedRole; |
10 | import de.uka.ipd.sdq.pcm.repository.OperationRequiredRole; |
11 | import de.uka.ipd.sdq.pcm.transformations.builder.util.PCMAndCompletionModelHolder; |
12 | |
13 | public abstract class AbstractCompositeStructureBuilder |
14 | extends AbstractComponentBuilder { |
15 | |
16 | |
17 | public AbstractCompositeStructureBuilder(PCMAndCompletionModelHolder models, String componentName) { |
18 | super(models, componentName); |
19 | } |
20 | |
21 | protected void addRequiredDelegationConnector(OperationRequiredRole innerRole, AssemblyContext innerContext, OperationRequiredRole outerRole) { |
22 | if (innerRole == null || innerContext == null || outerRole == null) |
23 | throw new IllegalArgumentException("At least on argument is null in delegation connector creation."); |
24 | RequiredDelegationConnector reqDelCon = CompositionFactory.eINSTANCE.createRequiredDelegationConnector(); |
25 | reqDelCon.setAssemblyContext_RequiredDelegationConnector(innerContext); |
26 | reqDelCon.setInnerRequiredRole_RequiredDelegationConnector(innerRole); |
27 | reqDelCon.setOuterRequiredRole_RequiredDelegationConnector(outerRole); |
28 | |
29 | getComposedStructure().getConnectors__ComposedStructure().add(reqDelCon); |
30 | } |
31 | |
32 | protected void addProvidedDelegationConnector(OperationProvidedRole innerRole, AssemblyContext innerContext, OperationProvidedRole outerRole) { |
33 | if (innerRole == null || innerContext == null || outerRole == null) |
34 | throw new IllegalArgumentException("At least on argument is null in delegation connector creation."); |
35 | ProvidedDelegationConnector delCon = CompositionFactory.eINSTANCE.createProvidedDelegationConnector(); |
36 | delCon.setAssemblyContext_ProvidedDelegationConnector(innerContext); |
37 | delCon.setInnerProvidedRole_ProvidedDelegationConnector(innerRole); |
38 | delCon.setOuterProvidedRole_ProvidedDelegationConnector(outerRole); |
39 | |
40 | getComposedStructure().getConnectors__ComposedStructure().add(delCon); |
41 | } |
42 | |
43 | protected void addAssemblyConnector(OperationRequiredRole from, AssemblyContext fromContext, OperationProvidedRole to, AssemblyContext toContext){ |
44 | AssemblyConnector acon = CompositionFactory.eINSTANCE.createAssemblyConnector(); |
45 | acon.setParentStructure__Connector(getComposedStructure()); |
46 | acon.setRequiredRole_AssemblyConnector(from); |
47 | acon.setRequiringAssemblyContext_AssemblyConnector(fromContext); |
48 | acon.setProvidedRole_AssemblyConnector(to); |
49 | acon.setProvidingAssemblyContext_AssemblyConnector(toContext); |
50 | } |
51 | |
52 | |
53 | protected ComposedStructure getComposedStructure(){ |
54 | return (ComposedStructure) myComponent; |
55 | } |
56 | |
57 | } |