Porting Implementation of Packet Utilization Standard from ADA to JAVA
300 likes | 513 Vues
Porting Implementation of Packet Utilization Standard from ADA to JAVA. JPUS de-briefing. Annelie Hultman (TEC-EME) Donata Pedrazzani (TEC-EMS) ESA/ESTEC 2004. Introduction. Final presentation of the YGT period Ported part of the PUS Ada framework to Java Aim of presentation
Porting Implementation of Packet Utilization Standard from ADA to JAVA
E N D
Presentation Transcript
Porting Implementation of Packet Utilization Standard from ADA to JAVA JPUS de-briefing Annelie Hultman (TEC-EME) Donata Pedrazzani (TEC-EMS) ESA/ESTEC 2004
Introduction • Final presentation of the YGT period • Ported part of the PUS Ada framework to Java • Aim of presentation • De-briefing of key findings which may be interesting for the sections ESA/ESTEC - JPUS de-briefing
Outline • Architecture issues • Ada packages versus Java OO • Encapsulation of data/visibility • Reusability concepts • Polymorphism • Low-level operations • Porting strategies • Porting of types • Porting of Ada generic package • Porting of protected objects and protected entries • Conclusion ESA/ESTEC - JPUS de-briefing
Outline • Architecture issues • Ada packages versus Java OO • Encapsulation of data/visibility • Reusability concepts • Polymorphism • Low-level operations • Porting strategies • Porting of types • Porting of Ada generic package • Porting of protected objects and protected entries • Conclusion ESA/ESTEC - JPUS de-briefing
Ada packages vs Java OO Ada • Unit of encapsulation: package Java • Unit of encapsulation: class • Package: repository for classes, host-environment facility which contains compiled class files ESA/ESTEC - JPUS de-briefing
Encapsulation of data/visibility Ada • Physical separation between unit’s specification and body • Accessibility given by location of declaration Java • No separation of a class into specification and body • Access control modifiers ESA/ESTEC - JPUS de-briefing
Encapsulation of data/visibility(2) ESA/ESTEC - JPUS de-briefing
Reusability concepts Ada • Specification and compiled units Java • javadoc documentation and bytecode (compiled .class files) ESA/ESTEC - JPUS de-briefing
Polymorphism Def: ability for references and collections to hold objects of different types Ada • Explicit: use of tagged types Java • Implicit from the language ESA/ESTEC - JPUS de-briefing
Polymorphism in Java ESA/ESTEC - JPUS de-briefing
Outline • Architecture issues • Ada packages versus Java OO • Encapsulation of data/visibility • Reusability concepts • Polymorphism • Low-level operations • Porting strategies • Porting of types • Porting of Ada generic package • Porting of protected objects and protected entries • Conclusion ESA/ESTEC - JPUS de-briefing
Low-level operations • Java cannot directly control hardware: programs must declare native methods (i.e. using JNI) and implement such operations in another language • Encoding/decoding to communication link in the framework ESA/ESTEC - JPUS de-briefing
Outline • Architecture issues • Ada packages versus Java OO • Encapsulation of data/visibility • Reusability concepts • Polymorphism • Low-level operations • Porting strategies • Porting of types • Porting of Ada generic package • Porting of protected objects and protected entries • Conclusion ESA/ESTEC - JPUS de-briefing
Porting Strategies • Porting of types • Porting of Ada generic package • Porting of protected objects and protected entries ESA/ESTEC - JPUS de-briefing
Porting of Types • New scalar types • Enumeration types • Arrays • Heterogeneous data structures (records) ESA/ESTEC - JPUS de-briefing
Porting of TypesArrays and Records • Arrays An array is in Java encapsulated in a class together with the operations on the array. This solution is not strictly necessary to carry out the porting, but it is more object oriented. • Heterogeneous data structures (records) A record in Ada is replaced by a class in Java. The operations on the variables of the record type in Ada are in Java implemented inside the class. ESA/ESTEC - JPUS de-briefing
Porting of TypesExample Arrays and Records (1) subtype Command_Index is Natural range 1 .. Schedule_Size; type Command_Schedule is array (Command_Index) ofOptional_Command_Schedule_Info; ESA/ESTEC - JPUS de-briefing
Porting of TypesExample Arrays and Records (2) type Optional_Command_Schedule_Info(Void : Boolean := True) is record case Void is when True => null; when False => Cmd_Schedule_Info : Command_Schedule_Info; end case; end record; ESA/ESTEC - JPUS de-briefing
Porting of TypesExample Arrays and Records (3) type Command_Schedule_Info is record TC_Packet : PUS.PUS_Packet; Sub_Schedule_ID_Inf : Sub_Schedule_ID; Scheduling_Event_Spec_Inf : Scheduling_Event_Spec; Time_Tag : On_Board_Scheduling_Types.CUC_Time; Actual_Schedule_Time : Optional_On_Board_Time; end record; ESA/ESTEC - JPUS de-briefing
1 * packet : TCPacket Porting of TypesExample Arrays and Records (4) ESA/ESTEC - JPUS de-briefing
Porting of Ada generic package An Ada generic package is a template, which can be parameterized, and from which corresponding nongeneric packages (instances) can be obtained. In Java a class serves as a template for creating objects (instances). • Generic Subprogram Parameters • Generic Value Parameters • Generic Type Parameters ESA/ESTEC - JPUS de-briefing
Generic Subprogram Parameters • Ada: The implementation of the actual subprogram is given at the instantiation of the generic package. • Java: The generic Ada package is ported to an Java abstract class. The actual subprogram is implemented in the subclass inheriting from the abstract class. ESA/ESTEC - JPUS de-briefing
Generic Value Parameters • Ada: generic value parameters are used for passing values or variables to a generic package • Java: passing the parameters via the constructor. ESA/ESTEC - JPUS de-briefing
Generic Value ParametersExample Public class CommandSchedule { // Attributes private CommandScheduleInfo [] cmdSchedule; private final int schSize; //Constructor. public CommandSchedule(int scheduleSize){ schSize = scheduleSize; cmdSchedule = new CommandScheduleInfo[schSize]; } // Methods… } ESA/ESTEC - JPUS de-briefing
Generic Type Parameters • Discrete types • Ada: Which discrete type is defined at the instantiation • Java: Integer • Private types • Ada: Any type where assignment and comparison is allowed • Java: PUSPacket class, or more general, Object class ESA/ESTEC - JPUS de-briefing
Generic Type ParametersExample Discrete Types type Sub_Schedule_ID is (< >). The range of the type is used for indexation of arrays. type Sub_Schedule_Times_Type is array (Sub_Schedule_ID)ofPUS_Data_Types.On_Board_Time; Sub_Schedule_Times : Sub_Schedule_Times_Type; In Java: integer type. The array indexation is made by having the number of sub schedules as a constant in e.g. the class MissionParameters.java. private int[] subScheduleTimes = new int[MissionParameters.NUMBER_OF_SUBSCHEDULES]; ESA/ESTEC - JPUS de-briefing
Porting of Protected objects and Protected entries • Protected objects in Ada are implemented in Java by using synchronized methods. • Protected entries in Ada are implemented in Java by using the wait/notify construction in Java ESA/ESTEC - JPUS de-briefing
Outline • Architecture issues • Ada packages versus Java OO • Encapsulation of data/visibility • Reusability concepts • Polymorphism • Low-level operations • Porting strategies • Porting of types • Porting of Ada generic package • Porting of protected objects and protected entries • Conclusion ESA/ESTEC - JPUS de-briefing
Conclusion Porting: • need of a model to understand the Ada code (i.e.:UML) • need of a well-defined porting strategy: • Ada 83 procedural language • Ada 95 has some object-based features • Java object oriented language Some issues to address: • direct communication with the hardware • how to represent low level data types with Java ESA/ESTEC - JPUS de-briefing
Future work • Java • Full implementation of the services • Port to Hard Real Time Java (Aero/jamaica) • Assess the architectural performances • Testing ESA/ESTEC - JPUS de-briefing