Skip to content
Snippets Groups Projects
Commit b88317b6 authored by Simon Barner's avatar Simon Barner
Browse files

- Remove more references to ResourceLink

refs 3261
parent 572cc85d
No related branches found
No related tags found
No related merge requests found
DeploymentFinalizer.java ce2c53558f008636c3c9f3bddd8432518c0545f1 RED DeploymentFinalizer.java ce2c53558f008636c3c9f3bddd8432518c0545f1 RED
DeploymentInitializer.java e190b0fe5af29c887ed59e011d68cdda5f59cf1d RED DeploymentInitializer.java e190b0fe5af29c887ed59e011d68cdda5f59cf1d RED
DeploymentReplicator.java 6877c3626ef0ee56db14b0af8688e7ec107290bb RED DeploymentReplicator.java 6877c3626ef0ee56db14b0af8688e7ec107290bb RED
ExplorationSolutionToDeployment.java 157b59dd1ae63fb4b51738a013945e055bbfaa4f RED ExplorationSolutionToDeployment.java 6841d5ada7db04f5e6aa68ae40865a3c958ef643 RED
...@@ -15,8 +15,6 @@ ...@@ -15,8 +15,6 @@
+--------------------------------------------------------------------------*/ +--------------------------------------------------------------------------*/
package org.fortiss.af3.exploration.alg.dse.modeltransformation.deployment; package org.fortiss.af3.exploration.alg.dse.modeltransformation.deployment;
import static org.fortiss.af3.platform.utils.PlatformArchitectureUtils.getPhysicalPlatformArchitecture;
import java.util.Collection; import java.util.Collection;
import java.util.Collections; import java.util.Collections;
import java.util.HashSet; import java.util.HashSet;
...@@ -77,7 +75,7 @@ public class ExplorationSolutionToDeployment extends TransformationStrategyBase< ...@@ -77,7 +75,7 @@ public class ExplorationSolutionToDeployment extends TransformationStrategyBase<
throw new TransformationModuleException(this, throw new TransformationModuleException(this,
"An PlatformArchitecture is required for this module to operate properly."); "An PlatformArchitecture is required for this module to operate properly.");
} }
getPhysicalPlatformArchitecture(af3PlatformArchitecture); // getPhysicalPlatformArchitecture(af3PlatformArchitecture);
} }
/** /**
......
AF3Utils.java 0449890944a45bf8cc1c7ce9a578228ba9b824f8 RED AF3Utils.java c48bfa348731c379205d72fbf0380f505e15176d RED
DesignSpaceExplorationModelElementFactory.java 73368ff5bd5ab3dab10aca6a331e14cbde440f59 RED DesignSpaceExplorationModelElementFactory.java 73368ff5bd5ab3dab10aca6a331e14cbde440f59 RED
ExplorationAlgDebugUtils.java 06116a61e99717a59b7b01e4e2865bf044a8a0e2 RED ExplorationAlgDebugUtils.java 06116a61e99717a59b7b01e4e2865bf044a8a0e2 RED
ExplorationAlgUtils.java 2cf411c8d8404d7319d7bc836dd74b5927375711 RED ExplorationAlgUtils.java 3571ce1be1bcc997d800c59e0108544293194e70 RED
ExplorationEcoreUtils.java 48ed07aec3cd93e66d37abc10d50636d591f1c71 RED ExplorationEcoreUtils.java 48ed07aec3cd93e66d37abc10d50636d591f1c71 RED
GraphUtils.java 8b25592f30645f7709af527c72551f038a163833 RED GraphUtils.java 8b25592f30645f7709af527c72551f038a163833 RED
TransformationUtils.java 9b424a20d117a601f9c6a4a4a4ee9e4879c29195 YELLOW TransformationUtils.java 9b424a20d117a601f9c6a4a4a4ee9e4879c29195 YELLOW
...@@ -19,8 +19,6 @@ import static org.fortiss.af3.exploration.alg.dse.sysmodel.arch.IResourceConnect ...@@ -19,8 +19,6 @@ import static org.fortiss.af3.exploration.alg.dse.sysmodel.arch.IResourceConnect
import static org.fortiss.af3.exploration.alg.dse.sysmodel.arch.IResourceConnectionAdapter.ConnectionType.INCOMING; import static org.fortiss.af3.exploration.alg.dse.sysmodel.arch.IResourceConnectionAdapter.ConnectionType.INCOMING;
import static org.fortiss.af3.exploration.alg.dse.sysmodel.arch.IResourceConnectionAdapter.ConnectionType.OUTGOING; import static org.fortiss.af3.exploration.alg.dse.sysmodel.arch.IResourceConnectionAdapter.ConnectionType.OUTGOING;
import static org.fortiss.af3.exploration.alg.util.DesignSpaceExplorationModelElementFactory.createComponentMultiAllocationConstraint; import static org.fortiss.af3.exploration.alg.util.DesignSpaceExplorationModelElementFactory.createComponentMultiAllocationConstraint;
import static org.fortiss.af3.platform.utils.PlatformArchitectureUtils.getReferencedElementsWithType;
import static org.fortiss.af3.platform.utils.PlatformArchitectureUtils.getResourceReferences;
import static org.fortiss.tooling.kernel.utils.EcoreUtils.getChildrenWithType; import static org.fortiss.tooling.kernel.utils.EcoreUtils.getChildrenWithType;
import static org.fortiss.tooling.kernel.utils.EcoreUtils.getParentsWithType; import static org.fortiss.tooling.kernel.utils.EcoreUtils.getParentsWithType;
import static org.fortiss.tooling.kernel.utils.KernelModelElementUtils.getParentElement; import static org.fortiss.tooling.kernel.utils.KernelModelElementUtils.getParentElement;
...@@ -293,16 +291,17 @@ public class AF3Utils { ...@@ -293,16 +291,17 @@ public class AF3Utils {
throws InvalidPlatformModelException { throws InvalidPlatformModelException {
// By the method signature, we know the instance type is a IConnector class. // By the method signature, we know the instance type is a IConnector class.
@SuppressWarnings("unchecked") ConnectionType connectionTypeSource = @SuppressWarnings("unchecked") ConnectionType connectionTypeSource =
systemModelAdapter.getConnectionType( systemModelAdapter.getConnectionType((Class<? extends IConnector>)sourceConnector
(Class<? extends IConnector>)sourceConnector.eClass().getInstanceClass()); .eClass().getInstanceClass());
@SuppressWarnings("unchecked") ConnectionType connectionTypeTarget = @SuppressWarnings("unchecked") ConnectionType connectionTypeTarget =
systemModelAdapter.getConnectionType( systemModelAdapter.getConnectionType((Class<? extends IConnector>)targetConnector
(Class<? extends IConnector>)targetConnector.eClass().getInstanceClass()); .eClass().getInstanceClass());
// assert (connectionTypeSource != null && connectionTypeTarget != null) : // assert (connectionTypeSource != null && connectionTypeTarget != null) :
// "Could not identify the type of one of the connection targets."; // "Could not identify the type of one of the connection targets.";
if((connectionTypeSource == INCOMING && connectionTypeTarget == INCOMING) || if((connectionTypeSource == INCOMING && connectionTypeTarget == INCOMING) ||
(connectionTypeSource == OUTGOING && connectionTypeTarget == OUTGOING)) { (connectionTypeSource == OUTGOING && connectionTypeTarget == OUTGOING)) {
throw new InvalidPlatformModelException((PlatformConnectorUnit)sourceConnector, throw new InvalidPlatformModelException(
(PlatformConnectorUnit)sourceConnector,
"A platform port or interface (see above) for incoming or outgoing traffic is connected to an port or interface of the same type. This is not allowed."); "A platform port or interface (see above) for incoming or outgoing traffic is connected to an port or interface of the same type. This is not allowed.");
} }
...@@ -358,8 +357,8 @@ public class AF3Utils { ...@@ -358,8 +357,8 @@ public class AF3Utils {
SystemModelAdapter<?, ?, ?, ?, ?, ?, ?> systemModelAdapter) { SystemModelAdapter<?, ?, ?, ?, ?, ?, ?> systemModelAdapter) {
// By the method signature, we know the instance type is a IConnector class. // By the method signature, we know the instance type is a IConnector class.
@SuppressWarnings("unchecked") ConnectionType connectionTypeSource = @SuppressWarnings("unchecked") ConnectionType connectionTypeSource =
systemModelAdapter.getConnectionType( systemModelAdapter.getConnectionType((Class<? extends IConnector>)sourceConnector
(Class<? extends IConnector>)sourceConnector.eClass().getInstanceClass()); .eClass().getInstanceClass());
return connectionTypeSource != null ? connectionTypeSource : BIDIRECTIONAL; return connectionTypeSource != null ? connectionTypeSource : BIDIRECTIONAL;
} }
...@@ -367,8 +366,8 @@ public class AF3Utils { ...@@ -367,8 +366,8 @@ public class AF3Utils {
* Predicate whether the subject {@link PlatformConnectorUnit} is a connector of the given * Predicate whether the subject {@link PlatformConnectorUnit} is a connector of the given
* {@link IModelElementAdapter}. * {@link IModelElementAdapter}.
*/ */
public static boolean isConnectorOf(PlatformConnectorUnit pConn, public static boolean
IModelElementAdapter<?> element) { isConnectorOf(PlatformConnectorUnit pConn, IModelElementAdapter<?> element) {
return pConn.getOwner() == element.getObject(); return pConn.getOwner() == element.getObject();
} }
...@@ -387,16 +386,18 @@ public class AF3Utils { ...@@ -387,16 +386,18 @@ public class AF3Utils {
* {@link PlatformConnectorUnit} for the device-internal communication of the given * {@link PlatformConnectorUnit} for the device-internal communication of the given
* {@link IModelElementAdapter}. * {@link IModelElementAdapter}.
*/ */
public static boolean isDeviceInternalPredecessor(PlatformConnectorUnit connCandidate, public static boolean
IModelElementAdapter<?> element, isDeviceInternalPredecessor(PlatformConnectorUnit connCandidate,
DirectedGraph<PlatformConnectorUnit, DefaultEdge> route) { IModelElementAdapter<?> element,
DirectedGraph<PlatformConnectorUnit, DefaultEdge> route) {
// The following rules apply for device internal communication: // The following rules apply for device internal communication:
// - Sender Port is on the same device OR // - Sender Port is on the same device OR
// - its reference port is one layer "below", e.g. Gateway -> Router AND // - its reference port is one layer "below", e.g. Gateway -> Router AND
// - the sender connector must have been traversed (natural for path walking a multicast // - the sender connector must have been traversed (natural for path walking a multicast
// message. // message.
if(route.containsVertex(connCandidate) && (isConnectorOf(connCandidate, element) || if(route.containsVertex(connCandidate) &&
isContainedInResource(connCandidate, element))) { (isConnectorOf(connCandidate, element) || isContainedInResource(connCandidate,
element))) {
return true; return true;
} }
return false; return false;
...@@ -454,12 +455,9 @@ public class AF3Utils { ...@@ -454,12 +455,9 @@ public class AF3Utils {
* Checks whether any parent {@link IPlatformResource} of the given {@code element} is a * Checks whether any parent {@link IPlatformResource} of the given {@code element} is a
* deployment target defined by the set of deployment targets ({@code deploymentTargets}). * deployment target defined by the set of deployment targets ({@code deploymentTargets}).
* If any parent element has been found that is a deployment target, {@code true} is returned. * If any parent element has been found that is a deployment target, {@code true} is returned.
* The method considers parents in the following order: * The method considers parents in the following order: <li>Check the direct parent (container).
* <li>Check the direct parent (container). * </li> <li>Check all referenced resources as defined in the {@link ResourceLink} annotation.</li>
* </li> * <li>Go to the parent resource and run the same checks.</li> <li>Run the above checks for all
* <li>Check all referenced resources as defined in the {@link ResourceLink} annotation.</li>
* <li>Go to the parent resource and run the same checks.</li>
* <li>Run the above checks for all
* references Resources as given by the {@link ResourceLink} annotations.</> * references Resources as given by the {@link ResourceLink} annotations.</>
* *
* @param element * @param element
...@@ -476,7 +474,8 @@ public class AF3Utils { ...@@ -476,7 +474,8 @@ public class AF3Utils {
return false; return false;
} }
List<IPlatformResource> resRefs = getResourceReferences((IModelElement)element); // TODO: Replace by Allocation Model
List<IPlatformResource> resRefs = null; // = getResourceReferences((IModelElement)element);
if(deploymentTargets.contains(parent)) { if(deploymentTargets.contains(parent)) {
return true; return true;
...@@ -507,8 +506,8 @@ public class AF3Utils { ...@@ -507,8 +506,8 @@ public class AF3Utils {
public static <T extends IPlatformResource & IHierarchicElement> boolean public static <T extends IPlatformResource & IHierarchicElement> boolean
isAnyChildDeploymentTarget(IPlatformResource element, Collection<T> deploymentTargets, isAnyChildDeploymentTarget(IPlatformResource element, Collection<T> deploymentTargets,
Class<T> targetType) { Class<T> targetType) {
return getChildrenWithType(element, targetType).stream() return getChildrenWithType(element, targetType).stream().anyMatch(
.anyMatch(child -> deploymentTargets.contains(child)); child -> deploymentTargets.contains(child));
} }
/** /**
...@@ -522,9 +521,11 @@ public class AF3Utils { ...@@ -522,9 +521,11 @@ public class AF3Utils {
* thereby establish a "communication link" between both platforms. * thereby establish a "communication link" between both platforms.
* @return Map representing the "inverse" 1:1 references of {@link ResourceLink}s. * @return Map representing the "inverse" 1:1 references of {@link ResourceLink}s.
*/ */
public static Map<IModelElement, IModelElement> getInverseIntraPlatformReferences( public static
PlatformArchitecture referencingPlatformArchitecture, Map<IModelElement, IModelElement>
Pair<Class<? extends IModelElement>, Class<? extends IModelElement>> interPlatformConnectingElements) { getInverseIntraPlatformReferences(
PlatformArchitecture referencingPlatformArchitecture,
Pair<Class<? extends IModelElement>, Class<? extends IModelElement>> interPlatformConnectingElements) {
if(interPlatformConnectingElements == null) { if(interPlatformConnectingElements == null) {
return Collections.emptyMap(); return Collections.emptyMap();
} }
...@@ -534,10 +535,12 @@ public class AF3Utils { ...@@ -534,10 +535,12 @@ public class AF3Utils {
for(IModelElement referencingElement : getChildrenWithType(referencingPlatformArchitecture, for(IModelElement referencingElement : getChildrenWithType(referencingPlatformArchitecture,
interPlatformConnectingElements.getFirst())) { interPlatformConnectingElements.getFirst())) {
for(IModelElement referencedElement : getReferencedElementsWithType(referencingElement, // TODO: Replace by Allocation Model
interPlatformConnectingElements.getSecond())) { // for(IModelElement referencedElement :
invElementReferences.put(referencedElement, referencingElement); // getReferencedElementsWithType(referencingElement,
} // interPlatformConnectingElements.getSecond())) {
// invElementReferences.put(referencedElement, referencingElement);
// }
} }
return invElementReferences; return invElementReferences;
...@@ -577,12 +580,12 @@ public class AF3Utils { ...@@ -577,12 +580,12 @@ public class AF3Utils {
* @return Set of {@link ComponentMultiAllocationConstraint}s with the same references as the * @return Set of {@link ComponentMultiAllocationConstraint}s with the same references as the
* {@link ComponentAllocation}s. * {@link ComponentAllocation}s.
*/ */
public static Collection<ComponentMultiAllocationConstraint> public static Collection<ComponentMultiAllocationConstraint> createConstraintsFromDeployment(
createConstraintsFromDeployment(Deployment deployment) { Deployment deployment) {
Collection<ComponentAllocation> allocatedComponents = deployment.getComponentAllocations(); Collection<ComponentAllocation> allocatedComponents = deployment.getComponentAllocations();
Function<ComponentAllocation, ComponentMultiAllocationConstraint> mapper = Function<ComponentAllocation, ComponentMultiAllocationConstraint> mapper =
ca -> createComponentMultiAllocationConstraint(ca.getComponent(), ca -> createComponentMultiAllocationConstraint(ca.getComponent(), new BasicEList<>(
new BasicEList<>(Arrays.asList(ca.getExecutionUnit()))); Arrays.asList(ca.getExecutionUnit())));
return allocatedComponents.stream().map(mapper) return allocatedComponents.stream().map(mapper)
.map(ComponentMultiAllocationConstraint.class::cast).collect(Collectors.toList()); .map(ComponentMultiAllocationConstraint.class::cast).collect(Collectors.toList());
} }
...@@ -600,8 +603,10 @@ public class AF3Utils { ...@@ -600,8 +603,10 @@ public class AF3Utils {
* @return The {@link ComponentArchitecture} identified as the <i>Component Pool</i> or * @return The {@link ComponentArchitecture} identified as the <i>Component Pool</i> or
* {@code null} if none is found. * {@code null} if none is found.
*/ */
public static ComponentArchitecture getFirstComponentPool( public static
IMappingEncoding<ITaskAdapter<?>, IResourceAdapter<?>, IMappingEntry<ITaskAdapter<?>, IResourceAdapter<?>>> mapping) { ComponentArchitecture
getFirstComponentPool(
IMappingEncoding<ITaskAdapter<?>, IResourceAdapter<?>, IMappingEntry<ITaskAdapter<?>, IResourceAdapter<?>>> mapping) {
for(ITaskAdapter<?> deployableComponent : mapping.getRequesters()) { for(ITaskAdapter<?> deployableComponent : mapping.getRequesters()) {
if(deployableComponent.isInstantiation()) { if(deployableComponent.isInstantiation()) {
// TODO: Avoid casting: Parameterize the IModelElementAdapter to use EObject-derived // TODO: Avoid casting: Parameterize the IModelElementAdapter to use EObject-derived
...@@ -691,8 +696,9 @@ public class AF3Utils { ...@@ -691,8 +696,9 @@ public class AF3Utils {
EList<Component> parentElements = getParentsWithType(startElement, Component.class); EList<Component> parentElements = getParentsWithType(startElement, Component.class);
for(Component parentComponent : parentElements) { for(Component parentComponent : parentElements) {
AbstractTaskMappingEntry entry = (AbstractTaskMappingEntry)encEntryModelElemAssoc AbstractTaskMappingEntry entry =
.inverse().get(parentComponent, AbstractTaskMappingEntry.class); (AbstractTaskMappingEntry)encEntryModelElemAssoc.inverse().get(parentComponent,
AbstractTaskMappingEntry.class);
if(entry != null) { if(entry != null) {
return true; return true;
} }
......
...@@ -17,7 +17,6 @@ package org.fortiss.af3.exploration.alg.util; ...@@ -17,7 +17,6 @@ package org.fortiss.af3.exploration.alg.util;
import static org.eclipse.emf.ecore.util.EcoreUtil.getAllContents; import static org.eclipse.emf.ecore.util.EcoreUtil.getAllContents;
import static org.fortiss.af3.exploration.alg.util.AF3Utils.isAnyParentDeploymentTarget; import static org.fortiss.af3.exploration.alg.util.AF3Utils.isAnyParentDeploymentTarget;
import static org.fortiss.af3.platform.utils.PlatformArchitectureUtils.getReferencedElementsWithType;
import static org.fortiss.tooling.kernel.utils.EcoreUtils.getChildrenWithType; import static org.fortiss.tooling.kernel.utils.EcoreUtils.getChildrenWithType;
import static org.fortiss.tooling.kernel.utils.EcoreUtils.getParentsWithType; import static org.fortiss.tooling.kernel.utils.EcoreUtils.getParentsWithType;
...@@ -51,10 +50,8 @@ import org.fortiss.af3.exploration.model.ExplorationTarget; ...@@ -51,10 +50,8 @@ import org.fortiss.af3.exploration.model.ExplorationTarget;
import org.fortiss.af3.exploration.model.IProblemDimension; import org.fortiss.af3.exploration.model.IProblemDimension;
import org.fortiss.af3.platform.model.IPlatformResource; import org.fortiss.af3.platform.model.IPlatformResource;
import org.fortiss.af3.platform.model.IVirtualizationPlatformArchitectureElement; import org.fortiss.af3.platform.model.IVirtualizationPlatformArchitectureElement;
import org.fortiss.af3.platform.utils.PlatformArchitectureUtils;
import org.fortiss.tooling.base.model.element.IHierarchicElement; import org.fortiss.tooling.base.model.element.IHierarchicElement;
import org.fortiss.tooling.base.model.element.IHierarchicElementContainer; import org.fortiss.tooling.base.model.element.IHierarchicElementContainer;
import org.fortiss.tooling.base.model.element.IModelElement;
import com.google.common.collect.Multimap; import com.google.common.collect.Multimap;
...@@ -405,8 +402,9 @@ public class ExplorationAlgUtils { ...@@ -405,8 +402,9 @@ public class ExplorationAlgUtils {
Collection<IPlatformResource> virtualizedResources = new HashSet<IPlatformResource>(); Collection<IPlatformResource> virtualizedResources = new HashSet<IPlatformResource>();
for(IVirtualizationPlatformArchitectureElement currentVirtualizationProvider : virtualizationProviders) { for(IVirtualizationPlatformArchitectureElement currentVirtualizationProvider : virtualizationProviders) {
virtualizedResources.addAll(PlatformArchitectureUtils // TODO: Replace by Allocation Model
.getResourceReferences((IModelElement)currentVirtualizationProvider)); // virtualizedResources.addAll(PlatformArchitectureUtils
// .getResourceReferences((IModelElement)currentVirtualizationProvider));
} }
return (Collections.disjoint(selfAndParentElements, virtualizedResources)) ? false : true; return (Collections.disjoint(selfAndParentElements, virtualizedResources)) ? false : true;
...@@ -446,10 +444,12 @@ public class ExplorationAlgUtils { ...@@ -446,10 +444,12 @@ public class ExplorationAlgUtils {
public static boolean haveSameParentHardwareElement(IHierarchicElement elementA, public static boolean haveSameParentHardwareElement(IHierarchicElement elementA,
IHierarchicElement elementB, IHierarchicElement elementB,
Collection<IVirtualizationPlatformArchitectureElement> virtualizationProviders) { Collection<IVirtualizationPlatformArchitectureElement> virtualizationProviders) {
List<IHierarchicElement> refA = List<IHierarchicElement> refA = null;
getReferencedElementsWithType(elementA, IHierarchicElement.class); // TODO: Replace by Allocation Model
List<IHierarchicElement> refB = // getReferencedElementsWithType(elementA, IHierarchicElement.class);
getReferencedElementsWithType(elementB, IHierarchicElement.class); List<IHierarchicElement> refB = null;
// TODO: Replace by Allocation Model
// getReferencedElementsWithType(elementB, IHierarchicElement.class);
if(refA.size() < 1 || refB.size() < 1) { if(refA.size() < 1 || refB.size() < 1) {
return false; return false;
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment