Class AllocationLookupSyncer
- java.lang.Object
-
- org.palladiosimulator.simulizar.modelobserver.AbstractModelObserver<org.palladiosimulator.pcm.allocation.Allocation>
-
- org.palladiosimulator.simulizar.modelobserver.AllocationLookupSyncer
-
- All Implemented Interfaces:
de.uka.ipd.sdq.simucomframework.resources.IAssemblyAllocationLookup<de.uka.ipd.sdq.simucomframework.resources.AbstractSimulatedResourceContainer>
,IModelObserver
public class AllocationLookupSyncer extends AbstractModelObserver<org.palladiosimulator.pcm.allocation.Allocation> implements de.uka.ipd.sdq.simucomframework.resources.IAssemblyAllocationLookup<de.uka.ipd.sdq.simucomframework.resources.AbstractSimulatedResourceContainer>
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.
-
-
Field Summary
-
Fields inherited from class org.palladiosimulator.simulizar.modelobserver.AbstractModelObserver
LOGGER, model, runtimeModel
-
-
Constructor Summary
Constructors Constructor Description AllocationLookupSyncer(de.uka.ipd.sdq.simucomframework.resources.ISimulatedModelEntityAccess<de.uka.ipd.sdq.identifier.Identifier,de.uka.ipd.sdq.simucomframework.resources.AbstractSimulatedResourceContainer> resourceContainerAccess)
Creates a new Allocation Lookup Syncer.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected void
add(Notification notification)
protected void
addAssemblyAllocation(org.palladiosimulator.pcm.core.composition.AssemblyContext ctx, List<org.palladiosimulator.pcm.core.composition.AssemblyContext> ctxHierarchy, de.uka.ipd.sdq.simucomframework.resources.AbstractSimulatedResourceContainer 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.protected void
addMany(Notification notification)
de.uka.ipd.sdq.simucomframework.resources.AbstractSimulatedResourceContainer
getAllocatedEntity(String assemblyContextId)
Returns the simulated resource container to which the provided assembly is allocated to.void
initialize(AbstractSimuLizarRuntimeState runtimeState)
Syncs PCM models with SimuCom.protected void
remove(Notification notification)
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.protected void
removeMany(Notification notification)
protected void
set(Notification notification)
-
Methods inherited from class org.palladiosimulator.simulizar.modelobserver.AbstractModelObserver
eventTypeCount, initialize, logDebugInfo, move, noFeatureID, removingAdapter, resolve, setTaggedValue, unregister, unset
-
-
-
-
Constructor Detail
-
AllocationLookupSyncer
public AllocationLookupSyncer(de.uka.ipd.sdq.simucomframework.resources.ISimulatedModelEntityAccess<de.uka.ipd.sdq.identifier.Identifier,de.uka.ipd.sdq.simucomframework.resources.AbstractSimulatedResourceContainer> resourceContainerAccess)
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
-
initialize
public void initialize(AbstractSimuLizarRuntimeState runtimeState)
Syncs PCM models with SimuCom.- Specified by:
initialize
in interfaceIModelObserver
-
getAllocatedEntity
public de.uka.ipd.sdq.simucomframework.resources.AbstractSimulatedResourceContainer 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<de.uka.ipd.sdq.simucomframework.resources.AbstractSimulatedResourceContainer>
- 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, de.uka.ipd.sdq.simucomframework.resources.AbstractSimulatedResourceContainer 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.
-
add
protected void add(Notification notification)
- Overrides:
add
in classAbstractModelObserver<org.palladiosimulator.pcm.allocation.Allocation>
-
addMany
protected void addMany(Notification notification)
- Overrides:
addMany
in classAbstractModelObserver<org.palladiosimulator.pcm.allocation.Allocation>
-
remove
protected void remove(Notification notification)
- Overrides:
remove
in classAbstractModelObserver<org.palladiosimulator.pcm.allocation.Allocation>
-
removeMany
protected void removeMany(Notification notification)
- Overrides:
removeMany
in classAbstractModelObserver<org.palladiosimulator.pcm.allocation.Allocation>
-
set
protected void set(Notification notification)
- Overrides:
set
in classAbstractModelObserver<org.palladiosimulator.pcm.allocation.Allocation>
-
-