Class AllocationLookupSyncer
- java.lang.Object
-
- org.palladiosimulator.simulizar.modelobserver.AllocationLookupSyncer
-
- All Implemented Interfaces:
de.uka.ipd.sdq.simucomframework.resources.IAssemblyAllocationLookup<EntityReference<org.palladiosimulator.pcm.resourceenvironment.ResourceContainer>>
public class AllocationLookupSyncer extends Object implements de.uka.ipd.sdq.simucomframework.resources.IAssemblyAllocationLookup<EntityReference<org.palladiosimulator.pcm.resourceenvironment.ResourceContainer>>
The Allocation Lookup Syncer provides an accessible cache for the mapping of allocation context to resource container. It provides the lookup functionality of theContext
for SimuLizar. In contrast to the generated SimuComContext variant, the allocation lookup syncer also supports nested assembly contexts through the usage ofFQComponentID
s. LIMITATION: Due to the way the listener is currently registered, changes to CompositeComponents will not trigger notifications. If this feature is required the syncer also needs to listen to changes in the repository model.
-
-
Constructor Summary
Constructors Constructor Description AllocationLookupSyncer(EntityReferenceFactory<org.palladiosimulator.pcm.resourceenvironment.ResourceContainer> resourceContainerReferenceFactory, PCMPartitionManager modelManager)
Creates a new Allocation Lookup Syncer.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected void
addAssemblyAllocation(org.palladiosimulator.pcm.core.composition.AssemblyContext ctx, List<org.palladiosimulator.pcm.core.composition.AssemblyContext> ctxHierarchy, EntityReference<org.palladiosimulator.pcm.resourceenvironment.ResourceContainer> container)
Adds an entry for the provided assembly context taking into account a stack of assembly contexts capturing the assemblies of containing composite components.protected void
addInitialAllocations(org.palladiosimulator.pcm.allocation.Allocation allocation)
Traverses a provided Allocation model and creates mappings for all containers Allocation contexts.EntityReference<org.palladiosimulator.pcm.resourceenvironment.ResourceContainer>
getAllocatedEntity(String assemblyContextId)
Returns the simulated resource container to which the provided assembly is allocated to.protected void
handleNotification(Notification msg)
protected void
removeAssemblyAllocation(org.palladiosimulator.pcm.core.composition.AssemblyContext ctx, List<org.palladiosimulator.pcm.core.composition.AssemblyContext> ctxHierarchy)
Removes the entry for the provided assembly context taking into account a stack of assembly contexts capturing the assemblies of containing composite components.
-
-
-
Constructor Detail
-
AllocationLookupSyncer
@Inject public AllocationLookupSyncer(EntityReferenceFactory<org.palladiosimulator.pcm.resourceenvironment.ResourceContainer> resourceContainerReferenceFactory, PCMPartitionManager modelManager)
Creates a new Allocation Lookup Syncer.- Parameters:
resourceContainerAccess
- a service to look up simulate resource container instances based on the id of their model counterpart.
-
-
Method Detail
-
handleNotification
protected void handleNotification(Notification msg)
-
getAllocatedEntity
public EntityReference<org.palladiosimulator.pcm.resourceenvironment.ResourceContainer> getAllocatedEntity(String assemblyContextId)
Returns the simulated resource container to which the provided assembly is allocated to. If the assembly is not allocated directly, but through a hierarchy ofCompositeComponent
s, the lookup needs to be done using the string representation of theFQComponentID
.- Specified by:
getAllocatedEntity
in interfacede.uka.ipd.sdq.simucomframework.resources.IAssemblyAllocationLookup<EntityReference<org.palladiosimulator.pcm.resourceenvironment.ResourceContainer>>
- Returns:
- the simulated resource container
-
addInitialAllocations
protected void addInitialAllocations(org.palladiosimulator.pcm.allocation.Allocation allocation)
Traverses a provided Allocation model and creates mappings for all containers Allocation contexts.- Parameters:
allocation
- the Allocation model
-
addAssemblyAllocation
protected void addAssemblyAllocation(org.palladiosimulator.pcm.core.composition.AssemblyContext ctx, List<org.palladiosimulator.pcm.core.composition.AssemblyContext> ctxHierarchy, EntityReference<org.palladiosimulator.pcm.resourceenvironment.ResourceContainer> container)
Adds an entry for the provided assembly context taking into account a stack of assembly contexts capturing the assemblies of containing composite components. In case the assembly refers to a CompositeComponent the method recursively descends to include mappings for the assemblies contained in the CompositeComponent.- Parameters:
ctx
- the assembly context to create a mapping for.ctxHierarchy
- the assemblies of potential enclosing CompositeComponents. Provide an empty list if none.container
- the simulated resource container to which the assembly context is allocated.
-
removeAssemblyAllocation
protected void removeAssemblyAllocation(org.palladiosimulator.pcm.core.composition.AssemblyContext ctx, List<org.palladiosimulator.pcm.core.composition.AssemblyContext> ctxHierarchy)
Removes the entry for the provided assembly context taking into account a stack of assembly contexts capturing the assemblies of containing composite components. In case the assembly refers to a CompositeComponent the method recursively descends to also remove mappings for the assemblies contained in the CompositeComponent.- Parameters:
ctx
- the assembly context to remove the mapping.ctxHierarchy
- the assemblies of potential enclosing CompositeComponents. Provide an empty list if none.
-
-