Skip to content
Snippets Groups Projects
Commit 2a8582bf authored by Stefano puri's avatar Stefano puri
Browse files

Extends PIM to PSM transformation to consider private and public

ARINCFunctions operations. 
In case of private operation, CHRtSpecification is attached to the
component instance (not the slot-port) through the CHRtPortSlot.


Change-Id: Ia47245b8c3db002a3251311157aff38f7ae08322
parent f3187df0
No related branches found
No related tags found
No related merge requests found
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
<extension <extension
point="org.eclipse.m2m.qvt.oml.runtime.qvtTransformation"> point="org.eclipse.m2m.qvt.oml.runtime.qvtTransformation">
<transformation <transformation
file="transformations/CHESS_PIM2PSM.qvto" file="transformations/CHESS_PIM2PSM_Inst_full_VERDE.qvto"
id="transformations/CHESS_PIM2PSM"> id="transformations/CHESS_PIM2PSM">
</transformation> </transformation>
</extension> </extension>
......
...@@ -15,11 +15,16 @@ import org.eclipse.m2m.qvt.oml.blackbox.java.Operation.Kind; ...@@ -15,11 +15,16 @@ import org.eclipse.m2m.qvt.oml.blackbox.java.Operation.Kind;
import org.eclipse.m2m.qvt.oml.util.IContext; import org.eclipse.m2m.qvt.oml.util.IContext;
import org.eclipse.uml2.uml.Activity; import org.eclipse.uml2.uml.Activity;
import org.eclipse.uml2.uml.ActivityFinalNode; import org.eclipse.uml2.uml.ActivityFinalNode;
import org.eclipse.uml2.uml.Comment;
import org.eclipse.uml2.uml.InitialNode; import org.eclipse.uml2.uml.InitialNode;
import org.eclipse.uml2.uml.InstanceSpecification; import org.eclipse.uml2.uml.InstanceSpecification;
import org.eclipse.uml2.uml.OpaqueAction; import org.eclipse.uml2.uml.OpaqueAction;
import org.eclipse.uml2.uml.Package; import org.eclipse.uml2.uml.Package;
import org.eclipse.uml2.uml.UMLFactory; import org.eclipse.uml2.uml.UMLFactory;
import org.polarsys.chess.chessmlprofile.Predictability.RTComponentModel.CHRtPortSlot;
import org.polarsys.chess.chessmlprofile.Predictability.RTComponentModel.CHRtSpecification;
import org.polarsys.chess.chessmlprofile.util.Constants;
import org.polarsys.chess.core.util.uml.ModelError;
import org.polarsys.chess.core.util.uml.UMLUtils; import org.polarsys.chess.core.util.uml.UMLUtils;
...@@ -92,4 +97,31 @@ public class Java4QVTutils { ...@@ -92,4 +97,31 @@ public class Java4QVTutils {
return UMLUtils.getRootInstanceInPackage(self); return UMLUtils.getRootInstanceInPackage(self);
} }
/**
* Updates the occKind property for the CHRtSpecification decorating an ARINCFunction.
* An ARINFFunction derives its period from the owning ARINCProcess.
*
* @param context the context
* @param self the InstanceSpecification instance of ARINCComponentImpl
* @param comment The Comment with the CHRTSpecification decorating the ARINCFunction
* @return
* @throws ModelError
*/
@Operation(kind = Kind.HELPER, contextual = true, withExecutionContext = true)
public static void getUpdatedArincFunChrtSpec(IContext context,
InstanceSpecification self, Comment comment) {
CHRtSpecification chrtspec = (CHRtSpecification) comment.getStereotypeApplication(
comment.getAppliedStereotype(Constants.CHRT_SPECIFICATION)
);
try {
UMLUtils.getUpdatedArincFunChrtSpec(self, chrtspec);
} catch (ModelError e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
} }
...@@ -144,6 +144,8 @@ public class TransUtil { ...@@ -144,6 +144,8 @@ public class TransUtil {
Stereotype stereo = pkg.getAppliedStereotype("CHESS::Core::PSMPackage"); Stereotype stereo = pkg.getAppliedStereotype("CHESS::Core::PSMPackage");
if(stereo != null){ if(stereo != null){
PSMPackage psmPkg = (PSMPackage) pkg.getStereotypeApplication(stereo); PSMPackage psmPkg = (PSMPackage) pkg.getStereotypeApplication(stereo);
if(psmPkg.getAnalysisContext() == null)
continue;
if(psmPkg.getAnalysisContext().getBase_NamedElement().getQualifiedName().equals(saAnalysisQN)){ if(psmPkg.getAnalysisContext().getBase_NamedElement().getQualifiedName().equals(saAnalysisQN)){
psmPackage = pkg; psmPackage = pkg;
platform = ((CHGaResourcePlatform) psmPkg.getAnalysisContext().getPlatform().get(0)).getBase_Package(); platform = ((CHGaResourcePlatform) psmPkg.getAnalysisContext().getPlatform().get(0)).getBase_Package();
......
...@@ -221,19 +221,53 @@ query operationClassName(slot : Slot, name : String) : String { ...@@ -221,19 +221,53 @@ query operationClassName(slot : Slot, name : String) : String {
+ "_" + name + "_" + name
} }
query operationClassName(instance : InstanceSpecification, name : String) : String {
return instance.name + instance.getStringId() + "_" + name
}
query opaqueActionName(slot : Slot, chrtSpec : chessmlprofile::RTComponentModel::CHRtSpecification) : String { query opaqueActionName(slot : Slot, chrtSpec : chessmlprofile::RTComponentModel::CHRtSpecification) : String {
return slot.owningInstance.name + slot.owningInstance.getStringId() + "_" return slot.owningInstance.name + slot.owningInstance.getStringId() + "_"
+ slot.definingFeature![Port].name // + slot.getStringId() + slot.definingFeature![Port].name // + slot.getStringId()
+ "_" + chrtSpec.context.name(); + "_" + chrtSpec.context.name();
} }
query chessmlprofile::RTComponentModel::CHRtSpecification::schedulableResource(slot : Slot) : String { query opaqueActionName(instance : InstanceSpecification, chrtSpec : chessmlprofile::RTComponentModel::CHRtSpecification) : String {
return instance.name + instance.getStringId() + "_" + chrtSpec.context.name();
}
query chessmlprofile::RTComponentModel::CHRtSpecification::schedulableResourceName(chrtportslot : chessmlprofile::RTComponentModel::CHRtPortSlot) : String {
//TODO what happens if the operation (i.e. the 'context') is overloaded? (same name?): resolved with name() query
var slot = chrtportslot.base_Slot;
if (slot <> null) {
return slot.owningInstance.name + slot.owningInstance.getStringId() + "_"
+ slot.definingFeature![Port].name // + slot.getStringId()
+ "_" + self.context.name() + "_task";
}else{
var instance = chrtportslot.base_InstanceSpecification;
return instance.name + instance.getStringId() + "_"
+ "_" + self.context.name() + "_task";
};
return "";
}
/*replaced by the query above
query chessmlprofile::RTComponentModel::CHRtSpecification::schedulableResourceName(slot : Slot) : String {
//TODO what happens if the operation (i.e. the 'context') is overloaded? (same name?): resolved with name() query //TODO what happens if the operation (i.e. the 'context') is overloaded? (same name?): resolved with name() query
return slot.owningInstance.name + slot.owningInstance.getStringId() + "_" return slot.owningInstance.name + slot.owningInstance.getStringId() + "_"
+ slot.definingFeature![Port].name // + slot.getStringId() + slot.definingFeature![Port].name // + slot.getStringId()
+ "_" + self.context.name() + "_task"; + "_" + self.context.name() + "_task";
} }
query chessmlprofile::RTComponentModel::CHRtSpecification::schedulableResourceName(instance : InstanceSpecification) : String {
//TODO what happens if the operation (i.e. the 'context') is overloaded? (same name?): resolved with name() query
return instance.name + instance.getStringId() + "_"
+ "_" + self.context.name() + "_task";
}*/
-- CHESS Stereotype Qualified Names -- CHESS Stereotype Qualified Names
property ComponentImplementationQN = "CHESS::ComponentModel::ComponentImplementation"; property ComponentImplementationQN = "CHESS::ComponentModel::ComponentImplementation";
...@@ -250,6 +284,10 @@ property ComponentViewQN ="CHESS::Core::CHESSViews::ComponentView"; ...@@ -250,6 +284,10 @@ property ComponentViewQN ="CHESS::Core::CHESSViews::ComponentView";
property IdentifInstanceQN = "CHESS::Core::IdentifInstance"; property IdentifInstanceQN = "CHESS::Core::IdentifInstance";
property IdentifSlotQN = "CHESS::Core::IdentifSlot"; property IdentifSlotQN = "CHESS::Core::IdentifSlot";
property ARINCFunctionQN = "CHESS::Predictability::ARINCComponentModel::ARINCFunction";
property ARINCProcessQN = "CHESS::Predictability::ARINCComponentModel::ARINCProcess";
property ARINCComponentQN = "CHESS::Predictability::ARINCComponentModel::ARINCComponentImpl";
-- MARTE Stereotype Qualified Names -- MARTE Stereotype Qualified Names
property ClientServerPortQN = "MARTE::MARTE_DesignModel::GCM::ClientServerPort"; property ClientServerPortQN = "MARTE::MARTE_DesignModel::GCM::ClientServerPort";
property AssignQN = "MARTE::MARTE_Foundations::Alloc::Assign"; property AssignQN = "MARTE::MARTE_Foundations::Alloc::Assign";
......
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