Commit 784e90af authored by Rakshit Mittal's avatar Rakshit Mittal
Browse files

support for addition of component libraries

parent 21109010
......@@ -90,7 +90,7 @@ class DIMTransformationDeltaInplace extends DIMTransformationRules{
val componentInstance2Declarative = createRule(FindSubcomponent.Matcher.querySpecification)
.action(CRUDActivationStateEnum.CREATED) [
if (subcompinst.subcomponent === null) {
componentInstanceCreatedDIM(subcompinst, aadlPackage)
componentInstanceCreatedDIM(subcompinst)
if (transformationUtils.propertyInheritancePreference = true) {
transformationUtils.elementCreationPropertyInheritance(subcompinst)
}
......@@ -100,6 +100,10 @@ class DIMTransformationDeltaInplace extends DIMTransformationRules{
}
].action(CRUDActivationStateEnum.UPDATED) [
subcompinst.subcomponent.set(namedElement_Name, subcompinst.name)
if (subcompinst.classifier.eContainer !== aadlPackage) {
aadlPackage.add(packageSection_ImportedUnit, subcompinst.classifier.eContainer)
}
subcompinst.subcomponent.set(subcomponent_Classifier, subcompinst.classifier)
println("DIM: Component instance "+subcompinst.name+" updated")
].action(CRUDActivationStateEnum.DELETED) [
componentInstanceDeletedDIM(subcompinst)
......
......@@ -103,26 +103,26 @@ class DIMTransformationRules {
return topSystemInst;
}
protected def componentInstanceCreatedDIM(ComponentInstance subcompinst, PublicPackageSection aadlpackage) {
protected def componentInstanceCreatedDIM(ComponentInstance subcompinst) {
var compinst = subcompinst.eContainer as ComponentInstance
// Parent Component Implementation Creation
if (compinst.classifier instanceof ComponentType) {
var compimp = {
switch (compinst.category) {
case ComponentCategory.ABSTRACT : aadlpackage.createChild(packageSection_OwnedClassifier,abstractImplementation)
case ComponentCategory.BUS : aadlpackage.createChild(packageSection_OwnedClassifier,busImplementation)
case ComponentCategory.DATA : aadlpackage.createChild(packageSection_OwnedClassifier,dataImplementation)
case ComponentCategory.DEVICE : aadlpackage.createChild(packageSection_OwnedClassifier,deviceImplementation)
case ComponentCategory.MEMORY : aadlpackage.createChild(packageSection_OwnedClassifier,memoryImplementation)
case ComponentCategory.PROCESS : aadlpackage.createChild(packageSection_OwnedClassifier,processImplementation)
case ComponentCategory.PROCESSOR : aadlpackage.createChild(packageSection_OwnedClassifier,processorImplementation)
case ComponentCategory.SUBPROGRAM : aadlpackage.createChild(packageSection_OwnedClassifier,subprogramImplementation)
case ComponentCategory.SUBPROGRAM_GROUP : aadlpackage.createChild(packageSection_OwnedClassifier,subprogramGroupImplementation)
case ComponentCategory.SYSTEM : aadlpackage.createChild(packageSection_OwnedClassifier,systemImplementation)
case ComponentCategory.THREAD : aadlpackage.createChild(packageSection_OwnedClassifier,threadImplementation)
case ComponentCategory.THREAD_GROUP : aadlpackage.createChild(packageSection_OwnedClassifier,threadGroupImplementation)
case ComponentCategory.VIRTUAL_BUS : aadlpackage.createChild(packageSection_OwnedClassifier,virtualBusImplementation)
case ComponentCategory.VIRTUAL_PROCESSOR : aadlpackage.createChild(packageSection_OwnedClassifier,virtualProcessorImplementation)
case ComponentCategory.ABSTRACT : aadlPackage.createChild(packageSection_OwnedClassifier,abstractImplementation)
case ComponentCategory.BUS : aadlPackage.createChild(packageSection_OwnedClassifier,busImplementation)
case ComponentCategory.DATA : aadlPackage.createChild(packageSection_OwnedClassifier,dataImplementation)
case ComponentCategory.DEVICE : aadlPackage.createChild(packageSection_OwnedClassifier,deviceImplementation)
case ComponentCategory.MEMORY : aadlPackage.createChild(packageSection_OwnedClassifier,memoryImplementation)
case ComponentCategory.PROCESS : aadlPackage.createChild(packageSection_OwnedClassifier,processImplementation)
case ComponentCategory.PROCESSOR : aadlPackage.createChild(packageSection_OwnedClassifier,processorImplementation)
case ComponentCategory.SUBPROGRAM : aadlPackage.createChild(packageSection_OwnedClassifier,subprogramImplementation)
case ComponentCategory.SUBPROGRAM_GROUP : aadlPackage.createChild(packageSection_OwnedClassifier,subprogramGroupImplementation)
case ComponentCategory.SYSTEM : aadlPackage.createChild(packageSection_OwnedClassifier,systemImplementation)
case ComponentCategory.THREAD : aadlPackage.createChild(packageSection_OwnedClassifier,threadImplementation)
case ComponentCategory.THREAD_GROUP : aadlPackage.createChild(packageSection_OwnedClassifier,threadGroupImplementation)
case ComponentCategory.VIRTUAL_BUS : aadlPackage.createChild(packageSection_OwnedClassifier,virtualBusImplementation)
case ComponentCategory.VIRTUAL_PROCESSOR : aadlPackage.createChild(packageSection_OwnedClassifier,virtualProcessorImplementation)
}
}
compimp.set(namedElement_Name, compinst.name+".impl")
......@@ -282,20 +282,20 @@ class DIMTransformationRules {
var subcomptype = {
if (subcompinst.classifier === null) {
switch (subcompinst.category) {
case ComponentCategory.ABSTRACT : aadlpackage.createChild(packageSection_OwnedClassifier,abstractType)
case ComponentCategory.BUS : aadlpackage.createChild(packageSection_OwnedClassifier,busType)
case ComponentCategory.DATA : aadlpackage.createChild(packageSection_OwnedClassifier,dataType)
case ComponentCategory.DEVICE : aadlpackage.createChild(packageSection_OwnedClassifier,deviceType)
case ComponentCategory.MEMORY : aadlpackage.createChild(packageSection_OwnedClassifier,memoryType)
case ComponentCategory.PROCESS : aadlpackage.createChild(packageSection_OwnedClassifier,processType)
case ComponentCategory.PROCESSOR : aadlpackage.createChild(packageSection_OwnedClassifier,processorType)
case ComponentCategory.SUBPROGRAM : aadlpackage.createChild(packageSection_OwnedClassifier,subprogramType)
case ComponentCategory.SUBPROGRAM_GROUP : aadlpackage.createChild(packageSection_OwnedClassifier,subprogramGroupType)
case ComponentCategory.SYSTEM : aadlpackage.createChild(packageSection_OwnedClassifier,systemType)
case ComponentCategory.THREAD : aadlpackage.createChild(packageSection_OwnedClassifier,threadType)
case ComponentCategory.THREAD_GROUP : aadlpackage.createChild(packageSection_OwnedClassifier,threadGroupType)
case ComponentCategory.VIRTUAL_BUS : aadlpackage.createChild(packageSection_OwnedClassifier,virtualBusType)
case ComponentCategory.VIRTUAL_PROCESSOR : aadlpackage.createChild(packageSection_OwnedClassifier,virtualProcessorType)
case ComponentCategory.ABSTRACT : aadlPackage.createChild(packageSection_OwnedClassifier,abstractType)
case ComponentCategory.BUS : aadlPackage.createChild(packageSection_OwnedClassifier,busType)
case ComponentCategory.DATA : aadlPackage.createChild(packageSection_OwnedClassifier,dataType)
case ComponentCategory.DEVICE : aadlPackage.createChild(packageSection_OwnedClassifier,deviceType)
case ComponentCategory.MEMORY : aadlPackage.createChild(packageSection_OwnedClassifier,memoryType)
case ComponentCategory.PROCESS : aadlPackage.createChild(packageSection_OwnedClassifier,processType)
case ComponentCategory.PROCESSOR : aadlPackage.createChild(packageSection_OwnedClassifier,processorType)
case ComponentCategory.SUBPROGRAM : aadlPackage.createChild(packageSection_OwnedClassifier,subprogramType)
case ComponentCategory.SUBPROGRAM_GROUP : aadlPackage.createChild(packageSection_OwnedClassifier,subprogramGroupType)
case ComponentCategory.SYSTEM : aadlPackage.createChild(packageSection_OwnedClassifier,systemType)
case ComponentCategory.THREAD : aadlPackage.createChild(packageSection_OwnedClassifier,threadType)
case ComponentCategory.THREAD_GROUP : aadlPackage.createChild(packageSection_OwnedClassifier,threadGroupType)
case ComponentCategory.VIRTUAL_BUS : aadlPackage.createChild(packageSection_OwnedClassifier,virtualBusType)
case ComponentCategory.VIRTUAL_PROCESSOR : aadlPackage.createChild(packageSection_OwnedClassifier,virtualProcessorType)
}
} else {
subcompinst.classifier
......@@ -304,8 +304,8 @@ class DIMTransformationRules {
if (subcompinst.classifier === null) {
subcomptype.set(namedElement_Name,subcompinst.name)
subcompinst.set(componentInstance_Classifier, subcomptype)
} else if (subcompinst.classifier.eContainer !== aadlpackage) {
aadlpackage.add(packageSection_ImportedUnit, compinst.classifier.eContainer)
} else if (subcompinst.classifier.eContainer !== aadlPackage) {
aadlPackage.add(packageSection_ImportedUnit, compinst.classifier.eContainer)
}
if (subcompinst.category == ComponentCategory.ABSTRACT) {
subcomp.set(abstractSubcomponent_AbstractSubcomponentType,subcomptype)
......
......@@ -98,7 +98,7 @@ class DIMTransformationState extends DIMTransformationRules{
// SubComponentInstance transformation
protected val componentInstance2Declarative = createRule(FindSubcomponent.instance)
.action(CRUDActivationStateEnum.CREATED) [
componentInstanceCreatedDIM(subcompinst, aadlPackage)
componentInstanceCreatedDIM(subcompinst)
println("DIM: Component instance "+subcompinst.name+" de-instantiated")
].addLifeCycle(Lifecycles.getDefault(true, true)).build
......
Markdown is supported
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