Commit d19cec0e authored by Simon Barner's avatar Simon Barner
Browse files

Add CA -> PA transformation that is rooted on the same basis as the CA -> TA transformation.

refs 3035
parent c2be6dee
......@@ -7,7 +7,8 @@ Bundle-Activator: org.fortiss.af3.partition.ui.AF3PartitionUIActivator
Require-Bundle: org.fortiss.af3.partition;visibility:=reexport,
org.fortiss.af3.allocation.ui,
org.fortiss.af3.schedule.ui,
org.fortiss.af3.platform.hierarchic
org.fortiss.af3.platform.hierarchic,
org.fortiss.af3.component.ui
Bundle-ActivationPolicy: lazy
Bundle-RequiredExecutionEnvironment: JavaSE-1.8
Bundle-Vendor: fortiss GmbH
......
......@@ -70,4 +70,8 @@
<modelElementClass modelElementClass="org.fortiss.af3.partition.model.allocation.PartitionToExecutionUnitAllocationTable"/>
</modelElementHandler>
</extension>
<extension point="org.fortiss.tooling.kernel.ui.contextMenuContribution">
<contextMenuContribution contributor="org.fortiss.af3.partition.ui.commands.TransformComponentToPartitionArchitectureMenu"/>
</extension>
</plugin>
TransformComponentToPartitionArchitectureMenu.java d390b305db41af2b6c86bddc80e75f8df43d9f76 YELLOW
/*-------------------------------------------------------------------------+
| Copyright 2018 fortiss GmbH |
| |
| Licensed under the Apache License, Version 2.0 (the "License"); |
| you may not use this file except in compliance with the License. |
| You may obtain a copy of the License at |
| |
| http://www.apache.org/licenses/LICENSE-2.0 |
| |
| Unless required by applicable law or agreed to in writing, software |
| distributed under the License is distributed on an "AS IS" BASIS, |
| WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| See the License for the specific language governing permissions and |
| limitations under the License. |
+--------------------------------------------------------------------------*/
package org.fortiss.af3.partition.ui.commands;
import static org.fortiss.af3.partition.ui.AF3PartitionUIActivator.getImageDescriptor;
import org.eclipse.jface.resource.ImageDescriptor;
import org.fortiss.af3.component.model.ComponentArchitecture;
import org.fortiss.af3.component.ui.commands.ComponentArchitectureTransformationMenuBase;
import org.fortiss.af3.partition.model.PartitionArchitecture;
import org.fortiss.af3.partition.model.allocation.ComponentToPartitionAllocationTable;
import org.fortiss.af3.partition.util.ComponentToPartitionArchitectureTransformation;
/**
* Context menu entry to transform a {@link ComponentArchitecture} into a
* {@link PartitionArchitecture}.
*
* @author barner
*/
public class TransformComponentToPartitionArchitectureMenu
extends
ComponentArchitectureTransformationMenuBase<PartitionArchitecture, ComponentToPartitionAllocationTable> {
/** Constructor. */
public TransformComponentToPartitionArchitectureMenu() {
super(new ComponentToPartitionArchitectureTransformation(),
ComponentToPartitionAllocationTable.class);
}
/** Declares where is located the icon to use for the menu contribution */
private static String MENU_ICON = "icons/partition_architecture.png";
/** Returns the icon that is visible in the context menu for this entry. */
@Override
protected ImageDescriptor getActionIcon() {
return getImageDescriptor(MENU_ICON);
}
/** {@inheritDoc} */
@Override
protected String getGeneratedArchitectureTypeName() {
return "Partition Architecture";
}
}
ComponentToPartitionArchitectureTransformation.java 77469ccab6afec806d91b4088b8028e2ea3ae834 YELLOW
PartitionArchitectureToPikeOSArchitectureTransformation.java 131ed81bbfe44e6ec6aca6897e5c2cc8fc12d84d RED
PartitionArchitectureUtils.java 7f384981224a39044aa91009f31b6a6f0c677a86 YELLOW
PartitionModelElementFactory.java b893a37ce8f847aecb7f23d3c7dda80b8746666c YELLOW
PartitionModelElementFactory.java b7df6aa957938f8c3e030f5643bc4e01000a6f38 YELLOW
/*-------------------------------------------------------------------------+
| Copyright 2018 fortiss GmbH |
| |
| Licensed under the Apache License, Version 2.0 (the "License"); |
| you may not use this file except in compliance with the License. |
| You may obtain a copy of the License at |
| |
| http://www.apache.org/licenses/LICENSE-2.0 |
| |
| Unless required by applicable law or agreed to in writing, software |
| distributed under the License is distributed on an "AS IS" BASIS, |
| WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| See the License for the specific language governing permissions and |
| limitations under the License. |
+--------------------------------------------------------------------------*/
package org.fortiss.af3.partition.util;
import static org.fortiss.af3.partition.util.PartitionModelElementFactory.createComponentToPartitionAllocationTable;
import static org.fortiss.af3.partition.util.PartitionModelElementFactory.createPartition;
import static org.fortiss.af3.partition.util.PartitionModelElementFactory.createPartitionArchitecture;
import static org.fortiss.af3.partition.util.PartitionModelElementFactory.createPartitionChannel;
import static org.fortiss.af3.partition.util.PartitionModelElementFactory.createPartitionSamplingInputPort;
import static org.fortiss.af3.partition.util.PartitionModelElementFactory.createPartitionSamplingOutputPort;
import org.fortiss.af3.allocation.model.AllocationTableCollection;
import org.fortiss.af3.component.model.Component;
import org.fortiss.af3.component.model.ComponentArchitecture;
import org.fortiss.af3.component.model.InputPort;
import org.fortiss.af3.component.model.OutputPort;
import org.fortiss.af3.component.utils.ComponentArchitectureTransformationBase;
import org.fortiss.af3.partition.model.Partition;
import org.fortiss.af3.partition.model.PartitionArchitecture;
import org.fortiss.af3.partition.model.PartitionChannel;
import org.fortiss.af3.partition.model.PartitionInputPort;
import org.fortiss.af3.partition.model.PartitionOutputPort;
import org.fortiss.af3.partition.model.allocation.ComponentToPartitionAllocationEntry;
import org.fortiss.af3.partition.model.allocation.ComponentToPartitionAllocationTable;
import org.fortiss.af3.partition.model.allocation.InputPortToPartitionInputPortAllocationEntry;
import org.fortiss.af3.partition.model.allocation.OutputPortToPartitionOutputPortAllocationEntry;
/**
* Transformation that synthesizes a {@link PartitionArchitecture} from the atomic components of the
* given {@link ComponentArchitecture}.
*
* @author barner
*/
public class ComponentToPartitionArchitectureTransformation
extends
ComponentArchitectureTransformationBase<PartitionArchitecture, ComponentToPartitionAllocationTable, Partition, PartitionInputPort, PartitionOutputPort, PartitionChannel, ComponentToPartitionAllocationEntry, InputPortToPartitionInputPortAllocationEntry, OutputPortToPartitionOutputPortAllocationEntry> {
/** Constructor. */
public ComponentToPartitionArchitectureTransformation() {
super(ComponentToPartitionAllocationEntry.class,
InputPortToPartitionInputPortAllocationEntry.class,
OutputPortToPartitionOutputPortAllocationEntry.class);
}
/** {@inheritDoc} */
@Override
protected PartitionArchitecture createArchitecture(Component component) {
return createPartitionArchitecture("Partition Architecture (generated for: " +
component.getName() + ")");
}
/** {@inheritDoc} */
@Override
protected ComponentToPartitionAllocationTable createAllocationTable(
PartitionArchitecture partitionArchitecture,
ComponentArchitecture componentArchitecture, AllocationTableCollection atc) {
return createComponentToPartitionAllocationTable(componentArchitecture.getTopComponent()
.getName() + LEFT_ARROW + partitionArchitecture.getName());
}
/** {@inheritDoc} */
@Override
protected Partition createEntity(Component comp) {
return createPartition("Partition_" + comp.getName());
}
/** {@inheritDoc} */
@Override
protected PartitionOutputPort createOutputPort(OutputPort outputPort) {
return createPartitionSamplingOutputPort(outputPort.getName());
}
/** {@inheritDoc} */
@Override
protected PartitionInputPort createInputPort(InputPort inputPort) {
return createPartitionSamplingInputPort(inputPort.getName());
}
/** {@inheritDoc} */
@Override
protected PartitionChannel createConnection(PartitionOutputPort partitionOutputPort,
PartitionInputPort partitionInputPort) {
String pChanName =
"pChan " + partitionOutputPort.getName() + LEFT_ARROW +
partitionInputPort.getName();
return createPartitionChannel(partitionOutputPort, partitionInputPort, pChanName);
}
/** {@inheritDoc} */
@Override
protected PartitionInputPort getInputPort(InputPort inputPort,
ComponentToPartitionAllocationTable ca2pa) {
return ca2pa.getPartitionInputPort(inputPort);
}
/** {@inheritDoc} */
@Override
protected PartitionOutputPort getOutputPort(OutputPort outputPort,
ComponentToPartitionAllocationTable ca2pa) {
return ca2pa.getPartitionOutputPort(outputPort);
}
}
......@@ -23,6 +23,9 @@ import org.fortiss.af3.partition.model.Partition;
import org.fortiss.af3.partition.model.PartitionArchitecture;
import org.fortiss.af3.partition.model.PartitionChannel;
import org.fortiss.af3.partition.model.PartitionFactory;
import org.fortiss.af3.partition.model.PartitionInputPort;
import org.fortiss.af3.partition.model.PartitionOutputPort;
import org.fortiss.af3.partition.model.PartitionPort;
import org.fortiss.af3.partition.model.PartitionQueuingInputPort;
import org.fortiss.af3.partition.model.PartitionQueuingOutputPort;
import org.fortiss.af3.partition.model.PartitionSamplingInputPort;
......@@ -65,6 +68,19 @@ public class PartitionModelElementFactory {
return pChan;
}
/**
* Creates a new {@link PartitionChannel} between the given {@link PartitionPort}s (with the
* given {@code name}).
*/
public static PartitionChannel createPartitionChannel(PartitionOutputPort partitionOutputPort,
PartitionInputPort partitionInputPort, String name) {
PartitionChannel pChan = createPartitionChannel(name);
pChan.setSource(partitionOutputPort);
pChan.setTarget(partitionInputPort);
return pChan;
}
/** Creates a new {@link PartitionQueuingInputPort} with the given {@code name}. */
public static PartitionQueuingInputPort createPartitionQueuingInputPort(String name) {
PartitionQueuingInputPort pInPort =
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment