330 likes | 417 Views
This comprehensive guide covers the overview of software interactions, interaction life cycle using ISL, and .NET implementation roadmap for improved component coordination and collaboration. Explore various patterns and security considerations.
E N D
Software interactions Anis Charfi,David Emsellem and Michel Riveill I3S Laboratory, Rainbow team CNRS & Nice University http://noah.essi.fr
Roadmap • Overview • Life cycle • Implementation in .NET • Conclusion
Software interactions Overviewhttp://noah.essi.fr
No modification on the component Reusability Dynamically no recompilation no application restart collaboration notification security storage notification storage Needs Add capabilities to components, compose and coordinate them
Needs class Agenda { void addMeeting(Meeting m) throws Exception{ meetingTable.add(m); } List meetingTable; … }
Needs class Agenda { void addMeeting(Meeting m) throws Exception{ meetingTable.add(m); display.notify("addMeeting: "+m.toString( )); } List meetingTable;; Display display; … }
Needs class Agenda { void addMeeting(Meeting m) throws Exception{ if (security.ckeck(…)) { meetingTable.add(m); display.notify("addMeeting: "+m.toString( )); } else { throw new Exception("Invalid operation"); } } List meetingTable;; Display display; SecurityService security; … }
Needs class Agenda { void addMeeting(Meeting m) throws Exception{ if (security.ckeck(…)) { meetingTable.add(m); database.store(getFullName( ),this); display.notify("addMeeting: "+m.toString( )); } else { throw new Exception("Invalid operation"); } } List meetingTable;; Display display; SecurityService security; Database database; … }
Needs void addMeeting(Meeting m) { meetingTable.add(m); } Default behaviour + void addMeeting(Meeting m) { meetingTable.add(m); display.notify("addMeeting: " +m.toString()); } Notification + void addMeeting(Meeting m)throws Exception{ if (security.ckeck(…)) { meetingTable.add(m); } else { throw new Exception("Invalid operation"); } } Security + void addMeeting(Meeting m) { meetingTable.add(m); database.store(getFullName(),this); } Persistance
Software interactions Life cyclehttp://noah.essi.fr
The Interaction Specification Language ISL 11 Syntax Interaction security ( Object obj, SecurityService service ){ obj.* -> if service.check(_call) then obj._call else exception "UnauthorizedUser" endif }
Interactions: Life cycle Interaction service patterns interactions agenda1 display1 Interaction notification(Object obj, Display display){ obj.* -> obj._call // display.notify(_call) }
Interaction service patterns interactions agenda1 display1 Interactions: Life cycle Interaction notification(Object obj, Display display){ obj.* -> obj._call // display.notify(_call) } registerPattern Pattern registration
Interaction service patterns notification interactions agenda1 display1 Interactions: Life cycle Instanciate(notification,[agenda1,display1]) Pattern instantiation
Interaction service patterns notification interactions notification#1 addMeeting() … getName() agenda1 display1 Interactions: Life cycle addRule Pattern instantiation
Interaction service patterns notification interactions notification#1 addMeeting() … getName() agenda1 display1 Interactions: Life cycle interaction security(Object obj, SecurityService service){ obj.addMeeting() -> ifservice.check(_call) then obj._call else exception "UnauthorizedUser" endif } security Service1
Interaction service patterns notification security interactions notification#1 addMeeting() … getName() agenda1 display1 security Service1 Interactions: Life cycle interaction security(Object obj, SecurityService service){ obj.addMeeting() -> ifservice.check(_call) then obj._call else exception "UnauthorizedUser" endif } registerPattern Pattern registration
Interaction service patterns notification security interactions notification#1 addMeeting() … getName() agenda1 display1 security Service1 Interactions: Life cycle Instanciate(security,[agenda1,securityService1]) Pattern instantiation
Interactions: Life cycle Interaction service patterns notification addRule security interactions notification#1 security#1 addMeeting() … getName() agenda1 display1 security Service1 Pattern instantiation
Interactions: Life cycle Interaction service Merging patterns + = notification security interactions notification#1 security#1 addMeeting() … getName() agenda1 display1 security Service1 Rule merging
Interactions: Life cycle Interaction service patterns notification AddMeeting security interactions notification#1 security#1 addMeeting() … getName() agenda1 display1 security Service1 Invocation
Software interactions Implementation http://noah.essi.fr
Noah, the implementation • Released version • http://noah.essi.fr Java + J2EE-Jonas .NET extension (June 2003 ) Specialized rotor version (Sept. 2003)
Porting the Interaction Service to .NET Breaking down the Interaction Service Interaction Server ( Java RMI) Interaction Management Interaction Execution Code Instrumentation Component management services
Notifying Msg IsRuleOn (Msg) [Yes] ExecuteRule [No] Execute Msg Execute (Rule) [No] Ret Value [Yes] Ret Value Method wrappers public void addMeeting(String m) { if(MetaObject.isRuleOn(0)) MetaObject.Execute(0, new Object[]{m}); else NOAH_addMeeting(m); } public void NOAH_addMeeting(String m) { List.add(m); } public void addMeeting(String m) { List.add(m); } Code Instrumentation in .NET Message interception Interacting Component Meta Object Executor Method caller
Code Instrumentation in .NET • Reflection API read class metadata: Problems with method bodies and Exceptions • Reflection.Emit API to emit an copy of the class and insert new members (fields, methods): Problems TypeBuilder creates only empty types, No cursor in emitted IL code • CLIFileReader library to read PE/COFF format and copy method bodies and exceptions • We generate a dynamic copy of the input assembly and then modify it Code Instrumentation in .NET Why Code Instrumentation? Components must store interactions, provide methods for adding/removing interactions, provide wrapper methodsfor message interception
Threading: execution of interactions Interaction rule example Team.addMeeting() -> { [1] Team._call ; Anis._call(var[0]) // David._call(var[0]) @1 } ISL tree Concurrency // Sequence ; WaitingMsg @ 0 QualifiedMsg [0] GlobalCall Anis.addMeeting GlobalCall David.addMeeting NotifyCall Rainbow._call
Threading: execution of interactions The execution engine • Interpreter of the ISL tree (analogous to Java Interpreter) • requires thread synchronization (concurrency, waiting) • Namespace System.Threadingfor multithreading and data access • Concurrency: start 2 child threads and block till they exit • use the method Join() of class Thread • Waitingand Qualified Message: block waiting thread till the qualified message thread exists • use methods Set() and WaitOne(), class ManualResetEvent • In Java no Join(), no SynchronisationEvents (wait() and notify())
Type Unification Code instrumentation: wrappers for business methods • The wrapper passes method parameters to the execution engine • The execution engine returns the method return Value • a) Java • Differentiates primitive types and classes • wrapping/unwrapping managed by the programmer • classes like Double,Integer… • If the reflection method invoke() returns a Double is it actually a double or a Double ? • b) .NET • every thing is an object: Value types and Reference types • Boxing, Unboxing fully transparent to the programmer • CLR automatically converts value types to objects
Language Interoperability Instrumentation occurs at the Intermediate language Level • a) Java: Byte Code • We can compile several languages to Java byte • However no real interoperability, No CTS analogous • b) .NET: MSIL • One tool for many .NET languages: C#, VisualBasic.NET, J# … • Language Interoperability: they share and extend each other classes • we support every .NET language that fulfills Common Language Specification
add rule / IML - add rule - remove rule - call .NET method Java Gateway Web Services .NET Gateway Web Services - merge rules - Noah interface - call Java method merge rules / IML method invocation (3) Cross-platform Interactions JAVA .NET .NET Object Http .NET Object TCP Java Object Interactions also possible between Java and .NET components
Conclusion • We can express interactions between components in a language independent way (ISL) • Dynamic component adaptation. No recompilation, No application restart • The same server manages interactions for Java and .NET components • Support of Interactions between heterogenous components e.g. Java and .NET components • Porting the service from Java to .NET enabled us to understand many of the internals of .NET • The interaction model can be easily extended to other component models such as CORBA CCM
Questions http://noah.essi.fr