SlideShare a Scribd company logo
walkmod
how it works
1
workflow
•All conventions are applied
with blocks of
transformations for each
source file.
•Transformations may
update the same sources or
creating/updating another
ones.
2
overview
• reader: reads the sources. i.e retrieves all files from a directory
recursively.
• walker: executes a chain of transformations for each source.
• transformation: updates or creates sources for the following
transformation.Transformations are connected like a pipe through a
shared context.
• writer: writes the sources. i.e using the eclipse formatter.
3
reader
• Reads the sources. By default, reads the folder src/main/java.
• Works with multiple include/exclude rules.
• Creates a resource object, whose content is iterated from the walker.
• Works for sources of any programming language.The resource object
could be a source folder, a parsed json file, etc..
• Is extensible. You only need to implement the reader and resource
interfaces.
4
reader configuration
<reader path="src/main/java" >
</reader>	
type="walkmod:commons:file-reader"
<param name="my1stparam">my1stvalue</param>
	 <param name="my2ndparam">my2ndvalue</param>
<include wildcard="com/my_company/**" ></include>
<exclude wildcard="com/my_company/utils/**"></exclude>
the exclude and
include rules [optional]
the reader bean
[default]
the custom
params
[optional]
5
walker
• Executes a chain of transformations for each object allocated in a
resource. i.e all java source files of an specific folder.
• merges the output produced by transformations with existent
resources.
• invokes the writer with the final (and merged) output.
• analyzes and reports which changes have been produced by the chain
of transformations in each object.
• Is extensible. You only need to implement the walker interface.
6
walker configuration
<walker root-namespace="" >		
<transformations>	 	
<transformation >
	 	 	
	 	 </transformation>
	 	
	 	 </transformations>
	 </walker>
type="walkmod:commons:java-walker"	 	
	 	 <param name="myparam">myvalue</param>
type="walkmod:commons:license-generator"
<param name="licenseFile">src/main/license-header.txt</param>
<transformation type=”walkmod:commons:import-cleaner” />
the walker
bean [default]
at least one
transformation must
be specified
the custom
params
[optional]
7
transformations
• modifies or creates objects that will be written.
• There are three ways to design a transformation. Using:
templates,
scripts,
or visitors.
8
template transformations
package ${query.resolve("node.package.name")};
public class ${query.resolve("type.name")}{
${for ( field in query.resolve("type.fields") ){
print “public ${field.type} get ${field.name}() {
return ${field.name} ;
}”;
}//end for
}
getter generator using groovy templates
9
why templates?
• Using templates is a well known practice in code generation, specially
in the backend of web applications (Velocity, JSP, freemarker..).
• Templates should be used to add code in source files.
• groovy is the default template engine.
• A set of interfaces must be implemented to work with your favorite
template engine.
10
template configuration
<!DOCTYPE walkmod PUBLIC "-//WALKMOD//DTD" "http://www.walkmod.com/dtd/walkmod-1.0.dtd">
<walkmod>
...
<transformation type="walkmod:commons:template" >
<param name="templates">
[ “src/main/groovy/dao.groovy”,
“src/main/groovy/web-services.groovy” ]
</param>
</transformation>
...
</walkmod>
<param name="templateEngine">walkmod:commons:groovy</param>
the template
engine[default]
the list of applied
templates
11
script transformations
import org.walkmod.lang.ast.body.ModifierSet;
import java.lang.reflect.Modifier;
import org.walkmod.lang.ast.body.FieldDeclaration;
for(type in node.types){	
def fields = type.members.findAll({it instanceof FieldDeclaration});
for (field in fields){
int modifiers = ModifierSet.addModifier(field.modifiers, Modifier.PRIVATE);
modifiers = ModifierSet.removeModifier(modifiers, Modifier.PROTECTED);
modifiers = ModifierSet.removeModifier(modifiers, Modifier.PUBLIC);
field.setModifiers(modifiers);
}
}
groovy script to force private fields
12
why scripts?
• Scripts allow the design of inline transformations.
• Scripts should be used to apply simple modifications in source files.
• Support for multiple languages.Those which implement the standard
Java scripting interface. i.e. groovy, javascript, python..
13
script configuration
...
<transformation type="walkmod:commons:scripting" >
<param name="language">
groovy
</param>
<param name="location">
src/main/groovy/my-script.groovy
</param>
</transformation>
...
the location of the
applied script
the default
scripting
language
14
visitor transformations
public class HelloVisitor extends VoidVisitor<VisitorContext>{
...
@Overwrite
public void visit(MethodDeclaration md, VisitorContext ctx){
//TODO
}
@Overwrite
public void visit(FieldDeclaration fd, VisitorContext ctx){
//TODO
}
...
}
15
why visitors?
• Visitors are developed and compiled in java.They allow the creation of
complex and efficient transformations.
• To include transformations as plugins to be shared inside the
community.
• Visitors should be used to apply complex modifications in source files.
16
visitor configuration
<!DOCTYPE walkmod PUBLIC "-//WALKMOD//DTD" "http://www.walkmod.com/dtd/walkmod-1.0.dtd">
<walkmod>
<plugins>
	 	 <plugin groupId="mygroupId" artifactId="myartifactId" version="versionNumber">
	 </plugin>
	 </plugins>
...
<transformation type="mygroupId:myartifactId:my-visitor" >
<param name="param1">
value1
</param>
<param name="paramN">
valueN
</param>
</transformation>
...
</walkmod>
the bean name of
the visitor
the visitor
setteable values
17
writer
• writes each object allocated in a resource. i.e all java source files of a
specific folder.
• Has include/exclude rules.
• Is extensible. You only need to implement the writer interface.
• There are useful writer implementations, such as the storage of the
contents of a toString() object method or the eclipse formatter.
18
<writer path="src/main/java" >
	 </writer>
type="walkmod:commons:eclipse-formatter"
<param name="my1stparam">my1stvalue</param>
<param name="my2ndparam">my2ndvalue</param>
<include wildcard="com/my_company/**"/>
<exclude wildcard="com/my_company/utils/**" />
writer configuration
exclude and include
rules [optional]
writer bean
[default]
custom
params
[optional]
19
thank youhttp://www.walkmod.com
20

More Related Content

What's hot

Invokedynamic / JSR-292
Invokedynamic / JSR-292Invokedynamic / JSR-292
Invokedynamic / JSR-292ytoshima
 
JavaScript 101
JavaScript 101JavaScript 101
JavaScript 101
ygv2000
 
Javascript session 01 - Introduction to Javascript
Javascript session 01 - Introduction to JavascriptJavascript session 01 - Introduction to Javascript
Javascript session 01 - Introduction to Javascript
Livingston Samuel
 
TypeScript
TypeScriptTypeScript
TypeScript
Oswald Campesato
 
Greach 2014 - Metaprogramming with groovy
Greach 2014 - Metaprogramming with groovyGreach 2014 - Metaprogramming with groovy
Greach 2014 - Metaprogramming with groovy
Iván López Martín
 
Typescript tips & tricks
Typescript tips & tricksTypescript tips & tricks
Typescript tips & tricks
Ori Calvo
 
Performance Optimization and JavaScript Best Practices
Performance Optimization and JavaScript Best PracticesPerformance Optimization and JavaScript Best Practices
Performance Optimization and JavaScript Best Practices
Doris Chen
 
WEB TECHNOLOGIES JavaScript
WEB TECHNOLOGIES JavaScriptWEB TECHNOLOGIES JavaScript
Node.js System: The Approach
Node.js System: The ApproachNode.js System: The Approach
Node.js System: The Approach
Haci Murat Yaman
 
JS - Basics
JS - BasicsJS - Basics
JS - Basics
John Fischer
 
TypeScript - Silver Bullet for the Full-stack Developers
TypeScript - Silver Bullet for the Full-stack DevelopersTypeScript - Silver Bullet for the Full-stack Developers
TypeScript - Silver Bullet for the Full-stack Developers
Rutenis Turcinas
 
JavaScript Basics and Best Practices - CC FE & UX
JavaScript Basics and Best Practices - CC FE & UXJavaScript Basics and Best Practices - CC FE & UX
JavaScript Basics and Best Practices - CC FE & UX
JWORKS powered by Ordina
 
Ppl for students unit 4 and 5
Ppl for students unit 4 and 5Ppl for students unit 4 and 5
Ppl for students unit 4 and 5Akshay Nagpurkar
 
Lambda: A Peek Under The Hood - Brian Goetz
Lambda: A Peek Under The Hood - Brian GoetzLambda: A Peek Under The Hood - Brian Goetz
Lambda: A Peek Under The Hood - Brian Goetz
JAX London
 
JavaScript - An Introduction
JavaScript - An IntroductionJavaScript - An Introduction
JavaScript - An Introduction
Manvendra Singh
 
Introduction to Javascript
Introduction to JavascriptIntroduction to Javascript
Introduction to Javascript
Amit Tyagi
 
Softshake 2013: 10 reasons why java developers are jealous of Scala developers
Softshake 2013: 10 reasons why java developers are jealous of Scala developersSoftshake 2013: 10 reasons why java developers are jealous of Scala developers
Softshake 2013: 10 reasons why java developers are jealous of Scala developers
Matthew Farwell
 
Xopus Application Framework
Xopus Application FrameworkXopus Application Framework
Xopus Application Framework
Jady Yang
 

What's hot (20)

Invokedynamic / JSR-292
Invokedynamic / JSR-292Invokedynamic / JSR-292
Invokedynamic / JSR-292
 
JavaScript 101
JavaScript 101JavaScript 101
JavaScript 101
 
Javascript session 01 - Introduction to Javascript
Javascript session 01 - Introduction to JavascriptJavascript session 01 - Introduction to Javascript
Javascript session 01 - Introduction to Javascript
 
TypeScript
TypeScriptTypeScript
TypeScript
 
Greach 2014 - Metaprogramming with groovy
Greach 2014 - Metaprogramming with groovyGreach 2014 - Metaprogramming with groovy
Greach 2014 - Metaprogramming with groovy
 
Typescript tips & tricks
Typescript tips & tricksTypescript tips & tricks
Typescript tips & tricks
 
Performance Optimization and JavaScript Best Practices
Performance Optimization and JavaScript Best PracticesPerformance Optimization and JavaScript Best Practices
Performance Optimization and JavaScript Best Practices
 
WEB TECHNOLOGIES JavaScript
WEB TECHNOLOGIES JavaScriptWEB TECHNOLOGIES JavaScript
WEB TECHNOLOGIES JavaScript
 
camel-scala.pdf
camel-scala.pdfcamel-scala.pdf
camel-scala.pdf
 
Node.js System: The Approach
Node.js System: The ApproachNode.js System: The Approach
Node.js System: The Approach
 
JS - Basics
JS - BasicsJS - Basics
JS - Basics
 
TypeScript - Silver Bullet for the Full-stack Developers
TypeScript - Silver Bullet for the Full-stack DevelopersTypeScript - Silver Bullet for the Full-stack Developers
TypeScript - Silver Bullet for the Full-stack Developers
 
Invoke dynamics
Invoke dynamicsInvoke dynamics
Invoke dynamics
 
JavaScript Basics and Best Practices - CC FE & UX
JavaScript Basics and Best Practices - CC FE & UXJavaScript Basics and Best Practices - CC FE & UX
JavaScript Basics and Best Practices - CC FE & UX
 
Ppl for students unit 4 and 5
Ppl for students unit 4 and 5Ppl for students unit 4 and 5
Ppl for students unit 4 and 5
 
Lambda: A Peek Under The Hood - Brian Goetz
Lambda: A Peek Under The Hood - Brian GoetzLambda: A Peek Under The Hood - Brian Goetz
Lambda: A Peek Under The Hood - Brian Goetz
 
JavaScript - An Introduction
JavaScript - An IntroductionJavaScript - An Introduction
JavaScript - An Introduction
 
Introduction to Javascript
Introduction to JavascriptIntroduction to Javascript
Introduction to Javascript
 
Softshake 2013: 10 reasons why java developers are jealous of Scala developers
Softshake 2013: 10 reasons why java developers are jealous of Scala developersSoftshake 2013: 10 reasons why java developers are jealous of Scala developers
Softshake 2013: 10 reasons why java developers are jealous of Scala developers
 
Xopus Application Framework
Xopus Application FrameworkXopus Application Framework
Xopus Application Framework
 

Viewers also liked

Design Patterns
Design PatternsDesign Patterns
Design Patterns
Raquel Pau
 
The Challenges & Pitfalls of Database Continuous Delivery
The Challenges & Pitfalls of Database Continuous DeliveryThe Challenges & Pitfalls of Database Continuous Delivery
The Challenges & Pitfalls of Database Continuous Delivery
Perforce
 
Challenges and best practices of database continuous delivery
Challenges and best practices of database continuous deliveryChallenges and best practices of database continuous delivery
Challenges and best practices of database continuous delivery
DBmaestro - Database DevOps
 
Patterns and Tools for Database Versioning, Migration, Data Loading and Test ...
Patterns and Tools for Database Versioning, Migration, Data Loading and Test ...Patterns and Tools for Database Versioning, Migration, Data Loading and Test ...
Patterns and Tools for Database Versioning, Migration, Data Loading and Test ...
Alan Pinstein
 
Continuous Delivery and Zero Downtime: What your architecture needs to succeed
Continuous Delivery and Zero Downtime: What your architecture needs to succeedContinuous Delivery and Zero Downtime: What your architecture needs to succeed
Continuous Delivery and Zero Downtime: What your architecture needs to succeed
Axel Fontaine
 
Database Source Control: Migrations vs State
Database Source Control: Migrations vs StateDatabase Source Control: Migrations vs State
Database Source Control: Migrations vs State
Eduardo Piairo
 
Road to database automation: database source control
Road to database automation: database source controlRoad to database automation: database source control
Road to database automation: database source control
Eduardo Piairo
 
Database version control without pain - the PHPNW10 version
Database version control without pain - the PHPNW10 versionDatabase version control without pain - the PHPNW10 version
Database version control without pain - the PHPNW10 version
Harrie Verveer
 
Flyway (33rd Degree)
Flyway (33rd Degree)Flyway (33rd Degree)
Flyway (33rd Degree)
Axel Fontaine
 
KYSUC - Keep Your Schema Under Control
KYSUC - Keep Your Schema Under ControlKYSUC - Keep Your Schema Under Control
KYSUC - Keep Your Schema Under Control
Coimbra JUG
 
Flyway
FlywayFlyway
Database migration with flyway
Database migration  with flywayDatabase migration  with flyway
Database migration with flyway
Jonathan Holloway
 
Javaland 2016 - Flyway vs. LiquiBase - Battle der Datenbankmigrationstools
Javaland 2016 - Flyway vs. LiquiBase - Battle der DatenbankmigrationstoolsJavaland 2016 - Flyway vs. LiquiBase - Battle der Datenbankmigrationstools
Javaland 2016 - Flyway vs. LiquiBase - Battle der Datenbankmigrationstools
Stephan Kaps
 
Liquibase & Flyway @ Baltic DevOps
Liquibase & Flyway @ Baltic DevOpsLiquibase & Flyway @ Baltic DevOps
Liquibase & Flyway @ Baltic DevOps
Andrei Solntsev
 
Database Schema Evolution
Database Schema EvolutionDatabase Schema Evolution
Database Schema Evolution
Lars Thorup
 
Database security issues
Database security issuesDatabase security issues
Database security issues
n|u - The Open Security Community
 
Database migrations with Flyway and Liquibase
Database migrations with Flyway and LiquibaseDatabase migrations with Flyway and Liquibase
Database migrations with Flyway and Liquibase
Lars Östling
 
Controlling Technical Debt with Continuous Delivery
Controlling Technical Debt with Continuous DeliveryControlling Technical Debt with Continuous Delivery
Controlling Technical Debt with Continuous Delivery
walkmod
 
Data quality and data profiling
Data quality and data profilingData quality and data profiling
Data quality and data profiling
Shailja Khurana
 

Viewers also liked (19)

Design Patterns
Design PatternsDesign Patterns
Design Patterns
 
The Challenges & Pitfalls of Database Continuous Delivery
The Challenges & Pitfalls of Database Continuous DeliveryThe Challenges & Pitfalls of Database Continuous Delivery
The Challenges & Pitfalls of Database Continuous Delivery
 
Challenges and best practices of database continuous delivery
Challenges and best practices of database continuous deliveryChallenges and best practices of database continuous delivery
Challenges and best practices of database continuous delivery
 
Patterns and Tools for Database Versioning, Migration, Data Loading and Test ...
Patterns and Tools for Database Versioning, Migration, Data Loading and Test ...Patterns and Tools for Database Versioning, Migration, Data Loading and Test ...
Patterns and Tools for Database Versioning, Migration, Data Loading and Test ...
 
Continuous Delivery and Zero Downtime: What your architecture needs to succeed
Continuous Delivery and Zero Downtime: What your architecture needs to succeedContinuous Delivery and Zero Downtime: What your architecture needs to succeed
Continuous Delivery and Zero Downtime: What your architecture needs to succeed
 
Database Source Control: Migrations vs State
Database Source Control: Migrations vs StateDatabase Source Control: Migrations vs State
Database Source Control: Migrations vs State
 
Road to database automation: database source control
Road to database automation: database source controlRoad to database automation: database source control
Road to database automation: database source control
 
Database version control without pain - the PHPNW10 version
Database version control without pain - the PHPNW10 versionDatabase version control without pain - the PHPNW10 version
Database version control without pain - the PHPNW10 version
 
Flyway (33rd Degree)
Flyway (33rd Degree)Flyway (33rd Degree)
Flyway (33rd Degree)
 
KYSUC - Keep Your Schema Under Control
KYSUC - Keep Your Schema Under ControlKYSUC - Keep Your Schema Under Control
KYSUC - Keep Your Schema Under Control
 
Flyway
FlywayFlyway
Flyway
 
Database migration with flyway
Database migration  with flywayDatabase migration  with flyway
Database migration with flyway
 
Javaland 2016 - Flyway vs. LiquiBase - Battle der Datenbankmigrationstools
Javaland 2016 - Flyway vs. LiquiBase - Battle der DatenbankmigrationstoolsJavaland 2016 - Flyway vs. LiquiBase - Battle der Datenbankmigrationstools
Javaland 2016 - Flyway vs. LiquiBase - Battle der Datenbankmigrationstools
 
Liquibase & Flyway @ Baltic DevOps
Liquibase & Flyway @ Baltic DevOpsLiquibase & Flyway @ Baltic DevOps
Liquibase & Flyway @ Baltic DevOps
 
Database Schema Evolution
Database Schema EvolutionDatabase Schema Evolution
Database Schema Evolution
 
Database security issues
Database security issuesDatabase security issues
Database security issues
 
Database migrations with Flyway and Liquibase
Database migrations with Flyway and LiquibaseDatabase migrations with Flyway and Liquibase
Database migrations with Flyway and Liquibase
 
Controlling Technical Debt with Continuous Delivery
Controlling Technical Debt with Continuous DeliveryControlling Technical Debt with Continuous Delivery
Controlling Technical Debt with Continuous Delivery
 
Data quality and data profiling
Data quality and data profilingData quality and data profiling
Data quality and data profiling
 

Similar to walkmod: how it works

Struts2-Spring=Hibernate
Struts2-Spring=HibernateStruts2-Spring=Hibernate
Struts2-Spring=Hibernate
Jay Shah
 
Knolx session
Knolx sessionKnolx session
Knolx session
Knoldus Inc.
 
DevOps Odessa #TechTalks 21.01.2020
DevOps Odessa #TechTalks 21.01.2020DevOps Odessa #TechTalks 21.01.2020
DevOps Odessa #TechTalks 21.01.2020
Lohika_Odessa_TechTalks
 
CouchDB for Web Applications - Erlang Factory London 2009
CouchDB for Web Applications - Erlang Factory London 2009CouchDB for Web Applications - Erlang Factory London 2009
CouchDB for Web Applications - Erlang Factory London 2009
Jason Davies
 
ADP - Chapter 2 Exploring the java Servlet Technology
ADP - Chapter 2 Exploring the java Servlet TechnologyADP - Chapter 2 Exploring the java Servlet Technology
ADP - Chapter 2 Exploring the java Servlet Technology
Riza Nurman
 
Servlets 3.0 - Asynchronous, Easy, Extensible @ Silicon Valley Code Camp 2010
Servlets 3.0 - Asynchronous, Easy, Extensible @ Silicon Valley Code Camp 2010Servlets 3.0 - Asynchronous, Easy, Extensible @ Silicon Valley Code Camp 2010
Servlets 3.0 - Asynchronous, Easy, Extensible @ Silicon Valley Code Camp 2010
Arun Gupta
 
15 darwino script & command line
15   darwino script & command line15   darwino script & command line
15 darwino script & command line
darwinodb
 
Java >= 9
Java >= 9Java >= 9
Java >= 9
Benjamin Pack
 
Ecto and Phoenix: Doing web with Elixir - Yurii Bodarev
Ecto and Phoenix: Doing web with Elixir - Yurii BodarevEcto and Phoenix: Doing web with Elixir - Yurii Bodarev
Ecto and Phoenix: Doing web with Elixir - Yurii Bodarev
Elixir Club
 
Ecto and Phoenix: Doing Web With Elixir
Ecto and Phoenix: Doing Web With ElixirEcto and Phoenix: Doing Web With Elixir
Ecto and Phoenix: Doing Web With Elixir
Yurii Bodarev
 
Rails Engine | Modular application
Rails Engine | Modular applicationRails Engine | Modular application
Rails Engine | Modular application
mirrec
 
Jruby synergy-of-ruby-and-java
Jruby synergy-of-ruby-and-javaJruby synergy-of-ruby-and-java
Jruby synergy-of-ruby-and-javaKeith Bennett
 
CS8392 OOP
CS8392 OOPCS8392 OOP
JavaScript and jQuery for SharePoint Developers
JavaScript and jQuery for SharePoint DevelopersJavaScript and jQuery for SharePoint Developers
JavaScript and jQuery for SharePoint Developers
Rob Windsor
 
Play Framework
Play FrameworkPlay Framework
Play Framework
Harinath Krishnamoorthy
 
JavaOne 2017 CON3282 - Code Generation with Annotation Processors: State of t...
JavaOne 2017 CON3282 - Code Generation with Annotation Processors: State of t...JavaOne 2017 CON3282 - Code Generation with Annotation Processors: State of t...
JavaOne 2017 CON3282 - Code Generation with Annotation Processors: State of t...
Jorge Hidalgo
 
Server Side Javascript
Server Side JavascriptServer Side Javascript
Server Side Javascriptrajivmordani
 
Staying Sane with Drupal NEPHP
Staying Sane with Drupal NEPHPStaying Sane with Drupal NEPHP
Staying Sane with Drupal NEPHP
Oscar Merida
 
oop unit1.pptx
oop unit1.pptxoop unit1.pptx
oop unit1.pptx
sureshkumara29
 
JUDCon 2010 Boston : TorqueBox
JUDCon 2010 Boston : TorqueBoxJUDCon 2010 Boston : TorqueBox
JUDCon 2010 Boston : TorqueBox
marekgoldmann
 

Similar to walkmod: how it works (20)

Struts2-Spring=Hibernate
Struts2-Spring=HibernateStruts2-Spring=Hibernate
Struts2-Spring=Hibernate
 
Knolx session
Knolx sessionKnolx session
Knolx session
 
DevOps Odessa #TechTalks 21.01.2020
DevOps Odessa #TechTalks 21.01.2020DevOps Odessa #TechTalks 21.01.2020
DevOps Odessa #TechTalks 21.01.2020
 
CouchDB for Web Applications - Erlang Factory London 2009
CouchDB for Web Applications - Erlang Factory London 2009CouchDB for Web Applications - Erlang Factory London 2009
CouchDB for Web Applications - Erlang Factory London 2009
 
ADP - Chapter 2 Exploring the java Servlet Technology
ADP - Chapter 2 Exploring the java Servlet TechnologyADP - Chapter 2 Exploring the java Servlet Technology
ADP - Chapter 2 Exploring the java Servlet Technology
 
Servlets 3.0 - Asynchronous, Easy, Extensible @ Silicon Valley Code Camp 2010
Servlets 3.0 - Asynchronous, Easy, Extensible @ Silicon Valley Code Camp 2010Servlets 3.0 - Asynchronous, Easy, Extensible @ Silicon Valley Code Camp 2010
Servlets 3.0 - Asynchronous, Easy, Extensible @ Silicon Valley Code Camp 2010
 
15 darwino script & command line
15   darwino script & command line15   darwino script & command line
15 darwino script & command line
 
Java >= 9
Java >= 9Java >= 9
Java >= 9
 
Ecto and Phoenix: Doing web with Elixir - Yurii Bodarev
Ecto and Phoenix: Doing web with Elixir - Yurii BodarevEcto and Phoenix: Doing web with Elixir - Yurii Bodarev
Ecto and Phoenix: Doing web with Elixir - Yurii Bodarev
 
Ecto and Phoenix: Doing Web With Elixir
Ecto and Phoenix: Doing Web With ElixirEcto and Phoenix: Doing Web With Elixir
Ecto and Phoenix: Doing Web With Elixir
 
Rails Engine | Modular application
Rails Engine | Modular applicationRails Engine | Modular application
Rails Engine | Modular application
 
Jruby synergy-of-ruby-and-java
Jruby synergy-of-ruby-and-javaJruby synergy-of-ruby-and-java
Jruby synergy-of-ruby-and-java
 
CS8392 OOP
CS8392 OOPCS8392 OOP
CS8392 OOP
 
JavaScript and jQuery for SharePoint Developers
JavaScript and jQuery for SharePoint DevelopersJavaScript and jQuery for SharePoint Developers
JavaScript and jQuery for SharePoint Developers
 
Play Framework
Play FrameworkPlay Framework
Play Framework
 
JavaOne 2017 CON3282 - Code Generation with Annotation Processors: State of t...
JavaOne 2017 CON3282 - Code Generation with Annotation Processors: State of t...JavaOne 2017 CON3282 - Code Generation with Annotation Processors: State of t...
JavaOne 2017 CON3282 - Code Generation with Annotation Processors: State of t...
 
Server Side Javascript
Server Side JavascriptServer Side Javascript
Server Side Javascript
 
Staying Sane with Drupal NEPHP
Staying Sane with Drupal NEPHPStaying Sane with Drupal NEPHP
Staying Sane with Drupal NEPHP
 
oop unit1.pptx
oop unit1.pptxoop unit1.pptx
oop unit1.pptx
 
JUDCon 2010 Boston : TorqueBox
JUDCon 2010 Boston : TorqueBoxJUDCon 2010 Boston : TorqueBox
JUDCon 2010 Boston : TorqueBox
 

Recently uploaded

GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
James Anderson
 
FIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdf
FIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdfFIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdf
FIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdf
FIDO Alliance
 
Assuring Contact Center Experiences for Your Customers With ThousandEyes
Assuring Contact Center Experiences for Your Customers With ThousandEyesAssuring Contact Center Experiences for Your Customers With ThousandEyes
Assuring Contact Center Experiences for Your Customers With ThousandEyes
ThousandEyes
 
FIDO Alliance Osaka Seminar: Overview.pdf
FIDO Alliance Osaka Seminar: Overview.pdfFIDO Alliance Osaka Seminar: Overview.pdf
FIDO Alliance Osaka Seminar: Overview.pdf
FIDO Alliance
 
Knowledge engineering: from people to machines and back
Knowledge engineering: from people to machines and backKnowledge engineering: from people to machines and back
Knowledge engineering: from people to machines and back
Elena Simperl
 
The Art of the Pitch: WordPress Relationships and Sales
The Art of the Pitch: WordPress Relationships and SalesThe Art of the Pitch: WordPress Relationships and Sales
The Art of the Pitch: WordPress Relationships and Sales
Laura Byrne
 
Software Delivery At the Speed of AI: Inflectra Invests In AI-Powered Quality
Software Delivery At the Speed of AI: Inflectra Invests In AI-Powered QualitySoftware Delivery At the Speed of AI: Inflectra Invests In AI-Powered Quality
Software Delivery At the Speed of AI: Inflectra Invests In AI-Powered Quality
Inflectra
 
Smart TV Buyer Insights Survey 2024 by 91mobiles.pdf
Smart TV Buyer Insights Survey 2024 by 91mobiles.pdfSmart TV Buyer Insights Survey 2024 by 91mobiles.pdf
Smart TV Buyer Insights Survey 2024 by 91mobiles.pdf
91mobiles
 
Key Trends Shaping the Future of Infrastructure.pdf
Key Trends Shaping the Future of Infrastructure.pdfKey Trends Shaping the Future of Infrastructure.pdf
Key Trends Shaping the Future of Infrastructure.pdf
Cheryl Hung
 
UiPath Test Automation using UiPath Test Suite series, part 3
UiPath Test Automation using UiPath Test Suite series, part 3UiPath Test Automation using UiPath Test Suite series, part 3
UiPath Test Automation using UiPath Test Suite series, part 3
DianaGray10
 
Monitoring Java Application Security with JDK Tools and JFR Events
Monitoring Java Application Security with JDK Tools and JFR EventsMonitoring Java Application Security with JDK Tools and JFR Events
Monitoring Java Application Security with JDK Tools and JFR Events
Ana-Maria Mihalceanu
 
AI for Every Business: Unlocking Your Product's Universal Potential by VP of ...
AI for Every Business: Unlocking Your Product's Universal Potential by VP of ...AI for Every Business: Unlocking Your Product's Universal Potential by VP of ...
AI for Every Business: Unlocking Your Product's Universal Potential by VP of ...
Product School
 
Generating a custom Ruby SDK for your web service or Rails API using Smithy
Generating a custom Ruby SDK for your web service or Rails API using SmithyGenerating a custom Ruby SDK for your web service or Rails API using Smithy
Generating a custom Ruby SDK for your web service or Rails API using Smithy
g2nightmarescribd
 
When stars align: studies in data quality, knowledge graphs, and machine lear...
When stars align: studies in data quality, knowledge graphs, and machine lear...When stars align: studies in data quality, knowledge graphs, and machine lear...
When stars align: studies in data quality, knowledge graphs, and machine lear...
Elena Simperl
 
To Graph or Not to Graph Knowledge Graph Architectures and LLMs
To Graph or Not to Graph Knowledge Graph Architectures and LLMsTo Graph or Not to Graph Knowledge Graph Architectures and LLMs
To Graph or Not to Graph Knowledge Graph Architectures and LLMs
Paul Groth
 
Epistemic Interaction - tuning interfaces to provide information for AI support
Epistemic Interaction - tuning interfaces to provide information for AI supportEpistemic Interaction - tuning interfaces to provide information for AI support
Epistemic Interaction - tuning interfaces to provide information for AI support
Alan Dix
 
GraphRAG is All You need? LLM & Knowledge Graph
GraphRAG is All You need? LLM & Knowledge GraphGraphRAG is All You need? LLM & Knowledge Graph
GraphRAG is All You need? LLM & Knowledge Graph
Guy Korland
 
Elevating Tactical DDD Patterns Through Object Calisthenics
Elevating Tactical DDD Patterns Through Object CalisthenicsElevating Tactical DDD Patterns Through Object Calisthenics
Elevating Tactical DDD Patterns Through Object Calisthenics
Dorra BARTAGUIZ
 
Leading Change strategies and insights for effective change management pdf 1.pdf
Leading Change strategies and insights for effective change management pdf 1.pdfLeading Change strategies and insights for effective change management pdf 1.pdf
Leading Change strategies and insights for effective change management pdf 1.pdf
OnBoard
 
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...
DanBrown980551
 

Recently uploaded (20)

GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
 
FIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdf
FIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdfFIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdf
FIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdf
 
Assuring Contact Center Experiences for Your Customers With ThousandEyes
Assuring Contact Center Experiences for Your Customers With ThousandEyesAssuring Contact Center Experiences for Your Customers With ThousandEyes
Assuring Contact Center Experiences for Your Customers With ThousandEyes
 
FIDO Alliance Osaka Seminar: Overview.pdf
FIDO Alliance Osaka Seminar: Overview.pdfFIDO Alliance Osaka Seminar: Overview.pdf
FIDO Alliance Osaka Seminar: Overview.pdf
 
Knowledge engineering: from people to machines and back
Knowledge engineering: from people to machines and backKnowledge engineering: from people to machines and back
Knowledge engineering: from people to machines and back
 
The Art of the Pitch: WordPress Relationships and Sales
The Art of the Pitch: WordPress Relationships and SalesThe Art of the Pitch: WordPress Relationships and Sales
The Art of the Pitch: WordPress Relationships and Sales
 
Software Delivery At the Speed of AI: Inflectra Invests In AI-Powered Quality
Software Delivery At the Speed of AI: Inflectra Invests In AI-Powered QualitySoftware Delivery At the Speed of AI: Inflectra Invests In AI-Powered Quality
Software Delivery At the Speed of AI: Inflectra Invests In AI-Powered Quality
 
Smart TV Buyer Insights Survey 2024 by 91mobiles.pdf
Smart TV Buyer Insights Survey 2024 by 91mobiles.pdfSmart TV Buyer Insights Survey 2024 by 91mobiles.pdf
Smart TV Buyer Insights Survey 2024 by 91mobiles.pdf
 
Key Trends Shaping the Future of Infrastructure.pdf
Key Trends Shaping the Future of Infrastructure.pdfKey Trends Shaping the Future of Infrastructure.pdf
Key Trends Shaping the Future of Infrastructure.pdf
 
UiPath Test Automation using UiPath Test Suite series, part 3
UiPath Test Automation using UiPath Test Suite series, part 3UiPath Test Automation using UiPath Test Suite series, part 3
UiPath Test Automation using UiPath Test Suite series, part 3
 
Monitoring Java Application Security with JDK Tools and JFR Events
Monitoring Java Application Security with JDK Tools and JFR EventsMonitoring Java Application Security with JDK Tools and JFR Events
Monitoring Java Application Security with JDK Tools and JFR Events
 
AI for Every Business: Unlocking Your Product's Universal Potential by VP of ...
AI for Every Business: Unlocking Your Product's Universal Potential by VP of ...AI for Every Business: Unlocking Your Product's Universal Potential by VP of ...
AI for Every Business: Unlocking Your Product's Universal Potential by VP of ...
 
Generating a custom Ruby SDK for your web service or Rails API using Smithy
Generating a custom Ruby SDK for your web service or Rails API using SmithyGenerating a custom Ruby SDK for your web service or Rails API using Smithy
Generating a custom Ruby SDK for your web service or Rails API using Smithy
 
When stars align: studies in data quality, knowledge graphs, and machine lear...
When stars align: studies in data quality, knowledge graphs, and machine lear...When stars align: studies in data quality, knowledge graphs, and machine lear...
When stars align: studies in data quality, knowledge graphs, and machine lear...
 
To Graph or Not to Graph Knowledge Graph Architectures and LLMs
To Graph or Not to Graph Knowledge Graph Architectures and LLMsTo Graph or Not to Graph Knowledge Graph Architectures and LLMs
To Graph or Not to Graph Knowledge Graph Architectures and LLMs
 
Epistemic Interaction - tuning interfaces to provide information for AI support
Epistemic Interaction - tuning interfaces to provide information for AI supportEpistemic Interaction - tuning interfaces to provide information for AI support
Epistemic Interaction - tuning interfaces to provide information for AI support
 
GraphRAG is All You need? LLM & Knowledge Graph
GraphRAG is All You need? LLM & Knowledge GraphGraphRAG is All You need? LLM & Knowledge Graph
GraphRAG is All You need? LLM & Knowledge Graph
 
Elevating Tactical DDD Patterns Through Object Calisthenics
Elevating Tactical DDD Patterns Through Object CalisthenicsElevating Tactical DDD Patterns Through Object Calisthenics
Elevating Tactical DDD Patterns Through Object Calisthenics
 
Leading Change strategies and insights for effective change management pdf 1.pdf
Leading Change strategies and insights for effective change management pdf 1.pdfLeading Change strategies and insights for effective change management pdf 1.pdf
Leading Change strategies and insights for effective change management pdf 1.pdf
 
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...
 

walkmod: how it works

  • 2. workflow •All conventions are applied with blocks of transformations for each source file. •Transformations may update the same sources or creating/updating another ones. 2
  • 3. overview • reader: reads the sources. i.e retrieves all files from a directory recursively. • walker: executes a chain of transformations for each source. • transformation: updates or creates sources for the following transformation.Transformations are connected like a pipe through a shared context. • writer: writes the sources. i.e using the eclipse formatter. 3
  • 4. reader • Reads the sources. By default, reads the folder src/main/java. • Works with multiple include/exclude rules. • Creates a resource object, whose content is iterated from the walker. • Works for sources of any programming language.The resource object could be a source folder, a parsed json file, etc.. • Is extensible. You only need to implement the reader and resource interfaces. 4
  • 5. reader configuration <reader path="src/main/java" > </reader> type="walkmod:commons:file-reader" <param name="my1stparam">my1stvalue</param> <param name="my2ndparam">my2ndvalue</param> <include wildcard="com/my_company/**" ></include> <exclude wildcard="com/my_company/utils/**"></exclude> the exclude and include rules [optional] the reader bean [default] the custom params [optional] 5
  • 6. walker • Executes a chain of transformations for each object allocated in a resource. i.e all java source files of an specific folder. • merges the output produced by transformations with existent resources. • invokes the writer with the final (and merged) output. • analyzes and reports which changes have been produced by the chain of transformations in each object. • Is extensible. You only need to implement the walker interface. 6
  • 7. walker configuration <walker root-namespace="" > <transformations> <transformation > </transformation> </transformations> </walker> type="walkmod:commons:java-walker" <param name="myparam">myvalue</param> type="walkmod:commons:license-generator" <param name="licenseFile">src/main/license-header.txt</param> <transformation type=”walkmod:commons:import-cleaner” /> the walker bean [default] at least one transformation must be specified the custom params [optional] 7
  • 8. transformations • modifies or creates objects that will be written. • There are three ways to design a transformation. Using: templates, scripts, or visitors. 8
  • 9. template transformations package ${query.resolve("node.package.name")}; public class ${query.resolve("type.name")}{ ${for ( field in query.resolve("type.fields") ){ print “public ${field.type} get ${field.name}() { return ${field.name} ; }”; }//end for } getter generator using groovy templates 9
  • 10. why templates? • Using templates is a well known practice in code generation, specially in the backend of web applications (Velocity, JSP, freemarker..). • Templates should be used to add code in source files. • groovy is the default template engine. • A set of interfaces must be implemented to work with your favorite template engine. 10
  • 11. template configuration <!DOCTYPE walkmod PUBLIC "-//WALKMOD//DTD" "http://www.walkmod.com/dtd/walkmod-1.0.dtd"> <walkmod> ... <transformation type="walkmod:commons:template" > <param name="templates"> [ “src/main/groovy/dao.groovy”, “src/main/groovy/web-services.groovy” ] </param> </transformation> ... </walkmod> <param name="templateEngine">walkmod:commons:groovy</param> the template engine[default] the list of applied templates 11
  • 12. script transformations import org.walkmod.lang.ast.body.ModifierSet; import java.lang.reflect.Modifier; import org.walkmod.lang.ast.body.FieldDeclaration; for(type in node.types){ def fields = type.members.findAll({it instanceof FieldDeclaration}); for (field in fields){ int modifiers = ModifierSet.addModifier(field.modifiers, Modifier.PRIVATE); modifiers = ModifierSet.removeModifier(modifiers, Modifier.PROTECTED); modifiers = ModifierSet.removeModifier(modifiers, Modifier.PUBLIC); field.setModifiers(modifiers); } } groovy script to force private fields 12
  • 13. why scripts? • Scripts allow the design of inline transformations. • Scripts should be used to apply simple modifications in source files. • Support for multiple languages.Those which implement the standard Java scripting interface. i.e. groovy, javascript, python.. 13
  • 14. script configuration ... <transformation type="walkmod:commons:scripting" > <param name="language"> groovy </param> <param name="location"> src/main/groovy/my-script.groovy </param> </transformation> ... the location of the applied script the default scripting language 14
  • 15. visitor transformations public class HelloVisitor extends VoidVisitor<VisitorContext>{ ... @Overwrite public void visit(MethodDeclaration md, VisitorContext ctx){ //TODO } @Overwrite public void visit(FieldDeclaration fd, VisitorContext ctx){ //TODO } ... } 15
  • 16. why visitors? • Visitors are developed and compiled in java.They allow the creation of complex and efficient transformations. • To include transformations as plugins to be shared inside the community. • Visitors should be used to apply complex modifications in source files. 16
  • 17. visitor configuration <!DOCTYPE walkmod PUBLIC "-//WALKMOD//DTD" "http://www.walkmod.com/dtd/walkmod-1.0.dtd"> <walkmod> <plugins> <plugin groupId="mygroupId" artifactId="myartifactId" version="versionNumber"> </plugin> </plugins> ... <transformation type="mygroupId:myartifactId:my-visitor" > <param name="param1"> value1 </param> <param name="paramN"> valueN </param> </transformation> ... </walkmod> the bean name of the visitor the visitor setteable values 17
  • 18. writer • writes each object allocated in a resource. i.e all java source files of a specific folder. • Has include/exclude rules. • Is extensible. You only need to implement the writer interface. • There are useful writer implementations, such as the storage of the contents of a toString() object method or the eclipse formatter. 18
  • 19. <writer path="src/main/java" > </writer> type="walkmod:commons:eclipse-formatter" <param name="my1stparam">my1stvalue</param> <param name="my2ndparam">my2ndvalue</param> <include wildcard="com/my_company/**"/> <exclude wildcard="com/my_company/utils/**" /> writer configuration exclude and include rules [optional] writer bean [default] custom params [optional] 19