SlideShare a Scribd company logo
1 of 29
Download to read offline
Using DSL for Automatic
 Generation of Software Connectors


TomΓ‘Ε‘ BureΕ‘, Michal Malohlava, Petr HnΔ›tynka

         DISTRIBUTED SYSTEMS RESEARCH GROUP
                   http://dsrg.mff.cuni.cz/

            CHARLES UNIVERSITY IN PRAGUE
             Faculty of Mathematics and Physics
Outline
     ●   Components and Connectors
     ●   Connector generation
     ●   Proposed connector code generator
           –   Template system
           –   Code generation engine
     ●   Conclusion




28.2.2008, ICCBSS 2008, Madrid               2
Components
     ●   Component
                 ●   Independent entity implementing some functionality
                 ●   Provides/requires interfaces
     ●   Typical development cycle
           –   Design
           –   Implementation
           –   Deployment
           –   Execution
     ●   SOFA component system (http://sofa.ow2.org/)


28.2.2008, ICCBSS 2008, Madrid                                            3
Connectors? Why?
    ●   Why should be a component interested in communication?
        => Connectors
         –   Displace communication matters
             from components
         –   Can connect different component
             technologies
    ●   Connectors
         –   Design time view
               ●   Model component interaction (communication style, non-functional
                   properties)
               ●   Represent only bindings and their properties
         –   Implementation view
               ●   Implements interaction with help of some middleware (RMI, JMS,...)
               ●   Implements additional services
                   (logging, benchmarking, ...)
28.2.2008, ICCBSS 2008, Madrid                                                          4
Connector generation
     ●   Automatically during deployment time
           –   Application components are distributed, connected
           –   All information about application are known...
                 ●   Distribution of application components
                 ●   Component interfaces' signatures
                 ●   Connection requirements, NFP (security, logging,...)
           –   ... and stored in a high-level connector specification
                 ●   Generated by a deployment tool    connector {
                                                         unit β€œclient_unit” {
                     in according to                       dock β€œnodeA”
                                                           provided port β€œcall”
                     a defined deployment plan             signature β€œIservice”
                                                           nfp β€œcommunication_style”
                 ●   Input for a connector generator           β€œmethod_invocation”
                                                         }
                                                         ...
                                                       }

28.2.2008, ICCBSS 2008, Madrid                                                         5
Connector architecture
     ●   Connector
           –   Connector units
                 ●   Top-level connector elements
                 ●   Remote bindings (between remote ports)
           –   Connector elements
                 ●   Element ports
                 ●   Primitive/composite
                 ●   Only local bindings




28.2.2008, ICCBSS 2008, Madrid                                6
Architecture of connector generator
     ●   Architecture resolver
           –   Find an architecture of a connector in according to described
               requirements (H-LCS)
     ●   Source code generation
           –   Driven by generation script
                 ●   Step-by-step process
           –   Generates source code from:
                 ●   Low-level connector
                     configuration
                 ●   Simple templates
           –   Compile generated code
           –   Package binaries


28.2.2008, ICCBSS 2008, Madrid                                                 7
Architecture of connector generator
     ●   Architecture resolver
           –   Find architecture of connector in according to described
               requirements (H-LCS)
     ●   Source code generation
           –   Driven by generation script
                 ●   Step-by-step process
           –   Generates source code from:
                 ●   Low-level connector
                     configuration
                 ●   Simple templates
           –   Compile generated code
           –   Package binaries


28.2.2008, ICCBSS 2008, Madrid                                            8
Low level connector configuration
     ●   Low-level connector configuration
           –   Input for source code generator
           –   Description of resolved connector architecture:
                 ●   Describes ports
                       –   Name
                       –   Type (provided, required, remote)
                       –   Resolved port signature
                 ●   List of sub-elements
                 ●   Bindings between sub-elements
                 ●   Selects template for implementation




28.2.2008, ICCBSS 2008, Madrid                                   9
Simple template system
     ●   Simple code templates which are processed by a Java class
           –   Class just substitutes parts enclosed in % by Java code
     ●   Sufficient for primitive connector elements, but for composite
         elements Java class generates all code:
         package %PACKAGE%;
         imports org...runtime.*;
         public class %CLASS% implements
                ElementLocalServer ,
                ElementLocalClient ,
                ElementRemoteServer ,
                ElementRemoteClient {
                protected Element[] subElements ;
                protected UnitReferenceBundle[] boundedToRRef;
                public %CLASS%( ) {
                }
               %INIT METHODS% // this part processed by special
                                  Java class
         }

28.2.2008, ICCBSS 2008, Madrid                                            10
Simple template system
     ●   Simple code templates which are processed by a Java class
           –   Class just substitutes parts enclosed in % by Java code
     ●   Sufficient for primitive connector elements, but for composite
         elements Java class generates all code:
         package %PACKAGE%;
         imports org...runtime.*;
         public class %CLASS% implements This variable is unfolded
                ElementLocalServer ,       into 200LOC by a Java
                ElementLocalClient ,         class with 1200LOC!
                ElementRemoteServer ,
                ElementRemoteClient {
                protected Element[] subElements ;
                protected UnitReferenceBundle[] boundedToRRef;
                public %CLASS%( ) {
                }
               %INIT METHODS% // this part processed by special
                                  Java class
         }

28.2.2008, ICCBSS 2008, Madrid                                            11
Issues of the simple template system
     ●   Connector implementation defined at several
         places
     ●   Java class does not allow syntax checking of
         generated code
           –   Error prone
     ●   Bad maintainability of generator classes
           –   Large blocks of System.out.println(β€œ...”);

     ●   Solution – new Domain Specific Language
         (DSL)

28.2.2008, ICCBSS 2008, Madrid                              12
Proposed template system
     ●   Template system based on a new DSL
           –   DSL describing connector elements
                 ●   Should support writing connector implementations in
                     different programming languages
                       –   Should allows easy development (syntax checking,
                           debugging,...)
                 ●   Extensible
     ●   Generation framework
           –   Processing DSL
           –   Generating target source code
                 ●   Code per connector element
                 ●   Independent on a chosen target language
28.2.2008, ICCBSS 2008, Madrid                                                13
DSL – ElLang basics
     ●   Designed new DSL
           –   Mixture of the meta-language ElLang (element language) and a
               target language (Java)
                 ●   Used MetaBorg method
                       –   Allows embedding language into another language
                             ● Connecting selected nonterminals of both languages


     ●   Meta-language ElLang (target language independent)
           –   Meta-variables
                 ●   ${a}, ${a[index]}
           –   Meta-queries (querying input XML)
                 ●   ${a.b.c}
           –   Meta-statements
                 ●   $set, $if, $include, $foreach, $rforeach
28.2.2008, ICCBSS 2008, Madrid                                                      14
DSL – ElLang basics
     ●   Designed new Domain Specific Language
             Mixture of meta-language
           – Recursive foreach                     ElLang and target language (Java)
                 ●   MetaBorg method developed by Stratego/XT group
               $rforeach(PORT in ${ports.port(type=PROVIDED)} )$
                if (quot;${PORT.name}quot;.equals(portName)) { into another language
                       – Allows embedding language

                  Object Connecting selected neterminals of both languages
                       – result = ((ElementLocalServer) subElements[${el[PORT....]}]);
                            ●    Defined via SDF
              if (isTopLevel) {
     ●   Meta-language ElLang
                dcm.reregisterConnectorUnitReference(parentUnit, portName, result);
              }
          – Meta-variables
              return result;
            } else $recpoint$
              ● ${a}, ${a[index]}
            $final$
               throw new ElementLinkException(quot;Invalid port 'quot;+portName+quot;'.quot;);
          – Meta-queries
            $end$
                 ●   ${a.b.c}
           –   Meta-statements
                 ●   $set, $if, $include, $foreach, $rforeach
28.2.2008, ICCBSS 2008, Madrid                                                           15
DSL – ElLang advanced features
     ●   Special meta-statements
           –   Simple templates inheritance (extends)
           –   Extension points ($extPoint$)
                 ●   Allow define points in a template which can be extended
                     in a child template
           –   Method templates
                 ●   Important for implementing component interfaces
                       –   ! component iface is not known when template is designing !
                 ●   ElLang has to provides information about methods of an
                     interface
                       –   ${method.name}, ${method.variables}, ...



28.2.2008, ICCBSS 2008, Madrid                                                           16
DSL – ElLang advanced features
     ●   Special meta-statements
           element console_log extends quot;primitive_default.ellangquot; {
           –   Simplemethod interfaceinheritance (extends)
                  implements
                       templates ${ports.port(name=in).signature} {
                             template {
                                 ${method.declareReturnValue}
           –   Extension points ($extPoint$)
                                 System.out.println(quot;method > ${method.name} < calledquot;);
                 ●   Allow define points in template which can be extended in
                     a child template
                              $if (method.returnVar) $
                            ${method.returnVar}
           – Method templates
                            = this.target.${method.name}(${method.variables});
                       $else$
              ● Important for implementing component interfaces
                            this.target.${method.name}(${method.variables});
                       $end$
                       –   ! component iface is not known when templates is designing !
                 ●   Language shouldreturn statemene if it is needed
                           //generates provides information about iface
                           ${method.returnStm}
                     methods
                         }
                       }
                       –   ${method.name}, ${method.variables}, ...
                 }


28.2.2008, ICCBSS 2008, Madrid                                                             17
DSL – element template structure
     ●   ElLang-J = an instance of ElLang
           –   For generating Java code
     ●   Connector element template:
                      package ${package};
                      import org . . . runtime .* ;

                      element console_log extends β€œprimitive_default.ellang” {
                        public ${classname} { /* constructor */ }

                         implements interface ElementLocalClient {
                           public void bindElPort(String portName , Object target ) {
                             /* ... */
                           }
                         }
                        implements interface ${ ports.port (name=line).signature} {
                          method template { /* ... */ }
                        }

28.2.2008, ICCBSS 2008, Madrid                                                          18
Generator architecture
     ●   Java part
           –   Prepares low-level connector configuration (L-LCC)
                 ●   Description of connector element internals
           –   Calls source code generator implemented in
               Stratego
     ●   Stratego part
           –   Implemented in Stratego language
                 ●   In fact compiled C-source code
           –   Generates source code
                 ●   From template written in ElLang-J
                 ●   From L-LCC passed from Java part of generator
28.2.2008, ICCBSS 2008, Madrid                                       19
Stratego/XT
     ●   Developed at Delft University of Technology,
         Netherlands
     ●   Tool set
           –   Grammar tools
                 ●   SDF – Syntax Definition Formalism
                 ●   Pretty printers
                 ●   Grammar definitions (Java, C/C++, XML, ...)
           –   Program transformation language Stratego
                 ●   Input represented as Abstract Syntax Tree (AST)
                       –   Term representation of AST called ATerm
                 ●   Based on rewriting of AST via strategies

28.2.2008, ICCBSS 2008, Madrid                                         20
Stratego/XT - architecture
     ●   How does it work?




28.2.2008, ICCBSS 2008, Madrid    21
Generator - Java part
     ●   Implementing action interface
           –   Therefore it can be used as a new action in connector
               element build script
           –   Rewrites low-level connector configuration into XML and
               passed it to Stratego part
     ●   Bridge between Java and Stratego:
           –   JNI bridge
           –   Shell bridge (execute connector generator)




28.2.2008, ICCBSS 2008, Madrid                                           22
Generator – Stratego part
     ●   Pipe line of several small transformation components
           –   Input XML preprocessor
           –   Template parser
           –   Template evaluation
           –   Target code generator
           –   Query component
     ●   All of them transform and
         produce AST




28.2.2008, ICCBSS 2008, Madrid                                  23
Stratego part – query component
     ●   Provides access to input XML (contains L-LCC)
           –   Simple queries Γ  la XPath
                 ●   Traversing XML
                       –   ${ports.port.name}
                 ●   conditions
                       –${ports.port(name=call).signature}
                          ● Returns signature of port called β€œcall”

                 ●   Count operator
                      – ${elements.element#count}
                          ● Returns number of sub-elements




28.2.2008, ICCBSS 2008, Madrid                                        24
Stratego part – evaluation component
     ●   Pipe-line of evaluation modules
           –   Processing extends statements
           –   Processing imports statements
           –   Template adjustment
                 ●   Normalization of statements with different notations
                       –   e.g. If -> If-Else ( in ATerms: If(cond,body) -> If(cond, body, []))
           –   Queries evaluation
           –   Meta-statements evaluation
     ●   Resulting AST is
         transformed into
         target code
28.2.2008, ICCBSS 2008, Madrid                                                                    25
Evaluation
     ●   Integrated in our SOFA component model
           –   It works :-)
     ●   But it is suitable for any component model
           –   And even for non-component based systems




28.2.2008, ICCBSS 2008, Madrid                            26
Evaluation (pros and cons)
     ●   Advantages
           –   Simple template system allowing easy writing of connector
               implementations
                 ●Generic solution
                ● Allows syntax checking


           –   Extensible template language
                 ●Allows defining new clones of ElLang in according to
                  specified requirements (e.g. ElLang-C#)
           –   Solutions is not invasive - proposed source code generator
               can be used just by modifying a build script controlling a
               connector generation
     ●   Disadvantages
           –   Stratego/XT is C-based, rest of generator is in Java
28.2.2008, ICCBSS 2008, Madrid                                              27
Future work
     ●   Byte code manipulation
           –   To avoid need of javac (~SDK) during deployment
               process
           –   Pre-compiled templates into binary form (templated
               bytecode)
                 ●   Fast template evaluation
     ●   Simplifying connector implementation
           –   Merging generated Java classes
     ●   Implementing ElLang for other target languages
         (e.g. ElLang-C#)
     ●   Simplifying method templates
28.2.2008, ICCBSS 2008, Madrid                                      28
Comments & Questions




                            Thank you for your attention!




28.2.2008, ICCBSS 2008, Madrid                              29

More Related Content

Viewers also liked

TAROT2013 Testing School - Antonia Bertolino presentation
TAROT2013 Testing School - Antonia Bertolino presentationTAROT2013 Testing School - Antonia Bertolino presentation
TAROT2013 Testing School - Antonia Bertolino presentationHenry Muccini
Β 
Modellazione UML per il WEB: Approccio di Conallen
Modellazione UML per il WEB: Approccio di ConallenModellazione UML per il WEB: Approccio di Conallen
Modellazione UML per il WEB: Approccio di ConallenHenry Muccini
Β 
SERENE 2014 School: Gabor karsai serene2014_school
SERENE 2014 School: Gabor karsai serene2014_schoolSERENE 2014 School: Gabor karsai serene2014_school
SERENE 2014 School: Gabor karsai serene2014_schoolHenry Muccini
Β 
Software Architecture Styles
Software Architecture StylesSoftware Architecture Styles
Software Architecture StylesHenry Muccini
Β 
UML per il Web: User Centric Design
UML per il Web: User Centric DesignUML per il Web: User Centric Design
UML per il Web: User Centric DesignHenry Muccini
Β 
Progettazione e sviluppo di un'applicazione web per la gestione di dati di at...
Progettazione e sviluppo di un'applicazione web per la gestione di dati di at...Progettazione e sviluppo di un'applicazione web per la gestione di dati di at...
Progettazione e sviluppo di un'applicazione web per la gestione di dati di at...daniel_zotti
Β 
Introduzione a UML
Introduzione a UMLIntroduzione a UML
Introduzione a UMLRiccardo Cardin
Β 
Software Architecture Views and Viewpoints
Software Architecture Views and ViewpointsSoftware Architecture Views and Viewpoints
Software Architecture Views and ViewpointsHenry Muccini
Β 
UML per il Web: Approccio WEBML
UML per il Web: Approccio WEBMLUML per il Web: Approccio WEBML
UML per il Web: Approccio WEBMLHenry Muccini
Β 

Viewers also liked (9)

TAROT2013 Testing School - Antonia Bertolino presentation
TAROT2013 Testing School - Antonia Bertolino presentationTAROT2013 Testing School - Antonia Bertolino presentation
TAROT2013 Testing School - Antonia Bertolino presentation
Β 
Modellazione UML per il WEB: Approccio di Conallen
Modellazione UML per il WEB: Approccio di ConallenModellazione UML per il WEB: Approccio di Conallen
Modellazione UML per il WEB: Approccio di Conallen
Β 
SERENE 2014 School: Gabor karsai serene2014_school
SERENE 2014 School: Gabor karsai serene2014_schoolSERENE 2014 School: Gabor karsai serene2014_school
SERENE 2014 School: Gabor karsai serene2014_school
Β 
Software Architecture Styles
Software Architecture StylesSoftware Architecture Styles
Software Architecture Styles
Β 
UML per il Web: User Centric Design
UML per il Web: User Centric DesignUML per il Web: User Centric Design
UML per il Web: User Centric Design
Β 
Progettazione e sviluppo di un'applicazione web per la gestione di dati di at...
Progettazione e sviluppo di un'applicazione web per la gestione di dati di at...Progettazione e sviluppo di un'applicazione web per la gestione di dati di at...
Progettazione e sviluppo di un'applicazione web per la gestione di dati di at...
Β 
Introduzione a UML
Introduzione a UMLIntroduzione a UML
Introduzione a UML
Β 
Software Architecture Views and Viewpoints
Software Architecture Views and ViewpointsSoftware Architecture Views and Viewpoints
Software Architecture Views and Viewpoints
Β 
UML per il Web: Approccio WEBML
UML per il Web: Approccio WEBMLUML per il Web: Approccio WEBML
UML per il Web: Approccio WEBML
Β 

Similar to Using DSL for generation of software connectors

Using Stratego/XT for generation of software connectors.
Using Stratego/XT for generation of software connectors.Using Stratego/XT for generation of software connectors.
Using Stratego/XT for generation of software connectors.Michal Malohlava
Β 
Tos tutorial
Tos tutorialTos tutorial
Tos tutorialmanikainth
Β 
Use Eclipse technologies to build a modern embedded IDE
Use Eclipse technologies to build a modern embedded IDEUse Eclipse technologies to build a modern embedded IDE
Use Eclipse technologies to build a modern embedded IDEBenjamin CabΓ©
Β 
AADL: Architecture Analysis and Design Language
AADL: Architecture Analysis and Design LanguageAADL: Architecture Analysis and Design Language
AADL: Architecture Analysis and Design LanguageIvano Malavolta
Β 
Custom Detectors for FindBugs (London Java Community Unconference 2)
Custom Detectors for FindBugs (London Java Community Unconference 2)Custom Detectors for FindBugs (London Java Community Unconference 2)
Custom Detectors for FindBugs (London Java Community Unconference 2)Robin Fernandes
Β 
Cloud compiler - Minor Project by students of CBPGEC
Cloud compiler - Minor Project by students of CBPGEC  Cloud compiler - Minor Project by students of CBPGEC
Cloud compiler - Minor Project by students of CBPGEC vipin kumar
Β 
Introdot Netc Sharp En
Introdot Netc Sharp EnIntrodot Netc Sharp En
Introdot Netc Sharp EnGregory Renard
Β 
IBM Rational Rhapsody and Qt Integration
IBM Rational Rhapsody and Qt IntegrationIBM Rational Rhapsody and Qt Integration
IBM Rational Rhapsody and Qt Integrationgjuljo
Β 
PHP Development Tools 2.0 - Success Story
PHP Development Tools 2.0 - Success StoryPHP Development Tools 2.0 - Success Story
PHP Development Tools 2.0 - Success StoryMichael Spector
Β 
Simulation using OMNet++
Simulation using OMNet++Simulation using OMNet++
Simulation using OMNet++jeromy fu
Β 
Java ME Networking & Connectivity
Java ME Networking & ConnectivityJava ME Networking & Connectivity
Java ME Networking & ConnectivityStefano Sanna
Β 
2006 Esug Omnibrowser
2006 Esug Omnibrowser2006 Esug Omnibrowser
2006 Esug Omnibrowserbergel
Β 

Similar to Using DSL for generation of software connectors (20)

Using Stratego/XT for generation of software connectors.
Using Stratego/XT for generation of software connectors.Using Stratego/XT for generation of software connectors.
Using Stratego/XT for generation of software connectors.
Β 
Tos tutorial
Tos tutorialTos tutorial
Tos tutorial
Β 
Use Eclipse technologies to build a modern embedded IDE
Use Eclipse technologies to build a modern embedded IDEUse Eclipse technologies to build a modern embedded IDE
Use Eclipse technologies to build a modern embedded IDE
Β 
Omnet++
Omnet++Omnet++
Omnet++
Β 
AADL: Architecture Analysis and Design Language
AADL: Architecture Analysis and Design LanguageAADL: Architecture Analysis and Design Language
AADL: Architecture Analysis and Design Language
Β 
Custom Detectors for FindBugs (London Java Community Unconference 2)
Custom Detectors for FindBugs (London Java Community Unconference 2)Custom Detectors for FindBugs (London Java Community Unconference 2)
Custom Detectors for FindBugs (London Java Community Unconference 2)
Β 
Cloud compiler - Minor Project by students of CBPGEC
Cloud compiler - Minor Project by students of CBPGEC  Cloud compiler - Minor Project by students of CBPGEC
Cloud compiler - Minor Project by students of CBPGEC
Β 
Introdot Netc Sharp En
Introdot Netc Sharp EnIntrodot Netc Sharp En
Introdot Netc Sharp En
Β 
IBM Rational Rhapsody and Qt Integration
IBM Rational Rhapsody and Qt IntegrationIBM Rational Rhapsody and Qt Integration
IBM Rational Rhapsody and Qt Integration
Β 
PHP Development Tools 2.0 - Success Story
PHP Development Tools 2.0 - Success StoryPHP Development Tools 2.0 - Success Story
PHP Development Tools 2.0 - Success Story
Β 
Simulation using OMNet++
Simulation using OMNet++Simulation using OMNet++
Simulation using OMNet++
Β 
Java ME Networking & Connectivity
Java ME Networking & ConnectivityJava ME Networking & Connectivity
Java ME Networking & Connectivity
Β 
Resume
ResumeResume
Resume
Β 
3rd 3DDRESD: SysGen
3rd 3DDRESD: SysGen3rd 3DDRESD: SysGen
3rd 3DDRESD: SysGen
Β 
Mina2
Mina2Mina2
Mina2
Β 
2006 Esug Omnibrowser
2006 Esug Omnibrowser2006 Esug Omnibrowser
2006 Esug Omnibrowser
Β 
Nanaji_Jonnadula
Nanaji_JonnadulaNanaji_Jonnadula
Nanaji_Jonnadula
Β 
VLSI
VLSIVLSI
VLSI
Β 
VLSI
VLSIVLSI
VLSI
Β 
Jnode
JnodeJnode
Jnode
Β 

Recently uploaded

Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...Neo4j
Β 
My Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationMy Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationRidwan Fadjar
Β 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationRadu Cotescu
Β 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdfhans926745
Β 
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 3652toLead Limited
Β 
Enhancing Worker Digital Experience: A Hands-on Workshop for Partners
Enhancing Worker Digital Experience: A Hands-on Workshop for PartnersEnhancing Worker Digital Experience: A Hands-on Workshop for Partners
Enhancing Worker Digital Experience: A Hands-on Workshop for PartnersThousandEyes
Β 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreternaman860154
Β 
Breaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountBreaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountPuma Security, LLC
Β 
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfThe Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfEnterprise Knowledge
Β 
FULL ENJOY πŸ” 8264348440 πŸ” Call Girls in Diplomatic Enclave | Delhi
FULL ENJOY πŸ” 8264348440 πŸ” Call Girls in Diplomatic Enclave | DelhiFULL ENJOY πŸ” 8264348440 πŸ” Call Girls in Diplomatic Enclave | Delhi
FULL ENJOY πŸ” 8264348440 πŸ” Call Girls in Diplomatic Enclave | Delhisoniya singh
Β 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘RTylerCroy
Β 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonAnna Loughnan Colquhoun
Β 
WhatsApp 9892124323 βœ“Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 βœ“Call Girls In Kalyan ( Mumbai ) secure serviceWhatsApp 9892124323 βœ“Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 βœ“Call Girls In Kalyan ( Mumbai ) secure servicePooja Nehwal
Β 
CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Servicegiselly40
Β 
Slack Application Development 101 Slides
Slack Application Development 101 SlidesSlack Application Development 101 Slides
Slack Application Development 101 Slidespraypatel2
Β 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking MenDelhi Call girls
Β 
The Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxThe Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxMalak Abu Hammad
Β 
Maximizing Board Effectiveness 2024 Webinar.pptx
Maximizing Board Effectiveness 2024 Webinar.pptxMaximizing Board Effectiveness 2024 Webinar.pptx
Maximizing Board Effectiveness 2024 Webinar.pptxOnBoard
Β 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsMaria Levchenko
Β 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationSafe Software
Β 

Recently uploaded (20)

Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Β 
My Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationMy Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 Presentation
Β 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organization
Β 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf
Β 
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Β 
Enhancing Worker Digital Experience: A Hands-on Workshop for Partners
Enhancing Worker Digital Experience: A Hands-on Workshop for PartnersEnhancing Worker Digital Experience: A Hands-on Workshop for Partners
Enhancing Worker Digital Experience: A Hands-on Workshop for Partners
Β 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreter
Β 
Breaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountBreaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path Mount
Β 
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfThe Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
Β 
FULL ENJOY πŸ” 8264348440 πŸ” Call Girls in Diplomatic Enclave | Delhi
FULL ENJOY πŸ” 8264348440 πŸ” Call Girls in Diplomatic Enclave | DelhiFULL ENJOY πŸ” 8264348440 πŸ” Call Girls in Diplomatic Enclave | Delhi
FULL ENJOY πŸ” 8264348440 πŸ” Call Girls in Diplomatic Enclave | Delhi
Β 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘
Β 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt Robison
Β 
WhatsApp 9892124323 βœ“Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 βœ“Call Girls In Kalyan ( Mumbai ) secure serviceWhatsApp 9892124323 βœ“Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 βœ“Call Girls In Kalyan ( Mumbai ) secure service
Β 
CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Service
Β 
Slack Application Development 101 Slides
Slack Application Development 101 SlidesSlack Application Development 101 Slides
Slack Application Development 101 Slides
Β 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men
Β 
The Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxThe Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptx
Β 
Maximizing Board Effectiveness 2024 Webinar.pptx
Maximizing Board Effectiveness 2024 Webinar.pptxMaximizing Board Effectiveness 2024 Webinar.pptx
Maximizing Board Effectiveness 2024 Webinar.pptx
Β 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed texts
Β 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
Β 

Using DSL for generation of software connectors

  • 1. Using DSL for Automatic Generation of Software Connectors TomΓ‘Ε‘ BureΕ‘, Michal Malohlava, Petr HnΔ›tynka DISTRIBUTED SYSTEMS RESEARCH GROUP http://dsrg.mff.cuni.cz/ CHARLES UNIVERSITY IN PRAGUE Faculty of Mathematics and Physics
  • 2. Outline ● Components and Connectors ● Connector generation ● Proposed connector code generator – Template system – Code generation engine ● Conclusion 28.2.2008, ICCBSS 2008, Madrid 2
  • 3. Components ● Component ● Independent entity implementing some functionality ● Provides/requires interfaces ● Typical development cycle – Design – Implementation – Deployment – Execution ● SOFA component system (http://sofa.ow2.org/) 28.2.2008, ICCBSS 2008, Madrid 3
  • 4. Connectors? Why? ● Why should be a component interested in communication? => Connectors – Displace communication matters from components – Can connect different component technologies ● Connectors – Design time view ● Model component interaction (communication style, non-functional properties) ● Represent only bindings and their properties – Implementation view ● Implements interaction with help of some middleware (RMI, JMS,...) ● Implements additional services (logging, benchmarking, ...) 28.2.2008, ICCBSS 2008, Madrid 4
  • 5. Connector generation ● Automatically during deployment time – Application components are distributed, connected – All information about application are known... ● Distribution of application components ● Component interfaces' signatures ● Connection requirements, NFP (security, logging,...) – ... and stored in a high-level connector specification ● Generated by a deployment tool connector { unit β€œclient_unit” { in according to dock β€œnodeA” provided port β€œcall” a defined deployment plan signature β€œIservice” nfp β€œcommunication_style” ● Input for a connector generator β€œmethod_invocation” } ... } 28.2.2008, ICCBSS 2008, Madrid 5
  • 6. Connector architecture ● Connector – Connector units ● Top-level connector elements ● Remote bindings (between remote ports) – Connector elements ● Element ports ● Primitive/composite ● Only local bindings 28.2.2008, ICCBSS 2008, Madrid 6
  • 7. Architecture of connector generator ● Architecture resolver – Find an architecture of a connector in according to described requirements (H-LCS) ● Source code generation – Driven by generation script ● Step-by-step process – Generates source code from: ● Low-level connector configuration ● Simple templates – Compile generated code – Package binaries 28.2.2008, ICCBSS 2008, Madrid 7
  • 8. Architecture of connector generator ● Architecture resolver – Find architecture of connector in according to described requirements (H-LCS) ● Source code generation – Driven by generation script ● Step-by-step process – Generates source code from: ● Low-level connector configuration ● Simple templates – Compile generated code – Package binaries 28.2.2008, ICCBSS 2008, Madrid 8
  • 9. Low level connector configuration ● Low-level connector configuration – Input for source code generator – Description of resolved connector architecture: ● Describes ports – Name – Type (provided, required, remote) – Resolved port signature ● List of sub-elements ● Bindings between sub-elements ● Selects template for implementation 28.2.2008, ICCBSS 2008, Madrid 9
  • 10. Simple template system ● Simple code templates which are processed by a Java class – Class just substitutes parts enclosed in % by Java code ● Sufficient for primitive connector elements, but for composite elements Java class generates all code: package %PACKAGE%; imports org...runtime.*; public class %CLASS% implements ElementLocalServer , ElementLocalClient , ElementRemoteServer , ElementRemoteClient { protected Element[] subElements ; protected UnitReferenceBundle[] boundedToRRef; public %CLASS%( ) { } %INIT METHODS% // this part processed by special Java class } 28.2.2008, ICCBSS 2008, Madrid 10
  • 11. Simple template system ● Simple code templates which are processed by a Java class – Class just substitutes parts enclosed in % by Java code ● Sufficient for primitive connector elements, but for composite elements Java class generates all code: package %PACKAGE%; imports org...runtime.*; public class %CLASS% implements This variable is unfolded ElementLocalServer , into 200LOC by a Java ElementLocalClient , class with 1200LOC! ElementRemoteServer , ElementRemoteClient { protected Element[] subElements ; protected UnitReferenceBundle[] boundedToRRef; public %CLASS%( ) { } %INIT METHODS% // this part processed by special Java class } 28.2.2008, ICCBSS 2008, Madrid 11
  • 12. Issues of the simple template system ● Connector implementation defined at several places ● Java class does not allow syntax checking of generated code – Error prone ● Bad maintainability of generator classes – Large blocks of System.out.println(β€œ...”); ● Solution – new Domain Specific Language (DSL) 28.2.2008, ICCBSS 2008, Madrid 12
  • 13. Proposed template system ● Template system based on a new DSL – DSL describing connector elements ● Should support writing connector implementations in different programming languages – Should allows easy development (syntax checking, debugging,...) ● Extensible ● Generation framework – Processing DSL – Generating target source code ● Code per connector element ● Independent on a chosen target language 28.2.2008, ICCBSS 2008, Madrid 13
  • 14. DSL – ElLang basics ● Designed new DSL – Mixture of the meta-language ElLang (element language) and a target language (Java) ● Used MetaBorg method – Allows embedding language into another language ● Connecting selected nonterminals of both languages ● Meta-language ElLang (target language independent) – Meta-variables ● ${a}, ${a[index]} – Meta-queries (querying input XML) ● ${a.b.c} – Meta-statements ● $set, $if, $include, $foreach, $rforeach 28.2.2008, ICCBSS 2008, Madrid 14
  • 15. DSL – ElLang basics ● Designed new Domain Specific Language Mixture of meta-language – Recursive foreach ElLang and target language (Java) ● MetaBorg method developed by Stratego/XT group $rforeach(PORT in ${ports.port(type=PROVIDED)} )$ if (quot;${PORT.name}quot;.equals(portName)) { into another language – Allows embedding language Object Connecting selected neterminals of both languages – result = ((ElementLocalServer) subElements[${el[PORT....]}]); ● Defined via SDF if (isTopLevel) { ● Meta-language ElLang dcm.reregisterConnectorUnitReference(parentUnit, portName, result); } – Meta-variables return result; } else $recpoint$ ● ${a}, ${a[index]} $final$ throw new ElementLinkException(quot;Invalid port 'quot;+portName+quot;'.quot;); – Meta-queries $end$ ● ${a.b.c} – Meta-statements ● $set, $if, $include, $foreach, $rforeach 28.2.2008, ICCBSS 2008, Madrid 15
  • 16. DSL – ElLang advanced features ● Special meta-statements – Simple templates inheritance (extends) – Extension points ($extPoint$) ● Allow define points in a template which can be extended in a child template – Method templates ● Important for implementing component interfaces – ! component iface is not known when template is designing ! ● ElLang has to provides information about methods of an interface – ${method.name}, ${method.variables}, ... 28.2.2008, ICCBSS 2008, Madrid 16
  • 17. DSL – ElLang advanced features ● Special meta-statements element console_log extends quot;primitive_default.ellangquot; { – Simplemethod interfaceinheritance (extends) implements templates ${ports.port(name=in).signature} { template { ${method.declareReturnValue} – Extension points ($extPoint$) System.out.println(quot;method > ${method.name} < calledquot;); ● Allow define points in template which can be extended in a child template $if (method.returnVar) $ ${method.returnVar} – Method templates = this.target.${method.name}(${method.variables}); $else$ ● Important for implementing component interfaces this.target.${method.name}(${method.variables}); $end$ – ! component iface is not known when templates is designing ! ● Language shouldreturn statemene if it is needed //generates provides information about iface ${method.returnStm} methods } } – ${method.name}, ${method.variables}, ... } 28.2.2008, ICCBSS 2008, Madrid 17
  • 18. DSL – element template structure ● ElLang-J = an instance of ElLang – For generating Java code ● Connector element template: package ${package}; import org . . . runtime .* ; element console_log extends β€œprimitive_default.ellang” { public ${classname} { /* constructor */ } implements interface ElementLocalClient { public void bindElPort(String portName , Object target ) { /* ... */ } } implements interface ${ ports.port (name=line).signature} { method template { /* ... */ } } 28.2.2008, ICCBSS 2008, Madrid 18
  • 19. Generator architecture ● Java part – Prepares low-level connector configuration (L-LCC) ● Description of connector element internals – Calls source code generator implemented in Stratego ● Stratego part – Implemented in Stratego language ● In fact compiled C-source code – Generates source code ● From template written in ElLang-J ● From L-LCC passed from Java part of generator 28.2.2008, ICCBSS 2008, Madrid 19
  • 20. Stratego/XT ● Developed at Delft University of Technology, Netherlands ● Tool set – Grammar tools ● SDF – Syntax Definition Formalism ● Pretty printers ● Grammar definitions (Java, C/C++, XML, ...) – Program transformation language Stratego ● Input represented as Abstract Syntax Tree (AST) – Term representation of AST called ATerm ● Based on rewriting of AST via strategies 28.2.2008, ICCBSS 2008, Madrid 20
  • 21. Stratego/XT - architecture ● How does it work? 28.2.2008, ICCBSS 2008, Madrid 21
  • 22. Generator - Java part ● Implementing action interface – Therefore it can be used as a new action in connector element build script – Rewrites low-level connector configuration into XML and passed it to Stratego part ● Bridge between Java and Stratego: – JNI bridge – Shell bridge (execute connector generator) 28.2.2008, ICCBSS 2008, Madrid 22
  • 23. Generator – Stratego part ● Pipe line of several small transformation components – Input XML preprocessor – Template parser – Template evaluation – Target code generator – Query component ● All of them transform and produce AST 28.2.2008, ICCBSS 2008, Madrid 23
  • 24. Stratego part – query component ● Provides access to input XML (contains L-LCC) – Simple queries Γ  la XPath ● Traversing XML – ${ports.port.name} ● conditions –${ports.port(name=call).signature} ● Returns signature of port called β€œcall” ● Count operator – ${elements.element#count} ● Returns number of sub-elements 28.2.2008, ICCBSS 2008, Madrid 24
  • 25. Stratego part – evaluation component ● Pipe-line of evaluation modules – Processing extends statements – Processing imports statements – Template adjustment ● Normalization of statements with different notations – e.g. If -> If-Else ( in ATerms: If(cond,body) -> If(cond, body, [])) – Queries evaluation – Meta-statements evaluation ● Resulting AST is transformed into target code 28.2.2008, ICCBSS 2008, Madrid 25
  • 26. Evaluation ● Integrated in our SOFA component model – It works :-) ● But it is suitable for any component model – And even for non-component based systems 28.2.2008, ICCBSS 2008, Madrid 26
  • 27. Evaluation (pros and cons) ● Advantages – Simple template system allowing easy writing of connector implementations ●Generic solution ● Allows syntax checking – Extensible template language ●Allows defining new clones of ElLang in according to specified requirements (e.g. ElLang-C#) – Solutions is not invasive - proposed source code generator can be used just by modifying a build script controlling a connector generation ● Disadvantages – Stratego/XT is C-based, rest of generator is in Java 28.2.2008, ICCBSS 2008, Madrid 27
  • 28. Future work ● Byte code manipulation – To avoid need of javac (~SDK) during deployment process – Pre-compiled templates into binary form (templated bytecode) ● Fast template evaluation ● Simplifying connector implementation – Merging generated Java classes ● Implementing ElLang for other target languages (e.g. ElLang-C#) ● Simplifying method templates 28.2.2008, ICCBSS 2008, Madrid 28
  • 29. Comments & Questions Thank you for your attention! 28.2.2008, ICCBSS 2008, Madrid 29