Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
af3
AF3
Commits
8d430d8f
Commit
8d430d8f
authored
Jan 30, 2018
by
Simon Barner
Browse files
- Move PartitionArchitectureToPikeOSArchitectureTransformation to af3.platform.pikeos
refs 3035
parent
d068e122
Changes
2
Hide whitespace changes
Inline
Side-by-side
org.fortiss.af3.partition/trunk/META-INF/MANIFEST.MF
View file @
8d430d8f
...
...
@@ -6,18 +6,9 @@ Bundle-Version: 2.12.0.qualifier
Bundle-ClassPath: .
Bundle-Activator: org.fortiss.af3.partition.AF3PartitionActivator
Require-Bundle: org.fortiss.af3.allocation;visibility:=reexport,
org.fortiss.tooling.base;visibility:=reexport,
org.fortiss.tooling.kernel;visibility:=reexport,
org.fortiss.af3.timing;visibility:=reexport,
org.fortiss.af3.task;visibility:=reexport,
org.fortiss.af3.component;visibility:=reexport,
org.fortiss.af3.expression;visibility:=reexport,
org.fortiss.af3.project;visibility:=reexport,
org.eclipse.core.runtime,
org.eclipse.emf.ecore;visibility:=reexport,
org.fortiss.af3.platform;visibility:=reexport,
org.fortiss.af3.deployment,
org.fortiss.af3.platform.pikeos
org.fortiss.af3.platform;visibility:=reexport
Bundle-ActivationPolicy: lazy
Bundle-RequiredExecutionEnvironment: JavaSE-1.8
Bundle-Vendor: fortiss GmbH
...
...
org.fortiss.af3.partition/trunk/src/org/fortiss/af3/partition/util/PartitionArchitectureToPikeOSArchitectureTransformation.java
deleted
100644 → 0
View file @
d068e122
/*-------------------------------------------------------------------------+
| Copyright 2017 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
.
deployment
.
utils
.
DeploymentModelElementFactory
.
createComponentAllocation
;
import
static
org
.
fortiss
.
af3
.
deployment
.
utils
.
DeploymentModelElementFactory
.
createDeployment
;
import
static
org
.
fortiss
.
af3
.
deployment
.
utils
.
DeploymentModelElementFactory
.
createTransceiverAllocation
;
import
static
org
.
fortiss
.
af3
.
platform
.
pikeos
.
utils
.
PikeosModelElementFactory
.
createBoard
;
import
static
org
.
fortiss
.
af3
.
platform
.
pikeos
.
utils
.
PikeosModelElementFactory
.
createBus
;
import
static
org
.
fortiss
.
af3
.
platform
.
pikeos
.
utils
.
PikeosModelElementFactory
.
createCore
;
import
static
org
.
fortiss
.
af3
.
platform
.
pikeos
.
utils
.
PikeosModelElementFactory
.
createInterPartitionComPort
;
import
static
org
.
fortiss
.
af3
.
platform
.
pikeos
.
utils
.
PikeosModelElementFactory
.
createInterPartitionCommunication
;
import
static
org
.
fortiss
.
af3
.
platform
.
pikeos
.
utils
.
PikeosModelElementFactory
.
createResourcePartition
;
import
static
org
.
fortiss
.
af3
.
platform
.
utils
.
PlatformModelElementFactory
.
createPlatformArchitecture
;
import
static
org
.
fortiss
.
tooling
.
kernel
.
utils
.
EcoreUtils
.
copy
;
import
static
org
.
fortiss
.
tooling
.
kernel
.
utils
.
EcoreUtils
.
pickInstanceOf
;
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.deployment.model.ComponentAllocation
;
import
org.fortiss.af3.deployment.model.Deployment
;
import
org.fortiss.af3.deployment.model.TransceiverAllocation
;
import
org.fortiss.af3.partition.model.Partition
;
import
org.fortiss.af3.partition.model.PartitionArchitecture
;
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
;
import
org.fortiss.af3.platform.model.PlatformArchitecture
;
import
org.fortiss.af3.platform.model.Transceiver
;
import
org.fortiss.af3.platform.pikeos.model.Board
;
import
org.fortiss.af3.platform.pikeos.model.Bus
;
import
org.fortiss.af3.platform.pikeos.model.Core
;
import
org.fortiss.af3.platform.pikeos.model.InterPartitionComPort
;
import
org.fortiss.af3.platform.pikeos.model.InterPartitionCommunication
;
import
org.fortiss.af3.platform.pikeos.model.ResourcePartition
;
/**
*
* @author zverlov
*/
public
class
PartitionArchitectureToPikeOSArchitectureTransformation
{
/** Create {@link PartitionArchitecture} based on PikeOSPA. */
public
static
PlatformArchitecture
createPikeOSArchitecture
(
PartitionArchitecture
virtArch
)
{
Board
board
=
createBoard
(
"Generic Board"
);
Core
core
=
createCore
(
"Generic Core"
);
board
.
getContainedElements
().
add
(
core
);
for
(
Partition
p
:
virtArch
.
getPartitions
())
{
ResourcePartition
ressourcePartition
=
createResourcePartition
(
p
.
getName
());
core
.
getContainedElements
().
add
(
ressourcePartition
);
}
PlatformArchitecture
pa
=
createPlatformArchitecture
();
pa
.
getContainedElements
().
add
(
board
);
return
pa
;
}
public
static
Deployment
allocationToDeployment
(
ComponentToPartitionAllocationTable
allocation
)
{
ComponentArchitecture
ca
=
copy
((
ComponentArchitecture
)
allocation
.
getSourceView
());
PlatformArchitecture
pa
=
createPlatformArchitecture
();
Board
board
=
createBoard
(
"Generic Board"
);
Core
core
=
createCore
(
"Generic Core"
);
Bus
bus
=
createBus
(
"Generic Bus"
);
InterPartitionCommunication
interParCom
=
createInterPartitionCommunication
(
"Generic InterPartitionCom"
);
core
.
getContainedElements
().
add
(
interParCom
);
board
.
getContainedElements
().
add
(
bus
);
board
.
getContainedElements
().
add
(
core
);
Deployment
dep
=
createDeployment
(
"AllocationDeployment"
,
ca
,
pa
);
for
(
ComponentToPartitionAllocationEntry
entry
:
pickInstanceOf
(
ComponentToPartitionAllocationEntry
.
class
,
allocation
.
getContainedElements
()))
{
Partition
p
=
(
Partition
)
entry
.
getTargetElement
();
ResourcePartition
rP
=
createResourcePartition
(
p
.
getName
());
InterPartitionComPort
comPort
=
createInterPartitionComPort
(
"InterPartitionCom_"
+
rP
.
getName
());
rP
.
getConnectors
().
add
(
comPort
);
Component
c
=
(
Component
)
entry
.
getSourceElements
().
get
(
0
);
core
.
getContainedElements
().
add
(
rP
);
ComponentAllocation
compAlloc
=
createComponentAllocation
(
c
,
rP
);
dep
.
getComponentAllocations
().
add
(
compAlloc
);
for
(
InputPortToPartitionInputPortAllocationEntry
inPortEntry
:
pickInstanceOf
(
InputPortToPartitionInputPortAllocationEntry
.
class
,
allocation
.
getContainedElements
()))
{
if
((
c
.
getConnectors
().
contains
(
inPortEntry
.
getSourceElements
().
get
(
0
)))
&&
(
p
.
getConnectors
().
contains
(
inPortEntry
.
getTargetElement
())))
{
InputPort
inputComponent
=
(
InputPort
)
inPortEntry
.
getSourceElements
().
get
(
0
);
Transceiver
rpTransceiverPort
=
rP
.
getTransceiverUnits
().
get
(
0
);
TransceiverAllocation
tranceiverAlloc
=
createTransceiverAllocation
(
inputComponent
,
rpTransceiverPort
);
dep
.
getPortAllocations
().
add
(
tranceiverAlloc
);
}
}
for
(
OutputPortToPartitionOutputPortAllocationEntry
outPortEntry
:
pickInstanceOf
(
OutputPortToPartitionOutputPortAllocationEntry
.
class
,
allocation
.
getContainedElements
()))
{
if
((
c
.
getConnectors
().
contains
(
outPortEntry
.
getSourceElements
().
get
(
0
)))
&&
(
p
.
getConnectors
().
contains
(
outPortEntry
.
getTargetElement
())))
{
OutputPort
outputComponent
=
(
OutputPort
)
outPortEntry
.
getSourceElements
().
get
(
0
);
Transceiver
rpTransceiverPort
=
(
Transceiver
)
rP
.
getConnectors
().
get
(
0
);
TransceiverAllocation
tranceiverAlloc
=
createTransceiverAllocation
(
outputComponent
,
rpTransceiverPort
);
dep
.
getPortAllocations
().
add
(
tranceiverAlloc
);
}
}
}
pa
.
getContainedElements
().
add
(
board
);
return
dep
;
}
}
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment