Class 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 the Context for SimuLizar. In contrast to the generated SimuComContext variant, the allocation lookup syncer also supports nested assembly contexts through the usage of FQComponentIDs. 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​(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.
    • 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

      • 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 of CompositeComponents, the lookup needs to be done using the string representation of the FQComponentID.
        Specified by:
        getAllocatedEntity in interface de.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.